@arkade-os/sdk 0.4.65 → 0.4.67
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 +66 -15
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +3 -6
- package/dist/adapters/expo.d.ts +3 -6
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-Chwe60Ce.d.cts → asyncStorageTaskQueue-LTpeXYaD.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-Dq_UcvDx.d.ts → asyncStorageTaskQueue-Za-e_zMk.d.ts} +2 -2
- package/dist/{chunk-G552MISJ.cjs → chunk-2JV4VQ7C.cjs} +56 -28
- package/dist/chunk-2JV4VQ7C.cjs.map +1 -0
- package/dist/{chunk-TFSVXMTM.js → chunk-3WIWNE4P.js} +56 -29
- package/dist/chunk-3WIWNE4P.js.map +1 -0
- package/dist/{chunk-XMOIRDLF.js → chunk-6TAQF6EV.js} +118 -16
- package/dist/chunk-6TAQF6EV.js.map +1 -0
- package/dist/{chunk-5YTSQSLE.js → chunk-AEWJU6NZ.js} +1033 -193
- package/dist/chunk-AEWJU6NZ.js.map +1 -0
- package/dist/{chunk-XN55B6EP.cjs → chunk-CO3KKSWM.cjs} +46 -19
- package/dist/chunk-CO3KKSWM.cjs.map +1 -0
- package/dist/{chunk-RESN6QHP.js → chunk-EALWOVHK.js} +4 -4
- package/dist/{chunk-RESN6QHP.js.map → chunk-EALWOVHK.js.map} +1 -1
- package/dist/{chunk-GFZNEMGL.cjs → chunk-MJUTO3PY.cjs} +1425 -574
- package/dist/chunk-MJUTO3PY.cjs.map +1 -0
- package/dist/{chunk-TYTPVPKD.js → chunk-MZFUZUTQ.js} +4 -4
- package/dist/{chunk-TYTPVPKD.js.map → chunk-MZFUZUTQ.js.map} +1 -1
- package/dist/{chunk-BABJ77NG.cjs → chunk-OIZ2V2VD.cjs} +163 -60
- package/dist/chunk-OIZ2V2VD.cjs.map +1 -0
- package/dist/{chunk-SJQM5AVB.cjs → chunk-R2YAMONM.cjs} +17 -17
- package/dist/{chunk-SJQM5AVB.cjs.map → chunk-R2YAMONM.cjs.map} +1 -1
- package/dist/{chunk-3G5V564P.js → chunk-X3VEMUVV.js} +32 -6
- package/dist/chunk-X3VEMUVV.js.map +1 -0
- package/dist/{chunk-7X744EFF.cjs → chunk-YDRZDZPP.cjs} +10 -10
- package/dist/{chunk-7X744EFF.cjs.map → chunk-YDRZDZPP.cjs.map} +1 -1
- 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-BBQW61ym.d.cts → delegate-Bz2e2zXY.d.cts} +1 -1
- package/dist/{delegate-Dv_9OVHv.d.ts → delegate-cdmzb2f9.d.ts} +1 -1
- package/dist/{wallet-DJUnN939.d.ts → hdWalletCapable-BSjuUYOO.d.cts} +319 -128
- package/dist/{wallet-C2NvHjWB.d.cts → hdWalletCapable-Hi12xjCJ.d.ts} +319 -128
- package/dist/{index-fDDiA1-L.d.ts → index-BiACuWaf.d.ts} +109 -13
- package/dist/{index-BtTtQFUX.d.cts → index-D2GjZxBr.d.cts} +109 -13
- package/dist/{index-CFOMyVMt.d.cts → index-DU5o_hz7.d.cts} +275 -51
- package/dist/{index-CFOMyVMt.d.ts → index-DU5o_hz7.d.ts} +275 -51
- package/dist/index.cjs +328 -276
- package/dist/index.d.cts +312 -41
- package/dist/index.d.ts +312 -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-CIKOS2OO.d.cts → taskRunner-BZJMLQ6g.d.cts} +2 -2
- package/dist/{taskRunner-BDzWbpct.d.ts → taskRunner-DATaRQus.d.ts} +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 +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-3G5V564P.js.map +0 -1
- package/dist/chunk-5YTSQSLE.js.map +0 -1
- package/dist/chunk-BABJ77NG.cjs.map +0 -1
- package/dist/chunk-G552MISJ.cjs.map +0 -1
- package/dist/chunk-GFZNEMGL.cjs.map +0 -1
- package/dist/chunk-TFSVXMTM.js.map +0 -1
- package/dist/chunk-XMOIRDLF.js.map +0 -1
- package/dist/chunk-XN55B6EP.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, d4 as TapscriptDeriving } from './index-DU5o_hz7.js';
|
|
2
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-cdmzb2f9.js';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -185,6 +185,25 @@ declare namespace VHTLC {
|
|
|
185
185
|
nonInteractiveRefund?: {
|
|
186
186
|
senderPkScript: Bytes;
|
|
187
187
|
emulatorPubkey: Bytes;
|
|
188
|
+
/**
|
|
189
|
+
* Also emit the timelocked twin: `server` plus the SAME
|
|
190
|
+
* covenant-tweaked co-signer, spendable after `refundLocktime`
|
|
191
|
+
* with no receiver signature and no sender signature.
|
|
192
|
+
*
|
|
193
|
+
* This is the only refund tier that needs nobody: `refund` and
|
|
194
|
+
* `refundWithoutReceiver` need the sender's key,
|
|
195
|
+
* `nonInteractiveRefund` needs the receiver's. A sender who
|
|
196
|
+
* funded a lockup and vanished is refundable through this leaf
|
|
197
|
+
* alone, by anyone, to their pre-committed address.
|
|
198
|
+
*
|
|
199
|
+
* Off by default: it is an additional leaf, appended last, so
|
|
200
|
+
* enabling it changes the taproot merkle root and therefore the
|
|
201
|
+
* address. `nonInteractiveClaim` and `nonInteractiveRefund` are
|
|
202
|
+
* independently optional, so this is the NINTH leaf only in the
|
|
203
|
+
* full swap-corridor configuration where both are set — on its
|
|
204
|
+
* own, it is the eighth.
|
|
205
|
+
*/
|
|
206
|
+
withoutReceiver?: boolean;
|
|
188
207
|
};
|
|
189
208
|
/**
|
|
190
209
|
* Optional: denominate this contract in an Arkade ASSET rather than in
|
|
@@ -256,6 +275,8 @@ declare namespace VHTLC {
|
|
|
256
275
|
readonly nonInteractiveClaimArkadeScript?: Bytes;
|
|
257
276
|
readonly nonInteractiveRefundScript?: string;
|
|
258
277
|
readonly nonInteractiveRefundArkadeScript?: Bytes;
|
|
278
|
+
readonly nonInteractiveRefundWithoutReceiverScript?: string;
|
|
279
|
+
readonly nonInteractiveRefundWithoutReceiverArkadeScript?: Bytes;
|
|
259
280
|
protected constructor(options: Options, preimageCondition: (hash: Bytes) => Bytes);
|
|
260
281
|
/** Return the collaborative claim tapleaf script. */
|
|
261
282
|
claim(): TapLeafScript;
|
|
@@ -273,6 +294,59 @@ declare namespace VHTLC {
|
|
|
273
294
|
nonInteractiveClaim(): [TapLeafScript, Bytes];
|
|
274
295
|
/** Return the non-interactive refund tapleaf script as well as the ArkadeScript. */
|
|
275
296
|
nonInteractiveRefund(): [TapLeafScript, Bytes];
|
|
297
|
+
/**
|
|
298
|
+
* Return the timelocked non-interactive refund tapleaf and its ArkadeScript.
|
|
299
|
+
*
|
|
300
|
+
* SPENDING THIS LEAF, CONCRETELY — confirmed from this SDK's own
|
|
301
|
+
* emulator client and covenant-spend builder ({@link
|
|
302
|
+
* EmulatorProvider} in `src/providers/emulator.ts`, and {@link
|
|
303
|
+
* ArkadeTransactionBuilder} in `src/arkade/contract.ts`), which is
|
|
304
|
+
* the general machinery every covenant leaf in this file goes
|
|
305
|
+
* through:
|
|
306
|
+
*
|
|
307
|
+
* 1. Build the ark tx spending this leaf (this method's {@link
|
|
308
|
+
* TapLeafScript} as `tapLeafScript`, this script's {@link
|
|
309
|
+
* VtxoScript.encode} as `tapTree`), plus its checkpoint tx.
|
|
310
|
+
* 2. Attach the ArkadeScript this method returns to the spent
|
|
311
|
+
* input via an `EmulatorPacket` (type 1) — `{ vin, script:
|
|
312
|
+
* <this ArkadeScript>, witness: <empty> }`, empty because the
|
|
313
|
+
* script pushes its own input/output index with
|
|
314
|
+
* `PUSHCURRENTINPUTINDEX` rather than reading one from the
|
|
315
|
+
* witness — wrapped in an `Extension` OP_RETURN output on the
|
|
316
|
+
* ark tx.
|
|
317
|
+
* 3. Attach the spent input's OWN creating ark tx as `PrevArkTx` on
|
|
318
|
+
* input 0 — required so the emulator can resolve that input's
|
|
319
|
+
* prevout pkScript/value; it does not otherwise have them.
|
|
320
|
+
* 4. POST the (base64-PSBT) ark tx and checkpoint(s) as `{ arkTx,
|
|
321
|
+
* checkpointTxs }` to the emulator's `POST /v1/tx`.
|
|
322
|
+
*
|
|
323
|
+
* THE COVENANT CHECK the emulator runs against that ArkadeScript —
|
|
324
|
+
* `enforcePayTo(senderPkScript)`, see that function above — is: the
|
|
325
|
+
* output at this SAME input's index is a v1 P2TR output paying
|
|
326
|
+
* `senderPkScript`, with a value at least the input's. Only on that
|
|
327
|
+
* check passing does the emulator sign for `nirCosigner` (the
|
|
328
|
+
* `emulatorPubkey` tweaked by this ArkadeScript's hash); the
|
|
329
|
+
* response carries the fully co-signed `signedArkTx` and
|
|
330
|
+
* `signedCheckpointTxs` — `ArkadeTransactionBuilder.send()`'s own
|
|
331
|
+
* comment on this path: "the emulator executes the arkade script
|
|
332
|
+
* and finalizes with arkd" — no separate call to arkd is made by
|
|
333
|
+
* this SDK for a covenant spend.
|
|
334
|
+
* Neither `server` nor `receiver` play any part in that check: this
|
|
335
|
+
* leaf's tapscript still requires `server`'s own signature
|
|
336
|
+
* alongside `nirCosigner`'s (see the class doc above), but that is
|
|
337
|
+
* consensus-level multisig, not something the covenant enforces.
|
|
338
|
+
*
|
|
339
|
+
* NOT SPENDABLE UNTIL `refundLocktime` MATURES — the tapscript's
|
|
340
|
+
* `OP_CHECKLOCKTIMEVERIFY` is arkd's concern, not the emulator's;
|
|
341
|
+
* the emulator will happily co-sign an immature spend and arkd will
|
|
342
|
+
* then refuse it. A block-height-typed `refundLocktime` (below the
|
|
343
|
+
* standard height/timestamp boundary this SDK names
|
|
344
|
+
* `CLTV_HEIGHT_THRESHOLD`, 500,000,000, in
|
|
345
|
+
* `src/contracts/handlers/helpers.ts`) is refused by arkd for a
|
|
346
|
+
* forfeit-eligible leaf independent of maturity — use a
|
|
347
|
+
* seconds-typed (absolute Unix timestamp) value.
|
|
348
|
+
*/
|
|
349
|
+
nonInteractiveRefundWithoutReceiver(): [TapLeafScript, Bytes];
|
|
276
350
|
}
|
|
277
351
|
/**
|
|
278
352
|
* Virtual Hash Time Lock Contract (VHTLC) script implementation.
|
|
@@ -292,11 +366,30 @@ declare namespace VHTLC {
|
|
|
292
366
|
* can push the sender's refund immediately, no timelock, pinned to a
|
|
293
367
|
* pre-committed destination — recoverable even if the sender's own key
|
|
294
368
|
* is lost
|
|
369
|
+
* - **nonInteractiveRefundWithoutReceiver** (optional): server + emulator
|
|
370
|
+
* can push the sender's refund after `refundLocktime`, pinned to a
|
|
371
|
+
* pre-committed destination — the only refund tier needing no
|
|
372
|
+
* participant signature at all
|
|
295
373
|
*
|
|
296
374
|
* See {@link ScriptV2} for the current recommended construction — same
|
|
297
375
|
* leaf ladder, same options shape, an added length check on the claim
|
|
298
376
|
* preimage. This class is unchanged and stays available as-is.
|
|
299
377
|
*
|
|
378
|
+
* **Pre-existing limitation, widened rather than introduced by
|
|
379
|
+
* `nonInteractiveRefundWithoutReceiver`.** `nonInteractiveClaim` and
|
|
380
|
+
* `nonInteractiveRefund` (and now its `withoutReceiver` leaf) build on
|
|
381
|
+
* this class exactly as they do on {@link ScriptV2} — both extend the
|
|
382
|
+
* same `BaseScript` where these leaves are constructed. But the `vhtlc`
|
|
383
|
+
* contract handler (`src/contracts/handlers/vhtlc.ts`) round-trips none
|
|
384
|
+
* of them: its params type carries no covenant fields, and
|
|
385
|
+
* `createScript` only ever builds the six signature-only leaves. A V1
|
|
386
|
+
* script built with either covenant option therefore compiles and can
|
|
387
|
+
* be funded, but cannot be registered as a `vhtlc` contract — the
|
|
388
|
+
* handler would derive a different (six-leaf) script for the same
|
|
389
|
+
* params and `ContractManager` refuses the mismatch. This was already
|
|
390
|
+
* true before `withoutReceiver` existed; it now applies to one more
|
|
391
|
+
* option than before, not to a newly-exposed one.
|
|
392
|
+
*
|
|
300
393
|
* @example
|
|
301
394
|
* ```typescript
|
|
302
395
|
* const vhtlc = new VHTLC.Script({
|
|
@@ -405,6 +498,8 @@ interface VHTLCV2ContractParams {
|
|
|
405
498
|
nonInteractiveRefund?: {
|
|
406
499
|
senderPkScript: Uint8Array;
|
|
407
500
|
emulatorPubkey: Uint8Array;
|
|
501
|
+
/** @see VHTLC.Options.nonInteractiveRefund.withoutReceiver */
|
|
502
|
+
withoutReceiver?: boolean;
|
|
408
503
|
};
|
|
409
504
|
}
|
|
410
505
|
/**
|
|
@@ -426,21 +521,22 @@ interface VHTLCV2ContractParams {
|
|
|
426
521
|
* the same ScriptV2 the two uses would fight over one row.
|
|
427
522
|
*
|
|
428
523
|
* **Which leaves this offers, and why the set is smaller than the ladder.**
|
|
429
|
-
* ScriptV2 has
|
|
524
|
+
* ScriptV2 has nine leaves; a wallet holding ONE of the two participant keys
|
|
430
525
|
* can satisfy four of them, and offering a leaf whose signature the caller
|
|
431
526
|
* cannot produce is worse than offering fewer — it turns a refusal into a
|
|
432
527
|
* transaction that gets built and then rejected.
|
|
433
528
|
*
|
|
434
|
-
* | leaf
|
|
435
|
-
*
|
|
436
|
-
* | `claim`
|
|
437
|
-
* | `refund`
|
|
438
|
-
* | `refundWithoutReceiver`
|
|
439
|
-
* | `unilateralClaim`
|
|
440
|
-
* | `unilateralRefund`
|
|
441
|
-
* | `unilateralRefundWithoutReceiver`
|
|
442
|
-
* | `nonInteractiveClaim`
|
|
443
|
-
* | `nonInteractiveRefund`
|
|
529
|
+
* | leaf | needs | offered |
|
|
530
|
+
* |---------------------------------------|--------------------------------|---------|
|
|
531
|
+
* | `claim` | receiver + server, preimage | yes, to the receiver |
|
|
532
|
+
* | `refund` | sender + receiver + server | no — needs the counterparty live |
|
|
533
|
+
* | `refundWithoutReceiver` | sender + server, CLTV | yes, to the sender |
|
|
534
|
+
* | `unilateralClaim` | receiver, CSV | yes, to the receiver |
|
|
535
|
+
* | `unilateralRefund` | sender + receiver, CSV | no — needs the counterparty live |
|
|
536
|
+
* | `unilateralRefundWithoutReceiver` | sender, CSV | yes, to the sender |
|
|
537
|
+
* | `nonInteractiveClaim` | server + emulator | no — the wallet holds neither key |
|
|
538
|
+
* | `nonInteractiveRefund` | server + receiver + emulator | no — the wallet holds neither key |
|
|
539
|
+
* | `nonInteractiveRefundWithoutReceiver` | server + emulator, CLTV | no — the wallet holds neither key |
|
|
444
540
|
*
|
|
445
541
|
* The two omitted interactive leaves are the same two the `vhtlc` handler
|
|
446
542
|
* omits, for the same reason: `refund` and `unilateralRefund` both need the
|
|
@@ -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, d4 as TapscriptDeriving } from './index-DU5o_hz7.cjs';
|
|
2
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-Bz2e2zXY.cjs';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -185,6 +185,25 @@ declare namespace VHTLC {
|
|
|
185
185
|
nonInteractiveRefund?: {
|
|
186
186
|
senderPkScript: Bytes;
|
|
187
187
|
emulatorPubkey: Bytes;
|
|
188
|
+
/**
|
|
189
|
+
* Also emit the timelocked twin: `server` plus the SAME
|
|
190
|
+
* covenant-tweaked co-signer, spendable after `refundLocktime`
|
|
191
|
+
* with no receiver signature and no sender signature.
|
|
192
|
+
*
|
|
193
|
+
* This is the only refund tier that needs nobody: `refund` and
|
|
194
|
+
* `refundWithoutReceiver` need the sender's key,
|
|
195
|
+
* `nonInteractiveRefund` needs the receiver's. A sender who
|
|
196
|
+
* funded a lockup and vanished is refundable through this leaf
|
|
197
|
+
* alone, by anyone, to their pre-committed address.
|
|
198
|
+
*
|
|
199
|
+
* Off by default: it is an additional leaf, appended last, so
|
|
200
|
+
* enabling it changes the taproot merkle root and therefore the
|
|
201
|
+
* address. `nonInteractiveClaim` and `nonInteractiveRefund` are
|
|
202
|
+
* independently optional, so this is the NINTH leaf only in the
|
|
203
|
+
* full swap-corridor configuration where both are set — on its
|
|
204
|
+
* own, it is the eighth.
|
|
205
|
+
*/
|
|
206
|
+
withoutReceiver?: boolean;
|
|
188
207
|
};
|
|
189
208
|
/**
|
|
190
209
|
* Optional: denominate this contract in an Arkade ASSET rather than in
|
|
@@ -256,6 +275,8 @@ declare namespace VHTLC {
|
|
|
256
275
|
readonly nonInteractiveClaimArkadeScript?: Bytes;
|
|
257
276
|
readonly nonInteractiveRefundScript?: string;
|
|
258
277
|
readonly nonInteractiveRefundArkadeScript?: Bytes;
|
|
278
|
+
readonly nonInteractiveRefundWithoutReceiverScript?: string;
|
|
279
|
+
readonly nonInteractiveRefundWithoutReceiverArkadeScript?: Bytes;
|
|
259
280
|
protected constructor(options: Options, preimageCondition: (hash: Bytes) => Bytes);
|
|
260
281
|
/** Return the collaborative claim tapleaf script. */
|
|
261
282
|
claim(): TapLeafScript;
|
|
@@ -273,6 +294,59 @@ declare namespace VHTLC {
|
|
|
273
294
|
nonInteractiveClaim(): [TapLeafScript, Bytes];
|
|
274
295
|
/** Return the non-interactive refund tapleaf script as well as the ArkadeScript. */
|
|
275
296
|
nonInteractiveRefund(): [TapLeafScript, Bytes];
|
|
297
|
+
/**
|
|
298
|
+
* Return the timelocked non-interactive refund tapleaf and its ArkadeScript.
|
|
299
|
+
*
|
|
300
|
+
* SPENDING THIS LEAF, CONCRETELY — confirmed from this SDK's own
|
|
301
|
+
* emulator client and covenant-spend builder ({@link
|
|
302
|
+
* EmulatorProvider} in `src/providers/emulator.ts`, and {@link
|
|
303
|
+
* ArkadeTransactionBuilder} in `src/arkade/contract.ts`), which is
|
|
304
|
+
* the general machinery every covenant leaf in this file goes
|
|
305
|
+
* through:
|
|
306
|
+
*
|
|
307
|
+
* 1. Build the ark tx spending this leaf (this method's {@link
|
|
308
|
+
* TapLeafScript} as `tapLeafScript`, this script's {@link
|
|
309
|
+
* VtxoScript.encode} as `tapTree`), plus its checkpoint tx.
|
|
310
|
+
* 2. Attach the ArkadeScript this method returns to the spent
|
|
311
|
+
* input via an `EmulatorPacket` (type 1) — `{ vin, script:
|
|
312
|
+
* <this ArkadeScript>, witness: <empty> }`, empty because the
|
|
313
|
+
* script pushes its own input/output index with
|
|
314
|
+
* `PUSHCURRENTINPUTINDEX` rather than reading one from the
|
|
315
|
+
* witness — wrapped in an `Extension` OP_RETURN output on the
|
|
316
|
+
* ark tx.
|
|
317
|
+
* 3. Attach the spent input's OWN creating ark tx as `PrevArkTx` on
|
|
318
|
+
* input 0 — required so the emulator can resolve that input's
|
|
319
|
+
* prevout pkScript/value; it does not otherwise have them.
|
|
320
|
+
* 4. POST the (base64-PSBT) ark tx and checkpoint(s) as `{ arkTx,
|
|
321
|
+
* checkpointTxs }` to the emulator's `POST /v1/tx`.
|
|
322
|
+
*
|
|
323
|
+
* THE COVENANT CHECK the emulator runs against that ArkadeScript —
|
|
324
|
+
* `enforcePayTo(senderPkScript)`, see that function above — is: the
|
|
325
|
+
* output at this SAME input's index is a v1 P2TR output paying
|
|
326
|
+
* `senderPkScript`, with a value at least the input's. Only on that
|
|
327
|
+
* check passing does the emulator sign for `nirCosigner` (the
|
|
328
|
+
* `emulatorPubkey` tweaked by this ArkadeScript's hash); the
|
|
329
|
+
* response carries the fully co-signed `signedArkTx` and
|
|
330
|
+
* `signedCheckpointTxs` — `ArkadeTransactionBuilder.send()`'s own
|
|
331
|
+
* comment on this path: "the emulator executes the arkade script
|
|
332
|
+
* and finalizes with arkd" — no separate call to arkd is made by
|
|
333
|
+
* this SDK for a covenant spend.
|
|
334
|
+
* Neither `server` nor `receiver` play any part in that check: this
|
|
335
|
+
* leaf's tapscript still requires `server`'s own signature
|
|
336
|
+
* alongside `nirCosigner`'s (see the class doc above), but that is
|
|
337
|
+
* consensus-level multisig, not something the covenant enforces.
|
|
338
|
+
*
|
|
339
|
+
* NOT SPENDABLE UNTIL `refundLocktime` MATURES — the tapscript's
|
|
340
|
+
* `OP_CHECKLOCKTIMEVERIFY` is arkd's concern, not the emulator's;
|
|
341
|
+
* the emulator will happily co-sign an immature spend and arkd will
|
|
342
|
+
* then refuse it. A block-height-typed `refundLocktime` (below the
|
|
343
|
+
* standard height/timestamp boundary this SDK names
|
|
344
|
+
* `CLTV_HEIGHT_THRESHOLD`, 500,000,000, in
|
|
345
|
+
* `src/contracts/handlers/helpers.ts`) is refused by arkd for a
|
|
346
|
+
* forfeit-eligible leaf independent of maturity — use a
|
|
347
|
+
* seconds-typed (absolute Unix timestamp) value.
|
|
348
|
+
*/
|
|
349
|
+
nonInteractiveRefundWithoutReceiver(): [TapLeafScript, Bytes];
|
|
276
350
|
}
|
|
277
351
|
/**
|
|
278
352
|
* Virtual Hash Time Lock Contract (VHTLC) script implementation.
|
|
@@ -292,11 +366,30 @@ declare namespace VHTLC {
|
|
|
292
366
|
* can push the sender's refund immediately, no timelock, pinned to a
|
|
293
367
|
* pre-committed destination — recoverable even if the sender's own key
|
|
294
368
|
* is lost
|
|
369
|
+
* - **nonInteractiveRefundWithoutReceiver** (optional): server + emulator
|
|
370
|
+
* can push the sender's refund after `refundLocktime`, pinned to a
|
|
371
|
+
* pre-committed destination — the only refund tier needing no
|
|
372
|
+
* participant signature at all
|
|
295
373
|
*
|
|
296
374
|
* See {@link ScriptV2} for the current recommended construction — same
|
|
297
375
|
* leaf ladder, same options shape, an added length check on the claim
|
|
298
376
|
* preimage. This class is unchanged and stays available as-is.
|
|
299
377
|
*
|
|
378
|
+
* **Pre-existing limitation, widened rather than introduced by
|
|
379
|
+
* `nonInteractiveRefundWithoutReceiver`.** `nonInteractiveClaim` and
|
|
380
|
+
* `nonInteractiveRefund` (and now its `withoutReceiver` leaf) build on
|
|
381
|
+
* this class exactly as they do on {@link ScriptV2} — both extend the
|
|
382
|
+
* same `BaseScript` where these leaves are constructed. But the `vhtlc`
|
|
383
|
+
* contract handler (`src/contracts/handlers/vhtlc.ts`) round-trips none
|
|
384
|
+
* of them: its params type carries no covenant fields, and
|
|
385
|
+
* `createScript` only ever builds the six signature-only leaves. A V1
|
|
386
|
+
* script built with either covenant option therefore compiles and can
|
|
387
|
+
* be funded, but cannot be registered as a `vhtlc` contract — the
|
|
388
|
+
* handler would derive a different (six-leaf) script for the same
|
|
389
|
+
* params and `ContractManager` refuses the mismatch. This was already
|
|
390
|
+
* true before `withoutReceiver` existed; it now applies to one more
|
|
391
|
+
* option than before, not to a newly-exposed one.
|
|
392
|
+
*
|
|
300
393
|
* @example
|
|
301
394
|
* ```typescript
|
|
302
395
|
* const vhtlc = new VHTLC.Script({
|
|
@@ -405,6 +498,8 @@ interface VHTLCV2ContractParams {
|
|
|
405
498
|
nonInteractiveRefund?: {
|
|
406
499
|
senderPkScript: Uint8Array;
|
|
407
500
|
emulatorPubkey: Uint8Array;
|
|
501
|
+
/** @see VHTLC.Options.nonInteractiveRefund.withoutReceiver */
|
|
502
|
+
withoutReceiver?: boolean;
|
|
408
503
|
};
|
|
409
504
|
}
|
|
410
505
|
/**
|
|
@@ -426,21 +521,22 @@ interface VHTLCV2ContractParams {
|
|
|
426
521
|
* the same ScriptV2 the two uses would fight over one row.
|
|
427
522
|
*
|
|
428
523
|
* **Which leaves this offers, and why the set is smaller than the ladder.**
|
|
429
|
-
* ScriptV2 has
|
|
524
|
+
* ScriptV2 has nine leaves; a wallet holding ONE of the two participant keys
|
|
430
525
|
* can satisfy four of them, and offering a leaf whose signature the caller
|
|
431
526
|
* cannot produce is worse than offering fewer — it turns a refusal into a
|
|
432
527
|
* transaction that gets built and then rejected.
|
|
433
528
|
*
|
|
434
|
-
* | leaf
|
|
435
|
-
*
|
|
436
|
-
* | `claim`
|
|
437
|
-
* | `refund`
|
|
438
|
-
* | `refundWithoutReceiver`
|
|
439
|
-
* | `unilateralClaim`
|
|
440
|
-
* | `unilateralRefund`
|
|
441
|
-
* | `unilateralRefundWithoutReceiver`
|
|
442
|
-
* | `nonInteractiveClaim`
|
|
443
|
-
* | `nonInteractiveRefund`
|
|
529
|
+
* | leaf | needs | offered |
|
|
530
|
+
* |---------------------------------------|--------------------------------|---------|
|
|
531
|
+
* | `claim` | receiver + server, preimage | yes, to the receiver |
|
|
532
|
+
* | `refund` | sender + receiver + server | no — needs the counterparty live |
|
|
533
|
+
* | `refundWithoutReceiver` | sender + server, CLTV | yes, to the sender |
|
|
534
|
+
* | `unilateralClaim` | receiver, CSV | yes, to the receiver |
|
|
535
|
+
* | `unilateralRefund` | sender + receiver, CSV | no — needs the counterparty live |
|
|
536
|
+
* | `unilateralRefundWithoutReceiver` | sender, CSV | yes, to the sender |
|
|
537
|
+
* | `nonInteractiveClaim` | server + emulator | no — the wallet holds neither key |
|
|
538
|
+
* | `nonInteractiveRefund` | server + receiver + emulator | no — the wallet holds neither key |
|
|
539
|
+
* | `nonInteractiveRefundWithoutReceiver` | server + emulator, CLTV | no — the wallet holds neither key |
|
|
444
540
|
*
|
|
445
541
|
* The two omitted interactive leaves are the same two the `vhtlc` handler
|
|
446
542
|
* omits, for the same reason: `refund` and `unilateralRefund` both need the
|