@arkade-os/sdk 0.5.0-rc.24 → 0.5.0-rc.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +65 -0
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +3 -3
  4. package/dist/adapters/expo.d.ts +3 -3
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/{asyncStorageTaskQueue-DeXfxJp5.d.cts → asyncStorageTaskQueue-CFWscYpG.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-C4ESykOx.d.ts → asyncStorageTaskQueue-DrFapzPg.d.ts} +2 -2
  8. package/dist/{chunk-PD5CVWPT.js → chunk-5JQ5EOYE.js} +25 -6
  9. package/dist/chunk-5JQ5EOYE.js.map +1 -0
  10. package/dist/{chunk-OIYVDV2N.cjs → chunk-B2YMUJD5.cjs} +1116 -657
  11. package/dist/chunk-B2YMUJD5.cjs.map +1 -0
  12. package/dist/{chunk-UV3IM6BG.cjs → chunk-CFOIHLON.cjs} +48 -48
  13. package/dist/{chunk-UV3IM6BG.cjs.map → chunk-CFOIHLON.cjs.map} +1 -1
  14. package/dist/{chunk-PAD5V653.cjs → chunk-FEBAG2K2.cjs} +40 -21
  15. package/dist/chunk-FEBAG2K2.cjs.map +1 -0
  16. package/dist/{chunk-RDJIT7RA.js → chunk-HPUKFTZV.js} +4 -4
  17. package/dist/{chunk-RDJIT7RA.js.map → chunk-HPUKFTZV.js.map} +1 -1
  18. package/dist/{chunk-HGOERMAY.js → chunk-HTCIPDVW.js} +23 -7
  19. package/dist/chunk-HTCIPDVW.js.map +1 -0
  20. package/dist/{chunk-O2WE7RWU.cjs → chunk-K2YTDYQF.cjs} +17 -17
  21. package/dist/chunk-K2YTDYQF.cjs.map +1 -0
  22. package/dist/{chunk-RFI6RO25.js → chunk-N2VM6V6K.js} +3 -3
  23. package/dist/{chunk-RFI6RO25.js.map → chunk-N2VM6V6K.js.map} +1 -1
  24. package/dist/{chunk-MJG2O6PT.cjs → chunk-QCD3SJOL.cjs} +10 -10
  25. package/dist/{chunk-MJG2O6PT.cjs.map → chunk-QCD3SJOL.cjs.map} +1 -1
  26. package/dist/{chunk-WXHMXKPV.js → chunk-U5ZRDVVB.js} +637 -181
  27. package/dist/chunk-U5ZRDVVB.js.map +1 -0
  28. package/dist/{chunk-65CTZR2O.cjs → chunk-VVFCCNU2.cjs} +23 -6
  29. package/dist/chunk-VVFCCNU2.cjs.map +1 -0
  30. package/dist/{chunk-2YGYHUBW.js → chunk-Y5VSJURH.js} +6 -6
  31. package/dist/chunk-Y5VSJURH.js.map +1 -0
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +3 -3
  34. package/dist/contracts/handlers/index.d.ts +3 -3
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-CJ34lCIK.d.ts → delegate-Cz8FnLqi.d.ts} +1 -1
  37. package/dist/{delegate-C1wtM1NZ.d.cts → delegate-r3jh7UcH.d.cts} +1 -1
  38. package/dist/{index-CH0tbuRp.d.ts → index-BfvbSL0W.d.cts} +81 -11
  39. package/dist/{index-CH0tbuRp.d.cts → index-BfvbSL0W.d.ts} +81 -11
  40. package/dist/{index-iD05fKPX.d.ts → index-Chgwl4dO.d.ts} +2 -2
  41. package/dist/{index-DhVOLSJN.d.cts → index-DOION7Ta.d.cts} +2 -2
  42. package/dist/index.cjs +328 -312
  43. package/dist/index.d.cts +129 -87
  44. package/dist/index.d.ts +129 -87
  45. package/dist/index.js +4 -4
  46. package/dist/repositories/realm/index.cjs +35 -35
  47. package/dist/repositories/realm/index.d.cts +2 -2
  48. package/dist/repositories/realm/index.d.ts +2 -2
  49. package/dist/repositories/realm/index.js +5 -5
  50. package/dist/repositories/sqlite/index.cjs +33 -33
  51. package/dist/repositories/sqlite/index.d.cts +2 -2
  52. package/dist/repositories/sqlite/index.d.ts +2 -2
  53. package/dist/repositories/sqlite/index.js +5 -5
  54. package/dist/{taskRunner-Ox7fjm1O.d.cts → taskRunner-BO8a-SQh.d.cts} +2 -2
  55. package/dist/{taskRunner-DGSSHZ6e.d.ts → taskRunner-CXAcjtdU.d.ts} +2 -2
  56. package/dist/wallet/expo/background.cjs +14 -14
  57. package/dist/wallet/expo/background.d.cts +3 -3
  58. package/dist/wallet/expo/background.d.ts +3 -3
  59. package/dist/wallet/expo/background.js +6 -6
  60. package/dist/wallet/expo/index.cjs +19 -15
  61. package/dist/wallet/expo/index.cjs.map +1 -1
  62. package/dist/wallet/expo/index.d.cts +6 -4
  63. package/dist/wallet/expo/index.d.ts +6 -4
  64. package/dist/wallet/expo/index.js +9 -5
  65. package/dist/wallet/expo/index.js.map +1 -1
  66. package/dist/{wallet-EWn1ivtK.d.cts → wallet-CFIfUlQP.d.ts} +72 -4
  67. package/dist/{wallet-DK71priz.d.ts → wallet-s90p-vIk.d.cts} +72 -4
  68. package/dist/worker/expo/index.cjs +9 -9
  69. package/dist/worker/expo/index.d.cts +4 -4
  70. package/dist/worker/expo/index.d.ts +4 -4
  71. package/dist/worker/expo/index.js +5 -5
  72. package/package.json +1 -1
  73. package/dist/chunk-2YGYHUBW.js.map +0 -1
  74. package/dist/chunk-65CTZR2O.cjs.map +0 -1
  75. package/dist/chunk-HGOERMAY.js.map +0 -1
  76. package/dist/chunk-O2WE7RWU.cjs.map +0 -1
  77. package/dist/chunk-OIYVDV2N.cjs.map +0 -1
  78. package/dist/chunk-PAD5V653.cjs.map +0 -1
  79. package/dist/chunk-PD5CVWPT.js.map +0 -1
  80. package/dist/chunk-WXHMXKPV.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, W as Wallet, P as ProviderConnectionState } from '../../wallet-EWn1ivtK.cjs';
2
- import { I as IWallet, a as Identity, b as WalletConfig, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, E as ExtendedCoin, h as ArkTransaction, i as ActivityRegistry, j as Activity, k as IContractManager, l as GetNewAddressesOptions, m as NewAddress, n as IDelegateManager, S as SettleParams, o as SettlementEvent, p as SendParams, R as Recipient, q as IAssetManager } from '../../index-CH0tbuRp.cjs';
3
- import { c as TaskQueue, T as TaskProcessor } from '../../taskRunner-Ox7fjm1O.cjs';
1
+ import { H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, W as Wallet, P as ProviderConnectionState } from '../../wallet-s90p-vIk.cjs';
2
+ import { I as IWallet, a as Identity, b as WalletConfig, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, E as ExtendedCoin, h as ArkTransaction, i as ActivityRegistry, j as Activity, k as IContractManager, l as GetNewAddressesOptions, m as NewAddress, n as IDelegateManager, S as SettleParams, o as SettlementEvent, p as SendParams, R as Recipient, q as IAssetManager } from '../../index-BfvbSL0W.cjs';
3
+ import { a as TaskQueue, T as TaskProcessor } from '../../taskRunner-BO8a-SQh.cjs';
4
4
  import '@scure/btc-signer/psbt.js';
5
5
  import '@scure/btc-signer/utils.js';
6
- import '../../delegate-C1wtM1NZ.cjs';
6
+ import '../../delegate-r3jh7UcH.cjs';
7
7
  import '@scure/btc-signer';
8
8
  import '@scure/btc-signer/transaction.js';
9
9
 
@@ -146,6 +146,8 @@ declare class ExpoWallet implements IWallet, HDWalletCapable, HDAllocationCapabl
146
146
  settle(params?: SettleParams, eventCallback?: (event: SettlementEvent) => void): Promise<string>;
147
147
  send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise<string>;
148
148
  get assetManager(): IAssetManager;
149
+ /** @see WalletConfig.concurrentSpending */
150
+ get concurrentSpending(): boolean;
149
151
  }
150
152
 
151
153
  export { type ExpoBackgroundConfig, ExpoWallet, type ExpoWalletConfig };
@@ -1,9 +1,9 @@
1
- import { H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, W as Wallet, P as ProviderConnectionState } from '../../wallet-DK71priz.js';
2
- import { I as IWallet, a as Identity, b as WalletConfig, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, E as ExtendedCoin, h as ArkTransaction, i as ActivityRegistry, j as Activity, k as IContractManager, l as GetNewAddressesOptions, m as NewAddress, n as IDelegateManager, S as SettleParams, o as SettlementEvent, p as SendParams, R as Recipient, q as IAssetManager } from '../../index-CH0tbuRp.js';
3
- import { c as TaskQueue, T as TaskProcessor } from '../../taskRunner-DGSSHZ6e.js';
1
+ import { H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, W as Wallet, P as ProviderConnectionState } from '../../wallet-CFIfUlQP.js';
2
+ import { I as IWallet, a as Identity, b as WalletConfig, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, E as ExtendedCoin, h as ArkTransaction, i as ActivityRegistry, j as Activity, k as IContractManager, l as GetNewAddressesOptions, m as NewAddress, n as IDelegateManager, S as SettleParams, o as SettlementEvent, p as SendParams, R as Recipient, q as IAssetManager } from '../../index-BfvbSL0W.js';
3
+ import { a as TaskQueue, T as TaskProcessor } from '../../taskRunner-CXAcjtdU.js';
4
4
  import '@scure/btc-signer/psbt.js';
5
5
  import '@scure/btc-signer/utils.js';
6
- import '../../delegate-CJ34lCIK.js';
6
+ import '../../delegate-Cz8FnLqi.js';
7
7
  import '@scure/btc-signer';
8
8
  import '@scure/btc-signer/transaction.js';
9
9
 
@@ -146,6 +146,8 @@ declare class ExpoWallet implements IWallet, HDWalletCapable, HDAllocationCapabl
146
146
  settle(params?: SettleParams, eventCallback?: (event: SettlementEvent) => void): Promise<string>;
147
147
  send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise<string>;
148
148
  get assetManager(): IAssetManager;
149
+ /** @see WalletConfig.concurrentSpending */
150
+ get concurrentSpending(): boolean;
149
151
  }
150
152
 
151
153
  export { type ExpoBackgroundConfig, ExpoWallet, type ExpoWalletConfig };
@@ -1,8 +1,8 @@
1
- import { contractPollProcessor, runTasks, CONTRACT_POLL_TASK_TYPE } from '../../chunk-RDJIT7RA.js';
2
- import { Wallet, extractArkProviderUrl, getRandomId, extendVirtualCoinForContract } from '../../chunk-WXHMXKPV.js';
3
- import '../../chunk-PD5CVWPT.js';
4
- import '../../chunk-RFI6RO25.js';
5
- import { assertTimerMs } from '../../chunk-HGOERMAY.js';
1
+ import { contractPollProcessor, runTasks, CONTRACT_POLL_TASK_TYPE } from '../../chunk-HPUKFTZV.js';
2
+ import { Wallet, extractArkProviderUrl, getRandomId, extendVirtualCoinForContract } from '../../chunk-U5ZRDVVB.js';
3
+ import '../../chunk-5JQ5EOYE.js';
4
+ import '../../chunk-N2VM6V6K.js';
5
+ import { assertTimerMs } from '../../chunk-HTCIPDVW.js';
6
6
  import { hex } from '@scure/base';
7
7
 
8
8
  function warnOnRemovedBackgroundFields(bg) {
@@ -238,6 +238,10 @@ var ExpoWallet = class _ExpoWallet {
238
238
  get assetManager() {
239
239
  return this.wallet.assetManager;
240
240
  }
241
+ /** @see WalletConfig.concurrentSpending */
242
+ get concurrentSpending() {
243
+ return this.wallet.concurrentSpending;
244
+ }
241
245
  };
242
246
 
243
247
  export { ExpoWallet };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/wallet/expo/wallet.ts"],"names":[],"mappings":";;;;;;;AA0EO,SAAS,8BAA8B,EAAA,EAAmB;AAC7D,EAAA,IAAI,CAAC,EAAA,IAAM,OAAO,EAAA,KAAO,QAAA,EAAU;AACnC,EAAA,MAAM,UAAoB,EAAC;AA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assertTimerMs } from \"../../utils/time\";\nimport { Wallet, extractArkProviderUrl, type ProviderConnectionState } from \"../wallet\";\nimport type { Activity, ActivityRegistry } from \"../activity\";\nimport type {\n ArkadeBroadcaster,\n ArkadeReader,\n GetArkadeInfoOptions,\n IWallet,\n IAssetManager,\n WalletBalance,\n WalletConfig,\n SettleParams,\n GetVtxosFilter,\n GetSpendableVtxosFilter,\n GetNewAddressesOptions,\n NewAddress,\n ArkTransaction,\n ExtendedCoin,\n Recipient,\n SendParams,\n} from \"..\";\nimport type { ArkadeInfo, SettlementEvent } from \"../../providers/ark\";\nimport type { Identity } from \"../../identity\";\nimport type {\n AddressAllocationCapable,\n HDAllocationCapable,\n HDWalletCapable,\n} from \"../hdWalletCapable\";\nimport type { IContractManager } from \"../../contracts/contractManager\";\nimport type { IDelegateManager } from \"../delegate\";\nimport type { TaskQueue, TaskItem } from \"../../worker/expo/taskQueue\";\nimport type { TaskProcessor, TaskDependencies } from \"../../worker/expo/taskRunner\";\nimport { runTasks } from \"../../worker/expo/taskRunner\";\nimport { contractPollProcessor, CONTRACT_POLL_TASK_TYPE } from \"../../worker/expo/processors\";\nimport { extendVirtualCoinForContract, getRandomId } from \"../utils\";\nimport type { PersistedBackgroundConfig } from \"./background\";\nimport type { AsyncStorageTaskQueue } from \"../../worker/expo/asyncStorageTaskQueue\";\nimport type { NormalizedExtendedVirtualCoin } from \"../vtxo\";\n\n/**\n * Background processing configuration for @see ExpoWallet.\n *\n * OS-level task registration is **not** part of this config — call\n * `registerExpoBackgroundTask` from `@arkade-os/sdk/wallet/expo/background`\n * explicitly. Splitting that step out keeps `/wallet/expo` free of the\n * `expo-task-manager` / `expo-background-task` dependencies, so\n * react-native-web and Node consumers can use `ExpoWallet` without\n * those native packages. See\n * https://github.com/arkade-os/ts-sdk/issues/486 for details.\n */\nexport interface ExpoBackgroundConfig {\n /** Persistence layer for foreground ↔ background handoff. */\n taskQueue: TaskQueue;\n /** Processors to run on each tick. Defaults to `[contractPollProcessor]`. */\n processors?: TaskProcessor[];\n /** If set, automatically polls at this interval (ms) while the app is in the foreground. */\n foregroundIntervalMs?: number;\n}\n\n/**\n * Configuration for @see ExpoWallet.setup.\n */\nexport interface ExpoWalletConfig extends WalletConfig {\n background: ExpoBackgroundConfig;\n}\n\n/**\n * Catches JS callers still passing the pre-fix-#486 fields: TypeScript\n * blocks these at compile time, but compiled JS silently dropped them\n * and consumers would never realize the OS task wasn't scheduled.\n *\n * @internal Exported for tests; not part of the public API surface.\n */\nexport function warnOnRemovedBackgroundFields(bg: unknown): void {\n if (!bg || typeof bg !== \"object\") return;\n const removed: string[] = [];\n if (\"taskName\" in bg) removed.push(\"taskName\");\n if (\"minimumBackgroundInterval\" in bg) {\n removed.push(\"minimumBackgroundInterval\");\n }\n if (removed.length === 0) return;\n console.warn(\n `[ark-sdk] ExpoWallet.setup: ignoring removed background field(s): ${removed.join(\", \")}. ` +\n 'OS-task registration moved to \"@arkade-os/sdk/wallet/expo/background\". ' +\n \"See https://github.com/arkade-os/ts-sdk/issues/486\",\n );\n}\n\n/**\n * Expo/React Native wallet with built-in background task processing.\n *\n * Wraps a standard @see Wallet and adds a lightweight task queue\n * for keeping contract/VTXO state fresh while the app is active and\n * across Expo BackgroundTask wakes.\n *\n * OS-level task registration is the consumer's responsibility — call\n * `registerExpoBackgroundTask` from\n * `@arkade-os/sdk/wallet/expo/background` after `setup()`. Keeping\n * registration out of `setup()` lets this entrypoint avoid pulling\n * `expo-task-manager` / `expo-background-task` into the `/wallet/expo`\n * bundle.\n *\n * @example\n * ```ts\n * import { ExpoWallet } from \"@arkade-os/sdk/wallet/expo\";\n * import { registerExpoBackgroundTask } from \"@arkade-os/sdk/wallet/expo/background\";\n * import { AsyncStorageTaskQueue } from \"@arkade-os/sdk/worker/expo\";\n *\n * const wallet = await ExpoWallet.setup({\n * identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),\n * arkProvider: new RestArkProvider(),\n * onchainProvider: new EsploraProvider(),\n * storage: { ... },\n * background: {\n * taskQueue: new AsyncStorageTaskQueue(AsyncStorage),\n * foregroundIntervalMs: 20_000,\n * },\n * });\n *\n * // Activate the OS scheduler (Expo Android/iOS only)\n * await registerExpoBackgroundTask(\"ark-background-poll\", { minimumInterval: 15 });\n *\n * const balance = await wallet.getBalance();\n * ```\n */\nexport class ExpoWallet\n implements IWallet, HDWalletCapable, HDAllocationCapable, AddressAllocationCapable\n{\n readonly identity: Identity;\n readonly arkProvider: Wallet[\"arkProvider\"];\n readonly indexerProvider: Wallet[\"indexerProvider\"];\n\n private foregroundIntervalId?: ReturnType<typeof setInterval>;\n private foregroundPollChain: Promise<void> = Promise.resolve();\n private cleared = false;\n\n private constructor(\n private readonly wallet: Wallet,\n private readonly taskQueue: TaskQueue,\n private readonly processors: TaskProcessor[],\n private readonly deps: TaskDependencies,\n foregroundIntervalMs?: number,\n ) {\n this.identity = wallet.identity;\n this.arkProvider = wallet.arkProvider;\n this.indexerProvider = wallet.indexerProvider;\n\n if (foregroundIntervalMs && foregroundIntervalMs > 0) {\n this.startForegroundPolling(foregroundIntervalMs);\n }\n }\n\n /**\n * Create an ExpoWallet with foreground/background queue handoff.\n *\n * 1. Creates the inner @see Wallet via `Wallet.create()`.\n * 2. Wires up processors (defaults to @see contractPollProcessor).\n * 3. Persists background config for the background handler (if the queue supports it).\n * 4. Seeds the task queue with a `contract-poll` task.\n * 5. Starts the foreground interval if `foregroundIntervalMs` is set.\n *\n * OS-level scheduling lives in\n * `@arkade-os/sdk/wallet/expo/background` and is invoked separately\n * by the consumer.\n */\n static async setup(config: ExpoWalletConfig): Promise<ExpoWallet> {\n assertTimerMs(\"foregroundIntervalMs\", config.background.foregroundIntervalMs);\n warnOnRemovedBackgroundFields(config.background);\n\n const wallet = await Wallet.create(config);\n\n const processors = config.background.processors ?? [contractPollProcessor];\n\n const deps: TaskDependencies = {\n walletRepository: wallet.walletRepository,\n contractRepository: wallet.contractRepository,\n indexerProvider: wallet.indexerProvider,\n arkProvider: wallet.arkProvider,\n extendVtxo: (vtxo, contract) => extendVirtualCoinForContract(vtxo, contract),\n };\n\n const { taskQueue } = config.background;\n\n // Persist wallet params so the background handler can rehydrate\n // without a network call. Only works with AsyncStorageTaskQueue.\n if (\"persistConfig\" in taskQueue) {\n const arkServerUrl = extractArkProviderUrl(wallet.arkProvider);\n\n if (typeof arkServerUrl === \"string\" && arkServerUrl.length > 0) {\n const timelock = wallet.offchainTapscript.options.csvTimelock;\n\n const bgConfig: PersistedBackgroundConfig = {\n arkServerUrl,\n pubkeyHex: hex.encode(wallet.offchainTapscript.options.pubKey),\n serverPubKeyHex: hex.encode(wallet.offchainTapscript.options.serverPubKey),\n exitTimelockValue: timelock.value.toString(),\n exitTimelockType: timelock.type,\n };\n\n await (taskQueue as AsyncStorageTaskQueue).persistConfig(bgConfig);\n }\n }\n\n const expoWallet = new ExpoWallet(\n wallet,\n taskQueue,\n processors,\n deps,\n config.background.foregroundIntervalMs,\n );\n\n // Seed the queue so the first tick (or background wake) has work to do\n await expoWallet.seedContractPollTask();\n\n return expoWallet;\n }\n\n // ── Foreground polling ───────────────────────────────────────────\n\n private startForegroundPolling(intervalMs: number): void {\n this.foregroundIntervalId = setInterval(() => {\n // Serialize polls so clear() can await the in-flight one before wiping.\n this.foregroundPollChain = this.foregroundPollChain\n .then(() => this.runForegroundPoll())\n .catch(console.error);\n }, intervalMs);\n }\n\n private async runForegroundPoll(): Promise<void> {\n if (this.cleared) return;\n\n await runTasks(this.taskQueue, this.processors, this.deps);\n\n // Consume results immediately (no background handoff needed)\n const results = await this.taskQueue.getResults();\n if (results.length > 0) {\n await this.taskQueue.acknowledgeResults(results.map((r) => r.id));\n }\n\n if (this.cleared) return;\n\n // Re-seed for the next tick\n await this.seedContractPollTask();\n }\n\n private async seedContractPollTask(): Promise<void> {\n const existing = await this.taskQueue.getTasks(CONTRACT_POLL_TASK_TYPE);\n if (existing.length > 0) return;\n\n const task: TaskItem = {\n id: getRandomId(),\n type: CONTRACT_POLL_TASK_TYPE,\n data: {},\n createdAt: Date.now(),\n };\n await this.taskQueue.addTask(task);\n }\n\n private async removeContractPollTasks(): Promise<void> {\n const tasks = await this.taskQueue.getTasks(CONTRACT_POLL_TASK_TYPE);\n for (const task of tasks) {\n await this.taskQueue.removeTask(task.id);\n }\n }\n\n // ── Lifecycle ────────────────────────────────────────────────────\n\n /**\n * Stop foreground polling and dispose the inner wallet.\n *\n * Does **not** unregister the OS background task — call\n * `unregisterExpoBackgroundTask` from\n * `@arkade-os/sdk/wallet/expo/background` yourself, matching the\n * explicit `register` step.\n */\n async dispose(): Promise<void> {\n if (this.foregroundIntervalId) {\n clearInterval(this.foregroundIntervalId);\n this.foregroundIntervalId = undefined;\n }\n\n await this.wallet.dispose();\n }\n\n /**\n * Stop foreground polling and wipe all locally persisted wallet data.\n * Does not unregister the OS background task or persisted queue config.\n */\n async clear(): Promise<void> {\n this.cleared = true;\n\n if (this.foregroundIntervalId) {\n clearInterval(this.foregroundIntervalId);\n this.foregroundIntervalId = undefined;\n }\n\n await this.foregroundPollChain;\n await this.wallet.clear();\n await this.removeContractPollTasks();\n }\n\n // ── IWallet delegation ───────────────────────────────────────────\n\n getAddress(): Promise<string> {\n return this.wallet.getAddress();\n }\n\n getBoardingAddress(): Promise<string> {\n return this.wallet.getBoardingAddress();\n }\n\n getArkadeInfo(opts?: GetArkadeInfoOptions): Promise<ArkadeInfo> {\n return this.wallet.getArkadeInfo(opts);\n }\n\n getArkadeReader(): Promise<ArkadeReader> {\n return this.wallet.getArkadeReader();\n }\n\n getArkadeBroadcaster(): Promise<ArkadeBroadcaster> {\n return this.wallet.getArkadeBroadcaster();\n }\n\n getBalance(): Promise<WalletBalance> {\n return this.wallet.getBalance();\n }\n\n getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]> {\n return this.wallet.getVtxos(filter);\n }\n\n getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]> {\n return this.wallet.getSpendableVtxos(filter);\n }\n\n getBoardingUtxos(): Promise<ExtendedCoin[]> {\n return this.wallet.getBoardingUtxos();\n }\n\n getTransactionHistory(): Promise<ArkTransaction[]> {\n return this.wallet.getTransactionHistory();\n }\n\n get activity(): ActivityRegistry {\n return this.wallet.activity;\n }\n\n getActivityHistory(): Promise<Activity[]> {\n return this.wallet.getActivityHistory();\n }\n\n getContractManager(): Promise<IContractManager> {\n return this.wallet.getContractManager();\n }\n\n // Descriptor surface, delegated like everything else here. Without these\n // the structural probes see a wallet with no HD state, so an Expo wallet\n // running `walletMode: 'hd'` would bind every artifact to its baseline\n // identity key — reusing one key across swaps while its receive addresses\n // rotate, and never allocating the indices a restore scan looks for.\n\n getCurrentSigningDescriptor(): Promise<string | undefined> {\n return this.wallet.getCurrentSigningDescriptor();\n }\n\n getNextSigningDescriptor(): Promise<string | undefined> {\n return this.wallet.getNextSigningDescriptor();\n }\n\n /** @see Wallet.getNewAddresses */\n getNewAddresses(opts?: GetNewAddressesOptions): Promise<NewAddress[]> {\n return this.wallet.getNewAddresses(opts);\n }\n\n getUsedSigningDescriptors(opts?: { lookAhead?: number }): Promise<string[]> {\n return this.wallet.getUsedSigningDescriptors(opts);\n }\n\n advanceSigningDescriptorWatermark(descriptor: string): Promise<void> {\n return this.wallet.advanceSigningDescriptorWatermark(descriptor);\n }\n\n signerForDescriptor(descriptor: string): Promise<Identity> {\n return this.wallet.signerForDescriptor(descriptor);\n }\n\n /**\n * Wallet-level provider-connection freshness, delegated to the wrapped\n * in-process wallet. Synchronous because the Expo foreground wallet is\n * in-process (no worker boundary). Foreground-only: it does not imply any\n * background task can read live foreground state.\n */\n getProviderConnectionState(): ProviderConnectionState {\n return this.wallet.getProviderConnectionState();\n }\n\n getDelegateManager(): Promise<IDelegateManager | undefined> {\n return this.wallet.getDelegateManager();\n }\n\n settle(\n params?: SettleParams,\n eventCallback?: (event: SettlementEvent) => void,\n ): Promise<string> {\n return this.wallet.settle(params, eventCallback);\n }\n\n send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise<string> {\n return this.wallet.send(...args);\n }\n\n get assetManager(): IAssetManager {\n return this.wallet.assetManager;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../src/wallet/expo/wallet.ts"],"names":[],"mappings":";;;;;;;AA0EO,SAAS,8BAA8B,EAAA,EAAmB;AAC7D,EAAA,IAAI,CAAC,EAAA,IAAM,OAAO,EAAA,KAAO,QAAA,EAAU;AACnC,EAAA,MAAM,UAAoB,EAAC;AAC3B,EAAA,IAAI,UAAA,IAAc,EAAA,EAAI,OAAA,CAAQ,IAAA,CAAK,UAAU,CAAA;AAC7C,EAAA,IAAI,+BAA+B,EAAA,EAAI;AACnC,IAAA,OAAA,CAAQ,KAAK,2BAA2B,CAAA;AAAA,EAC5C;AACA,EAAA,IAAI,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC1B,EAAA,OAAA,CAAQ,IAAA;AAAA,IACJ,CAAA,kEAAA,EAAqE,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,2HAAA;AAAA,GAG3F;AACJ;AAuCO,IAAM,UAAA,GAAN,MAAM,WAAA,CAEb;AAAA,EASY,WAAA,CACa,MAAA,EACA,SAAA,EACA,UAAA,EACA,MACjB,oBAAA,EACF;AALmB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,SAAA,GAAA,SAAA;AACA,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAGjB,IAAA,IAAA,CAAK,WAAW,MAAA,CAAO,QAAA;AACvB,IAAA,IAAA,CAAK,cAAc,MAAA,CAAO,WAAA;AAC1B,IAAA,IAAA,CAAK,kBAAkB,MAAA,CAAO,eAAA;AAE9B,IAAA,IAAI,oBAAA,IAAwB,uBAAuB,CAAA,EAAG;AAClD,MAAA,IAAA,CAAK,uBAAuB,oBAAoB,CAAA;AAAA,IACpD;AAAA,EACJ;AAAA,EAbqB,MAAA;AAA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CAAO,MAAA,EAAQ,aAAa,CAAA;AAAA,EACnD;AAAA,EAEA,QAAQ,IAAA,EAAmE;AACvE,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,GAAG,IAAI,CAAA;AAAA,EACnC;AAAA,EAEA,IAAI,YAAA,GAA8B;AAC9B,IAAA,OAAO,KAAK,MAAA,CAAO,YAAA;AAAA,EACvB;AAAA;AAAA,EAGA,IAAI,kBAAA,GAA8B;AAC9B,IAAA,OAAO,KAAK,MAAA,CAAO,kBAAA;AAAA,EACvB;AACJ","file":"index.js","sourcesContent":["import { hex } from \"@scure/base\";\nimport { assertTimerMs } from \"../../utils/time\";\nimport { Wallet, extractArkProviderUrl, type ProviderConnectionState } from \"../wallet\";\nimport type { Activity, ActivityRegistry } from \"../activity\";\nimport type {\n ArkadeBroadcaster,\n ArkadeReader,\n GetArkadeInfoOptions,\n IWallet,\n IAssetManager,\n WalletBalance,\n WalletConfig,\n SettleParams,\n GetVtxosFilter,\n GetSpendableVtxosFilter,\n GetNewAddressesOptions,\n NewAddress,\n ArkTransaction,\n ExtendedCoin,\n Recipient,\n SendParams,\n} from \"..\";\nimport type { ArkadeInfo, SettlementEvent } from \"../../providers/ark\";\nimport type { Identity } from \"../../identity\";\nimport type {\n AddressAllocationCapable,\n HDAllocationCapable,\n HDWalletCapable,\n} from \"../hdWalletCapable\";\nimport type { IContractManager } from \"../../contracts/contractManager\";\nimport type { IDelegateManager } from \"../delegate\";\nimport type { TaskQueue, TaskItem } from \"../../worker/expo/taskQueue\";\nimport type { TaskProcessor, TaskDependencies } from \"../../worker/expo/taskRunner\";\nimport { runTasks } from \"../../worker/expo/taskRunner\";\nimport { contractPollProcessor, CONTRACT_POLL_TASK_TYPE } from \"../../worker/expo/processors\";\nimport { extendVirtualCoinForContract, getRandomId } from \"../utils\";\nimport type { PersistedBackgroundConfig } from \"./background\";\nimport type { AsyncStorageTaskQueue } from \"../../worker/expo/asyncStorageTaskQueue\";\nimport type { NormalizedExtendedVirtualCoin } from \"../vtxo\";\n\n/**\n * Background processing configuration for @see ExpoWallet.\n *\n * OS-level task registration is **not** part of this config — call\n * `registerExpoBackgroundTask` from `@arkade-os/sdk/wallet/expo/background`\n * explicitly. Splitting that step out keeps `/wallet/expo` free of the\n * `expo-task-manager` / `expo-background-task` dependencies, so\n * react-native-web and Node consumers can use `ExpoWallet` without\n * those native packages. See\n * https://github.com/arkade-os/ts-sdk/issues/486 for details.\n */\nexport interface ExpoBackgroundConfig {\n /** Persistence layer for foreground ↔ background handoff. */\n taskQueue: TaskQueue;\n /** Processors to run on each tick. Defaults to `[contractPollProcessor]`. */\n processors?: TaskProcessor[];\n /** If set, automatically polls at this interval (ms) while the app is in the foreground. */\n foregroundIntervalMs?: number;\n}\n\n/**\n * Configuration for @see ExpoWallet.setup.\n */\nexport interface ExpoWalletConfig extends WalletConfig {\n background: ExpoBackgroundConfig;\n}\n\n/**\n * Catches JS callers still passing the pre-fix-#486 fields: TypeScript\n * blocks these at compile time, but compiled JS silently dropped them\n * and consumers would never realize the OS task wasn't scheduled.\n *\n * @internal Exported for tests; not part of the public API surface.\n */\nexport function warnOnRemovedBackgroundFields(bg: unknown): void {\n if (!bg || typeof bg !== \"object\") return;\n const removed: string[] = [];\n if (\"taskName\" in bg) removed.push(\"taskName\");\n if (\"minimumBackgroundInterval\" in bg) {\n removed.push(\"minimumBackgroundInterval\");\n }\n if (removed.length === 0) return;\n console.warn(\n `[ark-sdk] ExpoWallet.setup: ignoring removed background field(s): ${removed.join(\", \")}. ` +\n 'OS-task registration moved to \"@arkade-os/sdk/wallet/expo/background\". ' +\n \"See https://github.com/arkade-os/ts-sdk/issues/486\",\n );\n}\n\n/**\n * Expo/React Native wallet with built-in background task processing.\n *\n * Wraps a standard @see Wallet and adds a lightweight task queue\n * for keeping contract/VTXO state fresh while the app is active and\n * across Expo BackgroundTask wakes.\n *\n * OS-level task registration is the consumer's responsibility — call\n * `registerExpoBackgroundTask` from\n * `@arkade-os/sdk/wallet/expo/background` after `setup()`. Keeping\n * registration out of `setup()` lets this entrypoint avoid pulling\n * `expo-task-manager` / `expo-background-task` into the `/wallet/expo`\n * bundle.\n *\n * @example\n * ```ts\n * import { ExpoWallet } from \"@arkade-os/sdk/wallet/expo\";\n * import { registerExpoBackgroundTask } from \"@arkade-os/sdk/wallet/expo/background\";\n * import { AsyncStorageTaskQueue } from \"@arkade-os/sdk/worker/expo\";\n *\n * const wallet = await ExpoWallet.setup({\n * identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),\n * arkProvider: new RestArkProvider(),\n * onchainProvider: new EsploraProvider(),\n * storage: { ... },\n * background: {\n * taskQueue: new AsyncStorageTaskQueue(AsyncStorage),\n * foregroundIntervalMs: 20_000,\n * },\n * });\n *\n * // Activate the OS scheduler (Expo Android/iOS only)\n * await registerExpoBackgroundTask(\"ark-background-poll\", { minimumInterval: 15 });\n *\n * const balance = await wallet.getBalance();\n * ```\n */\nexport class ExpoWallet\n implements IWallet, HDWalletCapable, HDAllocationCapable, AddressAllocationCapable\n{\n readonly identity: Identity;\n readonly arkProvider: Wallet[\"arkProvider\"];\n readonly indexerProvider: Wallet[\"indexerProvider\"];\n\n private foregroundIntervalId?: ReturnType<typeof setInterval>;\n private foregroundPollChain: Promise<void> = Promise.resolve();\n private cleared = false;\n\n private constructor(\n private readonly wallet: Wallet,\n private readonly taskQueue: TaskQueue,\n private readonly processors: TaskProcessor[],\n private readonly deps: TaskDependencies,\n foregroundIntervalMs?: number,\n ) {\n this.identity = wallet.identity;\n this.arkProvider = wallet.arkProvider;\n this.indexerProvider = wallet.indexerProvider;\n\n if (foregroundIntervalMs && foregroundIntervalMs > 0) {\n this.startForegroundPolling(foregroundIntervalMs);\n }\n }\n\n /**\n * Create an ExpoWallet with foreground/background queue handoff.\n *\n * 1. Creates the inner @see Wallet via `Wallet.create()`.\n * 2. Wires up processors (defaults to @see contractPollProcessor).\n * 3. Persists background config for the background handler (if the queue supports it).\n * 4. Seeds the task queue with a `contract-poll` task.\n * 5. Starts the foreground interval if `foregroundIntervalMs` is set.\n *\n * OS-level scheduling lives in\n * `@arkade-os/sdk/wallet/expo/background` and is invoked separately\n * by the consumer.\n */\n static async setup(config: ExpoWalletConfig): Promise<ExpoWallet> {\n assertTimerMs(\"foregroundIntervalMs\", config.background.foregroundIntervalMs);\n warnOnRemovedBackgroundFields(config.background);\n\n const wallet = await Wallet.create(config);\n\n const processors = config.background.processors ?? [contractPollProcessor];\n\n const deps: TaskDependencies = {\n walletRepository: wallet.walletRepository,\n contractRepository: wallet.contractRepository,\n indexerProvider: wallet.indexerProvider,\n arkProvider: wallet.arkProvider,\n extendVtxo: (vtxo, contract) => extendVirtualCoinForContract(vtxo, contract),\n };\n\n const { taskQueue } = config.background;\n\n // Persist wallet params so the background handler can rehydrate\n // without a network call. Only works with AsyncStorageTaskQueue.\n if (\"persistConfig\" in taskQueue) {\n const arkServerUrl = extractArkProviderUrl(wallet.arkProvider);\n\n if (typeof arkServerUrl === \"string\" && arkServerUrl.length > 0) {\n const timelock = wallet.offchainTapscript.options.csvTimelock;\n\n const bgConfig: PersistedBackgroundConfig = {\n arkServerUrl,\n pubkeyHex: hex.encode(wallet.offchainTapscript.options.pubKey),\n serverPubKeyHex: hex.encode(wallet.offchainTapscript.options.serverPubKey),\n exitTimelockValue: timelock.value.toString(),\n exitTimelockType: timelock.type,\n };\n\n await (taskQueue as AsyncStorageTaskQueue).persistConfig(bgConfig);\n }\n }\n\n const expoWallet = new ExpoWallet(\n wallet,\n taskQueue,\n processors,\n deps,\n config.background.foregroundIntervalMs,\n );\n\n // Seed the queue so the first tick (or background wake) has work to do\n await expoWallet.seedContractPollTask();\n\n return expoWallet;\n }\n\n // ── Foreground polling ───────────────────────────────────────────\n\n private startForegroundPolling(intervalMs: number): void {\n this.foregroundIntervalId = setInterval(() => {\n // Serialize polls so clear() can await the in-flight one before wiping.\n this.foregroundPollChain = this.foregroundPollChain\n .then(() => this.runForegroundPoll())\n .catch(console.error);\n }, intervalMs);\n }\n\n private async runForegroundPoll(): Promise<void> {\n if (this.cleared) return;\n\n await runTasks(this.taskQueue, this.processors, this.deps);\n\n // Consume results immediately (no background handoff needed)\n const results = await this.taskQueue.getResults();\n if (results.length > 0) {\n await this.taskQueue.acknowledgeResults(results.map((r) => r.id));\n }\n\n if (this.cleared) return;\n\n // Re-seed for the next tick\n await this.seedContractPollTask();\n }\n\n private async seedContractPollTask(): Promise<void> {\n const existing = await this.taskQueue.getTasks(CONTRACT_POLL_TASK_TYPE);\n if (existing.length > 0) return;\n\n const task: TaskItem = {\n id: getRandomId(),\n type: CONTRACT_POLL_TASK_TYPE,\n data: {},\n createdAt: Date.now(),\n };\n await this.taskQueue.addTask(task);\n }\n\n private async removeContractPollTasks(): Promise<void> {\n const tasks = await this.taskQueue.getTasks(CONTRACT_POLL_TASK_TYPE);\n for (const task of tasks) {\n await this.taskQueue.removeTask(task.id);\n }\n }\n\n // ── Lifecycle ────────────────────────────────────────────────────\n\n /**\n * Stop foreground polling and dispose the inner wallet.\n *\n * Does **not** unregister the OS background task — call\n * `unregisterExpoBackgroundTask` from\n * `@arkade-os/sdk/wallet/expo/background` yourself, matching the\n * explicit `register` step.\n */\n async dispose(): Promise<void> {\n if (this.foregroundIntervalId) {\n clearInterval(this.foregroundIntervalId);\n this.foregroundIntervalId = undefined;\n }\n\n await this.wallet.dispose();\n }\n\n /**\n * Stop foreground polling and wipe all locally persisted wallet data.\n * Does not unregister the OS background task or persisted queue config.\n */\n async clear(): Promise<void> {\n this.cleared = true;\n\n if (this.foregroundIntervalId) {\n clearInterval(this.foregroundIntervalId);\n this.foregroundIntervalId = undefined;\n }\n\n await this.foregroundPollChain;\n await this.wallet.clear();\n await this.removeContractPollTasks();\n }\n\n // ── IWallet delegation ───────────────────────────────────────────\n\n getAddress(): Promise<string> {\n return this.wallet.getAddress();\n }\n\n getBoardingAddress(): Promise<string> {\n return this.wallet.getBoardingAddress();\n }\n\n getArkadeInfo(opts?: GetArkadeInfoOptions): Promise<ArkadeInfo> {\n return this.wallet.getArkadeInfo(opts);\n }\n\n getArkadeReader(): Promise<ArkadeReader> {\n return this.wallet.getArkadeReader();\n }\n\n getArkadeBroadcaster(): Promise<ArkadeBroadcaster> {\n return this.wallet.getArkadeBroadcaster();\n }\n\n getBalance(): Promise<WalletBalance> {\n return this.wallet.getBalance();\n }\n\n getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]> {\n return this.wallet.getVtxos(filter);\n }\n\n getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]> {\n return this.wallet.getSpendableVtxos(filter);\n }\n\n getBoardingUtxos(): Promise<ExtendedCoin[]> {\n return this.wallet.getBoardingUtxos();\n }\n\n getTransactionHistory(): Promise<ArkTransaction[]> {\n return this.wallet.getTransactionHistory();\n }\n\n get activity(): ActivityRegistry {\n return this.wallet.activity;\n }\n\n getActivityHistory(): Promise<Activity[]> {\n return this.wallet.getActivityHistory();\n }\n\n getContractManager(): Promise<IContractManager> {\n return this.wallet.getContractManager();\n }\n\n // Descriptor surface, delegated like everything else here. Without these\n // the structural probes see a wallet with no HD state, so an Expo wallet\n // running `walletMode: 'hd'` would bind every artifact to its baseline\n // identity key — reusing one key across swaps while its receive addresses\n // rotate, and never allocating the indices a restore scan looks for.\n\n getCurrentSigningDescriptor(): Promise<string | undefined> {\n return this.wallet.getCurrentSigningDescriptor();\n }\n\n getNextSigningDescriptor(): Promise<string | undefined> {\n return this.wallet.getNextSigningDescriptor();\n }\n\n /** @see Wallet.getNewAddresses */\n getNewAddresses(opts?: GetNewAddressesOptions): Promise<NewAddress[]> {\n return this.wallet.getNewAddresses(opts);\n }\n\n getUsedSigningDescriptors(opts?: { lookAhead?: number }): Promise<string[]> {\n return this.wallet.getUsedSigningDescriptors(opts);\n }\n\n advanceSigningDescriptorWatermark(descriptor: string): Promise<void> {\n return this.wallet.advanceSigningDescriptorWatermark(descriptor);\n }\n\n signerForDescriptor(descriptor: string): Promise<Identity> {\n return this.wallet.signerForDescriptor(descriptor);\n }\n\n /**\n * Wallet-level provider-connection freshness, delegated to the wrapped\n * in-process wallet. Synchronous because the Expo foreground wallet is\n * in-process (no worker boundary). Foreground-only: it does not imply any\n * background task can read live foreground state.\n */\n getProviderConnectionState(): ProviderConnectionState {\n return this.wallet.getProviderConnectionState();\n }\n\n getDelegateManager(): Promise<IDelegateManager | undefined> {\n return this.wallet.getDelegateManager();\n }\n\n settle(\n params?: SettleParams,\n eventCallback?: (event: SettlementEvent) => void,\n ): Promise<string> {\n return this.wallet.settle(params, eventCallback);\n }\n\n send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise<string> {\n return this.wallet.send(...args);\n }\n\n get assetManager(): IAssetManager {\n return this.wallet.assetManager;\n }\n\n /** @see WalletConfig.concurrentSpending */\n get concurrentSpending(): boolean {\n return this.wallet.concurrentSpending;\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { W as WalletRepository, P as PageRequest, O as Outpoint, D as PageResult, B as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, h as ArkTransaction, Q as WalletState, a2 as DescriptorProvider, a3 as DescriptorSigningRequest, a4 as Transaction, l as GetNewAddressesOptions, m as NewAddress, a as Identity, w as RelativeTimelock, a5 as Network, a6 as CSVMultisigTapscript, a7 as BatchStartedEvent, a8 as TreeSigningStartedEvent, a9 as TxTree, aa as TreeNoncesEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, ad as BatchFailedEvent, ae as TreeTxEvent, af as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, C as ContractRepository, k as IContractManager, ag as IReadonlyWallet, ah as ReadonlyIdentity, ai as OnchainProvider, u as ArkProvider, v as IndexerProvider, aj as DelegateProvider, ak as ReadonlyWalletConfig, X as IntentRepository, _ as VirtualTxRepository, al as ExitCaptureMode, am as ExitDataSource, i as ActivityRegistry, an as IReadonlyAssetManager, ao as ContractSyncState, ap as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, aq as NetworkName, ar as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, as as ContractWithVtxos, at as selectPendingRecoveryOutpoints, j as Activity, au as Coin, av as ContractManager, aw as ContractManagerConfig, I as IWallet, ax as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ay as VtxoManager, n as IDelegateManager, S as SettleParams, R as Recipient, az as SignerSession, aA as SignedIntent, aB as Intent, p as SendParams, aC as TimeHeight } from './index-CH0tbuRp.cjs';
1
+ import { W as WalletRepository, P as PageRequest, O as Outpoint, D as PageResult, B as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, h as ArkTransaction, Q as WalletState, a2 as DescriptorProvider, a3 as DescriptorSigningRequest, a4 as Transaction, l as GetNewAddressesOptions, m as NewAddress, a as Identity, w as RelativeTimelock, a5 as Network, a6 as CSVMultisigTapscript, a7 as BatchStartedEvent, a8 as TreeSigningStartedEvent, a9 as TxTree, aa as TreeNoncesEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, ad as BatchFailedEvent, ae as TreeTxEvent, af as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, C as ContractRepository, k as IContractManager, ag as IReadonlyWallet, ah as ReadonlyIdentity, ai as OnchainProvider, u as ArkProvider, v as IndexerProvider, aj as DelegateProvider, ak as ReadonlyWalletConfig, X as IntentRepository, _ as VirtualTxRepository, al as ExitCaptureMode, am as ExitDataSource, i as ActivityRegistry, an as IReadonlyAssetManager, ao as ContractSyncState, ap as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, aq as NetworkName, ar as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, as as ContractWithVtxos, at as selectPendingRecoveryOutpoints, j as Activity, au as Coin, av as ContractManager, aw as ContractManagerConfig, I as IWallet, ax as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ay as VtxoManager, n as IDelegateManager, S as SettleParams, R as Recipient, az as SignerSession, aA as SignedIntent, aB as Intent, p as SendParams, aC as TimeHeight } from './index-BfvbSL0W.js';
2
2
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-C1wtM1NZ.cjs';
4
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Cz8FnLqi.js';
5
5
 
6
6
  /**
7
7
  * IndexedDB-based implementation of WalletRepository.
@@ -847,6 +847,23 @@ declare class ArkadeCashCreateError extends Error {
847
847
  /** The original failure from `send`. */
848
848
  cause: unknown);
849
849
  }
850
+ /**
851
+ * Thrown by {@link Wallet.claimCash} when the arkadeCash comes from another operator. Its signer
852
+ * is not the connected operator's active signer, and it is not in the operator's list of
853
+ * deprecated signers either. Nothing is queried or signed. To claim it, connect to the operator
854
+ * that issued it.
855
+ */
856
+ declare class ArkadeCashOperatorMismatchError extends Error {
857
+ /** The signer in the arkadeCash script, x-only hex. */
858
+ readonly cashSignerPubKey: string;
859
+ /** The active signer of the connected operator, x-only hex. */
860
+ readonly activeSignerPubKey: string;
861
+ constructor(
862
+ /** The signer in the arkadeCash script, x-only hex. */
863
+ cashSignerPubKey: string,
864
+ /** The active signer of the connected operator, x-only hex. */
865
+ activeSignerPubKey: string);
866
+ }
850
867
  /**
851
868
  * Freshness of provider-backed sync (server-info source + indexer-sync health). Balances/VTXOs
852
869
  * are always served from the repository regardless. `syncing` says a provider sync is in flight
@@ -899,6 +916,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
899
916
  private readonly _assetManager;
900
917
  readonly walletContractTimelocks: RelativeTimelock[];
901
918
  protected _pendingSpendOutpoints: Set<string>;
919
+ protected _heldOutpoints: Set<string>;
902
920
  /** Activity resolvers consumed by {@link getActivityHistory}. */
903
921
  readonly activity: ActivityRegistry;
904
922
  get assetManager(): IReadonlyAssetManager;
@@ -1066,6 +1084,11 @@ declare class ReadonlyWallet implements IReadonlyWallet {
1066
1084
  getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1067
1085
  /** Cached VTXOs; may be empty before the first sync. Never use for coin selection. */
1068
1086
  getStoredVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1087
+ /**
1088
+ * @internal The stored VTXOs {@link reserveVtxos} holds, minus any being spent: for renewal,
1089
+ * which skips them, to report the ones it would have renewed. No sync.
1090
+ */
1091
+ getHeldVtxos(): Promise<NormalizedExtendedVirtualCoin[]>;
1069
1092
  /** @inheritdoc */
1070
1093
  getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1071
1094
  /**
@@ -1170,6 +1193,12 @@ declare class ReadonlyWallet implements IReadonlyWallet {
1170
1193
  * recovery goes through the deprecated-signer migration API.
1171
1194
  */
1172
1195
  getBoardingUtxos(): Promise<ExtendedCoin[]>;
1196
+ /**
1197
+ * @internal {@link getBoardingUtxos} minus those an in-flight settle is spending, for SDK
1198
+ * picks. The getter itself lists them: callers that mirror it (the worker's cache and
1199
+ * broadcasts, balances) must not see a settle's inputs vanish, and then stay gone if it fails.
1200
+ */
1201
+ getSelectableBoardingUtxos(): Promise<ExtendedCoin[]>;
1173
1202
  getStoredBoardingUtxos(): Promise<ExtendedCoin[]>;
1174
1203
  /**
1175
1204
  * Subscribe to onchain and offchain notifications for newly received funds.
@@ -1501,7 +1530,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1501
1530
  private _doRotateServerSigner;
1502
1531
  /**
1503
1532
  * Serializes `settle`/`send` so VtxoManager's background renewal can't race user
1504
- * transactions for the same inputs.
1533
+ * transactions for the same inputs; with `concurrentSpending`, only until inputs are reserved.
1505
1534
  */
1506
1535
  private _txLock;
1507
1536
  private readonly _settlingOutpoints;
@@ -1509,7 +1538,21 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1509
1538
  private _restoreInFlight?;
1510
1539
  private _addPendingSpends;
1511
1540
  private _removePendingSpends;
1541
+ /**
1542
+ * Hold VTXOs so no SDK-chosen spend picks them; the holder still spends them by naming them.
1543
+ * All-or-nothing: throws {@link VtxoReservedError} if any is held or already being spent.
1544
+ * In-memory, for this `Wallet` instance only.
1545
+ */
1546
+ reserveVtxos(outpoints: readonly Outpoint[]): VtxoReservation;
1547
+ /**
1548
+ * @internal For `AssetManager`: reserves what `fn` submits, hiding it from other picks until
1549
+ * the submit ends. With `concurrentSpending`, `fn` runs under the wallet lock, released once
1550
+ * the inputs are reserved; otherwise `fn` runs unlocked and only the submit takes the lock.
1551
+ */
1552
+ withSpendLock<T>(fn: (submit: OffchainSubmit) => Promise<T>): Promise<T>;
1512
1553
  private _withTxLock;
1554
+ private _assertNotInFlight;
1555
+ private _assertNotHeld;
1513
1556
  /**
1514
1557
  * Explicitly recover this wallet's contracts and balance on a fresh repo: a gap-limit scan
1515
1558
  * for HD wallets, the single default pubkey otherwise. Throws on operational failure (a
@@ -1528,6 +1571,10 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1528
1571
  }): Promise<void>;
1529
1572
  private _runRestore;
1530
1573
  readonly settlementConfig: SettlementConfig | false;
1574
+ private _concurrentSpending;
1575
+ private _submitsAwaitingFinalize;
1576
+ /** @see WalletConfig.concurrentSpending */
1577
+ get concurrentSpending(): boolean;
1531
1578
  /** Public here; `ReadonlyWallet` keeps it protected so a readonly view can't submit. */
1532
1579
  readonly arkProvider: ArkProvider;
1533
1580
  /**
@@ -1825,6 +1872,27 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1825
1872
  declare class AbortError extends Error {
1826
1873
  constructor(message?: string);
1827
1874
  }
1875
+ /**
1876
+ * A VTXO named for a spend or a hold is held, or already being spent by another operation.
1877
+ * Match on `name`, not `instanceof`: only the name survives the service-worker boundary.
1878
+ */
1879
+ declare class VtxoReservedError extends Error {
1880
+ readonly outpoints: readonly string[];
1881
+ readonly holder: "in-flight" | "held";
1882
+ readonly name = "VtxoReservedError";
1883
+ constructor(outpoints: readonly string[], holder: "in-flight" | "held");
1884
+ }
1885
+ /** A hold placed by {@link Wallet.reserveVtxos}. */
1886
+ interface VtxoReservation {
1887
+ readonly outpoints: readonly Outpoint[];
1888
+ /** Idempotent. */
1889
+ release(): void;
1890
+ }
1891
+ /** @internal Submits an Arkade transaction for {@link Wallet.withSpendLock}'s caller. */
1892
+ type OffchainSubmit = (inputs: ExtendedVirtualCoin[], outputs: TransactionOutput[]) => Promise<{
1893
+ arkTxid: string;
1894
+ signedCheckpointTxs: string[];
1895
+ }>;
1828
1896
  /** Options for {@link waitForIncomingFunds}. */
1829
1897
  interface WaitForIncomingFundsOptions {
1830
1898
  /**
@@ -1863,4 +1931,4 @@ interface WaitForIncomingFundsOptions {
1863
1931
  */
1864
1932
  declare function waitForIncomingFunds(wallet: Wallet, options?: WaitForIncomingFundsOptions): Promise<IncomingFunds>;
1865
1933
 
1866
- export { waitForIncomingFunds as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, assertValidServerUnrollScript as E, ForeignDescriptorError as F, defaultBatchExpiryPolicy as G, type HDWalletCapable as H, type IncomingFunds as I, defaultCheckpointExitDelayPolicy as J, KeyringDescriptorProvider as K, isAddressAllocationCapable as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, isArkError as N, isHDAllocationCapable as O, type ProviderConnectionState as P, isHDWalletCapable as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, maybeArkError as T, resolveBatchExpiryPolicy as U, resolveCheckpointExitDelayPolicy as V, Wallet as W, resolveDescriptorSigner as X, selectVirtualCoins as Y, signingDescriptorIndex as Z, strictSigningDescriptorIndex as _, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, AbortError as f, ArkError as g, ArkErrorName as h, type ArkadeCashClaimResult as i, ArkadeCashCreateError as j, type ArkadeCashUnclaimedReason as k, type ArkadeCashUnclaimedVtxo as l, type ArkadeCashVtxoRef as m, type BoardingUtxoGroup as n, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as o, IndexedDBWalletRepository as p, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as q, type ProviderKind as r, ProviderUnavailableError as s, REGTEST_MIN_BATCH_EXPIRY_SECONDS as t, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as u, type ServerInfoSource as v, ServerResponseMismatchError as w, type WaitForIncomingFundsOptions as x, WalletCannotAllocateAddressError as y, assertValidBatchExpiry as z };
1934
+ export { selectVirtualCoins as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, WalletCannotAllocateAddressError as E, ForeignDescriptorError as F, assertValidBatchExpiry as G, type HDWalletCapable as H, type IncomingFunds as I, assertValidServerUnrollScript as J, KeyringDescriptorProvider as K, defaultBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, defaultCheckpointExitDelayPolicy as N, isAddressAllocationCapable as O, type ProviderConnectionState as P, isArkError as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, isHDAllocationCapable as T, isHDWalletCapable as U, type VtxoReservation as V, Wallet as W, maybeArkError as X, resolveBatchExpiryPolicy as Y, resolveCheckpointExitDelayPolicy as Z, resolveDescriptorSigner as _, type HDAllocationCapable as a, signingDescriptorIndex as a0, strictSigningDescriptorIndex as a1, waitForIncomingFunds as a2, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, AbortError as f, ArkError as g, ArkErrorName as h, type ArkadeCashClaimResult as i, ArkadeCashCreateError as j, ArkadeCashOperatorMismatchError as k, type ArkadeCashUnclaimedReason as l, type ArkadeCashUnclaimedVtxo as m, type ArkadeCashVtxoRef as n, type BoardingUtxoGroup as o, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as p, IndexedDBWalletRepository as q, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as r, type ProviderKind as s, ProviderUnavailableError as t, REGTEST_MIN_BATCH_EXPIRY_SECONDS as u, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as v, type ServerInfoSource as w, ServerResponseMismatchError as x, VtxoReservedError as y, type WaitForIncomingFundsOptions as z };
@@ -1,7 +1,7 @@
1
- import { W as WalletRepository, P as PageRequest, O as Outpoint, D as PageResult, B as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, h as ArkTransaction, Q as WalletState, a2 as DescriptorProvider, a3 as DescriptorSigningRequest, a4 as Transaction, l as GetNewAddressesOptions, m as NewAddress, a as Identity, w as RelativeTimelock, a5 as Network, a6 as CSVMultisigTapscript, a7 as BatchStartedEvent, a8 as TreeSigningStartedEvent, a9 as TxTree, aa as TreeNoncesEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, ad as BatchFailedEvent, ae as TreeTxEvent, af as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, C as ContractRepository, k as IContractManager, ag as IReadonlyWallet, ah as ReadonlyIdentity, ai as OnchainProvider, u as ArkProvider, v as IndexerProvider, aj as DelegateProvider, ak as ReadonlyWalletConfig, X as IntentRepository, _ as VirtualTxRepository, al as ExitCaptureMode, am as ExitDataSource, i as ActivityRegistry, an as IReadonlyAssetManager, ao as ContractSyncState, ap as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, aq as NetworkName, ar as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, as as ContractWithVtxos, at as selectPendingRecoveryOutpoints, j as Activity, au as Coin, av as ContractManager, aw as ContractManagerConfig, I as IWallet, ax as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ay as VtxoManager, n as IDelegateManager, S as SettleParams, R as Recipient, az as SignerSession, aA as SignedIntent, aB as Intent, p as SendParams, aC as TimeHeight } from './index-CH0tbuRp.js';
1
+ import { W as WalletRepository, P as PageRequest, O as Outpoint, D as PageResult, B as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, h as ArkTransaction, Q as WalletState, a2 as DescriptorProvider, a3 as DescriptorSigningRequest, a4 as Transaction, l as GetNewAddressesOptions, m as NewAddress, a as Identity, w as RelativeTimelock, a5 as Network, a6 as CSVMultisigTapscript, a7 as BatchStartedEvent, a8 as TreeSigningStartedEvent, a9 as TxTree, aa as TreeNoncesEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, ad as BatchFailedEvent, ae as TreeTxEvent, af as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, C as ContractRepository, k as IContractManager, ag as IReadonlyWallet, ah as ReadonlyIdentity, ai as OnchainProvider, u as ArkProvider, v as IndexerProvider, aj as DelegateProvider, ak as ReadonlyWalletConfig, X as IntentRepository, _ as VirtualTxRepository, al as ExitCaptureMode, am as ExitDataSource, i as ActivityRegistry, an as IReadonlyAssetManager, ao as ContractSyncState, ap as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, aq as NetworkName, ar as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, as as ContractWithVtxos, at as selectPendingRecoveryOutpoints, j as Activity, au as Coin, av as ContractManager, aw as ContractManagerConfig, I as IWallet, ax as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ay as VtxoManager, n as IDelegateManager, S as SettleParams, R as Recipient, az as SignerSession, aA as SignedIntent, aB as Intent, p as SendParams, aC as TimeHeight } from './index-BfvbSL0W.cjs';
2
2
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-CJ34lCIK.js';
4
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-r3jh7UcH.cjs';
5
5
 
6
6
  /**
7
7
  * IndexedDB-based implementation of WalletRepository.
@@ -847,6 +847,23 @@ declare class ArkadeCashCreateError extends Error {
847
847
  /** The original failure from `send`. */
848
848
  cause: unknown);
849
849
  }
850
+ /**
851
+ * Thrown by {@link Wallet.claimCash} when the arkadeCash comes from another operator. Its signer
852
+ * is not the connected operator's active signer, and it is not in the operator's list of
853
+ * deprecated signers either. Nothing is queried or signed. To claim it, connect to the operator
854
+ * that issued it.
855
+ */
856
+ declare class ArkadeCashOperatorMismatchError extends Error {
857
+ /** The signer in the arkadeCash script, x-only hex. */
858
+ readonly cashSignerPubKey: string;
859
+ /** The active signer of the connected operator, x-only hex. */
860
+ readonly activeSignerPubKey: string;
861
+ constructor(
862
+ /** The signer in the arkadeCash script, x-only hex. */
863
+ cashSignerPubKey: string,
864
+ /** The active signer of the connected operator, x-only hex. */
865
+ activeSignerPubKey: string);
866
+ }
850
867
  /**
851
868
  * Freshness of provider-backed sync (server-info source + indexer-sync health). Balances/VTXOs
852
869
  * are always served from the repository regardless. `syncing` says a provider sync is in flight
@@ -899,6 +916,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
899
916
  private readonly _assetManager;
900
917
  readonly walletContractTimelocks: RelativeTimelock[];
901
918
  protected _pendingSpendOutpoints: Set<string>;
919
+ protected _heldOutpoints: Set<string>;
902
920
  /** Activity resolvers consumed by {@link getActivityHistory}. */
903
921
  readonly activity: ActivityRegistry;
904
922
  get assetManager(): IReadonlyAssetManager;
@@ -1066,6 +1084,11 @@ declare class ReadonlyWallet implements IReadonlyWallet {
1066
1084
  getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1067
1085
  /** Cached VTXOs; may be empty before the first sync. Never use for coin selection. */
1068
1086
  getStoredVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1087
+ /**
1088
+ * @internal The stored VTXOs {@link reserveVtxos} holds, minus any being spent: for renewal,
1089
+ * which skips them, to report the ones it would have renewed. No sync.
1090
+ */
1091
+ getHeldVtxos(): Promise<NormalizedExtendedVirtualCoin[]>;
1069
1092
  /** @inheritdoc */
1070
1093
  getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1071
1094
  /**
@@ -1170,6 +1193,12 @@ declare class ReadonlyWallet implements IReadonlyWallet {
1170
1193
  * recovery goes through the deprecated-signer migration API.
1171
1194
  */
1172
1195
  getBoardingUtxos(): Promise<ExtendedCoin[]>;
1196
+ /**
1197
+ * @internal {@link getBoardingUtxos} minus those an in-flight settle is spending, for SDK
1198
+ * picks. The getter itself lists them: callers that mirror it (the worker's cache and
1199
+ * broadcasts, balances) must not see a settle's inputs vanish, and then stay gone if it fails.
1200
+ */
1201
+ getSelectableBoardingUtxos(): Promise<ExtendedCoin[]>;
1173
1202
  getStoredBoardingUtxos(): Promise<ExtendedCoin[]>;
1174
1203
  /**
1175
1204
  * Subscribe to onchain and offchain notifications for newly received funds.
@@ -1501,7 +1530,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1501
1530
  private _doRotateServerSigner;
1502
1531
  /**
1503
1532
  * Serializes `settle`/`send` so VtxoManager's background renewal can't race user
1504
- * transactions for the same inputs.
1533
+ * transactions for the same inputs; with `concurrentSpending`, only until inputs are reserved.
1505
1534
  */
1506
1535
  private _txLock;
1507
1536
  private readonly _settlingOutpoints;
@@ -1509,7 +1538,21 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1509
1538
  private _restoreInFlight?;
1510
1539
  private _addPendingSpends;
1511
1540
  private _removePendingSpends;
1541
+ /**
1542
+ * Hold VTXOs so no SDK-chosen spend picks them; the holder still spends them by naming them.
1543
+ * All-or-nothing: throws {@link VtxoReservedError} if any is held or already being spent.
1544
+ * In-memory, for this `Wallet` instance only.
1545
+ */
1546
+ reserveVtxos(outpoints: readonly Outpoint[]): VtxoReservation;
1547
+ /**
1548
+ * @internal For `AssetManager`: reserves what `fn` submits, hiding it from other picks until
1549
+ * the submit ends. With `concurrentSpending`, `fn` runs under the wallet lock, released once
1550
+ * the inputs are reserved; otherwise `fn` runs unlocked and only the submit takes the lock.
1551
+ */
1552
+ withSpendLock<T>(fn: (submit: OffchainSubmit) => Promise<T>): Promise<T>;
1512
1553
  private _withTxLock;
1554
+ private _assertNotInFlight;
1555
+ private _assertNotHeld;
1513
1556
  /**
1514
1557
  * Explicitly recover this wallet's contracts and balance on a fresh repo: a gap-limit scan
1515
1558
  * for HD wallets, the single default pubkey otherwise. Throws on operational failure (a
@@ -1528,6 +1571,10 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1528
1571
  }): Promise<void>;
1529
1572
  private _runRestore;
1530
1573
  readonly settlementConfig: SettlementConfig | false;
1574
+ private _concurrentSpending;
1575
+ private _submitsAwaitingFinalize;
1576
+ /** @see WalletConfig.concurrentSpending */
1577
+ get concurrentSpending(): boolean;
1531
1578
  /** Public here; `ReadonlyWallet` keeps it protected so a readonly view can't submit. */
1532
1579
  readonly arkProvider: ArkProvider;
1533
1580
  /**
@@ -1825,6 +1872,27 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1825
1872
  declare class AbortError extends Error {
1826
1873
  constructor(message?: string);
1827
1874
  }
1875
+ /**
1876
+ * A VTXO named for a spend or a hold is held, or already being spent by another operation.
1877
+ * Match on `name`, not `instanceof`: only the name survives the service-worker boundary.
1878
+ */
1879
+ declare class VtxoReservedError extends Error {
1880
+ readonly outpoints: readonly string[];
1881
+ readonly holder: "in-flight" | "held";
1882
+ readonly name = "VtxoReservedError";
1883
+ constructor(outpoints: readonly string[], holder: "in-flight" | "held");
1884
+ }
1885
+ /** A hold placed by {@link Wallet.reserveVtxos}. */
1886
+ interface VtxoReservation {
1887
+ readonly outpoints: readonly Outpoint[];
1888
+ /** Idempotent. */
1889
+ release(): void;
1890
+ }
1891
+ /** @internal Submits an Arkade transaction for {@link Wallet.withSpendLock}'s caller. */
1892
+ type OffchainSubmit = (inputs: ExtendedVirtualCoin[], outputs: TransactionOutput[]) => Promise<{
1893
+ arkTxid: string;
1894
+ signedCheckpointTxs: string[];
1895
+ }>;
1828
1896
  /** Options for {@link waitForIncomingFunds}. */
1829
1897
  interface WaitForIncomingFundsOptions {
1830
1898
  /**
@@ -1863,4 +1931,4 @@ interface WaitForIncomingFundsOptions {
1863
1931
  */
1864
1932
  declare function waitForIncomingFunds(wallet: Wallet, options?: WaitForIncomingFundsOptions): Promise<IncomingFunds>;
1865
1933
 
1866
- export { waitForIncomingFunds as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, assertValidServerUnrollScript as E, ForeignDescriptorError as F, defaultBatchExpiryPolicy as G, type HDWalletCapable as H, type IncomingFunds as I, defaultCheckpointExitDelayPolicy as J, KeyringDescriptorProvider as K, isAddressAllocationCapable as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, isArkError as N, isHDAllocationCapable as O, type ProviderConnectionState as P, isHDWalletCapable as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, maybeArkError as T, resolveBatchExpiryPolicy as U, resolveCheckpointExitDelayPolicy as V, Wallet as W, resolveDescriptorSigner as X, selectVirtualCoins as Y, signingDescriptorIndex as Z, strictSigningDescriptorIndex as _, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, AbortError as f, ArkError as g, ArkErrorName as h, type ArkadeCashClaimResult as i, ArkadeCashCreateError as j, type ArkadeCashUnclaimedReason as k, type ArkadeCashUnclaimedVtxo as l, type ArkadeCashVtxoRef as m, type BoardingUtxoGroup as n, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as o, IndexedDBWalletRepository as p, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as q, type ProviderKind as r, ProviderUnavailableError as s, REGTEST_MIN_BATCH_EXPIRY_SECONDS as t, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as u, type ServerInfoSource as v, ServerResponseMismatchError as w, type WaitForIncomingFundsOptions as x, WalletCannotAllocateAddressError as y, assertValidBatchExpiry as z };
1934
+ export { selectVirtualCoins as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, WalletCannotAllocateAddressError as E, ForeignDescriptorError as F, assertValidBatchExpiry as G, type HDWalletCapable as H, type IncomingFunds as I, assertValidServerUnrollScript as J, KeyringDescriptorProvider as K, defaultBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, defaultCheckpointExitDelayPolicy as N, isAddressAllocationCapable as O, type ProviderConnectionState as P, isArkError as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, isHDAllocationCapable as T, isHDWalletCapable as U, type VtxoReservation as V, Wallet as W, maybeArkError as X, resolveBatchExpiryPolicy as Y, resolveCheckpointExitDelayPolicy as Z, resolveDescriptorSigner as _, type HDAllocationCapable as a, signingDescriptorIndex as a0, strictSigningDescriptorIndex as a1, waitForIncomingFunds as a2, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, AbortError as f, ArkError as g, ArkErrorName as h, type ArkadeCashClaimResult as i, ArkadeCashCreateError as j, ArkadeCashOperatorMismatchError as k, type ArkadeCashUnclaimedReason as l, type ArkadeCashUnclaimedVtxo as m, type ArkadeCashVtxoRef as n, type BoardingUtxoGroup as o, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as p, IndexedDBWalletRepository as q, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as r, type ProviderKind as s, ProviderUnavailableError as t, REGTEST_MIN_BATCH_EXPIRY_SECONDS as u, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as v, type ServerInfoSource as w, ServerResponseMismatchError as x, VtxoReservedError as y, type WaitForIncomingFundsOptions as z };
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkMJG2O6PT_cjs = require('../../chunk-MJG2O6PT.cjs');
4
- require('../../chunk-OIYVDV2N.cjs');
5
- require('../../chunk-PAD5V653.cjs');
6
- require('../../chunk-UV3IM6BG.cjs');
7
- require('../../chunk-65CTZR2O.cjs');
3
+ var chunkQCD3SJOL_cjs = require('../../chunk-QCD3SJOL.cjs');
4
+ require('../../chunk-B2YMUJD5.cjs');
5
+ require('../../chunk-FEBAG2K2.cjs');
6
+ require('../../chunk-CFOIHLON.cjs');
7
+ require('../../chunk-VVFCCNU2.cjs');
8
8
 
9
9
  // src/worker/expo/taskQueue.ts
10
10
  var InMemoryTaskQueue = class {
@@ -120,19 +120,19 @@ var AsyncStorageTaskQueue = class {
120
120
 
121
121
  Object.defineProperty(exports, "CONTRACT_POLL_TASK_TYPE", {
122
122
  enumerable: true,
123
- get: function () { return chunkMJG2O6PT_cjs.CONTRACT_POLL_TASK_TYPE; }
123
+ get: function () { return chunkQCD3SJOL_cjs.CONTRACT_POLL_TASK_TYPE; }
124
124
  });
125
125
  Object.defineProperty(exports, "contractPollProcessor", {
126
126
  enumerable: true,
127
- get: function () { return chunkMJG2O6PT_cjs.contractPollProcessor; }
127
+ get: function () { return chunkQCD3SJOL_cjs.contractPollProcessor; }
128
128
  });
129
129
  Object.defineProperty(exports, "createTaskDependencies", {
130
130
  enumerable: true,
131
- get: function () { return chunkMJG2O6PT_cjs.createTaskDependencies; }
131
+ get: function () { return chunkQCD3SJOL_cjs.createTaskDependencies; }
132
132
  });
133
133
  Object.defineProperty(exports, "runTasks", {
134
134
  enumerable: true,
135
- get: function () { return chunkMJG2O6PT_cjs.runTasks; }
135
+ get: function () { return chunkQCD3SJOL_cjs.runTasks; }
136
136
  });
137
137
  exports.AsyncStorageTaskQueue = AsyncStorageTaskQueue;
138
138
  exports.InMemoryTaskQueue = InMemoryTaskQueue;
@@ -1,7 +1,7 @@
1
- import { T as TaskProcessor } from '../../taskRunner-Ox7fjm1O.cjs';
2
- export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, a as TaskDependencies, b as TaskItem, c as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-Ox7fjm1O.cjs';
3
- export { A as AsyncStorageLike, a as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-DeXfxJp5.cjs';
4
- import '../../index-CH0tbuRp.cjs';
1
+ import { T as TaskProcessor } from '../../taskRunner-BO8a-SQh.cjs';
2
+ export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, b as TaskDependencies, c as TaskItem, a as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-BO8a-SQh.cjs';
3
+ export { a as AsyncStorageLike, A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-CFWscYpG.cjs';
4
+ import '../../index-BfvbSL0W.cjs';
5
5
  import '@scure/btc-signer/utils.js';
6
6
  import '@scure/btc-signer/psbt.js';
7
7
  import '@scure/btc-signer';
@@ -1,7 +1,7 @@
1
- import { T as TaskProcessor } from '../../taskRunner-DGSSHZ6e.js';
2
- export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, a as TaskDependencies, b as TaskItem, c as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-DGSSHZ6e.js';
3
- export { A as AsyncStorageLike, a as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-C4ESykOx.js';
4
- import '../../index-CH0tbuRp.js';
1
+ import { T as TaskProcessor } from '../../taskRunner-CXAcjtdU.js';
2
+ export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, b as TaskDependencies, c as TaskItem, a as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-CXAcjtdU.js';
3
+ export { a as AsyncStorageLike, A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-DrFapzPg.js';
4
+ import '../../index-BfvbSL0W.js';
5
5
  import '@scure/btc-signer/utils.js';
6
6
  import '@scure/btc-signer/psbt.js';
7
7
  import '@scure/btc-signer';
@@ -1,8 +1,8 @@
1
- export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks } from '../../chunk-RDJIT7RA.js';
2
- import '../../chunk-WXHMXKPV.js';
3
- import '../../chunk-PD5CVWPT.js';
4
- import '../../chunk-RFI6RO25.js';
5
- import '../../chunk-HGOERMAY.js';
1
+ export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks } from '../../chunk-HPUKFTZV.js';
2
+ import '../../chunk-U5ZRDVVB.js';
3
+ import '../../chunk-5JQ5EOYE.js';
4
+ import '../../chunk-N2VM6V6K.js';
5
+ import '../../chunk-HTCIPDVW.js';
6
6
 
7
7
  // src/worker/expo/taskQueue.ts
8
8
  var InMemoryTaskQueue = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/sdk",
3
- "version": "0.5.0-rc.24",
3
+ "version": "0.5.0-rc.26",
4
4
  "description": "TypeScript SDK for building Bitcoin wallets using the Arkade protocol",
5
5
  "repository": {
6
6
  "type": "git",