import { S as StorageAdapter, a as MerkleTreeState, M as MerkleNodeRecord, E as EntryMemoRecord, L as ListEntryMemosQuery, b as EntryNullifierRecord, c as ListEntryNullifiersQuery, d as SyncCursor, U as UtxoRecord, e as ListUtxosQuery, H as Hex, O as OperationType, f as StoredOperation, g as OperationDetailFor, h as OperationStatus, i as ListOperationsQuery, J as MerkleLeafRecord } from './index-CI7UllxU.js';
export { A as App_ABI, j as AssetOverrideEntry, k as AssetsOverride, B as BABYJUBJUB_SCALAR_FIELD, l as BASE_DEV, m as BASE_MAINNET, n as BSC_DEV, o as BSC_MAINNET, p as BSC_TESTNET, q as BSC_TESTNET_DEV, C as ChainConfigInput, r as CommitmentData, s as CryptoToolkit, D as DepositOperation, t as DepositOperationDetail, u as DummyFactory, v as ETH_DEV, w as ETH_MAINNET, K as KeyManager, x as KeyValueClient, y as KeyValueStore, z as KeyValueStoreOptions, F as LedgerInfo, G as MemoKit, I as MemoryStore, N as OCashSdk, P as OCashSdkConfig, Q as OperationCreateInput, R as OpsApi, T as PlannerEstimateTransferResult, V as PlannerEstimateWithdrawResult, W as ProofResult, X as RedisStore, Y as RedisStoreOptions, Z as RelayerRequest, _ as SEPOLIA_DEV, $ as SEPOLIA_TESTNET, a0 as SdkEvent, a1 as SyncChainStatus, a2 as TokenMetadata, a3 as TransactionReceipt, a4 as TransferOperation, a5 as TransferOperationDetail, a6 as TransferWitnessInput, a7 as Utils, a8 as WalletSessionInput, a9 as WithdrawOperation, aa as WithdrawOperationDetail, ab as WithdrawWitnessInput, ac as WitnessBuildResult, ad as WitnessContext, ae as assertChainConfigInput, af as assertTokenList, ag as assertTokenMetadata, ah as calcTransferProofBinding, ai as calcWithdrawProofBinding, aj as createSdk, ak as default, al as defaultAssetsOverrideMainnet, am as defaultAssetsOverrideTestnet, an as fetchPoolTokensFromContract, ao as normalizeTokenMetadata } from './index-CI7UllxU.js';
import 'viem';

type FileStoreOptions = {
    baseDir: string;
    maxOperations?: number;
};
/**
 * JSON-file backed StorageAdapter for Node environments.
 * Persists wallet state and shared merkle/entry cache to disk.
 */
declare class FileStore implements StorageAdapter {
    private readonly options;
    private walletId;
    private readonly cursors;
    private readonly utxos;
    private operations;
    private merkleTrees;
    private merkleNodes;
    private entryMemos;
    private entryNullifiers;
    private saveChain;
    private readonly maxOperations;
    private readonly merkleNextCid;
    /**
     * Create a FileStore with a base directory and optional limits.
     */
    constructor(options: FileStoreOptions);
    private samePlainRecord;
    /**
     * Initialize store for a wallet id and load from disk.
     */
    init(options?: {
        walletId?: string;
    }): Promise<void>;
    /**
     * Flush pending state to disk.
     */
    close(): Promise<void>;
    /**
     * Compute the primary JSON state file path for the current wallet id.
     */
    private filePath;
    /**
     * Compute the shared JSON state file path for chain-level caches.
     */
    private sharedFilePath;
    /**
     * Compute the shared merkle leaves jsonl file path for a chain.
     */
    private merkleFilePath;
    private readMerkleFile;
    /**
     * Infer the next merkle cid from the tail of the jsonl file.
     */
    private getMerkleNextCid;
    /**
     * Load persisted state from disk into memory.
     */
    private load;
    /**
     * Persist wallet-scoped state to disk using a temp file swap.
     */
    private saveWallet;
    /**
     * Persist shared chain-scoped state to disk using a temp file swap.
     */
    private saveShared;
    /**
     * Get persisted merkle tree metadata for a chain.
     */
    getMerkleTree(chainId: number): Promise<MerkleTreeState | undefined>;
    /**
     * Persist merkle tree metadata for a chain.
     */
    setMerkleTree(chainId: number, tree: MerkleTreeState): Promise<void>;
    /**
     * Clear merkle tree metadata for a chain.
     */
    clearMerkleTree(chainId: number): Promise<void>;
    /**
     * Get a merkle node by id.
     */
    getMerkleNode(chainId: number, id: string): Promise<MerkleNodeRecord | undefined>;
    /**
     * Upsert merkle nodes for a chain and persist.
     */
    upsertMerkleNodes(chainId: number, nodes: MerkleNodeRecord[]): Promise<void>;
    /**
     * Clear merkle nodes for a chain.
     */
    clearMerkleNodes(chainId: number): Promise<void>;
    /**
     * Upsert entry memos (raw EntryService cache) and persist.
     */
    upsertEntryMemos(memos: EntryMemoRecord[]): Promise<void>;
    /**
     * List entry memos with query filtering and pagination.
     */
    listEntryMemos(query: ListEntryMemosQuery): Promise<{
        total: number;
        rows: EntryMemoRecord[];
    }>;
    /**
     * Clear entry memo cache for a chain.
     */
    clearEntryMemos(chainId: number): Promise<void>;
    /**
     * Upsert entry nullifiers (raw EntryService cache) and persist.
     */
    upsertEntryNullifiers(nullifiers: EntryNullifierRecord[]): Promise<void>;
    /**
     * List entry nullifiers with query filtering and pagination.
     */
    listEntryNullifiers(query: ListEntryNullifiersQuery): Promise<{
        total: number;
        rows: EntryNullifierRecord[];
    }>;
    /**
     * Clear entry nullifier cache for a chain.
     */
    clearEntryNullifiers(chainId: number): Promise<void>;
    /**
     * Get persisted sync cursor for a chain.
     */
    getSyncCursor(chainId: number): Promise<SyncCursor | undefined>;
    /**
     * Set persisted sync cursor for a chain.
     */
    setSyncCursor(chainId: number, cursor: SyncCursor): Promise<void>;
    /**
     * Upsert UTXOs and persist.
     */
    upsertUtxos(utxos: UtxoRecord[]): Promise<void>;
    /**
     * List UTXOs with query filtering and pagination.
     */
    listUtxos(query?: ListUtxosQuery): Promise<{
        total: number;
        rows: UtxoRecord[];
    }>;
    /**
     * Mark UTXOs as spent by nullifier and persist.
     */
    markSpent(input: {
        chainId: number;
        nullifiers: Hex[];
    }): Promise<number>;
    /**
     * Load merkle leaves from jsonl file.
     */
    getMerkleLeaves(chainId: number): Promise<Array<{
        cid: number;
        commitment: Hex;
    }> | undefined>;
    /**
     * Get a merkle leaf by cid (loads full list then indexes).
     */
    getMerkleLeaf(chainId: number, cid: number): Promise<{
        chainId: number;
        cid: number;
        commitment: `0x${string}`;
    } | undefined>;
    /**
     * Append contiguous merkle leaves to jsonl file.
     */
    appendMerkleLeaves(chainId: number, leaves: Array<{
        cid: number;
        commitment: Hex;
    }>): Promise<void>;
    /**
     * Delete merkle leaves jsonl file for a chain.
     */
    clearMerkleLeaves(chainId: number): Promise<void>;
    /**
     * Create and persist an operation record.
     */
    createOperation<TType extends OperationType>(input: Omit<StoredOperation<OperationDetailFor<TType>>, 'id' | 'createdAt' | 'status'> & Partial<Pick<StoredOperation<OperationDetailFor<TType>>, 'createdAt' | 'id' | 'status'>> & {
        type: TType;
    }): {
        id: string;
        createdAt: number;
        status: OperationStatus;
        type: OperationType & TType;
        chainId?: number | undefined;
        tokenId?: string | undefined;
        requestUrl?: string | undefined;
        relayerTxHash?: `0x${string}` | undefined;
        txHash?: `0x${string}` | undefined;
        detail?: OperationDetailFor<TType> | undefined;
        error?: string | undefined;
    };
    /**
     * Update an operation record and persist.
     */
    updateOperation(id: string, patch: Partial<StoredOperation>): void;
    /**
     * Delete an operation record and persist.
     */
    deleteOperation(id: string): boolean;
    /**
     * Clear all operations and persist.
     */
    clearOperations(): void;
    /**
     * Prune operations to a maximum count and persist.
     */
    pruneOperations(options?: {
        max?: number;
    }): number;
    /**
     * List operations with filtering/pagination.
     */
    listOperations(input?: number | ListOperationsQuery): StoredOperation[];
}

type SqliteBindValue = string | number | bigint | Uint8Array | null;
interface SqliteStatement {
    run(...params: SqliteBindValue[]): unknown;
    get(...params: SqliteBindValue[]): unknown;
    all(...params: SqliteBindValue[]): unknown[];
}
interface SqliteDatabase {
    exec(sql: string): void;
    prepare(sql: string): SqliteStatement;
    close?: () => void;
    pragma?: (pragma: string) => unknown;
}
type SqliteStoreOptions = {
    filename: string;
    walletId?: string;
    maxOperations?: number;
    readonly?: boolean;
    createIfMissing?: boolean;
    busyTimeoutMs?: number;
    pragmas?: string[];
    database?: SqliteDatabase;
};
declare class SqliteStore implements StorageAdapter {
    private readonly options;
    private walletId;
    private readonly maxOperations;
    private db;
    constructor(options: SqliteStoreOptions);
    init(options?: {
        walletId?: string;
    }): Promise<void>;
    close(): Promise<void>;
    private walletKey;
    private ensureDb;
    private openDatabase;
    private tryOpenWithNodeSqlite;
    private tryOpenWithBetterSqlite;
    private applyPragmas;
    private initSchema;
    private row;
    private rows;
    private run;
    private inClause;
    getSyncCursor(chainId: number): Promise<SyncCursor | undefined>;
    setSyncCursor(chainId: number, cursor: SyncCursor): Promise<void>;
    upsertUtxos(utxos: UtxoRecord[]): Promise<void>;
    listUtxos(query?: ListUtxosQuery): Promise<{
        total: number;
        rows: UtxoRecord[];
    }>;
    markSpent(input: {
        chainId: number;
        nullifiers: Hex[];
    }): Promise<number>;
    getMerkleLeaves(chainId: number): Promise<Array<{
        cid: number;
        commitment: Hex;
    }> | undefined>;
    getMerkleLeaf(chainId: number, cid: number): Promise<MerkleLeafRecord | undefined>;
    appendMerkleLeaves(chainId: number, leaves: Array<{
        cid: number;
        commitment: Hex;
    }>): Promise<void>;
    clearMerkleLeaves(chainId: number): Promise<void>;
    getMerkleNode(chainId: number, id: string): Promise<MerkleNodeRecord | undefined>;
    upsertMerkleNodes(chainId: number, nodes: MerkleNodeRecord[]): Promise<void>;
    clearMerkleNodes(chainId: number): Promise<void>;
    getMerkleTree(chainId: number): Promise<MerkleTreeState | undefined>;
    setMerkleTree(chainId: number, tree: MerkleTreeState): Promise<void>;
    clearMerkleTree(chainId: number): Promise<void>;
    upsertEntryMemos(memos: EntryMemoRecord[]): Promise<void>;
    listEntryMemos(query: ListEntryMemosQuery): Promise<{
        total: number;
        rows: EntryMemoRecord[];
    }>;
    clearEntryMemos(chainId: number): Promise<void>;
    upsertEntryNullifiers(nullifiers: EntryNullifierRecord[]): Promise<void>;
    listEntryNullifiers(query: ListEntryNullifiersQuery): Promise<{
        total: number;
        rows: EntryNullifierRecord[];
    }>;
    clearEntryNullifiers(chainId: number): Promise<void>;
    private getOperationById;
    private operationFromRow;
    private upsertOperationRow;
    createOperation<TType extends OperationType>(input: Omit<StoredOperation<OperationDetailFor<TType>>, 'id' | 'createdAt' | 'status'> & Partial<Pick<StoredOperation<OperationDetailFor<TType>>, 'createdAt' | 'id' | 'status'>> & {
        type: TType;
    }): StoredOperation<OperationDetailFor<TType>> & {
        type: TType;
    };
    updateOperation(id: string, patch: Partial<StoredOperation>): void;
    deleteOperation(id: string): boolean;
    clearOperations(): void;
    pruneOperations(options?: {
        max?: number;
    }): number;
    listOperations(input?: number | ListOperationsQuery): StoredOperation[];
}

export { EntryMemoRecord, EntryNullifierRecord, FileStore, type FileStoreOptions, Hex, ListEntryMemosQuery, ListEntryNullifiersQuery, ListOperationsQuery, ListUtxosQuery, MerkleLeafRecord, MerkleNodeRecord, MerkleTreeState, OperationStatus, OperationType, SqliteStore, type SqliteStoreOptions, StorageAdapter, StoredOperation, SyncCursor, UtxoRecord };
