@arkade-os/sdk 0.5.0-rc.0 → 0.5.0-rc.2

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 +34 -1
  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-CdF_ELX8.d.cts → asyncStorageTaskQueue-BuDvgWh6.d.cts} +1 -1
  9. package/dist/{asyncStorageTaskQueue-BCzN3Y45.d.ts → asyncStorageTaskQueue-C5rBYlru.d.ts} +1 -1
  10. package/dist/{chunk-KTU44AEH.js → chunk-3R476TDV.js} +4 -4
  11. package/dist/{chunk-KTU44AEH.js.map → chunk-3R476TDV.js.map} +1 -1
  12. package/dist/{chunk-HL7EC2Z5.cjs → chunk-43FKNLX4.cjs} +50 -50
  13. package/dist/{chunk-HL7EC2Z5.cjs.map → chunk-43FKNLX4.cjs.map} +1 -1
  14. package/dist/{chunk-FVTJJQNM.js → chunk-4PKLULWT.js} +3 -3
  15. package/dist/{chunk-FVTJJQNM.js.map → chunk-4PKLULWT.js.map} +1 -1
  16. package/dist/{chunk-ABJPM4JF.js → chunk-6DNR46C7.js} +4 -4
  17. package/dist/{chunk-ABJPM4JF.js.map → chunk-6DNR46C7.js.map} +1 -1
  18. package/dist/{chunk-PB5KJI4U.cjs → chunk-D25O4EGY.cjs} +10 -10
  19. package/dist/{chunk-PB5KJI4U.cjs.map → chunk-D25O4EGY.cjs.map} +1 -1
  20. package/dist/{chunk-5MJHZHG7.cjs → chunk-GMZZQXV5.cjs} +863 -484
  21. package/dist/chunk-GMZZQXV5.cjs.map +1 -0
  22. package/dist/{chunk-RXWKCEZP.cjs → chunk-HLCGYOIH.cjs} +17 -17
  23. package/dist/{chunk-RXWKCEZP.cjs.map → chunk-HLCGYOIH.cjs.map} +1 -1
  24. package/dist/{chunk-PPG6W34P.js → chunk-ISO4TI5J.js} +3 -3
  25. package/dist/{chunk-PPG6W34P.js.map → chunk-ISO4TI5J.js.map} +1 -1
  26. package/dist/{chunk-6AFUNKK7.cjs → chunk-JZWLXNHV.cjs} +3 -3
  27. package/dist/{chunk-6AFUNKK7.cjs.map → chunk-JZWLXNHV.cjs.map} +1 -1
  28. package/dist/{chunk-CZ32XADN.cjs → chunk-NVZJSKZS.cjs} +17 -17
  29. package/dist/{chunk-CZ32XADN.cjs.map → chunk-NVZJSKZS.cjs.map} +1 -1
  30. package/dist/{chunk-JYP7YXT2.js → chunk-ZOTXDOS5.js} +4 -4
  31. package/dist/{chunk-JYP7YXT2.js.map → chunk-ZOTXDOS5.js.map} +1 -1
  32. package/dist/{chunk-6F2Q32KA.js → chunk-ZRNQV6HV.js} +425 -52
  33. package/dist/chunk-ZRNQV6HV.js.map +1 -0
  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-DLIOBQ5x.d.cts → delegate-1yp1HyP7.d.cts} +1 -1
  39. package/dist/{delegate-Dyn5L80J.d.ts → delegate-BAX5QftB.d.ts} +1 -1
  40. package/dist/{hdWalletCapable-Dt3MUiGE.d.cts → hdWalletCapable-CmEU0NP1.d.ts} +49 -5
  41. package/dist/{hdWalletCapable-D9tooZ6F.d.ts → hdWalletCapable-eJgaT-ec.d.cts} +49 -5
  42. package/dist/{index-D9tXd-tN.d.ts → index-Bem5vKzX.d.ts} +2 -2
  43. package/dist/{index-Udm5V2xW.d.cts → index-DUxufw76.d.cts} +53 -1
  44. package/dist/{index-Udm5V2xW.d.ts → index-DUxufw76.d.ts} +53 -1
  45. package/dist/{index-D3hmsuKs.d.cts → index-W_oMcOmG.d.cts} +2 -2
  46. package/dist/index.cjs +318 -294
  47. package/dist/index.d.cts +81 -14
  48. package/dist/index.d.ts +81 -14
  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-ZdS16Ypm.d.ts → taskRunner-D_iPiZIi.d.ts} +1 -1
  59. package/dist/{taskRunner-DxZciNaa.d.cts → taskRunner-Dr3NStc0.d.cts} +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-5MJHZHG7.cjs.map +0 -1
  74. package/dist/chunk-6F2Q32KA.js.map +0 -1
@@ -1,38 +1,38 @@
1
1
  'use strict';
2
2
 
3
- var chunkHL7EC2Z5_cjs = require('../../chunk-HL7EC2Z5.cjs');
4
- require('../../chunk-6AFUNKK7.cjs');
3
+ var chunk43FKNLX4_cjs = require('../../chunk-43FKNLX4.cjs');
4
+ require('../../chunk-JZWLXNHV.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 chunkHL7EC2Z5_cjs.ArkadeContractHandler; }
11
+ get: function () { return chunk43FKNLX4_cjs.ArkadeContractHandler; }
12
12
  });
13
13
  Object.defineProperty(exports, "BoardingContractHandler", {
14
14
  enumerable: true,
15
- get: function () { return chunkHL7EC2Z5_cjs.BoardingContractHandler; }
15
+ get: function () { return chunk43FKNLX4_cjs.BoardingContractHandler; }
16
16
  });
17
17
  Object.defineProperty(exports, "DefaultContractHandler", {
18
18
  enumerable: true,
19
- get: function () { return chunkHL7EC2Z5_cjs.DefaultContractHandler; }
19
+ get: function () { return chunk43FKNLX4_cjs.DefaultContractHandler; }
20
20
  });
21
21
  Object.defineProperty(exports, "DelegateContractHandler", {
22
22
  enumerable: true,
23
- get: function () { return chunkHL7EC2Z5_cjs.DelegateContractHandler; }
23
+ get: function () { return chunk43FKNLX4_cjs.DelegateContractHandler; }
24
24
  });
25
25
  Object.defineProperty(exports, "VHTLCContractHandler", {
26
26
  enumerable: true,
27
- get: function () { return chunkHL7EC2Z5_cjs.VHTLCContractHandler; }
27
+ get: function () { return chunk43FKNLX4_cjs.VHTLCContractHandler; }
28
28
  });
29
29
  Object.defineProperty(exports, "VHTLCV2ContractHandler", {
30
30
  enumerable: true,
31
- get: function () { return chunkHL7EC2Z5_cjs.VHTLCV2ContractHandler; }
31
+ get: function () { return chunk43FKNLX4_cjs.VHTLCV2ContractHandler; }
32
32
  });
33
33
  Object.defineProperty(exports, "contractHandlers", {
34
34
  enumerable: true,
35
- get: function () { return chunkHL7EC2Z5_cjs.contractHandlers; }
35
+ get: function () { return chunk43FKNLX4_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-D3hmsuKs.cjs';
2
- import '../../index-Udm5V2xW.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-W_oMcOmG.cjs';
2
+ import '../../index-DUxufw76.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-DLIOBQ5x.cjs';
7
+ import '../../delegate-1yp1HyP7.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-D9tXd-tN.js';
2
- import '../../index-Udm5V2xW.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-Bem5vKzX.js';
2
+ import '../../index-DUxufw76.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-Dyn5L80J.js';
7
+ import '../../delegate-BAX5QftB.js';
@@ -1,5 +1,5 @@
1
- export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-KTU44AEH.js';
2
- import '../../chunk-PPG6W34P.js';
1
+ export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers } from '../../chunk-3R476TDV.js';
2
+ import '../../chunk-ISO4TI5J.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 { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-Udm5V2xW.cjs';
2
+ import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-DUxufw76.cjs';
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 { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-Udm5V2xW.js';
2
+ import { w as RelativeTimelock, V as VtxoScript, x as TapLeafScript } from './index-DUxufw76.js';
3
3
 
4
4
  /**
5
5
  * DefaultVtxo is the default implementation of a VtxoScript.
@@ -1,8 +1,8 @@
1
- import { w as RelativeTimelock, X as Network, Y as CSVMultisigTapscript, Z as BatchStartedEvent, _ as TreeSigningStartedEvent, $ as TxTree, a0 as TreeNoncesEvent, a1 as BatchFinalizationEvent, a2 as BatchFinalizedEvent, a3 as BatchFailedEvent, a4 as TreeTxEvent, a5 as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a6 as DescriptorProvider, j as IContractManager, a7 as IReadonlyWallet, a8 as ReadonlyIdentity, a9 as OnchainProvider, u as ArkProvider, v as IndexerProvider, aa as DelegateProvider, ab as ReadonlyWalletConfig, J as IntentRepository, M as VirtualTxRepository, ac as ExitCaptureMode, ad as ExitDataSource, h as ActivityRegistry, ae as IReadonlyAssetManager, af as ContractSyncState, ag as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, ah as NetworkName, ai as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, aj as ContractWithVtxos, ak as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, al as Coin, B as ExtendedVirtualCoin, am as ContractManager, an as ContractManagerConfig, I as IWallet, a as Identity, k as GetNewAddressesOptions, l as NewAddress, ao as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ap as VtxoManager, m as IDelegateManager, S as SendBitcoinParams, n as SettleParams, R as Recipient, aq as SignerSession, ar as SignedIntent, as as Intent, p as SendParams, at as TimeHeight } from './index-Udm5V2xW.cjs';
1
+ import { w as RelativeTimelock, X as Network, Y as CSVMultisigTapscript, Z as BatchStartedEvent, _ as TreeSigningStartedEvent, $ as TxTree, a0 as TreeNoncesEvent, a1 as BatchFinalizationEvent, a2 as BatchFinalizedEvent, a3 as BatchFailedEvent, a4 as TreeTxEvent, a5 as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a6 as DescriptorProvider, j as IContractManager, a7 as IReadonlyWallet, a8 as ReadonlyIdentity, a9 as OnchainProvider, u as ArkProvider, v as IndexerProvider, aa as DelegateProvider, ab as ReadonlyWalletConfig, J as IntentRepository, M as VirtualTxRepository, ac as ExitCaptureMode, ad as ExitDataSource, h as ActivityRegistry, ae as IReadonlyAssetManager, af as ContractSyncState, ag as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, ah as NetworkName, ai as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, aj as ContractWithVtxos, ak as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, al as Coin, B as ExtendedVirtualCoin, am as ContractManager, an as ContractManagerConfig, I as IWallet, a as Identity, k as GetNewAddressesOptions, l as NewAddress, ao as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ap as VtxoManager, m as IDelegateManager, S as SendBitcoinParams, n as SettleParams, R as Recipient, aq as SignerSession, ar as SignedIntent, as as Intent, p as SendParams, at as TimeHeight } from './index-DUxufw76.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-DLIOBQ5x.cjs';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BAX5QftB.js';
6
6
 
7
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
8
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -2013,11 +2013,55 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
2013
2013
  changeAmount: bigint;
2014
2014
  };
2015
2015
  /**
2016
- * Wait for incoming funds to the wallet
2016
+ * Raised when a wait is cancelled through its `AbortSignal` or `timeoutMs`.
2017
+ *
2018
+ * `name` is `"AbortError"`, matching both the platform convention and the
2019
+ * `error.name === "AbortError"` checks the provider layer already makes, so a
2020
+ * caller can treat DOM and SDK aborts identically.
2021
+ */
2022
+ declare class AbortError extends Error {
2023
+ constructor(message?: string);
2024
+ }
2025
+ /** Options for {@link waitForIncomingFunds}. */
2026
+ interface WaitForIncomingFundsOptions {
2027
+ /**
2028
+ * Cancels the wait. On abort the underlying subscription is stopped and
2029
+ * the returned promise rejects — with the signal's `reason` when the
2030
+ * caller supplied an `Error`, otherwise an {@link AbortError}.
2031
+ */
2032
+ signal?: AbortSignal;
2033
+ /**
2034
+ * Cancels the wait after this many milliseconds, rejecting with an
2035
+ * {@link AbortError}. Equivalent to passing an `AbortSignal.timeout`
2036
+ * signal, without requiring that API on the target platform.
2037
+ */
2038
+ timeoutMs?: number;
2039
+ }
2040
+ /**
2041
+ * Wait for incoming funds to the wallet.
2042
+ *
2043
+ * This opens live network watchers (an onchain address subscription plus the
2044
+ * wallet's indexer stream) and keeps them open until it settles. **Cancel it
2045
+ * if you are not going to await it to completion** — pass a `signal` or a
2046
+ * `timeoutMs`. Racing an uncancelled call against a timer (`Promise.race`)
2047
+ * abandons the loser without stopping its watchers, and repeating that in a
2048
+ * loop stacks subscriptions until the process exits.
2049
+ *
2017
2050
  * @param wallet - The wallet to wait for incoming funds
2051
+ * @param options - Cancellation options; see {@link WaitForIncomingFundsOptions}
2018
2052
  * @returns A promise that resolves the next new coins received by the wallet's address
2053
+ * @throws {AbortError} If cancelled via `signal` or `timeoutMs`
2054
+ * @example
2055
+ * ```typescript
2056
+ * // Wake early on a deposit, but give up after 30s and release the watchers.
2057
+ * try {
2058
+ * const funds = await waitForIncomingFunds(wallet, { timeoutMs: 30_000 })
2059
+ * } catch (e) {
2060
+ * if ((e as Error).name !== "AbortError") throw e
2061
+ * }
2062
+ * ```
2019
2063
  */
2020
- declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
2064
+ declare function waitForIncomingFunds(wallet: Wallet, options?: WaitForIncomingFundsOptions): Promise<IncomingFunds>;
2021
2065
 
2022
2066
  /**
2023
2067
  * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
@@ -2185,4 +2229,4 @@ interface AddressAllocationCapable {
2185
2229
  /** Structural type guard for {@link AddressAllocationCapable}. */
2186
2230
  declare function isAddressAllocationCapable(value: unknown): value is AddressAllocationCapable;
2187
2231
 
2188
- 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 };
2232
+ 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 { w as RelativeTimelock, X as Network, Y as CSVMultisigTapscript, Z as BatchStartedEvent, _ as TreeSigningStartedEvent, $ as TxTree, a0 as TreeNoncesEvent, a1 as BatchFinalizationEvent, a2 as BatchFinalizedEvent, a3 as BatchFailedEvent, a4 as TreeTxEvent, a5 as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a6 as DescriptorProvider, j as IContractManager, a7 as IReadonlyWallet, a8 as ReadonlyIdentity, a9 as OnchainProvider, u as ArkProvider, v as IndexerProvider, aa as DelegateProvider, ab as ReadonlyWalletConfig, J as IntentRepository, M as VirtualTxRepository, ac as ExitCaptureMode, ad as ExitDataSource, h as ActivityRegistry, ae as IReadonlyAssetManager, af as ContractSyncState, ag as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, ah as NetworkName, ai as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, aj as ContractWithVtxos, ak as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, al as Coin, B as ExtendedVirtualCoin, am as ContractManager, an as ContractManagerConfig, I as IWallet, a as Identity, k as GetNewAddressesOptions, l as NewAddress, ao as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ap as VtxoManager, m as IDelegateManager, S as SendBitcoinParams, n as SettleParams, R as Recipient, aq as SignerSession, ar as SignedIntent, as as Intent, p as SendParams, at as TimeHeight } from './index-Udm5V2xW.js';
1
+ import { w as RelativeTimelock, X as Network, Y as CSVMultisigTapscript, Z as BatchStartedEvent, _ as TreeSigningStartedEvent, $ as TxTree, a0 as TreeNoncesEvent, a1 as BatchFinalizationEvent, a2 as BatchFinalizedEvent, a3 as BatchFailedEvent, a4 as TreeTxEvent, a5 as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a6 as DescriptorProvider, j as IContractManager, a7 as IReadonlyWallet, a8 as ReadonlyIdentity, a9 as OnchainProvider, u as ArkProvider, v as IndexerProvider, aa as DelegateProvider, ab as ReadonlyWalletConfig, J as IntentRepository, M as VirtualTxRepository, ac as ExitCaptureMode, ad as ExitDataSource, h as ActivityRegistry, ae as IReadonlyAssetManager, af as ContractSyncState, ag as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, ah as NetworkName, ai as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, aj as ContractWithVtxos, ak as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, al as Coin, B as ExtendedVirtualCoin, am as ContractManager, an as ContractManagerConfig, I as IWallet, a as Identity, k as GetNewAddressesOptions, l as NewAddress, ao as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ap as VtxoManager, m as IDelegateManager, S as SendBitcoinParams, n as SettleParams, R as Recipient, aq as SignerSession, ar as SignedIntent, as as Intent, p as SendParams, at as TimeHeight } from './index-DUxufw76.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-Dyn5L80J.js';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-1yp1HyP7.cjs';
6
6
 
7
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
8
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -2013,11 +2013,55 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
2013
2013
  changeAmount: bigint;
2014
2014
  };
2015
2015
  /**
2016
- * Wait for incoming funds to the wallet
2016
+ * Raised when a wait is cancelled through its `AbortSignal` or `timeoutMs`.
2017
+ *
2018
+ * `name` is `"AbortError"`, matching both the platform convention and the
2019
+ * `error.name === "AbortError"` checks the provider layer already makes, so a
2020
+ * caller can treat DOM and SDK aborts identically.
2021
+ */
2022
+ declare class AbortError extends Error {
2023
+ constructor(message?: string);
2024
+ }
2025
+ /** Options for {@link waitForIncomingFunds}. */
2026
+ interface WaitForIncomingFundsOptions {
2027
+ /**
2028
+ * Cancels the wait. On abort the underlying subscription is stopped and
2029
+ * the returned promise rejects — with the signal's `reason` when the
2030
+ * caller supplied an `Error`, otherwise an {@link AbortError}.
2031
+ */
2032
+ signal?: AbortSignal;
2033
+ /**
2034
+ * Cancels the wait after this many milliseconds, rejecting with an
2035
+ * {@link AbortError}. Equivalent to passing an `AbortSignal.timeout`
2036
+ * signal, without requiring that API on the target platform.
2037
+ */
2038
+ timeoutMs?: number;
2039
+ }
2040
+ /**
2041
+ * Wait for incoming funds to the wallet.
2042
+ *
2043
+ * This opens live network watchers (an onchain address subscription plus the
2044
+ * wallet's indexer stream) and keeps them open until it settles. **Cancel it
2045
+ * if you are not going to await it to completion** — pass a `signal` or a
2046
+ * `timeoutMs`. Racing an uncancelled call against a timer (`Promise.race`)
2047
+ * abandons the loser without stopping its watchers, and repeating that in a
2048
+ * loop stacks subscriptions until the process exits.
2049
+ *
2017
2050
  * @param wallet - The wallet to wait for incoming funds
2051
+ * @param options - Cancellation options; see {@link WaitForIncomingFundsOptions}
2018
2052
  * @returns A promise that resolves the next new coins received by the wallet's address
2053
+ * @throws {AbortError} If cancelled via `signal` or `timeoutMs`
2054
+ * @example
2055
+ * ```typescript
2056
+ * // Wake early on a deposit, but give up after 30s and release the watchers.
2057
+ * try {
2058
+ * const funds = await waitForIncomingFunds(wallet, { timeoutMs: 30_000 })
2059
+ * } catch (e) {
2060
+ * if ((e as Error).name !== "AbortError") throw e
2061
+ * }
2062
+ * ```
2019
2063
  */
2020
- declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
2064
+ declare function waitForIncomingFunds(wallet: Wallet, options?: WaitForIncomingFundsOptions): Promise<IncomingFunds>;
2021
2065
 
2022
2066
  /**
2023
2067
  * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
@@ -2185,4 +2229,4 @@ interface AddressAllocationCapable {
2185
2229
  /** Structural type guard for {@link AddressAllocationCapable}. */
2186
2230
  declare function isAddressAllocationCapable(value: unknown): value is AddressAllocationCapable;
2187
2231
 
2188
- 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 };
2232
+ 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 { bn as ContractHandler, w as RelativeTimelock, bz as Discoverable, V as VtxoScript, x as TapLeafScript, df as TapscriptDeriving } from './index-Udm5V2xW.js';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Dyn5L80J.js';
1
+ import { bn as ContractHandler, w as RelativeTimelock, bz as Discoverable, V as VtxoScript, x as TapLeafScript, df as TapscriptDeriving } from './index-DUxufw76.js';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BAX5QftB.js';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /**
@@ -1730,6 +1730,8 @@ type ExplorerTransaction = {
1730
1730
  status: {
1731
1731
  confirmed: boolean;
1732
1732
  block_time: number;
1733
+ /** Set by Esplora; the electrum provider omits it. */
1734
+ block_height?: number;
1733
1735
  };
1734
1736
  };
1735
1737
  interface OnchainProvider {
@@ -1807,7 +1809,14 @@ interface OnchainProvider {
1807
1809
  /**
1808
1810
  * Fetch the current chain tip.
1809
1811
  *
1810
- * @returns Current chain height, block time, and block hash
1812
+ * @returns Current chain height, median-time-past, and block hash
1813
+ * @remarks
1814
+ * `time` is the tip's **median-time-past**, not the header's own `nTime`.
1815
+ * BIP-113 evaluates seconds-typed `OP_CHECKLOCKTIMEVERIFY` /
1816
+ * `OP_CHECKSEQUENCEVERIFY` against MTP, which lags the tip by roughly an
1817
+ * hour; the header time may sit two hours ahead of it. An implementation
1818
+ * returning the header time calls a timelock mature before the network
1819
+ * does — surfacing as a broadcast the node rejects, not as a bug here.
1811
1820
  */
1812
1821
  getChainTip(): Promise<{
1813
1822
  height: number;
@@ -1840,6 +1849,16 @@ declare class EsploraProvider implements OnchainProvider {
1840
1849
  private baseUrl;
1841
1850
  readonly pollingInterval: number;
1842
1851
  readonly forcePolling: boolean;
1852
+ /**
1853
+ * Live {@link watchAddresses} subscriptions, keyed by their address set.
1854
+ *
1855
+ * Concurrent watchers over the same addresses share one transport, so a
1856
+ * caller that opens watchers in a loop — or leaks them by abandoning
1857
+ * {@link waitForIncomingFunds} — costs one entry in a `Set` rather than
1858
+ * another WebSocket plus another full-history polling loop. Entries are
1859
+ * dropped once their last subscriber stops.
1860
+ */
1861
+ private readonly addressWatches;
1843
1862
  constructor(baseUrl?: string, opts?: {
1844
1863
  /** Polling interval in milliseconds. */
1845
1864
  pollingInterval?: number;
@@ -1854,6 +1873,12 @@ declare class EsploraProvider implements OnchainProvider {
1854
1873
  txid?: string;
1855
1874
  }[]>;
1856
1875
  getTransactions(address: string): Promise<ExplorerTransaction[]>;
1876
+ /**
1877
+ * Activity counts for an address, without its transactions — orders of
1878
+ * magnitude smaller than `/address/{addr}/txs`, which is what makes it
1879
+ * usable as a change probe for the polling fallback.
1880
+ */
1881
+ private getAddressStats;
1857
1882
  getRawTransaction(txid: string): Promise<Uint8Array>;
1858
1883
  getTxStatus(txid: string): Promise<{
1859
1884
  confirmed: false;
@@ -1862,7 +1887,34 @@ declare class EsploraProvider implements OnchainProvider {
1862
1887
  blockTime: number;
1863
1888
  blockHeight: number;
1864
1889
  }>;
1890
+ /**
1891
+ * Watch a set of addresses over the explorer's WebSocket, degrading to HTTP
1892
+ * polling whenever the socket is unavailable and returning to the socket as
1893
+ * soon as it can be re-established.
1894
+ *
1895
+ * Concurrent calls covering the same address set share one transport. The
1896
+ * returned function releases **this** subscription only; the transport is
1897
+ * torn down when the last subscriber releases it. Calling it more than once
1898
+ * is a no-op.
1899
+ *
1900
+ * @param addresses - Addresses to monitor; order is not significant
1901
+ * @param callback - Invoked with transactions seen after the watch started
1902
+ * @returns A function releasing this subscription
1903
+ * @remarks
1904
+ * The HTTP fallback fetches full address history per address per cycle,
1905
+ * which is dramatically more expensive than the socket — so callers should
1906
+ * release watches they no longer need rather than relying on sharing.
1907
+ * @see {@link waitForIncomingFunds} for the cancellation-aware wallet-level helper
1908
+ */
1865
1909
  watchAddresses(addresses: string[], callback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
1910
+ /**
1911
+ * Bring up one shared address watch: a WebSocket subscription where the
1912
+ * explorer supports it, degrading to HTTP polling when it doesn't.
1913
+ *
1914
+ * @param addresses - Addresses this watch covers
1915
+ * @param onTeardown - Invoked when the watch retires, to drop the registry entry
1916
+ */
1917
+ private createAddressWatch;
1866
1918
  getChainTip(): Promise<{
1867
1919
  height: number;
1868
1920
  time: number;
@@ -1730,6 +1730,8 @@ type ExplorerTransaction = {
1730
1730
  status: {
1731
1731
  confirmed: boolean;
1732
1732
  block_time: number;
1733
+ /** Set by Esplora; the electrum provider omits it. */
1734
+ block_height?: number;
1733
1735
  };
1734
1736
  };
1735
1737
  interface OnchainProvider {
@@ -1807,7 +1809,14 @@ interface OnchainProvider {
1807
1809
  /**
1808
1810
  * Fetch the current chain tip.
1809
1811
  *
1810
- * @returns Current chain height, block time, and block hash
1812
+ * @returns Current chain height, median-time-past, and block hash
1813
+ * @remarks
1814
+ * `time` is the tip's **median-time-past**, not the header's own `nTime`.
1815
+ * BIP-113 evaluates seconds-typed `OP_CHECKLOCKTIMEVERIFY` /
1816
+ * `OP_CHECKSEQUENCEVERIFY` against MTP, which lags the tip by roughly an
1817
+ * hour; the header time may sit two hours ahead of it. An implementation
1818
+ * returning the header time calls a timelock mature before the network
1819
+ * does — surfacing as a broadcast the node rejects, not as a bug here.
1811
1820
  */
1812
1821
  getChainTip(): Promise<{
1813
1822
  height: number;
@@ -1840,6 +1849,16 @@ declare class EsploraProvider implements OnchainProvider {
1840
1849
  private baseUrl;
1841
1850
  readonly pollingInterval: number;
1842
1851
  readonly forcePolling: boolean;
1852
+ /**
1853
+ * Live {@link watchAddresses} subscriptions, keyed by their address set.
1854
+ *
1855
+ * Concurrent watchers over the same addresses share one transport, so a
1856
+ * caller that opens watchers in a loop — or leaks them by abandoning
1857
+ * {@link waitForIncomingFunds} — costs one entry in a `Set` rather than
1858
+ * another WebSocket plus another full-history polling loop. Entries are
1859
+ * dropped once their last subscriber stops.
1860
+ */
1861
+ private readonly addressWatches;
1843
1862
  constructor(baseUrl?: string, opts?: {
1844
1863
  /** Polling interval in milliseconds. */
1845
1864
  pollingInterval?: number;
@@ -1854,6 +1873,12 @@ declare class EsploraProvider implements OnchainProvider {
1854
1873
  txid?: string;
1855
1874
  }[]>;
1856
1875
  getTransactions(address: string): Promise<ExplorerTransaction[]>;
1876
+ /**
1877
+ * Activity counts for an address, without its transactions — orders of
1878
+ * magnitude smaller than `/address/{addr}/txs`, which is what makes it
1879
+ * usable as a change probe for the polling fallback.
1880
+ */
1881
+ private getAddressStats;
1857
1882
  getRawTransaction(txid: string): Promise<Uint8Array>;
1858
1883
  getTxStatus(txid: string): Promise<{
1859
1884
  confirmed: false;
@@ -1862,7 +1887,34 @@ declare class EsploraProvider implements OnchainProvider {
1862
1887
  blockTime: number;
1863
1888
  blockHeight: number;
1864
1889
  }>;
1890
+ /**
1891
+ * Watch a set of addresses over the explorer's WebSocket, degrading to HTTP
1892
+ * polling whenever the socket is unavailable and returning to the socket as
1893
+ * soon as it can be re-established.
1894
+ *
1895
+ * Concurrent calls covering the same address set share one transport. The
1896
+ * returned function releases **this** subscription only; the transport is
1897
+ * torn down when the last subscriber releases it. Calling it more than once
1898
+ * is a no-op.
1899
+ *
1900
+ * @param addresses - Addresses to monitor; order is not significant
1901
+ * @param callback - Invoked with transactions seen after the watch started
1902
+ * @returns A function releasing this subscription
1903
+ * @remarks
1904
+ * The HTTP fallback fetches full address history per address per cycle,
1905
+ * which is dramatically more expensive than the socket — so callers should
1906
+ * release watches they no longer need rather than relying on sharing.
1907
+ * @see {@link waitForIncomingFunds} for the cancellation-aware wallet-level helper
1908
+ */
1865
1909
  watchAddresses(addresses: string[], callback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
1910
+ /**
1911
+ * Bring up one shared address watch: a WebSocket subscription where the
1912
+ * explorer supports it, degrading to HTTP polling when it doesn't.
1913
+ *
1914
+ * @param addresses - Addresses this watch covers
1915
+ * @param onTeardown - Invoked when the watch retires, to drop the registry entry
1916
+ */
1917
+ private createAddressWatch;
1866
1918
  getChainTip(): Promise<{
1867
1919
  height: number;
1868
1920
  time: number;
@@ -1,5 +1,5 @@
1
- import { bn as ContractHandler, w as RelativeTimelock, bz as Discoverable, V as VtxoScript, x as TapLeafScript, df as TapscriptDeriving } from './index-Udm5V2xW.cjs';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DLIOBQ5x.cjs';
1
+ import { bn as ContractHandler, w as RelativeTimelock, bz as Discoverable, V as VtxoScript, x as TapLeafScript, df as TapscriptDeriving } from './index-DUxufw76.cjs';
2
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-1yp1HyP7.cjs';
3
3
  import { Bytes } from '@scure/btc-signer/utils.js';
4
4
 
5
5
  /**