@arkade-os/sdk 0.4.59 → 0.4.61

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 (88) hide show
  1. package/README.md +34 -6
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +4 -4
  4. package/dist/adapters/expo.d.ts +4 -4
  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-CYHXFfvn.d.cts → asyncStorageTaskQueue-BWDxp3Dr.d.cts} +2 -2
  9. package/dist/{asyncStorageTaskQueue-BwuWQ1Qc.d.ts → asyncStorageTaskQueue-Cq9FpKv6.d.ts} +2 -2
  10. package/dist/{chunk-V2KENVN6.cjs → chunk-2JHN5RCY.cjs} +22 -15
  11. package/dist/chunk-2JHN5RCY.cjs.map +1 -0
  12. package/dist/{chunk-DYNB6POO.cjs → chunk-3NUDA3MB.cjs} +4423 -2934
  13. package/dist/chunk-3NUDA3MB.cjs.map +1 -0
  14. package/dist/{chunk-PN5RD7ZI.js → chunk-6O5OLYTZ.js} +1685 -1138
  15. package/dist/chunk-6O5OLYTZ.js.map +1 -0
  16. package/dist/{chunk-OVSNY3HC.js → chunk-AUEXB42T.js} +3965 -2503
  17. package/dist/chunk-AUEXB42T.js.map +1 -0
  18. package/dist/{chunk-DSTYXT2D.cjs → chunk-FNCQJLR2.cjs} +44 -6
  19. package/dist/chunk-FNCQJLR2.cjs.map +1 -0
  20. package/dist/{chunk-VSHY5TBY.js → chunk-GDI2A65Z.js} +4 -4
  21. package/dist/{chunk-VSHY5TBY.js.map → chunk-GDI2A65Z.js.map} +1 -1
  22. package/dist/{chunk-FIMOVH25.js → chunk-PVY6DMN5.js} +40 -7
  23. package/dist/chunk-PVY6DMN5.js.map +1 -0
  24. package/dist/{chunk-2XO43UHI.cjs → chunk-SF5NKAUA.cjs} +1731 -1180
  25. package/dist/chunk-SF5NKAUA.cjs.map +1 -0
  26. package/dist/{chunk-7FA36NOA.cjs → chunk-XFYFREPH.cjs} +17 -17
  27. package/dist/{chunk-7FA36NOA.cjs.map → chunk-XFYFREPH.cjs.map} +1 -1
  28. package/dist/{chunk-H342JPPZ.js → chunk-XLHN5L2O.js} +5 -5
  29. package/dist/chunk-XLHN5L2O.js.map +1 -0
  30. package/dist/{chunk-IPFGYVF3.cjs → chunk-XMRB74HA.cjs} +10 -10
  31. package/dist/chunk-XMRB74HA.cjs.map +1 -0
  32. package/dist/{chunk-YEHGCHIL.js → chunk-YVQNHELA.js} +12 -5
  33. package/dist/chunk-YVQNHELA.js.map +1 -0
  34. package/dist/contracts/handlers/index.cjs +12 -8
  35. package/dist/contracts/handlers/index.d.cts +5 -5
  36. package/dist/contracts/handlers/index.d.ts +5 -5
  37. package/dist/contracts/handlers/index.js +2 -2
  38. package/dist/{delegate-D0eGaz3J.d.cts → delegate-BySzD37I.d.ts} +1 -1
  39. package/dist/{delegate-B_oKWm1k.d.ts → delegate-C4Rl6h9l.d.cts} +1 -1
  40. package/dist/{ark-C9DsPSm8.d.cts → index-BcRCHnzN.d.cts} +4887 -4331
  41. package/dist/{ark-C9DsPSm8.d.ts → index-BcRCHnzN.d.ts} +4887 -4331
  42. package/dist/{index-BmK6tEqf.d.ts → index-Butfkm-K.d.cts} +224 -68
  43. package/dist/{index-BG2AL2Ie.d.cts → index-C29VNcxC.d.ts} +224 -68
  44. package/dist/index.cjs +374 -230
  45. package/dist/index.d.cts +522 -82
  46. package/dist/index.d.ts +522 -82
  47. package/dist/index.js +4 -4
  48. package/dist/repositories/realm/index.cjs +43 -23
  49. package/dist/repositories/realm/index.cjs.map +1 -1
  50. package/dist/repositories/realm/index.d.cts +23 -11
  51. package/dist/repositories/realm/index.d.ts +23 -11
  52. package/dist/repositories/realm/index.js +29 -9
  53. package/dist/repositories/realm/index.js.map +1 -1
  54. package/dist/repositories/sqlite/index.cjs +48 -23
  55. package/dist/repositories/sqlite/index.cjs.map +1 -1
  56. package/dist/repositories/sqlite/index.d.cts +11 -5
  57. package/dist/repositories/sqlite/index.d.ts +11 -5
  58. package/dist/repositories/sqlite/index.js +35 -10
  59. package/dist/repositories/sqlite/index.js.map +1 -1
  60. package/dist/{taskRunner-Cy4Gh8n7.d.ts → taskRunner-BTq3rMpI.d.cts} +2 -2
  61. package/dist/{taskRunner-CBvKIttE.d.cts → taskRunner-DxMJYJ7Y.d.ts} +2 -2
  62. package/dist/wallet/expo/background.cjs +14 -14
  63. package/dist/wallet/expo/background.d.cts +5 -5
  64. package/dist/wallet/expo/background.d.ts +5 -5
  65. package/dist/wallet/expo/background.js +6 -6
  66. package/dist/wallet/expo/index.cjs +37 -14
  67. package/dist/wallet/expo/index.cjs.map +1 -1
  68. package/dist/wallet/expo/index.d.cts +13 -5
  69. package/dist/wallet/expo/index.d.ts +13 -5
  70. package/dist/wallet/expo/index.js +28 -5
  71. package/dist/wallet/expo/index.js.map +1 -1
  72. package/dist/{wallet-EyVDhqzP.d.ts → wallet-BVIfg2ic.d.ts} +222 -19
  73. package/dist/{wallet-DlXemAzP.d.cts → wallet-DrSsUden.d.cts} +222 -19
  74. package/dist/worker/expo/index.cjs +9 -9
  75. package/dist/worker/expo/index.d.cts +7 -7
  76. package/dist/worker/expo/index.d.ts +7 -7
  77. package/dist/worker/expo/index.js +5 -5
  78. package/package.json +4 -2
  79. package/dist/chunk-2XO43UHI.cjs.map +0 -1
  80. package/dist/chunk-DSTYXT2D.cjs.map +0 -1
  81. package/dist/chunk-DYNB6POO.cjs.map +0 -1
  82. package/dist/chunk-FIMOVH25.js.map +0 -1
  83. package/dist/chunk-H342JPPZ.js.map +0 -1
  84. package/dist/chunk-IPFGYVF3.cjs.map +0 -1
  85. package/dist/chunk-OVSNY3HC.js.map +0 -1
  86. package/dist/chunk-PN5RD7ZI.js.map +0 -1
  87. package/dist/chunk-V2KENVN6.cjs.map +0 -1
  88. package/dist/chunk-YEHGCHIL.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { a as Identity, p as RelativeTimelock, J as Network, K as CSVMultisigTapscript, L as SignerSet, M as BatchStartedEvent, P as TreeSigningStartedEvent, Q as TxTree, U as TreeNoncesEvent, X as BatchFinalizationEvent, Y as BatchFinalizedEvent, Z as BatchFailedEvent, _ as TreeTxEvent, $ as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a0 as DescriptorProvider, f as IContractManager, a1 as IReadonlyWallet, a2 as ReadonlyIdentity, a3 as OnchainProvider, o as IndexerProvider, a4 as DelegateProvider, a5 as ReadonlyWalletConfig, x as IntentRepository, B as VirtualTxRepository, a6 as ExitCaptureMode, a7 as ExitDataSource, d as ActivityRegistry, a8 as IReadonlyAssetManager, a9 as ContractSyncState, n as ArkProvider, aa as NetworkName, ab as ArkInfo, ac as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, A as ArkTransaction, e as Activity, E as ExtendedCoin, ad as Coin, t as ExtendedVirtualCoin, ae as ContractManager, af as ContractManagerConfig, I as IWallet, ag as SettlementConfig, j as IAssetManager, ah as VtxoManager, g as IDelegateManager, S as SendBitcoinParams, h as SettleParams, R as Recipient, ai as SignerSession, aj as SignedIntent, ak as Intent, al as TimeHeight } from './ark-C9DsPSm8.cjs';
1
+ import { a as Identity, J as DescriptorProvider, p as RelativeTimelock, K as Network, L as CSVMultisigTapscript, M as BatchStartedEvent, P as TreeSigningStartedEvent, Q as TxTree, U as TreeNoncesEvent, X as BatchFinalizationEvent, Y as BatchFinalizedEvent, Z as BatchFailedEvent, _ as TreeTxEvent, $ as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, f as IContractManager, a0 as IReadonlyWallet, a1 as ReadonlyIdentity, a2 as OnchainProvider, o as IndexerProvider, a3 as DelegateProvider, a4 as ReadonlyWalletConfig, x as IntentRepository, B as VirtualTxRepository, a5 as ExitCaptureMode, a6 as ExitDataSource, d as ActivityRegistry, a7 as IReadonlyAssetManager, a8 as ContractSyncState, a9 as RecipientAddressContext, n as ArkProvider, aa as NetworkName, ab as ArkInfo, ac as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, ad as ContractWithVtxos, ae as selectPendingRecoveryOutpoints, A as ArkTransaction, e as Activity, E as ExtendedCoin, af as Coin, t as ExtendedVirtualCoin, ag as ContractManager, ah as ContractManagerConfig, I as IWallet, ai as SettlementConfig, j as IAssetManager, aj as VtxoManager, g as IDelegateManager, S as SendBitcoinParams, h as SettleParams, R as Recipient, ak as SignerSession, al as SignedIntent, am as Intent, an as TimeHeight } from './index-BcRCHnzN.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-D0eGaz3J.cjs';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-C4Rl6h9l.cjs';
6
6
 
7
7
  /**
8
8
  * Capability a wallet exposes so descriptor-blind consumers — Boltz swaps and
@@ -24,17 +24,106 @@ interface HDWalletCapable {
24
24
  * Every descriptor the wallet may hold keys under, ascending by index:
25
25
  * the allocation watermark's band plus any descriptor persisted on a
26
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.
27
31
  */
28
- getUsedSigningDescriptors(): Promise<string[]>;
32
+ getUsedSigningDescriptors(opts?: {
33
+ lookAhead?: number;
34
+ }): Promise<string[]>;
29
35
  /**
30
36
  * An {@link Identity} whose keys and signatures are those of `descriptor`.
31
- * Returns the wallet identity itself when the wallet has no descriptor
32
- * signer.
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.
33
51
  */
34
52
  signerForDescriptor(descriptor: string): Promise<Identity>;
35
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>;
36
78
  /** Structural type guard for {@link HDWalletCapable}. */
37
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;
38
127
 
39
128
  /** Wall-clock floor for `batchExpiry` outside regtest. */
40
129
  declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
@@ -152,17 +241,6 @@ declare function resolveCheckpointExitDelayPolicy(network: Network, overrides?:
152
241
  */
153
242
  declare function assertValidServerUnrollScript(checkpointTapscript: string, policy: CheckpointExitDelayPolicy): CSVMultisigTapscript.Type;
154
243
 
155
- declare function getRandomId(): string;
156
- /**
157
- * What a recipient Arkade address must match. An address failing either check
158
- * belongs to another network or operator, so this wallet's operator cannot
159
- * create the VTXO where the recipient's wallet expects it.
160
- */
161
- type RecipientAddressContext = {
162
- hrp: string;
163
- signerSet: SignerSet;
164
- };
165
-
166
244
  declare class ArkError extends Error {
167
245
  readonly code: number;
168
246
  readonly message: string;
@@ -443,6 +521,21 @@ interface ReceiveRotatorBootResult {
443
521
  interface ReceiveRotatorFactory {
444
522
  createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
445
523
  }
524
+ /**
525
+ * Parse the trailing HD child index from a materialized signing
526
+ * descriptor (`tr(...xpub.../0/<index>)`). Returns 0 when the
527
+ * descriptor is absent or carries no parseable child index — restore
528
+ * registers the index-0 baseline untagged, so a missing descriptor
529
+ * legitimately maps to 0.
530
+ */
531
+ declare function signingDescriptorIndex(descriptor: unknown): number;
532
+ /**
533
+ * Strict sibling of {@link signingDescriptorIndex}: `undefined` instead of
534
+ * the 0 fallback, for callers that must tell "no parseable index" apart from
535
+ * index 0 — a watermark move mapped to 0 would move nothing while reporting
536
+ * success.
537
+ */
538
+ declare function strictSigningDescriptorIndex(descriptor: string): number | undefined;
446
539
  /**
447
540
  * Minimal logging surface the rotator needs. `console` satisfies it
448
541
  * out of the box; SDK consumers can pass a structured logger
@@ -638,6 +731,12 @@ declare class WalletReceiveRotator {
638
731
  private rotate;
639
732
  }
640
733
 
734
+ /**
735
+ * Maximum caller-requested HD descriptors materialized past the watermark by
736
+ * getUsedSigningDescriptors(). Bounds plugin/restore probes without changing
737
+ * the wallet's actual allocation watermark.
738
+ */
739
+ declare const MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD = 1000;
641
740
  type IncomingFunds = {
642
741
  type: "utxo";
643
742
  coins: Coin[];
@@ -647,6 +746,13 @@ type IncomingFunds = {
647
746
  spentVtxos: ExtendedVirtualCoin[];
648
747
  };
649
748
 
749
+ /**
750
+ * What signer classification needs of a snapshot: contract params and the coins
751
+ * under them. Structural rather than {@link ContractWithVtxos} so a repository-
752
+ * built snapshot — the worker's, whose VTXOs carry no `contractScript` — can be
753
+ * classified without allocating a parallel array to satisfy the nominal type.
754
+ */
755
+ type PendingRecoverySnapshot = Parameters<typeof selectPendingRecoveryOutpoints>[0];
650
756
  /**
651
757
  * Boarding UTXOs grouped by the boarding address they sit on, carrying that
652
758
  * address's signer association explicitly. Returned by
@@ -976,18 +1082,80 @@ declare class ReadonlyWallet implements IReadonlyWallet {
976
1082
  /**
977
1083
  * Return virtual outputs tracked by the wallet.
978
1084
  *
1085
+ * The raw reporting/recovery read: escrowed, locked and awaiting-recovery
1086
+ * funds are all present. Coin selection must use
1087
+ * {@link getSpendableVtxos} instead — feeding this straight into
1088
+ * `settle({ inputs })` or `sendBitcoin({ selectedVtxos })` bypasses the
1089
+ * generic-spending gate.
1090
+ *
979
1091
  * @param filter - Optional flags controlling whether recoverable or unrolled VTXOs are included
980
1092
  */
981
1093
  getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1094
+ /** @inheritdoc */
1095
+ getSpendableVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
1096
+ /**
1097
+ * Debug-log any explicit input generic selection would have excluded, for
1098
+ * each of the three reasons it excludes on. Explicit-input APIs stay ungated
1099
+ * on purpose (naming an outpoint *is* the intent the gate protects, and it
1100
+ * is how an escrowed deposit is recovered once generic selection stops
1101
+ * covering it), so this only makes the crossing visible — notably
1102
+ * `settle({ inputs: await wallet.getVtxos() })`, which launders the raw read
1103
+ * into a spend. Never throws into a spend path.
1104
+ *
1105
+ * Public so the worker handler and plugins can report their own
1106
+ * explicit-input crossings through the same three checks.
1107
+ */
1108
+ logUngatedInputs(source: string, inputs: readonly {
1109
+ txid: string;
1110
+ vout: number;
1111
+ script?: string;
1112
+ }[]): Promise<void>;
1113
+ /**
1114
+ * Contracts whose operator signer is past its rotation cutoff, as an
1115
+ * exclusion over scripts. The outpoint-level `pendingRecovery` set needs a
1116
+ * synced VTXO snapshot to also drop already-swept coins; this answers the
1117
+ * same question about a caller-supplied input without one, and a swept
1118
+ * outpoint is unspendable regardless.
1119
+ */
1120
+ private expiredSignerExclusion;
1121
+ /** The intent store's lock set. Fails open, like every other read of it. */
1122
+ private lockedOutpoints;
1123
+ /**
1124
+ * One contract+VTXO read. `getContractsWithVtxos` opportunistically syncs
1125
+ * against the indexer, so every caller that needs more than one view of the
1126
+ * wallet's coins takes a single snapshot and derives them all from it —
1127
+ * otherwise the gate and the pending-recovery set answer about two different
1128
+ * points in time, and each read costs another sync.
1129
+ */
1130
+ protected contractSnapshot(): Promise<ContractWithVtxos[]>;
1131
+ /**
1132
+ * The two exclusion sets the gate is made of, derived from one snapshot so
1133
+ * {@link getSpendableVtxos} and the balance answer about the same instant.
1134
+ */
1135
+ private spendabilityView;
1136
+ /** The capability probes {@link computeOffchainBalance} needs, over one snapshot. */
1137
+ private balanceCapabilities;
982
1138
  /**
983
1139
  * Outpoints of VTXOs whose deprecated signer is past its cutoff (EXPIRED) and
984
1140
  * which have not yet been swept — unspendable until they recover. Offline:
985
1141
  * classifies the repo's contracts against the cached signer set (active +
986
1142
  * {@link _deprecatedSigners}, cutoffs included). Empty fast-path when no
987
1143
  * signer is deprecated. Consumed by {@link getBalance} (the `pendingRecovery`
988
- * bucket) and the send coin-selection path so neither counts nor spends them.
1144
+ * bucket) and by {@link getSpendableVtxos} so neither counts nor spends them.
1145
+ *
1146
+ * Takes a fresh {@link contractSnapshot}, which syncs against the indexer.
1147
+ * Callers that already hold a snapshot — or that must not sync at all, like
1148
+ * the worker's balance read — pass it to
1149
+ * {@link pendingRecoveryOutpointsIn} instead.
989
1150
  */
990
1151
  pendingRecoveryOutpoints(): Promise<Set<string>>;
1152
+ /**
1153
+ * {@link pendingRecoveryOutpoints} over a snapshot the caller already has:
1154
+ * pure classification against the cached signer set, no repository or
1155
+ * network read of its own.
1156
+ */
1157
+ pendingRecoveryOutpointsIn(snapshot: PendingRecoverySnapshot): Set<string>;
1158
+ private selectPendingRecovery;
991
1159
  /**
992
1160
  * Return wallet transaction history derived from Arkade state and boarding transactions.
993
1161
  */
@@ -1330,6 +1498,22 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1330
1498
  * @see HDWalletCapable.getCurrentSigningDescriptor
1331
1499
  */
1332
1500
  getCurrentSigningDescriptor(): Promise<string | undefined>;
1501
+ /**
1502
+ * @see HDAllocationCapable.getNextSigningDescriptor
1503
+ *
1504
+ * Every `Wallet` answers — this is where the wallet's key-provisioning
1505
+ * policy lives, so consumers never have to branch on wallet shape:
1506
+ * - HD: allocate a fresh index through the contract manager (which owns
1507
+ * cross-context serialization and the look-ahead band).
1508
+ * - custom provider: whatever the provider allocates.
1509
+ * - static / `auto`: the identity key as a bare `tr(pubkey)` descriptor —
1510
+ * the same answer every call, because that IS the static policy.
1511
+ */
1512
+ getNextSigningDescriptor(): Promise<string | undefined>;
1513
+ /**
1514
+ * @see HDAllocationCapable.advanceSigningDescriptorWatermark
1515
+ */
1516
+ advanceSigningDescriptorWatermark(descriptor: string): Promise<void>;
1333
1517
  /**
1334
1518
  * @see HDWalletCapable.getUsedSigningDescriptors
1335
1519
  *
@@ -1338,9 +1522,18 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1338
1522
  * alone would miss indices allocated for something the wallet never
1339
1523
  * persisted (a swap, an externally issued invoice).
1340
1524
  */
1341
- getUsedSigningDescriptors(): Promise<string[]>;
1525
+ getUsedSigningDescriptors(opts?: {
1526
+ lookAhead?: number;
1527
+ }): Promise<string[]>;
1342
1528
  /**
1343
1529
  * @see HDWalletCapable.signerForDescriptor
1530
+ *
1531
+ * Fail-loud contract: the returned identity is always the descriptor's
1532
+ * own key. A descriptor this wallet cannot sign for throws
1533
+ * {@link ForeignDescriptorError} instead of silently substituting the
1534
+ * baseline identity — that identity would sign happily with the wrong
1535
+ * key, and the failure would only surface as a rejected transaction or a
1536
+ * dead script, far from the call that caused it.
1344
1537
  */
1345
1538
  signerForDescriptor(descriptor: string): Promise<Identity>;
1346
1539
  /**
@@ -1479,6 +1672,13 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1479
1672
  /**
1480
1673
  * Settle boarding inputs and/or virtual outputs into a finalized mainnet transaction.
1481
1674
  *
1675
+ * `params.inputs` is **ungated**: whatever the caller names is settled,
1676
+ * including VTXOs generic selection would skip. That is what makes an
1677
+ * escrowed or otherwise gated deposit recoverable by hand — but it also
1678
+ * means `settle({ inputs: await wallet.getVtxos() })` silently bypasses the
1679
+ * gate. Pass {@link getSpendableVtxos} instead when the intent is "settle
1680
+ * whatever is spendable".
1681
+ *
1482
1682
  * @param params - Optional settlement inputs and outputs. When omitted, the wallet settles all eligible funds.
1483
1683
  * @param eventCallback - Optional callback invoked for settlement stream events.
1484
1684
  * @returns The finalized Arkade transaction id
@@ -1681,6 +1881,9 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable
1681
1881
  /**
1682
1882
  * Build an offchain transaction from the given inputs and outputs,
1683
1883
  * sign it, submit to the Arkade provider, and finalize.
1884
+ *
1885
+ * Signs whatever it is handed, ungated — see {@link settle} for the trade.
1886
+ *
1684
1887
  * @returns The Arkade transaction id and server-signed checkpoint PSBTs (for bookkeeping)
1685
1888
  */
1686
1889
  buildAndSubmitOffchainTx(inputs: ExtendedVirtualCoin[], outputs: TransactionOutput[], serverUnrollScript?: CSVMultisigTapscript.Type): Promise<{
@@ -1707,4 +1910,4 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1707
1910
  */
1708
1911
  declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
1709
1912
 
1710
- export { ArkError as A, type BatchExpiryPolicy as B, type CheckpointExitDelayPolicy as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, resolveCheckpointExitDelayPolicy as E, selectVirtualCoins as F, waitForIncomingFunds as G, type HDWalletCapable as H, type IncomingFunds as I, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as M, type ProviderConnectionState as P, ReadonlyWallet as R, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as S, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, Batch as d, ArkErrorName as e, type ArkadeCashClaimResult as f, ArkadeCashCreateError as g, type ArkadeCashUnclaimedReason as h, type ArkadeCashUnclaimedVtxo as i, type BoardingUtxoGroup as j, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as k, type ProviderKind as l, ProviderUnavailableError as m, REGTEST_MIN_BATCH_EXPIRY_SECONDS as n, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS as o, type ServerInfoSource as p, ServerResponseMismatchError as q, assertValidBatchExpiry as r, assertValidServerUnrollScript as s, defaultBatchExpiryPolicy as t, defaultCheckpointExitDelayPolicy as u, getRandomId as v, isArkError as w, isHDWalletCapable as x, maybeArkError as y, resolveBatchExpiryPolicy as z };
1913
+ 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 };
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkIPFGYVF3_cjs = require('../../chunk-IPFGYVF3.cjs');
4
- require('../../chunk-DYNB6POO.cjs');
5
- require('../../chunk-V2KENVN6.cjs');
6
- require('../../chunk-2XO43UHI.cjs');
7
- require('../../chunk-DSTYXT2D.cjs');
3
+ var chunkXMRB74HA_cjs = require('../../chunk-XMRB74HA.cjs');
4
+ require('../../chunk-3NUDA3MB.cjs');
5
+ require('../../chunk-2JHN5RCY.cjs');
6
+ require('../../chunk-SF5NKAUA.cjs');
7
+ require('../../chunk-FNCQJLR2.cjs');
8
8
  require('../../chunk-5BLDMQED.cjs');
9
9
 
10
10
  // src/worker/expo/taskQueue.ts
@@ -121,19 +121,19 @@ var AsyncStorageTaskQueue = class {
121
121
 
122
122
  Object.defineProperty(exports, "CONTRACT_POLL_TASK_TYPE", {
123
123
  enumerable: true,
124
- get: function () { return chunkIPFGYVF3_cjs.CONTRACT_POLL_TASK_TYPE; }
124
+ get: function () { return chunkXMRB74HA_cjs.CONTRACT_POLL_TASK_TYPE; }
125
125
  });
126
126
  Object.defineProperty(exports, "contractPollProcessor", {
127
127
  enumerable: true,
128
- get: function () { return chunkIPFGYVF3_cjs.contractPollProcessor; }
128
+ get: function () { return chunkXMRB74HA_cjs.contractPollProcessor; }
129
129
  });
130
130
  Object.defineProperty(exports, "createTaskDependencies", {
131
131
  enumerable: true,
132
- get: function () { return chunkIPFGYVF3_cjs.createTaskDependencies; }
132
+ get: function () { return chunkXMRB74HA_cjs.createTaskDependencies; }
133
133
  });
134
134
  Object.defineProperty(exports, "runTasks", {
135
135
  enumerable: true,
136
- get: function () { return chunkIPFGYVF3_cjs.runTasks; }
136
+ get: function () { return chunkXMRB74HA_cjs.runTasks; }
137
137
  });
138
138
  exports.AsyncStorageTaskQueue = AsyncStorageTaskQueue;
139
139
  exports.InMemoryTaskQueue = InMemoryTaskQueue;
@@ -1,11 +1,11 @@
1
- import { T as TaskProcessor } from '../../taskRunner-CBvKIttE.cjs';
2
- export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, a as TaskDependencies, b as TaskItem, c as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-CBvKIttE.cjs';
3
- export { A as AsyncStorageLike, a as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-CYHXFfvn.cjs';
4
- import '../../ark-C9DsPSm8.cjs';
5
- import '@scure/btc-signer/transaction.js';
1
+ import { T as TaskProcessor } from '../../taskRunner-BTq3rMpI.cjs';
2
+ export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, b as TaskDependencies, c as TaskItem, a as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-BTq3rMpI.cjs';
3
+ export { a as AsyncStorageLike, A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-BWDxp3Dr.cjs';
4
+ import '../../index-BcRCHnzN.cjs';
6
5
  import '@scure/btc-signer/utils.js';
7
- import '@scure/btc-signer/psbt.js';
6
+ import '@scure/btc-signer/transaction.js';
8
7
  import '@scure/btc-signer';
8
+ import '@scure/btc-signer/psbt.js';
9
9
 
10
10
  declare const CONTRACT_POLL_TASK_TYPE = "contract-poll";
11
11
  /**
@@ -13,7 +13,7 @@ declare const CONTRACT_POLL_TASK_TYPE = "contract-poll";
13
13
  * persists the results to the wallet repository.
14
14
  *
15
15
  * Replicates the polling subset of @see ContractManager.initialize:
16
- * 1. Load all contracts from the contract repository.
16
+ * 1. Load every watched contract from the contract repository.
17
17
  * 2. Paginated fetch of every VTXO (including spent) from the indexer.
18
18
  * 3. Extend each VTXO with tapscript data.
19
19
  * 4. Save to the wallet repository.
@@ -1,11 +1,11 @@
1
- import { T as TaskProcessor } from '../../taskRunner-Cy4Gh8n7.js';
2
- export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, a as TaskDependencies, b as TaskItem, c as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-Cy4Gh8n7.js';
3
- export { A as AsyncStorageLike, a as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-BwuWQ1Qc.js';
4
- import '../../ark-C9DsPSm8.js';
5
- import '@scure/btc-signer/transaction.js';
1
+ import { T as TaskProcessor } from '../../taskRunner-DxMJYJ7Y.js';
2
+ export { C as CreateTaskDependenciesOptions, I as InMemoryTaskQueue, b as TaskDependencies, c as TaskItem, a as TaskQueue, d as TaskResult, e as createTaskDependencies, r as runTasks } from '../../taskRunner-DxMJYJ7Y.js';
3
+ export { a as AsyncStorageLike, A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-Cq9FpKv6.js';
4
+ import '../../index-BcRCHnzN.js';
6
5
  import '@scure/btc-signer/utils.js';
7
- import '@scure/btc-signer/psbt.js';
6
+ import '@scure/btc-signer/transaction.js';
8
7
  import '@scure/btc-signer';
8
+ import '@scure/btc-signer/psbt.js';
9
9
 
10
10
  declare const CONTRACT_POLL_TASK_TYPE = "contract-poll";
11
11
  /**
@@ -13,7 +13,7 @@ declare const CONTRACT_POLL_TASK_TYPE = "contract-poll";
13
13
  * persists the results to the wallet repository.
14
14
  *
15
15
  * Replicates the polling subset of @see ContractManager.initialize:
16
- * 1. Load all contracts from the contract repository.
16
+ * 1. Load every watched contract from the contract repository.
17
17
  * 2. Paginated fetch of every VTXO (including spent) from the indexer.
18
18
  * 3. Extend each VTXO with tapscript data.
19
19
  * 4. Save to the wallet repository.
@@ -1,8 +1,8 @@
1
- export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks } from '../../chunk-H342JPPZ.js';
2
- import '../../chunk-OVSNY3HC.js';
3
- import '../../chunk-YEHGCHIL.js';
4
- import '../../chunk-PN5RD7ZI.js';
5
- import '../../chunk-FIMOVH25.js';
1
+ export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks } from '../../chunk-XLHN5L2O.js';
2
+ import '../../chunk-AUEXB42T.js';
3
+ import '../../chunk-YVQNHELA.js';
4
+ import '../../chunk-6O5OLYTZ.js';
5
+ import '../../chunk-PVY6DMN5.js';
6
6
  import '../../chunk-NSBPE2FW.js';
7
7
 
8
8
  // src/worker/expo/taskQueue.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/sdk",
3
- "version": "0.4.59",
3
+ "version": "0.4.61",
4
4
  "description": "TypeScript SDK for building Bitcoin wallets using the Arkade protocol",
5
5
  "repository": {
6
6
  "type": "git",
@@ -156,7 +156,9 @@
156
156
  "@types/better-sqlite3": "7.6.13",
157
157
  "@vitest/coverage-v8": "3.2.7",
158
158
  "better-sqlite3": "12.6.2",
159
- "typedoc": "^0.28.19"
159
+ "tsup": "^8.5.0",
160
+ "typedoc": "^0.28.19",
161
+ "typescript": "5.9.2"
160
162
  },
161
163
  "peerDependencies": {
162
164
  "@react-native-async-storage/async-storage": ">=1.0.0",