@arkade-os/sdk 0.4.60 → 0.4.62
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 +4 -4
- package/dist/adapters/expo.d.ts +4 -4
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-CqijAAPG.d.cts → asyncStorageTaskQueue-B53mOTCw.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-Vsp6uk8e.d.ts → asyncStorageTaskQueue-Df-CTfTE.d.ts} +2 -2
- package/dist/{chunk-Y54MUBT7.js → chunk-2IZW6AEK.js} +879 -146
- package/dist/chunk-2IZW6AEK.js.map +1 -0
- package/dist/{chunk-MZNLCMUP.cjs → chunk-G53HASDV.cjs} +113 -79
- package/dist/chunk-G53HASDV.cjs.map +1 -0
- package/dist/{chunk-3Q7BBUWO.js → chunk-H2ZAJOQA.js} +4 -4
- package/dist/{chunk-3Q7BBUWO.js.map → chunk-H2ZAJOQA.js.map} +1 -1
- package/dist/{chunk-PRFL62ID.cjs → chunk-I6EDUE75.cjs} +17 -17
- package/dist/{chunk-PRFL62ID.cjs.map → chunk-I6EDUE75.cjs.map} +1 -1
- package/dist/{chunk-B66RYHTB.js → chunk-I7RLG6VX.js} +4 -4
- package/dist/{chunk-B66RYHTB.js.map → chunk-I7RLG6VX.js.map} +1 -1
- package/dist/{chunk-2DINXHGQ.js → chunk-L7S5KC5B.js} +66 -35
- package/dist/chunk-L7S5KC5B.js.map +1 -0
- package/dist/{chunk-4A4GRSTB.cjs → chunk-OH2XLTXE.cjs} +3 -3
- package/dist/{chunk-4A4GRSTB.cjs.map → chunk-OH2XLTXE.cjs.map} +1 -1
- package/dist/{chunk-2XLNQHG4.cjs → chunk-PWWA4DBL.cjs} +10 -10
- package/dist/{chunk-2XLNQHG4.cjs.map → chunk-PWWA4DBL.cjs.map} +1 -1
- package/dist/{chunk-H7JCHFM6.cjs → chunk-QRSR4HV4.cjs} +17 -17
- package/dist/{chunk-H7JCHFM6.cjs.map → chunk-QRSR4HV4.cjs.map} +1 -1
- package/dist/{chunk-FSKANUV4.js → chunk-RMBI6P4N.js} +3 -3
- package/dist/{chunk-FSKANUV4.js.map → chunk-RMBI6P4N.js.map} +1 -1
- package/dist/{chunk-JBULXTCC.js → chunk-URT2RVGB.js} +3 -3
- package/dist/{chunk-JBULXTCC.js.map → chunk-URT2RVGB.js.map} +1 -1
- package/dist/{chunk-KNS5MTTI.cjs → chunk-Z2OZMKFV.cjs} +1272 -523
- package/dist/chunk-Z2OZMKFV.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +5 -5
- package/dist/contracts/handlers/index.d.ts +5 -5
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-DNEuM_nK.d.cts → delegate-BjYJJsml.d.ts} +1 -1
- package/dist/{delegate-DidNTsKm.d.ts → delegate-CC1gcvuC.d.cts} +1 -1
- package/dist/{index-BP8-zniX.d.cts → index-C888wFEV.d.ts} +102 -102
- package/dist/{ark-D2_yNhfz.d.cts → index-CwBr7qzV.d.cts} +3941 -3812
- package/dist/{ark-D2_yNhfz.d.ts → index-CwBr7qzV.d.ts} +3941 -3812
- package/dist/{index-DzQbNQUG.d.ts → index-Cz5_WaQP.d.cts} +102 -102
- package/dist/index.cjs +328 -248
- package/dist/index.d.cts +340 -52
- package/dist/index.d.ts +340 -52
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +4 -4
- package/dist/repositories/realm/index.d.ts +4 -4
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +4 -4
- package/dist/repositories/sqlite/index.d.ts +4 -4
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-9gnlYEpb.d.ts → taskRunner-BMUndClz.d.cts} +2 -2
- package/dist/{taskRunner-BEQNFEa4.d.cts → taskRunner-DZWUsSzA.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +5 -5
- package/dist/wallet/expo/background.d.ts +5 -5
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +36 -16
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +13 -6
- package/dist/wallet/expo/index.d.ts +13 -6
- package/dist/wallet/expo/index.js +27 -7
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-ipUA1XCp.d.cts → wallet-Dpjx6CJ7.d.ts} +91 -17
- package/dist/{wallet-C_MYHyOj.d.ts → wallet-H3f14est.d.cts} +91 -17
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +6 -6
- package/dist/worker/expo/index.d.ts +6 -6
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-2DINXHGQ.js.map +0 -1
- package/dist/chunk-KNS5MTTI.cjs.map +0 -1
- package/dist/chunk-MZNLCMUP.cjs.map +0 -1
- package/dist/chunk-Y54MUBT7.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOH2XLTXE_cjs = require('./chunk-OH2XLTXE.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 chunkOH2XLTXE_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 = chunkOH2XLTXE_cjs.MultisigTapscript.encode({
|
|
84
84
|
pubkeys: [pubKey, serverPubKey]
|
|
85
85
|
}).script;
|
|
86
|
-
const exitScript =
|
|
86
|
+
const exitScript = chunkOH2XLTXE_cjs.CSVMultisigTapscript.encode({
|
|
87
87
|
timelock: csvTimelock,
|
|
88
88
|
pubkeys: [pubKey]
|
|
89
89
|
}).script;
|
|
@@ -212,6 +212,31 @@ function deriveDescriptorLeafCompressedPubKey(descriptor) {
|
|
|
212
212
|
}
|
|
213
213
|
return key.keyPath ? key.bip32.derivePath(key.keyPath.replace(/^\//, "")).publicKey : key.bip32.publicKey;
|
|
214
214
|
}
|
|
215
|
+
function parseHDDescriptor(descriptor) {
|
|
216
|
+
if (!isDescriptor(descriptor)) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
let expansion;
|
|
220
|
+
try {
|
|
221
|
+
const network = isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
|
|
222
|
+
expansion = descriptorsScure.expand({ descriptor, network });
|
|
223
|
+
} catch {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
const key = expansion.expansionMap?.["@0"];
|
|
227
|
+
if (!key?.masterFingerprint || !key.originPath || !key.keyPath || !key.bip32) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
fingerprint: base.hex.encode(key.masterFingerprint),
|
|
232
|
+
basePath: key.originPath.replace(/^\//, ""),
|
|
233
|
+
xpub: key.bip32.toBase58(),
|
|
234
|
+
derivationPath: key.keyPath.replace(/^\//, "")
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
async function identityDescriptor(identity) {
|
|
238
|
+
return normalizeToDescriptor(base.hex.encode(await identity.xOnlyPublicKey()));
|
|
239
|
+
}
|
|
215
240
|
|
|
216
241
|
// src/contracts/metadata.ts
|
|
217
242
|
var WALLET_RECEIVE_SOURCE = "wallet-receive";
|
|
@@ -263,7 +288,7 @@ function extractPubKeyBytes(value) {
|
|
|
263
288
|
return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
|
|
264
289
|
}
|
|
265
290
|
function deserializeCsvTimelock(value) {
|
|
266
|
-
return value !== void 0 && value !== "" ?
|
|
291
|
+
return value !== void 0 && value !== "" ? chunkOH2XLTXE_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
267
292
|
}
|
|
268
293
|
var CLTV_HEIGHT_THRESHOLD = 500000000n;
|
|
269
294
|
function isCltvSatisfied(context, locktime) {
|
|
@@ -305,7 +330,7 @@ function assertVhtlcSpendableNow(contract, context) {
|
|
|
305
330
|
function isCsvSpendable(context, sequence) {
|
|
306
331
|
if (sequence === void 0) return true;
|
|
307
332
|
if (!context.vtxo) return false;
|
|
308
|
-
const timelock =
|
|
333
|
+
const timelock = chunkOH2XLTXE_cjs.sequenceToTimelock(sequence);
|
|
309
334
|
if (timelock.type === "blocks") {
|
|
310
335
|
if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
|
|
311
336
|
return false;
|
|
@@ -363,21 +388,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
|
|
|
363
388
|
async function detectUsedScripts(indexerProvider, scriptHexes) {
|
|
364
389
|
const used = /* @__PURE__ */ new Set();
|
|
365
390
|
const unique = [...new Set(scriptHexes)];
|
|
366
|
-
for (let offset = 0; offset < unique.length; offset +=
|
|
367
|
-
const scripts = unique.slice(offset, offset +
|
|
391
|
+
for (let offset = 0; offset < unique.length; offset += chunkOH2XLTXE_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
|
|
392
|
+
const scripts = unique.slice(offset, offset + chunkOH2XLTXE_cjs.SCRIPT_QUERY_CHUNK_SIZE);
|
|
368
393
|
const remaining = new Set(scripts);
|
|
369
394
|
let pageIndex = 0;
|
|
370
395
|
let hasMore = true;
|
|
371
396
|
while (hasMore && remaining.size > 0) {
|
|
372
|
-
const { vtxos, page } = await
|
|
397
|
+
const { vtxos, page } = await chunkOH2XLTXE_cjs.getNormalizedVtxos(indexerProvider, {
|
|
373
398
|
scripts,
|
|
374
399
|
pageIndex,
|
|
375
|
-
pageSize:
|
|
400
|
+
pageSize: chunkOH2XLTXE_cjs.DEFAULT_PAGE_SIZE
|
|
376
401
|
});
|
|
377
402
|
for (const vtxo of vtxos) {
|
|
378
403
|
if (remaining.delete(vtxo.script)) used.add(vtxo.script);
|
|
379
404
|
}
|
|
380
|
-
hasMore = page ? vtxos.length ===
|
|
405
|
+
hasMore = page ? vtxos.length === chunkOH2XLTXE_cjs.DEFAULT_PAGE_SIZE : false;
|
|
381
406
|
pageIndex++;
|
|
382
407
|
}
|
|
383
408
|
}
|
|
@@ -438,7 +463,7 @@ var DefaultContractHandler = {
|
|
|
438
463
|
return {
|
|
439
464
|
pubKey: base.hex.encode(params.pubKey),
|
|
440
465
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
441
|
-
csvTimelock:
|
|
466
|
+
csvTimelock: chunkOH2XLTXE_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
442
467
|
};
|
|
443
468
|
},
|
|
444
469
|
deserializeParams(params) {
|
|
@@ -473,7 +498,7 @@ function defaultCandidatesAt(_index, descriptor, deps) {
|
|
|
473
498
|
params: {
|
|
474
499
|
pubKey: base.hex.encode(c.pubKey),
|
|
475
500
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
476
|
-
csvTimelock:
|
|
501
|
+
csvTimelock: chunkOH2XLTXE_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
477
502
|
},
|
|
478
503
|
script: c.scriptHex,
|
|
479
504
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -489,12 +514,12 @@ function discoverDefaultRange(entries, deps) {
|
|
|
489
514
|
}
|
|
490
515
|
exports.DelegateVtxo = void 0;
|
|
491
516
|
((DelegateVtxo2) => {
|
|
492
|
-
class Script3 extends
|
|
517
|
+
class Script3 extends chunkOH2XLTXE_cjs.VtxoScript {
|
|
493
518
|
/** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
|
|
494
519
|
constructor(options) {
|
|
495
520
|
const defaultVtxo = new exports.DefaultVtxo.Script(options);
|
|
496
521
|
const { delegatePubKey, pubKey, serverPubKey } = options;
|
|
497
|
-
const delegateScript =
|
|
522
|
+
const delegateScript = chunkOH2XLTXE_cjs.MultisigTapscript.encode({
|
|
498
523
|
pubkeys: [pubKey, delegatePubKey, serverPubKey]
|
|
499
524
|
}).script;
|
|
500
525
|
super([...defaultVtxo.scripts, delegateScript]);
|
|
@@ -533,7 +558,7 @@ var DelegateContractHandler = {
|
|
|
533
558
|
pubKey: base.hex.encode(params.pubKey),
|
|
534
559
|
serverPubKey: base.hex.encode(params.serverPubKey),
|
|
535
560
|
delegatePubKey: base.hex.encode(params.delegatePubKey),
|
|
536
|
-
csvTimelock:
|
|
561
|
+
csvTimelock: chunkOH2XLTXE_cjs.timelockToSequence(params.csvTimelock).toString()
|
|
537
562
|
};
|
|
538
563
|
},
|
|
539
564
|
deserializeParams(params) {
|
|
@@ -577,7 +602,7 @@ function delegateCandidatesAt(_index, descriptor, deps) {
|
|
|
577
602
|
pubKey: base.hex.encode(c.pubKey),
|
|
578
603
|
serverPubKey: base.hex.encode(c.serverPubKey),
|
|
579
604
|
delegatePubKey: base.hex.encode(delegatePubKey),
|
|
580
|
-
csvTimelock:
|
|
605
|
+
csvTimelock: chunkOH2XLTXE_cjs.timelockToSequence(c.csvTimelock).toString()
|
|
581
606
|
},
|
|
582
607
|
script: c.scriptHex,
|
|
583
608
|
address: c.script.address(deps.network.hrp, c.serverPubKey).encode()
|
|
@@ -1268,22 +1293,18 @@ var ArkadeScript = wrap({
|
|
|
1268
1293
|
w.byte(v);
|
|
1269
1294
|
continue;
|
|
1270
1295
|
} else if (typeof o === "number" || typeof o === "bigint") {
|
|
1271
|
-
if (o === 0 || o === 0n) {
|
|
1272
|
-
w.byte(0);
|
|
1273
|
-
continue;
|
|
1274
|
-
} else if (o >= 1 && o <= 16) {
|
|
1275
|
-
w.byte(btcSigner.OP.OP_1 - 1 + Number(o));
|
|
1276
|
-
continue;
|
|
1277
|
-
} else if (o === -1 || o === -1n) {
|
|
1278
|
-
w.byte(btcSigner.OP["1NEGATE"]);
|
|
1279
|
-
continue;
|
|
1280
|
-
}
|
|
1281
1296
|
const big = typeof o === "number" ? BigInt(o) : o;
|
|
1282
1297
|
o = encode(big);
|
|
1283
1298
|
}
|
|
1284
1299
|
if (!(o instanceof Uint8Array)) throw new Error(`Wrong Script OP=${o} (${typeof o})`);
|
|
1285
1300
|
const len = o.length;
|
|
1286
|
-
if (len
|
|
1301
|
+
if (len === 1 && o[0] >= 1 && o[0] <= 16) {
|
|
1302
|
+
w.byte(btcSigner.OP.OP_1 - 1 + o[0]);
|
|
1303
|
+
continue;
|
|
1304
|
+
} else if (len === 1 && o[0] === 129) {
|
|
1305
|
+
w.byte(btcSigner.OP["1NEGATE"]);
|
|
1306
|
+
continue;
|
|
1307
|
+
} else if (len < btcSigner.OP.PUSHDATA1) w.byte(len);
|
|
1287
1308
|
else if (len <= 255) {
|
|
1288
1309
|
w.byte(btcSigner.OP.PUSHDATA1);
|
|
1289
1310
|
w.byte(len);
|
|
@@ -1416,7 +1437,7 @@ function computeArkadeScriptPublicKey(pubKey, script) {
|
|
|
1416
1437
|
// src/script/vhtlc.ts
|
|
1417
1438
|
exports.VHTLC = void 0;
|
|
1418
1439
|
((VHTLC2) => {
|
|
1419
|
-
class BaseScript extends
|
|
1440
|
+
class BaseScript extends chunkOH2XLTXE_cjs.VtxoScript {
|
|
1420
1441
|
options;
|
|
1421
1442
|
claimScript;
|
|
1422
1443
|
refundScript;
|
|
@@ -1441,27 +1462,27 @@ exports.VHTLC = void 0;
|
|
|
1441
1462
|
unilateralRefundWithoutReceiverDelay
|
|
1442
1463
|
} = options;
|
|
1443
1464
|
const conditionScript = preimageCondition(preimageHash);
|
|
1444
|
-
const claimScript =
|
|
1465
|
+
const claimScript = chunkOH2XLTXE_cjs.ConditionMultisigTapscript.encode({
|
|
1445
1466
|
conditionScript,
|
|
1446
1467
|
pubkeys: [receiver, server]
|
|
1447
1468
|
}).script;
|
|
1448
|
-
const refundScript =
|
|
1469
|
+
const refundScript = chunkOH2XLTXE_cjs.MultisigTapscript.encode({
|
|
1449
1470
|
pubkeys: [sender, receiver, server]
|
|
1450
1471
|
}).script;
|
|
1451
|
-
const refundWithoutReceiverScript =
|
|
1472
|
+
const refundWithoutReceiverScript = chunkOH2XLTXE_cjs.CLTVMultisigTapscript.encode({
|
|
1452
1473
|
absoluteTimelock: refundLocktime,
|
|
1453
1474
|
pubkeys: [sender, server]
|
|
1454
1475
|
}).script;
|
|
1455
|
-
const unilateralClaimScript =
|
|
1476
|
+
const unilateralClaimScript = chunkOH2XLTXE_cjs.ConditionCSVMultisigTapscript.encode({
|
|
1456
1477
|
conditionScript,
|
|
1457
1478
|
timelock: unilateralClaimDelay,
|
|
1458
1479
|
pubkeys: [receiver]
|
|
1459
1480
|
}).script;
|
|
1460
|
-
const unilateralRefundScript =
|
|
1481
|
+
const unilateralRefundScript = chunkOH2XLTXE_cjs.CSVMultisigTapscript.encode({
|
|
1461
1482
|
timelock: unilateralRefundDelay,
|
|
1462
1483
|
pubkeys: [sender, receiver]
|
|
1463
1484
|
}).script;
|
|
1464
|
-
const unilateralRefundWithoutReceiverScript =
|
|
1485
|
+
const unilateralRefundWithoutReceiverScript = chunkOH2XLTXE_cjs.CSVMultisigTapscript.encode({
|
|
1465
1486
|
timelock: unilateralRefundWithoutReceiverDelay,
|
|
1466
1487
|
pubkeys: [sender]
|
|
1467
1488
|
}).script;
|
|
@@ -1477,7 +1498,7 @@ exports.VHTLC = void 0;
|
|
|
1477
1498
|
let nonInteractiveClaimScript;
|
|
1478
1499
|
if (options.nonInteractiveClaim) {
|
|
1479
1500
|
arkadeScriptNic = enforcePayTo(options.nonInteractiveClaim.receiverPkScript);
|
|
1480
|
-
nonInteractiveClaimScript =
|
|
1501
|
+
nonInteractiveClaimScript = chunkOH2XLTXE_cjs.ConditionMultisigTapscript.encode({
|
|
1481
1502
|
conditionScript,
|
|
1482
1503
|
pubkeys: [
|
|
1483
1504
|
server,
|
|
@@ -1493,7 +1514,7 @@ exports.VHTLC = void 0;
|
|
|
1493
1514
|
let nonInteractiveRefundScript;
|
|
1494
1515
|
if (options.nonInteractiveRefund) {
|
|
1495
1516
|
arkadeScriptNir = enforcePayTo(options.nonInteractiveRefund.senderPkScript);
|
|
1496
|
-
nonInteractiveRefundScript =
|
|
1517
|
+
nonInteractiveRefundScript = chunkOH2XLTXE_cjs.MultisigTapscript.encode({
|
|
1497
1518
|
pubkeys: [
|
|
1498
1519
|
server,
|
|
1499
1520
|
receiver,
|
|
@@ -1696,9 +1717,9 @@ var VHTLCContractHandler = {
|
|
|
1696
1717
|
server: base.hex.encode(params.server),
|
|
1697
1718
|
hash: base.hex.encode(params.preimageHash),
|
|
1698
1719
|
refundLocktime: params.refundLocktime.toString(),
|
|
1699
|
-
claimDelay:
|
|
1700
|
-
refundDelay:
|
|
1701
|
-
refundNoReceiverDelay:
|
|
1720
|
+
claimDelay: chunkOH2XLTXE_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1721
|
+
refundDelay: chunkOH2XLTXE_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1722
|
+
refundNoReceiverDelay: chunkOH2XLTXE_cjs.timelockToSequence(
|
|
1702
1723
|
params.unilateralRefundWithoutReceiverDelay
|
|
1703
1724
|
).toString()
|
|
1704
1725
|
};
|
|
@@ -1710,9 +1731,9 @@ var VHTLCContractHandler = {
|
|
|
1710
1731
|
server: base.hex.decode(params.server),
|
|
1711
1732
|
preimageHash: base.hex.decode(params.hash),
|
|
1712
1733
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1713
|
-
unilateralClaimDelay:
|
|
1714
|
-
unilateralRefundDelay:
|
|
1715
|
-
unilateralRefundWithoutReceiverDelay:
|
|
1734
|
+
unilateralClaimDelay: chunkOH2XLTXE_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
1735
|
+
unilateralRefundDelay: chunkOH2XLTXE_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
1736
|
+
unilateralRefundWithoutReceiverDelay: chunkOH2XLTXE_cjs.sequenceToTimelock(
|
|
1716
1737
|
Number(params.refundNoReceiverDelay)
|
|
1717
1738
|
)
|
|
1718
1739
|
};
|
|
@@ -1871,21 +1892,19 @@ var VHTLCContractHandler = {
|
|
|
1871
1892
|
* `refundWithoutReceiver` — `CLTV[sender, server]`, the sender's OWN
|
|
1872
1893
|
* refund, which the server rejects until `refundLocktime` matures. The
|
|
1873
1894
|
* reasons are that an escrowed lockup must not count toward the
|
|
1874
|
-
* `available` balance bucket
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
1877
|
-
*
|
|
1878
|
-
*
|
|
1879
|
-
*
|
|
1895
|
+
* `available` balance bucket, and that generic RENEWAL must not silently
|
|
1896
|
+
* execute a refund the caller never asked for — `runPeriodicSettle` selects
|
|
1897
|
+
* through `getSpendableVtxos`, which this gate filters, and it runs
|
|
1898
|
+
* unprompted whenever a wallet is built without an explicit
|
|
1899
|
+
* `settlementConfig`.
|
|
1900
|
+
*
|
|
1901
|
+
* **Inseparable from {@link deriveTapscripts}.** Deriving the leaf without
|
|
1902
|
+
* closing the gate hands generic renewal an escrow it had never been
|
|
1903
|
+
* offered before; before that method existed the answer here was
|
|
1904
|
+
* unobservable, so the two only ever made sense together.
|
|
1880
1905
|
*
|
|
1881
|
-
*
|
|
1882
|
-
*
|
|
1883
|
-
* reached this gate and the answer here was unobservable — the previous
|
|
1884
|
-
* `true` and the missing derivation were safe only by cancelling out.
|
|
1885
|
-
* Deriving the leaf without closing the gate would hand generic renewal an
|
|
1886
|
-
* escrow it had never been offered before. (The earlier `true` was
|
|
1887
|
-
* justified as preserving selection of in-flight swaps; no such selection
|
|
1888
|
-
* was ever reachable, for that same annotation reason.)
|
|
1906
|
+
* Recovery is filtered on {@link assertSpendableNow}, not on this: the gate
|
|
1907
|
+
* is permanent, and applying it there would strand a matured lockup.
|
|
1889
1908
|
*/
|
|
1890
1909
|
isGenericallySpendable: () => false,
|
|
1891
1910
|
/**
|
|
@@ -1913,7 +1932,12 @@ var VHTLCContractHandler = {
|
|
|
1913
1932
|
* on this leaf is only valid once `refundLocktime` has matured, so a
|
|
1914
1933
|
* recovery round that sweeps this VTXO early is rejected by the server.
|
|
1915
1934
|
* Nothing in this handler can enforce that, because the annotation is
|
|
1916
|
-
* derived per contract and knows no clock
|
|
1935
|
+
* derived per contract and knows no clock; `recoverVtxos` filters on
|
|
1936
|
+
* {@link assertSpendableNow} for it.
|
|
1937
|
+
*
|
|
1938
|
+
* **Role-blind.** A receiver's row gets the same leaf, which names keys that
|
|
1939
|
+
* wallet does not hold, so it is satisfiable only by the wallet holding the
|
|
1940
|
+
* lockup's `sender` key and fails at intent registration for anyone else.
|
|
1917
1941
|
*/
|
|
1918
1942
|
deriveTapscripts(script) {
|
|
1919
1943
|
const leaf = script.refundWithoutReceiver();
|
|
@@ -1946,9 +1970,9 @@ var VHTLCV2ContractHandler = {
|
|
|
1946
1970
|
server: base.hex.encode(params.server),
|
|
1947
1971
|
hash: base.hex.encode(params.preimageHash),
|
|
1948
1972
|
refundLocktime: params.refundLocktime.toString(),
|
|
1949
|
-
claimDelay:
|
|
1950
|
-
refundDelay:
|
|
1951
|
-
refundNoReceiverDelay:
|
|
1973
|
+
claimDelay: chunkOH2XLTXE_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
|
|
1974
|
+
refundDelay: chunkOH2XLTXE_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
|
|
1975
|
+
refundNoReceiverDelay: chunkOH2XLTXE_cjs.timelockToSequence(
|
|
1952
1976
|
params.unilateralRefundWithoutReceiverDelay
|
|
1953
1977
|
).toString(),
|
|
1954
1978
|
// Spread rather than written as `undefined`: a `Record<string,
|
|
@@ -1991,9 +2015,9 @@ var VHTLCV2ContractHandler = {
|
|
|
1991
2015
|
server: base.hex.decode(params.server),
|
|
1992
2016
|
preimageHash: base.hex.decode(params.hash),
|
|
1993
2017
|
refundLocktime: BigInt(params.refundLocktime),
|
|
1994
|
-
unilateralClaimDelay:
|
|
1995
|
-
unilateralRefundDelay:
|
|
1996
|
-
unilateralRefundWithoutReceiverDelay:
|
|
2018
|
+
unilateralClaimDelay: chunkOH2XLTXE_cjs.sequenceToTimelock(Number(params.claimDelay)),
|
|
2019
|
+
unilateralRefundDelay: chunkOH2XLTXE_cjs.sequenceToTimelock(Number(params.refundDelay)),
|
|
2020
|
+
unilateralRefundWithoutReceiverDelay: chunkOH2XLTXE_cjs.sequenceToTimelock(
|
|
1997
2021
|
Number(params.refundNoReceiverDelay)
|
|
1998
2022
|
),
|
|
1999
2023
|
...claim && {
|
|
@@ -2159,10 +2183,12 @@ var VHTLCV2ContractHandler = {
|
|
|
2159
2183
|
* complete, or race a claim already in flight. The `vhtlc` handler now
|
|
2160
2184
|
* answers the same, for the same reason.
|
|
2161
2185
|
*
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2165
|
-
* refund
|
|
2186
|
+
* The gate covers `available` and renewal. Recovery is generic and names
|
|
2187
|
+
* nothing, so it is not covered here: `recoverVtxos` filters on
|
|
2188
|
+
* {@link assertSpendableNow} instead, which drops a lockup only while its
|
|
2189
|
+
* refund path is shut rather than forever. The explicit routes out —
|
|
2190
|
+
* `settle({ inputs })`, or `@arkade-os/swap`'s `pushRefundWithoutReceiver`
|
|
2191
|
+
* over `findLockupVtxos`' outpoints — are unaffected either way.
|
|
2166
2192
|
*/
|
|
2167
2193
|
isGenericallySpendable: () => false,
|
|
2168
2194
|
/**
|
|
@@ -2194,7 +2220,12 @@ var VHTLCV2ContractHandler = {
|
|
|
2194
2220
|
* round that sweeps this VTXO early is rejected by the server. That is the
|
|
2195
2221
|
* same constraint `packages/boltz-swap` encodes as "pre-CLTV recoverable →
|
|
2196
2222
|
* skipped"; nothing in this handler can enforce it, because the annotation
|
|
2197
|
-
* is derived per contract and knows no clock.
|
|
2223
|
+
* is derived per contract and knows no clock. `recoverVtxos` filters on
|
|
2224
|
+
* {@link assertSpendableNow} for it.
|
|
2225
|
+
*
|
|
2226
|
+
* **Role-blind.** A receiver's row gets the same leaf, which names keys that
|
|
2227
|
+
* wallet does not hold, so it is satisfiable only by the wallet holding the
|
|
2228
|
+
* lockup's `sender` key and fails at intent registration for anyone else.
|
|
2198
2229
|
*/
|
|
2199
2230
|
deriveTapscripts(script) {
|
|
2200
2231
|
const leaf = script.refundWithoutReceiver();
|
|
@@ -2259,7 +2290,7 @@ var BoardingContractHandler = {
|
|
|
2259
2290
|
const coins = await deps.onchainProvider.getCoins(onchainAddress);
|
|
2260
2291
|
if (coins.length === 0) return [];
|
|
2261
2292
|
const scriptHex = base.hex.encode(script.pkScript);
|
|
2262
|
-
const boardingSeq =
|
|
2293
|
+
const boardingSeq = chunkOH2XLTXE_cjs.timelockToSequence(deps.boardingTimelock);
|
|
2263
2294
|
return [
|
|
2264
2295
|
{
|
|
2265
2296
|
type: "boarding",
|
|
@@ -2420,27 +2451,27 @@ function encodeTapscriptSegment(seg, pubkeys, args) {
|
|
|
2420
2451
|
if (seg.csv) {
|
|
2421
2452
|
const timelock = { type: seg.csv.type, value: resolveTimelockValue(seg.csv.value, args) };
|
|
2422
2453
|
if (seg.asm) {
|
|
2423
|
-
return
|
|
2454
|
+
return chunkOH2XLTXE_cjs.ConditionCSVMultisigTapscript.encode({
|
|
2424
2455
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2425
2456
|
timelock,
|
|
2426
2457
|
pubkeys
|
|
2427
2458
|
});
|
|
2428
2459
|
}
|
|
2429
|
-
return
|
|
2460
|
+
return chunkOH2XLTXE_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
|
|
2430
2461
|
}
|
|
2431
2462
|
if (seg.cltv !== void 0) {
|
|
2432
|
-
return
|
|
2463
|
+
return chunkOH2XLTXE_cjs.CLTVMultisigTapscript.encode({
|
|
2433
2464
|
absoluteTimelock: resolveTimelockValue(seg.cltv, args),
|
|
2434
2465
|
pubkeys
|
|
2435
2466
|
});
|
|
2436
2467
|
}
|
|
2437
2468
|
if (seg.asm) {
|
|
2438
|
-
return
|
|
2469
|
+
return chunkOH2XLTXE_cjs.ConditionMultisigTapscript.encode({
|
|
2439
2470
|
conditionScript: resolveAsm(seg.asm, args),
|
|
2440
2471
|
pubkeys
|
|
2441
2472
|
});
|
|
2442
2473
|
}
|
|
2443
|
-
return
|
|
2474
|
+
return chunkOH2XLTXE_cjs.MultisigTapscript.encode({ pubkeys });
|
|
2444
2475
|
}
|
|
2445
2476
|
function compileFunctions(program, args, keys) {
|
|
2446
2477
|
if (program.version !== SUPPORTED_PROGRAM_VERSION) {
|
|
@@ -2470,7 +2501,7 @@ function compileFunctions(program, args, keys) {
|
|
|
2470
2501
|
return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
|
|
2471
2502
|
});
|
|
2472
2503
|
}
|
|
2473
|
-
var ArkadeProgramScript = class extends
|
|
2504
|
+
var ArkadeProgramScript = class extends chunkOH2XLTXE_cjs.VtxoScript {
|
|
2474
2505
|
constructor(program, args, keys) {
|
|
2475
2506
|
const partial = compileFunctions(program, args, keys);
|
|
2476
2507
|
super(partial.map((p) => p.leafScript));
|
|
@@ -2683,7 +2714,7 @@ function pathsFor(script, context, opts) {
|
|
|
2683
2714
|
continue;
|
|
2684
2715
|
}
|
|
2685
2716
|
if (requiresServer) continue;
|
|
2686
|
-
const sequence = csv ? Number(
|
|
2717
|
+
const sequence = csv ? Number(chunkOH2XLTXE_cjs.timelockToSequence(csv)) : void 0;
|
|
2687
2718
|
if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
|
|
2688
2719
|
if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
|
|
2689
2720
|
continue;
|
|
@@ -2796,11 +2827,14 @@ exports.deserializeArkadeContractParams = deserializeArkadeContractParams;
|
|
|
2796
2827
|
exports.fromASM = fromASM;
|
|
2797
2828
|
exports.getOpcodeName = getOpcodeName;
|
|
2798
2829
|
exports.getOpcodeValue = getOpcodeValue;
|
|
2830
|
+
exports.identityDescriptor = identityDescriptor;
|
|
2799
2831
|
exports.inputName = inputName;
|
|
2800
2832
|
exports.isCltvSatisfied = isCltvSatisfied;
|
|
2801
2833
|
exports.isCsvSpendable = isCsvSpendable;
|
|
2802
2834
|
exports.isMainnetDescriptor = isMainnetDescriptor;
|
|
2835
|
+
exports.normalizeToDescriptor = normalizeToDescriptor;
|
|
2803
2836
|
exports.parseArtifact = parseArtifact;
|
|
2837
|
+
exports.parseHDDescriptor = parseHDDescriptor;
|
|
2804
2838
|
exports.resolveAsm = resolveAsm;
|
|
2805
2839
|
exports.serializeArkadeContractParams = serializeArkadeContractParams;
|
|
2806
2840
|
exports.speculativeReceiveMetadata = speculativeReceiveMetadata;
|
|
@@ -2808,5 +2842,5 @@ exports.stringifyArtifact = stringifyArtifact;
|
|
|
2808
2842
|
exports.toASM = toASM;
|
|
2809
2843
|
exports.validateProgram = validateProgram;
|
|
2810
2844
|
exports.witnessRefToBytes = witnessRefToBytes;
|
|
2811
|
-
//# sourceMappingURL=chunk-
|
|
2812
|
-
//# sourceMappingURL=chunk-
|
|
2845
|
+
//# sourceMappingURL=chunk-G53HASDV.cjs.map
|
|
2846
|
+
//# sourceMappingURL=chunk-G53HASDV.cjs.map
|