@arkade-os/sdk 0.4.66 → 0.4.68
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/README.md +71 -15
- 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/{asyncStorageTaskQueue-BZcIN7sA.d.cts → asyncStorageTaskQueue-B2CcXIHU.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-B6SijMi3.d.ts → asyncStorageTaskQueue-DaZlVTbM.d.ts} +1 -1
- package/dist/{chunk-2JZGPXU4.js → chunk-33Q2RFET.js} +3 -3
- package/dist/{chunk-2JZGPXU4.js.map → chunk-33Q2RFET.js.map} +1 -1
- package/dist/{chunk-CYOI4PEA.js → chunk-45FKMOJH.js} +160 -114
- package/dist/chunk-45FKMOJH.js.map +1 -0
- package/dist/{chunk-J33ZEM3A.js → chunk-4CMXV5SF.js} +45 -14
- package/dist/chunk-4CMXV5SF.js.map +1 -0
- package/dist/{chunk-LL47QIHD.cjs → chunk-4KCVS4ZN.cjs} +10 -10
- package/dist/{chunk-LL47QIHD.cjs.map → chunk-4KCVS4ZN.cjs.map} +1 -1
- package/dist/{chunk-PXPPZF5K.cjs → chunk-6YUACVX4.cjs} +205 -159
- package/dist/chunk-6YUACVX4.cjs.map +1 -0
- package/dist/{chunk-ZIRFXBKL.cjs → chunk-EJOFL5WH.cjs} +47 -13
- package/dist/chunk-EJOFL5WH.cjs.map +1 -0
- package/dist/{chunk-R5POS3RS.js → chunk-G4I6PU5H.js} +4 -4
- package/dist/{chunk-R5POS3RS.js.map → chunk-G4I6PU5H.js.map} +1 -1
- package/dist/{chunk-55ZZ6RBL.js → chunk-GQ4NMQGR.js} +4 -4
- package/dist/{chunk-55ZZ6RBL.js.map → chunk-GQ4NMQGR.js.map} +1 -1
- package/dist/{chunk-IM6IKNSL.cjs → chunk-JGMSZIE4.cjs} +17 -17
- package/dist/{chunk-IM6IKNSL.cjs.map → chunk-JGMSZIE4.cjs.map} +1 -1
- package/dist/{chunk-3S3JZUEN.cjs → chunk-PJR63FTK.cjs} +17 -17
- package/dist/{chunk-3S3JZUEN.cjs.map → chunk-PJR63FTK.cjs.map} +1 -1
- package/dist/{chunk-DSC3G6QZ.js → chunk-VBHXBI7F.js} +1060 -185
- package/dist/chunk-VBHXBI7F.js.map +1 -0
- package/dist/{chunk-5E6IZNRG.cjs → chunk-WCJVKFAP.cjs} +1467 -581
- package/dist/chunk-WCJVKFAP.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- 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-T-vgxMYZ.d.ts → delegate-AomVWxO_.d.ts} +1 -1
- package/dist/{delegate-YXupcWWJ.d.cts → delegate-Bffc5f54.d.cts} +1 -1
- package/dist/{wallet-CNibc3yJ.d.ts → hdWalletCapable-B5nRs3RH.d.cts} +318 -127
- package/dist/{wallet-DJN1QgFt.d.cts → hdWalletCapable-DZdIVa23.d.ts} +318 -127
- package/dist/{index-uUE_uQPn.d.ts → index-C7RZCfoY.d.cts} +222 -19
- package/dist/{index-uUE_uQPn.d.cts → index-C7RZCfoY.d.ts} +222 -19
- package/dist/{index-e7LYXk1d.d.cts → index-jouvy8FD.d.ts} +172 -99
- package/dist/{index-D_FgwLH9.d.ts → index-nfyQM33h.d.cts} +172 -99
- package/dist/index.cjs +326 -278
- package/dist/index.d.cts +295 -41
- package/dist/index.d.ts +295 -41
- 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-BOVcIH1N.d.cts → taskRunner-D2vnpPBT.d.cts} +1 -1
- package/dist/{taskRunner-DNyD1kXG.d.ts → taskRunner-DuwK9t8O.d.ts} +1 -1
- 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 +18 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -5
- package/dist/wallet/expo/index.d.ts +7 -5
- package/dist/wallet/expo/index.js +10 -6
- package/dist/wallet/expo/index.js.map +1 -1
- 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 +3 -3
- package/dist/chunk-5E6IZNRG.cjs.map +0 -1
- package/dist/chunk-CYOI4PEA.js.map +0 -1
- package/dist/chunk-DSC3G6QZ.js.map +0 -1
- package/dist/chunk-J33ZEM3A.js.map +0 -1
- package/dist/chunk-PXPPZF5K.cjs.map +0 -1
- package/dist/chunk-ZIRFXBKL.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
1
|
+
import { bg as ContractHandler, s as RelativeTimelock, bs as Discoverable, V as VtxoScript, t as TapLeafScript, d5 as TapscriptDeriving } from './index-C7RZCfoY.js';
|
|
2
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-AomVWxO_.js';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -114,77 +114,79 @@ declare namespace VHTLC {
|
|
|
114
114
|
unilateralRefundDelay: RelativeTimelock;
|
|
115
115
|
unilateralRefundWithoutReceiverDelay: RelativeTimelock;
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
117
|
+
* The emulator covenant leaves, ALL OR NOTHING. Present, this adds the
|
|
118
|
+
* three non-interactive leaves the emulator co-signs under a covenant
|
|
119
|
+
* pinning the payout to a pre-committed destination:
|
|
120
|
+
*
|
|
121
|
+
* - `nonInteractiveClaim`: `server` + a covenant-tweaked emulator
|
|
122
|
+
* co-signer, paying `receiverPkScript` — the receiver's claim can
|
|
123
|
+
* be pushed without the receiver being online.
|
|
124
|
+
* - `nonInteractiveRefund`: `server` + `receiver` + a covenant-tweaked
|
|
125
|
+
* emulator co-signer, paying `senderPkScript`, no timelock — lets
|
|
126
|
+
* server and receiver release the refund the moment they agree the
|
|
127
|
+
* swap has failed, and recoverable even if the sender's own key is
|
|
128
|
+
* lost, since no OTHER refund-side leaf survives that.
|
|
129
|
+
* - `nonInteractiveRefundWithoutReceiver`: `server` + the SAME
|
|
130
|
+
* covenant-tweaked co-signer as `nonInteractiveRefund`, paying
|
|
131
|
+
* `senderPkScript` after `refundLocktime` — the only refund tier
|
|
132
|
+
* needing no participant signature at all, so a sender who funded
|
|
133
|
+
* a lockup and vanished is refundable through it alone.
|
|
134
|
+
*
|
|
135
|
+
* WHY ONE FLAG AND NOT A SWITCH PER LEAF. The three are one mechanism
|
|
136
|
+
* — the same emulator key, the same `enforcePayTo` covenant pointed
|
|
137
|
+
* at a per-role destination — and they protect opposite directions of
|
|
138
|
+
* the same swap, so no real configuration wants a subset. A subset
|
|
139
|
+
* would cost, not buy: every optional leaf multiplies the tree shapes
|
|
140
|
+
* a counterparty must derive to verify an address (nothing on the
|
|
141
|
+
* wire says which leaves a quote carries), so per-leaf toggling turns
|
|
142
|
+
* one address comparison into a combinatorial guess. All-or-nothing
|
|
143
|
+
* keeps the shape count at two: suite, or no suite.
|
|
144
|
+
*
|
|
145
|
+
* Leaf order fixes the taproot merkle root, so the suite is appended
|
|
146
|
+
* after the six signature leaves in a fixed order (claim, refund,
|
|
147
|
+
* timelocked refund) and a script built with this option NEVER
|
|
148
|
+
* collides with one built without it — which is what makes "did this
|
|
149
|
+
* quote opt in" a question an address comparison answers.
|
|
150
|
+
*
|
|
151
|
+
* STABLE PER RELEASE: what this option builds does not change within
|
|
152
|
+
* a published SDK version. A future covenant leaf joins the suite
|
|
153
|
+
* only behind a NEW option, so re-deriving a lockup with the SDK
|
|
154
|
+
* that quoted it reproduces its address byte-for-byte.
|
|
120
155
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
156
|
+
nonInteractiveParameters?: {
|
|
157
|
+
/**
|
|
158
|
+
* The emulator service's public key, 32-byte x-only or 33-byte
|
|
159
|
+
* compressed. ONE key, tweaked per covenant destination, becomes
|
|
160
|
+
* the co-signer of every leaf in the suite — the leaves share it
|
|
161
|
+
* structurally, and BIP-341 tapscript sighashes committing to the
|
|
162
|
+
* tapleaf hash are what keep a signature for one leaf from
|
|
163
|
+
* replaying against another.
|
|
164
|
+
*/
|
|
123
165
|
emulatorPubkey: Bytes;
|
|
124
166
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* ADDITIVE, NEVER A REPLACEMENT. The conservation bound stays. On
|
|
134
|
-
* its own, `out >= quoted` leaves everything ABOVE the quote
|
|
135
|
-
* unconstrained, so an overfunded lockup's surplus could be routed
|
|
136
|
-
* anywhere by whoever assembles the spend — trading an underfunding
|
|
137
|
-
* hole for a skimming one. Both bounds together admit neither.
|
|
138
|
-
*
|
|
139
|
-
* WHAT IT COSTS, and it is not only opcodes:
|
|
140
|
-
*
|
|
141
|
-
* - THE ADDRESS BECOMES A FUNCTION OF THE QUOTE. These amounts
|
|
142
|
-
* compile into the leaf, hence the emulator key, hence the
|
|
143
|
-
* pkScript. A re-quote is a different address, and cannot be
|
|
144
|
-
* applied to a lockup already funded.
|
|
145
|
-
* - AN UNDERFUNDED LOCKUP BECOMES UNCLAIMABLE. Its only exit is the
|
|
146
|
-
* refund path, which waits out the CLTV. That is the intended
|
|
147
|
-
* incentive and it lands on whoever misfunded — but it converts
|
|
148
|
-
* "claim the short amount now and settle up" into "wait for the
|
|
149
|
-
* timelock".
|
|
150
|
-
*
|
|
151
|
-
* Omit for the default. Omitting leaves every script byte unchanged,
|
|
152
|
-
* so contracts already funded keep their addresses.
|
|
167
|
+
* Where the claim covenant pays: the receiver's own P2TR
|
|
168
|
+
* pkScript, 34 bytes.
|
|
169
|
+
*/
|
|
170
|
+
receiverPkScript: Bytes;
|
|
171
|
+
/**
|
|
172
|
+
* Where BOTH refund covenants pay: the sender's own P2TR
|
|
173
|
+
* pkScript, 34 bytes. One destination shared by both refund
|
|
174
|
+
* leaves, so they cannot diverge on where a refund goes.
|
|
153
175
|
*/
|
|
154
|
-
strict?: {
|
|
155
|
-
/** Sats the claim must pay. Positive. */
|
|
156
|
-
amount: bigint;
|
|
157
|
-
/**
|
|
158
|
-
* Asset base units the claim must pay.
|
|
159
|
-
*
|
|
160
|
-
* Required iff {@link VHTLC.Options.asset} is set, and refused
|
|
161
|
-
* otherwise. Strict-on-sats-only against an asset-denominated
|
|
162
|
-
* contract would pin the sat CARRIER and say nothing about the
|
|
163
|
-
* asset that is the actual amount — half-enforcement that reads
|
|
164
|
-
* like enforcement, which is the failure this option exists to
|
|
165
|
-
* avoid rather than introduce.
|
|
166
|
-
*/
|
|
167
|
-
assetAmount?: bigint;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* Optional non-interactive refund leaf: `server` + `receiver` + a
|
|
172
|
-
* covenant-tweaked emulator co-signer, pinned to `senderPkScript`, no
|
|
173
|
-
* timelock. Every OTHER refund-side leaf in this contract requires
|
|
174
|
-
* the sender's own signature — if the sender permanently loses that
|
|
175
|
-
* key, none of them are reachable. This leaf is the one exception:
|
|
176
|
-
* it needs neither the sender's presence nor their key, so funds
|
|
177
|
-
* remain recoverable to the sender's pre-committed address even
|
|
178
|
-
* then. It still needs the receiver (unlike `nonInteractiveClaim`,
|
|
179
|
-
* which needs only server + emulator) — deliberately: this is what
|
|
180
|
-
* lets server + receiver release the refund immediately, the moment
|
|
181
|
-
* they agree the swap has failed, rather than making the sender wait
|
|
182
|
-
* out `refundLocktime` the way {@link Script.refundWithoutReceiver}
|
|
183
|
-
* does.
|
|
184
|
-
*/
|
|
185
|
-
nonInteractiveRefund?: {
|
|
186
176
|
senderPkScript: Bytes;
|
|
187
|
-
|
|
177
|
+
/**
|
|
178
|
+
* LEGACY REBUILD ONLY — never for a new lockup.
|
|
179
|
+
*
|
|
180
|
+
* `"preTimelockedRefund"` builds the suite WITHOUT its timelocked
|
|
181
|
+
* refund leaf: the shape every emulator-covenant lockup funded
|
|
182
|
+
* before that leaf shipped carries. Lockups already funded in that
|
|
183
|
+
* shape keep it permanently — a leaf cannot be retrofitted onto an
|
|
184
|
+
* address already committed — so re-deriving such a lockup (to
|
|
185
|
+
* spend it, or to verify an old quote's address) needs this. A new
|
|
186
|
+
* lockup that omits the leaf gives up the one refund tier needing
|
|
187
|
+
* nobody, for nothing.
|
|
188
|
+
*/
|
|
189
|
+
legacy?: "preTimelockedRefund";
|
|
188
190
|
};
|
|
189
191
|
/**
|
|
190
192
|
* Optional: denominate this contract in an Arkade ASSET rather than in
|
|
@@ -256,6 +258,8 @@ declare namespace VHTLC {
|
|
|
256
258
|
readonly nonInteractiveClaimArkadeScript?: Bytes;
|
|
257
259
|
readonly nonInteractiveRefundScript?: string;
|
|
258
260
|
readonly nonInteractiveRefundArkadeScript?: Bytes;
|
|
261
|
+
readonly nonInteractiveRefundWithoutReceiverScript?: string;
|
|
262
|
+
readonly nonInteractiveRefundWithoutReceiverArkadeScript?: Bytes;
|
|
259
263
|
protected constructor(options: Options, preimageCondition: (hash: Bytes) => Bytes);
|
|
260
264
|
/** Return the collaborative claim tapleaf script. */
|
|
261
265
|
claim(): TapLeafScript;
|
|
@@ -273,6 +277,59 @@ declare namespace VHTLC {
|
|
|
273
277
|
nonInteractiveClaim(): [TapLeafScript, Bytes];
|
|
274
278
|
/** Return the non-interactive refund tapleaf script as well as the ArkadeScript. */
|
|
275
279
|
nonInteractiveRefund(): [TapLeafScript, Bytes];
|
|
280
|
+
/**
|
|
281
|
+
* Return the timelocked non-interactive refund tapleaf and its ArkadeScript.
|
|
282
|
+
*
|
|
283
|
+
* SPENDING THIS LEAF, CONCRETELY — confirmed from this SDK's own
|
|
284
|
+
* emulator client and covenant-spend builder ({@link
|
|
285
|
+
* EmulatorProvider} in `src/providers/emulator.ts`, and {@link
|
|
286
|
+
* ArkadeTransactionBuilder} in `src/arkade/contract.ts`), which is
|
|
287
|
+
* the general machinery every covenant leaf in this file goes
|
|
288
|
+
* through:
|
|
289
|
+
*
|
|
290
|
+
* 1. Build the ark tx spending this leaf (this method's {@link
|
|
291
|
+
* TapLeafScript} as `tapLeafScript`, this script's {@link
|
|
292
|
+
* VtxoScript.encode} as `tapTree`), plus its checkpoint tx.
|
|
293
|
+
* 2. Attach the ArkadeScript this method returns to the spent
|
|
294
|
+
* input via an `EmulatorPacket` (type 1) — `{ vin, script:
|
|
295
|
+
* <this ArkadeScript>, witness: <empty> }`, empty because the
|
|
296
|
+
* script pushes its own input/output index with
|
|
297
|
+
* `PUSHCURRENTINPUTINDEX` rather than reading one from the
|
|
298
|
+
* witness — wrapped in an `Extension` OP_RETURN output on the
|
|
299
|
+
* ark tx.
|
|
300
|
+
* 3. Attach the spent input's OWN creating ark tx as `PrevArkTx` on
|
|
301
|
+
* input 0 — required so the emulator can resolve that input's
|
|
302
|
+
* prevout pkScript/value; it does not otherwise have them.
|
|
303
|
+
* 4. POST the (base64-PSBT) ark tx and checkpoint(s) as `{ arkTx,
|
|
304
|
+
* checkpointTxs }` to the emulator's `POST /v1/tx`.
|
|
305
|
+
*
|
|
306
|
+
* THE COVENANT CHECK the emulator runs against that ArkadeScript —
|
|
307
|
+
* `enforcePayTo(senderPkScript)`, see that function above — is: the
|
|
308
|
+
* output at this SAME input's index is a v1 P2TR output paying
|
|
309
|
+
* `senderPkScript`, with a value at least the input's. Only on that
|
|
310
|
+
* check passing does the emulator sign for `nirCosigner` (the
|
|
311
|
+
* `emulatorPubkey` tweaked by this ArkadeScript's hash); the
|
|
312
|
+
* response carries the fully co-signed `signedArkTx` and
|
|
313
|
+
* `signedCheckpointTxs` — `ArkadeTransactionBuilder.send()`'s own
|
|
314
|
+
* comment on this path: "the emulator executes the arkade script
|
|
315
|
+
* and finalizes with arkd" — no separate call to arkd is made by
|
|
316
|
+
* this SDK for a covenant spend.
|
|
317
|
+
* Neither `server` nor `receiver` play any part in that check: this
|
|
318
|
+
* leaf's tapscript still requires `server`'s own signature
|
|
319
|
+
* alongside `nirCosigner`'s (see the class doc above), but that is
|
|
320
|
+
* consensus-level multisig, not something the covenant enforces.
|
|
321
|
+
*
|
|
322
|
+
* NOT SPENDABLE UNTIL `refundLocktime` MATURES — the tapscript's
|
|
323
|
+
* `OP_CHECKLOCKTIMEVERIFY` is arkd's concern, not the emulator's;
|
|
324
|
+
* the emulator will happily co-sign an immature spend and arkd will
|
|
325
|
+
* then refuse it. A block-height-typed `refundLocktime` (below the
|
|
326
|
+
* standard height/timestamp boundary this SDK names
|
|
327
|
+
* `CLTV_HEIGHT_THRESHOLD`, 500,000,000, in
|
|
328
|
+
* `src/contracts/handlers/helpers.ts`) is refused by arkd for a
|
|
329
|
+
* forfeit-eligible leaf independent of maturity — use a
|
|
330
|
+
* seconds-typed (absolute Unix timestamp) value.
|
|
331
|
+
*/
|
|
332
|
+
nonInteractiveRefundWithoutReceiver(): [TapLeafScript, Bytes];
|
|
276
333
|
}
|
|
277
334
|
/**
|
|
278
335
|
* Virtual Hash Time Lock Contract (VHTLC) script implementation.
|
|
@@ -286,17 +343,34 @@ declare namespace VHTLC {
|
|
|
286
343
|
* - **unilateralClaim**: Receiver can claim unilaterally after delay
|
|
287
344
|
* - **unilateralRefund**: Sender and receiver can refund unilaterally after delay
|
|
288
345
|
* - **unilateralRefundWithoutReceiver**: Sender can refund unilaterally after delay
|
|
289
|
-
* - **nonInteractiveClaim** (
|
|
290
|
-
* receiver's claim, pinned to a pre-committed destination
|
|
291
|
-
* - **nonInteractiveRefund** (
|
|
292
|
-
* can push the sender's refund immediately, no timelock,
|
|
293
|
-
* pre-committed destination — recoverable even if the
|
|
294
|
-
* is lost
|
|
346
|
+
* - **nonInteractiveClaim** (with `nonInteractiveParameters`): server + emulator
|
|
347
|
+
* can push the receiver's claim, pinned to a pre-committed destination
|
|
348
|
+
* - **nonInteractiveRefund** (with `nonInteractiveParameters`): server + receiver
|
|
349
|
+
* + emulator can push the sender's refund immediately, no timelock,
|
|
350
|
+
* pinned to a pre-committed destination — recoverable even if the
|
|
351
|
+
* sender's own key is lost
|
|
352
|
+
* - **nonInteractiveRefundWithoutReceiver** (with `nonInteractiveParameters`):
|
|
353
|
+
* server + emulator can push the sender's refund after `refundLocktime`,
|
|
354
|
+
* pinned to a pre-committed destination — the only refund tier needing
|
|
355
|
+
* no participant signature at all
|
|
295
356
|
*
|
|
296
357
|
* See {@link ScriptV2} for the current recommended construction — same
|
|
297
358
|
* leaf ladder, same options shape, an added length check on the claim
|
|
298
359
|
* preimage. This class is unchanged and stays available as-is.
|
|
299
360
|
*
|
|
361
|
+
* **Pre-existing limitation: the `vhtlc` contract handler registers none
|
|
362
|
+
* of the covenant leaves.** `nonInteractiveParameters` builds on this class
|
|
363
|
+
* exactly as it does on {@link ScriptV2} — both extend the same
|
|
364
|
+
* `BaseScript` where those leaves are constructed. But the `vhtlc`
|
|
365
|
+
* contract handler (`src/contracts/handlers/vhtlc.ts`) round-trips none
|
|
366
|
+
* of them: its params type carries no covenant fields, and
|
|
367
|
+
* `createScript` only ever builds the six signature-only leaves. A V1
|
|
368
|
+
* script built with the covenant suite therefore compiles and can
|
|
369
|
+
* be funded, but cannot be registered as a `vhtlc` contract — the
|
|
370
|
+
* handler would derive a different (six-leaf) script for the same
|
|
371
|
+
* params and `ContractManager` refuses the mismatch. Register through
|
|
372
|
+
* the `vhtlc-v2` handler instead, which round-trips the suite.
|
|
373
|
+
*
|
|
300
374
|
* @example
|
|
301
375
|
* ```typescript
|
|
302
376
|
* const vhtlc = new VHTLC.Script({
|
|
@@ -367,9 +441,9 @@ declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.S
|
|
|
367
441
|
* The eight mandatory fields are `VHTLCContractParams` verbatim — the two
|
|
368
442
|
* script versions take the same {@link VHTLC.Options}, so a divergent shape
|
|
369
443
|
* here would be a difference with no cause. What V1's handler has no field for
|
|
370
|
-
* is the
|
|
371
|
-
*
|
|
372
|
-
*
|
|
444
|
+
* is the emulator covenant suite, and that is exactly what the swap corridor's
|
|
445
|
+
* lockup carries, so leaving it out would make this handler unable to
|
|
446
|
+
* round-trip the contract it exists to serve.
|
|
373
447
|
*/
|
|
374
448
|
interface VHTLCV2ContractParams {
|
|
375
449
|
sender: Uint8Array;
|
|
@@ -391,20 +465,18 @@ interface VHTLCV2ContractParams {
|
|
|
391
465
|
/** The asset group index within that genesis transaction. */
|
|
392
466
|
groupIndex: number;
|
|
393
467
|
};
|
|
394
|
-
/**
|
|
395
|
-
|
|
468
|
+
/**
|
|
469
|
+
* The emulator covenant suite, all or nothing — mirrors {@link
|
|
470
|
+
* VHTLC.Options.nonInteractiveParameters} exactly, including the legacy selector:
|
|
471
|
+
* a row funded before the timelocked refund leaf shipped round-trips with
|
|
472
|
+
* `legacy: "preTimelockedRefund"` and re-derives its eight-leaf shape.
|
|
473
|
+
*/
|
|
474
|
+
nonInteractiveParameters?: {
|
|
396
475
|
receiverPkScript: Uint8Array;
|
|
397
476
|
emulatorPubkey: Uint8Array;
|
|
398
|
-
/** @see VHTLC.Options.nonInteractiveClaim.strict */
|
|
399
|
-
strict?: {
|
|
400
|
-
amount: bigint;
|
|
401
|
-
assetAmount?: bigint;
|
|
402
|
-
};
|
|
403
|
-
};
|
|
404
|
-
/** @see VHTLC.Options.nonInteractiveRefund */
|
|
405
|
-
nonInteractiveRefund?: {
|
|
406
477
|
senderPkScript: Uint8Array;
|
|
407
|
-
|
|
478
|
+
/** @see VHTLC.Options.nonInteractiveParameters.legacy */
|
|
479
|
+
legacy?: "preTimelockedRefund";
|
|
408
480
|
};
|
|
409
481
|
}
|
|
410
482
|
/**
|
|
@@ -426,21 +498,22 @@ interface VHTLCV2ContractParams {
|
|
|
426
498
|
* the same ScriptV2 the two uses would fight over one row.
|
|
427
499
|
*
|
|
428
500
|
* **Which leaves this offers, and why the set is smaller than the ladder.**
|
|
429
|
-
* ScriptV2 has
|
|
501
|
+
* ScriptV2 has nine leaves; a wallet holding ONE of the two participant keys
|
|
430
502
|
* can satisfy four of them, and offering a leaf whose signature the caller
|
|
431
503
|
* cannot produce is worse than offering fewer — it turns a refusal into a
|
|
432
504
|
* transaction that gets built and then rejected.
|
|
433
505
|
*
|
|
434
|
-
* | leaf
|
|
435
|
-
*
|
|
436
|
-
* | `claim`
|
|
437
|
-
* | `refund`
|
|
438
|
-
* | `refundWithoutReceiver`
|
|
439
|
-
* | `unilateralClaim`
|
|
440
|
-
* | `unilateralRefund`
|
|
441
|
-
* | `unilateralRefundWithoutReceiver`
|
|
442
|
-
* | `nonInteractiveClaim`
|
|
443
|
-
* | `nonInteractiveRefund`
|
|
506
|
+
* | leaf | needs | offered |
|
|
507
|
+
* |---------------------------------------|--------------------------------|---------|
|
|
508
|
+
* | `claim` | receiver + server, preimage | yes, to the receiver |
|
|
509
|
+
* | `refund` | sender + receiver + server | no — needs the counterparty live |
|
|
510
|
+
* | `refundWithoutReceiver` | sender + server, CLTV | yes, to the sender |
|
|
511
|
+
* | `unilateralClaim` | receiver, CSV | yes, to the receiver |
|
|
512
|
+
* | `unilateralRefund` | sender + receiver, CSV | no — needs the counterparty live |
|
|
513
|
+
* | `unilateralRefundWithoutReceiver` | sender, CSV | yes, to the sender |
|
|
514
|
+
* | `nonInteractiveClaim` | server + emulator | no — the wallet holds neither key |
|
|
515
|
+
* | `nonInteractiveRefund` | server + receiver + emulator | no — the wallet holds neither key |
|
|
516
|
+
* | `nonInteractiveRefundWithoutReceiver` | server + emulator, CLTV | no — the wallet holds neither key |
|
|
444
517
|
*
|
|
445
518
|
* The two omitted interactive leaves are the same two the `vhtlc` handler
|
|
446
519
|
* omits, for the same reason: `refund` and `unilateralRefund` both need the
|