import { PublicKey } from '@rialo/ts-cdk'; import { IdentifierArray, WalletAccount, IdentifierString, Wallet } from '@wallet-standard/base'; import { a as FrostAppState, F as FrostConfig, W as WalletEntity, A as AccountEntity } from './config-CKQwL4wm.cjs'; import '@tanstack/store'; interface CreateMockAccountOptions { address?: string; publicKey?: Uint8Array; chains?: IdentifierArray; features?: IdentifierArray; label?: string; } /** * Creates a mock WalletAccount for testing. */ declare function createMockAccount(options?: CreateMockAccountOptions): WalletAccount; interface CreateMockWalletOptions { name?: string; icon?: string; chains?: IdentifierString[]; accounts?: WalletAccount[]; /** Auto-approve connection requests */ autoApprove?: boolean; /** Delay before resolving connect (ms) */ connectDelay?: number; /** Simulate connection failure */ failConnect?: boolean | Error; /** Simulate disconnect failure */ failDisconnect?: boolean | Error; /** Include standard:events feature */ supportsEvents?: boolean; /** Include rialo:signMessage feature */ supportsSignMessage?: boolean; /** Include rialo:signTransaction feature */ supportsSignTransaction?: boolean; /** Include rialo:signAndSendTransaction feature */ supportsSignAndSend?: boolean; } interface MockWallet extends Wallet { /** Programmatically trigger account change event */ _emitAccountChange: (accounts: WalletAccount[]) => void; /** Get connect call count */ _connectCallCount: number; /** Get disconnect call count */ _disconnectCallCount: number; /** Get sign message call count */ _signMessageCallCount: number; /** Get sign transaction call count */ _signTransactionCallCount: number; /** Last signed message */ _lastSignedMessage: Uint8Array | null; /** Last signed transaction */ _lastSignedTransaction: Uint8Array | null; /** Reset all counters and state */ _reset: () => void; } /** * Creates a mock Wallet implementing wallet-standard interface. */ declare function createMockWallet(options?: CreateMockWalletOptions): MockWallet; interface CreateMockClientOptions { /** Default balance to return */ defaultBalance?: bigint; /** Map of address -> balance */ balances?: Map; /** Simulate RPC errors */ failRequests?: boolean | Error; /** Delay before resolving requests (ms) */ requestDelay?: number; /** Mock transaction signatures to return */ transactionSignature?: string; } /** Result of a confirmed transaction (matches @rialo/ts-cdk ConfirmedTransaction) */ interface MockConfirmedTransaction { signature: string; executed: boolean; err?: string; } /** * Mock RialoClient interface for testing. * Only includes the methods commonly needed in tests. */ interface MockRialoClient { getBalance: (pubkey: PublicKey) => Promise; sendTransaction: (transaction: Uint8Array) => Promise; sendAndConfirmTransaction: (transaction: Uint8Array) => Promise; getTransaction: () => Promise; getLatestBlockhash: () => Promise<{ blockhash: string; lastValidBlockHeight: number; }>; /** Set balance for an address (use address string as key) */ _setBalance: (address: string, balance: bigint) => void; /** Get send transaction call count */ _sendTransactionCallCount: number; /** Get sendAndConfirm call count */ _sendAndConfirmCallCount: number; /** Last sent transaction */ _lastSentTransaction: Uint8Array | null; /** Configure transaction to fail on-chain (executed: false) */ _setTransactionFails: (fails: boolean, err?: string) => void; /** Reset all state */ _reset: () => void; } /** * Creates a mock RialoClient for testing. */ declare function createMockClient(options?: CreateMockClientOptions): MockRialoClient; /** * Creates an in-memory Storage implementation for testing. */ declare function createMockStorage(): Storage; interface CreateMockConfigOptions { /** Initial state overrides */ initialState?: Partial; /** Mock client options */ clientOptions?: CreateMockClientOptions; /** Mock storage (null to disable persistence) */ storage?: Storage | null; /** Chain ID */ chainId?: string; /** Auto-connect setting */ autoConnect?: boolean; } /** * Creates a mock FrostConfig for testing. * * @example * ```ts * const { config, mockClient } = createMockConfig({ * initialState: { status: "connected", walletName: "TestWallet" }, * }); * * // Use in tests * const result = await connect(config, { walletName: "TestWallet" }); * expect(mockClient._connectCallCount).toBe(1); * ``` */ declare function createMockConfig(options?: CreateMockConfigOptions): { config: FrostConfig; mockClient: MockRialoClient; mockStorage: Storage | null; }; /** * Waits for a condition to be true. */ declare function waitFor(condition: () => boolean | Promise, options?: { timeout?: number; interval?: number; }): Promise; /** * Waits for state to match a condition. */ declare function waitForState(config: FrostConfig, predicate: (state: FrostAppState) => boolean, options?: { timeout?: number; interval?: number; }): Promise; /** * Creates a mock WalletEntity for store initialization. */ declare function createMockWalletEntity(overrides?: Partial): WalletEntity; /** * Creates a mock AccountEntity for store initialization. */ declare function createMockAccountEntity(overrides?: Partial): AccountEntity; export { type CreateMockAccountOptions, type CreateMockClientOptions, type CreateMockConfigOptions, type CreateMockWalletOptions, type MockConfirmedTransaction, type MockRialoClient, type MockWallet, createMockAccount, createMockAccountEntity, createMockClient, createMockConfig, createMockStorage, createMockWallet, createMockWalletEntity, waitFor, waitForState };