@arkade-os/sdk 0.4.68 → 0.4.69

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 (74) hide show
  1. package/README.md +33 -0
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/adapters/indexedDB.cjs +5 -5
  7. package/dist/adapters/indexedDB.js +4 -4
  8. package/dist/{asyncStorageTaskQueue-DaZlVTbM.d.ts → asyncStorageTaskQueue-BgUJN-3X.d.ts} +1 -1
  9. package/dist/{asyncStorageTaskQueue-B2CcXIHU.d.cts → asyncStorageTaskQueue-Cstx6hS7.d.cts} +1 -1
  10. package/dist/{chunk-45FKMOJH.js → chunk-2PPL3O7Z.js} +3 -3
  11. package/dist/{chunk-45FKMOJH.js.map → chunk-2PPL3O7Z.js.map} +1 -1
  12. package/dist/{chunk-EJOFL5WH.cjs → chunk-5MLC2HU3.cjs} +3 -3
  13. package/dist/{chunk-EJOFL5WH.cjs.map → chunk-5MLC2HU3.cjs.map} +1 -1
  14. package/dist/{chunk-WCJVKFAP.cjs → chunk-EBYCTLET.cjs} +787 -479
  15. package/dist/chunk-EBYCTLET.cjs.map +1 -0
  16. package/dist/{chunk-PJR63FTK.cjs → chunk-GVHUHTRH.cjs} +17 -17
  17. package/dist/{chunk-PJR63FTK.cjs.map → chunk-GVHUHTRH.cjs.map} +1 -1
  18. package/dist/{chunk-4KCVS4ZN.cjs → chunk-HQ4DMGA4.cjs} +10 -10
  19. package/dist/{chunk-4KCVS4ZN.cjs.map → chunk-HQ4DMGA4.cjs.map} +1 -1
  20. package/dist/{chunk-4CMXV5SF.js → chunk-L5SCQYHF.js} +3 -3
  21. package/dist/{chunk-4CMXV5SF.js.map → chunk-L5SCQYHF.js.map} +1 -1
  22. package/dist/{chunk-G4I6PU5H.js → chunk-MNMPGEK2.js} +4 -4
  23. package/dist/{chunk-G4I6PU5H.js.map → chunk-MNMPGEK2.js.map} +1 -1
  24. package/dist/{chunk-VBHXBI7F.js → chunk-TA7XLEP2.js} +357 -50
  25. package/dist/chunk-TA7XLEP2.js.map +1 -0
  26. package/dist/{chunk-6YUACVX4.cjs → chunk-WIFL5QYZ.cjs} +49 -49
  27. package/dist/{chunk-6YUACVX4.cjs.map → chunk-WIFL5QYZ.cjs.map} +1 -1
  28. package/dist/{chunk-GQ4NMQGR.js → chunk-XLWDX7QZ.js} +4 -4
  29. package/dist/{chunk-GQ4NMQGR.js.map → chunk-XLWDX7QZ.js.map} +1 -1
  30. package/dist/{chunk-JGMSZIE4.cjs → chunk-XQPN5YP2.cjs} +17 -17
  31. package/dist/{chunk-JGMSZIE4.cjs.map → chunk-XQPN5YP2.cjs.map} +1 -1
  32. package/dist/{chunk-33Q2RFET.js → chunk-YG7T6LI3.js} +3 -3
  33. package/dist/{chunk-33Q2RFET.js.map → chunk-YG7T6LI3.js.map} +1 -1
  34. package/dist/contracts/handlers/index.cjs +9 -9
  35. package/dist/contracts/handlers/index.d.cts +3 -3
  36. package/dist/contracts/handlers/index.d.ts +3 -3
  37. package/dist/contracts/handlers/index.js +2 -2
  38. package/dist/{delegate-AomVWxO_.d.ts → delegate-BPdzTbwN.d.ts} +1 -1
  39. package/dist/{delegate-Bffc5f54.d.cts → delegate-DrwIar11.d.cts} +1 -1
  40. package/dist/{hdWalletCapable-DZdIVa23.d.ts → hdWalletCapable-D4WH35z0.d.cts} +49 -5
  41. package/dist/{hdWalletCapable-B5nRs3RH.d.cts → hdWalletCapable-DyxCiNVE.d.ts} +49 -5
  42. package/dist/{index-nfyQM33h.d.cts → index-BqhpAqqj.d.cts} +2 -2
  43. package/dist/{index-jouvy8FD.d.ts → index-TZJvbIaA.d.ts} +2 -2
  44. package/dist/{index-C7RZCfoY.d.cts → index-dWRqYSdS.d.cts} +53 -1
  45. package/dist/{index-C7RZCfoY.d.ts → index-dWRqYSdS.d.ts} +53 -1
  46. package/dist/index.cjs +294 -290
  47. package/dist/index.d.cts +25 -8
  48. package/dist/index.d.ts +25 -8
  49. package/dist/index.js +4 -4
  50. package/dist/repositories/realm/index.cjs +19 -19
  51. package/dist/repositories/realm/index.d.cts +2 -2
  52. package/dist/repositories/realm/index.d.ts +2 -2
  53. package/dist/repositories/realm/index.js +5 -5
  54. package/dist/repositories/sqlite/index.cjs +18 -18
  55. package/dist/repositories/sqlite/index.d.cts +2 -2
  56. package/dist/repositories/sqlite/index.d.ts +2 -2
  57. package/dist/repositories/sqlite/index.js +5 -5
  58. package/dist/{taskRunner-D2vnpPBT.d.cts → taskRunner-CzYKyJ9c.d.cts} +1 -1
  59. package/dist/{taskRunner-DuwK9t8O.d.ts → taskRunner-D2fnbqYw.d.ts} +1 -1
  60. package/dist/wallet/expo/background.cjs +14 -14
  61. package/dist/wallet/expo/background.d.cts +3 -3
  62. package/dist/wallet/expo/background.d.ts +3 -3
  63. package/dist/wallet/expo/background.js +6 -6
  64. package/dist/wallet/expo/index.cjs +14 -14
  65. package/dist/wallet/expo/index.d.cts +4 -4
  66. package/dist/wallet/expo/index.d.ts +4 -4
  67. package/dist/wallet/expo/index.js +5 -5
  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-VBHXBI7F.js.map +0 -1
  74. package/dist/chunk-WCJVKFAP.cjs.map +0 -1
@@ -1,38 +1,38 @@
1
1
  'use strict';
2
2
 
3
- var chunk6YUACVX4_cjs = require('../../chunk-6YUACVX4.cjs');
4
- require('../../chunk-EJOFL5WH.cjs');
3
+ var chunkWIFL5QYZ_cjs = require('../../chunk-WIFL5QYZ.cjs');
4
+ require('../../chunk-5MLC2HU3.cjs');
5
5
  require('../../chunk-5BLDMQED.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "ArkadeContractHandler", {
10
10
  enumerable: true,
11
- get: function () { return chunk6YUACVX4_cjs.ArkadeContractHandler; }
11
+ get: function () { return chunkWIFL5QYZ_cjs.ArkadeContractHandler; }
12
12
  });
13
13
  Object.defineProperty(exports, "BoardingContractHandler", {
14
14
  enumerable: true,
15
- get: function () { return chunk6YUACVX4_cjs.BoardingContractHandler; }
15
+ get: function () { return chunkWIFL5QYZ_cjs.BoardingContractHandler; }
16
16
  });
17
17
  Object.defineProperty(exports, "DefaultContractHandler", {
18
18
  enumerable: true,
19
- get: function () { return chunk6YUACVX4_cjs.DefaultContractHandler; }
19
+ get: function () { return chunkWIFL5QYZ_cjs.DefaultContractHandler; }
20
20
  });
21
21
  Object.defineProperty(exports, "DelegateContractHandler", {
22
22
  enumerable: true,
23
- get: function () { return chunk6YUACVX4_cjs.DelegateContractHandler; }
23
+ get: function () { return chunkWIFL5QYZ_cjs.DelegateContractHandler; }
24
24
  });
25
25
  Object.defineProperty(exports, "VHTLCContractHandler", {
26
26
  enumerable: true,
27
- get: function () { return chunk6YUACVX4_cjs.VHTLCContractHandler; }
27
+ get: function () { return chunkWIFL5QYZ_cjs.VHTLCContractHandler; }
28
28
  });
29
29
  Object.defineProperty(exports, "VHTLCV2ContractHandler", {
30
30
  enumerable: true,
31
- get: function () { return chunk6YUACVX4_cjs.VHTLCV2ContractHandler; }
31
+ get: function () { return chunkWIFL5QYZ_cjs.VHTLCV2ContractHandler; }
32
32
  });
33
33
  Object.defineProperty(exports, "contractHandlers", {
34
34
  enumerable: true,
35
- get: function () { return chunk6YUACVX4_cjs.contractHandlers; }
35
+ get: function () { return chunkWIFL5QYZ_cjs.contractHandlers; }
36
36
  });
37
37
  //# sourceMappingURL=index.cjs.map
38
38
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
- export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-nfyQM33h.cjs';
2
- import '../../index-C7RZCfoY.cjs';
1
+ export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-BqhpAqqj.cjs';
2
+ import '../../index-dWRqYSdS.cjs';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/btc-signer/psbt.js';
7
- import '../../delegate-Bffc5f54.cjs';
7
+ import '../../delegate-DrwIar11.cjs';
@@ -1,7 +1,7 @@
1
- export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-jouvy8FD.js';
2
- import '../../index-C7RZCfoY.js';
1
+ export { n as ArkadeContractHandler, B as BoardingContractHandler, o as BoardingContractParams, D as DefaultContractHandler, q as DefaultContractParams, t as DelegateContractHandler, u as DelegateContractParams, x as VHTLCContractHandler, y as VHTLCContractParams, z as VHTLCV2ContractHandler, E as VHTLCV2ContractParams, F as contractHandlers } from '../../index-TZJvbIaA.js';
2
+ import '../../index-dWRqYSdS.js';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
6
6
  import '@scure/btc-signer/psbt.js';
7
- import '../../delegate-AomVWxO_.js';
7
+ import '../../delegate-BPdzTbwN.js';
@@ -1,5 +1,5 @@
1
- export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-45FKMOJH.js';
2
- import '../../chunk-4CMXV5SF.js';
1
+ export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-2PPL3O7Z.js';
2
+ import '../../chunk-L5SCQYHF.js';
3
3
  import '../../chunk-NSBPE2FW.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-C7RZCfoY.js';
2
+ import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-dWRqYSdS.js';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,5 +1,5 @@
1
1
  import { Bytes } from '@scure/btc-signer/utils.js';
2
- import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-C7RZCfoY.cjs';
2
+ import { s as RelativeTimelock, V as VtxoScript, t as TapLeafScript } from './index-dWRqYSdS.cjs';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,8 +1,8 @@
1
- import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-C7RZCfoY.js';
1
+ import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-dWRqYSdS.cjs';
2
2
  import { Transaction } from '@scure/btc-signer';
3
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
4
4
  import { Bytes } from '@scure/btc-signer/utils.js';
5
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-AomVWxO_.js';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DrwIar11.cjs';
6
6
 
7
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
8
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -1938,11 +1938,55 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1938
1938
  changeAmount: bigint;
1939
1939
  };
1940
1940
  /**
1941
- * Wait for incoming funds to the wallet
1941
+ * Raised when a wait is cancelled through its `AbortSignal` or `timeoutMs`.
1942
+ *
1943
+ * `name` is `"AbortError"`, matching both the platform convention and the
1944
+ * `error.name === "AbortError"` checks the provider layer already makes, so a
1945
+ * caller can treat DOM and SDK aborts identically.
1946
+ */
1947
+ declare class AbortError extends Error {
1948
+ constructor(message?: string);
1949
+ }
1950
+ /** Options for {@link waitForIncomingFunds}. */
1951
+ interface WaitForIncomingFundsOptions {
1952
+ /**
1953
+ * Cancels the wait. On abort the underlying subscription is stopped and
1954
+ * the returned promise rejects — with the signal's `reason` when the
1955
+ * caller supplied an `Error`, otherwise an {@link AbortError}.
1956
+ */
1957
+ signal?: AbortSignal;
1958
+ /**
1959
+ * Cancels the wait after this many milliseconds, rejecting with an
1960
+ * {@link AbortError}. Equivalent to passing an `AbortSignal.timeout`
1961
+ * signal, without requiring that API on the target platform.
1962
+ */
1963
+ timeoutMs?: number;
1964
+ }
1965
+ /**
1966
+ * Wait for incoming funds to the wallet.
1967
+ *
1968
+ * This opens live network watchers (an onchain address subscription plus the
1969
+ * wallet's indexer stream) and keeps them open until it settles. **Cancel it
1970
+ * if you are not going to await it to completion** — pass a `signal` or a
1971
+ * `timeoutMs`. Racing an uncancelled call against a timer (`Promise.race`)
1972
+ * abandons the loser without stopping its watchers, and repeating that in a
1973
+ * loop stacks subscriptions until the process exits.
1974
+ *
1942
1975
  * @param wallet - The wallet to wait for incoming funds
1976
+ * @param options - Cancellation options; see {@link WaitForIncomingFundsOptions}
1943
1977
  * @returns A promise that resolves the next new coins received by the wallet's address
1978
+ * @throws {AbortError} If cancelled via `signal` or `timeoutMs`
1979
+ * @example
1980
+ * ```typescript
1981
+ * // Wake early on a deposit, but give up after 30s and release the watchers.
1982
+ * try {
1983
+ * const funds = await waitForIncomingFunds(wallet, { timeoutMs: 30_000 })
1984
+ * } catch (e) {
1985
+ * if ((e as Error).name !== "AbortError") throw e
1986
+ * }
1987
+ * ```
1944
1988
  */
1945
- declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
1989
+ declare function waitForIncomingFunds(wallet: Wallet, options?: WaitForIncomingFundsOptions): Promise<IncomingFunds>;
1946
1990
 
1947
1991
  /**
1948
1992
  * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
@@ -2110,4 +2154,4 @@ interface AddressAllocationCapable {
2110
2154
  /** Structural type guard for {@link AddressAllocationCapable}. */
2111
2155
  declare function isAddressAllocationCapable(value: unknown): value is AddressAllocationCapable;
2112
2156
 
2113
- export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, isArkError as E, ForeignDescriptorError as F, isHDAllocationCapable as G, type HDWalletCapable as H, type IncomingFunds as I, isHDWalletCapable as J, maybeArkError as K, resolveBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, resolveCheckpointExitDelayPolicy as N, resolveDescriptorSigner as O, type ProviderConnectionState as P, selectVirtualCoins as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, signingDescriptorIndex as T, strictSigningDescriptorIndex as U, waitForIncomingFunds as V, Wallet as W, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, ArkError as f, ArkErrorName as g, type ArkadeCashClaimResult as h, ArkadeCashCreateError as i, type ArkadeCashUnclaimedReason as j, type ArkadeCashUnclaimedVtxo as k, type BoardingUtxoGroup as l, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as m, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as n, type ProviderKind as o, ProviderUnavailableError as p, REGTEST_MIN_BATCH_EXPIRY_SECONDS as q, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as r, type ServerInfoSource as s, ServerResponseMismatchError as t, WalletCannotAllocateAddressError as u, assertValidBatchExpiry as v, assertValidServerUnrollScript as w, defaultBatchExpiryPolicy as x, defaultCheckpointExitDelayPolicy as y, isAddressAllocationCapable as z };
2157
+ export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, defaultCheckpointExitDelayPolicy as E, ForeignDescriptorError as F, isAddressAllocationCapable as G, type HDWalletCapable as H, type IncomingFunds as I, isArkError as J, isHDAllocationCapable as K, isHDWalletCapable as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, maybeArkError as N, resolveBatchExpiryPolicy as O, type ProviderConnectionState as P, resolveCheckpointExitDelayPolicy as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, resolveDescriptorSigner as T, selectVirtualCoins as U, signingDescriptorIndex as V, Wallet as W, strictSigningDescriptorIndex as X, waitForIncomingFunds as Y, 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 BoardingUtxoGroup as m, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as n, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as o, type ProviderKind as p, ProviderUnavailableError as q, REGTEST_MIN_BATCH_EXPIRY_SECONDS as r, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as s, type ServerInfoSource as t, ServerResponseMismatchError as u, type WaitForIncomingFundsOptions as v, WalletCannotAllocateAddressError as w, assertValidBatchExpiry as x, assertValidServerUnrollScript as y, defaultBatchExpiryPolicy as z };
@@ -1,8 +1,8 @@
1
- import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-C7RZCfoY.cjs';
1
+ import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-dWRqYSdS.js';
2
2
  import { Transaction } from '@scure/btc-signer';
3
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
4
4
  import { Bytes } from '@scure/btc-signer/utils.js';
5
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Bffc5f54.cjs';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BPdzTbwN.js';
6
6
 
7
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
8
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -1938,11 +1938,55 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1938
1938
  changeAmount: bigint;
1939
1939
  };
1940
1940
  /**
1941
- * Wait for incoming funds to the wallet
1941
+ * Raised when a wait is cancelled through its `AbortSignal` or `timeoutMs`.
1942
+ *
1943
+ * `name` is `"AbortError"`, matching both the platform convention and the
1944
+ * `error.name === "AbortError"` checks the provider layer already makes, so a
1945
+ * caller can treat DOM and SDK aborts identically.
1946
+ */
1947
+ declare class AbortError extends Error {
1948
+ constructor(message?: string);
1949
+ }
1950
+ /** Options for {@link waitForIncomingFunds}. */
1951
+ interface WaitForIncomingFundsOptions {
1952
+ /**
1953
+ * Cancels the wait. On abort the underlying subscription is stopped and
1954
+ * the returned promise rejects — with the signal's `reason` when the
1955
+ * caller supplied an `Error`, otherwise an {@link AbortError}.
1956
+ */
1957
+ signal?: AbortSignal;
1958
+ /**
1959
+ * Cancels the wait after this many milliseconds, rejecting with an
1960
+ * {@link AbortError}. Equivalent to passing an `AbortSignal.timeout`
1961
+ * signal, without requiring that API on the target platform.
1962
+ */
1963
+ timeoutMs?: number;
1964
+ }
1965
+ /**
1966
+ * Wait for incoming funds to the wallet.
1967
+ *
1968
+ * This opens live network watchers (an onchain address subscription plus the
1969
+ * wallet's indexer stream) and keeps them open until it settles. **Cancel it
1970
+ * if you are not going to await it to completion** — pass a `signal` or a
1971
+ * `timeoutMs`. Racing an uncancelled call against a timer (`Promise.race`)
1972
+ * abandons the loser without stopping its watchers, and repeating that in a
1973
+ * loop stacks subscriptions until the process exits.
1974
+ *
1942
1975
  * @param wallet - The wallet to wait for incoming funds
1976
+ * @param options - Cancellation options; see {@link WaitForIncomingFundsOptions}
1943
1977
  * @returns A promise that resolves the next new coins received by the wallet's address
1978
+ * @throws {AbortError} If cancelled via `signal` or `timeoutMs`
1979
+ * @example
1980
+ * ```typescript
1981
+ * // Wake early on a deposit, but give up after 30s and release the watchers.
1982
+ * try {
1983
+ * const funds = await waitForIncomingFunds(wallet, { timeoutMs: 30_000 })
1984
+ * } catch (e) {
1985
+ * if ((e as Error).name !== "AbortError") throw e
1986
+ * }
1987
+ * ```
1944
1988
  */
1945
- declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
1989
+ declare function waitForIncomingFunds(wallet: Wallet, options?: WaitForIncomingFundsOptions): Promise<IncomingFunds>;
1946
1990
 
1947
1991
  /**
1948
1992
  * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
@@ -2110,4 +2154,4 @@ interface AddressAllocationCapable {
2110
2154
  /** Structural type guard for {@link AddressAllocationCapable}. */
2111
2155
  declare function isAddressAllocationCapable(value: unknown): value is AddressAllocationCapable;
2112
2156
 
2113
- export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, isArkError as E, ForeignDescriptorError as F, isHDAllocationCapable as G, type HDWalletCapable as H, type IncomingFunds as I, isHDWalletCapable as J, maybeArkError as K, resolveBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, resolveCheckpointExitDelayPolicy as N, resolveDescriptorSigner as O, type ProviderConnectionState as P, selectVirtualCoins as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, signingDescriptorIndex as T, strictSigningDescriptorIndex as U, waitForIncomingFunds as V, Wallet as W, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, ArkError as f, ArkErrorName as g, type ArkadeCashClaimResult as h, ArkadeCashCreateError as i, type ArkadeCashUnclaimedReason as j, type ArkadeCashUnclaimedVtxo as k, type BoardingUtxoGroup as l, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as m, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as n, type ProviderKind as o, ProviderUnavailableError as p, REGTEST_MIN_BATCH_EXPIRY_SECONDS as q, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as r, type ServerInfoSource as s, ServerResponseMismatchError as t, WalletCannotAllocateAddressError as u, assertValidBatchExpiry as v, assertValidServerUnrollScript as w, defaultBatchExpiryPolicy as x, defaultCheckpointExitDelayPolicy as y, isAddressAllocationCapable as z };
2157
+ export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, defaultCheckpointExitDelayPolicy as E, ForeignDescriptorError as F, isAddressAllocationCapable as G, type HDWalletCapable as H, type IncomingFunds as I, isArkError as J, isHDAllocationCapable as K, isHDWalletCapable as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, maybeArkError as N, resolveBatchExpiryPolicy as O, type ProviderConnectionState as P, resolveCheckpointExitDelayPolicy as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, resolveDescriptorSigner as T, selectVirtualCoins as U, signingDescriptorIndex as V, Wallet as W, strictSigningDescriptorIndex as X, waitForIncomingFunds as Y, 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 BoardingUtxoGroup as m, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as n, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as o, type ProviderKind as p, ProviderUnavailableError as q, REGTEST_MIN_BATCH_EXPIRY_SECONDS as r, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as s, type ServerInfoSource as t, ServerResponseMismatchError as u, type WaitForIncomingFundsOptions as v, WalletCannotAllocateAddressError as w, assertValidBatchExpiry as x, assertValidServerUnrollScript as y, defaultBatchExpiryPolicy as z };
@@ -1,5 +1,5 @@
1
- import { bg as ContractHandler, s as RelativeTimelock, bs as Discoverable, V as VtxoScript, t as TapLeafScript, d5 as TapscriptDeriving } from './index-C7RZCfoY.cjs';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Bffc5f54.cjs';
1
+ import { bg as ContractHandler, s as RelativeTimelock, bs as Discoverable, V as VtxoScript, t as TapLeafScript, d5 as TapscriptDeriving } from './index-dWRqYSdS.cjs';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DrwIar11.cjs';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { bg as ContractHandler, s as RelativeTimelock, bs as Discoverable, V as VtxoScript, t as TapLeafScript, d5 as TapscriptDeriving } from './index-C7RZCfoY.js';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-AomVWxO_.js';
1
+ import { bg as ContractHandler, s as RelativeTimelock, bs as Discoverable, V as VtxoScript, t as TapLeafScript, d5 as TapscriptDeriving } from './index-dWRqYSdS.js';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BPdzTbwN.js';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /**
@@ -1699,6 +1699,8 @@ type ExplorerTransaction = {
1699
1699
  status: {
1700
1700
  confirmed: boolean;
1701
1701
  block_time: number;
1702
+ /** Set by Esplora; the electrum provider omits it. */
1703
+ block_height?: number;
1702
1704
  };
1703
1705
  };
1704
1706
  interface OnchainProvider {
@@ -1776,7 +1778,14 @@ interface OnchainProvider {
1776
1778
  /**
1777
1779
  * Fetch the current chain tip.
1778
1780
  *
1779
- * @returns Current chain height, block time, and block hash
1781
+ * @returns Current chain height, median-time-past, and block hash
1782
+ * @remarks
1783
+ * `time` is the tip's **median-time-past**, not the header's own `nTime`.
1784
+ * BIP-113 evaluates seconds-typed `OP_CHECKLOCKTIMEVERIFY` /
1785
+ * `OP_CHECKSEQUENCEVERIFY` against MTP, which lags the tip by roughly an
1786
+ * hour; the header time may sit two hours ahead of it. An implementation
1787
+ * returning the header time calls a timelock mature before the network
1788
+ * does — surfacing as a broadcast the node rejects, not as a bug here.
1780
1789
  */
1781
1790
  getChainTip(): Promise<{
1782
1791
  height: number;
@@ -1809,6 +1818,16 @@ declare class EsploraProvider implements OnchainProvider {
1809
1818
  private baseUrl;
1810
1819
  readonly pollingInterval: number;
1811
1820
  readonly forcePolling: boolean;
1821
+ /**
1822
+ * Live {@link watchAddresses} subscriptions, keyed by their address set.
1823
+ *
1824
+ * Concurrent watchers over the same addresses share one transport, so a
1825
+ * caller that opens watchers in a loop — or leaks them by abandoning
1826
+ * {@link waitForIncomingFunds} — costs one entry in a `Set` rather than
1827
+ * another WebSocket plus another full-history polling loop. Entries are
1828
+ * dropped once their last subscriber stops.
1829
+ */
1830
+ private readonly addressWatches;
1812
1831
  constructor(baseUrl?: string, opts?: {
1813
1832
  /** Polling interval in milliseconds. */
1814
1833
  pollingInterval?: number;
@@ -1823,6 +1842,12 @@ declare class EsploraProvider implements OnchainProvider {
1823
1842
  txid?: string;
1824
1843
  }[]>;
1825
1844
  getTransactions(address: string): Promise<ExplorerTransaction[]>;
1845
+ /**
1846
+ * Activity counts for an address, without its transactions — orders of
1847
+ * magnitude smaller than `/address/{addr}/txs`, which is what makes it
1848
+ * usable as a change probe for the polling fallback.
1849
+ */
1850
+ private getAddressStats;
1826
1851
  getRawTransaction(txid: string): Promise<Uint8Array>;
1827
1852
  getTxStatus(txid: string): Promise<{
1828
1853
  confirmed: false;
@@ -1831,7 +1856,34 @@ declare class EsploraProvider implements OnchainProvider {
1831
1856
  blockTime: number;
1832
1857
  blockHeight: number;
1833
1858
  }>;
1859
+ /**
1860
+ * Watch a set of addresses over the explorer's WebSocket, degrading to HTTP
1861
+ * polling whenever the socket is unavailable and returning to the socket as
1862
+ * soon as it can be re-established.
1863
+ *
1864
+ * Concurrent calls covering the same address set share one transport. The
1865
+ * returned function releases **this** subscription only; the transport is
1866
+ * torn down when the last subscriber releases it. Calling it more than once
1867
+ * is a no-op.
1868
+ *
1869
+ * @param addresses - Addresses to monitor; order is not significant
1870
+ * @param callback - Invoked with transactions seen after the watch started
1871
+ * @returns A function releasing this subscription
1872
+ * @remarks
1873
+ * The HTTP fallback fetches full address history per address per cycle,
1874
+ * which is dramatically more expensive than the socket — so callers should
1875
+ * release watches they no longer need rather than relying on sharing.
1876
+ * @see {@link waitForIncomingFunds} for the cancellation-aware wallet-level helper
1877
+ */
1834
1878
  watchAddresses(addresses: string[], callback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
1879
+ /**
1880
+ * Bring up one shared address watch: a WebSocket subscription where the
1881
+ * explorer supports it, degrading to HTTP polling when it doesn't.
1882
+ *
1883
+ * @param addresses - Addresses this watch covers
1884
+ * @param onTeardown - Invoked when the watch retires, to drop the registry entry
1885
+ */
1886
+ private createAddressWatch;
1835
1887
  getChainTip(): Promise<{
1836
1888
  height: number;
1837
1889
  time: number;
@@ -1699,6 +1699,8 @@ type ExplorerTransaction = {
1699
1699
  status: {
1700
1700
  confirmed: boolean;
1701
1701
  block_time: number;
1702
+ /** Set by Esplora; the electrum provider omits it. */
1703
+ block_height?: number;
1702
1704
  };
1703
1705
  };
1704
1706
  interface OnchainProvider {
@@ -1776,7 +1778,14 @@ interface OnchainProvider {
1776
1778
  /**
1777
1779
  * Fetch the current chain tip.
1778
1780
  *
1779
- * @returns Current chain height, block time, and block hash
1781
+ * @returns Current chain height, median-time-past, and block hash
1782
+ * @remarks
1783
+ * `time` is the tip's **median-time-past**, not the header's own `nTime`.
1784
+ * BIP-113 evaluates seconds-typed `OP_CHECKLOCKTIMEVERIFY` /
1785
+ * `OP_CHECKSEQUENCEVERIFY` against MTP, which lags the tip by roughly an
1786
+ * hour; the header time may sit two hours ahead of it. An implementation
1787
+ * returning the header time calls a timelock mature before the network
1788
+ * does — surfacing as a broadcast the node rejects, not as a bug here.
1780
1789
  */
1781
1790
  getChainTip(): Promise<{
1782
1791
  height: number;
@@ -1809,6 +1818,16 @@ declare class EsploraProvider implements OnchainProvider {
1809
1818
  private baseUrl;
1810
1819
  readonly pollingInterval: number;
1811
1820
  readonly forcePolling: boolean;
1821
+ /**
1822
+ * Live {@link watchAddresses} subscriptions, keyed by their address set.
1823
+ *
1824
+ * Concurrent watchers over the same addresses share one transport, so a
1825
+ * caller that opens watchers in a loop — or leaks them by abandoning
1826
+ * {@link waitForIncomingFunds} — costs one entry in a `Set` rather than
1827
+ * another WebSocket plus another full-history polling loop. Entries are
1828
+ * dropped once their last subscriber stops.
1829
+ */
1830
+ private readonly addressWatches;
1812
1831
  constructor(baseUrl?: string, opts?: {
1813
1832
  /** Polling interval in milliseconds. */
1814
1833
  pollingInterval?: number;
@@ -1823,6 +1842,12 @@ declare class EsploraProvider implements OnchainProvider {
1823
1842
  txid?: string;
1824
1843
  }[]>;
1825
1844
  getTransactions(address: string): Promise<ExplorerTransaction[]>;
1845
+ /**
1846
+ * Activity counts for an address, without its transactions — orders of
1847
+ * magnitude smaller than `/address/{addr}/txs`, which is what makes it
1848
+ * usable as a change probe for the polling fallback.
1849
+ */
1850
+ private getAddressStats;
1826
1851
  getRawTransaction(txid: string): Promise<Uint8Array>;
1827
1852
  getTxStatus(txid: string): Promise<{
1828
1853
  confirmed: false;
@@ -1831,7 +1856,34 @@ declare class EsploraProvider implements OnchainProvider {
1831
1856
  blockTime: number;
1832
1857
  blockHeight: number;
1833
1858
  }>;
1859
+ /**
1860
+ * Watch a set of addresses over the explorer's WebSocket, degrading to HTTP
1861
+ * polling whenever the socket is unavailable and returning to the socket as
1862
+ * soon as it can be re-established.
1863
+ *
1864
+ * Concurrent calls covering the same address set share one transport. The
1865
+ * returned function releases **this** subscription only; the transport is
1866
+ * torn down when the last subscriber releases it. Calling it more than once
1867
+ * is a no-op.
1868
+ *
1869
+ * @param addresses - Addresses to monitor; order is not significant
1870
+ * @param callback - Invoked with transactions seen after the watch started
1871
+ * @returns A function releasing this subscription
1872
+ * @remarks
1873
+ * The HTTP fallback fetches full address history per address per cycle,
1874
+ * which is dramatically more expensive than the socket — so callers should
1875
+ * release watches they no longer need rather than relying on sharing.
1876
+ * @see {@link waitForIncomingFunds} for the cancellation-aware wallet-level helper
1877
+ */
1834
1878
  watchAddresses(addresses: string[], callback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
1879
+ /**
1880
+ * Bring up one shared address watch: a WebSocket subscription where the
1881
+ * explorer supports it, degrading to HTTP polling when it doesn't.
1882
+ *
1883
+ * @param addresses - Addresses this watch covers
1884
+ * @param onTeardown - Invoked when the watch retires, to drop the registry entry
1885
+ */
1886
+ private createAddressWatch;
1835
1887
  getChainTip(): Promise<{
1836
1888
  height: number;
1837
1889
  time: number;