@arkade-os/sdk 0.4.67 → 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 (78) hide show
  1. package/README.md +38 -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-Za-e_zMk.d.ts → asyncStorageTaskQueue-BgUJN-3X.d.ts} +2 -2
  9. package/dist/{asyncStorageTaskQueue-LTpeXYaD.d.cts → asyncStorageTaskQueue-Cstx6hS7.d.cts} +2 -2
  10. package/dist/{chunk-6TAQF6EV.js → chunk-2PPL3O7Z.js} +72 -120
  11. package/dist/chunk-2PPL3O7Z.js.map +1 -0
  12. package/dist/{chunk-2JV4VQ7C.cjs → chunk-5MLC2HU3.cjs} +17 -3
  13. package/dist/chunk-5MLC2HU3.cjs.map +1 -0
  14. package/dist/{chunk-MJUTO3PY.cjs → chunk-EBYCTLET.cjs} +832 -488
  15. package/dist/chunk-EBYCTLET.cjs.map +1 -0
  16. package/dist/{chunk-CO3KKSWM.cjs → chunk-GVHUHTRH.cjs} +17 -17
  17. package/dist/{chunk-CO3KKSWM.cjs.map → chunk-GVHUHTRH.cjs.map} +1 -1
  18. package/dist/{chunk-YDRZDZPP.cjs → chunk-HQ4DMGA4.cjs} +10 -10
  19. package/dist/{chunk-YDRZDZPP.cjs.map → chunk-HQ4DMGA4.cjs.map} +1 -1
  20. package/dist/{chunk-3WIWNE4P.js → chunk-L5SCQYHF.js} +16 -4
  21. package/dist/chunk-L5SCQYHF.js.map +1 -0
  22. package/dist/{chunk-MZFUZUTQ.js → chunk-MNMPGEK2.js} +4 -4
  23. package/dist/{chunk-MZFUZUTQ.js.map → chunk-MNMPGEK2.js.map} +1 -1
  24. package/dist/{chunk-AEWJU6NZ.js → chunk-TA7XLEP2.js} +411 -68
  25. package/dist/chunk-TA7XLEP2.js.map +1 -0
  26. package/dist/{chunk-OIZ2V2VD.cjs → chunk-WIFL5QYZ.cjs} +118 -166
  27. package/dist/chunk-WIFL5QYZ.cjs.map +1 -0
  28. package/dist/{chunk-EALWOVHK.js → chunk-XLWDX7QZ.js} +4 -4
  29. package/dist/{chunk-EALWOVHK.js.map → chunk-XLWDX7QZ.js.map} +1 -1
  30. package/dist/{chunk-R2YAMONM.cjs → chunk-XQPN5YP2.cjs} +17 -17
  31. package/dist/{chunk-R2YAMONM.cjs.map → chunk-XQPN5YP2.cjs.map} +1 -1
  32. package/dist/{chunk-X3VEMUVV.js → chunk-YG7T6LI3.js} +3 -3
  33. package/dist/{chunk-X3VEMUVV.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-cdmzb2f9.d.ts → delegate-BPdzTbwN.d.ts} +1 -1
  39. package/dist/{delegate-Bz2e2zXY.d.cts → delegate-DrwIar11.d.cts} +1 -1
  40. package/dist/{hdWalletCapable-Hi12xjCJ.d.ts → hdWalletCapable-D4WH35z0.d.cts} +49 -5
  41. package/dist/{hdWalletCapable-BSjuUYOO.d.cts → hdWalletCapable-DyxCiNVE.d.ts} +49 -5
  42. package/dist/{index-BiACuWaf.d.ts → index-BqhpAqqj.d.cts} +96 -119
  43. package/dist/{index-D2GjZxBr.d.cts → index-TZJvbIaA.d.ts} +96 -119
  44. package/dist/{index-DU5o_hz7.d.cts → index-dWRqYSdS.d.cts} +70 -2
  45. package/dist/{index-DU5o_hz7.d.ts → index-dWRqYSdS.d.ts} +70 -2
  46. package/dist/index.cjs +297 -289
  47. package/dist/index.d.cts +29 -8
  48. package/dist/index.d.ts +29 -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-BZJMLQ6g.d.cts → taskRunner-CzYKyJ9c.d.cts} +2 -2
  59. package/dist/{taskRunner-DATaRQus.d.ts → taskRunner-D2fnbqYw.d.ts} +2 -2
  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-2JV4VQ7C.cjs.map +0 -1
  74. package/dist/chunk-3WIWNE4P.js.map +0 -1
  75. package/dist/chunk-6TAQF6EV.js.map +0 -1
  76. package/dist/chunk-AEWJU6NZ.js.map +0 -1
  77. package/dist/chunk-MJUTO3PY.cjs.map +0 -1
  78. package/dist/chunk-OIZ2V2VD.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { bg as ContractHandler, s as RelativeTimelock, bs as Discoverable, V as VtxoScript, t as TapLeafScript, d4 as TapscriptDeriving } from './index-DU5o_hz7.cjs';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Bz2e2zXY.cjs';
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
  /**
@@ -114,96 +114,79 @@ declare namespace VHTLC {
114
114
  unilateralRefundDelay: RelativeTimelock;
115
115
  unilateralRefundWithoutReceiverDelay: RelativeTimelock;
116
116
  /**
117
- * Optional non-interactive claim leaf: `server` plus a covenant-tweaked
118
- * emulator co-signer, pinned to `receiverPkScript`. Lets the receiver's
119
- * claim be pushed by the emulator without the receiver being online.
117
+ * The emulator covenant leaves, ALL OR NOTHING. Present, this adds the
118
+ * three non-interactive leaves the emulator co-signs under a covenant
119
+ * pinning the payout to a pre-committed destination:
120
+ *
121
+ * - `nonInteractiveClaim`: `server` + a covenant-tweaked emulator
122
+ * co-signer, paying `receiverPkScript` — the receiver's claim can
123
+ * be pushed without the receiver being online.
124
+ * - `nonInteractiveRefund`: `server` + `receiver` + a covenant-tweaked
125
+ * emulator co-signer, paying `senderPkScript`, no timelock — lets
126
+ * server and receiver release the refund the moment they agree the
127
+ * swap has failed, and recoverable even if the sender's own key is
128
+ * lost, since no OTHER refund-side leaf survives that.
129
+ * - `nonInteractiveRefundWithoutReceiver`: `server` + the SAME
130
+ * covenant-tweaked co-signer as `nonInteractiveRefund`, paying
131
+ * `senderPkScript` after `refundLocktime` — the only refund tier
132
+ * needing no participant signature at all, so a sender who funded
133
+ * a lockup and vanished is refundable through it alone.
134
+ *
135
+ * WHY ONE FLAG AND NOT A SWITCH PER LEAF. The three are one mechanism
136
+ * — the same emulator key, the same `enforcePayTo` covenant pointed
137
+ * at a per-role destination — and they protect opposite directions of
138
+ * the same swap, so no real configuration wants a subset. A subset
139
+ * would cost, not buy: every optional leaf multiplies the tree shapes
140
+ * a counterparty must derive to verify an address (nothing on the
141
+ * wire says which leaves a quote carries), so per-leaf toggling turns
142
+ * one address comparison into a combinatorial guess. All-or-nothing
143
+ * keeps the shape count at two: suite, or no suite.
144
+ *
145
+ * Leaf order fixes the taproot merkle root, so the suite is appended
146
+ * after the six signature leaves in a fixed order (claim, refund,
147
+ * timelocked refund) and a script built with this option NEVER
148
+ * collides with one built without it — which is what makes "did this
149
+ * quote opt in" a question an address comparison answers.
150
+ *
151
+ * STABLE PER RELEASE: what this option builds does not change within
152
+ * a published SDK version. A future covenant leaf joins the suite
153
+ * only behind a NEW option, so re-deriving a lockup with the SDK
154
+ * that quoted it reproduces its address byte-for-byte.
120
155
  */
121
- nonInteractiveClaim?: {
122
- receiverPkScript: Bytes;
156
+ nonInteractiveParameters?: {
157
+ /**
158
+ * The emulator service's public key, 32-byte x-only or 33-byte
159
+ * compressed. ONE key, tweaked per covenant destination, becomes
160
+ * the co-signer of every leaf in the suite — the leaves share it
161
+ * structurally, and BIP-341 tapscript sighashes committing to the
162
+ * tapleaf hash are what keep a signature for one leaf from
163
+ * replaying against another.
164
+ */
123
165
  emulatorPubkey: Bytes;
124
166
  /**
125
- * OPT-IN: also require the claim to pay at least these amounts.
126
- *
127
- * The covenant's default bound is conservation (`out >= in`) — see
128
- * {@link enforcePayTo} for why a quote is normally not the
129
- * covenant's business. This is the escape hatch for a consumer that
130
- * wants the quote enforced in script rather than at its own
131
- * admission layer.
132
- *
133
- * ADDITIVE, NEVER A REPLACEMENT. The conservation bound stays. On
134
- * its own, `out >= quoted` leaves everything ABOVE the quote
135
- * unconstrained, so an overfunded lockup's surplus could be routed
136
- * anywhere by whoever assembles the spend — trading an underfunding
137
- * hole for a skimming one. Both bounds together admit neither.
138
- *
139
- * WHAT IT COSTS, and it is not only opcodes:
140
- *
141
- * - THE ADDRESS BECOMES A FUNCTION OF THE QUOTE. These amounts
142
- * compile into the leaf, hence the emulator key, hence the
143
- * pkScript. A re-quote is a different address, and cannot be
144
- * applied to a lockup already funded.
145
- * - AN UNDERFUNDED LOCKUP BECOMES UNCLAIMABLE. Its only exit is the
146
- * refund path, which waits out the CLTV. That is the intended
147
- * incentive and it lands on whoever misfunded — but it converts
148
- * "claim the short amount now and settle up" into "wait for the
149
- * timelock".
150
- *
151
- * Omit for the default. Omitting leaves every script byte unchanged,
152
- * so contracts already funded keep their addresses.
167
+ * Where the claim covenant pays: the receiver's own P2TR
168
+ * pkScript, 34 bytes.
169
+ */
170
+ receiverPkScript: Bytes;
171
+ /**
172
+ * Where BOTH refund covenants pay: the sender's own P2TR
173
+ * pkScript, 34 bytes. One destination shared by both refund
174
+ * leaves, so they cannot diverge on where a refund goes.
153
175
  */
154
- strict?: {
155
- /** Sats the claim must pay. Positive. */
156
- amount: bigint;
157
- /**
158
- * Asset base units the claim must pay.
159
- *
160
- * Required iff {@link VHTLC.Options.asset} is set, and refused
161
- * otherwise. Strict-on-sats-only against an asset-denominated
162
- * contract would pin the sat CARRIER and say nothing about the
163
- * asset that is the actual amount — half-enforcement that reads
164
- * like enforcement, which is the failure this option exists to
165
- * avoid rather than introduce.
166
- */
167
- assetAmount?: bigint;
168
- };
169
- };
170
- /**
171
- * Optional non-interactive refund leaf: `server` + `receiver` + a
172
- * covenant-tweaked emulator co-signer, pinned to `senderPkScript`, no
173
- * timelock. Every OTHER refund-side leaf in this contract requires
174
- * the sender's own signature — if the sender permanently loses that
175
- * key, none of them are reachable. This leaf is the one exception:
176
- * it needs neither the sender's presence nor their key, so funds
177
- * remain recoverable to the sender's pre-committed address even
178
- * then. It still needs the receiver (unlike `nonInteractiveClaim`,
179
- * which needs only server + emulator) — deliberately: this is what
180
- * lets server + receiver release the refund immediately, the moment
181
- * they agree the swap has failed, rather than making the sender wait
182
- * out `refundLocktime` the way {@link Script.refundWithoutReceiver}
183
- * does.
184
- */
185
- nonInteractiveRefund?: {
186
176
  senderPkScript: Bytes;
187
- emulatorPubkey: Bytes;
188
177
  /**
189
- * Also emit the timelocked twin: `server` plus the SAME
190
- * covenant-tweaked co-signer, spendable after `refundLocktime`
191
- * with no receiver signature and no sender signature.
178
+ * LEGACY REBUILD ONLY never for a new lockup.
192
179
  *
193
- * This is the only refund tier that needs nobody: `refund` and
194
- * `refundWithoutReceiver` need the sender's key,
195
- * `nonInteractiveRefund` needs the receiver's. A sender who
196
- * funded a lockup and vanished is refundable through this leaf
197
- * alone, by anyone, to their pre-committed address.
198
- *
199
- * Off by default: it is an additional leaf, appended last, so
200
- * enabling it changes the taproot merkle root and therefore the
201
- * address. `nonInteractiveClaim` and `nonInteractiveRefund` are
202
- * independently optional, so this is the NINTH leaf only in the
203
- * full swap-corridor configuration where both are set — on its
204
- * own, it is the eighth.
180
+ * `"preTimelockedRefund"` builds the suite WITHOUT its timelocked
181
+ * refund leaf: the shape every emulator-covenant lockup funded
182
+ * before that leaf shipped carries. Lockups already funded in that
183
+ * shape keep it permanently a leaf cannot be retrofitted onto an
184
+ * address already committed so re-deriving such a lockup (to
185
+ * spend it, or to verify an old quote's address) needs this. A new
186
+ * lockup that omits the leaf gives up the one refund tier needing
187
+ * nobody, for nothing.
205
188
  */
206
- withoutReceiver?: boolean;
189
+ legacy?: "preTimelockedRefund";
207
190
  };
208
191
  /**
209
192
  * Optional: denominate this contract in an Arkade ASSET rather than in
@@ -360,35 +343,33 @@ declare namespace VHTLC {
360
343
  * - **unilateralClaim**: Receiver can claim unilaterally after delay
361
344
  * - **unilateralRefund**: Sender and receiver can refund unilaterally after delay
362
345
  * - **unilateralRefundWithoutReceiver**: Sender can refund unilaterally after delay
363
- * - **nonInteractiveClaim** (optional): server + emulator can push the
364
- * receiver's claim, pinned to a pre-committed destination
365
- * - **nonInteractiveRefund** (optional): server + receiver + emulator
366
- * can push the sender's refund immediately, no timelock, pinned to a
367
- * pre-committed destination — recoverable even if the sender's own key
368
- * is lost
369
- * - **nonInteractiveRefundWithoutReceiver** (optional): server + emulator
370
- * can push the sender's refund after `refundLocktime`, pinned to a
371
- * pre-committed destination — the only refund tier needing no
372
- * participant signature at all
346
+ * - **nonInteractiveClaim** (with `nonInteractiveParameters`): server + emulator
347
+ * can push the receiver's claim, pinned to a pre-committed destination
348
+ * - **nonInteractiveRefund** (with `nonInteractiveParameters`): server + receiver
349
+ * + emulator can push the sender's refund immediately, no timelock,
350
+ * pinned to a pre-committed destination — recoverable even if the
351
+ * sender's own key is lost
352
+ * - **nonInteractiveRefundWithoutReceiver** (with `nonInteractiveParameters`):
353
+ * server + emulator can push the sender's refund after `refundLocktime`,
354
+ * pinned to a pre-committed destination — the only refund tier needing
355
+ * no participant signature at all
373
356
  *
374
357
  * See {@link ScriptV2} for the current recommended construction — same
375
358
  * leaf ladder, same options shape, an added length check on the claim
376
359
  * preimage. This class is unchanged and stays available as-is.
377
360
  *
378
- * **Pre-existing limitation, widened rather than introduced by
379
- * `nonInteractiveRefundWithoutReceiver`.** `nonInteractiveClaim` and
380
- * `nonInteractiveRefund` (and now its `withoutReceiver` leaf) build on
381
- * this class exactly as they do on {@link ScriptV2} — both extend the
382
- * same `BaseScript` where these leaves are constructed. But the `vhtlc`
361
+ * **Pre-existing limitation: the `vhtlc` contract handler registers none
362
+ * of the covenant leaves.** `nonInteractiveParameters` builds on this class
363
+ * exactly as it does on {@link ScriptV2} — both extend the same
364
+ * `BaseScript` where those leaves are constructed. But the `vhtlc`
383
365
  * contract handler (`src/contracts/handlers/vhtlc.ts`) round-trips none
384
366
  * of them: its params type carries no covenant fields, and
385
367
  * `createScript` only ever builds the six signature-only leaves. A V1
386
- * script built with either covenant option therefore compiles and can
368
+ * script built with the covenant suite therefore compiles and can
387
369
  * be funded, but cannot be registered as a `vhtlc` contract — the
388
370
  * handler would derive a different (six-leaf) script for the same
389
- * params and `ContractManager` refuses the mismatch. This was already
390
- * true before `withoutReceiver` existed; it now applies to one more
391
- * option than before, not to a newly-exposed one.
371
+ * params and `ContractManager` refuses the mismatch. Register through
372
+ * the `vhtlc-v2` handler instead, which round-trips the suite.
392
373
  *
393
374
  * @example
394
375
  * ```typescript
@@ -460,9 +441,9 @@ declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.S
460
441
  * The eight mandatory fields are `VHTLCContractParams` verbatim — the two
461
442
  * script versions take the same {@link VHTLC.Options}, so a divergent shape
462
443
  * here would be a difference with no cause. What V1's handler has no field for
463
- * is the two optional covenant leaves, and those are exactly what the swap
464
- * corridor's lockup carries, so leaving them out would make this handler unable
465
- * to round-trip the contract it exists to serve.
444
+ * is the emulator covenant suite, and that is exactly what the swap corridor's
445
+ * lockup carries, so leaving it out would make this handler unable to
446
+ * round-trip the contract it exists to serve.
466
447
  */
467
448
  interface VHTLCV2ContractParams {
468
449
  sender: Uint8Array;
@@ -484,22 +465,18 @@ interface VHTLCV2ContractParams {
484
465
  /** The asset group index within that genesis transaction. */
485
466
  groupIndex: number;
486
467
  };
487
- /** @see VHTLC.Options.nonInteractiveClaim */
488
- nonInteractiveClaim?: {
468
+ /**
469
+ * The emulator covenant suite, all or nothing — mirrors {@link
470
+ * VHTLC.Options.nonInteractiveParameters} exactly, including the legacy selector:
471
+ * a row funded before the timelocked refund leaf shipped round-trips with
472
+ * `legacy: "preTimelockedRefund"` and re-derives its eight-leaf shape.
473
+ */
474
+ nonInteractiveParameters?: {
489
475
  receiverPkScript: Uint8Array;
490
476
  emulatorPubkey: Uint8Array;
491
- /** @see VHTLC.Options.nonInteractiveClaim.strict */
492
- strict?: {
493
- amount: bigint;
494
- assetAmount?: bigint;
495
- };
496
- };
497
- /** @see VHTLC.Options.nonInteractiveRefund */
498
- nonInteractiveRefund?: {
499
477
  senderPkScript: Uint8Array;
500
- emulatorPubkey: Uint8Array;
501
- /** @see VHTLC.Options.nonInteractiveRefund.withoutReceiver */
502
- withoutReceiver?: boolean;
478
+ /** @see VHTLC.Options.nonInteractiveParameters.legacy */
479
+ legacy?: "preTimelockedRefund";
503
480
  };
504
481
  }
505
482
  /**
@@ -13,6 +13,12 @@ declare class Transaction extends Transaction$1 {
13
13
  static fromPSBT(psbt_: Bytes, opts?: TxOpts): Transaction;
14
14
  static fromRaw(raw: Bytes, opts?: TxOpts): Transaction;
15
15
  }
16
+ /**
17
+ * Reject a PSBT that declares a sighash type outside `allowedSighashTypes` on
18
+ * any input, before it reaches a signer. An input carrying no explicit type is
19
+ * left alone: the signer treats a taproot input as {@link SigHash.DEFAULT}.
20
+ */
21
+ declare function assertAllowedSighashTypes(tx: Transaction$1, allowedSighashTypes?: number[]): void;
16
22
 
17
23
  /**
18
24
  * MuSig2 nonce pair containing public and secret values.
@@ -1693,6 +1699,8 @@ type ExplorerTransaction = {
1693
1699
  status: {
1694
1700
  confirmed: boolean;
1695
1701
  block_time: number;
1702
+ /** Set by Esplora; the electrum provider omits it. */
1703
+ block_height?: number;
1696
1704
  };
1697
1705
  };
1698
1706
  interface OnchainProvider {
@@ -1770,7 +1778,14 @@ interface OnchainProvider {
1770
1778
  /**
1771
1779
  * Fetch the current chain tip.
1772
1780
  *
1773
- * @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.
1774
1789
  */
1775
1790
  getChainTip(): Promise<{
1776
1791
  height: number;
@@ -1803,6 +1818,16 @@ declare class EsploraProvider implements OnchainProvider {
1803
1818
  private baseUrl;
1804
1819
  readonly pollingInterval: number;
1805
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;
1806
1831
  constructor(baseUrl?: string, opts?: {
1807
1832
  /** Polling interval in milliseconds. */
1808
1833
  pollingInterval?: number;
@@ -1817,6 +1842,12 @@ declare class EsploraProvider implements OnchainProvider {
1817
1842
  txid?: string;
1818
1843
  }[]>;
1819
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;
1820
1851
  getRawTransaction(txid: string): Promise<Uint8Array>;
1821
1852
  getTxStatus(txid: string): Promise<{
1822
1853
  confirmed: false;
@@ -1825,7 +1856,34 @@ declare class EsploraProvider implements OnchainProvider {
1825
1856
  blockTime: number;
1826
1857
  blockHeight: number;
1827
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
+ */
1828
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;
1829
1887
  getChainTip(): Promise<{
1830
1888
  height: number;
1831
1889
  time: number;
@@ -2189,6 +2247,9 @@ interface SettlementConfig {
2189
2247
  /**
2190
2248
  * Check if a virtual output is expiring soon based on threshold
2191
2249
  *
2250
+ * Always `false` for an unilaterally exited output: "expiring soon" is a renewal
2251
+ * signal, and no batch can renew an output that already lives onchain.
2252
+ *
2192
2253
  * @param vtxo - The virtual output to check
2193
2254
  * @param thresholdMs - Threshold in milliseconds from now
2194
2255
  * @returns true if virtual output expires within threshold, false otherwise
@@ -5501,6 +5562,13 @@ interface WalletBalance {
5501
5562
  /**
5502
5563
  * Total balance across offchain, recoverable, pending-recovery, unrolled,
5503
5564
  * and boarding funds.
5565
+ *
5566
+ * One known main-thread-only wedge: while a spend is in flight — `send`,
5567
+ * `sendBitcoin` or `settle` — its VTXO inputs are withheld from every bucket,
5568
+ * including this one. Boarding inputs are not: only virtual coins enter the
5569
+ * set. That state lives on the `Wallet` instance driving the spend, so a
5570
+ * service-worker client reading the same repository still counts them until
5571
+ * the spend settles. Both sides converge when it does.
5504
5572
  */
5505
5573
  total: number;
5506
5574
  /** Asset balance entries (`assetId` & `amount`) the wallet owns. */
@@ -6159,4 +6227,4 @@ interface IReadonlyWallet {
6159
6227
  clear(): Promise<void>;
6160
6228
  }
6161
6229
 
6162
- export { type BatchFailedEvent as $, type ArkTransaction as A, type IntentRepository as B, type ContractRepository as C, type ArkIntent as D, type ExtendedCoin as E, type IntentFilter as F, type GetVtxosFilter as G, type VirtualTxRepository as H, type IWallet as I, type VirtualTx as J, type VtxoBranch as K, ChainedTxType as L, type Network as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, CSVMultisigTapscript as P, type BatchStartedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotificationEvent as T, type TreeSigningStartedEvent as U, VtxoScript as V, type WalletRepository as W, TxTree as X, type TreeNoncesEvent as Y, type BatchFinalizationEvent as Z, type BatchFinalizedEvent as _, type Identity as a, type ActivityIntent as a$, type TreeTxEvent as a0, type TreeSignatureEvent as a1, type DescriptorProvider as a2, type IReadonlyWallet as a3, type ReadonlyIdentity as a4, type OnchainProvider as a5, type DelegateProvider as a6, type ReadonlyWalletConfig as a7, type ExitCaptureMode as a8, type ExitDataSource as a9, type FeeInfo as aA, type CreateContractParams as aB, type GetContractsFilter as aC, type GetSpendablePathsOptions as aD, type GetAllSpendingPathsOptions as aE, type IssuanceParams as aF, type ReissuanceParams as aG, type BurnParams as aH, type RenewVtxosOptions as aI, type PathSelection as aJ, type ContractEvent as aK, type AssetDetails as aL, type IssuanceResult as aM, type DelegateInfo as aN, type MigrationGlobalSkipReason as aO, type MigrationLegSkipReason as aP, type SignerStatus as aQ, type StorageConfig as aR, type IVtxoManager as aS, type ExplorerTransaction as aT, type TreeNonces as aU, type TreePartialSigs as aV, type PendingTx as aW, type EncodedVtxoScript as aX, type Status as aY, type ChainTx as aZ, type PathContext as a_, type IReadonlyAssetManager as aa, type ContractSyncState as ab, type RecipientAddressContext as ac, type NetworkName as ad, type ArkInfo as ae, ArkAddress as af, type ContractWithVtxos as ag, selectPendingRecoveryOutpoints as ah, type Coin as ai, ContractManager as aj, type ContractManagerConfig as ak, type SettlementConfig as al, VtxoManager as am, type SignerSession as an, type SignedIntent as ao, Intent as ap, type TimeHeight as aq, type DescriptorSigningRequest as ar, Transaction as as, type IntentFeeConfig as at, type OffchainInput as au, FeeAmount as av, type OnchainInput as aw, type FeeOutput as ax, type ContractWatcherConfig as ay, type Asset as az, type WalletConfig as b, RestDelegatorProvider as b$, type ActivityResolver as b0, type ArkIntentState as b1, type ArkTapscript as b2, type AssetMetadata as b3, BITCOIN_EMULATOR_PUBKEY as b4, type BaseWalletConfig as b5, type BatchInfo as b6, type BatchSignableIdentity as b7, CLTVMultisigTapscript as b8, type CandidateDeps as b9, EventSourceUnavailableError as bA, type ExitChainResolver as bB, type ExtendedContractVtxo as bC, type GroupMembership as bD, type HandlerError as bE, type IDelegatorManager as bF, INTENT_TERMINAL_STATES as bG, IndexerTxType as bH, type IntentCoin as bI, type KnownMetadata as bJ, MUTINYNET_EMULATOR_PUBKEY as bK, type MigrateDeprecatedSignerOptions as bL, type MigrationLegReport as bM, type MigrationVtxoRef as bN, MultisigTapscript as bO, type NewAddressType as bP, type Nonces as bQ, type Output as bR, type PageResponse as bS, type PaginationOptions as bT, PartialSig as bU, type PrevTxSource as bV, PrevTxUnavailableError as bW, type ProviderClass as bX, REGTEST_EMULATOR_PUBKEY as bY, type RawTxSource as bZ, RestDelegateProvider as b_, ChainTxType as ba, type CommitmentTx as bb, ConditionCSVMultisigTapscript as bc, ConditionMultisigTapscript as bd, type ContractBalance as be, type ContractEventCallback as bf, type ContractHandler as bg, type ContractState as bh, type ContractVtxo as bi, ContractWatcher as bj, DEFAULT_VTXO_PAGE_SIZE as bk, DelegateManagerImpl as bl, type DelegateOptions as bm, DelegatorManagerImpl as bn, type DelegatorProvider as bo, type DeprecatedSignerMigrationReport as bp, type DeprecatedSignerReport as bq, DigestMismatchError as br, type Discoverable as bs, type DiscoveredContract as bt, type DiscoveryDeps as bu, ESPLORA_URL as bv, EsploraProvider as bw, type EventSourceCapable as bx, type EventSourceFactory as by, type EventSourceLike as bz, type WalletBalance as c, resolvePrevTxs as c$, type ScanContractsOptions as c0, type ScanResult as c1, type ScheduledSession as c2, SettlementEventType as c3, type SignRequest as c4, type SignerClassification as c5, type SignerSet as c6, type SubscriptionEvent as c7, type SubscriptionHeartbeat as c8, type SweepTxNotification as c9, configureEventSource as cA, createDefaultActivityRegistry as cB, createExitChainResolver as cC, decodeTapscript as cD, defaultEmulatorPubkey as cE, getConfiguredEventSource as cF, getNetwork as cG, getRandomId as cH, getSequence as cI, hasCandidates as cJ, hasTerminalSpend as cK, isBatchSignable as cL, isCooperativelyMigratable as cM, isDiscoverable as cN, isEventSourceUnavailableError as cO, isExpired as cP, isPastExpiry as cQ, isRecoverable as cR, isSigningIdentity as cS, isSpendable as cT, isSubdust as cU, isTerminalIntentState as cV, isVirtualCoin as cW, isVtxoExpiringSoon as cX, networks as cY, resolveEmulatorPubkey as cZ, resolveEventSource as c_, type TapLeaves as ca, TapTreeCoder as cb, TapscriptType as cc, type Tx as cd, type TxHistoryRecord as ce, type TxKey as cf, type TxNotification as cg, type TxTag as ch, type TxTreeNode as ci, TxType as cj, type VirtualStatus as ck, type Vtxo as cl, type VtxoChain as cm, type VtxoType as cn, type WalletMode as co, type WithPrevTx as cp, assetMintResolver as cq, attachPrevArkTxs as cr, attachPrevoutTxs as cs, boardingResolver as ct, canRecoverOnchain as cu, canSpendOffchain as cv, canSweepOnchain as cw, classifyAgainstSignerSet as cx, classifyContractSigner as cy, collabExitResolver as cz, ActivityRegistry as d, scriptFromTapLeafScript as d0, signerSetFromInfo as d1, toXOnlySignerHex as d2, withPrevTxs as d3, type TapscriptDeriving as d4, type Activity as e, type IContractManager as f, type GetNewAddressesOptions as g, type NewAddress as h, type IDelegateManager as i, type SettleParams as j, type SettlementEvent as k, type SendParams as l, type IAssetManager as m, RestArkProvider as n, RestIndexerProvider as o, type SubscriptionResponse as p, type ArkProvider as q, type IndexerProvider as r, type RelativeTimelock as s, type TapLeafScript as t, type VirtualCoin as u, type Contract as v, type ExtendedVirtualCoin as w, type VtxoRepositoryKey as x, type WalletState as y, type ContractFilter as z };
6230
+ export { type BatchFailedEvent as $, type ArkTransaction as A, type IntentRepository as B, type ContractRepository as C, type ArkIntent as D, type ExtendedCoin as E, type IntentFilter as F, type GetVtxosFilter as G, type VirtualTxRepository as H, type IWallet as I, type VirtualTx as J, type VtxoBranch as K, ChainedTxType as L, type Network as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, CSVMultisigTapscript as P, type BatchStartedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotificationEvent as T, type TreeSigningStartedEvent as U, VtxoScript as V, type WalletRepository as W, TxTree as X, type TreeNoncesEvent as Y, type BatchFinalizationEvent as Z, type BatchFinalizedEvent as _, type Identity as a, type ActivityIntent as a$, type TreeTxEvent as a0, type TreeSignatureEvent as a1, type DescriptorProvider as a2, type IReadonlyWallet as a3, type ReadonlyIdentity as a4, type OnchainProvider as a5, type DelegateProvider as a6, type ReadonlyWalletConfig as a7, type ExitCaptureMode as a8, type ExitDataSource as a9, type FeeInfo as aA, type CreateContractParams as aB, type GetContractsFilter as aC, type GetSpendablePathsOptions as aD, type GetAllSpendingPathsOptions as aE, type IssuanceParams as aF, type ReissuanceParams as aG, type BurnParams as aH, type RenewVtxosOptions as aI, type PathSelection as aJ, type ContractEvent as aK, type AssetDetails as aL, type IssuanceResult as aM, type DelegateInfo as aN, type MigrationGlobalSkipReason as aO, type MigrationLegSkipReason as aP, type SignerStatus as aQ, type StorageConfig as aR, type IVtxoManager as aS, type ExplorerTransaction as aT, type TreeNonces as aU, type TreePartialSigs as aV, type PendingTx as aW, type EncodedVtxoScript as aX, type Status as aY, type ChainTx as aZ, type PathContext as a_, type IReadonlyAssetManager as aa, type ContractSyncState as ab, type RecipientAddressContext as ac, type NetworkName as ad, type ArkInfo as ae, ArkAddress as af, type ContractWithVtxos as ag, selectPendingRecoveryOutpoints as ah, type Coin as ai, ContractManager as aj, type ContractManagerConfig as ak, type SettlementConfig as al, VtxoManager as am, type SignerSession as an, type SignedIntent as ao, Intent as ap, type TimeHeight as aq, type DescriptorSigningRequest as ar, Transaction as as, type IntentFeeConfig as at, type OffchainInput as au, FeeAmount as av, type OnchainInput as aw, type FeeOutput as ax, type ContractWatcherConfig as ay, type Asset as az, type WalletConfig as b, RestDelegatorProvider as b$, type ActivityResolver as b0, type ArkIntentState as b1, type ArkTapscript as b2, type AssetMetadata as b3, BITCOIN_EMULATOR_PUBKEY as b4, type BaseWalletConfig as b5, type BatchInfo as b6, type BatchSignableIdentity as b7, CLTVMultisigTapscript as b8, type CandidateDeps as b9, EventSourceUnavailableError as bA, type ExitChainResolver as bB, type ExtendedContractVtxo as bC, type GroupMembership as bD, type HandlerError as bE, type IDelegatorManager as bF, INTENT_TERMINAL_STATES as bG, IndexerTxType as bH, type IntentCoin as bI, type KnownMetadata as bJ, MUTINYNET_EMULATOR_PUBKEY as bK, type MigrateDeprecatedSignerOptions as bL, type MigrationLegReport as bM, type MigrationVtxoRef as bN, MultisigTapscript as bO, type NewAddressType as bP, type Nonces as bQ, type Output as bR, type PageResponse as bS, type PaginationOptions as bT, PartialSig as bU, type PrevTxSource as bV, PrevTxUnavailableError as bW, type ProviderClass as bX, REGTEST_EMULATOR_PUBKEY as bY, type RawTxSource as bZ, RestDelegateProvider as b_, ChainTxType as ba, type CommitmentTx as bb, ConditionCSVMultisigTapscript as bc, ConditionMultisigTapscript as bd, type ContractBalance as be, type ContractEventCallback as bf, type ContractHandler as bg, type ContractState as bh, type ContractVtxo as bi, ContractWatcher as bj, DEFAULT_VTXO_PAGE_SIZE as bk, DelegateManagerImpl as bl, type DelegateOptions as bm, DelegatorManagerImpl as bn, type DelegatorProvider as bo, type DeprecatedSignerMigrationReport as bp, type DeprecatedSignerReport as bq, DigestMismatchError as br, type Discoverable as bs, type DiscoveredContract as bt, type DiscoveryDeps as bu, ESPLORA_URL as bv, EsploraProvider as bw, type EventSourceCapable as bx, type EventSourceFactory as by, type EventSourceLike as bz, type WalletBalance as c, resolveEventSource as c$, type ScanContractsOptions as c0, type ScanResult as c1, type ScheduledSession as c2, SettlementEventType as c3, type SignRequest as c4, type SignerClassification as c5, type SignerSet as c6, type SubscriptionEvent as c7, type SubscriptionHeartbeat as c8, type SweepTxNotification as c9, collabExitResolver as cA, configureEventSource as cB, createDefaultActivityRegistry as cC, createExitChainResolver as cD, decodeTapscript as cE, defaultEmulatorPubkey as cF, getConfiguredEventSource as cG, getNetwork as cH, getRandomId as cI, getSequence as cJ, hasCandidates as cK, hasTerminalSpend as cL, isBatchSignable as cM, isCooperativelyMigratable as cN, isDiscoverable as cO, isEventSourceUnavailableError as cP, isExpired as cQ, isPastExpiry as cR, isRecoverable as cS, isSigningIdentity as cT, isSpendable as cU, isSubdust as cV, isTerminalIntentState as cW, isVirtualCoin as cX, isVtxoExpiringSoon as cY, networks as cZ, resolveEmulatorPubkey as c_, type TapLeaves as ca, TapTreeCoder as cb, TapscriptType as cc, type Tx as cd, type TxHistoryRecord as ce, type TxKey as cf, type TxNotification as cg, type TxTag as ch, type TxTreeNode as ci, TxType as cj, type VirtualStatus as ck, type Vtxo as cl, type VtxoChain as cm, type VtxoType as cn, type WalletMode as co, type WithPrevTx as cp, assertAllowedSighashTypes as cq, assetMintResolver as cr, attachPrevArkTxs as cs, attachPrevoutTxs as ct, boardingResolver as cu, canRecoverOnchain as cv, canSpendOffchain as cw, canSweepOnchain as cx, classifyAgainstSignerSet as cy, classifyContractSigner as cz, ActivityRegistry as d, resolvePrevTxs as d0, scriptFromTapLeafScript as d1, signerSetFromInfo as d2, toXOnlySignerHex as d3, withPrevTxs as d4, type TapscriptDeriving as d5, type Activity as e, type IContractManager as f, type GetNewAddressesOptions as g, type NewAddress as h, type IDelegateManager as i, type SettleParams as j, type SettlementEvent as k, type SendParams as l, type IAssetManager as m, RestArkProvider as n, RestIndexerProvider as o, type SubscriptionResponse as p, type ArkProvider as q, type IndexerProvider as r, type RelativeTimelock as s, type TapLeafScript as t, type VirtualCoin as u, type Contract as v, type ExtendedVirtualCoin as w, type VtxoRepositoryKey as x, type WalletState as y, type ContractFilter as z };
@@ -13,6 +13,12 @@ declare class Transaction extends Transaction$1 {
13
13
  static fromPSBT(psbt_: Bytes, opts?: TxOpts): Transaction;
14
14
  static fromRaw(raw: Bytes, opts?: TxOpts): Transaction;
15
15
  }
16
+ /**
17
+ * Reject a PSBT that declares a sighash type outside `allowedSighashTypes` on
18
+ * any input, before it reaches a signer. An input carrying no explicit type is
19
+ * left alone: the signer treats a taproot input as {@link SigHash.DEFAULT}.
20
+ */
21
+ declare function assertAllowedSighashTypes(tx: Transaction$1, allowedSighashTypes?: number[]): void;
16
22
 
17
23
  /**
18
24
  * MuSig2 nonce pair containing public and secret values.
@@ -1693,6 +1699,8 @@ type ExplorerTransaction = {
1693
1699
  status: {
1694
1700
  confirmed: boolean;
1695
1701
  block_time: number;
1702
+ /** Set by Esplora; the electrum provider omits it. */
1703
+ block_height?: number;
1696
1704
  };
1697
1705
  };
1698
1706
  interface OnchainProvider {
@@ -1770,7 +1778,14 @@ interface OnchainProvider {
1770
1778
  /**
1771
1779
  * Fetch the current chain tip.
1772
1780
  *
1773
- * @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.
1774
1789
  */
1775
1790
  getChainTip(): Promise<{
1776
1791
  height: number;
@@ -1803,6 +1818,16 @@ declare class EsploraProvider implements OnchainProvider {
1803
1818
  private baseUrl;
1804
1819
  readonly pollingInterval: number;
1805
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;
1806
1831
  constructor(baseUrl?: string, opts?: {
1807
1832
  /** Polling interval in milliseconds. */
1808
1833
  pollingInterval?: number;
@@ -1817,6 +1842,12 @@ declare class EsploraProvider implements OnchainProvider {
1817
1842
  txid?: string;
1818
1843
  }[]>;
1819
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;
1820
1851
  getRawTransaction(txid: string): Promise<Uint8Array>;
1821
1852
  getTxStatus(txid: string): Promise<{
1822
1853
  confirmed: false;
@@ -1825,7 +1856,34 @@ declare class EsploraProvider implements OnchainProvider {
1825
1856
  blockTime: number;
1826
1857
  blockHeight: number;
1827
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
+ */
1828
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;
1829
1887
  getChainTip(): Promise<{
1830
1888
  height: number;
1831
1889
  time: number;
@@ -2189,6 +2247,9 @@ interface SettlementConfig {
2189
2247
  /**
2190
2248
  * Check if a virtual output is expiring soon based on threshold
2191
2249
  *
2250
+ * Always `false` for an unilaterally exited output: "expiring soon" is a renewal
2251
+ * signal, and no batch can renew an output that already lives onchain.
2252
+ *
2192
2253
  * @param vtxo - The virtual output to check
2193
2254
  * @param thresholdMs - Threshold in milliseconds from now
2194
2255
  * @returns true if virtual output expires within threshold, false otherwise
@@ -5501,6 +5562,13 @@ interface WalletBalance {
5501
5562
  /**
5502
5563
  * Total balance across offchain, recoverable, pending-recovery, unrolled,
5503
5564
  * and boarding funds.
5565
+ *
5566
+ * One known main-thread-only wedge: while a spend is in flight — `send`,
5567
+ * `sendBitcoin` or `settle` — its VTXO inputs are withheld from every bucket,
5568
+ * including this one. Boarding inputs are not: only virtual coins enter the
5569
+ * set. That state lives on the `Wallet` instance driving the spend, so a
5570
+ * service-worker client reading the same repository still counts them until
5571
+ * the spend settles. Both sides converge when it does.
5504
5572
  */
5505
5573
  total: number;
5506
5574
  /** Asset balance entries (`assetId` & `amount`) the wallet owns. */
@@ -6159,4 +6227,4 @@ interface IReadonlyWallet {
6159
6227
  clear(): Promise<void>;
6160
6228
  }
6161
6229
 
6162
- export { type BatchFailedEvent as $, type ArkTransaction as A, type IntentRepository as B, type ContractRepository as C, type ArkIntent as D, type ExtendedCoin as E, type IntentFilter as F, type GetVtxosFilter as G, type VirtualTxRepository as H, type IWallet as I, type VirtualTx as J, type VtxoBranch as K, ChainedTxType as L, type Network as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, CSVMultisigTapscript as P, type BatchStartedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotificationEvent as T, type TreeSigningStartedEvent as U, VtxoScript as V, type WalletRepository as W, TxTree as X, type TreeNoncesEvent as Y, type BatchFinalizationEvent as Z, type BatchFinalizedEvent as _, type Identity as a, type ActivityIntent as a$, type TreeTxEvent as a0, type TreeSignatureEvent as a1, type DescriptorProvider as a2, type IReadonlyWallet as a3, type ReadonlyIdentity as a4, type OnchainProvider as a5, type DelegateProvider as a6, type ReadonlyWalletConfig as a7, type ExitCaptureMode as a8, type ExitDataSource as a9, type FeeInfo as aA, type CreateContractParams as aB, type GetContractsFilter as aC, type GetSpendablePathsOptions as aD, type GetAllSpendingPathsOptions as aE, type IssuanceParams as aF, type ReissuanceParams as aG, type BurnParams as aH, type RenewVtxosOptions as aI, type PathSelection as aJ, type ContractEvent as aK, type AssetDetails as aL, type IssuanceResult as aM, type DelegateInfo as aN, type MigrationGlobalSkipReason as aO, type MigrationLegSkipReason as aP, type SignerStatus as aQ, type StorageConfig as aR, type IVtxoManager as aS, type ExplorerTransaction as aT, type TreeNonces as aU, type TreePartialSigs as aV, type PendingTx as aW, type EncodedVtxoScript as aX, type Status as aY, type ChainTx as aZ, type PathContext as a_, type IReadonlyAssetManager as aa, type ContractSyncState as ab, type RecipientAddressContext as ac, type NetworkName as ad, type ArkInfo as ae, ArkAddress as af, type ContractWithVtxos as ag, selectPendingRecoveryOutpoints as ah, type Coin as ai, ContractManager as aj, type ContractManagerConfig as ak, type SettlementConfig as al, VtxoManager as am, type SignerSession as an, type SignedIntent as ao, Intent as ap, type TimeHeight as aq, type DescriptorSigningRequest as ar, Transaction as as, type IntentFeeConfig as at, type OffchainInput as au, FeeAmount as av, type OnchainInput as aw, type FeeOutput as ax, type ContractWatcherConfig as ay, type Asset as az, type WalletConfig as b, RestDelegatorProvider as b$, type ActivityResolver as b0, type ArkIntentState as b1, type ArkTapscript as b2, type AssetMetadata as b3, BITCOIN_EMULATOR_PUBKEY as b4, type BaseWalletConfig as b5, type BatchInfo as b6, type BatchSignableIdentity as b7, CLTVMultisigTapscript as b8, type CandidateDeps as b9, EventSourceUnavailableError as bA, type ExitChainResolver as bB, type ExtendedContractVtxo as bC, type GroupMembership as bD, type HandlerError as bE, type IDelegatorManager as bF, INTENT_TERMINAL_STATES as bG, IndexerTxType as bH, type IntentCoin as bI, type KnownMetadata as bJ, MUTINYNET_EMULATOR_PUBKEY as bK, type MigrateDeprecatedSignerOptions as bL, type MigrationLegReport as bM, type MigrationVtxoRef as bN, MultisigTapscript as bO, type NewAddressType as bP, type Nonces as bQ, type Output as bR, type PageResponse as bS, type PaginationOptions as bT, PartialSig as bU, type PrevTxSource as bV, PrevTxUnavailableError as bW, type ProviderClass as bX, REGTEST_EMULATOR_PUBKEY as bY, type RawTxSource as bZ, RestDelegateProvider as b_, ChainTxType as ba, type CommitmentTx as bb, ConditionCSVMultisigTapscript as bc, ConditionMultisigTapscript as bd, type ContractBalance as be, type ContractEventCallback as bf, type ContractHandler as bg, type ContractState as bh, type ContractVtxo as bi, ContractWatcher as bj, DEFAULT_VTXO_PAGE_SIZE as bk, DelegateManagerImpl as bl, type DelegateOptions as bm, DelegatorManagerImpl as bn, type DelegatorProvider as bo, type DeprecatedSignerMigrationReport as bp, type DeprecatedSignerReport as bq, DigestMismatchError as br, type Discoverable as bs, type DiscoveredContract as bt, type DiscoveryDeps as bu, ESPLORA_URL as bv, EsploraProvider as bw, type EventSourceCapable as bx, type EventSourceFactory as by, type EventSourceLike as bz, type WalletBalance as c, resolvePrevTxs as c$, type ScanContractsOptions as c0, type ScanResult as c1, type ScheduledSession as c2, SettlementEventType as c3, type SignRequest as c4, type SignerClassification as c5, type SignerSet as c6, type SubscriptionEvent as c7, type SubscriptionHeartbeat as c8, type SweepTxNotification as c9, configureEventSource as cA, createDefaultActivityRegistry as cB, createExitChainResolver as cC, decodeTapscript as cD, defaultEmulatorPubkey as cE, getConfiguredEventSource as cF, getNetwork as cG, getRandomId as cH, getSequence as cI, hasCandidates as cJ, hasTerminalSpend as cK, isBatchSignable as cL, isCooperativelyMigratable as cM, isDiscoverable as cN, isEventSourceUnavailableError as cO, isExpired as cP, isPastExpiry as cQ, isRecoverable as cR, isSigningIdentity as cS, isSpendable as cT, isSubdust as cU, isTerminalIntentState as cV, isVirtualCoin as cW, isVtxoExpiringSoon as cX, networks as cY, resolveEmulatorPubkey as cZ, resolveEventSource as c_, type TapLeaves as ca, TapTreeCoder as cb, TapscriptType as cc, type Tx as cd, type TxHistoryRecord as ce, type TxKey as cf, type TxNotification as cg, type TxTag as ch, type TxTreeNode as ci, TxType as cj, type VirtualStatus as ck, type Vtxo as cl, type VtxoChain as cm, type VtxoType as cn, type WalletMode as co, type WithPrevTx as cp, assetMintResolver as cq, attachPrevArkTxs as cr, attachPrevoutTxs as cs, boardingResolver as ct, canRecoverOnchain as cu, canSpendOffchain as cv, canSweepOnchain as cw, classifyAgainstSignerSet as cx, classifyContractSigner as cy, collabExitResolver as cz, ActivityRegistry as d, scriptFromTapLeafScript as d0, signerSetFromInfo as d1, toXOnlySignerHex as d2, withPrevTxs as d3, type TapscriptDeriving as d4, type Activity as e, type IContractManager as f, type GetNewAddressesOptions as g, type NewAddress as h, type IDelegateManager as i, type SettleParams as j, type SettlementEvent as k, type SendParams as l, type IAssetManager as m, RestArkProvider as n, RestIndexerProvider as o, type SubscriptionResponse as p, type ArkProvider as q, type IndexerProvider as r, type RelativeTimelock as s, type TapLeafScript as t, type VirtualCoin as u, type Contract as v, type ExtendedVirtualCoin as w, type VtxoRepositoryKey as x, type WalletState as y, type ContractFilter as z };
6230
+ export { type BatchFailedEvent as $, type ArkTransaction as A, type IntentRepository as B, type ContractRepository as C, type ArkIntent as D, type ExtendedCoin as E, type IntentFilter as F, type GetVtxosFilter as G, type VirtualTxRepository as H, type IWallet as I, type VirtualTx as J, type VtxoBranch as K, ChainedTxType as L, type Network as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, CSVMultisigTapscript as P, type BatchStartedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotificationEvent as T, type TreeSigningStartedEvent as U, VtxoScript as V, type WalletRepository as W, TxTree as X, type TreeNoncesEvent as Y, type BatchFinalizationEvent as Z, type BatchFinalizedEvent as _, type Identity as a, type ActivityIntent as a$, type TreeTxEvent as a0, type TreeSignatureEvent as a1, type DescriptorProvider as a2, type IReadonlyWallet as a3, type ReadonlyIdentity as a4, type OnchainProvider as a5, type DelegateProvider as a6, type ReadonlyWalletConfig as a7, type ExitCaptureMode as a8, type ExitDataSource as a9, type FeeInfo as aA, type CreateContractParams as aB, type GetContractsFilter as aC, type GetSpendablePathsOptions as aD, type GetAllSpendingPathsOptions as aE, type IssuanceParams as aF, type ReissuanceParams as aG, type BurnParams as aH, type RenewVtxosOptions as aI, type PathSelection as aJ, type ContractEvent as aK, type AssetDetails as aL, type IssuanceResult as aM, type DelegateInfo as aN, type MigrationGlobalSkipReason as aO, type MigrationLegSkipReason as aP, type SignerStatus as aQ, type StorageConfig as aR, type IVtxoManager as aS, type ExplorerTransaction as aT, type TreeNonces as aU, type TreePartialSigs as aV, type PendingTx as aW, type EncodedVtxoScript as aX, type Status as aY, type ChainTx as aZ, type PathContext as a_, type IReadonlyAssetManager as aa, type ContractSyncState as ab, type RecipientAddressContext as ac, type NetworkName as ad, type ArkInfo as ae, ArkAddress as af, type ContractWithVtxos as ag, selectPendingRecoveryOutpoints as ah, type Coin as ai, ContractManager as aj, type ContractManagerConfig as ak, type SettlementConfig as al, VtxoManager as am, type SignerSession as an, type SignedIntent as ao, Intent as ap, type TimeHeight as aq, type DescriptorSigningRequest as ar, Transaction as as, type IntentFeeConfig as at, type OffchainInput as au, FeeAmount as av, type OnchainInput as aw, type FeeOutput as ax, type ContractWatcherConfig as ay, type Asset as az, type WalletConfig as b, RestDelegatorProvider as b$, type ActivityResolver as b0, type ArkIntentState as b1, type ArkTapscript as b2, type AssetMetadata as b3, BITCOIN_EMULATOR_PUBKEY as b4, type BaseWalletConfig as b5, type BatchInfo as b6, type BatchSignableIdentity as b7, CLTVMultisigTapscript as b8, type CandidateDeps as b9, EventSourceUnavailableError as bA, type ExitChainResolver as bB, type ExtendedContractVtxo as bC, type GroupMembership as bD, type HandlerError as bE, type IDelegatorManager as bF, INTENT_TERMINAL_STATES as bG, IndexerTxType as bH, type IntentCoin as bI, type KnownMetadata as bJ, MUTINYNET_EMULATOR_PUBKEY as bK, type MigrateDeprecatedSignerOptions as bL, type MigrationLegReport as bM, type MigrationVtxoRef as bN, MultisigTapscript as bO, type NewAddressType as bP, type Nonces as bQ, type Output as bR, type PageResponse as bS, type PaginationOptions as bT, PartialSig as bU, type PrevTxSource as bV, PrevTxUnavailableError as bW, type ProviderClass as bX, REGTEST_EMULATOR_PUBKEY as bY, type RawTxSource as bZ, RestDelegateProvider as b_, ChainTxType as ba, type CommitmentTx as bb, ConditionCSVMultisigTapscript as bc, ConditionMultisigTapscript as bd, type ContractBalance as be, type ContractEventCallback as bf, type ContractHandler as bg, type ContractState as bh, type ContractVtxo as bi, ContractWatcher as bj, DEFAULT_VTXO_PAGE_SIZE as bk, DelegateManagerImpl as bl, type DelegateOptions as bm, DelegatorManagerImpl as bn, type DelegatorProvider as bo, type DeprecatedSignerMigrationReport as bp, type DeprecatedSignerReport as bq, DigestMismatchError as br, type Discoverable as bs, type DiscoveredContract as bt, type DiscoveryDeps as bu, ESPLORA_URL as bv, EsploraProvider as bw, type EventSourceCapable as bx, type EventSourceFactory as by, type EventSourceLike as bz, type WalletBalance as c, resolveEventSource as c$, type ScanContractsOptions as c0, type ScanResult as c1, type ScheduledSession as c2, SettlementEventType as c3, type SignRequest as c4, type SignerClassification as c5, type SignerSet as c6, type SubscriptionEvent as c7, type SubscriptionHeartbeat as c8, type SweepTxNotification as c9, collabExitResolver as cA, configureEventSource as cB, createDefaultActivityRegistry as cC, createExitChainResolver as cD, decodeTapscript as cE, defaultEmulatorPubkey as cF, getConfiguredEventSource as cG, getNetwork as cH, getRandomId as cI, getSequence as cJ, hasCandidates as cK, hasTerminalSpend as cL, isBatchSignable as cM, isCooperativelyMigratable as cN, isDiscoverable as cO, isEventSourceUnavailableError as cP, isExpired as cQ, isPastExpiry as cR, isRecoverable as cS, isSigningIdentity as cT, isSpendable as cU, isSubdust as cV, isTerminalIntentState as cW, isVirtualCoin as cX, isVtxoExpiringSoon as cY, networks as cZ, resolveEmulatorPubkey as c_, type TapLeaves as ca, TapTreeCoder as cb, TapscriptType as cc, type Tx as cd, type TxHistoryRecord as ce, type TxKey as cf, type TxNotification as cg, type TxTag as ch, type TxTreeNode as ci, TxType as cj, type VirtualStatus as ck, type Vtxo as cl, type VtxoChain as cm, type VtxoType as cn, type WalletMode as co, type WithPrevTx as cp, assertAllowedSighashTypes as cq, assetMintResolver as cr, attachPrevArkTxs as cs, attachPrevoutTxs as ct, boardingResolver as cu, canRecoverOnchain as cv, canSpendOffchain as cw, canSweepOnchain as cx, classifyAgainstSignerSet as cy, classifyContractSigner as cz, ActivityRegistry as d, resolvePrevTxs as d0, scriptFromTapLeafScript as d1, signerSetFromInfo as d2, toXOnlySignerHex as d3, withPrevTxs as d4, type TapscriptDeriving as d5, type Activity as e, type IContractManager as f, type GetNewAddressesOptions as g, type NewAddress as h, type IDelegateManager as i, type SettleParams as j, type SettlementEvent as k, type SendParams as l, type IAssetManager as m, RestArkProvider as n, RestIndexerProvider as o, type SubscriptionResponse as p, type ArkProvider as q, type IndexerProvider as r, type RelativeTimelock as s, type TapLeafScript as t, type VirtualCoin as u, type Contract as v, type ExtendedVirtualCoin as w, type VtxoRepositoryKey as x, type WalletState as y, type ContractFilter as z };