@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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEJOFL5WH_cjs = require('./chunk-EJOFL5WH.cjs');
|
|
4
4
|
var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
|
|
5
5
|
var base = require('@scure/base');
|
|
6
6
|
var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
|
|
@@ -76,14 +76,14 @@ var ContractHandlerRegistry = class {
|
|
|
76
76
|
var contractHandlers = new ContractHandlerRegistry();
|
|
77
77
|
exports.DefaultVtxo = void 0;
|
|
78
78
|
((DefaultVtxo2) => {
|
|
79
|
-
class Script3 extends
|
|
79
|
+
class Script3 extends chunkEJOFL5WH_cjs.VtxoScript {
|
|
80
80
|
/** Create the default virtual output script with one forfeit path and one exit path. */
|
|
81
81
|
constructor(options) {
|
|
82
82
|
const { pubKey, serverPubKey, csvTimelock } = options;
|
|
83
|
-
const forfeitScript =
|
|
83
|
+
const forfeitScript = chunkEJOFL5WH_cjs.MultisigTapscript.encode({
|
|
84
84
|
pubkeys: [pubKey, serverPubKey]
|
|
85
85
|
}).script;
|
|
86
|
-
const exitScript =
|
|
86
|
+
const exitScript = chunkEJOFL5WH_cjs.CSVMultisigTapscript.encode({
|
|
87
87
|
timelock: csvTimelock,
|
|
88
88
|
pubkeys: [pubKey]
|
|
89
89
|
}).script;
|
|
@@ -288,7 +288,7 @@ function extractPubKeyBytes(value) {
|
|
|
288
288
|
return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
|
|
289
289
|
}
|
|
290
290
|
function deserializeCsvTimelock(value) {
|
|
291
|
-
return value !== void 0 && value !== "" ?
|
|
291
|
+
return value !== void 0 && value !== "" ? chunkEJOFL5WH_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
292
292
|
}
|
|
293
293
|
var CLTV_HEIGHT_THRESHOLD = 500000000n;
|
|
294
294
|
function isCltvSatisfied(context, locktime) {
|
|
@@ -330,7 +330,7 @@ function assertVhtlcSpendableNow(contract, context) {
|
|
|
330
330
|
function isCsvSpendable(context, sequence) {
|
|
331
331
|
if (sequence === void 0) return true;
|
|
332
332
|
if (!context.vtxo) return false;
|
|
333
|
-
const timelock =
|
|
333
|
+
const timelock = chunkEJOFL5WH_cjs.sequenceToTimelock(sequence);
|
|
334
334
|
if (timelock.type === "blocks") {
|
|
335
335
|
if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
|
|
336
336
|
return false;
|
|
@@ -388,21 +388,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
|
|
|
388
388
|
async function detectUsedScripts(indexerProvider, scriptHexes) {
|
|
389
389
|
const used = /* @__PURE__ */ new Set();
|
|
390
390
|
const unique = [...new Set(scriptHexes)];
|
|
391
|
-
for (let offset = 0; offset < unique.length; offset +=
|
|
392
|
-
const scripts = unique.slice(offset, offset +
|
|
391
|
+
for (let offset = 0; offset < unique.length; offset += chunkEJOFL5WH_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
392
|
+
const scripts = unique.slice(offset, offset + chunkEJOFL5WH_cjs.SCRIPT_QUERY_CHUNK_SIZE);
|
|
393
393
|
const remaining = new Set(scripts);
|
|
394
394
|
let pageIndex = 0;
|
|
395
395
|
let hasMore = true;
|
|
396
396
|
while (hasMore && remaining.size > 0) {
|
|
397
|
-
const { vtxos, page } = await
|
|
397
|
+
const { vtxos, page } = await chunkEJOFL5WH_cjs.getNormalizedVtxos(indexerProvider, {
|
|
398
398
|
scripts,
|
|
399
399
|
pageIndex,
|
|
400
|
-
pageSize:
|
|
400
|
+
pageSize: chunkEJOFL5WH_cjs.DEFAULT_PAGE_SIZE
|
|
401
401
|
});
|
|
402
402
|
for (const vtxo of vtxos) {
|
|
403
403
|
if (remaining.delete(vtxo.script)) used.add(vtxo.script);
|
|
404
404
|
}
|
|
405
|
-
hasMore = page ? vtxos.length ===
|
|
405
|
+
hasMore = page ? vtxos.length === chunkEJOFL5WH_cjs.DEFAULT_PAGE_SIZE : false;
|
|
406
406
|
pageIndex++;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
@@ -463,7 +463,7 @@ var DefaultContractHandler = {
|
|
|
463
463
|
return {
|
|
464
464
|
pubKey: base.hex.encode(params.pubKey),
|
|
465
465
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
466
|
-
csvTimelock:
|
|
466
|
+
csvTimelock: chunkEJOFL5WH_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
467
467
|
};
|
|
468
468
|
},
|
|
469
469
|
deserializeParams(params) {
|
|
@@ -498,7 +498,7 @@ function defaultCandidatesAt(_index, descriptor, deps) {
|
|
|
498
498
|
params: {
|
|
499
499
|
pubKey: base.hex.encode(c.pubKey),
|
|
500
500
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
501
|
-
csvTimelock:
|
|
501
|
+
csvTimelock: chunkEJOFL5WH_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
502
502
|
},
|
|
503
503
|
script: c.scriptHex,
|
|
504
504
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -514,12 +514,12 @@ function discoverDefaultRange(entries, deps) {
|
|
|
514
514
|
}
|
|
515
515
|
exports.DelegateVtxo = void 0;
|
|
516
516
|
((DelegateVtxo2) => {
|
|
517
|
-
class Script3 extends
|
|
517
|
+
class Script3 extends chunkEJOFL5WH_cjs.VtxoScript {
|
|
518
518
|
/** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
|
|
519
519
|
constructor(options) {
|
|
520
520
|
const defaultVtxo = new exports.DefaultVtxo.Script(options);
|
|
521
521
|
const { delegatePubKey, pubKey, serverPubKey } = options;
|
|
522
|
-
const delegateScript =
|
|
522
|
+
const delegateScript = chunkEJOFL5WH_cjs.MultisigTapscript.encode({
|
|
523
523
|
pubkeys: [pubKey, delegatePubKey, serverPubKey]
|
|
524
524
|
}).script;
|
|
525
525
|
super([...defaultVtxo.scripts, delegateScript]);
|
|
@@ -558,7 +558,7 @@ var DelegateContractHandler = {
|
|
|
558
558
|
pubKey: base.hex.encode(params.pubKey),
|
|
559
559
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
560
560
|
delegatePubKey: base.hex.encode(params.delegatePubKey),
|
|
561
|
-
csvTimelock:
|
|
561
|
+
csvTimelock: chunkEJOFL5WH_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
562
562
|
};
|
|
563
563
|
},
|
|
564
564
|
deserializeParams(params) {
|
|
@@ -602,7 +602,7 @@ function delegateCandidatesAt(_index, descriptor, deps) {
|
|
|
602
602
|
pubKey: base.hex.encode(c.pubKey),
|
|
603
603
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
604
604
|
delegatePubKey: base.hex.encode(delegatePubKey),
|
|
605
|
-
csvTimelock:
|
|
605
|
+
csvTimelock: chunkEJOFL5WH_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
606
606
|
},
|
|
607
607
|
script: c.scriptHex,
|
|
608
608
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -1445,7 +1445,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
|
|
|
1445
1445
|
// src/script/vhtlc.ts
|
|
1446
1446
|
exports.VHTLC = void 0;
|
|
1447
1447
|
((VHTLC2) => {
|
|
1448
|
-
class BaseScript extends
|
|
1448
|
+
class BaseScript extends chunkEJOFL5WH_cjs.VtxoScript {
|
|
1449
1449
|
options;
|
|
1450
1450
|
claimScript;
|
|
1451
1451
|
refundScript;
|
|
@@ -1457,6 +1457,8 @@ exports.VHTLC = void 0;
|
|
|
1457
1457
|
nonInteractiveClaimArkadeScript;
|
|
1458
1458
|
nonInteractiveRefundScript;
|
|
1459
1459
|
nonInteractiveRefundArkadeScript;
|
|
1460
|
+
nonInteractiveRefundWithoutReceiverScript;
|
|
1461
|
+
nonInteractiveRefundWithoutReceiverArkadeScript;
|
|
1460
1462
|
constructor(options, preimageCondition) {
|
|
1461
1463
|
validateOptions(options);
|
|
1462
1464
|
const {
|
|
@@ -1470,27 +1472,27 @@ exports.VHTLC = void 0;
|
|
|
1470
1472
|
unilateralRefundWithoutReceiverDelay
|
|
1471
1473
|
} = options;
|
|
1472
1474
|
const conditionScript = preimageCondition(preimageHash);
|
|
1473
|
-
const claimScript =
|
|
1475
|
+
const claimScript = chunkEJOFL5WH_cjs.ConditionMultisigTapscript.encode({
|
|
1474
1476
|
conditionScript,
|
|
1475
1477
|
pubkeys: [receiver, server]
|
|
1476
1478
|
}).script;
|
|
1477
|
-
const refundScript =
|
|
1479
|
+
const refundScript = chunkEJOFL5WH_cjs.MultisigTapscript.encode({
|
|
1478
1480
|
pubkeys: [sender, receiver, server]
|
|
1479
1481
|
}).script;
|
|
1480
|
-
const refundWithoutReceiverScript =
|
|
1482
|
+
const refundWithoutReceiverScript = chunkEJOFL5WH_cjs.CLTVMultisigTapscript.encode({
|
|
1481
1483
|
absoluteTimelock: refundLocktime,
|
|
1482
1484
|
pubkeys: [sender, server]
|
|
1483
1485
|
}).script;
|
|
1484
|
-
const unilateralClaimScript =
|
|
1486
|
+
const unilateralClaimScript = chunkEJOFL5WH_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1485
1487
|
conditionScript,
|
|
1486
1488
|
timelock: unilateralClaimDelay,
|
|
1487
1489
|
pubkeys: [receiver]
|
|
1488
1490
|
}).script;
|
|
1489
|
-
const unilateralRefundScript =
|
|
1491
|
+
const unilateralRefundScript = chunkEJOFL5WH_cjs.CSVMultisigTapscript.encode({
|
|
1490
1492
|
timelock: unilateralRefundDelay,
|
|
1491
1493
|
pubkeys: [sender, receiver]
|
|
1492
1494
|
}).script;
|
|
1493
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1495
|
+
const unilateralRefundWithoutReceiverScript = chunkEJOFL5WH_cjs.CSVMultisigTapscript.encode({
|
|
1494
1496
|
timelock: unilateralRefundWithoutReceiverDelay,
|
|
1495
1497
|
pubkeys: [sender]
|
|
1496
1498
|
}).script;
|
|
@@ -1504,42 +1506,36 @@ exports.VHTLC = void 0;
|
|
|
1504
1506
|
];
|
|
1505
1507
|
let arkadeScriptNic;
|
|
1506
1508
|
let nonInteractiveClaimScript;
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
);
|
|
1513
|
-
nonInteractiveClaimScript =
|
|
1509
|
+
let arkadeScriptNir;
|
|
1510
|
+
let nonInteractiveRefundScript;
|
|
1511
|
+
let nonInteractiveRefundWithoutReceiverScript;
|
|
1512
|
+
const covenants = options.nonInteractiveParameters;
|
|
1513
|
+
if (covenants) {
|
|
1514
|
+
arkadeScriptNic = enforcePayToMaybeAsset(covenants.receiverPkScript, options.asset);
|
|
1515
|
+
nonInteractiveClaimScript = chunkEJOFL5WH_cjs.ConditionMultisigTapscript.encode({
|
|
1514
1516
|
conditionScript,
|
|
1515
1517
|
pubkeys: [
|
|
1516
1518
|
server,
|
|
1517
|
-
computeArkadeScriptPublicKey(
|
|
1518
|
-
options.nonInteractiveClaim.emulatorPubkey,
|
|
1519
|
-
arkadeScriptNic
|
|
1520
|
-
)
|
|
1519
|
+
computeArkadeScriptPublicKey(covenants.emulatorPubkey, arkadeScriptNic)
|
|
1521
1520
|
]
|
|
1522
1521
|
}).script;
|
|
1523
1522
|
scripts.push(nonInteractiveClaimScript);
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
arkadeScriptNir = enforcePayToMaybeAsset(
|
|
1529
|
-
options.nonInteractiveRefund.senderPkScript,
|
|
1530
|
-
options.asset
|
|
1523
|
+
arkadeScriptNir = enforcePayToMaybeAsset(covenants.senderPkScript, options.asset);
|
|
1524
|
+
const nirCosigner = computeArkadeScriptPublicKey(
|
|
1525
|
+
covenants.emulatorPubkey,
|
|
1526
|
+
arkadeScriptNir
|
|
1531
1527
|
);
|
|
1532
|
-
nonInteractiveRefundScript =
|
|
1533
|
-
pubkeys: [
|
|
1534
|
-
server,
|
|
1535
|
-
receiver,
|
|
1536
|
-
computeArkadeScriptPublicKey(
|
|
1537
|
-
options.nonInteractiveRefund.emulatorPubkey,
|
|
1538
|
-
arkadeScriptNir
|
|
1539
|
-
)
|
|
1540
|
-
]
|
|
1528
|
+
nonInteractiveRefundScript = chunkEJOFL5WH_cjs.MultisigTapscript.encode({
|
|
1529
|
+
pubkeys: [server, receiver, nirCosigner]
|
|
1541
1530
|
}).script;
|
|
1542
1531
|
scripts.push(nonInteractiveRefundScript);
|
|
1532
|
+
if (covenants.legacy !== "preTimelockedRefund") {
|
|
1533
|
+
nonInteractiveRefundWithoutReceiverScript = chunkEJOFL5WH_cjs.CLTVMultisigTapscript.encode({
|
|
1534
|
+
absoluteTimelock: refundLocktime,
|
|
1535
|
+
pubkeys: [server, nirCosigner]
|
|
1536
|
+
}).script;
|
|
1537
|
+
scripts.push(nonInteractiveRefundWithoutReceiverScript);
|
|
1538
|
+
}
|
|
1543
1539
|
}
|
|
1544
1540
|
super(scripts);
|
|
1545
1541
|
this.options = options;
|
|
@@ -1559,6 +1555,12 @@ exports.VHTLC = void 0;
|
|
|
1559
1555
|
this.nonInteractiveRefundScript = base.hex.encode(nonInteractiveRefundScript);
|
|
1560
1556
|
this.nonInteractiveRefundArkadeScript = arkadeScriptNir;
|
|
1561
1557
|
}
|
|
1558
|
+
if (nonInteractiveRefundWithoutReceiverScript) {
|
|
1559
|
+
this.nonInteractiveRefundWithoutReceiverScript = base.hex.encode(
|
|
1560
|
+
nonInteractiveRefundWithoutReceiverScript
|
|
1561
|
+
);
|
|
1562
|
+
this.nonInteractiveRefundWithoutReceiverArkadeScript = arkadeScriptNir;
|
|
1563
|
+
}
|
|
1562
1564
|
}
|
|
1563
1565
|
/** Return the collaborative claim tapleaf script. */
|
|
1564
1566
|
claim() {
|
|
@@ -1604,6 +1606,67 @@ exports.VHTLC = void 0;
|
|
|
1604
1606
|
this.nonInteractiveRefundArkadeScript
|
|
1605
1607
|
];
|
|
1606
1608
|
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Return the timelocked non-interactive refund tapleaf and its ArkadeScript.
|
|
1611
|
+
*
|
|
1612
|
+
* SPENDING THIS LEAF, CONCRETELY — confirmed from this SDK's own
|
|
1613
|
+
* emulator client and covenant-spend builder ({@link
|
|
1614
|
+
* EmulatorProvider} in `src/providers/emulator.ts`, and {@link
|
|
1615
|
+
* ArkadeTransactionBuilder} in `src/arkade/contract.ts`), which is
|
|
1616
|
+
* the general machinery every covenant leaf in this file goes
|
|
1617
|
+
* through:
|
|
1618
|
+
*
|
|
1619
|
+
* 1. Build the ark tx spending this leaf (this method's {@link
|
|
1620
|
+
* TapLeafScript} as `tapLeafScript`, this script's {@link
|
|
1621
|
+
* VtxoScript.encode} as `tapTree`), plus its checkpoint tx.
|
|
1622
|
+
* 2. Attach the ArkadeScript this method returns to the spent
|
|
1623
|
+
* input via an `EmulatorPacket` (type 1) — `{ vin, script:
|
|
1624
|
+
* <this ArkadeScript>, witness: <empty> }`, empty because the
|
|
1625
|
+
* script pushes its own input/output index with
|
|
1626
|
+
* `PUSHCURRENTINPUTINDEX` rather than reading one from the
|
|
1627
|
+
* witness — wrapped in an `Extension` OP_RETURN output on the
|
|
1628
|
+
* ark tx.
|
|
1629
|
+
* 3. Attach the spent input's OWN creating ark tx as `PrevArkTx` on
|
|
1630
|
+
* input 0 — required so the emulator can resolve that input's
|
|
1631
|
+
* prevout pkScript/value; it does not otherwise have them.
|
|
1632
|
+
* 4. POST the (base64-PSBT) ark tx and checkpoint(s) as `{ arkTx,
|
|
1633
|
+
* checkpointTxs }` to the emulator's `POST /v1/tx`.
|
|
1634
|
+
*
|
|
1635
|
+
* THE COVENANT CHECK the emulator runs against that ArkadeScript —
|
|
1636
|
+
* `enforcePayTo(senderPkScript)`, see that function above — is: the
|
|
1637
|
+
* output at this SAME input's index is a v1 P2TR output paying
|
|
1638
|
+
* `senderPkScript`, with a value at least the input's. Only on that
|
|
1639
|
+
* check passing does the emulator sign for `nirCosigner` (the
|
|
1640
|
+
* `emulatorPubkey` tweaked by this ArkadeScript's hash); the
|
|
1641
|
+
* response carries the fully co-signed `signedArkTx` and
|
|
1642
|
+
* `signedCheckpointTxs` — `ArkadeTransactionBuilder.send()`'s own
|
|
1643
|
+
* comment on this path: "the emulator executes the arkade script
|
|
1644
|
+
* and finalizes with arkd" — no separate call to arkd is made by
|
|
1645
|
+
* this SDK for a covenant spend.
|
|
1646
|
+
* Neither `server` nor `receiver` play any part in that check: this
|
|
1647
|
+
* leaf's tapscript still requires `server`'s own signature
|
|
1648
|
+
* alongside `nirCosigner`'s (see the class doc above), but that is
|
|
1649
|
+
* consensus-level multisig, not something the covenant enforces.
|
|
1650
|
+
*
|
|
1651
|
+
* NOT SPENDABLE UNTIL `refundLocktime` MATURES — the tapscript's
|
|
1652
|
+
* `OP_CHECKLOCKTIMEVERIFY` is arkd's concern, not the emulator's;
|
|
1653
|
+
* the emulator will happily co-sign an immature spend and arkd will
|
|
1654
|
+
* then refuse it. A block-height-typed `refundLocktime` (below the
|
|
1655
|
+
* standard height/timestamp boundary this SDK names
|
|
1656
|
+
* `CLTV_HEIGHT_THRESHOLD`, 500,000,000, in
|
|
1657
|
+
* `src/contracts/handlers/helpers.ts`) is refused by arkd for a
|
|
1658
|
+
* forfeit-eligible leaf independent of maturity — use a
|
|
1659
|
+
* seconds-typed (absolute Unix timestamp) value.
|
|
1660
|
+
*/
|
|
1661
|
+
nonInteractiveRefundWithoutReceiver() {
|
|
1662
|
+
if (!this.nonInteractiveRefundWithoutReceiverScript || !this.nonInteractiveRefundWithoutReceiverArkadeScript) {
|
|
1663
|
+
throw new Error("VHTLC has no non-interactive refund-without-receiver leaf");
|
|
1664
|
+
}
|
|
1665
|
+
return [
|
|
1666
|
+
this.findLeaf(this.nonInteractiveRefundWithoutReceiverScript),
|
|
1667
|
+
this.nonInteractiveRefundWithoutReceiverArkadeScript
|
|
1668
|
+
];
|
|
1669
|
+
}
|
|
1607
1670
|
}
|
|
1608
1671
|
class Script3 extends BaseScript {
|
|
1609
1672
|
constructor(options) {
|
|
@@ -1631,47 +1694,25 @@ exports.VHTLC = void 0;
|
|
|
1631
1694
|
if (!preimageHash || preimageHash.length !== 20) {
|
|
1632
1695
|
throw new Error("preimage hash must be 20 bytes");
|
|
1633
1696
|
}
|
|
1634
|
-
if (options.asset !== void 0 && !options.
|
|
1635
|
-
throw new Error(
|
|
1636
|
-
"asset has no effect without nonInteractiveClaim or nonInteractiveRefund"
|
|
1637
|
-
);
|
|
1638
|
-
}
|
|
1639
|
-
const strict = options.nonInteractiveClaim?.strict;
|
|
1640
|
-
if (strict !== void 0) {
|
|
1641
|
-
if (strict.amount <= 0n) {
|
|
1642
|
-
throw new Error(`strict claim amount must be positive, got ${strict.amount}`);
|
|
1643
|
-
}
|
|
1644
|
-
if (options.asset !== void 0 && strict.assetAmount === void 0) {
|
|
1645
|
-
throw new Error(
|
|
1646
|
-
"strict claim needs assetAmount when the contract is denominated in an asset: bounding only the sats would leave the asset amount unenforced"
|
|
1647
|
-
);
|
|
1648
|
-
}
|
|
1649
|
-
if (options.asset === void 0 && strict.assetAmount !== void 0) {
|
|
1650
|
-
throw new Error("strict claim assetAmount has no effect without asset");
|
|
1651
|
-
}
|
|
1652
|
-
if (strict.assetAmount !== void 0 && strict.assetAmount <= 0n) {
|
|
1653
|
-
throw new Error(
|
|
1654
|
-
`strict claim assetAmount must be positive, got ${strict.assetAmount}`
|
|
1655
|
-
);
|
|
1656
|
-
}
|
|
1697
|
+
if (options.asset !== void 0 && !options.nonInteractiveParameters) {
|
|
1698
|
+
throw new Error("asset has no effect without nonInteractiveParameters");
|
|
1657
1699
|
}
|
|
1658
|
-
if (options.
|
|
1659
|
-
const { emulatorPubkey, receiverPkScript } = options.
|
|
1700
|
+
if (options.nonInteractiveParameters) {
|
|
1701
|
+
const { emulatorPubkey, receiverPkScript, senderPkScript, legacy } = options.nonInteractiveParameters;
|
|
1660
1702
|
if (!emulatorPubkey || emulatorPubkey.length !== 32 && emulatorPubkey.length !== 33) {
|
|
1661
1703
|
throw new Error("Invalid public key length (emulator)");
|
|
1662
1704
|
}
|
|
1663
1705
|
if (!receiverPkScript || !isP2trPkScript(receiverPkScript)) {
|
|
1664
1706
|
throw new Error("Invalid P2TR script");
|
|
1665
1707
|
}
|
|
1666
|
-
}
|
|
1667
|
-
if (options.nonInteractiveRefund) {
|
|
1668
|
-
const { emulatorPubkey, senderPkScript } = options.nonInteractiveRefund;
|
|
1669
|
-
if (!emulatorPubkey || emulatorPubkey.length !== 32 && emulatorPubkey.length !== 33) {
|
|
1670
|
-
throw new Error("Invalid public key length (emulator)");
|
|
1671
|
-
}
|
|
1672
1708
|
if (!senderPkScript || !isP2trPkScript(senderPkScript)) {
|
|
1673
1709
|
throw new Error("Invalid P2TR script");
|
|
1674
1710
|
}
|
|
1711
|
+
if (legacy !== void 0 && legacy !== "preTimelockedRefund") {
|
|
1712
|
+
throw new Error(
|
|
1713
|
+
`nonInteractiveParameters.legacy must be "preTimelockedRefund" when set, got ${JSON.stringify(legacy)}`
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1675
1716
|
}
|
|
1676
1717
|
if (!receiver || receiver.length !== 32) {
|
|
1677
1718
|
throw new Error("Invalid public key length (receiver)");
|
|
@@ -1723,7 +1764,7 @@ function preimageConditionScriptV2(preimageHash) {
|
|
|
1723
1764
|
function isP2trPkScript(pkScript) {
|
|
1724
1765
|
return pkScript.length === 34 && pkScript[0] === 81 && pkScript[1] === 32;
|
|
1725
1766
|
}
|
|
1726
|
-
function satClause(destinationPkScript
|
|
1767
|
+
function satClause(destinationPkScript) {
|
|
1727
1768
|
return [
|
|
1728
1769
|
"PUSHCURRENTINPUTINDEX",
|
|
1729
1770
|
"DUP",
|
|
@@ -1733,21 +1774,18 @@ function satClause(destinationPkScript, quotedSats) {
|
|
|
1733
1774
|
destinationPkScript.subarray(2),
|
|
1734
1775
|
"EQUALVERIFY",
|
|
1735
1776
|
"INSPECTOUTPUTVALUE",
|
|
1736
|
-
// `DUP` because the output value is needed twice: once against the
|
|
1737
|
-
// quote, once against the input.
|
|
1738
|
-
...quotedSats === void 0 ? [] : ["DUP", quotedSats, "GREATERTHANOREQUAL", "VERIFY"],
|
|
1739
1777
|
"PUSHCURRENTINPUTINDEX",
|
|
1740
1778
|
"INSPECTINPUTVALUE",
|
|
1741
1779
|
"GREATERTHANOREQUAL"
|
|
1742
1780
|
];
|
|
1743
1781
|
}
|
|
1744
|
-
function enforcePayTo(destinationPkScript
|
|
1782
|
+
function enforcePayTo(destinationPkScript) {
|
|
1745
1783
|
if (!isP2trPkScript(destinationPkScript)) {
|
|
1746
1784
|
throw new Error("invalid P2TR script");
|
|
1747
1785
|
}
|
|
1748
|
-
return ArkadeScript.encode(satClause(destinationPkScript
|
|
1786
|
+
return ArkadeScript.encode(satClause(destinationPkScript));
|
|
1749
1787
|
}
|
|
1750
|
-
function enforcePayToAsset(destinationPkScript, asset
|
|
1788
|
+
function enforcePayToAsset(destinationPkScript, asset) {
|
|
1751
1789
|
if (!isP2trPkScript(destinationPkScript)) {
|
|
1752
1790
|
throw new Error("invalid P2TR script");
|
|
1753
1791
|
}
|
|
@@ -1771,10 +1809,6 @@ function enforcePayToAsset(destinationPkScript, asset, strict) {
|
|
|
1771
1809
|
"INSPECTOUTASSETLOOKUP",
|
|
1772
1810
|
"VERIFY",
|
|
1773
1811
|
// PRESENT on the output, not merely "zero of it"
|
|
1774
|
-
// The quoted bound, when the caller opted in — added to the input
|
|
1775
|
-
// comparison below, not substituted for it. `DUP` because the output's
|
|
1776
|
-
// asset amount is needed twice.
|
|
1777
|
-
...strict?.assetAmount === void 0 ? [] : ["DUP", strict.assetAmount, "GREATERTHANOREQUAL", "VERIFY"],
|
|
1778
1812
|
"PUSHCURRENTINPUTINDEX",
|
|
1779
1813
|
inspectionTxid,
|
|
1780
1814
|
asset.groupIndex,
|
|
@@ -1789,11 +1823,11 @@ function enforcePayToAsset(destinationPkScript, asset, strict) {
|
|
|
1789
1823
|
1,
|
|
1790
1824
|
"EQUALVERIFY",
|
|
1791
1825
|
// ...then the sat covenant, the same tokens `enforcePayTo` emits.
|
|
1792
|
-
...satClause(destinationPkScript
|
|
1826
|
+
...satClause(destinationPkScript)
|
|
1793
1827
|
]);
|
|
1794
1828
|
}
|
|
1795
|
-
function enforcePayToMaybeAsset(destinationPkScript, asset
|
|
1796
|
-
return asset === void 0 ? enforcePayTo(destinationPkScript
|
|
1829
|
+
function enforcePayToMaybeAsset(destinationPkScript, asset) {
|
|
1830
|
+
return asset === void 0 ? enforcePayTo(destinationPkScript) : enforcePayToAsset(destinationPkScript, asset);
|
|
1797
1831
|
}
|
|
1798
1832
|
|
|
1799
1833
|
// src/contracts/handlers/vhtlc.ts
|
|
@@ -1810,9 +1844,9 @@ var VHTLCContractHandler = {
|
|
|
1810
1844
|
server: base.hex.encode(params.server),
|
|
1811
1845
|
hash: base.hex.encode(params.preimageHash),
|
|
1812
1846
|
refundLocktime: params.refundLocktime.toString(),
|
|
1813
|
-
claimDelay:
|
|
1814
|
-
refundDelay:
|
|
1815
|
-
refundNoReceiverDelay:
|
|
1847
|
+
claimDelay: chunkEJOFL5WH_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1848
|
+
refundDelay: chunkEJOFL5WH_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1849
|
+
refundNoReceiverDelay: chunkEJOFL5WH_cjs.timelockToSequence(
|
|
1816
1850
|
params.unilateralRefundWithoutReceiverDelay
|
|
1817
1851
|
).toString()
|
|
1818
1852
|
};
|
|
@@ -1824,9 +1858,9 @@ var VHTLCContractHandler = {
|
|
|
1824
1858
|
server: base.hex.decode(params.server),
|
|
1825
1859
|
preimageHash: base.hex.decode(params.hash),
|
|
1826
1860
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1827
|
-
unilateralClaimDelay:
|
|
1828
|
-
unilateralRefundDelay:
|
|
1829
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1861
|
+
unilateralClaimDelay: chunkEJOFL5WH_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1862
|
+
unilateralRefundDelay: chunkEJOFL5WH_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1863
|
+
unilateralRefundWithoutReceiverDelay: chunkEJOFL5WH_cjs.sequenceToTimelock(
|
|
1830
1864
|
Number(params.refundNoReceiverDelay)
|
|
1831
1865
|
)
|
|
1832
1866
|
};
|
|
@@ -2065,46 +2099,46 @@ var VHTLCV2ContractHandler = {
|
|
|
2065
2099
|
return new exports.VHTLC.ScriptV2(typed);
|
|
2066
2100
|
},
|
|
2067
2101
|
serializeParams(params) {
|
|
2102
|
+
const covenants = params.nonInteractiveParameters;
|
|
2068
2103
|
return {
|
|
2069
2104
|
sender: base.hex.encode(params.sender),
|
|
2070
2105
|
receiver: base.hex.encode(params.receiver),
|
|
2071
2106
|
server: base.hex.encode(params.server),
|
|
2072
2107
|
hash: base.hex.encode(params.preimageHash),
|
|
2073
2108
|
refundLocktime: params.refundLocktime.toString(),
|
|
2074
|
-
claimDelay:
|
|
2075
|
-
refundDelay:
|
|
2076
|
-
refundNoReceiverDelay:
|
|
2109
|
+
claimDelay: chunkEJOFL5WH_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
2110
|
+
refundDelay: chunkEJOFL5WH_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
2111
|
+
refundNoReceiverDelay: chunkEJOFL5WH_cjs.timelockToSequence(
|
|
2077
2112
|
params.unilateralRefundWithoutReceiverDelay
|
|
2078
2113
|
).toString(),
|
|
2114
|
+
// The on-disk keys keep their per-leaf names even though the typed
|
|
2115
|
+
// param is ONE group: rows written by older SDKs carry exactly
|
|
2116
|
+
// these keys, and changing the storage encoding would orphan them.
|
|
2117
|
+
// The group maps onto them without loss — one emulator key serves
|
|
2118
|
+
// both covenant destinations by construction (see the option's doc
|
|
2119
|
+
// on VHTLC.Options), so the two emulator-key columns always hold
|
|
2120
|
+
// the same value on a row written from here.
|
|
2121
|
+
//
|
|
2079
2122
|
// Spread rather than written as `undefined`: a `Record<string,
|
|
2080
2123
|
// string>` round-tripped through a repository must not gain keys
|
|
2081
2124
|
// whose value is the string "undefined".
|
|
2082
|
-
...
|
|
2083
|
-
nonInteractiveClaimReceiverPkScript: base.hex.encode(
|
|
2084
|
-
|
|
2085
|
-
),
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
),
|
|
2089
|
-
//
|
|
2090
|
-
//
|
|
2091
|
-
//
|
|
2092
|
-
//
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
}
|
|
2125
|
+
...covenants && {
|
|
2126
|
+
nonInteractiveClaimReceiverPkScript: base.hex.encode(covenants.receiverPkScript),
|
|
2127
|
+
nonInteractiveClaimEmulatorPubkey: base.hex.encode(covenants.emulatorPubkey),
|
|
2128
|
+
nonInteractiveRefundSenderPkScript: base.hex.encode(covenants.senderPkScript),
|
|
2129
|
+
nonInteractiveRefundEmulatorPubkey: base.hex.encode(covenants.emulatorPubkey),
|
|
2130
|
+
// The legacy marker is precisely the ABSENCE of this key: a
|
|
2131
|
+
// row carrying it re-derives the full suite (nine leaves), a
|
|
2132
|
+
// row lacking it the pre-timelocked-refund eight — the same
|
|
2133
|
+
// encoding older SDKs wrote for eight-leaf rows, so those rows
|
|
2134
|
+
// read back unchanged. Spread rather than a "false"/"undefined"
|
|
2135
|
+
// string: a dropped flag re-derives the EIGHT-leaf script, a
|
|
2136
|
+
// different pkScript, and registration dies at
|
|
2137
|
+
// `upsertContractRow` with an opaque `Script mismatch`.
|
|
2138
|
+
...covenants.legacy === void 0 && {
|
|
2139
|
+
nonInteractiveRefundWithoutReceiver: "1"
|
|
2098
2140
|
}
|
|
2099
2141
|
},
|
|
2100
|
-
...params.nonInteractiveRefund && {
|
|
2101
|
-
nonInteractiveRefundSenderPkScript: base.hex.encode(
|
|
2102
|
-
params.nonInteractiveRefund.senderPkScript
|
|
2103
|
-
),
|
|
2104
|
-
nonInteractiveRefundEmulatorPubkey: base.hex.encode(
|
|
2105
|
-
params.nonInteractiveRefund.emulatorPubkey
|
|
2106
|
-
)
|
|
2107
|
-
},
|
|
2108
2142
|
// The asset must round-trip, and its absence here used to be silent
|
|
2109
2143
|
// in the worst way. `ContractManager` re-derives a contract from
|
|
2110
2144
|
// these params; dropping the asset derives the SAT-ONLY script, so
|
|
@@ -2133,14 +2167,34 @@ var VHTLCV2ContractHandler = {
|
|
|
2133
2167
|
"nonInteractiveRefundEmulatorPubkey",
|
|
2134
2168
|
"nonInteractiveRefund"
|
|
2135
2169
|
);
|
|
2170
|
+
if (claim === void 0 !== (refund === void 0)) {
|
|
2171
|
+
throw new Error(
|
|
2172
|
+
"emulator covenant params are all-or-nothing: the claim keys (nonInteractiveClaim*) and the refund keys (nonInteractiveRefund*) must both be present or both absent \u2014 a row carrying one side was written for a leaf subset this handler no longer derives"
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2175
|
+
if (claim && refund && base.hex.encode(claim.emulatorPubkey) !== base.hex.encode(refund.emulatorPubkey)) {
|
|
2176
|
+
throw new Error(
|
|
2177
|
+
"emulator covenant params name two different emulator pubkeys: the suite derives both covenant cosigners from ONE key, so this row cannot be rebuilt as a group"
|
|
2178
|
+
);
|
|
2179
|
+
}
|
|
2136
2180
|
if (params.assetTxid === void 0 !== (params.assetGroupIndex === void 0)) {
|
|
2137
2181
|
throw new Error(
|
|
2138
2182
|
"asset params are incomplete: assetTxid and assetGroupIndex must both be present or both absent"
|
|
2139
2183
|
);
|
|
2140
2184
|
}
|
|
2141
|
-
if (params.
|
|
2185
|
+
if (params.strictClaimAmount !== void 0 || params.strictClaimAssetAmount !== void 0) {
|
|
2142
2186
|
throw new Error(
|
|
2143
|
-
"
|
|
2187
|
+
"strict claim params on a stored row: the strict claim bound was removed and this row's lockup cannot be re-derived without it \u2014 restore it with the SDK version that wrote it"
|
|
2188
|
+
);
|
|
2189
|
+
}
|
|
2190
|
+
if (params.nonInteractiveRefundWithoutReceiver !== void 0 && !refund) {
|
|
2191
|
+
throw new Error(
|
|
2192
|
+
"nonInteractiveRefundWithoutReceiver without the emulator covenant keys it extends: reading this as 'not set' would re-derive a script without the leaf"
|
|
2193
|
+
);
|
|
2194
|
+
}
|
|
2195
|
+
if (params.nonInteractiveRefundWithoutReceiver !== void 0 && params.nonInteractiveRefundWithoutReceiver !== "1") {
|
|
2196
|
+
throw new Error(
|
|
2197
|
+
`nonInteractiveRefundWithoutReceiver must be "1" when present, got ` + JSON.stringify(params.nonInteractiveRefundWithoutReceiver)
|
|
2144
2198
|
);
|
|
2145
2199
|
}
|
|
2146
2200
|
const asset = params.assetTxid !== void 0 && params.assetGroupIndex !== void 0 ? {
|
|
@@ -2154,30 +2208,22 @@ var VHTLCV2ContractHandler = {
|
|
|
2154
2208
|
preimageHash: base.hex.decode(params.hash),
|
|
2155
2209
|
refundLocktime: BigInt(params.refundLocktime),
|
|
2156
2210
|
...asset && { asset },
|
|
2157
|
-
unilateralClaimDelay:
|
|
2158
|
-
unilateralRefundDelay:
|
|
2159
|
-
unilateralRefundWithoutReceiverDelay:
|
|
2211
|
+
unilateralClaimDelay: chunkEJOFL5WH_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
2212
|
+
unilateralRefundDelay: chunkEJOFL5WH_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
2213
|
+
unilateralRefundWithoutReceiverDelay: chunkEJOFL5WH_cjs.sequenceToTimelock(
|
|
2160
2214
|
Number(params.refundNoReceiverDelay)
|
|
2161
2215
|
),
|
|
2162
|
-
...claim && {
|
|
2163
|
-
|
|
2216
|
+
...claim && refund && {
|
|
2217
|
+
nonInteractiveParameters: {
|
|
2164
2218
|
receiverPkScript: claim.destination,
|
|
2219
|
+
senderPkScript: refund.destination,
|
|
2165
2220
|
emulatorPubkey: claim.emulatorPubkey,
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
assetAmount: BigInt(params.strictClaimAssetAmount)
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2221
|
+
// Absence of the flag IS the legacy marker — the same
|
|
2222
|
+
// encoding older SDKs wrote for eight-leaf rows.
|
|
2223
|
+
...params.nonInteractiveRefundWithoutReceiver !== "1" && {
|
|
2224
|
+
legacy: "preTimelockedRefund"
|
|
2173
2225
|
}
|
|
2174
2226
|
}
|
|
2175
|
-
},
|
|
2176
|
-
...refund && {
|
|
2177
|
-
nonInteractiveRefund: {
|
|
2178
|
-
senderPkScript: refund.destination,
|
|
2179
|
-
emulatorPubkey: refund.emulatorPubkey
|
|
2180
|
-
}
|
|
2181
2227
|
}
|
|
2182
2228
|
};
|
|
2183
2229
|
},
|
|
@@ -2437,7 +2483,7 @@ var BoardingContractHandler = {
|
|
|
2437
2483
|
const coins = await deps.onchainProvider.getCoins(onchainAddress);
|
|
2438
2484
|
if (coins.length === 0) return [];
|
|
2439
2485
|
const scriptHex = base.hex.encode(script.pkScript);
|
|
2440
|
-
const boardingSeq =
|
|
2486
|
+
const boardingSeq = chunkEJOFL5WH_cjs.timelockToSequence(deps.boardingTimelock);
|
|
2441
2487
|
return [
|
|
2442
2488
|
{
|
|
2443
2489
|
type: "boarding",
|
|
@@ -2598,27 +2644,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
|
|
|
2598
2644
|
if (seg.csv) {
|
|
2599
2645
|
const timelock = { type: seg.csv.type, value: resolveTimelockValue(seg.csv.value, args) };
|
|
2600
2646
|
if (seg.asm) {
|
|
2601
|
-
return
|
|
2647
|
+
return chunkEJOFL5WH_cjs.ConditionCSVMultisigTapscript.encode({
|
|
2602
2648
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2603
2649
|
timelock,
|
|
2604
2650
|
pubkeys
|
|
2605
2651
|
});
|
|
2606
2652
|
}
|
|
2607
|
-
return
|
|
2653
|
+
return chunkEJOFL5WH_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
2608
2654
|
}
|
|
2609
2655
|
if (seg.cltv !== void 0) {
|
|
2610
|
-
return
|
|
2656
|
+
return chunkEJOFL5WH_cjs.CLTVMultisigTapscript.encode({
|
|
2611
2657
|
absoluteTimelock: resolveTimelockValue(seg.cltv, args),
|
|
2612
2658
|
pubkeys
|
|
2613
2659
|
});
|
|
2614
2660
|
}
|
|
2615
2661
|
if (seg.asm) {
|
|
2616
|
-
return
|
|
2662
|
+
return chunkEJOFL5WH_cjs.ConditionMultisigTapscript.encode({
|
|
2617
2663
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2618
2664
|
pubkeys
|
|
2619
2665
|
});
|
|
2620
2666
|
}
|
|
2621
|
-
return
|
|
2667
|
+
return chunkEJOFL5WH_cjs.MultisigTapscript.encode({ pubkeys });
|
|
2622
2668
|
}
|
|
2623
2669
|
function compileFunctions(program, args, keys) {
|
|
2624
2670
|
if (program.version !== SUPPORTED_PROGRAM_VERSION) {
|
|
@@ -2648,7 +2694,7 @@ function compileFunctions(program, args, keys) {
|
|
|
2648
2694
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2649
2695
|
});
|
|
2650
2696
|
}
|
|
2651
|
-
var ArkadeProgramScript = class extends
|
|
2697
|
+
var ArkadeProgramScript = class extends chunkEJOFL5WH_cjs.VtxoScript {
|
|
2652
2698
|
constructor(program, args, keys) {
|
|
2653
2699
|
const partial = compileFunctions(program, args, keys);
|
|
2654
2700
|
super(partial.map((p) => p.leafScript));
|
|
@@ -2861,7 +2907,7 @@ function pathsFor(script, context, opts) {
|
|
|
2861
2907
|
continue;
|
|
2862
2908
|
}
|
|
2863
2909
|
if (requiresServer) continue;
|
|
2864
|
-
const sequence = csv ? Number(
|
|
2910
|
+
const sequence = csv ? Number(chunkEJOFL5WH_cjs.timelockToSequence(csv)) : void 0;
|
|
2865
2911
|
if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
|
|
2866
2912
|
if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
|
|
2867
2913
|
continue;
|
|
@@ -2990,5 +3036,5 @@ exports.toASM = toASM;
|
|
|
2990
3036
|
exports.toXOnly = toXOnly;
|
|
2991
3037
|
exports.validateProgram = validateProgram;
|
|
2992
3038
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
2993
|
-
//# sourceMappingURL=chunk-
|
|
2994
|
-
//# sourceMappingURL=chunk-
|
|
3039
|
+
//# sourceMappingURL=chunk-6YUACVX4.cjs.map
|
|
3040
|
+
//# sourceMappingURL=chunk-6YUACVX4.cjs.map
|