@arkade-os/sdk 0.4.45 → 0.4.47

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 (91) 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-C-PjOngm.d.cts → ark-CoJgwTi_.d.cts} +31 -3
  8. package/dist/{ark-C-PjOngm.d.ts → ark-CoJgwTi_.d.ts} +31 -3
  9. package/dist/{asyncStorageTaskQueue-BmBPvTyh.d.cts → asyncStorageTaskQueue-Dowyo59a.d.cts} +2 -2
  10. package/dist/{asyncStorageTaskQueue-CHpI3moJ.d.ts → asyncStorageTaskQueue-Z3aFoXCl.d.ts} +2 -2
  11. package/dist/{chunk-QZ6HZZZK.js → chunk-3N5I6GT6.js} +3 -3
  12. package/dist/{chunk-QZ6HZZZK.js.map → chunk-3N5I6GT6.js.map} +1 -1
  13. package/dist/{chunk-BOA4SHCD.js → chunk-AJQ4AOT3.js} +4 -4
  14. package/dist/{chunk-BOA4SHCD.js.map → chunk-AJQ4AOT3.js.map} +1 -1
  15. package/dist/{chunk-BE5MUB7T.js → chunk-C7TXXTMS.js} +9 -5
  16. package/dist/chunk-C7TXXTMS.js.map +1 -0
  17. package/dist/{chunk-YBQV7XBC.js → chunk-CDDWXBEM.js} +139 -21
  18. package/dist/chunk-CDDWXBEM.js.map +1 -0
  19. package/dist/{chunk-UHOHLN3C.cjs → chunk-HHV5FPC6.cjs} +148 -25
  20. package/dist/chunk-HHV5FPC6.cjs.map +1 -0
  21. package/dist/{chunk-HZ7VIN7P.cjs → chunk-JAYOXOLT.cjs} +14 -14
  22. package/dist/{chunk-HZ7VIN7P.cjs.map → chunk-JAYOXOLT.cjs.map} +1 -1
  23. package/dist/{chunk-HXDZ2QTW.cjs → chunk-L5ND2FJJ.cjs} +9 -5
  24. package/dist/chunk-L5ND2FJJ.cjs.map +1 -0
  25. package/dist/{chunk-TGRJ5WAX.js → chunk-OCS5S3L3.js} +1085 -103
  26. package/dist/chunk-OCS5S3L3.js.map +1 -0
  27. package/dist/chunk-RQSA7ADZ.cjs +2286 -0
  28. package/dist/chunk-RQSA7ADZ.cjs.map +1 -0
  29. package/dist/{chunk-OFQGANH2.cjs → chunk-VE67GMGM.cjs} +7 -7
  30. package/dist/{chunk-OFQGANH2.cjs.map → chunk-VE67GMGM.cjs.map} +1 -1
  31. package/dist/{chunk-SRCWBFSZ.cjs → chunk-WTTLIFS7.cjs} +1281 -289
  32. package/dist/chunk-WTTLIFS7.cjs.map +1 -0
  33. package/dist/chunk-XN3554FT.js +2244 -0
  34. package/dist/chunk-XN3554FT.js.map +1 -0
  35. package/dist/contracts/handlers/index.cjs +11 -7
  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-BKNqva1j.d.ts → delegate-CuaDqqQi.d.ts} +1 -1
  40. package/dist/{delegate-DOEobYwH.d.cts → delegate-Dl87_zMA.d.cts} +1 -1
  41. package/dist/index-BC_G0VTh.d.cts +512 -0
  42. package/dist/index-CKwpZEpw.d.ts +512 -0
  43. package/dist/index.cjs +219 -159
  44. package/dist/index.d.cts +3097 -2090
  45. package/dist/index.d.ts +3097 -2090
  46. package/dist/index.js +4 -4
  47. package/dist/repositories/realm/index.cjs +23 -19
  48. package/dist/repositories/realm/index.cjs.map +1 -1
  49. package/dist/repositories/realm/index.d.cts +2 -2
  50. package/dist/repositories/realm/index.d.ts +2 -2
  51. package/dist/repositories/realm/index.js +9 -5
  52. package/dist/repositories/realm/index.js.map +1 -1
  53. package/dist/repositories/sqlite/index.cjs +22 -18
  54. package/dist/repositories/sqlite/index.cjs.map +1 -1
  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 +9 -5
  58. package/dist/repositories/sqlite/index.js.map +1 -1
  59. package/dist/{taskRunner-BngWSFMi.d.ts → taskRunner-Dz-TI4Rb.d.ts} +2 -2
  60. package/dist/{taskRunner-DOiyRuJa.d.cts → taskRunner-Dz47k0lp.d.cts} +2 -2
  61. package/dist/wallet/expo/background.cjs +14 -14
  62. package/dist/wallet/expo/background.d.cts +3 -3
  63. package/dist/wallet/expo/background.d.ts +3 -3
  64. package/dist/wallet/expo/background.js +6 -6
  65. package/dist/wallet/expo/index.cjs +18 -14
  66. package/dist/wallet/expo/index.cjs.map +1 -1
  67. package/dist/wallet/expo/index.d.cts +4 -4
  68. package/dist/wallet/expo/index.d.ts +4 -4
  69. package/dist/wallet/expo/index.js +9 -5
  70. package/dist/wallet/expo/index.js.map +1 -1
  71. package/dist/{wallet-DBjumS42.d.cts → wallet-Oxz_wLxo.d.cts} +47 -3
  72. package/dist/{wallet-B3awP1Nj.d.ts → wallet-x7egmXq6.d.ts} +47 -3
  73. package/dist/worker/expo/index.cjs +10 -9
  74. package/dist/worker/expo/index.cjs.map +1 -1
  75. package/dist/worker/expo/index.d.cts +4 -4
  76. package/dist/worker/expo/index.d.ts +4 -4
  77. package/dist/worker/expo/index.js +6 -5
  78. package/dist/worker/expo/index.js.map +1 -1
  79. package/package.json +2 -2
  80. package/dist/chunk-32YKLQPS.cjs +0 -970
  81. package/dist/chunk-32YKLQPS.cjs.map +0 -1
  82. package/dist/chunk-BE5MUB7T.js.map +0 -1
  83. package/dist/chunk-HXDZ2QTW.cjs.map +0 -1
  84. package/dist/chunk-SRCWBFSZ.cjs.map +0 -1
  85. package/dist/chunk-TGRJ5WAX.js.map +0 -1
  86. package/dist/chunk-UHOHLN3C.cjs.map +0 -1
  87. package/dist/chunk-YBQV7XBC.js.map +0 -1
  88. package/dist/chunk-YNEDJTX2.js +0 -957
  89. package/dist/chunk-YNEDJTX2.js.map +0 -1
  90. package/dist/index-BlW4I30l.d.cts +0 -259
  91. package/dist/index-Cm2fGeox.d.ts +0 -259
@@ -1,259 +0,0 @@
1
- import { q as RelativeTimelock, V as VtxoScript, r as TapLeafScript, b3 as ContractHandler, bf as Discoverable } from './ark-C-PjOngm.js';
2
- import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-BKNqva1j.js';
3
- import { Bytes } from '@scure/btc-signer/utils.js';
4
-
5
- /** Virtual Hash Time Lock Contract (VHTLC) namespace. */
6
- declare namespace VHTLC {
7
- interface Options {
8
- sender: Bytes;
9
- receiver: Bytes;
10
- server: Bytes;
11
- preimageHash: Bytes;
12
- refundLocktime: bigint;
13
- unilateralClaimDelay: RelativeTimelock;
14
- unilateralRefundDelay: RelativeTimelock;
15
- unilateralRefundWithoutReceiverDelay: RelativeTimelock;
16
- }
17
- /**
18
- * Virtual Hash Time Lock Contract (VHTLC) script implementation.
19
- *
20
- * VHTLC enables atomic swaps and conditional payments in the Arkade protocol.
21
- * It provides multiple spending paths:
22
- *
23
- * - **claim**: Receiver can claim funds by revealing the preimage
24
- * - **refund**: Sender and receiver can collaboratively refund
25
- * - **refundWithoutReceiver**: Sender can refund after locktime expires
26
- * - **unilateralClaim**: Receiver can claim unilaterally after delay
27
- * - **unilateralRefund**: Sender and receiver can refund unilaterally after delay
28
- * - **unilateralRefundWithoutReceiver**: Sender can refund unilaterally after delay
29
- *
30
- * @example
31
- * ```typescript
32
- * const vhtlc = new VHTLC.Script({
33
- * sender: alicePubKey,
34
- * receiver: bobPubKey,
35
- * server: serverPubKey,
36
- * preimageHash: hash160(secret),
37
- * refundLocktime: BigInt(chainTip + 10),
38
- * unilateralClaimDelay: { type: 'blocks', value: 100n },
39
- * unilateralRefundDelay: { type: 'blocks', value: 102n },
40
- * unilateralRefundWithoutReceiverDelay: { type: 'blocks', value: 103n }
41
- * });
42
- * ```
43
- */
44
- class Script extends VtxoScript {
45
- readonly options: Options;
46
- readonly claimScript: string;
47
- readonly refundScript: string;
48
- readonly refundWithoutReceiverScript: string;
49
- readonly unilateralClaimScript: string;
50
- readonly unilateralRefundScript: string;
51
- readonly unilateralRefundWithoutReceiverScript: string;
52
- /** Create a VHTLC script from the supplied participant keys, hash, and timelocks. */
53
- constructor(options: Options);
54
- /** Return the collaborative claim tapleaf script. */
55
- claim(): TapLeafScript;
56
- /** Return the collaborative refund tapleaf script. */
57
- refund(): TapLeafScript;
58
- /** Return the refund-without-receiver tapleaf script. */
59
- refundWithoutReceiver(): TapLeafScript;
60
- /** Return the unilateral claim tapleaf script. */
61
- unilateralClaim(): TapLeafScript;
62
- /** Return the unilateral refund tapleaf script. */
63
- unilateralRefund(): TapLeafScript;
64
- /** Return the unilateral refund-without-receiver tapleaf script. */
65
- unilateralRefundWithoutReceiver(): TapLeafScript;
66
- }
67
- }
68
-
69
- /**
70
- * Registry for contract handlers.
71
- *
72
- * Each contract type ("default", "vhtlc", etc.) has a handler that knows
73
- * how to create VtxoScripts, serialize params, and select spending paths.
74
- *
75
- * @example
76
- * ```typescript
77
- * // Register a custom handler
78
- * contractHandlers.register(myCustomHandler);
79
- *
80
- * // Get handler for a type
81
- * const handler = contractHandlers.get("vhtlc");
82
- * const script = handler.createScript(contract.params);
83
- * ```
84
- */
85
- declare class ContractHandlerRegistry {
86
- private handlers;
87
- /**
88
- * Register a contract handler.
89
- *
90
- * @param handler - The handler to register
91
- * @throws If a handler for this type is already registered
92
- */
93
- register(handler: ContractHandler<unknown>): void;
94
- /**
95
- * Get a handler by type.
96
- *
97
- * @param type - The contract type
98
- * @returns The handler, or undefined if not found
99
- */
100
- get(type: string): ContractHandler<unknown> | undefined;
101
- /**
102
- * Get a handler by type, throwing if not found.
103
- *
104
- * @param type - The contract type
105
- * @returns The handler
106
- * @throws If no handler is registered for this type
107
- */
108
- getOrThrow(type: string): ContractHandler<unknown>;
109
- /**
110
- * Check if a handler is registered.
111
- *
112
- * @param type - The contract type
113
- */
114
- has(type: string): boolean;
115
- /**
116
- * Get all registered types.
117
- */
118
- getRegisteredTypes(): string[];
119
- /**
120
- * Unregister a handler (mainly for testing).
121
- */
122
- unregister(type: string): boolean;
123
- /**
124
- * Clear all handlers (mainly for testing).
125
- */
126
- clear(): void;
127
- }
128
- /**
129
- * Global registry of contract handlers.
130
- */
131
- declare const contractHandlers: ContractHandlerRegistry;
132
-
133
- /**
134
- * Typed parameters for DefaultVtxo contracts.
135
- */
136
- interface DefaultContractParams {
137
- pubKey: Uint8Array;
138
- serverPubKey: Uint8Array;
139
- csvTimelock: RelativeTimelock;
140
- }
141
- /**
142
- * Handler for default wallet VTXOs.
143
- *
144
- * Default contracts use the standard forfeit + exit tapscript:
145
- * - forfeit: (Alice + Server) multisig for collaborative spending
146
- * - exit: (Alice) + CSV timelock for unilateral exit
147
- */
148
- declare const DefaultContractHandler: ContractHandler<DefaultContractParams, DefaultVtxo.Script> & Discoverable;
149
-
150
- /**
151
- * Typed parameters for DelegateVtxo contracts.
152
- */
153
- interface DelegateContractParams {
154
- pubKey: Uint8Array;
155
- serverPubKey: Uint8Array;
156
- delegatePubKey: Uint8Array;
157
- csvTimelock: RelativeTimelock;
158
- }
159
- /**
160
- * Handler for delegate wallet virtual outputs.
161
- *
162
- * Delegate contracts extend the default tapscript with an additional delegate path:
163
- * - forfeit: (Alice + Server) multisig for collaborative spending
164
- * - exit: (Alice) + CSV timelock for unilateral exit
165
- * - delegate: (Alice + Delegate + Server) multisig for delegated renewal
166
- */
167
- declare const DelegateContractHandler: ContractHandler<DelegateContractParams, DelegateVtxo.Script> & Discoverable;
168
-
169
- /**
170
- * Typed parameters for VHTLC contracts.
171
- */
172
- interface VHTLCContractParams {
173
- sender: Uint8Array;
174
- receiver: Uint8Array;
175
- server: Uint8Array;
176
- preimageHash: Uint8Array;
177
- refundLocktime: bigint;
178
- unilateralClaimDelay: RelativeTimelock;
179
- unilateralRefundDelay: RelativeTimelock;
180
- unilateralRefundWithoutReceiverDelay: RelativeTimelock;
181
- }
182
- /**
183
- * Handler for Virtual Hash Time Lock Contract (VHTLC).
184
- *
185
- * VHTLC supports multiple spending paths:
186
- *
187
- * Collaborative paths (with server):
188
- * - claim: Receiver + Server with preimage
189
- * - refund: Sender + Receiver + Server
190
- * - refundWithoutReceiver: Sender + Server after CLTV locktime
191
- *
192
- * Unilateral paths (without server):
193
- * - unilateralClaim: Receiver with preimage after CSV delay
194
- * - unilateralRefund: Sender + Receiver after CSV delay
195
- * - unilateralRefundWithoutReceiver: Sender after CSV delay
196
- */
197
- declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.Script>;
198
-
199
- /**
200
- * Typed parameters for boarding contracts.
201
- *
202
- * Boarding reuses the exact `default` contract parameter shape
203
- * (`pubKey` / `serverPubKey` / `csvTimelock`) rather than inventing
204
- * boarding-specific names — the boarding semantics come from the
205
- * contract type and from populating `csvTimelock` with the server's
206
- * boarding-exit delay (`ArkInfo.boardingExitDelay`) instead of the
207
- * offchain unilateral-exit delay.
208
- */
209
- type BoardingContractParams = DefaultContractParams;
210
- /**
211
- * Handler for the boarding contract (registered type `boarding`).
212
- *
213
- * The boarding contract derives the on-chain Bitcoin address used to
214
- * board funds onto Arkade. It shares the exact `DefaultVtxo.Script`
215
- * shape with the `default` contract — a Taproot output co-owned by the
216
- * wallet and the Ark server, with a CSV exit path back to the wallet —
217
- * and therefore reuses the `default` handler's path logic (forfeit via
218
- * server cooperation, exit after the boarding CSV).
219
- *
220
- * Boarding semantics come entirely from the contract type and from
221
- * sourcing the CSV timelock from the server's boarding-exit delay
222
- * (`ArkInfo.boardingExitDelay`), not from renamed parameters. The
223
- * offchain `default` contract is built from `ArkInfo.unilateralExitDelay`
224
- * instead, so the two share a script shape but differ in their CSV
225
- * timelock value. Parameters round-trip through the same
226
- * `timelockToSequence` / `sequenceToTimelock` helpers and BIP68 sequence
227
- * encoding as `default` / `delegate`.
228
- *
229
- * Like `default` / `delegate`, the boarding handler implements
230
- * {@link Discoverable.discoverAt} so `wallet.restore()` can rediscover
231
- * used boarding indices from authoritative on-chain data. It differs from
232
- * the L2 handlers in its source of truth: boarding probes the **on-chain**
233
- * UTXO set at its P2TR address (`OnchainProvider.getCoins`) rather than the
234
- * Ark indexer, and builds its candidate from the boarding-exit CSV
235
- * (`deps.boardingTimelock`). When boarding discovery is not plumbed (no
236
- * `deps.boardingTimelock` / `deps.onchainNetwork`) `discoverAt` no-ops.
237
- *
238
- * Identity & the default/boarding collision: a contract's `script` (pkScript)
239
- * is its unique identity — a script owns exactly one repository row. `boarding`
240
- * is a first-class type with its own row **when its script is distinct** from
241
- * the wallet's `default` baseline — the real-world case, since a sound Ark
242
- * server keeps boardingExitDelay strictly longer than unilateralExitDelay (equal
243
- * delays would expose the provider to a double-spend). Should those delays ever
244
- * coincide (a misconfigured/malicious server), the boarding script is
245
- * byte-identical to the default script. `discoverAt` does NOT pre-coalesce that
246
- * collision: it always emits `type: "boarding"`, and the single shared row is
247
- * resolved FIRST-WINS at the persistence layer
248
- * ({@link ContractManager.upsertContract}) — whichever purpose is persisted
249
- * first keeps the row, and the scan deliberately probes boarding first
250
- * (see docs/hd-wallets_onchain_rotation_collision_fix.md §5.1–5.2). Either way
251
- * the funds are equally spendable through the shared `DefaultVtxo.Script` paths.
252
- * Consumers must NOT rely on `contract.type === "boarding"` to identify the
253
- * boarding purpose — resolve the boarding script via
254
- * `wallet.getBoardingAddress()` / `wallet.boardingTapscript` (which never depend
255
- * on the persisted contract's type) and match by script when needed.
256
- */
257
- declare const BoardingContractHandler: ContractHandler<BoardingContractParams, DefaultVtxo.Script> & Discoverable;
258
-
259
- export { BoardingContractHandler as B, DefaultContractHandler as D, VHTLC as V, type BoardingContractParams as a, type DefaultContractParams as b, DelegateContractHandler as c, type DelegateContractParams as d, VHTLCContractHandler as e, type VHTLCContractParams as f, contractHandlers as g };