import { C as CaatingaWalletAdapter } from './types-D4XEyX4J.cjs'; /** * Optional adapter capabilities the session takes advantage of when present. * The minimal {@link CaatingaWalletAdapter} contract stays untouched: adapters * that only implement `getPublicKey`/`signTransaction` (e.g. Freighter) work, * richer adapters (e.g. Stellar Wallets Kit) get modal-based connect, real * disconnect, and wallet-id persistence for free. */ interface CaatingaWalletCapabilities { openModal?(): Promise; disconnect?(): Promise; setWallet?(walletId: string): void; getWalletId?(): string | undefined; } type WalletSessionStatus = "disconnected" | "connecting" | "connected"; interface WalletSessionState { status: WalletSessionStatus; publicKey: string | null; error: Error | null; } /** Minimal storage contract so tests and non-browser hosts can inject their own. */ interface WalletSessionStorage { getItem(key: string): string | null; setItem(key: string, value: string): void; removeItem(key: string): void; } interface WalletSessionOptions { /** Persist the connection across page loads so `restore()` can reconnect silently. */ persist?: boolean; /** Storage backend for persistence. Defaults to `window.localStorage` when available. */ storage?: WalletSessionStorage; /** Persistence key. Defaults to {@link WALLET_SESSION_STORAGE_KEY}. */ storageKey?: string; /** Optional timeout (ms) applied to connect/restore wallet calls. */ timeout?: number; } interface WalletSession { adapter: CaatingaWalletAdapter; getState(): WalletSessionState; /** Subscribe to state transitions. Returns an unsubscribe function. */ subscribe(listener: () => void): () => void; /** Connect via the adapter modal when available, else `getPublicKey()`. */ connect(): Promise; disconnect(): Promise; /** * Silent reconnect from persisted state. Resolves the public key on success, * `null` when nothing was persisted or reconnection failed — never rejects * and never sets `state.error` (no error toast on page load). */ restore(): Promise; } declare const WALLET_SESSION_STORAGE_KEY = "caatinga:wallet-session"; declare function createWalletSession(adapter: CaatingaWalletAdapter, options?: WalletSessionOptions): WalletSession; export { type CaatingaWalletCapabilities as C, WALLET_SESSION_STORAGE_KEY as W, type WalletSession as a, type WalletSessionOptions as b, type WalletSessionState as c, type WalletSessionStatus as d, type WalletSessionStorage as e, createWalletSession as f };