/**
 * Persisted wallet sync-state store.
 *
 * Saves and loads encrypted snapshots of `serializeState()` output for the
 * three wallet sub-wallets (shielded / unshielded / dust). Persisting these
 * lets a server restart resume an existing wallet via `XxxWallet.restore(...)`
 * instead of paying the multi-hour fresh chain scan from genesis.
 *
 * Format: each blob is the SDK's `serializeState()` output, a JSON-ish text
 * string, encrypted via storage-encryption.ts (AES-256-GCM, same wire format
 * as PrivateStates.ciphertext). Strings stay as strings end-to-end — feeding
 * a Uint8Array back into `restore(...)` makes the SDK's Effect/Either
 * deserializer fail with `Either.getOrThrow called on a Left`.
 *
 * DB layer: standard CAP `cds.connect.to('db').run(...)`. The wallet SDK no
 * longer blocks the main thread's microtask queue because it runs in a
 * `worker_threads` worker, so CAP's Promise machinery resolves normally.
 * See `srv/midnight/wallet-worker.ts` and `wallet-worker-client.ts`.
 *
 * Concurrency: a per-accountId in-process mutex serializes saves so two
 * overlapping ticks can't race the upsert.
 */
/**
 * Wallet sub-state blobs from `serializeState()`. SDK returns strings; pass
 * them back to `restore(...)` unchanged.
 */
export interface SerializedWalletStates {
    shielded?: string | null;
    unshielded?: string | null;
    dust?: string | null;
}
export interface SaveSyncStateArgs {
    accountId: string;
    passphrase: string;
    sdkVersion: string;
    states: SerializedWalletStates;
}
export interface LoadSyncStateArgs {
    accountId: string;
    passphrase: string;
    expectedSdkVersion: string;
}
export interface LoadedSyncState {
    shielded?: string;
    unshielded?: string;
    dust?: string;
}
/**
 * Encrypts (if non-null) and persists the wallet sub-states.
 *
 * Idempotent per (accountId): a row is upserted by primary key. Concurrent
 * saves for the same accountId are serialised via the in-process mutex so
 * later writes always win.
 */
export declare function saveSyncState(args: SaveSyncStateArgs): Promise<void>;
/**
 * Loads and decrypts persisted sub-states for an account.
 *
 * Returns `null` when:
 *   - no row exists
 *   - the stored `sdkVersion` doesn't match `expectedSdkVersion`
 *   - decryption of any non-null blob fails (wrong passphrase, corruption)
 *
 * A null return triggers the caller to fall back to a fresh `startWith*()`
 * sync from genesis.
 */
export declare function loadSyncState(args: LoadSyncStateArgs): Promise<LoadedSyncState | null>;
/** Removes any persisted state for an account (e.g. on disconnectWallet). */
export declare function deleteSyncState(accountId: string): Promise<void>;
export declare function getWalletSdkVersion(): string;
/** Test-only: reset the cached db promise so each test gets a fresh handle. */
export declare function __resetDbHandleForTests(): void;
