import { H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, W as Wallet, P as ProviderConnectionState } from '../../hdWalletCapable-CUJDKRKO.cjs'; import { I as IWallet, a as Identity, b as WalletConfig, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, d as GetSpendableVtxosFilter, E as ExtendedCoin, A as ArkTransaction, e as ActivityRegistry, f as Activity, g as IContractManager, h as GetNewAddressesOptions, i as NewAddress, j as IDelegateManager, S as SendBitcoinParams, k as SettleParams, l as SettlementEvent, m as SendParams, R as Recipient, n as IAssetManager } from '../../index-Ctul0N3Y.cjs'; import { c as TaskQueue, T as TaskProcessor } from '../../taskRunner-DB17db5n.cjs'; import '@scure/btc-signer/psbt.js'; import '@scure/btc-signer/utils.js'; import '../../delegate-B4bKASut.cjs'; import '@scure/btc-signer'; import '@scure/btc-signer/transaction.js'; /** * Background processing configuration for @see ExpoWallet. * * OS-level task registration is **not** part of this config — call * `registerExpoBackgroundTask` from `@arkade-os/sdk/wallet/expo/background` * explicitly. Splitting that step out keeps `/wallet/expo` free of the * `expo-task-manager` / `expo-background-task` dependencies, so * react-native-web and Node consumers can use `ExpoWallet` without * those native packages. See * https://github.com/arkade-os/ts-sdk/issues/486 for details. */ interface ExpoBackgroundConfig { /** Persistence layer for foreground ↔ background handoff. */ taskQueue: TaskQueue; /** Processors to run on each tick. Defaults to `[contractPollProcessor]`. */ processors?: TaskProcessor[]; /** If set, automatically polls at this interval (ms) while the app is in the foreground. */ foregroundIntervalMs?: number; } /** * Configuration for @see ExpoWallet.setup. */ interface ExpoWalletConfig extends WalletConfig { background: ExpoBackgroundConfig; } /** * Expo/React Native wallet with built-in background task processing. * * Wraps a standard @see Wallet and adds a lightweight task queue * for keeping contract/VTXO state fresh while the app is active and * across Expo BackgroundTask wakes. * * OS-level task registration is the consumer's responsibility — call * `registerExpoBackgroundTask` from * `@arkade-os/sdk/wallet/expo/background` after `setup()`. Keeping * registration out of `setup()` lets this entrypoint avoid pulling * `expo-task-manager` / `expo-background-task` into the `/wallet/expo` * bundle. * * @example * ```ts * import { ExpoWallet } from "@arkade-os/sdk/wallet/expo"; * import { registerExpoBackgroundTask } from "@arkade-os/sdk/wallet/expo/background"; * import { AsyncStorageTaskQueue } from "@arkade-os/sdk/worker/expo"; * * const wallet = await ExpoWallet.setup({ * identity: MnemonicIdentity.fromMnemonic('abandon abandon...'), * arkProvider: new RestArkProvider(), * onchainProvider: new EsploraProvider(), * storage: { ... }, * background: { * taskQueue: new AsyncStorageTaskQueue(AsyncStorage), * foregroundIntervalMs: 20_000, * }, * }); * * // Activate the OS scheduler (Expo Android/iOS only) * await registerExpoBackgroundTask("ark-background-poll", { minimumInterval: 15 }); * * const balance = await wallet.getBalance(); * ``` */ declare class ExpoWallet implements IWallet, HDWalletCapable, HDAllocationCapable, AddressAllocationCapable { private readonly wallet; private readonly taskQueue; private readonly processors; private readonly deps; readonly identity: Identity; readonly arkProvider: Wallet["arkProvider"]; readonly indexerProvider: Wallet["indexerProvider"]; private foregroundIntervalId?; private foregroundPollChain; private cleared; private constructor(); /** * Create an ExpoWallet with foreground/background queue handoff. * * 1. Creates the inner @see Wallet via `Wallet.create()`. * 2. Wires up processors (defaults to @see contractPollProcessor). * 3. Persists background config for the background handler (if the queue supports it). * 4. Seeds the task queue with a `contract-poll` task. * 5. Starts the foreground interval if `foregroundIntervalMs` is set. * * OS-level scheduling lives in * `@arkade-os/sdk/wallet/expo/background` and is invoked separately * by the consumer. */ static setup(config: ExpoWalletConfig): Promise; private startForegroundPolling; private runForegroundPoll; private seedContractPollTask; private removeContractPollTasks; /** * Stop foreground polling and dispose the inner wallet. * * Does **not** unregister the OS background task — call * `unregisterExpoBackgroundTask` from * `@arkade-os/sdk/wallet/expo/background` yourself, matching the * explicit `register` step. */ dispose(): Promise; /** * Stop foreground polling and wipe all locally persisted wallet data. * Does not unregister the OS background task or persisted queue config. */ clear(): Promise; getAddress(): Promise; getBoardingAddress(): Promise; getBalance(): Promise; getVtxos(filter?: GetVtxosFilter): Promise; getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise; getBoardingUtxos(): Promise; getTransactionHistory(): Promise; get activity(): ActivityRegistry; getActivityHistory(): Promise; getContractManager(): Promise; getCurrentSigningDescriptor(): Promise; getNextSigningDescriptor(): Promise; /** @see Wallet.getNewAddresses */ getNewAddresses(opts?: GetNewAddressesOptions): Promise; getUsedSigningDescriptors(opts?: { lookAhead?: number; }): Promise; advanceSigningDescriptorWatermark(descriptor: string): Promise; signerForDescriptor(descriptor: string): Promise; /** * Wallet-level provider-connection freshness, delegated to the wrapped * in-process wallet. Synchronous because the Expo foreground wallet is * in-process (no worker boundary). Foreground-only: it does not imply any * background task can read live foreground state. */ getProviderConnectionState(): ProviderConnectionState; getDelegateManager(): Promise; /** @deprecated alias for @see ExpoWallet.getDelegateManager */ getDelegatorManager(): Promise; sendBitcoin(params: SendBitcoinParams): Promise; settle(params?: SettleParams, eventCallback?: (event: SettlementEvent) => void): Promise; send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise; get assetManager(): IAssetManager; } export { type ExpoBackgroundConfig, ExpoWallet, type ExpoWalletConfig };