@arkade-os/sdk 0.4.54 → 0.4.56

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 (77) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/adapters/indexedDB.cjs +5 -5
  6. package/dist/adapters/indexedDB.js +4 -4
  7. package/dist/{ark-acFuA57I.d.cts → ark-Cgsd9tMd.d.cts} +40 -3
  8. package/dist/{ark-acFuA57I.d.ts → ark-Cgsd9tMd.d.ts} +40 -3
  9. package/dist/{asyncStorageTaskQueue-BO3cvMpP.d.cts → asyncStorageTaskQueue-C0ZsDE60.d.cts} +2 -2
  10. package/dist/{asyncStorageTaskQueue-DACXtP0I.d.ts → asyncStorageTaskQueue-CXz4PRBW.d.ts} +2 -2
  11. package/dist/{chunk-RNECH3TA.cjs → chunk-24YNIQSW.cjs} +15 -15
  12. package/dist/{chunk-RNECH3TA.cjs.map → chunk-24YNIQSW.cjs.map} +1 -1
  13. package/dist/{chunk-53XNU2EL.cjs → chunk-37XKN5DZ.cjs} +60 -40
  14. package/dist/chunk-37XKN5DZ.cjs.map +1 -0
  15. package/dist/{chunk-7L3P3EP5.js → chunk-5IMBONCK.js} +4 -4
  16. package/dist/{chunk-7L3P3EP5.js.map → chunk-5IMBONCK.js.map} +1 -1
  17. package/dist/{chunk-GMUVWKOK.cjs → chunk-CDWLZQQW.cjs} +11 -3
  18. package/dist/chunk-CDWLZQQW.cjs.map +1 -0
  19. package/dist/{chunk-D5LUPJJP.cjs → chunk-ENRRZFZ4.cjs} +774 -399
  20. package/dist/chunk-ENRRZFZ4.cjs.map +1 -0
  21. package/dist/{chunk-4EIKOJLD.js → chunk-IFGN2GB2.js} +11 -4
  22. package/dist/chunk-IFGN2GB2.js.map +1 -0
  23. package/dist/{chunk-YRLBZJYO.cjs → chunk-IMVKQQHU.cjs} +9 -9
  24. package/dist/{chunk-YRLBZJYO.cjs.map → chunk-IMVKQQHU.cjs.map} +1 -1
  25. package/dist/{chunk-BYJJIITU.cjs → chunk-MXPBHDOI.cjs} +17 -17
  26. package/dist/{chunk-BYJJIITU.cjs.map → chunk-MXPBHDOI.cjs.map} +1 -1
  27. package/dist/{chunk-ZOY5JSVA.js → chunk-NN7BNNF5.js} +3 -3
  28. package/dist/{chunk-ZOY5JSVA.js.map → chunk-NN7BNNF5.js.map} +1 -1
  29. package/dist/{chunk-A37WVZ5T.js → chunk-OOPDT2WV.js} +23 -4
  30. package/dist/chunk-OOPDT2WV.js.map +1 -0
  31. package/dist/{chunk-TEHJCEF3.js → chunk-T22257HW.js} +422 -56
  32. package/dist/chunk-T22257HW.js.map +1 -0
  33. package/dist/{chunk-QY2YVFZT.js → chunk-VNDVUM2W.js} +4 -4
  34. package/dist/{chunk-QY2YVFZT.js.map → chunk-VNDVUM2W.js.map} +1 -1
  35. package/dist/contracts/handlers/index.cjs +8 -8
  36. package/dist/contracts/handlers/index.d.cts +3 -3
  37. package/dist/contracts/handlers/index.d.ts +3 -3
  38. package/dist/contracts/handlers/index.js +2 -2
  39. package/dist/{delegate-DjwZZi6L.d.ts → delegate-CZPXtd2F.d.ts} +1 -1
  40. package/dist/{delegate-Ca_wXiYE.d.cts → delegate-xXT8O-Kn.d.cts} +1 -1
  41. package/dist/{index-Ddq0mIKX.d.ts → index-BBJ466mM.d.ts} +2 -2
  42. package/dist/{index-DFfefdpc.d.cts → index-BYG2eKOA.d.cts} +2 -2
  43. package/dist/index.cjs +246 -202
  44. package/dist/index.d.cts +169 -16
  45. package/dist/index.d.ts +169 -16
  46. package/dist/index.js +4 -4
  47. package/dist/repositories/realm/index.cjs +19 -19
  48. package/dist/repositories/realm/index.d.cts +2 -2
  49. package/dist/repositories/realm/index.d.ts +2 -2
  50. package/dist/repositories/realm/index.js +5 -5
  51. package/dist/repositories/sqlite/index.cjs +18 -18
  52. package/dist/repositories/sqlite/index.d.cts +2 -2
  53. package/dist/repositories/sqlite/index.d.ts +2 -2
  54. package/dist/repositories/sqlite/index.js +5 -5
  55. package/dist/{taskRunner-DEwlrgId.d.cts → taskRunner-BG1PRFps.d.cts} +2 -2
  56. package/dist/{taskRunner-DbCNRP31.d.ts → taskRunner-C46NnRsY.d.ts} +2 -2
  57. package/dist/wallet/expo/background.cjs +14 -14
  58. package/dist/wallet/expo/background.d.cts +3 -3
  59. package/dist/wallet/expo/background.d.ts +3 -3
  60. package/dist/wallet/expo/background.js +6 -6
  61. package/dist/wallet/expo/index.cjs +14 -14
  62. package/dist/wallet/expo/index.d.cts +5 -5
  63. package/dist/wallet/expo/index.d.ts +5 -5
  64. package/dist/wallet/expo/index.js +5 -5
  65. package/dist/{wallet-B9rpddG2.d.ts → wallet-1yWg75gN.d.cts} +100 -6
  66. package/dist/{wallet-ByjM6L20.d.cts → wallet-DuCm55EC.d.ts} +100 -6
  67. package/dist/worker/expo/index.cjs +9 -9
  68. package/dist/worker/expo/index.d.cts +4 -4
  69. package/dist/worker/expo/index.d.ts +4 -4
  70. package/dist/worker/expo/index.js +5 -5
  71. package/package.json +1 -1
  72. package/dist/chunk-4EIKOJLD.js.map +0 -1
  73. package/dist/chunk-53XNU2EL.cjs.map +0 -1
  74. package/dist/chunk-A37WVZ5T.js.map +0 -1
  75. package/dist/chunk-D5LUPJJP.cjs.map +0 -1
  76. package/dist/chunk-GMUVWKOK.cjs.map +0 -1
  77. package/dist/chunk-TEHJCEF3.js.map +0 -1
@@ -1,8 +1,51 @@
1
+ import { a as Identity, J as SignerSet, K as BatchStartedEvent, L as TreeSigningStartedEvent, M as TxTree, P as TreeNoncesEvent, Q as BatchFinalizationEvent, U as BatchFinalizedEvent, X as BatchFailedEvent, Y as TreeTxEvent, Z as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, _ as DescriptorProvider, f as IContractManager, $ as IReadonlyWallet, a0 as ReadonlyIdentity, a1 as Network, a2 as OnchainProvider, o as IndexerProvider, a3 as DelegateProvider, a4 as ReadonlyWalletConfig, x as IntentRepository, B as VirtualTxRepository, a5 as ExitCaptureMode, a6 as ExitDataSource, p as RelativeTimelock, d as ActivityRegistry, a7 as IReadonlyAssetManager, a8 as ContractSyncState, n as ArkProvider, a9 as NetworkName, aa as ArkInfo, ab as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, A as ArkTransaction, e as Activity, E as ExtendedCoin, ac as Coin, t as ExtendedVirtualCoin, ad as ContractManager, ae as ContractManagerConfig, I as IWallet, af as CSVMultisigTapscript, 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-Cgsd9tMd.cjs';
1
2
  import { Transaction } from '@scure/btc-signer';
2
- import { Bytes } from '@scure/btc-signer/utils.js';
3
- import { J as BatchStartedEvent, K as TreeSigningStartedEvent, L as TxTree, M as TreeNoncesEvent, P as BatchFinalizationEvent, Q as BatchFinalizedEvent, U as BatchFailedEvent, X as TreeTxEvent, Y as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, Z as DescriptorProvider, f as IContractManager, _ as IReadonlyWallet, $ as ReadonlyIdentity, a0 as Network, a1 as OnchainProvider, o as IndexerProvider, a2 as DelegateProvider, a3 as ReadonlyWalletConfig, x as IntentRepository, B as VirtualTxRepository, a4 as ExitCaptureMode, a5 as ExitDataSource, p as RelativeTimelock, d as ActivityRegistry, a6 as IReadonlyAssetManager, a7 as ContractSyncState, n as ArkProvider, a8 as NetworkName, a9 as ArkInfo, aa as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, A as ArkTransaction, e as Activity, E as ExtendedCoin, ab as Coin, t as ExtendedVirtualCoin, ac as ContractManager, ad as ContractManagerConfig, I as IWallet, a as Identity, ae as CSVMultisigTapscript, af as SettlementConfig, j as IAssetManager, ag as VtxoManager, g as IDelegateManager, S as SendBitcoinParams, h as SettleParams, R as Recipient, ah as SignerSession, ai as SignedIntent, aj as Intent, ak as TimeHeight } from './ark-acFuA57I.js';
4
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
5
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DjwZZi6L.js';
4
+ import { Bytes } from '@scure/btc-signer/utils.js';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-xXT8O-Kn.cjs';
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
+ getUsedSigningDescriptors(): Promise<string[]>;
29
+ /**
30
+ * 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.
33
+ */
34
+ signerForDescriptor(descriptor: string): Promise<Identity>;
35
+ }
36
+ /** Structural type guard for {@link HDWalletCapable}. */
37
+ declare function isHDWalletCapable(value: unknown): value is HDWalletCapable;
38
+
39
+ declare function getRandomId(): string;
40
+ /**
41
+ * What a recipient Arkade address must match. An address failing either check
42
+ * belongs to another network or operator, so this wallet's operator cannot
43
+ * create the VTXO where the recipient's wallet expects it.
44
+ */
45
+ type RecipientAddressContext = {
46
+ hrp: string;
47
+ signerSet: SignerSet;
48
+ };
6
49
 
7
50
  declare class ArkError extends Error {
8
51
  readonly code: number;
@@ -50,7 +93,9 @@ declare function isArkError(error: unknown, name?: ArkErrorName): error is ArkEr
50
93
  * {@link ProviderUnavailableError} message and the wallet's
51
94
  * `ProviderConnectionState`; it is deliberately *not* carried as a structured
52
95
  * field on the error, since custom `Error` own-properties do not survive the
53
- * service-worker `postMessage` boundary (only `name`/`message`/`cause` do).
96
+ * service-worker `postMessage` boundary. Structured clone keeps `message`,
97
+ * `stack` and `cause`, drops own-properties, and normalizes a custom `name` to
98
+ * `"Error"` — only the built-in error names survive it.
54
99
  */
55
100
  type ProviderKind = "arkade" | "indexer";
56
101
  /**
@@ -68,6 +113,24 @@ declare class ProviderUnavailableError extends Error {
68
113
  cause?: unknown;
69
114
  });
70
115
  }
116
+ /**
117
+ * A response does not reconcile with what the SDK submitted or already
118
+ * validated — a checkpoint tx whose txid is not among those submitted, a
119
+ * commitment tx that differs from the one validated at tree signing. Terminal
120
+ * rather than retryable: the two are equal by construction in a well-formed
121
+ * exchange, so the same request would produce the same outcome.
122
+ *
123
+ * Neither own-properties nor a custom `name` cross the service-worker
124
+ * `postMessage` boundary (see {@link ProviderKind}), so `retryable` and `name`
125
+ * are in-process conveniences and every distinguishing detail belongs in
126
+ * `message` — the one field a consumer past the boundary can still branch on.
127
+ */
128
+ declare class ServerResponseMismatchError extends Error {
129
+ readonly retryable = false;
130
+ constructor(message: string, options?: {
131
+ cause?: unknown;
132
+ });
133
+ }
71
134
  /**
72
135
  * Try to convert an error to an ArkError class, returning undefined if the error is not an ArkError
73
136
  * @param error - The error to parse
@@ -698,6 +761,12 @@ declare class ReadonlyWallet implements IReadonlyWallet {
698
761
  * spend path, which is current-signer-only.
699
762
  */
700
763
  protected watchedBoardingSigners(): Set<string>;
764
+ /**
765
+ * `serverPubKey` defaults to the live key; spend paths that snapshot it
766
+ * against mid-flight rotation pass their snapshot, so the check reads from
767
+ * one rotation epoch.
768
+ */
769
+ protected recipientAddressContext(serverPubKey?: Bytes): RecipientAddressContext;
701
770
  /**
702
771
  * Currently-active receive tapscript. Read-only from the outside;
703
772
  * mutated only via {@link Wallet.setOffchainTapscriptForRotation}
@@ -989,7 +1058,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
989
1058
  * });
990
1059
  * ```
991
1060
  */
992
- declare class Wallet extends ReadonlyWallet implements IWallet {
1061
+ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable {
993
1062
  readonly arkProvider: ArkProvider;
994
1063
  readonly forfeitOutputScript: Bytes;
995
1064
  readonly forfeitPubkey: Bytes;
@@ -1137,6 +1206,23 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
1137
1206
  * (no rotation, no index burned).
1138
1207
  */
1139
1208
  getNewBoardingAddress(): Promise<string>;
1209
+ /**
1210
+ * @see HDWalletCapable.getCurrentSigningDescriptor
1211
+ */
1212
+ getCurrentSigningDescriptor(): Promise<string | undefined>;
1213
+ /**
1214
+ * @see HDWalletCapable.getUsedSigningDescriptors
1215
+ *
1216
+ * Union of the watermark band and the descriptors persisted on contracts:
1217
+ * the band alone would miss rows a restore scan wrote, and the contracts
1218
+ * alone would miss indices allocated for something the wallet never
1219
+ * persisted (a swap, an externally issued invoice).
1220
+ */
1221
+ getUsedSigningDescriptors(): Promise<string[]>;
1222
+ /**
1223
+ * @see HDWalletCapable.signerForDescriptor
1224
+ */
1225
+ signerForDescriptor(descriptor: string): Promise<Identity>;
1140
1226
  /**
1141
1227
  * Mid-session server-signer rotation (plan §4). When arkd rotates its
1142
1228
  * active signer mid-session — the case the long-lived service worker and
@@ -1348,6 +1434,14 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
1348
1434
  finalized: string[];
1349
1435
  pending: string[];
1350
1436
  }>;
1437
+ /**
1438
+ * The server unroll scripts a pending checkpoint may legitimately have been
1439
+ * built under: this wallet's configured one, the server's current one, and
1440
+ * one per deprecated signer (same closure, deprecated key). A tx submitted
1441
+ * before a signer rotation was built under the old key, so rebuilding
1442
+ * against the current key alone would leave it pending forever.
1443
+ */
1444
+ private checkpointUnrollCandidates;
1351
1445
  private hasPendingTxFlag;
1352
1446
  private setPendingTxFlag;
1353
1447
  /**
@@ -1489,4 +1583,4 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1489
1583
  */
1490
1584
  declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
1491
1585
 
1492
- export { ArkError as A, Batch as B, type IncomingFunds as I, type ProviderConnectionState as P, ReadonlyWallet as R, type ServerInfoSource as S, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, ArkErrorName as d, type ArkadeCashClaimResult as e, ArkadeCashCreateError as f, type ArkadeCashUnclaimedReason as g, type ArkadeCashUnclaimedVtxo as h, type BoardingUtxoGroup as i, type ProviderKind as j, ProviderUnavailableError as k, isArkError as l, maybeArkError as m, selectVirtualCoins as s, waitForIncomingFunds as w };
1586
+ export { ArkError as A, Batch as B, type HDWalletCapable as H, type IncomingFunds as I, type ProviderConnectionState as P, ReadonlyWallet as R, type ServerInfoSource as S, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, ArkErrorName as d, type ArkadeCashClaimResult as e, ArkadeCashCreateError as f, type ArkadeCashUnclaimedReason as g, type ArkadeCashUnclaimedVtxo as h, type BoardingUtxoGroup as i, type ProviderKind as j, ProviderUnavailableError as k, ServerResponseMismatchError as l, getRandomId as m, isArkError as n, isHDWalletCapable as o, maybeArkError as p, selectVirtualCoins as s, waitForIncomingFunds as w };
@@ -1,8 +1,51 @@
1
+ import { a as Identity, J as SignerSet, K as BatchStartedEvent, L as TreeSigningStartedEvent, M as TxTree, P as TreeNoncesEvent, Q as BatchFinalizationEvent, U as BatchFinalizedEvent, X as BatchFailedEvent, Y as TreeTxEvent, Z as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, _ as DescriptorProvider, f as IContractManager, $ as IReadonlyWallet, a0 as ReadonlyIdentity, a1 as Network, a2 as OnchainProvider, o as IndexerProvider, a3 as DelegateProvider, a4 as ReadonlyWalletConfig, x as IntentRepository, B as VirtualTxRepository, a5 as ExitCaptureMode, a6 as ExitDataSource, p as RelativeTimelock, d as ActivityRegistry, a7 as IReadonlyAssetManager, a8 as ContractSyncState, n as ArkProvider, a9 as NetworkName, aa as ArkInfo, ab as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, A as ArkTransaction, e as Activity, E as ExtendedCoin, ac as Coin, t as ExtendedVirtualCoin, ad as ContractManager, ae as ContractManagerConfig, I as IWallet, af as CSVMultisigTapscript, 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-Cgsd9tMd.js';
1
2
  import { Transaction } from '@scure/btc-signer';
2
- import { Bytes } from '@scure/btc-signer/utils.js';
3
- import { J as BatchStartedEvent, K as TreeSigningStartedEvent, L as TxTree, M as TreeNoncesEvent, P as BatchFinalizationEvent, Q as BatchFinalizedEvent, U as BatchFailedEvent, X as TreeTxEvent, Y as TreeSignatureEvent, i as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, Z as DescriptorProvider, f as IContractManager, _ as IReadonlyWallet, $ as ReadonlyIdentity, a0 as Network, a1 as OnchainProvider, o as IndexerProvider, a2 as DelegateProvider, a3 as ReadonlyWalletConfig, x as IntentRepository, B as VirtualTxRepository, a4 as ExitCaptureMode, a5 as ExitDataSource, p as RelativeTimelock, d as ActivityRegistry, a6 as IReadonlyAssetManager, a7 as ContractSyncState, n as ArkProvider, a8 as NetworkName, a9 as ArkInfo, aa as ArkAddress, c as WalletBalance, G as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, A as ArkTransaction, e as Activity, E as ExtendedCoin, ab as Coin, t as ExtendedVirtualCoin, ac as ContractManager, ad as ContractManagerConfig, I as IWallet, a as Identity, ae as CSVMultisigTapscript, af as SettlementConfig, j as IAssetManager, ag as VtxoManager, g as IDelegateManager, S as SendBitcoinParams, h as SettleParams, R as Recipient, ah as SignerSession, ai as SignedIntent, aj as Intent, ak as TimeHeight } from './ark-acFuA57I.cjs';
4
3
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
5
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Ca_wXiYE.cjs';
4
+ import { Bytes } from '@scure/btc-signer/utils.js';
5
+ import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-CZPXtd2F.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
+ getUsedSigningDescriptors(): Promise<string[]>;
29
+ /**
30
+ * 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.
33
+ */
34
+ signerForDescriptor(descriptor: string): Promise<Identity>;
35
+ }
36
+ /** Structural type guard for {@link HDWalletCapable}. */
37
+ declare function isHDWalletCapable(value: unknown): value is HDWalletCapable;
38
+
39
+ declare function getRandomId(): string;
40
+ /**
41
+ * What a recipient Arkade address must match. An address failing either check
42
+ * belongs to another network or operator, so this wallet's operator cannot
43
+ * create the VTXO where the recipient's wallet expects it.
44
+ */
45
+ type RecipientAddressContext = {
46
+ hrp: string;
47
+ signerSet: SignerSet;
48
+ };
6
49
 
7
50
  declare class ArkError extends Error {
8
51
  readonly code: number;
@@ -50,7 +93,9 @@ declare function isArkError(error: unknown, name?: ArkErrorName): error is ArkEr
50
93
  * {@link ProviderUnavailableError} message and the wallet's
51
94
  * `ProviderConnectionState`; it is deliberately *not* carried as a structured
52
95
  * field on the error, since custom `Error` own-properties do not survive the
53
- * service-worker `postMessage` boundary (only `name`/`message`/`cause` do).
96
+ * service-worker `postMessage` boundary. Structured clone keeps `message`,
97
+ * `stack` and `cause`, drops own-properties, and normalizes a custom `name` to
98
+ * `"Error"` — only the built-in error names survive it.
54
99
  */
55
100
  type ProviderKind = "arkade" | "indexer";
56
101
  /**
@@ -68,6 +113,24 @@ declare class ProviderUnavailableError extends Error {
68
113
  cause?: unknown;
69
114
  });
70
115
  }
116
+ /**
117
+ * A response does not reconcile with what the SDK submitted or already
118
+ * validated — a checkpoint tx whose txid is not among those submitted, a
119
+ * commitment tx that differs from the one validated at tree signing. Terminal
120
+ * rather than retryable: the two are equal by construction in a well-formed
121
+ * exchange, so the same request would produce the same outcome.
122
+ *
123
+ * Neither own-properties nor a custom `name` cross the service-worker
124
+ * `postMessage` boundary (see {@link ProviderKind}), so `retryable` and `name`
125
+ * are in-process conveniences and every distinguishing detail belongs in
126
+ * `message` — the one field a consumer past the boundary can still branch on.
127
+ */
128
+ declare class ServerResponseMismatchError extends Error {
129
+ readonly retryable = false;
130
+ constructor(message: string, options?: {
131
+ cause?: unknown;
132
+ });
133
+ }
71
134
  /**
72
135
  * Try to convert an error to an ArkError class, returning undefined if the error is not an ArkError
73
136
  * @param error - The error to parse
@@ -698,6 +761,12 @@ declare class ReadonlyWallet implements IReadonlyWallet {
698
761
  * spend path, which is current-signer-only.
699
762
  */
700
763
  protected watchedBoardingSigners(): Set<string>;
764
+ /**
765
+ * `serverPubKey` defaults to the live key; spend paths that snapshot it
766
+ * against mid-flight rotation pass their snapshot, so the check reads from
767
+ * one rotation epoch.
768
+ */
769
+ protected recipientAddressContext(serverPubKey?: Bytes): RecipientAddressContext;
701
770
  /**
702
771
  * Currently-active receive tapscript. Read-only from the outside;
703
772
  * mutated only via {@link Wallet.setOffchainTapscriptForRotation}
@@ -989,7 +1058,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
989
1058
  * });
990
1059
  * ```
991
1060
  */
992
- declare class Wallet extends ReadonlyWallet implements IWallet {
1061
+ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable {
993
1062
  readonly arkProvider: ArkProvider;
994
1063
  readonly forfeitOutputScript: Bytes;
995
1064
  readonly forfeitPubkey: Bytes;
@@ -1137,6 +1206,23 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
1137
1206
  * (no rotation, no index burned).
1138
1207
  */
1139
1208
  getNewBoardingAddress(): Promise<string>;
1209
+ /**
1210
+ * @see HDWalletCapable.getCurrentSigningDescriptor
1211
+ */
1212
+ getCurrentSigningDescriptor(): Promise<string | undefined>;
1213
+ /**
1214
+ * @see HDWalletCapable.getUsedSigningDescriptors
1215
+ *
1216
+ * Union of the watermark band and the descriptors persisted on contracts:
1217
+ * the band alone would miss rows a restore scan wrote, and the contracts
1218
+ * alone would miss indices allocated for something the wallet never
1219
+ * persisted (a swap, an externally issued invoice).
1220
+ */
1221
+ getUsedSigningDescriptors(): Promise<string[]>;
1222
+ /**
1223
+ * @see HDWalletCapable.signerForDescriptor
1224
+ */
1225
+ signerForDescriptor(descriptor: string): Promise<Identity>;
1140
1226
  /**
1141
1227
  * Mid-session server-signer rotation (plan §4). When arkd rotates its
1142
1228
  * active signer mid-session — the case the long-lived service worker and
@@ -1348,6 +1434,14 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
1348
1434
  finalized: string[];
1349
1435
  pending: string[];
1350
1436
  }>;
1437
+ /**
1438
+ * The server unroll scripts a pending checkpoint may legitimately have been
1439
+ * built under: this wallet's configured one, the server's current one, and
1440
+ * one per deprecated signer (same closure, deprecated key). A tx submitted
1441
+ * before a signer rotation was built under the old key, so rebuilding
1442
+ * against the current key alone would leave it pending forever.
1443
+ */
1444
+ private checkpointUnrollCandidates;
1351
1445
  private hasPendingTxFlag;
1352
1446
  private setPendingTxFlag;
1353
1447
  /**
@@ -1489,4 +1583,4 @@ declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount:
1489
1583
  */
1490
1584
  declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
1491
1585
 
1492
- export { ArkError as A, Batch as B, type IncomingFunds as I, type ProviderConnectionState as P, ReadonlyWallet as R, type ServerInfoSource as S, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, ArkErrorName as d, type ArkadeCashClaimResult as e, ArkadeCashCreateError as f, type ArkadeCashUnclaimedReason as g, type ArkadeCashUnclaimedVtxo as h, type BoardingUtxoGroup as i, type ProviderKind as j, ProviderUnavailableError as k, isArkError as l, maybeArkError as m, selectVirtualCoins as s, waitForIncomingFunds as w };
1586
+ export { ArkError as A, Batch as B, type HDWalletCapable as H, type IncomingFunds as I, type ProviderConnectionState as P, ReadonlyWallet as R, type ServerInfoSource as S, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, ArkErrorName as d, type ArkadeCashClaimResult as e, ArkadeCashCreateError as f, type ArkadeCashUnclaimedReason as g, type ArkadeCashUnclaimedVtxo as h, type BoardingUtxoGroup as i, type ProviderKind as j, ProviderUnavailableError as k, ServerResponseMismatchError as l, getRandomId as m, isArkError as n, isHDWalletCapable as o, maybeArkError as p, selectVirtualCoins as s, waitForIncomingFunds as w };
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkYRLBZJYO_cjs = require('../../chunk-YRLBZJYO.cjs');
4
- require('../../chunk-D5LUPJJP.cjs');
5
- require('../../chunk-RNECH3TA.cjs');
6
- require('../../chunk-53XNU2EL.cjs');
7
- require('../../chunk-GMUVWKOK.cjs');
3
+ var chunkIMVKQQHU_cjs = require('../../chunk-IMVKQQHU.cjs');
4
+ require('../../chunk-ENRRZFZ4.cjs');
5
+ require('../../chunk-24YNIQSW.cjs');
6
+ require('../../chunk-37XKN5DZ.cjs');
7
+ require('../../chunk-CDWLZQQW.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 chunkYRLBZJYO_cjs.CONTRACT_POLL_TASK_TYPE; }
124
+ get: function () { return chunkIMVKQQHU_cjs.CONTRACT_POLL_TASK_TYPE; }
125
125
  });
126
126
  Object.defineProperty(exports, "contractPollProcessor", {
127
127
  enumerable: true,
128
- get: function () { return chunkYRLBZJYO_cjs.contractPollProcessor; }
128
+ get: function () { return chunkIMVKQQHU_cjs.contractPollProcessor; }
129
129
  });
130
130
  Object.defineProperty(exports, "createTaskDependencies", {
131
131
  enumerable: true,
132
- get: function () { return chunkYRLBZJYO_cjs.createTaskDependencies; }
132
+ get: function () { return chunkIMVKQQHU_cjs.createTaskDependencies; }
133
133
  });
134
134
  Object.defineProperty(exports, "runTasks", {
135
135
  enumerable: true,
136
- get: function () { return chunkYRLBZJYO_cjs.runTasks; }
136
+ get: function () { return chunkIMVKQQHU_cjs.runTasks; }
137
137
  });
138
138
  exports.AsyncStorageTaskQueue = AsyncStorageTaskQueue;
139
139
  exports.InMemoryTaskQueue = InMemoryTaskQueue;
@@ -1,7 +1,7 @@
1
- import { T as TaskProcessor } from '../../taskRunner-DEwlrgId.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-DEwlrgId.cjs';
3
- export { A as AsyncStorageLike, a as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-BO3cvMpP.cjs';
4
- import '../../ark-acFuA57I.cjs';
1
+ import { T as TaskProcessor } from '../../taskRunner-BG1PRFps.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-BG1PRFps.cjs';
3
+ export { a as AsyncStorageLike, A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-C0ZsDE60.cjs';
4
+ import '../../ark-Cgsd9tMd.cjs';
5
5
  import '@scure/btc-signer/transaction.js';
6
6
  import '@scure/btc-signer/utils.js';
7
7
  import '@scure/btc-signer/psbt.js';
@@ -1,7 +1,7 @@
1
- import { T as TaskProcessor } from '../../taskRunner-DbCNRP31.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-DbCNRP31.js';
3
- export { A as AsyncStorageLike, a as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-DACXtP0I.js';
4
- import '../../ark-acFuA57I.js';
1
+ import { T as TaskProcessor } from '../../taskRunner-C46NnRsY.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-C46NnRsY.js';
3
+ export { a as AsyncStorageLike, A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-CXz4PRBW.js';
4
+ import '../../ark-Cgsd9tMd.js';
5
5
  import '@scure/btc-signer/transaction.js';
6
6
  import '@scure/btc-signer/utils.js';
7
7
  import '@scure/btc-signer/psbt.js';
@@ -1,8 +1,8 @@
1
- export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks } from '../../chunk-7L3P3EP5.js';
2
- import '../../chunk-TEHJCEF3.js';
3
- import '../../chunk-ZOY5JSVA.js';
4
- import '../../chunk-A37WVZ5T.js';
5
- import '../../chunk-4EIKOJLD.js';
1
+ export { CONTRACT_POLL_TASK_TYPE, contractPollProcessor, createTaskDependencies, runTasks } from '../../chunk-5IMBONCK.js';
2
+ import '../../chunk-T22257HW.js';
3
+ import '../../chunk-NN7BNNF5.js';
4
+ import '../../chunk-OOPDT2WV.js';
5
+ import '../../chunk-IFGN2GB2.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.54",
3
+ "version": "0.4.56",
4
4
  "description": "TypeScript SDK for building Bitcoin wallets using the Arkade protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",