@arkade-os/sdk 0.5.4 → 0.5.6

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.
Files changed (112) hide show
  1. package/README.md +103 -17
  2. package/dist/adapters/expo.cjs +7 -6
  3. package/dist/adapters/expo.d.cts +4 -3
  4. package/dist/adapters/expo.d.ts +4 -3
  5. package/dist/adapters/expo.js +4 -3
  6. package/dist/{asyncStorageTaskQueue-DTBa8EH7.d.cts → asyncStorageTaskQueue-Bh2n0msM.d.cts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-DHMIxY04.d.ts → asyncStorageTaskQueue-CpkstKZ5.d.ts} +2 -2
  8. package/dist/base-C-Y5t_0F.d.cts +359 -0
  9. package/dist/base-C-Y5t_0F.d.ts +359 -0
  10. package/dist/{chunk-6CUP6ZIF.js → chunk-47Z4LEIW.js} +17 -841
  11. package/dist/chunk-47Z4LEIW.js.map +1 -0
  12. package/dist/{chunk-DNITZVNG.cjs → chunk-4X67IB2V.cjs} +18 -17
  13. package/dist/chunk-4X67IB2V.cjs.map +1 -0
  14. package/dist/{chunk-BTRCN4JJ.js → chunk-C7NY6WSA.js} +64 -4
  15. package/dist/chunk-C7NY6WSA.js.map +1 -0
  16. package/dist/{chunk-TUOLZBNC.js → chunk-DJYX73W2.js} +5 -4
  17. package/dist/chunk-DJYX73W2.js.map +1 -0
  18. package/dist/chunk-DNFTHG73.js +829 -0
  19. package/dist/chunk-DNFTHG73.js.map +1 -0
  20. package/dist/chunk-FDJ734CH.js +882 -0
  21. package/dist/chunk-FDJ734CH.js.map +1 -0
  22. package/dist/chunk-FLPWNMX3.cjs +930 -0
  23. package/dist/chunk-FLPWNMX3.cjs.map +1 -0
  24. package/dist/{chunk-WXNSISXK.cjs → chunk-HKEPJBTY.cjs} +79 -18
  25. package/dist/chunk-HKEPJBTY.cjs.map +1 -0
  26. package/dist/chunk-JFJNB7ZH.cjs +884 -0
  27. package/dist/chunk-JFJNB7ZH.cjs.map +1 -0
  28. package/dist/{chunk-GHUUT54D.cjs → chunk-LZAINCGU.cjs} +89 -933
  29. package/dist/chunk-LZAINCGU.cjs.map +1 -0
  30. package/dist/{chunk-E6OOJEHL.cjs → chunk-NDQ4LB4X.cjs} +60 -934
  31. package/dist/chunk-NDQ4LB4X.cjs.map +1 -0
  32. package/dist/{chunk-AG4TFD6F.js → chunk-QTMK34TP.js} +79 -884
  33. package/dist/chunk-QTMK34TP.js.map +1 -0
  34. package/dist/chunk-V3ZLL5VY.js +380 -0
  35. package/dist/chunk-V3ZLL5VY.js.map +1 -0
  36. package/dist/{chunk-MWVAWFX6.js → chunk-VWW2ZBPI.js} +4 -4
  37. package/dist/{chunk-MWVAWFX6.js.map → chunk-VWW2ZBPI.js.map} +1 -1
  38. package/dist/chunk-X6ZI53DZ.cjs +383 -0
  39. package/dist/chunk-X6ZI53DZ.cjs.map +1 -0
  40. package/dist/{chunk-F3FAE7VJ.cjs → chunk-Y3CDDPWI.cjs} +3138 -1764
  41. package/dist/chunk-Y3CDDPWI.cjs.map +1 -0
  42. package/dist/{chunk-ZJHLLDBP.js → chunk-YKT4NAQG.js} +2653 -1295
  43. package/dist/chunk-YKT4NAQG.js.map +1 -0
  44. package/dist/{chunk-B6VNKGIH.cjs → chunk-YS76JSGP.cjs} +10 -10
  45. package/dist/{chunk-B6VNKGIH.cjs.map → chunk-YS76JSGP.cjs.map} +1 -1
  46. package/dist/compiler.cjs +50 -0
  47. package/dist/compiler.cjs.map +1 -0
  48. package/dist/compiler.d.cts +38 -0
  49. package/dist/compiler.d.ts +38 -0
  50. package/dist/compiler.js +47 -0
  51. package/dist/compiler.js.map +1 -0
  52. package/dist/contracts/handlers/index.cjs +11 -9
  53. package/dist/contracts/handlers/index.d.cts +6 -4
  54. package/dist/contracts/handlers/index.d.ts +6 -4
  55. package/dist/contracts/handlers/index.js +4 -2
  56. package/dist/{delegate-xrSBNybC.d.ts → delegate-gGkUnYpi.d.cts} +1 -1
  57. package/dist/{delegate-f4_t864Z.d.cts → delegate-iyDum4fw.d.ts} +1 -1
  58. package/dist/{index-BJDz15ms.d.ts → index-2wKMrT0a.d.ts} +5 -270
  59. package/dist/{index-BjiVGtp8.d.cts → index-46g577Ka.d.cts} +5 -270
  60. package/dist/{index-DRwe0UDN.d.cts → index-C66rjxz2.d.ts} +1603 -1721
  61. package/dist/{index-DRwe0UDN.d.ts → index-Dqk07NwJ.d.cts} +1603 -1721
  62. package/dist/index.cjs +457 -378
  63. package/dist/index.d.cts +640 -385
  64. package/dist/index.d.ts +640 -385
  65. package/dist/index.js +7 -4
  66. package/dist/{wallet-jVBDQl6R.d.cts → keyringDescriptorProvider-DiBM4GmB.d.ts} +417 -366
  67. package/dist/{wallet-Oc3Wd5gv.d.ts → keyringDescriptorProvider-DnaLUC7v.d.cts} +417 -366
  68. package/dist/program-BARSNg3X.d.ts +286 -0
  69. package/dist/program-znrWkxE4.d.cts +286 -0
  70. package/dist/repositories/realm/index.cjs +71 -51
  71. package/dist/repositories/realm/index.cjs.map +1 -1
  72. package/dist/repositories/realm/index.d.cts +20 -9
  73. package/dist/repositories/realm/index.d.ts +20 -9
  74. package/dist/repositories/realm/index.js +42 -23
  75. package/dist/repositories/realm/index.js.map +1 -1
  76. package/dist/repositories/sqlite/index.cjs +81 -56
  77. package/dist/repositories/sqlite/index.cjs.map +1 -1
  78. package/dist/repositories/sqlite/index.d.cts +17 -8
  79. package/dist/repositories/sqlite/index.d.ts +17 -8
  80. package/dist/repositories/sqlite/index.js +55 -31
  81. package/dist/repositories/sqlite/index.js.map +1 -1
  82. package/dist/{taskRunner-CDlNeth0.d.ts → taskRunner-BM6IAKlS.d.ts} +2 -2
  83. package/dist/{taskRunner-BPPU-YHG.d.cts → taskRunner-BmDIZiSl.d.cts} +2 -2
  84. package/dist/wallet/expo/background.cjs +17 -14
  85. package/dist/wallet/expo/background.cjs.map +1 -1
  86. package/dist/wallet/expo/background.d.cts +5 -4
  87. package/dist/wallet/expo/background.d.ts +5 -4
  88. package/dist/wallet/expo/background.js +9 -6
  89. package/dist/wallet/expo/background.js.map +1 -1
  90. package/dist/wallet/expo/index.cjs +29 -16
  91. package/dist/wallet/expo/index.cjs.map +1 -1
  92. package/dist/wallet/expo/index.d.cts +12 -7
  93. package/dist/wallet/expo/index.d.ts +12 -7
  94. package/dist/wallet/expo/index.js +19 -6
  95. package/dist/wallet/expo/index.js.map +1 -1
  96. package/dist/worker/expo/index.cjs +12 -9
  97. package/dist/worker/expo/index.cjs.map +1 -1
  98. package/dist/worker/expo/index.d.cts +6 -5
  99. package/dist/worker/expo/index.d.ts +6 -5
  100. package/dist/worker/expo/index.js +8 -5
  101. package/dist/worker/expo/index.js.map +1 -1
  102. package/package.json +16 -1
  103. package/dist/chunk-6CUP6ZIF.js.map +0 -1
  104. package/dist/chunk-AG4TFD6F.js.map +0 -1
  105. package/dist/chunk-BTRCN4JJ.js.map +0 -1
  106. package/dist/chunk-DNITZVNG.cjs.map +0 -1
  107. package/dist/chunk-E6OOJEHL.cjs.map +0 -1
  108. package/dist/chunk-F3FAE7VJ.cjs.map +0 -1
  109. package/dist/chunk-GHUUT54D.cjs.map +0 -1
  110. package/dist/chunk-TUOLZBNC.js.map +0 -1
  111. package/dist/chunk-WXNSISXK.cjs.map +0 -1
  112. package/dist/chunk-ZJHLLDBP.js.map +0 -1
@@ -1,33 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkGHUUT54D_cjs = require('./chunk-GHUUT54D.cjs');
3
+ var chunkJFJNB7ZH_cjs = require('./chunk-JFJNB7ZH.cjs');
4
+ var chunkLZAINCGU_cjs = require('./chunk-LZAINCGU.cjs');
5
+ var chunkFLPWNMX3_cjs = require('./chunk-FLPWNMX3.cjs');
4
6
  var base = require('@scure/base');
5
7
  var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
6
8
  var btcSigner = require('@scure/btc-signer');
7
- var P = require('micro-packed');
8
- var secp256k1_js = require('@noble/curves/secp256k1.js');
9
- var utils_js = require('@noble/curves/utils.js');
10
- var utils_js$1 = require('@scure/btc-signer/utils.js');
11
-
12
- function _interopNamespace(e) {
13
- if (e && e.__esModule) return e;
14
- var n = Object.create(null);
15
- if (e) {
16
- Object.keys(e).forEach(function (k) {
17
- if (k !== 'default') {
18
- var d = Object.getOwnPropertyDescriptor(e, k);
19
- Object.defineProperty(n, k, d.get ? d : {
20
- enumerable: true,
21
- get: function () { return e[k]; }
22
- });
23
- }
24
- });
25
- }
26
- n.default = e;
27
- return Object.freeze(n);
28
- }
29
-
30
- var P__namespace = /*#__PURE__*/_interopNamespace(P);
31
9
 
32
10
  // src/contracts/handlers/registry.ts
33
11
  var ContractHandlerRegistry = class {
@@ -68,14 +46,14 @@ var ContractHandlerRegistry = class {
68
46
  var contractHandlers = new ContractHandlerRegistry();
69
47
  exports.DefaultVtxo = void 0;
70
48
  ((DefaultVtxo2) => {
71
- class Script3 extends chunkGHUUT54D_cjs.VtxoScript {
49
+ class Script2 extends chunkFLPWNMX3_cjs.VtxoScript {
72
50
  /** Create the default virtual output script with one forfeit path and one exit path. */
73
51
  constructor(options) {
74
52
  const { pubKey, serverPubKey, csvTimelock } = options;
75
- const forfeitScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
53
+ const forfeitScript = chunkFLPWNMX3_cjs.MultisigTapscript.encode({
76
54
  pubkeys: [pubKey, serverPubKey]
77
55
  }).script;
78
- const exitScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
56
+ const exitScript = chunkFLPWNMX3_cjs.CSVMultisigTapscript.encode({
79
57
  timelock: csvTimelock,
80
58
  pubkeys: [pubKey]
81
59
  }).script;
@@ -101,7 +79,7 @@ exports.DefaultVtxo = void 0;
101
79
  return this.findLeaf(this.exitScript);
102
80
  }
103
81
  }
104
- DefaultVtxo2.Script = Script3;
82
+ DefaultVtxo2.Script = Script2;
105
83
  })(exports.DefaultVtxo || (exports.DefaultVtxo = {}));
106
84
  function isMainnetDescriptor(descriptor) {
107
85
  return !descriptor.includes("tpub");
@@ -267,7 +245,7 @@ function extractPubKeyBytes(value) {
267
245
  return base.hex.decode(extractPubKey(normalizeToDescriptor(value)));
268
246
  }
269
247
  function deserializeCsvTimelock(value) {
270
- return value !== void 0 && value !== "" ? chunkGHUUT54D_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
248
+ return value !== void 0 && value !== "" ? chunkFLPWNMX3_cjs.sequenceToTimelock(Number(value)) : exports.DefaultVtxo.Script.DEFAULT_TIMELOCK;
271
249
  }
272
250
  var CLTV_HEIGHT_THRESHOLD = 500000000n;
273
251
  function isCltvSatisfied(context, locktime) {
@@ -431,14 +409,14 @@ function deriveVhtlcTapscripts(script) {
431
409
  const leaf = script.refundWithoutReceiver();
432
410
  return {
433
411
  forfeitTapLeafScript: leaf,
434
- intentTapLeafScript: leaf,
412
+ proofTapLeafScript: leaf,
435
413
  tapTree: script.encode()
436
414
  };
437
415
  }
438
416
  function isCsvSpendable(context, sequence) {
439
417
  if (sequence === void 0) return true;
440
418
  if (!context.vtxo) return false;
441
- const timelock = chunkGHUUT54D_cjs.sequenceToTimelock(sequence);
419
+ const timelock = chunkFLPWNMX3_cjs.sequenceToTimelock(sequence);
442
420
  if (timelock.type === "blocks") {
443
421
  if (context.blockHeight === void 0 || context.vtxo.status.block_height === void 0) {
444
422
  return false;
@@ -496,21 +474,21 @@ function forfeitExitSpendablePaths(script, contract, context) {
496
474
  async function detectUsedScripts(indexerProvider, scriptHexes) {
497
475
  const used = /* @__PURE__ */ new Set();
498
476
  const unique = [...new Set(scriptHexes)];
499
- for (let offset = 0; offset < unique.length; offset += chunkGHUUT54D_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
500
- const scripts = unique.slice(offset, offset + chunkGHUUT54D_cjs.SCRIPT_QUERY_CHUNK_SIZE);
477
+ for (let offset = 0; offset < unique.length; offset += chunkLZAINCGU_cjs.SCRIPT_QUERY_CHUNK_SIZE) {
478
+ const scripts = unique.slice(offset, offset + chunkLZAINCGU_cjs.SCRIPT_QUERY_CHUNK_SIZE);
501
479
  const remaining = new Set(scripts);
502
480
  let pageIndex = 0;
503
481
  let hasMore = true;
504
482
  while (hasMore && remaining.size > 0) {
505
- const { vtxos, page } = await chunkGHUUT54D_cjs.getNormalizedVtxos(indexerProvider, {
483
+ const { vtxos, page } = await chunkLZAINCGU_cjs.getNormalizedVtxos(indexerProvider, {
506
484
  scripts,
507
485
  pageIndex,
508
- pageSize: chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE
486
+ pageSize: chunkLZAINCGU_cjs.DEFAULT_PAGE_SIZE
509
487
  });
510
488
  for (const vtxo of vtxos) {
511
489
  if (remaining.delete(vtxo.script)) used.add(vtxo.script);
512
490
  }
513
- hasMore = page ? vtxos.length === chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE : false;
491
+ hasMore = page ? vtxos.length === chunkLZAINCGU_cjs.DEFAULT_PAGE_SIZE : false;
514
492
  pageIndex++;
515
493
  }
516
494
  }
@@ -571,7 +549,7 @@ var DefaultContractHandler = {
571
549
  return {
572
550
  pubKey: base.hex.encode(params.pubKey),
573
551
  serverPubKey: base.hex.encode(params.serverPubKey),
574
- csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(params.csvTimelock).toString()
552
+ csvTimelock: chunkFLPWNMX3_cjs.timelockToSequence(params.csvTimelock).toString()
575
553
  };
576
554
  },
577
555
  deserializeParams(params) {
@@ -618,12 +596,12 @@ function discoverDefaultRange(entries, deps) {
618
596
  }
619
597
  exports.DelegateVtxo = void 0;
620
598
  ((DelegateVtxo2) => {
621
- class Script3 extends chunkGHUUT54D_cjs.VtxoScript {
599
+ class Script2 extends chunkFLPWNMX3_cjs.VtxoScript {
622
600
  /** Create a delegated virtual output script with forfeit, exit, and delegate paths. */
623
601
  constructor(options) {
624
602
  const defaultVtxo = new exports.DefaultVtxo.Script(options);
625
603
  const { delegatePubKey, pubKey, serverPubKey } = options;
626
- const delegateScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
604
+ const delegateScript = chunkFLPWNMX3_cjs.MultisigTapscript.encode({
627
605
  pubkeys: [pubKey, delegatePubKey, serverPubKey]
628
606
  }).script;
629
607
  super([...defaultVtxo.scripts, delegateScript]);
@@ -647,7 +625,7 @@ exports.DelegateVtxo = void 0;
647
625
  return this.findLeaf(this.delegateScript);
648
626
  }
649
627
  }
650
- DelegateVtxo2.Script = Script3;
628
+ DelegateVtxo2.Script = Script2;
651
629
  })(exports.DelegateVtxo || (exports.DelegateVtxo = {}));
652
630
 
653
631
  // src/contracts/handlers/delegate.ts
@@ -662,7 +640,7 @@ var DelegateContractHandler = {
662
640
  pubKey: base.hex.encode(params.pubKey),
663
641
  serverPubKey: base.hex.encode(params.serverPubKey),
664
642
  delegatePubKey: base.hex.encode(params.delegatePubKey),
665
- csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(params.csvTimelock).toString()
643
+ csvTimelock: chunkFLPWNMX3_cjs.timelockToSequence(params.csvTimelock).toString()
666
644
  };
667
645
  },
668
646
  deserializeParams(params) {
@@ -718,334 +696,9 @@ function discoverDelegateRange(entries, deps) {
718
696
  (c, index, descriptor) => ({ ...c, ...rotatedReceiveMetadata(index, descriptor) })
719
697
  );
720
698
  }
721
- var ARKADE_OP = {
722
- // Merkle Branch Verification (0xb3 — repurposed NOP4 slot)
723
- MERKLEBRANCHVERIFY: 179,
724
- PUT: 187,
725
- // Digest (0xc3)
726
- DIGEST: 195,
727
- // SHA256 Streaming (0xc4-0xc6)
728
- SHA256INITIALIZE: 196,
729
- SHA256UPDATE: 197,
730
- SHA256FINALIZE: 198,
731
- // Input Introspection (0xc7-0xcb)
732
- INSPECTINPUTOUTPOINT: 199,
733
- INSPECTINPUTARKADESCRIPTHASH: 200,
734
- INSPECTINPUTVALUE: 201,
735
- INSPECTINPUTSCRIPTPUBKEY: 202,
736
- INSPECTINPUTSEQUENCE: 203,
737
- // Signatures (0xcc-0xcd)
738
- CHECKSIGFROMSTACK: 204,
739
- PUSHCURRENTINPUTINDEX: 205,
740
- // Input Arkade Witness Introspection (0xce)
741
- INSPECTINPUTARKADEWITNESSHASH: 206,
742
- // Output Introspection (0xcf, 0xd1)
743
- INSPECTOUTPUTVALUE: 207,
744
- INSPECTOUTPUTSCRIPTPUBKEY: 209,
745
- // Transaction Introspection (0xd2-0xd6)
746
- INSPECTVERSION: 210,
747
- INSPECTLOCKTIME: 211,
748
- INSPECTNUMINPUTS: 212,
749
- INSPECTNUMOUTPUTS: 213,
750
- TXWEIGHT: 214,
751
- // Byte/Number Conversion & Arithmetic (0xd7-0xda)
752
- NUM2BIN: 215,
753
- BIN2NUM: 216,
754
- REVERSEBYTES: 217,
755
- MODEXP: 218,
756
- // VTXO Expiry & Emulator Clock (0xdb-0xdc)
757
- PUSHEXPIRY: 219,
758
- CHECKTIME: 220,
759
- // 0xdd-0xdf are unassigned (OP_UNKNOWN221-223)
760
- // EC Operations (0xe0-0xe2)
761
- ECADD: 224,
762
- ECMUL: 225,
763
- ECPAIRING: 226,
764
- // EC Operations (0xe3-0xe4)
765
- ECMULSCALARVERIFY: 227,
766
- TWEAKVERIFY: 228,
767
- // Asset Groups (0xe5-0xf2)
768
- INSPECTNUMASSETGROUPS: 229,
769
- INSPECTASSETGROUPASSETID: 230,
770
- INSPECTASSETGROUPCTRL: 231,
771
- FINDASSETGROUPBYASSETID: 232,
772
- INSPECTASSETGROUPMETADATAHASH: 233,
773
- INSPECTASSETGROUPNUM: 234,
774
- INSPECTASSETGROUP: 235,
775
- INSPECTASSETGROUPSUM: 236,
776
- INSPECTOUTASSETCOUNT: 237,
777
- INSPECTOUTASSETAT: 238,
778
- INSPECTOUTASSETLOOKUP: 239,
779
- INSPECTINASSETCOUNT: 240,
780
- INSPECTINASSETAT: 241,
781
- INSPECTINASSETLOOKUP: 242,
782
- // Transaction ID (0xf3)
783
- TXID: 243,
784
- // Packet Introspection (0xf4-0xf5) — added in emulator v0.0.1
785
- INSPECTPACKET: 244,
786
- INSPECTINPUTPACKET: 245,
787
- // Signature Hash (0xf6)
788
- SIGHASH: 246,
789
- // Continuation & Intent Introspection (0xf7-0xf8)
790
- TUNNEL: 247,
791
- INSPECTINTENTMESSAGE: 248
792
- };
793
- var ARKADE_OPCODES = Object.values(ARKADE_OP);
794
- var ARKADE_OPCODE_NAMES = Object.fromEntries(
795
- Object.entries(ARKADE_OP).map(([name, value]) => [value, name])
796
- );
797
- var ARKADE_OPCODE_VALUES = Object.fromEntries(
798
- Object.entries(ARKADE_OPCODE_NAMES).map(([value, name]) => [name, Number(value)])
799
- );
800
- function buildBitcoinOpcodeNames() {
801
- const names = {};
802
- for (const [key, value] of Object.entries(btcSigner.OP)) {
803
- if (typeof value === "number") {
804
- const name = key.startsWith("OP_") ? key : `OP_${key}`;
805
- names[value] = name;
806
- }
807
- }
808
- names[0] = "OP_0";
809
- return names;
810
- }
811
- function buildBitcoinOpcodeValues() {
812
- const values = {};
813
- for (const [key, value] of Object.entries(btcSigner.OP)) {
814
- if (typeof value === "number") {
815
- const name = key.startsWith("OP_") ? key : `OP_${key}`;
816
- values[name] = value;
817
- values[key] = value;
818
- }
819
- }
820
- return values;
821
- }
822
- var BITCOIN_OPCODE_NAMES = buildBitcoinOpcodeNames();
823
- var BITCOIN_OPCODE_VALUES = buildBitcoinOpcodeValues();
824
- var OPCODE_NAMES = {
825
- ...BITCOIN_OPCODE_NAMES,
826
- // Add Arkade opcodes with OP_ prefix
827
- ...Object.fromEntries(
828
- Object.entries(ARKADE_OPCODE_NAMES).map(([value, name]) => [Number(value), `OP_${name}`])
829
- )
830
- };
831
- var OPCODE_VALUES = {
832
- ...BITCOIN_OPCODE_VALUES,
833
- // Add Arkade opcodes with and without OP_ prefix
834
- ...ARKADE_OPCODE_VALUES,
835
- ...Object.fromEntries(
836
- Object.entries(ARKADE_OPCODE_VALUES).map(([name, value]) => [`OP_${name}`, value])
837
- )
838
- };
839
- function getOpcodeName(value) {
840
- if (value >= 1 && value <= 75) {
841
- return `OP_DATA_${value}`;
842
- }
843
- return OPCODE_NAMES[value];
844
- }
845
- function getOpcodeValue(name) {
846
- const dataMatch = name.match(/^OP_DATA_(\d+)$/);
847
- if (dataMatch) {
848
- const n = parseInt(dataMatch[1], 10);
849
- if (n >= 1 && n <= 75) {
850
- return n;
851
- }
852
- return void 0;
853
- }
854
- return OPCODE_VALUES[name];
855
- }
856
-
857
- // src/arkade/bignum.ts
858
- var bignum_exports = {};
859
- chunkGHUUT54D_cjs.__export(bignum_exports, {
860
- BIGNUM_MAX_BYTES: () => BIGNUM_MAX_BYTES,
861
- decode: () => decode,
862
- encode: () => encode
863
- });
864
- var BIGNUM_MAX_BYTES = 520;
865
- var codec = btcSigner.ScriptNum(
866
- BIGNUM_MAX_BYTES,
867
- /* forceMinimal */
868
- true
869
- );
870
- function encode(value) {
871
- const result = codec.encode(value);
872
- if (result.length > BIGNUM_MAX_BYTES) {
873
- throw new Error(`BigNum value exceeds 520 bytes (encoded to ${result.length} bytes)`);
874
- }
875
- return result;
876
- }
877
- function decode(value) {
878
- return codec.decode(value);
879
- }
880
-
881
- // src/arkade/script.ts
882
- var ARKADE_OPS = { ...btcSigner.OP, ...ARKADE_OP };
883
- var ArkadeOPNames = {};
884
- for (const [k, v] of Object.entries(ARKADE_OPS)) {
885
- if (typeof v === "number") ArkadeOPNames[v] = k;
886
- }
887
- var ArkadeScript = P__namespace.wrap({
888
- encodeStream: (w, value) => {
889
- for (let o of value) {
890
- if (typeof o === "string") {
891
- const v = ARKADE_OPS[o];
892
- if (v === void 0) throw new Error(`Unknown opcode=${o}`);
893
- w.byte(v);
894
- continue;
895
- } else if (typeof o === "number" || typeof o === "bigint") {
896
- const big = typeof o === "number" ? BigInt(o) : o;
897
- o = encode(big);
898
- }
899
- if (!(o instanceof Uint8Array)) throw new Error(`Wrong Script OP=${o} (${typeof o})`);
900
- const len = o.length;
901
- if (len === 1 && o[0] >= 1 && o[0] <= 16) {
902
- w.byte(btcSigner.OP.OP_1 - 1 + o[0]);
903
- continue;
904
- } else if (len === 1 && o[0] === 129) {
905
- w.byte(btcSigner.OP["1NEGATE"]);
906
- continue;
907
- } else if (len < btcSigner.OP.PUSHDATA1) w.byte(len);
908
- else if (len <= 255) {
909
- w.byte(btcSigner.OP.PUSHDATA1);
910
- w.byte(len);
911
- } else if (len <= 65535) {
912
- w.byte(btcSigner.OP.PUSHDATA2);
913
- w.bytes(P__namespace.U16LE.encode(len));
914
- } else {
915
- w.byte(btcSigner.OP.PUSHDATA4);
916
- w.bytes(P__namespace.U32LE.encode(len));
917
- }
918
- w.bytes(o);
919
- }
920
- },
921
- decodeStream: (r) => {
922
- const out = [];
923
- while (!r.isEnd()) {
924
- const cur = r.byte();
925
- if (btcSigner.OP.OP_0 < cur && cur <= btcSigner.OP.PUSHDATA4) {
926
- let len;
927
- if (cur < btcSigner.OP.PUSHDATA1) len = cur;
928
- else if (cur === btcSigner.OP.PUSHDATA1) len = P__namespace.U8.decodeStream(r);
929
- else if (cur === btcSigner.OP.PUSHDATA2) len = P__namespace.U16LE.decodeStream(r);
930
- else if (cur === btcSigner.OP.PUSHDATA4) len = P__namespace.U32LE.decodeStream(r);
931
- else throw new Error("Should be not possible");
932
- out.push(r.bytes(len));
933
- } else if (cur === 0) {
934
- out.push(0);
935
- } else if (btcSigner.OP.OP_1 <= cur && cur <= btcSigner.OP.OP_16) {
936
- out.push(cur - (btcSigner.OP.OP_1 - 1));
937
- } else if (cur === btcSigner.OP["1NEGATE"]) {
938
- out.push(-1);
939
- } else {
940
- const op = ArkadeOPNames[cur];
941
- if (op === void 0) throw new Error(`Unknown opcode=${cur.toString(16)}`);
942
- out.push(op);
943
- }
944
- }
945
- return out;
946
- }
947
- });
948
- function toASM(script) {
949
- const parts = [];
950
- for (const op of script) {
951
- if (typeof op === "string") {
952
- const name = op.startsWith("OP_") ? op : `OP_${op}`;
953
- parts.push(name);
954
- } else if (typeof op === "number" || typeof op === "bigint") {
955
- if (op === 0 || op === 0n) {
956
- parts.push("OP_0");
957
- } else if (op >= 1 && op <= 16) {
958
- parts.push(`OP_${op}`);
959
- } else if (op === -1 || op === -1n) {
960
- parts.push("OP_1NEGATE");
961
- } else {
962
- parts.push(base.hex.encode(encode(BigInt(op))));
963
- }
964
- } else {
965
- parts.push(base.hex.encode(op));
966
- }
967
- }
968
- return parts.join(" ");
969
- }
970
- function fromASM(asm) {
971
- const tokens = asm.trim().split(/\s+/).filter(Boolean);
972
- const out = [];
973
- for (const token of tokens) {
974
- if (token === "OP_0" || token === "OP_FALSE") {
975
- out.push(0);
976
- continue;
977
- }
978
- if (token === "OP_TRUE") {
979
- out.push(1);
980
- continue;
981
- }
982
- const numMatch = token.match(/^OP_(\d+)$/);
983
- if (numMatch) {
984
- const n = parseInt(numMatch[1], 10);
985
- if (n >= 1 && n <= 16) {
986
- out.push(n);
987
- continue;
988
- }
989
- }
990
- let key;
991
- if (token.startsWith("OP_")) {
992
- key = token.slice(3);
993
- } else {
994
- key = token;
995
- }
996
- if (key in ARKADE_OPS) {
997
- out.push(key);
998
- continue;
999
- }
1000
- if (/^[0-9a-fA-F]+$/.test(token) && token.length % 2 === 0) {
1001
- try {
1002
- out.push(base.hex.decode(token));
1003
- continue;
1004
- } catch {
1005
- }
1006
- }
1007
- throw new Error(`Invalid ASM token: ${token}`);
1008
- }
1009
- return out;
1010
- }
1011
- function asmToBytes(asm) {
1012
- return ArkadeScript.encode(fromASM(asm));
1013
- }
1014
- function bytesToASM(script) {
1015
- return toASM(ArkadeScript.decode(script));
1016
- }
1017
-
1018
- // src/utils/keys.ts
1019
- function toXOnly(key, label = "public key") {
1020
- if (key.length === 32) return key;
1021
- if (key.length === 33 && (key[0] === 2 || key[0] === 3)) return key.subarray(1);
1022
- throw new Error(`${label} is not a compressed or x-only public key`);
1023
- }
1024
-
1025
- // src/arkade/tweak.ts
1026
- var TAG_SCRIPT = "ArkScriptHash";
1027
- var TAG_WITNESS = "ArkWitnessHash";
1028
- function arkadeScriptHash(script) {
1029
- return secp256k1_js.schnorr.utils.taggedHash(TAG_SCRIPT, script);
1030
- }
1031
- function arkadeWitnessHash(witness) {
1032
- if (witness.length === 0) {
1033
- return new Uint8Array(32);
1034
- }
1035
- return secp256k1_js.schnorr.utils.taggedHash(TAG_WITNESS, witness);
1036
- }
1037
- function computeArkadeScriptPublicKey(pubKey, script) {
1038
- const hash = arkadeScriptHash(script);
1039
- const point = secp256k1_js.schnorr.utils.lift_x(utils_js.bytesToNumberBE(toXOnly(pubKey, "emulator key")));
1040
- const scalar = utils_js.bytesToNumberBE(hash) % secp256k1_js.secp256k1.Point.CURVE().n;
1041
- const tweak = secp256k1_js.secp256k1.Point.BASE.multiply(scalar);
1042
- return secp256k1_js.schnorr.utils.pointToBytes(point.add(tweak));
1043
- }
1044
-
1045
- // src/script/vhtlc.ts
1046
699
  exports.VHTLC = void 0;
1047
700
  ((VHTLC2) => {
1048
- class BaseScript extends chunkGHUUT54D_cjs.VtxoScript {
701
+ class BaseScript extends chunkFLPWNMX3_cjs.VtxoScript {
1049
702
  options;
1050
703
  claimScript;
1051
704
  refundScript;
@@ -1072,27 +725,27 @@ exports.VHTLC = void 0;
1072
725
  unilateralRefundWithoutReceiverDelay
1073
726
  } = options;
1074
727
  const conditionScript = preimageCondition(preimageHash);
1075
- const claimScript = chunkGHUUT54D_cjs.ConditionMultisigTapscript.encode({
728
+ const claimScript = chunkFLPWNMX3_cjs.ConditionMultisigTapscript.encode({
1076
729
  conditionScript,
1077
730
  pubkeys: [receiver, server]
1078
731
  }).script;
1079
- const refundScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
732
+ const refundScript = chunkFLPWNMX3_cjs.MultisigTapscript.encode({
1080
733
  pubkeys: [sender, receiver, server]
1081
734
  }).script;
1082
- const refundWithoutReceiverScript = chunkGHUUT54D_cjs.CLTVMultisigTapscript.encode({
735
+ const refundWithoutReceiverScript = chunkFLPWNMX3_cjs.CLTVMultisigTapscript.encode({
1083
736
  absoluteTimelock: refundLocktime,
1084
737
  pubkeys: [sender, server]
1085
738
  }).script;
1086
- const unilateralClaimScript = chunkGHUUT54D_cjs.ConditionCSVMultisigTapscript.encode({
739
+ const unilateralClaimScript = chunkFLPWNMX3_cjs.ConditionCSVMultisigTapscript.encode({
1087
740
  conditionScript,
1088
741
  timelock: unilateralClaimDelay,
1089
742
  pubkeys: [receiver]
1090
743
  }).script;
1091
- const unilateralRefundScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
744
+ const unilateralRefundScript = chunkFLPWNMX3_cjs.CSVMultisigTapscript.encode({
1092
745
  timelock: unilateralRefundDelay,
1093
746
  pubkeys: [sender, receiver]
1094
747
  }).script;
1095
- const unilateralRefundWithoutReceiverScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
748
+ const unilateralRefundWithoutReceiverScript = chunkFLPWNMX3_cjs.CSVMultisigTapscript.encode({
1096
749
  timelock: unilateralRefundWithoutReceiverDelay,
1097
750
  pubkeys: [sender]
1098
751
  }).script;
@@ -1112,25 +765,25 @@ exports.VHTLC = void 0;
1112
765
  const covenants = options.nonInteractiveParameters;
1113
766
  if (covenants) {
1114
767
  arkadeScriptNic = enforcePayToMaybeAsset(covenants.receiverPkScript, options.asset);
1115
- nonInteractiveClaimScript = chunkGHUUT54D_cjs.ConditionMultisigTapscript.encode({
768
+ nonInteractiveClaimScript = chunkFLPWNMX3_cjs.ConditionMultisigTapscript.encode({
1116
769
  conditionScript,
1117
770
  pubkeys: [
1118
771
  server,
1119
- computeArkadeScriptPublicKey(covenants.emulatorPubkey, arkadeScriptNic)
772
+ chunkJFJNB7ZH_cjs.computeArkadeScriptPublicKey(covenants.emulatorPubkey, arkadeScriptNic)
1120
773
  ]
1121
774
  }).script;
1122
775
  scripts.push(nonInteractiveClaimScript);
1123
776
  arkadeScriptNir = enforcePayToMaybeAsset(covenants.senderPkScript, options.asset);
1124
- const nirCosigner = computeArkadeScriptPublicKey(
777
+ const nirCosigner = chunkJFJNB7ZH_cjs.computeArkadeScriptPublicKey(
1125
778
  covenants.emulatorPubkey,
1126
779
  arkadeScriptNir
1127
780
  );
1128
- nonInteractiveRefundScript = chunkGHUUT54D_cjs.MultisigTapscript.encode({
781
+ nonInteractiveRefundScript = chunkFLPWNMX3_cjs.MultisigTapscript.encode({
1129
782
  pubkeys: [server, receiver, nirCosigner]
1130
783
  }).script;
1131
784
  scripts.push(nonInteractiveRefundScript);
1132
785
  if (covenants.legacy !== "preTimelockedRefund") {
1133
- nonInteractiveRefundWithoutReceiverScript = chunkGHUUT54D_cjs.CLTVMultisigTapscript.encode({
786
+ nonInteractiveRefundWithoutReceiverScript = chunkFLPWNMX3_cjs.CLTVMultisigTapscript.encode({
1134
787
  absoluteTimelock: refundLocktime,
1135
788
  pubkeys: [server, nirCosigner]
1136
789
  }).script;
@@ -1233,12 +886,12 @@ exports.VHTLC = void 0;
1233
886
  ];
1234
887
  }
1235
888
  }
1236
- class Script3 extends BaseScript {
889
+ class Script2 extends BaseScript {
1237
890
  constructor(options) {
1238
891
  super(options, preimageConditionScript);
1239
892
  }
1240
893
  }
1241
- VHTLC2.Script = Script3;
894
+ VHTLC2.Script = Script2;
1242
895
  class ScriptV2 extends BaseScript {
1243
896
  constructor(options) {
1244
897
  super(options, preimageConditionScriptV2);
@@ -1348,7 +1001,7 @@ function enforcePayTo(destinationPkScript) {
1348
1001
  if (!isP2trPkScript(destinationPkScript)) {
1349
1002
  throw new Error("invalid P2TR script");
1350
1003
  }
1351
- return ArkadeScript.encode(satClause(destinationPkScript));
1004
+ return chunkJFJNB7ZH_cjs.ArkadeScript.encode(satClause(destinationPkScript));
1352
1005
  }
1353
1006
  function enforcePayToAsset(destinationPkScript, asset) {
1354
1007
  if (!isP2trPkScript(destinationPkScript)) {
@@ -1363,7 +1016,7 @@ function enforcePayToAsset(destinationPkScript, asset) {
1363
1016
  );
1364
1017
  }
1365
1018
  const inspectionTxid = Uint8Array.from(asset.txid).reverse();
1366
- return ArkadeScript.encode([
1019
+ return chunkJFJNB7ZH_cjs.ArkadeScript.encode([
1367
1020
  // The output at the input's index carries at least the input's amount of the asset.
1368
1021
  "PUSHCURRENTINPUTINDEX",
1369
1022
  inspectionTxid,
@@ -1406,9 +1059,9 @@ var VHTLCContractHandler = {
1406
1059
  server: base.hex.encode(params.server),
1407
1060
  hash: base.hex.encode(params.preimageHash),
1408
1061
  refundLocktime: params.refundLocktime.toString(),
1409
- claimDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
1410
- refundDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
1411
- refundNoReceiverDelay: chunkGHUUT54D_cjs.timelockToSequence(
1062
+ claimDelay: chunkFLPWNMX3_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
1063
+ refundDelay: chunkFLPWNMX3_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
1064
+ refundNoReceiverDelay: chunkFLPWNMX3_cjs.timelockToSequence(
1412
1065
  params.unilateralRefundWithoutReceiverDelay
1413
1066
  ).toString()
1414
1067
  };
@@ -1420,9 +1073,9 @@ var VHTLCContractHandler = {
1420
1073
  server: base.hex.decode(params.server),
1421
1074
  preimageHash: base.hex.decode(params.hash),
1422
1075
  refundLocktime: BigInt(params.refundLocktime),
1423
- unilateralClaimDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.claimDelay)),
1424
- unilateralRefundDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.refundDelay)),
1425
- unilateralRefundWithoutReceiverDelay: chunkGHUUT54D_cjs.sequenceToTimelock(
1076
+ unilateralClaimDelay: chunkFLPWNMX3_cjs.sequenceToTimelock(Number(params.claimDelay)),
1077
+ unilateralRefundDelay: chunkFLPWNMX3_cjs.sequenceToTimelock(Number(params.refundDelay)),
1078
+ unilateralRefundWithoutReceiverDelay: chunkFLPWNMX3_cjs.sequenceToTimelock(
1426
1079
  Number(params.refundNoReceiverDelay)
1427
1080
  )
1428
1081
  };
@@ -1515,9 +1168,9 @@ var VHTLCV2ContractHandler = {
1515
1168
  server: base.hex.encode(params.server),
1516
1169
  hash: base.hex.encode(params.preimageHash),
1517
1170
  refundLocktime: params.refundLocktime.toString(),
1518
- claimDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
1519
- refundDelay: chunkGHUUT54D_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
1520
- refundNoReceiverDelay: chunkGHUUT54D_cjs.timelockToSequence(
1171
+ claimDelay: chunkFLPWNMX3_cjs.timelockToSequence(params.unilateralClaimDelay).toString(),
1172
+ refundDelay: chunkFLPWNMX3_cjs.timelockToSequence(params.unilateralRefundDelay).toString(),
1173
+ refundNoReceiverDelay: chunkFLPWNMX3_cjs.timelockToSequence(
1521
1174
  params.unilateralRefundWithoutReceiverDelay
1522
1175
  ).toString(),
1523
1176
  // Per-leaf on-disk keys predate the grouped param and older rows carry exactly these;
@@ -1595,9 +1248,9 @@ var VHTLCV2ContractHandler = {
1595
1248
  preimageHash: base.hex.decode(params.hash),
1596
1249
  refundLocktime: BigInt(params.refundLocktime),
1597
1250
  ...asset && { asset },
1598
- unilateralClaimDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.claimDelay)),
1599
- unilateralRefundDelay: chunkGHUUT54D_cjs.sequenceToTimelock(Number(params.refundDelay)),
1600
- unilateralRefundWithoutReceiverDelay: chunkGHUUT54D_cjs.sequenceToTimelock(
1251
+ unilateralClaimDelay: chunkFLPWNMX3_cjs.sequenceToTimelock(Number(params.claimDelay)),
1252
+ unilateralRefundDelay: chunkFLPWNMX3_cjs.sequenceToTimelock(Number(params.refundDelay)),
1253
+ unilateralRefundWithoutReceiverDelay: chunkFLPWNMX3_cjs.sequenceToTimelock(
1601
1254
  Number(params.refundNoReceiverDelay)
1602
1255
  ),
1603
1256
  ...claim && refund && {
@@ -1660,6 +1313,7 @@ var VHTLCV2ContractHandler = {
1660
1313
  };
1661
1314
  var BoardingContractHandler = {
1662
1315
  type: "boarding",
1316
+ defaultScope: "onchain",
1663
1317
  createScript(params) {
1664
1318
  return DefaultContractHandler.createScript(params);
1665
1319
  },
@@ -1716,496 +1370,6 @@ var BoardingContractHandler = {
1716
1370
  ];
1717
1371
  }
1718
1372
  };
1719
- var MinimalScriptNum = btcSigner.ScriptNum(void 0, true);
1720
- var ARKADE_TYPE_ENCODINGS = {
1721
- pubkey: "raw",
1722
- signature: "schnorr-64",
1723
- bytes: "raw",
1724
- bytes20: "raw-20",
1725
- bytes32: "raw-32",
1726
- asset: "raw-32",
1727
- int: "scriptnum",
1728
- bool: "scriptnum",
1729
- AssetGroup: "scriptnum"
1730
- };
1731
- var SUPPORTED_PROGRAM_VERSION = 1;
1732
- var UnsupportedProgramVersionError = class extends Error {
1733
- constructor(version, context) {
1734
- super(
1735
- `${context}: unsupported program version ${String(version)}; this SDK supports version ${SUPPORTED_PROGRAM_VERSION}. Recover it with an SDK that reads version ${String(version)}, re-create it with current params, or delete it.`
1736
- );
1737
- this.version = version;
1738
- }
1739
- version;
1740
- name = "UnsupportedProgramVersionError";
1741
- };
1742
- function bindValue(bind, name) {
1743
- const v = Object.hasOwn(bind, name) ? bind[name] : void 0;
1744
- if (v === void 0) throw new Error(`unbound parameter '${name}'`);
1745
- return v;
1746
- }
1747
- function resolveTimelockValue(value, args) {
1748
- if (typeof value === "bigint") return value;
1749
- if (value.startsWith("$")) {
1750
- const v = bindValue(args, value.slice(1));
1751
- if (typeof v === "bigint" || typeof v === "number") return BigInt(v);
1752
- throw new Error(`timelock value '${value}' must resolve to a number`);
1753
- }
1754
- throw new Error(
1755
- `invalid timelock value '${value}' \u2014 expected a bigint or a '$param' reference`
1756
- );
1757
- }
1758
- function resolveCsvTimelock(csv, args) {
1759
- const value = resolveTimelockValue(csv.value, args);
1760
- if (csv.type !== "sequence") return { type: csv.type, value };
1761
- const timelock = chunkGHUUT54D_cjs.sequenceToCanonicalTimelock(value);
1762
- if (!timelock) {
1763
- throw new Error(
1764
- `csv '${csv.value}' resolved to ${value}, which is not a canonical BIP68 sequence`
1765
- );
1766
- }
1767
- return timelock;
1768
- }
1769
- function resolveAsm(asm, bind) {
1770
- const tokens = asm.map((t) => {
1771
- if (typeof t === "string" && t.startsWith("$")) {
1772
- return bindValue(bind, t.slice(1));
1773
- }
1774
- if (t === "<SELF>") {
1775
- throw new Error(
1776
- "<SELF> is not a placeholder; use INSPECTINPUTSCRIPTPUBKEY for continuation covenants"
1777
- );
1778
- }
1779
- return t;
1780
- });
1781
- return ArkadeScript.encode(tokens);
1782
- }
1783
- function witnessRefToBytes(ref, callArgs, programArgs) {
1784
- if (ref instanceof Uint8Array) return ref;
1785
- if (typeof ref === "number" || typeof ref === "bigint") {
1786
- return MinimalScriptNum.encode(BigInt(ref));
1787
- }
1788
- const v = ref.startsWith("$") ? bindValue(programArgs, ref.slice(1)) : bindValue(callArgs, ref);
1789
- if (v instanceof Uint8Array) return v;
1790
- return MinimalScriptNum.encode(BigInt(v));
1791
- }
1792
- function validateTapscript(seg) {
1793
- if (!seg.signers || seg.signers.length === 0) {
1794
- throw new Error("tapscript: at least one signer is required");
1795
- }
1796
- if (seg.asm !== void 0 && seg.cltv !== void 0) {
1797
- throw new Error(
1798
- "tapscript: `asm` and `cltv` conflict \u2014 arkd has no condition+CLTV closure"
1799
- );
1800
- }
1801
- if (seg.csv !== void 0 && seg.cltv !== void 0) {
1802
- throw new Error("tapscript: `csv` and `cltv` conflict \u2014 use at most one timelock");
1803
- }
1804
- for (const t of seg.asm ?? []) {
1805
- if (typeof t === "string" && t in ARKADE_OP) {
1806
- throw new Error(
1807
- `tapscript: arkade opcode '${t}' is not enforceable on-chain \u2014 move it to arkadeScript`
1808
- );
1809
- }
1810
- }
1811
- }
1812
- function collectParamRefs(program) {
1813
- const refs = /* @__PURE__ */ new Set();
1814
- const collect = (items) => {
1815
- for (const t of items ?? []) {
1816
- if (typeof t === "string" && t.startsWith("$")) refs.add(t.slice(1));
1817
- else if (isTweakedSigner(t) && t.tweak.startsWith("$")) refs.add(t.tweak.slice(1));
1818
- }
1819
- };
1820
- for (const fn of Object.values(program.functions)) {
1821
- const tap = fn.tapscript;
1822
- collect(tap.signers);
1823
- collect(tap.asm);
1824
- collect(tap.witness);
1825
- collect(tap.csv ? [tap.csv.value] : void 0);
1826
- collect(tap.cltv !== void 0 ? [tap.cltv] : void 0);
1827
- collect(fn.arkadeScript?.asm);
1828
- collect(fn.arkadeScript?.witness);
1829
- }
1830
- return refs;
1831
- }
1832
- var TYPED_BYTE_LENGTHS = {
1833
- pubkey: 32,
1834
- signature: 64,
1835
- bytes20: 20,
1836
- bytes32: 32,
1837
- asset: 32
1838
- };
1839
- function validateParamValue(def, value) {
1840
- if (typeof def.type !== "string" || !Object.hasOwn(ARKADE_TYPE_ENCODINGS, def.type)) {
1841
- throw new Error(`program parameter '${def.name}': unknown type '${def.type}'`);
1842
- }
1843
- if (ARKADE_TYPE_ENCODINGS[def.type] === "scriptnum") {
1844
- if (typeof value !== "bigint" && typeof value !== "number") {
1845
- throw new Error(`program parameter '${def.name}' expects ${def.type}, got bytes`);
1846
- }
1847
- if (typeof value === "number" && !Number.isSafeInteger(value)) {
1848
- throw new Error(
1849
- `program parameter '${def.name}' expects a safe integer; use bigint for larger values`
1850
- );
1851
- }
1852
- if (def.type === "bool" && value !== 0 && value !== 1 && value !== 0n && value !== 1n) {
1853
- throw new Error(`program parameter '${def.name}' expects a boolean encoded as 0 or 1`);
1854
- }
1855
- return;
1856
- }
1857
- if (!(value instanceof Uint8Array)) {
1858
- throw new Error(
1859
- `program parameter '${def.name}' expects ${def.type} bytes, got ${typeof value}`
1860
- );
1861
- }
1862
- const length = TYPED_BYTE_LENGTHS[def.type];
1863
- if (length !== void 0 && value.length !== length) {
1864
- throw new Error(
1865
- `program parameter '${def.name}' expects a ${length}-byte ${def.type}, got ${value.length} bytes`
1866
- );
1867
- }
1868
- }
1869
- function validateProgram(program, args) {
1870
- const params = program.params ?? [];
1871
- const declared = new Set(params.map((p) => p.name));
1872
- for (const name of declared) {
1873
- if (!Object.hasOwn(args, name) || args[name] === void 0) {
1874
- throw new Error(`program parameter '${name}' is declared but not bound in args`);
1875
- }
1876
- }
1877
- for (const ref of collectParamRefs(program)) {
1878
- if (!declared.has(ref)) {
1879
- throw new Error(`'$${ref}' is referenced but not declared in program params`);
1880
- }
1881
- }
1882
- for (const p of params) {
1883
- validateParamValue(p, args[p.name]);
1884
- }
1885
- for (const name of Object.keys(args)) {
1886
- if (!declared.has(name)) throw new Error(`program: undeclared argument '${name}'`);
1887
- }
1888
- }
1889
- function isTweakedSigner(ref) {
1890
- if (typeof ref !== "object" || ref === null || ref instanceof Uint8Array) return false;
1891
- const { tweak, fn } = ref;
1892
- return typeof tweak === "string" && typeof fn === "string";
1893
- }
1894
- function resolveSigner(ref, args) {
1895
- if (ref instanceof Uint8Array) return ref;
1896
- if (typeof ref !== "string" || !ref.startsWith("$")) {
1897
- throw new Error(`unknown signer reference '${ref}' \u2014 use a '$param' or key bytes`);
1898
- }
1899
- const v = bindValue(args, ref.slice(1));
1900
- if (!(v instanceof Uint8Array)) {
1901
- throw new Error(`signer ${ref} must be a pubkey (bytes)`);
1902
- }
1903
- return v;
1904
- }
1905
- function encodeTapscriptSegment(seg, pubkeys, args) {
1906
- if (seg.csv) {
1907
- const timelock = resolveCsvTimelock(seg.csv, args);
1908
- if (seg.asm) {
1909
- return chunkGHUUT54D_cjs.ConditionCSVMultisigTapscript.encode({
1910
- conditionScript: resolveAsm(seg.asm, args),
1911
- timelock,
1912
- pubkeys
1913
- });
1914
- }
1915
- return chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({ timelock, pubkeys });
1916
- }
1917
- if (seg.cltv !== void 0) {
1918
- return chunkGHUUT54D_cjs.CLTVMultisigTapscript.encode({
1919
- absoluteTimelock: resolveTimelockValue(seg.cltv, args),
1920
- pubkeys
1921
- });
1922
- }
1923
- if (seg.asm) {
1924
- return chunkGHUUT54D_cjs.ConditionMultisigTapscript.encode({
1925
- conditionScript: resolveAsm(seg.asm, args),
1926
- pubkeys
1927
- });
1928
- }
1929
- return chunkGHUUT54D_cjs.MultisigTapscript.encode({ pubkeys });
1930
- }
1931
- function compileFunctions(program, args, keys) {
1932
- if (program.version !== SUPPORTED_PROGRAM_VERSION) {
1933
- throw new UnsupportedProgramVersionError(program.version, "ArkadeContract");
1934
- }
1935
- const functions = program.functions;
1936
- const names = Object.keys(functions);
1937
- if (names.length === 0) {
1938
- throw new Error("ArkadeContract: program has no functions");
1939
- }
1940
- validateProgram(program, args);
1941
- if (args.server !== void 0 && (!(args.server instanceof Uint8Array) || !utils_js$1.equalBytes(args.server, keys.serverKey))) {
1942
- throw new Error(
1943
- "ArkadeContract: reserved server parameter must match the contract server key"
1944
- );
1945
- }
1946
- const defs = names.map((n) => functions[n]);
1947
- const covenants = /* @__PURE__ */ new Map();
1948
- for (const [name, def] of Object.entries(functions)) {
1949
- if (!def.arkadeScript) continue;
1950
- const script = resolveAsm(def.arkadeScript.asm, args);
1951
- for (const target of [name, ...def.group ? [def.group] : []]) {
1952
- const previous = covenants.get(target);
1953
- if (previous && !utils_js$1.equalBytes(previous, script)) {
1954
- throw new Error(`ArkadeContract: ambiguous covenant '${target}'`);
1955
- }
1956
- covenants.set(target, script);
1957
- }
1958
- }
1959
- const covenant = names.find(
1960
- (_, i) => defs[i].arkadeScript && defs[i].tapscript.emulator !== null
1961
- );
1962
- if (covenant && !keys.emulatorKey) {
1963
- throw new Error(
1964
- `ArkadeContract: function '${covenant}' has an arkadeScript but no emulator is configured \u2014 pass an \`emulator\` to Arkade.connect`
1965
- );
1966
- }
1967
- return defs.map((def, i) => {
1968
- const pubkeys = def.tapscript.signers.map((signer) => {
1969
- if (!isTweakedSigner(signer)) return resolveSigner(signer, args);
1970
- const script = covenants.get(signer.fn);
1971
- if (!script) {
1972
- throw new Error(
1973
- `ArkadeContract: function '${names[i]}' tweaks '${signer.fn}', which has no arkade script`
1974
- );
1975
- }
1976
- return computeArkadeScriptPublicKey(resolveSigner(signer.tweak, args), script);
1977
- });
1978
- const arkadeScript = def.arkadeScript ? covenants.get(names[i]) : void 0;
1979
- const leafPubkeys = [...pubkeys];
1980
- if (arkadeScript && def.tapscript.emulator !== null) {
1981
- const position = def.tapscript.emulatorIndex ?? pubkeys.length;
1982
- if (!Number.isInteger(position) || position < 0 || position > pubkeys.length) {
1983
- throw new Error(
1984
- `ArkadeContract: function '${names[i]}' has an invalid emulator position ${position}`
1985
- );
1986
- }
1987
- const target = def.group ? covenants.get(def.tapscript.emulator ?? def.group) : arkadeScript;
1988
- if (!target || !utils_js$1.equalBytes(target, arkadeScript)) {
1989
- throw new Error(
1990
- `ArkadeContract: function '${names[i]}' has an invalid emulator covenant '${def.tapscript.emulator}'`
1991
- );
1992
- }
1993
- leafPubkeys.splice(
1994
- position,
1995
- 0,
1996
- computeArkadeScriptPublicKey(keys.emulatorKey, target)
1997
- );
1998
- } else if (def.tapscript.emulatorIndex !== void 0) {
1999
- throw new Error(
2000
- `ArkadeContract: function '${names[i]}' specifies an emulator position without an emulator`
2001
- );
2002
- }
2003
- validateTapscript({ ...def.tapscript, signers: leafPubkeys });
2004
- const leafScript = encodeTapscriptSegment(def.tapscript, leafPubkeys, args).script;
2005
- return { name: names[i], def, leafScript, arkadeScript, signerKeys: pubkeys };
2006
- });
2007
- }
2008
- var ArkadeProgramScript = class extends chunkGHUUT54D_cjs.VtxoScript {
2009
- constructor(program, args, keys) {
2010
- const partial = compileFunctions(program, args, keys);
2011
- super(partial.map((p) => p.leafScript));
2012
- this.program = program;
2013
- this.args = args;
2014
- this.keys = keys;
2015
- this.compiled = partial.map((p) => ({
2016
- ...p,
2017
- tapLeafScript: this.findLeaf(base.hex.encode(p.leafScript))
2018
- }));
2019
- }
2020
- program;
2021
- args;
2022
- keys;
2023
- /** Spending paths in declaration order. */
2024
- compiled;
2025
- /** The compiled spending path with the given function name, if any. */
2026
- functionByName(name) {
2027
- return this.compiled.find((f) => f.name === name);
2028
- }
2029
- };
2030
- function parseArtifact(artifact) {
2031
- if (Array.isArray(artifact.functions)) {
2032
- throw new Error(
2033
- "parseArtifact: `functions` is an array, which is the arkadec artifact shape, not an SDK program \u2014 read it with programFromArtifact instead"
2034
- );
2035
- }
2036
- if (typeof artifact.functions !== "object" || artifact.functions === null) {
2037
- throw new Error("parseArtifact: `functions` must be an object keyed by function name");
2038
- }
2039
- const hexToken = (t) => typeof t === "string" && t.startsWith("0x") ? base.hex.decode(t.slice(2)) : t;
2040
- const signerRef = (s) => {
2041
- if (s instanceof Uint8Array || typeof s === "string") return hexToken(s);
2042
- if (isTweakedSigner(s)) return { tweak: s.tweak, fn: s.fn };
2043
- throw new Error("parseArtifact: a tweaked signer needs string `tweak` and `fn`");
2044
- };
2045
- const timelockValue = (v) => typeof v === "string" && v.startsWith("$") ? v : BigInt(v);
2046
- if (artifact.version !== void 0 && artifact.version !== SUPPORTED_PROGRAM_VERSION) {
2047
- throw new UnsupportedProgramVersionError(artifact.version, "parseArtifact");
2048
- }
2049
- const declarations = [artifact.params];
2050
- for (const [name, fn] of Object.entries(artifact.functions)) {
2051
- if (!fn || typeof fn !== "object" || Array.isArray(fn)) {
2052
- throw new Error(`parseArtifact: function '${name}' must be an object`);
2053
- }
2054
- const tap = fn.tapscript;
2055
- if (tap !== void 0 && (!tap || typeof tap !== "object" || Array.isArray(tap))) {
2056
- throw new Error(`parseArtifact: function '${name}' tapscript must be an object`);
2057
- }
2058
- declarations.push(fn.inputs, tap?.signatures);
2059
- if (tap?.emulatorIndex !== void 0 && (!Number.isInteger(tap.emulatorIndex) || tap.emulatorIndex < 0)) {
2060
- throw new Error(`parseArtifact: function '${name}' has an invalid emulator position`);
2061
- }
2062
- }
2063
- for (const defs of declarations) {
2064
- if (defs === void 0) continue;
2065
- if (!Array.isArray(defs)) {
2066
- throw new Error(
2067
- "parseArtifact: parameters, inputs and signatures require arrays of typed declarations"
2068
- );
2069
- }
2070
- for (const def of defs) {
2071
- if (!def || typeof def.name !== "string" || def.name.length === 0 || typeof def.type !== "string" || !Object.hasOwn(ARKADE_TYPE_ENCODINGS, def.type)) {
2072
- throw new Error(
2073
- "parseArtifact: parameters, inputs and signatures require typed { name, type } declarations"
2074
- );
2075
- }
2076
- }
2077
- }
2078
- const functions = /* @__PURE__ */ Object.create(null);
2079
- for (const [name, fn] of Object.entries(artifact.functions)) {
2080
- const tap = fn.tapscript ?? {};
2081
- const tapscript = {
2082
- signers: (tap.signers ?? []).map(signerRef),
2083
- ...tap.signatures ? { signatures: tap.signatures } : {},
2084
- ...tap.asm ? { asm: tap.asm.map(hexToken) } : {},
2085
- ...tap.witness ? { witness: tap.witness.map(hexToken) } : {},
2086
- ...tap.csv ? { csv: { type: tap.csv.type, value: timelockValue(tap.csv.value) } } : {},
2087
- ...tap.cltv !== void 0 ? { cltv: timelockValue(tap.cltv) } : {},
2088
- ..."emulator" in tap ? { emulator: tap.emulator } : {},
2089
- ...tap.emulatorIndex !== void 0 ? { emulatorIndex: tap.emulatorIndex } : {}
2090
- };
2091
- const arkadeScript = fn.arkadeScript ? {
2092
- asm: fn.arkadeScript.asm.map(hexToken),
2093
- ...fn.arkadeScript.witness ? { witness: fn.arkadeScript.witness.map(hexToken) } : {}
2094
- } : void 0;
2095
- functions[name] = {
2096
- ...fn.group !== void 0 ? { group: fn.group } : {},
2097
- ...fn.inputs ? { inputs: fn.inputs } : {},
2098
- tapscript,
2099
- ...arkadeScript ? { arkadeScript } : {}
2100
- };
2101
- }
2102
- return {
2103
- version: artifact.version ?? SUPPORTED_PROGRAM_VERSION,
2104
- ...artifact.name !== void 0 ? { name: artifact.name } : {},
2105
- ...artifact.params ? { params: artifact.params } : {},
2106
- functions
2107
- };
2108
- }
2109
- function stringifyArtifact(program) {
2110
- const token = (t) => {
2111
- if (t instanceof Uint8Array) return "0x" + base.hex.encode(t);
2112
- if (typeof t === "bigint") {
2113
- if (t >= BigInt(Number.MIN_SAFE_INTEGER) && t <= BigInt(Number.MAX_SAFE_INTEGER)) {
2114
- return Number(t);
2115
- }
2116
- return "0x" + base.hex.encode(MinimalScriptNum.encode(t));
2117
- }
2118
- return t;
2119
- };
2120
- const functions = /* @__PURE__ */ Object.create(null);
2121
- for (const [name, fn] of Object.entries(program.functions)) {
2122
- const tap = fn.tapscript;
2123
- functions[name] = {
2124
- ...fn.group !== void 0 ? { group: fn.group } : {},
2125
- ...fn.inputs ? { inputs: fn.inputs } : {},
2126
- tapscript: {
2127
- signers: tap.signers.map(token),
2128
- ...tap.signatures ? { signatures: tap.signatures } : {},
2129
- ...tap.asm ? { asm: tap.asm.map(token) } : {},
2130
- ...tap.witness ? { witness: tap.witness.map(token) } : {},
2131
- ...tap.csv ? { csv: { type: tap.csv.type, value: tap.csv.value.toString() } } : {},
2132
- ...tap.cltv !== void 0 ? { cltv: tap.cltv.toString() } : {},
2133
- ...tap.emulator !== void 0 ? { emulator: tap.emulator } : {},
2134
- ...tap.emulatorIndex !== void 0 ? { emulatorIndex: tap.emulatorIndex } : {}
2135
- },
2136
- ...fn.arkadeScript ? {
2137
- arkadeScript: {
2138
- asm: fn.arkadeScript.asm.map(token),
2139
- ...fn.arkadeScript.witness ? { witness: fn.arkadeScript.witness.map(token) } : {}
2140
- }
2141
- } : {}
2142
- };
2143
- }
2144
- return JSON.stringify({
2145
- version: program.version,
2146
- ...program.name !== void 0 ? { name: program.name } : {},
2147
- ...program.params ? { params: program.params } : {},
2148
- functions
2149
- });
2150
- }
2151
- function serializeArgValue(v) {
2152
- if (v instanceof Uint8Array) return "0x" + base.hex.encode(v);
2153
- if (typeof v === "bigint") return v.toString();
2154
- return v;
2155
- }
2156
- function parseTypedArgValue(name, type, v) {
2157
- if (ARKADE_TYPE_ENCODINGS[type] === "scriptnum") {
2158
- if (typeof v === "number") return v;
2159
- if (typeof v === "string") return BigInt(v);
2160
- throw new Error(
2161
- `arkade contract params: '${name}' expects ${type}, got ${JSON.stringify(v)}`
2162
- );
2163
- }
2164
- if (typeof v === "string" && v.startsWith("0x")) return base.hex.decode(v.slice(2));
2165
- throw new Error(
2166
- `arkade contract params: '${name}' expects ${type} as 0x-prefixed hex, got ${JSON.stringify(v)}`
2167
- );
2168
- }
2169
- function serializeArkadeContractParams(typed) {
2170
- const args = /* @__PURE__ */ Object.create(null);
2171
- for (const [k, v] of Object.entries(typed.args)) {
2172
- args[k] = serializeArgValue(v);
2173
- }
2174
- return {
2175
- program: stringifyArtifact(typed.program),
2176
- args: JSON.stringify(args),
2177
- serverKey: base.hex.encode(typed.serverKey),
2178
- ...typed.userKey ? { userKey: base.hex.encode(typed.userKey) } : {},
2179
- ...typed.emulatorKey ? { emulatorKey: base.hex.encode(typed.emulatorKey) } : {}
2180
- };
2181
- }
2182
- function deserializeArkadeContractParams(params) {
2183
- if (!params.program) {
2184
- throw new Error("arkade contract params: missing 'program'");
2185
- }
2186
- if (!params.serverKey) {
2187
- throw new Error("arkade contract params: missing 'serverKey'");
2188
- }
2189
- const program = parseArtifact(JSON.parse(params.program));
2190
- const paramTypes = new Map((program.params ?? []).map((p) => [p.name, p.type]));
2191
- const args = /* @__PURE__ */ Object.create(null);
2192
- if (params.args) {
2193
- for (const [k, v] of Object.entries(JSON.parse(params.args))) {
2194
- const type = paramTypes.get(k);
2195
- if (!type) throw new Error(`arkade contract params: undeclared argument '${k}'`);
2196
- args[k] = parseTypedArgValue(k, type, v);
2197
- }
2198
- }
2199
- return {
2200
- program,
2201
- args,
2202
- serverKey: base.hex.decode(params.serverKey),
2203
- ...params.userKey ? { userKey: base.hex.decode(params.userKey) } : {},
2204
- ...params.emulatorKey ? { emulatorKey: base.hex.decode(params.emulatorKey) } : {}
2205
- };
2206
- }
2207
-
2208
- // src/contracts/handlers/arkade.ts
2209
1373
  function walletKeyFrom(context) {
2210
1374
  if (!context.walletDescriptor) return void 0;
2211
1375
  try {
@@ -2214,21 +1378,13 @@ function walletKeyFrom(context) {
2214
1378
  return void 0;
2215
1379
  }
2216
1380
  }
2217
- function staticWitness(fn, script) {
2218
- const refs = fn.def.tapscript.witness ?? [];
2219
- try {
2220
- return refs.map((w) => witnessRefToBytes(w, {}, script.args));
2221
- } catch {
2222
- return null;
2223
- }
2224
- }
2225
1381
  function pathsFor(script, context, opts) {
2226
1382
  const walletKey = walletKeyFrom(context);
2227
1383
  const serverHex = base.hex.encode(script.keys.serverKey);
2228
1384
  const paths = [];
2229
1385
  for (const fn of script.compiled) {
2230
1386
  if (fn.arkadeScript) continue;
2231
- const witness = staticWitness(fn, script);
1387
+ const witness = chunkJFJNB7ZH_cjs.staticWitness(fn.def.tapscript.witness, script.args);
2232
1388
  if (witness === null) continue;
2233
1389
  const signerHexes = fn.signerKeys.map((s) => base.hex.encode(s));
2234
1390
  const requiresServer = signerHexes.includes(serverHex);
@@ -2237,8 +1393,8 @@ function pathsFor(script, context, opts) {
2237
1393
  continue;
2238
1394
  }
2239
1395
  const csvDef = fn.def.tapscript.csv;
2240
- const csv = csvDef ? resolveCsvTimelock(csvDef, script.args) : void 0;
2241
- const cltv = fn.def.tapscript.cltv !== void 0 ? resolveTimelockValue(fn.def.tapscript.cltv, script.args) : void 0;
1396
+ const csv = csvDef ? chunkJFJNB7ZH_cjs.resolveCsvTimelock(csvDef, script.args) : void 0;
1397
+ const cltv = fn.def.tapscript.cltv !== void 0 ? chunkJFJNB7ZH_cjs.resolveTimelockValue(fn.def.tapscript.cltv, script.args) : void 0;
2242
1398
  if (context.collaborative) {
2243
1399
  if (csv) continue;
2244
1400
  if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
@@ -2251,7 +1407,7 @@ function pathsFor(script, context, opts) {
2251
1407
  continue;
2252
1408
  }
2253
1409
  if (requiresServer) continue;
2254
- const sequence = csv ? Number(chunkGHUUT54D_cjs.timelockToSequence(csv)) : void 0;
1410
+ const sequence = csv ? Number(chunkFLPWNMX3_cjs.timelockToSequence(csv)) : void 0;
2255
1411
  if (opts.checkTimelocks && csv && !isCsvSpendable(context, sequence)) continue;
2256
1412
  if (opts.checkTimelocks && cltv !== void 0 && !isCltvSatisfied(context, cltv)) {
2257
1413
  continue;
@@ -2268,17 +1424,17 @@ var ArkadeContractHandler = {
2268
1424
  type: "arkade",
2269
1425
  createScript(params) {
2270
1426
  const typed = this.deserializeParams(params);
2271
- return new ArkadeProgramScript(typed.program, typed.args, {
1427
+ return new chunkJFJNB7ZH_cjs.ArkadeProgramScript(typed.program, typed.args, {
2272
1428
  serverKey: typed.serverKey,
2273
1429
  userKey: typed.userKey,
2274
1430
  emulatorKey: typed.emulatorKey
2275
1431
  });
2276
1432
  },
2277
1433
  serializeParams(params) {
2278
- return serializeArkadeContractParams(params);
1434
+ return chunkJFJNB7ZH_cjs.serializeArkadeContractParams(params);
2279
1435
  },
2280
1436
  deserializeParams(params) {
2281
- return deserializeArkadeContractParams(params);
1437
+ return chunkJFJNB7ZH_cjs.deserializeArkadeContractParams(params);
2282
1438
  },
2283
1439
  selectPath(script, _contract, context) {
2284
1440
  const paths = pathsFor(script, context, { checkTimelocks: true });
@@ -2319,7 +1475,7 @@ var ArkadeContractHandler = {
2319
1475
  const leaf = collaborative[0]?.leaf ?? script.compiled.find((f) => f.arkadeScript)?.tapLeafScript ?? script.compiled[0].tapLeafScript;
2320
1476
  return {
2321
1477
  forfeitTapLeafScript: leaf,
2322
- intentTapLeafScript: leaf,
1478
+ proofTapLeafScript: leaf,
2323
1479
  tapTree: script.encode()
2324
1480
  };
2325
1481
  }
@@ -2333,55 +1489,25 @@ contractHandlers.register(VHTLCV2ContractHandler);
2333
1489
  contractHandlers.register(BoardingContractHandler);
2334
1490
  contractHandlers.register(ArkadeContractHandler);
2335
1491
 
2336
- exports.ARKADE_OP = ARKADE_OP;
2337
- exports.ARKADE_OPCODES = ARKADE_OPCODES;
2338
- exports.ARKADE_OPCODE_NAMES = ARKADE_OPCODE_NAMES;
2339
- exports.ARKADE_OPCODE_VALUES = ARKADE_OPCODE_VALUES;
2340
- exports.ARKADE_OPS = ARKADE_OPS;
2341
- exports.ARKADE_TYPE_ENCODINGS = ARKADE_TYPE_ENCODINGS;
2342
1492
  exports.ArkadeContractHandler = ArkadeContractHandler;
2343
- exports.ArkadeProgramScript = ArkadeProgramScript;
2344
- exports.ArkadeScript = ArkadeScript;
2345
1493
  exports.BoardingContractHandler = BoardingContractHandler;
2346
1494
  exports.DefaultContractHandler = DefaultContractHandler;
2347
1495
  exports.DelegateContractHandler = DelegateContractHandler;
2348
- exports.OPCODE_NAMES = OPCODE_NAMES;
2349
- exports.OPCODE_VALUES = OPCODE_VALUES;
2350
- exports.SUPPORTED_PROGRAM_VERSION = SUPPORTED_PROGRAM_VERSION;
2351
- exports.UnsupportedProgramVersionError = UnsupportedProgramVersionError;
2352
1496
  exports.VHTLCContractHandler = VHTLCContractHandler;
2353
1497
  exports.VHTLCV2ContractHandler = VHTLCV2ContractHandler;
2354
1498
  exports.WALLET_RECEIVE_SOURCE = WALLET_RECEIVE_SOURCE;
2355
- exports.arkadeScriptHash = arkadeScriptHash;
2356
- exports.arkadeWitnessHash = arkadeWitnessHash;
2357
- exports.asmToBytes = asmToBytes;
2358
- exports.bignum_exports = bignum_exports;
2359
- exports.bytesToASM = bytesToASM;
2360
- exports.computeArkadeScriptPublicKey = computeArkadeScriptPublicKey;
2361
1499
  exports.contractHandlers = contractHandlers;
2362
1500
  exports.deriveDescriptorLeafCompressedPubKey = deriveDescriptorLeafCompressedPubKey;
2363
1501
  exports.deriveDescriptorLeafPubKey = deriveDescriptorLeafPubKey;
2364
1502
  exports.descriptorIsOurs = descriptorIsOurs;
2365
- exports.deserializeArkadeContractParams = deserializeArkadeContractParams;
1503
+ exports.exitSequence = exitSequence;
2366
1504
  exports.extractPubKey = extractPubKey;
2367
- exports.fromASM = fromASM;
2368
- exports.getOpcodeName = getOpcodeName;
2369
- exports.getOpcodeValue = getOpcodeValue;
2370
1505
  exports.identityDescriptor = identityDescriptor;
2371
1506
  exports.isCltvSatisfied = isCltvSatisfied;
2372
1507
  exports.isCsvSpendable = isCsvSpendable;
2373
1508
  exports.isMainnetDescriptor = isMainnetDescriptor;
2374
1509
  exports.normalizeToDescriptor = normalizeToDescriptor;
2375
- exports.parseArtifact = parseArtifact;
2376
1510
  exports.parseHDDescriptor = parseHDDescriptor;
2377
- exports.resolveAsm = resolveAsm;
2378
- exports.serializeArkadeContractParams = serializeArkadeContractParams;
2379
1511
  exports.speculativeReceiveMetadata = speculativeReceiveMetadata;
2380
- exports.stringifyArtifact = stringifyArtifact;
2381
- exports.toASM = toASM;
2382
- exports.toXOnly = toXOnly;
2383
- exports.validateParamValue = validateParamValue;
2384
- exports.validateProgram = validateProgram;
2385
- exports.witnessRefToBytes = witnessRefToBytes;
2386
- //# sourceMappingURL=chunk-E6OOJEHL.cjs.map
2387
- //# sourceMappingURL=chunk-E6OOJEHL.cjs.map
1512
+ //# sourceMappingURL=chunk-NDQ4LB4X.cjs.map
1513
+ //# sourceMappingURL=chunk-NDQ4LB4X.cjs.map