@arkade-os/sdk 0.4.46 → 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.
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{ark-C9ognsOV.d.cts → ark-CoJgwTi_.d.cts} +26 -2
- package/dist/{ark-C9ognsOV.d.ts → ark-CoJgwTi_.d.ts} +26 -2
- package/dist/{asyncStorageTaskQueue-CmBYVlxw.d.cts → asyncStorageTaskQueue-Dowyo59a.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-BAKZ5cS5.d.ts → asyncStorageTaskQueue-Z3aFoXCl.d.ts} +2 -2
- package/dist/{chunk-R2SVAM5Q.js → chunk-3N5I6GT6.js} +3 -3
- package/dist/{chunk-R2SVAM5Q.js.map → chunk-3N5I6GT6.js.map} +1 -1
- package/dist/{chunk-JTCQ6QXQ.js → chunk-AJQ4AOT3.js} +4 -4
- package/dist/{chunk-JTCQ6QXQ.js.map → chunk-AJQ4AOT3.js.map} +1 -1
- package/dist/{chunk-FWG4TSPN.js → chunk-C7TXXTMS.js} +4 -5
- package/dist/chunk-C7TXXTMS.js.map +1 -0
- package/dist/{chunk-CWJ7ZCP7.js → chunk-CDDWXBEM.js} +87 -16
- package/dist/chunk-CDDWXBEM.js.map +1 -0
- package/dist/{chunk-7IYIFMF4.cjs → chunk-HHV5FPC6.cjs} +94 -20
- package/dist/chunk-HHV5FPC6.cjs.map +1 -0
- package/dist/{chunk-SOXGAA52.cjs → chunk-JAYOXOLT.cjs} +14 -14
- package/dist/{chunk-SOXGAA52.cjs.map → chunk-JAYOXOLT.cjs.map} +1 -1
- package/dist/{chunk-MQB5H4X5.cjs → chunk-L5ND2FJJ.cjs} +4 -5
- package/dist/chunk-L5ND2FJJ.cjs.map +1 -0
- package/dist/{chunk-P6VBP3CT.js → chunk-OCS5S3L3.js} +1010 -98
- package/dist/chunk-OCS5S3L3.js.map +1 -0
- package/dist/chunk-RQSA7ADZ.cjs +2286 -0
- package/dist/chunk-RQSA7ADZ.cjs.map +1 -0
- package/dist/{chunk-6TQJOD72.cjs → chunk-VE67GMGM.cjs} +7 -7
- package/dist/{chunk-6TQJOD72.cjs.map → chunk-VE67GMGM.cjs.map} +1 -1
- package/dist/{chunk-D46YDM36.cjs → chunk-WTTLIFS7.cjs} +1207 -285
- package/dist/chunk-WTTLIFS7.cjs.map +1 -0
- package/dist/chunk-XN3554FT.js +2244 -0
- package/dist/chunk-XN3554FT.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +11 -7
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-aOd5qINr.d.ts → delegate-CuaDqqQi.d.ts} +1 -1
- package/dist/{delegate-DVEgyRwI.d.cts → delegate-Dl87_zMA.d.cts} +1 -1
- package/dist/index-BC_G0VTh.d.cts +512 -0
- package/dist/index-CKwpZEpw.d.ts +512 -0
- package/dist/index.cjs +213 -161
- package/dist/index.d.cts +3097 -2090
- package/dist/index.d.ts +3097 -2090
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-B48-V-Pb.d.ts → taskRunner-Dz-TI4Rb.d.ts} +2 -2
- package/dist/{taskRunner-nNecmQ2C.d.cts → taskRunner-Dz47k0lp.d.cts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +5 -5
- package/dist/{wallet-BUg3D4WJ.d.cts → wallet-Oxz_wLxo.d.cts} +13 -3
- package/dist/{wallet-DM0oShTu.d.ts → wallet-x7egmXq6.d.ts} +13 -3
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-4KXOCVXP.cjs +0 -973
- package/dist/chunk-4KXOCVXP.cjs.map +0 -1
- package/dist/chunk-7IYIFMF4.cjs.map +0 -1
- package/dist/chunk-CWJ7ZCP7.js.map +0 -1
- package/dist/chunk-D46YDM36.cjs.map +0 -1
- package/dist/chunk-FWG4TSPN.js.map +0 -1
- package/dist/chunk-MQB5H4X5.cjs.map +0 -1
- package/dist/chunk-P6VBP3CT.js.map +0 -1
- package/dist/chunk-QKC2T54O.js +0 -960
- package/dist/chunk-QKC2T54O.js.map +0 -1
- package/dist/index-CPzL4tqg.d.ts +0 -259
- package/dist/index-D8vmtWWO.d.cts +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-C9ognsOV.cjs';
|
|
2
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DVEgyRwI.cjs';
|
|
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 };
|