@arkade-os/sdk 0.4.66 → 0.4.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +66 -15
  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-BZcIN7sA.d.cts → asyncStorageTaskQueue-LTpeXYaD.d.cts} +2 -2
  9. package/dist/{asyncStorageTaskQueue-B6SijMi3.d.ts → asyncStorageTaskQueue-Za-e_zMk.d.ts} +2 -2
  10. package/dist/{chunk-ZIRFXBKL.cjs → chunk-2JV4VQ7C.cjs} +33 -13
  11. package/dist/chunk-2JV4VQ7C.cjs.map +1 -0
  12. package/dist/{chunk-J33ZEM3A.js → chunk-3WIWNE4P.js} +33 -14
  13. package/dist/chunk-3WIWNE4P.js.map +1 -0
  14. package/dist/{chunk-CYOI4PEA.js → chunk-6TAQF6EV.js} +107 -13
  15. package/dist/chunk-6TAQF6EV.js.map +1 -0
  16. package/dist/{chunk-DSC3G6QZ.js → chunk-AEWJU6NZ.js} +1006 -167
  17. package/dist/chunk-AEWJU6NZ.js.map +1 -0
  18. package/dist/{chunk-3S3JZUEN.cjs → chunk-CO3KKSWM.cjs} +17 -17
  19. package/dist/{chunk-3S3JZUEN.cjs.map → chunk-CO3KKSWM.cjs.map} +1 -1
  20. package/dist/{chunk-55ZZ6RBL.js → chunk-EALWOVHK.js} +4 -4
  21. package/dist/{chunk-55ZZ6RBL.js.map → chunk-EALWOVHK.js.map} +1 -1
  22. package/dist/{chunk-5E6IZNRG.cjs → chunk-MJUTO3PY.cjs} +1413 -563
  23. package/dist/chunk-MJUTO3PY.cjs.map +1 -0
  24. package/dist/{chunk-R5POS3RS.js → chunk-MZFUZUTQ.js} +4 -4
  25. package/dist/{chunk-R5POS3RS.js.map → chunk-MZFUZUTQ.js.map} +1 -1
  26. package/dist/{chunk-PXPPZF5K.cjs → chunk-OIZ2V2VD.cjs} +152 -58
  27. package/dist/chunk-OIZ2V2VD.cjs.map +1 -0
  28. package/dist/{chunk-IM6IKNSL.cjs → chunk-R2YAMONM.cjs} +17 -17
  29. package/dist/{chunk-IM6IKNSL.cjs.map → chunk-R2YAMONM.cjs.map} +1 -1
  30. package/dist/{chunk-2JZGPXU4.js → chunk-X3VEMUVV.js} +3 -3
  31. package/dist/{chunk-2JZGPXU4.js.map → chunk-X3VEMUVV.js.map} +1 -1
  32. package/dist/{chunk-LL47QIHD.cjs → chunk-YDRZDZPP.cjs} +10 -10
  33. package/dist/{chunk-LL47QIHD.cjs.map → chunk-YDRZDZPP.cjs.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-YXupcWWJ.d.cts → delegate-Bz2e2zXY.d.cts} +1 -1
  39. package/dist/{delegate-T-vgxMYZ.d.ts → delegate-cdmzb2f9.d.ts} +1 -1
  40. package/dist/{wallet-CNibc3yJ.d.ts → hdWalletCapable-BSjuUYOO.d.cts} +318 -127
  41. package/dist/{wallet-DJN1QgFt.d.cts → hdWalletCapable-Hi12xjCJ.d.ts} +318 -127
  42. package/dist/{index-e7LYXk1d.d.cts → index-BiACuWaf.d.ts} +109 -13
  43. package/dist/{index-D_FgwLH9.d.ts → index-D2GjZxBr.d.cts} +109 -13
  44. package/dist/{index-uUE_uQPn.d.ts → index-DU5o_hz7.d.cts} +206 -19
  45. package/dist/{index-uUE_uQPn.d.cts → index-DU5o_hz7.d.ts} +206 -19
  46. package/dist/index.cjs +322 -278
  47. package/dist/index.d.cts +291 -41
  48. package/dist/index.d.ts +291 -41
  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-BOVcIH1N.d.cts → taskRunner-BZJMLQ6g.d.cts} +2 -2
  59. package/dist/{taskRunner-DNyD1kXG.d.ts → taskRunner-DATaRQus.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 +18 -14
  65. package/dist/wallet/expo/index.cjs.map +1 -1
  66. package/dist/wallet/expo/index.d.cts +7 -5
  67. package/dist/wallet/expo/index.d.ts +7 -5
  68. package/dist/wallet/expo/index.js +10 -6
  69. package/dist/wallet/expo/index.js.map +1 -1
  70. package/dist/worker/expo/index.cjs +9 -9
  71. package/dist/worker/expo/index.d.cts +4 -4
  72. package/dist/worker/expo/index.d.ts +4 -4
  73. package/dist/worker/expo/index.js +5 -5
  74. package/package.json +3 -3
  75. package/dist/chunk-5E6IZNRG.cjs.map +0 -1
  76. package/dist/chunk-CYOI4PEA.js.map +0 -1
  77. package/dist/chunk-DSC3G6QZ.js.map +0 -1
  78. package/dist/chunk-J33ZEM3A.js.map +0 -1
  79. package/dist/chunk-PXPPZF5K.cjs.map +0 -1
  80. package/dist/chunk-ZIRFXBKL.cjs.map +0 -1
@@ -1,129 +1,8 @@
1
- import { a as Identity, K as DescriptorProvider, q as RelativeTimelock, L as Network, M as CSVMultisigTapscript, P as BatchStartedEvent, Q as TreeSigningStartedEvent, U as TxTree, X as TreeNoncesEvent, Y as BatchFinalizationEvent, Z as BatchFinalizedEvent, _ as BatchFailedEvent, $ as TreeTxEvent, a0 as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, f as IContractManager, a1 as IReadonlyWallet, a2 as ReadonlyIdentity, a3 as OnchainProvider, p as IndexerProvider, a4 as DelegateProvider, a5 as ReadonlyWalletConfig, y as IntentRepository, D as VirtualTxRepository, a6 as ExitCaptureMode, a7 as ExitDataSource, d as ActivityRegistry, a8 as IReadonlyAssetManager, a9 as ContractSyncState, aa as RecipientAddressContext, o as ArkProvider, ab as NetworkName, ac as ArkInfo, ad as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ae as ContractWithVtxos, af as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ag as Coin, u as ExtendedVirtualCoin, ah as ContractManager, ai as ContractManagerConfig, I as IWallet, aj as SettlementConfig, k as IAssetManager, ak as VtxoManager, g as IDelegateManager, S as SendBitcoinParams, h as SettleParams, R as Recipient, al as SignerSession, am as SignedIntent, an as Intent, j as SendParams, ao as TimeHeight } from './index-uUE_uQPn.js';
1
+ import { s as RelativeTimelock, M as Network, P as CSVMultisigTapscript, Q as BatchStartedEvent, U as TreeSigningStartedEvent, X as TxTree, Y as TreeNoncesEvent, Z as BatchFinalizationEvent, _ as BatchFinalizedEvent, $ as BatchFailedEvent, a0 as TreeTxEvent, a1 as TreeSignatureEvent, k as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a2 as DescriptorProvider, f as IContractManager, a3 as IReadonlyWallet, a4 as ReadonlyIdentity, a5 as OnchainProvider, r as IndexerProvider, a6 as DelegateProvider, a7 as ReadonlyWalletConfig, B as IntentRepository, H as VirtualTxRepository, a8 as ExitCaptureMode, a9 as ExitDataSource, d as ActivityRegistry, aa as IReadonlyAssetManager, ab as ContractSyncState, ac as RecipientAddressContext, q as ArkProvider, ad as NetworkName, ae as ArkInfo, af as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ag as ContractWithVtxos, ah as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, ai as Coin, w as ExtendedVirtualCoin, aj as ContractManager, ak as ContractManagerConfig, I as IWallet, a as Identity, g as GetNewAddressesOptions, h as NewAddress, al as SettlementConfig, m as IAssetManager, am as VtxoManager, i as IDelegateManager, S as SendBitcoinParams, j as SettleParams, R as Recipient, an as SignerSession, ao as SignedIntent, ap as Intent, l as SendParams, aq as TimeHeight } from './index-DU5o_hz7.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-T-vgxMYZ.js';
6
-
7
- /**
8
- * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
9
- * other plugins — can bind the artifacts they create to the wallet's current
10
- * HD index and later enumerate every index that has been used.
11
- *
12
- * Probed structurally ({@link isHDWalletCapable}) rather than widening
13
- * `IWallet`: plugins must keep working against wallets that predate it, and a
14
- * static wallet answers "no HD state" through the same three methods.
15
- */
16
- interface HDWalletCapable {
17
- /**
18
- * The descriptor at the wallet's current receive index, or `undefined` for
19
- * static / `auto` wallets and HD wallets that have never rotated. Callers
20
- * fall back to the identity key.
21
- */
22
- getCurrentSigningDescriptor(): Promise<string | undefined>;
23
- /**
24
- * Every descriptor the wallet may hold keys under, ascending by index:
25
- * the allocation watermark's band plus any descriptor persisted on a
26
- * contract. Empty for static wallets.
27
- *
28
- * `lookAhead` appends that many descriptors past the watermark without
29
- * advancing it, for a restore that must probe indices no local state
30
- * mentions yet.
31
- */
32
- getUsedSigningDescriptors(opts?: {
33
- lookAhead?: number;
34
- }): Promise<string[]>;
35
- /**
36
- * An {@link Identity} whose keys and signatures are those of `descriptor`.
37
- * Returns the wallet identity itself when `descriptor` is the identity's
38
- * own key (a static wallet's descriptor, or an HD wallet's baseline key).
39
- *
40
- * Throws {@link ForeignDescriptorError} for a descriptor this wallet
41
- * cannot sign for. Never silently substitutes another key: an identity
42
- * handed out for a foreign descriptor signs happily with the wrong key,
43
- * and that surfaces only as a rejected transaction or a dead script —
44
- * far from the call that caused it.
45
- *
46
- * The returned identity must actually sign — `sign`, `signMessage` and
47
- * `signerSession`, not just `xOnlyPublicKey`. A watch-only identity
48
- * carrying the right key is not a signer, and `contractSigner` refuses it
49
- * as `WalletCannotSignError`: returning one here would otherwise pass
50
- * every check and throw at push time, after the contract is funded.
51
- */
52
- signerForDescriptor(descriptor: string): Promise<Identity>;
53
- }
54
- /**
55
- * Thrown by {@link HDWalletCapable.signerForDescriptor} when the wallet holds
56
- * no key for the requested descriptor — it belongs to another seed, or to an
57
- * identity this wallet does not carry. A typed refusal so callers can tell
58
- * "not my key" from transient signing failures.
59
- */
60
- declare class ForeignDescriptorError extends Error {
61
- readonly descriptor: string;
62
- readonly name = "ForeignDescriptorError";
63
- constructor(descriptor: string, options?: {
64
- cause?: unknown;
65
- });
66
- }
67
- /** Anything that can derive and sign for a descriptor it claims. */
68
- type DescriptorOwner = Pick<DescriptorProvider, "isOurs" | "signWithDescriptor" | "signMessageWithDescriptor">;
69
- /**
70
- * The identity that signs `descriptor`, or {@link ForeignDescriptorError}.
71
- *
72
- * Shared by every {@link HDWalletCapable.signerForDescriptor} implementation
73
- * so they cannot drift: the page-side and worker-side wallets answering
74
- * differently for one descriptor is a signer that passes a public-key check
75
- * and then throws on every signature — after the artifact is funded.
76
- */
77
- declare function resolveDescriptorSigner(descriptor: string, identity: Identity, provider?: DescriptorOwner): Promise<Identity>;
78
- /** Structural type guard for {@link HDWalletCapable}. */
79
- declare function isHDWalletCapable(value: unknown): value is HDWalletCapable;
80
- /**
81
- * Allocating a *fresh* index, which is strictly more than
82
- * {@link HDWalletCapable}'s descriptor awareness.
83
- *
84
- * Deliberately a separate probe rather than three more methods on
85
- * `HDWalletCapable`: widening that guard would silently demote every wallet
86
- * implementing only its original surface — including one built by an older
87
- * SDK — from HD-capable to static, which is exactly the breakage it documents
88
- * itself as avoiding. Consumers that only read descriptors keep the narrow
89
- * probe; anything deriving per-artifact secrets asks for this one.
90
- */
91
- interface HDAllocationCapable {
92
- /**
93
- * The signing descriptor a new artifact (a swap, an invoice, a contract)
94
- * should bind to. **The wallet decides what that means**: an HD wallet
95
- * allocates a fresh index, advancing the watermark; a static wallet
96
- * answers with its one `tr(pubkey)` descriptor every time. Consumers must
97
- * not probe the wallet's shape or mint key material of their own — they
98
- * ask, and use what comes back with
99
- * {@link HDWalletCapable.signerForDescriptor}.
100
- *
101
- * `undefined` only for implementations that genuinely cannot answer;
102
- * `Wallet` always answers. Callers that must work against such wallets
103
- * fall back to the identity key — never to a random one.
104
- *
105
- * Distinct from {@link HDWalletCapable.getCurrentSigningDescriptor}, which
106
- * peeks: on an HD wallet, two artifacts bound to a peek share a key.
107
- * Whether the returned descriptor is unique per call is a property of the
108
- * wallet, not of this method — anything deriving per-artifact secrets
109
- * from the descriptor must check the descriptor's shape, not the wallet's.
110
- */
111
- getNextSigningDescriptor(): Promise<string | undefined>;
112
- /**
113
- * Move the allocation watermark to `descriptor`'s index so later
114
- * allocations cannot reissue it. Monotonic — a lower index is a no-op.
115
- * On a static wallet there is no watermark: the wallet's own descriptor
116
- * is accepted as a no-op.
117
- *
118
- * Throws on a descriptor this wallet cannot derive, or an HD descriptor
119
- * with no parseable trailing child index: silently mapping those to index
120
- * 0 would move the watermark nowhere and let a restored artifact's index
121
- * be handed out again.
122
- */
123
- advanceSigningDescriptorWatermark(descriptor: string): Promise<void>;
124
- }
125
- /** Structural type guard for {@link HDAllocationCapable}. */
126
- declare function isHDAllocationCapable(value: unknown): value is HDAllocationCapable;
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Bz2e2zXY.cjs';
127
6
 
128
7
  /** Wall-clock floor for `batchExpiry` outside regtest. */
129
8
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -779,10 +658,12 @@ interface BoardingUtxoGroup {
779
658
  * - `subdust` — below dust, so it sits at an OP_RETURN script with no spendable
780
659
  * leaf. Unspendable as cash; `createCash` prevents minting these.
781
660
  * - `already-spent` — someone else claimed it first.
661
+ * - `exited` — unilaterally exited onchain, so the offchain sweep cannot reach it;
662
+ * `Unroll.completeUnroll` is the remedy.
782
663
  * - `has-assets` — asset-bearing; the BTC-only sweep would burn the assets.
783
664
  * - `sweep-failed` — spendable, but its own sweep was rejected.
784
665
  */
785
- type ArkadeCashUnclaimedReason = "swept" | "subdust" | "already-spent" | "has-assets" | "sweep-failed";
666
+ type ArkadeCashUnclaimedReason = "swept" | "subdust" | "already-spent" | "exited" | "has-assets" | "sweep-failed";
786
667
  /** A VTXO {@link Wallet.claimCash} left behind, with the reason why. */
787
668
  interface ArkadeCashUnclaimedVtxo {
788
669
  txid: string;
@@ -1342,7 +1223,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
1342
1223
  * });
1343
1224
  * ```
1344
1225
  */
1345
- declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable {
1226
+ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable, AddressAllocationCapable {
1346
1227
  readonly arkProvider: ArkProvider;
1347
1228
  readonly forfeitOutputScript: Bytes;
1348
1229
  readonly forfeitPubkey: Bytes;
@@ -1388,6 +1269,25 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1388
1269
  * are logged, never thrown back into the provider's emit loop.
1389
1270
  */
1390
1271
  private handleServerInfoChanged;
1272
+ /**
1273
+ * Await an `onServerInfoChanged` handler still applying a rotation.
1274
+ *
1275
+ * The provider emits synchronously but {@link handleServerInfoChanged} runs
1276
+ * off the emit, so between the two a caller can observe a half-applied
1277
+ * rotation: {@link rotateServerSigner} persists the active signer's contract
1278
+ * rows *before* committing the tapscripts, so `arkServerPublicKey` still
1279
+ * reads the old key while the new key's rows are already in the repository.
1280
+ * A path that refreshes server info and then reads signer-derived state must
1281
+ * drain the chain first, or it both reads that torn state and races the
1282
+ * handler for the rotation itself.
1283
+ *
1284
+ * Resolves once the chain is idle; a handler that threw already logged, and
1285
+ * its rejection is swallowed here.
1286
+ *
1287
+ * @internal Invoked by {@link dispose} and the {@link VtxoManager} migration
1288
+ * pass; not part of the stable public API.
1289
+ */
1290
+ settleServerInfoChanges(): Promise<void>;
1391
1291
  private _receiveRotatorInstalled;
1392
1292
  /**
1393
1293
  * Descriptor-aware signer used by {@link _signerRouter} to sign
@@ -1492,8 +1392,130 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1492
1392
  * provider and keeps a single index-0 boarding address for its lifetime,
1493
1393
  * so this returns the existing {@link getBoardingAddress} unchanged
1494
1394
  * (no rotation, no index burned).
1395
+ *
1396
+ * **Behaviour change.** A wallet configured with a custom
1397
+ * {@link DescriptorProvider} (`walletMode: <provider>`) now rotates here.
1398
+ * It previously did not: allocation went through the contract manager,
1399
+ * which only wires an `allocate` hook for {@link HDDescriptorProvider}, so
1400
+ * such a wallet read as "declined to allocate" and silently kept its
1401
+ * index-0 boarding address forever. Those wallets now burn an index per
1402
+ * call — including via {@link maybeRotateBoardingAfterBoard}, which fires
1403
+ * on every settle that consumes a boarding UTXO. Funds at retired
1404
+ * addresses stay reachable: each rotation persists its `boarding` contract
1405
+ * before swapping, and {@link getBoardingUtxos} fans out over the full
1406
+ * historical set.
1407
+ *
1408
+ * @deprecated Use {@link getNewAddresses} — it mints any combination of
1409
+ * address types at one shared index, and reports the contract row behind
1410
+ * each. Note the difference in display behaviour: this method *swaps* the
1411
+ * advertised boarding address, where `getNewAddresses` mints side
1412
+ * addresses and leaves {@link getBoardingAddress} alone. To keep this
1413
+ * method's behaviour, keep calling this method.
1495
1414
  */
1496
1415
  getNewBoardingAddress(): Promise<string>;
1416
+ /**
1417
+ * Allocate a *fresh* address of each requested type, all derived from one
1418
+ * newly allocated HD index.
1419
+ *
1420
+ * This is the explicit allocator the receive path otherwise lacks:
1421
+ * {@link getAddress} and {@link getBoardingAddress} are stable reads of the
1422
+ * wallet's display addresses, and the display receive address only advances
1423
+ * when a payment arrives ({@link WalletReceiveRotator} rotates on
1424
+ * `vtxo_received`). Issuing a second address before the first is paid — one
1425
+ * invoice for Alice, another for Bob — has to go through here.
1426
+ *
1427
+ * Each call:
1428
+ *
1429
+ * - allocates **one** index from the shared HD stream, however many types
1430
+ * were asked for, so a `default` + `boarding` pair are siblings rather
1431
+ * than two burnt indices;
1432
+ * - builds each requested script at that index, preserving every other
1433
+ * option of the wallet's current script for that flavour (including a
1434
+ * delegate wallet's `delegate` shape);
1435
+ * - persists each as an `active` contract carrying its `signingDescriptor`,
1436
+ * so the ContractWatcher monitors it, the balance counts it, and
1437
+ * {@link signerForDescriptor} can recover the key;
1438
+ * - slides the look-ahead band, since the watermark moved past indices an
1439
+ * external issuer may still be handing out.
1440
+ *
1441
+ * The minted rows are deliberately left **untagged**: the boot lookups
1442
+ * adopt the newest {@link WALLET_RECEIVE_SOURCE}-tagged row as the display
1443
+ * address, and a side address issued to one counterparty must not become
1444
+ * the address the wallet advertises to everyone else. {@link getAddress}
1445
+ * and {@link getBoardingAddress} are unchanged by this call.
1446
+ *
1447
+ * A wallet with no HD stream (`walletMode: 'static'` / `'auto'`) has one
1448
+ * address per flavour for its lifetime. Without `forceNew` it returns those
1449
+ * — the real persisted rows, no index burned; with `forceNew` it throws
1450
+ * {@link WalletCannotAllocateAddressError} rather than hand back an address
1451
+ * that is not in fact fresh.
1452
+ *
1453
+ * @example
1454
+ * ```typescript
1455
+ * const [invoice] = await wallet.getNewAddresses({ forceNew: true });
1456
+ * // hand `invoice.address` to Alice, keep the descriptor with the invoice
1457
+ * const signer = await wallet.signerForDescriptor(invoice.signingDescriptor);
1458
+ * ```
1459
+ */
1460
+ getNewAddresses(opts?: GetNewAddressesOptions): Promise<NewAddress[]>;
1461
+ /**
1462
+ * Shared allocation core behind {@link getNewAddresses} and the deprecated
1463
+ * {@link getNewBoardingAddress}, so the two cannot drift on what an
1464
+ * allocation costs or what gets persisted.
1465
+ *
1466
+ * @param tagSource - Tag the persisted rows {@link WALLET_RECEIVE_SOURCE},
1467
+ * making the next boot adopt them as the display address. Only the
1468
+ * deprecated boarding allocator passes `true`; `getNewAddresses` mints side
1469
+ * addresses and must not hijack what the wallet advertises.
1470
+ */
1471
+ private allocateAddresses;
1472
+ /**
1473
+ * The wallet's existing display addresses, as persisted contract rows —
1474
+ * the honest answer for a wallet with no index to burn.
1475
+ *
1476
+ * Each type is minted from the descriptor that already owns its display
1477
+ * script ({@link displayDescriptor}), not from the identity key, so the
1478
+ * returned `signingDescriptor` is the one that signs for the returned
1479
+ * `address` even on a wallet that has rotated.
1480
+ */
1481
+ private currentAddresses;
1482
+ /**
1483
+ * The descriptor that owns the wallet's current display script for `type`,
1484
+ * read off the row the wallet persisted when it adopted that script.
1485
+ *
1486
+ * Deriving it from the identity instead is only correct for a wallet that
1487
+ * never rotates. On one that has — an HD wallet whose provider later
1488
+ * declines to allocate — the display script belongs to an HD child, and
1489
+ * pairing its address with the identity descriptor hands the caller a
1490
+ * {@link NewAddress} whose `signingDescriptor` resolves, via
1491
+ * {@link signerForDescriptor}, to a signer holding the wrong key.
1492
+ *
1493
+ * Falls back to the identity's pathless `tr(pubkey)` when no row carries a
1494
+ * descriptor: the static / `auto` case, where the identity key genuinely
1495
+ * owns the display script and this is what `getNextSigningDescriptor`
1496
+ * answers too. (The index-0 baselines registered at construction carry no
1497
+ * `signingDescriptor` metadata, so those wallets take this path.)
1498
+ */
1499
+ private displayDescriptor;
1500
+ /**
1501
+ * Build, persist and shape one address of `type` owned by `descriptor` —
1502
+ * the single build-and-register path behind both {@link allocateAddresses}
1503
+ * and {@link currentAddresses}, so a freshly allocated address and a
1504
+ * re-registered display address cannot disagree on what gets written.
1505
+ *
1506
+ * The descriptor is the sole source of the script's owner key in both
1507
+ * branches. Deriving one flavour from the descriptor and the other from a
1508
+ * tapscript field is what lets `address` and `signingDescriptor` drift
1509
+ * apart.
1510
+ */
1511
+ private mintAddress;
1512
+ /**
1513
+ * Build the boarding contract owned by `pubKey`, keeping every other option
1514
+ * of the wallet's current boarding tapscript (notably the boarding-exit
1515
+ * CSV, which is index-independent). The offchain analogue lives in
1516
+ * {@link buildReceiveContract}.
1517
+ */
1518
+ private buildBoardingContract;
1497
1519
  /**
1498
1520
  * @see HDWalletCapable.getCurrentSigningDescriptor
1499
1521
  */
@@ -1701,7 +1723,10 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1701
1723
  * `typeof` guard skips the arknote strings settle also accepts.
1702
1724
  *
1703
1725
  * No-ops for static / `auto` wallets (no descriptor provider — boarding
1704
- * stays on its fixed index-0 address). Best-effort and non-fatal: the
1726
+ * stays on its fixed index-0 address). Wallets on a custom
1727
+ * {@link DescriptorProvider} DO rotate here now, where they previously
1728
+ * no-opped — see the behaviour-change note on {@link
1729
+ * getNewBoardingAddress}. Best-effort and non-fatal: the
1705
1730
  * settle has already committed and its txid must be returned, so a
1706
1731
  * rotation failure is logged and swallowed rather than thrown. Funds at
1707
1732
  * the retired boarding address remain discoverable — the old `boarding`
@@ -1919,4 +1944,170 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1919
1944
  */
1920
1945
  declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
1921
1946
 
1922
- export { ArkError as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, maybeArkError as E, ForeignDescriptorError as F, resolveBatchExpiryPolicy as G, type HDWalletCapable as H, type IncomingFunds as I, resolveCheckpointExitDelayPolicy as J, resolveDescriptorSigner as K, selectVirtualCoins as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, signingDescriptorIndex as N, strictSigningDescriptorIndex as O, type ProviderConnectionState as P, waitForIncomingFunds as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, Wallet as W, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, ArkErrorName as f, type ArkadeCashClaimResult as g, ArkadeCashCreateError as h, type ArkadeCashUnclaimedReason as i, type ArkadeCashUnclaimedVtxo as j, type BoardingUtxoGroup as k, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as l, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as m, type ProviderKind as n, ProviderUnavailableError as o, REGTEST_MIN_BATCH_EXPIRY_SECONDS as p, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as q, type ServerInfoSource as r, ServerResponseMismatchError as s, assertValidBatchExpiry as t, assertValidServerUnrollScript as u, defaultBatchExpiryPolicy as v, defaultCheckpointExitDelayPolicy as w, isArkError as x, isHDAllocationCapable as y, isHDWalletCapable as z };
1947
+ /**
1948
+ * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
1949
+ * other plugins — can bind the artifacts they create to the wallet's current
1950
+ * HD index and later enumerate every index that has been used.
1951
+ *
1952
+ * Probed structurally ({@link isHDWalletCapable}) rather than widening
1953
+ * `IWallet`: plugins must keep working against wallets that predate it, and a
1954
+ * static wallet answers "no HD state" through the same three methods.
1955
+ */
1956
+ interface HDWalletCapable {
1957
+ /**
1958
+ * The descriptor at the wallet's current receive index, or `undefined` for
1959
+ * static / `auto` wallets and HD wallets that have never rotated. Callers
1960
+ * fall back to the identity key.
1961
+ */
1962
+ getCurrentSigningDescriptor(): Promise<string | undefined>;
1963
+ /**
1964
+ * Every descriptor the wallet may hold keys under, ascending by index:
1965
+ * the allocation watermark's band plus any descriptor persisted on a
1966
+ * contract. Empty for static wallets.
1967
+ *
1968
+ * `lookAhead` appends that many descriptors past the watermark without
1969
+ * advancing it, for a restore that must probe indices no local state
1970
+ * mentions yet.
1971
+ */
1972
+ getUsedSigningDescriptors(opts?: {
1973
+ lookAhead?: number;
1974
+ }): Promise<string[]>;
1975
+ /**
1976
+ * An {@link Identity} whose keys and signatures are those of `descriptor`.
1977
+ * Returns the wallet identity itself when `descriptor` is the identity's
1978
+ * own key (a static wallet's descriptor, or an HD wallet's baseline key).
1979
+ *
1980
+ * Throws {@link ForeignDescriptorError} for a descriptor this wallet
1981
+ * cannot sign for. Never silently substitutes another key: an identity
1982
+ * handed out for a foreign descriptor signs happily with the wrong key,
1983
+ * and that surfaces only as a rejected transaction or a dead script —
1984
+ * far from the call that caused it.
1985
+ *
1986
+ * The returned identity must actually sign — `sign`, `signMessage` and
1987
+ * `signerSession`, not just `xOnlyPublicKey`. A watch-only identity
1988
+ * carrying the right key is not a signer, and `contractSigner` refuses it
1989
+ * as `WalletCannotSignError`: returning one here would otherwise pass
1990
+ * every check and throw at push time, after the contract is funded.
1991
+ */
1992
+ signerForDescriptor(descriptor: string): Promise<Identity>;
1993
+ }
1994
+ /**
1995
+ * Thrown by {@link HDWalletCapable.signerForDescriptor} when the wallet holds
1996
+ * no key for the requested descriptor — it belongs to another seed, or to an
1997
+ * identity this wallet does not carry. A typed refusal so callers can tell
1998
+ * "not my key" from transient signing failures.
1999
+ */
2000
+ declare class ForeignDescriptorError extends Error {
2001
+ readonly descriptor: string;
2002
+ readonly name = "ForeignDescriptorError";
2003
+ constructor(descriptor: string, options?: {
2004
+ cause?: unknown;
2005
+ });
2006
+ }
2007
+ /**
2008
+ * Thrown by `Wallet.getNewAddresses({ forceNew: true })` when the wallet has
2009
+ * no HD stream to advance — `walletMode: 'static'` / `'auto'`, or a
2010
+ * {@link DescriptorProvider} that declined to allocate.
2011
+ *
2012
+ * A typed refusal rather than a silent repeat: a caller that asked for a
2013
+ * *fresh* address is issuing one per counterparty, and quietly returning the
2014
+ * address it already handed out surfaces only as two payers sharing a script.
2015
+ */
2016
+ declare class WalletCannotAllocateAddressError extends Error {
2017
+ readonly name = "WalletCannotAllocateAddressError";
2018
+ constructor(reason: string, options?: {
2019
+ cause?: unknown;
2020
+ });
2021
+ }
2022
+ /** Anything that can derive and sign for a descriptor it claims. */
2023
+ type DescriptorOwner = Pick<DescriptorProvider, "isOurs" | "signWithDescriptor" | "signMessageWithDescriptor">;
2024
+ /**
2025
+ * The identity that signs `descriptor`, or {@link ForeignDescriptorError}.
2026
+ *
2027
+ * Shared by every {@link HDWalletCapable.signerForDescriptor} implementation
2028
+ * so they cannot drift: the page-side and worker-side wallets answering
2029
+ * differently for one descriptor is a signer that passes a public-key check
2030
+ * and then throws on every signature — after the artifact is funded.
2031
+ */
2032
+ declare function resolveDescriptorSigner(descriptor: string, identity: Identity, provider?: DescriptorOwner): Promise<Identity>;
2033
+ /** Structural type guard for {@link HDWalletCapable}. */
2034
+ declare function isHDWalletCapable(value: unknown): value is HDWalletCapable;
2035
+ /**
2036
+ * Allocating a *fresh* index, which is strictly more than
2037
+ * {@link HDWalletCapable}'s descriptor awareness.
2038
+ *
2039
+ * Deliberately a separate probe rather than three more methods on
2040
+ * `HDWalletCapable`: widening that guard would silently demote every wallet
2041
+ * implementing only its original surface — including one built by an older
2042
+ * SDK — from HD-capable to static, which is exactly the breakage it documents
2043
+ * itself as avoiding. Consumers that only read descriptors keep the narrow
2044
+ * probe; anything deriving per-artifact secrets asks for this one.
2045
+ */
2046
+ interface HDAllocationCapable {
2047
+ /**
2048
+ * The signing descriptor a new artifact (a swap, an invoice, a contract)
2049
+ * should bind to. **The wallet decides what that means**: an HD wallet
2050
+ * allocates a fresh index, advancing the watermark; a static wallet
2051
+ * answers with its one `tr(pubkey)` descriptor every time. Consumers must
2052
+ * not probe the wallet's shape or mint key material of their own — they
2053
+ * ask, and use what comes back with
2054
+ * {@link HDWalletCapable.signerForDescriptor}.
2055
+ *
2056
+ * `undefined` only for implementations that genuinely cannot answer;
2057
+ * `Wallet` always answers. Callers that must work against such wallets
2058
+ * fall back to the identity key — never to a random one.
2059
+ *
2060
+ * Distinct from {@link HDWalletCapable.getCurrentSigningDescriptor}, which
2061
+ * peeks: on an HD wallet, two artifacts bound to a peek share a key.
2062
+ * Whether the returned descriptor is unique per call is a property of the
2063
+ * wallet, not of this method — anything deriving per-artifact secrets
2064
+ * from the descriptor must check the descriptor's shape, not the wallet's.
2065
+ */
2066
+ getNextSigningDescriptor(): Promise<string | undefined>;
2067
+ /**
2068
+ * Move the allocation watermark to `descriptor`'s index so later
2069
+ * allocations cannot reissue it. Monotonic — a lower index is a no-op.
2070
+ * On a static wallet there is no watermark: the wallet's own descriptor
2071
+ * is accepted as a no-op.
2072
+ *
2073
+ * Throws on a descriptor this wallet cannot derive, or an HD descriptor
2074
+ * with no parseable trailing child index: silently mapping those to index
2075
+ * 0 would move the watermark nowhere and let a restored artifact's index
2076
+ * be handed out again.
2077
+ */
2078
+ advanceSigningDescriptorWatermark(descriptor: string): Promise<void>;
2079
+ }
2080
+ /** Structural type guard for {@link HDAllocationCapable}. */
2081
+ declare function isHDAllocationCapable(value: unknown): value is HDAllocationCapable;
2082
+ /**
2083
+ * Minting addresses to hand out, which is strictly more than
2084
+ * {@link HDAllocationCapable}'s bare index allocation: the wallet also builds
2085
+ * the scripts at that index, persists them as watched contracts, and reports
2086
+ * the rows.
2087
+ *
2088
+ * A third probe rather than another method on `HDAllocationCapable`, for the
2089
+ * same reason that interface exists separately from {@link HDWalletCapable}:
2090
+ * widening an existing guard silently demotes every wallet implementing only
2091
+ * its older surface.
2092
+ */
2093
+ interface AddressAllocationCapable {
2094
+ /**
2095
+ * Fresh addresses of each requested type, all derived from one newly
2096
+ * allocated HD index, persisted and watched. **The wallet decides what
2097
+ * "fresh" means**: an HD wallet burns an index, a wallet with no stream
2098
+ * answers with its existing display addresses — or, under
2099
+ * `forceNew`, refuses with {@link WalletCannotAllocateAddressError}
2100
+ * rather than repeat an address it already handed out.
2101
+ *
2102
+ * Distinct from {@link HDAllocationCapable.getNextSigningDescriptor},
2103
+ * which yields only an index and leaves the caller to build and register
2104
+ * the script — two steps that must not be split across a process
2105
+ * boundary, since a page that allocated an index and then failed to
2106
+ * register the script holds a burnt index and an unwatched address.
2107
+ */
2108
+ getNewAddresses(opts?: GetNewAddressesOptions): Promise<NewAddress[]>;
2109
+ }
2110
+ /** Structural type guard for {@link AddressAllocationCapable}. */
2111
+ declare function isAddressAllocationCapable(value: unknown): value is AddressAllocationCapable;
2112
+
2113
+ export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, isArkError as E, ForeignDescriptorError as F, isHDAllocationCapable as G, type HDWalletCapable as H, type IncomingFunds as I, isHDWalletCapable as J, maybeArkError as K, resolveBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, resolveCheckpointExitDelayPolicy as N, resolveDescriptorSigner as O, type ProviderConnectionState as P, selectVirtualCoins as Q, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, signingDescriptorIndex as T, strictSigningDescriptorIndex as U, waitForIncomingFunds as V, Wallet as W, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, ArkError as f, ArkErrorName as g, type ArkadeCashClaimResult as h, ArkadeCashCreateError as i, type ArkadeCashUnclaimedReason as j, type ArkadeCashUnclaimedVtxo as k, type BoardingUtxoGroup as l, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as m, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as n, type ProviderKind as o, ProviderUnavailableError as p, REGTEST_MIN_BATCH_EXPIRY_SECONDS as q, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as r, type ServerInfoSource as s, ServerResponseMismatchError as t, WalletCannotAllocateAddressError as u, assertValidBatchExpiry as v, assertValidServerUnrollScript as w, defaultBatchExpiryPolicy as x, defaultCheckpointExitDelayPolicy as y, isAddressAllocationCapable as z };