@arkade-os/sdk 0.4.48 → 0.4.49

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 (77) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/adapters/indexedDB.cjs +5 -5
  6. package/dist/adapters/indexedDB.js +4 -4
  7. package/dist/{ark-CjE0KkGp.d.cts → ark-nkSiPYNf.d.cts} +86 -24
  8. package/dist/{ark-CjE0KkGp.d.ts → ark-nkSiPYNf.d.ts} +86 -24
  9. package/dist/{asyncStorageTaskQueue-D9SOPMPC.d.ts → asyncStorageTaskQueue-DCaEE83p.d.ts} +1 -1
  10. package/dist/{asyncStorageTaskQueue-CeLZhZFU.d.cts → asyncStorageTaskQueue-DdxhsEz6.d.cts} +1 -1
  11. package/dist/{chunk-ENZ4YPR2.cjs → chunk-2LAJ3RTH.cjs} +491 -418
  12. package/dist/chunk-2LAJ3RTH.cjs.map +1 -0
  13. package/dist/{chunk-NYR5H6GR.js → chunk-5QVBJUOG.js} +154 -81
  14. package/dist/chunk-5QVBJUOG.js.map +1 -0
  15. package/dist/{chunk-SYDANBJI.cjs → chunk-6UI5BFE7.cjs} +9 -9
  16. package/dist/{chunk-SYDANBJI.cjs.map → chunk-6UI5BFE7.cjs.map} +1 -1
  17. package/dist/{chunk-G6J6AEMH.js → chunk-BLJQV3N4.js} +4 -4
  18. package/dist/{chunk-G6J6AEMH.js.map → chunk-BLJQV3N4.js.map} +1 -1
  19. package/dist/{chunk-BHHLRZCS.js → chunk-CPO2UB7L.js} +4 -4
  20. package/dist/{chunk-BHHLRZCS.js.map → chunk-CPO2UB7L.js.map} +1 -1
  21. package/dist/{chunk-7TXSPRN5.cjs → chunk-E7HB3GKK.cjs} +31 -2
  22. package/dist/chunk-E7HB3GKK.cjs.map +1 -0
  23. package/dist/{chunk-ZDDBTFVO.js → chunk-EFNLTS6Q.js} +29 -3
  24. package/dist/chunk-EFNLTS6Q.js.map +1 -0
  25. package/dist/{chunk-XFMGIFBL.js → chunk-HN25T276.js} +4 -4
  26. package/dist/{chunk-XFMGIFBL.js.map → chunk-HN25T276.js.map} +1 -1
  27. package/dist/{chunk-5XMVTK5S.cjs → chunk-LJQ2VQBE.cjs} +211 -230
  28. package/dist/chunk-LJQ2VQBE.cjs.map +1 -0
  29. package/dist/{chunk-4VVTRPH3.js → chunk-MBSYQ3WX.js} +183 -201
  30. package/dist/chunk-MBSYQ3WX.js.map +1 -0
  31. package/dist/{chunk-EB3ALGTM.cjs → chunk-QDXQULVM.cjs} +13 -13
  32. package/dist/{chunk-EB3ALGTM.cjs.map → chunk-QDXQULVM.cjs.map} +1 -1
  33. package/dist/{chunk-ENDNQPZA.cjs → chunk-XOLH3LFO.cjs} +17 -17
  34. package/dist/{chunk-ENDNQPZA.cjs.map → chunk-XOLH3LFO.cjs.map} +1 -1
  35. package/dist/contracts/handlers/index.cjs +8 -8
  36. package/dist/contracts/handlers/index.d.cts +3 -3
  37. package/dist/contracts/handlers/index.d.ts +3 -3
  38. package/dist/contracts/handlers/index.js +2 -2
  39. package/dist/{delegate-D3dY-2vS.d.cts → delegate-Cqqw1T1J.d.cts} +1 -1
  40. package/dist/{delegate-DhGZk1r2.d.ts → delegate-D6Orvyq7.d.ts} +1 -1
  41. package/dist/{index-DK4_iWYy.d.ts → index-CWoogah0.d.ts} +2 -2
  42. package/dist/{index-D6RQROds.d.cts → index-Yd4hecbM.d.cts} +2 -2
  43. package/dist/index.cjs +181 -181
  44. package/dist/index.d.cts +8 -8
  45. package/dist/index.d.ts +8 -8
  46. package/dist/index.js +4 -4
  47. package/dist/repositories/realm/index.cjs +19 -19
  48. package/dist/repositories/realm/index.d.cts +2 -2
  49. package/dist/repositories/realm/index.d.ts +2 -2
  50. package/dist/repositories/realm/index.js +5 -5
  51. package/dist/repositories/sqlite/index.cjs +18 -18
  52. package/dist/repositories/sqlite/index.d.cts +2 -2
  53. package/dist/repositories/sqlite/index.d.ts +2 -2
  54. package/dist/repositories/sqlite/index.js +5 -5
  55. package/dist/{taskRunner-Brnak0Rc.d.cts → taskRunner-BjB5QINR.d.cts} +1 -1
  56. package/dist/{taskRunner-B-2MHCYG.d.ts → taskRunner-Dw7xs60Q.d.ts} +1 -1
  57. package/dist/wallet/expo/background.cjs +14 -14
  58. package/dist/wallet/expo/background.d.cts +3 -3
  59. package/dist/wallet/expo/background.d.ts +3 -3
  60. package/dist/wallet/expo/background.js +6 -6
  61. package/dist/wallet/expo/index.cjs +14 -14
  62. package/dist/wallet/expo/index.d.cts +4 -4
  63. package/dist/wallet/expo/index.d.ts +4 -4
  64. package/dist/wallet/expo/index.js +5 -5
  65. package/dist/{wallet-B5bwixQa.d.ts → wallet-CGkWu3xV.d.cts} +2 -2
  66. package/dist/{wallet-DiOrtYic.d.cts → wallet-DyUHrPyN.d.ts} +2 -2
  67. package/dist/worker/expo/index.cjs +9 -9
  68. package/dist/worker/expo/index.d.cts +4 -4
  69. package/dist/worker/expo/index.d.ts +4 -4
  70. package/dist/worker/expo/index.js +5 -5
  71. package/package.json +1 -1
  72. package/dist/chunk-4VVTRPH3.js.map +0 -1
  73. package/dist/chunk-5XMVTK5S.cjs.map +0 -1
  74. package/dist/chunk-7TXSPRN5.cjs.map +0 -1
  75. package/dist/chunk-ENZ4YPR2.cjs.map +0 -1
  76. package/dist/chunk-NYR5H6GR.js.map +0 -1
  77. package/dist/chunk-ZDDBTFVO.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkEB3ALGTM_cjs = require('./chunk-EB3ALGTM.cjs');
4
- var chunk5XMVTK5S_cjs = require('./chunk-5XMVTK5S.cjs');
5
- var chunk7TXSPRN5_cjs = require('./chunk-7TXSPRN5.cjs');
3
+ var chunkQDXQULVM_cjs = require('./chunk-QDXQULVM.cjs');
4
+ var chunkLJQ2VQBE_cjs = require('./chunk-LJQ2VQBE.cjs');
5
+ var chunkE7HB3GKK_cjs = require('./chunk-E7HB3GKK.cjs');
6
6
  var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
7
7
  var utils_js = require('@scure/btc-signer/utils.js');
8
8
  var btcSigner = require('@scure/btc-signer');
@@ -185,7 +185,7 @@ var TreeSignerSession = class _TreeSignerSession {
185
185
  noncesByPubkey.set(base.hex.encode(myPublicKey.subarray(1)), myNonce);
186
186
  const tx = this.graph.find(txid);
187
187
  if (!tx) throw new Error(`missing tx for txid ${txid}`);
188
- const cosigners = chunkEB3ALGTM_cjs.getArkPsbtFields(tx.root, 0, chunkEB3ALGTM_cjs.CosignerPublicKey).map(
188
+ const cosigners = chunkQDXQULVM_cjs.getArkPsbtFields(tx.root, 0, chunkQDXQULVM_cjs.CosignerPublicKey).map(
189
189
  (c) => base.hex.encode(c.key.subarray(1))
190
190
  // xonly pubkey
191
191
  );
@@ -237,7 +237,7 @@ var TreeSignerSession = class _TreeSignerSession {
237
237
  if (!aggNonce) throw new Error("missing aggregate nonce");
238
238
  const prevoutAmounts = [];
239
239
  const prevoutScripts = [];
240
- const cosigners = chunkEB3ALGTM_cjs.getArkPsbtFields(g.root, 0, chunkEB3ALGTM_cjs.CosignerPublicKey).map((c) => c.key);
240
+ const cosigners = chunkQDXQULVM_cjs.getArkPsbtFields(g.root, 0, chunkQDXQULVM_cjs.CosignerPublicKey).map((c) => c.key);
241
241
  const { finalKey } = aggregateKeys(cosigners, true, {
242
242
  taprootTweak: this.scriptRoot
243
243
  });
@@ -416,7 +416,7 @@ var SeedIdentity = class _SeedIdentity {
416
416
  let network;
417
417
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
418
418
  descriptor = opts.descriptor;
419
- network = chunk5XMVTK5S_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
419
+ network = chunkLJQ2VQBE_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
420
420
  } else {
421
421
  network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
422
422
  descriptor = descriptorsScure.scriptExpressions.trBIP32({
@@ -501,7 +501,7 @@ var SeedIdentity = class _SeedIdentity {
501
501
  * `StaticDescriptorProvider` for legacy single-key wallets.
502
502
  */
503
503
  isOurs(descriptor) {
504
- return chunk5XMVTK5S_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
504
+ return chunkLJQ2VQBE_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
505
505
  }
506
506
  /**
507
507
  * Signs each request with the key derived from its descriptor.
@@ -538,7 +538,7 @@ var SeedIdentity = class _SeedIdentity {
538
538
  }
539
539
  // ── internal helpers ─────────────────────────────────────────────
540
540
  derivePrivateKeyForDescriptor(descriptor) {
541
- const network = chunk5XMVTK5S_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
541
+ const network = chunkLJQ2VQBE_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
542
542
  const expansion = descriptorsScure.expand({ descriptor, network });
543
543
  if (expansion.isRanged) {
544
544
  throw new Error(
@@ -624,7 +624,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
624
624
  */
625
625
  descriptor;
626
626
  constructor(descriptor) {
627
- const network = chunk5XMVTK5S_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
627
+ const network = chunkLJQ2VQBE_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
628
628
  let expansion;
629
629
  try {
630
630
  expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
@@ -674,7 +674,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
674
674
  * `StaticDescriptorProvider` for legacy single-key wallets.
675
675
  */
676
676
  isOurs(descriptor) {
677
- return chunk5XMVTK5S_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
677
+ return chunkLJQ2VQBE_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
678
678
  }
679
679
  };
680
680
  function serializeSeedOwnedSigningIdentity(identity) {
@@ -986,14 +986,14 @@ var RestDelegateProvider = class {
986
986
  */
987
987
  async delegate(intent, forfeitTxs, options) {
988
988
  const url = `${this.url}/v1/delegate`;
989
- const response = await chunkEB3ALGTM_cjs.baseFetch(url, {
989
+ const response = await chunkQDXQULVM_cjs.baseFetch(url, {
990
990
  method: "POST",
991
991
  headers: {
992
992
  "Content-Type": "application/json"
993
993
  },
994
994
  body: JSON.stringify({
995
995
  intent: {
996
- message: chunkEB3ALGTM_cjs.Intent.encodeMessage(intent.message),
996
+ message: chunkQDXQULVM_cjs.Intent.encodeMessage(intent.message),
997
997
  proof: intent.proof
998
998
  },
999
999
  forfeit_txs: forfeitTxs,
@@ -1013,7 +1013,7 @@ var RestDelegateProvider = class {
1013
1013
  */
1014
1014
  async getDelegateInfo() {
1015
1015
  const url = `${this.url}/v1/delegator/info`;
1016
- const response = await chunkEB3ALGTM_cjs.rateGate.runHttp(url, () => chunkEB3ALGTM_cjs.baseFetch(url));
1016
+ const response = await chunkQDXQULVM_cjs.rateGate.runHttp(url, () => chunkQDXQULVM_cjs.baseFetch(url));
1017
1017
  if (!response.ok) {
1018
1018
  const errorText2 = await response.text();
1019
1019
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1040,7 +1040,7 @@ var ESPLORA_URL = {
1040
1040
  regtest: "http://localhost:3000/api"
1041
1041
  };
1042
1042
  var EsploraProvider = class {
1043
- constructor(baseUrl = ESPLORA_URL[chunk7TXSPRN5_cjs.DEFAULT_NETWORK_NAME], opts) {
1043
+ constructor(baseUrl = ESPLORA_URL[chunkE7HB3GKK_cjs.DEFAULT_NETWORK_NAME], opts) {
1044
1044
  this.baseUrl = baseUrl;
1045
1045
  this.pollingInterval = opts?.pollingInterval ?? 15e3;
1046
1046
  this.forcePolling = opts?.forcePolling ?? false;
@@ -1049,14 +1049,14 @@ var EsploraProvider = class {
1049
1049
  pollingInterval;
1050
1050
  forcePolling;
1051
1051
  async getCoins(address) {
1052
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1052
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1053
1053
  if (!response.ok) {
1054
1054
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1055
1055
  }
1056
1056
  return response.json();
1057
1057
  }
1058
1058
  async getFeeRate() {
1059
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1059
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1060
1060
  if (response.status === 404) {
1061
1061
  return void 0;
1062
1062
  }
@@ -1077,7 +1077,7 @@ var EsploraProvider = class {
1077
1077
  }
1078
1078
  }
1079
1079
  async getTxOutspends(txid) {
1080
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1080
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1081
1081
  if (!response.ok) {
1082
1082
  const error = await response.text();
1083
1083
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -1085,7 +1085,7 @@ var EsploraProvider = class {
1085
1085
  return response.json();
1086
1086
  }
1087
1087
  async getTransactions(address) {
1088
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1088
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1089
1089
  if (!response.ok) {
1090
1090
  const error = await response.text();
1091
1091
  throw new Error(`Failed to get transactions: ${error}`);
@@ -1093,7 +1093,7 @@ var EsploraProvider = class {
1093
1093
  return response.json();
1094
1094
  }
1095
1095
  async getTxStatus(txid) {
1096
- const txresponse = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1096
+ const txresponse = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1097
1097
  if (!txresponse.ok) {
1098
1098
  throw new Error(txresponse.statusText);
1099
1099
  }
@@ -1101,7 +1101,7 @@ var EsploraProvider = class {
1101
1101
  if (!tx.status.confirmed) {
1102
1102
  return { confirmed: false };
1103
1103
  }
1104
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1104
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1105
1105
  if (!response.ok) {
1106
1106
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
1107
1107
  }
@@ -1185,7 +1185,7 @@ var EsploraProvider = class {
1185
1185
  return stopFunc;
1186
1186
  }
1187
1187
  async getChainTip() {
1188
- const tipBlocks = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/blocks`);
1188
+ const tipBlocks = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/blocks`);
1189
1189
  if (!tipBlocks.ok) {
1190
1190
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
1191
1191
  }
@@ -1204,7 +1204,7 @@ var EsploraProvider = class {
1204
1204
  };
1205
1205
  }
1206
1206
  async broadcastPackage(parent, child) {
1207
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
1207
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
1208
1208
  method: "POST",
1209
1209
  headers: {
1210
1210
  "Content-Type": "application/json"
@@ -1218,7 +1218,7 @@ var EsploraProvider = class {
1218
1218
  return response.json();
1219
1219
  }
1220
1220
  async broadcastTx(tx) {
1221
- const response = await chunkEB3ALGTM_cjs.baseFetch(`${this.baseUrl}/tx`, {
1221
+ const response = await chunkQDXQULVM_cjs.baseFetch(`${this.baseUrl}/tx`, {
1222
1222
  method: "POST",
1223
1223
  headers: {
1224
1224
  "Content-Type": "text/plain"
@@ -1380,7 +1380,7 @@ function findP2AOutput(tx) {
1380
1380
  var CHILD_DUST_AMOUNT = 546;
1381
1381
  function buildAnchorChild(params) {
1382
1382
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
1383
- const child = new chunkEB3ALGTM_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
1383
+ const child = new chunkQDXQULVM_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
1384
1384
  child.addInput(findP2AOutput(parent));
1385
1385
  const estimator = TxWeightEstimator.create().addP2AInput();
1386
1386
  for (const _ of fundingCoins) {
@@ -1428,7 +1428,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
1428
1428
  );
1429
1429
  }
1430
1430
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
1431
- const tx = new chunkEB3ALGTM_cjs.Transaction({
1431
+ const tx = new chunkQDXQULVM_cjs.Transaction({
1432
1432
  version: 3,
1433
1433
  lockTime: txLocktime
1434
1434
  });
@@ -1504,7 +1504,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
1504
1504
  if (previousScriptKey.length !== 32) {
1505
1505
  throw new Error(`parent output ${childIndex} has invalid script`);
1506
1506
  }
1507
- const cosigners = chunkEB3ALGTM_cjs.getArkPsbtFields(child.root, 0, chunkEB3ALGTM_cjs.CosignerPublicKey);
1507
+ const cosigners = chunkQDXQULVM_cjs.getArkPsbtFields(child.root, 0, chunkQDXQULVM_cjs.CosignerPublicKey);
1508
1508
  if (cosigners.length === 0) {
1509
1509
  throw ErrMissingCosignersPublicKeys;
1510
1510
  }
@@ -1562,7 +1562,7 @@ var EmulatorPacket = class _EmulatorPacket {
1562
1562
  return new _EmulatorPacket(entries);
1563
1563
  }
1564
1564
  static fromBytes(data) {
1565
- const reader = new chunkEB3ALGTM_cjs.BufferReader(data);
1565
+ const reader = new chunkQDXQULVM_cjs.BufferReader(data);
1566
1566
  const entryCount = reader.readCompactSize();
1567
1567
  const entries = [];
1568
1568
  for (let i = 0; i < entryCount; i++) {
@@ -1580,7 +1580,7 @@ var EmulatorPacket = class _EmulatorPacket {
1580
1580
  return _EmulatorPacket.PACKET_TYPE;
1581
1581
  }
1582
1582
  serialize() {
1583
- const writer = new chunkEB3ALGTM_cjs.BufferWriter();
1583
+ const writer = new chunkQDXQULVM_cjs.BufferWriter();
1584
1584
  writer.writeCompactSize(this.entries.length);
1585
1585
  for (const entry of this.entries) {
1586
1586
  writer.writeUint16LE(entry.vin);
@@ -1667,7 +1667,7 @@ var Extension = class _Extension {
1667
1667
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
1668
1668
  );
1669
1669
  }
1670
- const reader = new chunkEB3ALGTM_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
1670
+ const reader = new chunkQDXQULVM_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
1671
1671
  const packets = [];
1672
1672
  while (reader.remaining() > 0) {
1673
1673
  const packetType = reader.readByte();
@@ -1741,7 +1741,7 @@ var Extension = class _Extension {
1741
1741
  */
1742
1742
  getAssetPacket() {
1743
1743
  for (const p of this.packets) {
1744
- if (p instanceof chunkEB3ALGTM_cjs.Packet) {
1744
+ if (p instanceof chunkQDXQULVM_cjs.Packet) {
1745
1745
  return p;
1746
1746
  }
1747
1747
  }
@@ -1779,8 +1779,8 @@ var Extension = class _Extension {
1779
1779
  };
1780
1780
  function parsePacket(packetType, data) {
1781
1781
  switch (packetType) {
1782
- case chunkEB3ALGTM_cjs.Packet.PACKET_TYPE:
1783
- return chunkEB3ALGTM_cjs.Packet.fromBytes(data);
1782
+ case chunkQDXQULVM_cjs.Packet.PACKET_TYPE:
1783
+ return chunkQDXQULVM_cjs.Packet.fromBytes(data);
1784
1784
  case EmulatorPacket.PACKET_TYPE:
1785
1785
  return EmulatorPacket.fromBytes(data);
1786
1786
  default:
@@ -1841,7 +1841,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
1841
1841
  for (const recipient of recipients) {
1842
1842
  let arkAddress;
1843
1843
  try {
1844
- arkAddress = chunk7TXSPRN5_cjs.ArkAddress.decode(recipient.address);
1844
+ arkAddress = chunkE7HB3GKK_cjs.ArkAddress.decode(recipient.address);
1845
1845
  } catch {
1846
1846
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
1847
1847
  continue;
@@ -2077,7 +2077,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2077
2077
  const existing = inputsByAssetId.get(asset.assetId);
2078
2078
  inputsByAssetId.set(asset.assetId, [
2079
2079
  ...existing ?? [],
2080
- chunkEB3ALGTM_cjs.AssetInput.create(inputIndex, asset.amount)
2080
+ chunkQDXQULVM_cjs.AssetInput.create(inputIndex, asset.amount)
2081
2081
  ]);
2082
2082
  }
2083
2083
  }
@@ -2089,7 +2089,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2089
2089
  const existing = outputsByAssetId.get(asset.assetId);
2090
2090
  outputsByAssetId.set(asset.assetId, [
2091
2091
  ...existing ?? [],
2092
- chunkEB3ALGTM_cjs.AssetOutput.create(outputIndex, asset.amount)
2092
+ chunkQDXQULVM_cjs.AssetOutput.create(outputIndex, asset.amount)
2093
2093
  ]);
2094
2094
  }
2095
2095
  }
@@ -2100,7 +2100,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2100
2100
  const existing = outputsByAssetId.get(asset.assetId);
2101
2101
  outputsByAssetId.set(asset.assetId, [
2102
2102
  ...existing ?? [],
2103
- chunkEB3ALGTM_cjs.AssetOutput.create(outputIndex, asset.amount)
2103
+ chunkQDXQULVM_cjs.AssetOutput.create(outputIndex, asset.amount)
2104
2104
  ]);
2105
2105
  }
2106
2106
  }
@@ -2109,11 +2109,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2109
2109
  for (const assetIdStr of allAssetIds) {
2110
2110
  const inputs = inputsByAssetId.get(assetIdStr);
2111
2111
  const outputs = outputsByAssetId.get(assetIdStr);
2112
- const assetId = chunkEB3ALGTM_cjs.AssetId.fromString(assetIdStr);
2113
- const group = chunkEB3ALGTM_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
2112
+ const assetId = chunkQDXQULVM_cjs.AssetId.fromString(assetIdStr);
2113
+ const group = chunkQDXQULVM_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
2114
2114
  groups.push(group);
2115
2115
  }
2116
- return chunkEB3ALGTM_cjs.Packet.create(groups);
2116
+ return chunkQDXQULVM_cjs.Packet.create(groups);
2117
2117
  }
2118
2118
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
2119
2119
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -2218,8 +2218,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
2218
2218
  function buildVirtualTx(inputs, outputs) {
2219
2219
  let lockTime = 0n;
2220
2220
  for (const input of inputs) {
2221
- const tapscript = chunk7TXSPRN5_cjs.decodeTapscript(chunk7TXSPRN5_cjs.scriptFromTapLeafScript(input.tapLeafScript));
2222
- if (chunk7TXSPRN5_cjs.CLTVMultisigTapscript.is(tapscript)) {
2221
+ const tapscript = chunkE7HB3GKK_cjs.decodeTapscript(chunkE7HB3GKK_cjs.scriptFromTapLeafScript(input.tapLeafScript));
2222
+ if (chunkE7HB3GKK_cjs.CLTVMultisigTapscript.is(tapscript)) {
2223
2223
  if (lockTime !== 0n) {
2224
2224
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
2225
2225
  throw new Error("cannot mix seconds and blocks locktime");
@@ -2230,7 +2230,7 @@ function buildVirtualTx(inputs, outputs) {
2230
2230
  }
2231
2231
  }
2232
2232
  }
2233
- const tx = new chunkEB3ALGTM_cjs.Transaction({
2233
+ const tx = new chunkQDXQULVM_cjs.Transaction({
2234
2234
  version: 3,
2235
2235
  lockTime: Number(lockTime)
2236
2236
  });
@@ -2240,12 +2240,12 @@ function buildVirtualTx(inputs, outputs) {
2240
2240
  index: input.vout,
2241
2241
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
2242
2242
  witnessUtxo: {
2243
- script: chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).pkScript,
2243
+ script: chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).pkScript,
2244
2244
  amount: BigInt(input.value)
2245
2245
  },
2246
2246
  tapLeafScript: [input.tapLeafScript]
2247
2247
  });
2248
- chunkEB3ALGTM_cjs.setArkPsbtField(tx, i, chunkEB3ALGTM_cjs.VtxoTaprootTree, input.tapTree);
2248
+ chunkQDXQULVM_cjs.setArkPsbtField(tx, i, chunkQDXQULVM_cjs.VtxoTaprootTree, input.tapTree);
2249
2249
  }
2250
2250
  for (const output of outputs) {
2251
2251
  tx.addOutput(output);
@@ -2254,8 +2254,8 @@ function buildVirtualTx(inputs, outputs) {
2254
2254
  return tx;
2255
2255
  }
2256
2256
  function buildCheckpointTx(vtxo, serverUnrollScript) {
2257
- const collaborativeClosure = chunk7TXSPRN5_cjs.decodeTapscript(chunk7TXSPRN5_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
2258
- const checkpointVtxoScript = new chunk7TXSPRN5_cjs.VtxoScript([
2257
+ const collaborativeClosure = chunkE7HB3GKK_cjs.decodeTapscript(chunkE7HB3GKK_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
2258
+ const checkpointVtxoScript = new chunkE7HB3GKK_cjs.VtxoScript([
2259
2259
  serverUnrollScript.script,
2260
2260
  collaborativeClosure.script
2261
2261
  ]);
@@ -2399,7 +2399,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
2399
2399
  }
2400
2400
  function isValidArkAddress(address) {
2401
2401
  try {
2402
- chunk7TXSPRN5_cjs.ArkAddress.decode(address);
2402
+ chunkE7HB3GKK_cjs.ArkAddress.decode(address);
2403
2403
  return true;
2404
2404
  } catch (e) {
2405
2405
  return false;
@@ -2428,14 +2428,14 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks) {
2428
2428
  let finalCheckpoints;
2429
2429
  if (userSignedCheckpoints) {
2430
2430
  finalCheckpoints = signedCheckpointTxs.map((c, i) => {
2431
- const serverSigned = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(c));
2431
+ const serverSigned = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(c));
2432
2432
  combineTapscriptSigs(userSignedCheckpoints[i], serverSigned);
2433
2433
  return base.base64.encode(serverSigned.toPSBT());
2434
2434
  });
2435
2435
  } else {
2436
2436
  finalCheckpoints = await Promise.all(
2437
2437
  signedCheckpointTxs.map(async (c) => {
2438
- const tx = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(c));
2438
+ const tx = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(c));
2439
2439
  const signed = await signer.signCheckpoint(tx);
2440
2440
  return base.base64.encode(signed.toPSBT());
2441
2441
  })
@@ -2631,7 +2631,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
2631
2631
  };
2632
2632
  }
2633
2633
  function deriveContractTapscripts(contract) {
2634
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(contract.type);
2634
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(contract.type);
2635
2635
  if (!handler) {
2636
2636
  throw new Error(`No handler for contract type '${contract.type}'`);
2637
2637
  }
@@ -2705,7 +2705,7 @@ function validateRecipients(recipients, dustAmount) {
2705
2705
  for (const recipient of recipients) {
2706
2706
  let address;
2707
2707
  try {
2708
- address = chunk7TXSPRN5_cjs.ArkAddress.decode(recipient.address);
2708
+ address = chunkE7HB3GKK_cjs.ArkAddress.decode(recipient.address);
2709
2709
  } catch (e) {
2710
2710
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
2711
2711
  }
@@ -2733,7 +2733,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
2733
2733
  continue;
2734
2734
  }
2735
2735
  for (const v of vtxos) {
2736
- if (!chunk7TXSPRN5_cjs.hasTerminalSpend(v) && !v.isSwept) out.add(`${v.txid}:${v.vout}`);
2736
+ if (!chunkE7HB3GKK_cjs.hasTerminalSpend(v) && !v.isSwept) out.add(`${v.txid}:${v.vout}`);
2737
2737
  }
2738
2738
  }
2739
2739
  return out;
@@ -2766,10 +2766,10 @@ function byValueDescending(vtxos) {
2766
2766
  return [...vtxos].sort((a, b) => b.value - a.value);
2767
2767
  }
2768
2768
  async function fetchTimeHeight(wallet) {
2769
- return chunk7TXSPRN5_cjs.resolveTimeHeight(wallet.onchainProvider);
2769
+ return chunkE7HB3GKK_cjs.resolveTimeHeight(wallet.onchainProvider);
2770
2770
  }
2771
2771
  function canMigrateBySend(vtxo, now) {
2772
- if (!chunk7TXSPRN5_cjs.canSpendOffchain(vtxo, now)) return false;
2772
+ if (!chunkE7HB3GKK_cjs.canSpendOffchain(vtxo, now)) return false;
2773
2773
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
2774
2774
  }
2775
2775
  function byExpiryAscending(vtxos, now) {
@@ -2777,7 +2777,7 @@ function byExpiryAscending(vtxos, now) {
2777
2777
  if (vtxo.isSwept) return -Infinity;
2778
2778
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
2779
2779
  if (vtxo.expiresAtHeight !== void 0) {
2780
- return chunk7TXSPRN5_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
2780
+ return chunkE7HB3GKK_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
2781
2781
  }
2782
2782
  return Infinity;
2783
2783
  };
@@ -2814,10 +2814,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
2814
2814
  };
2815
2815
  function getRecoverableVtxos(vtxos, dustAmount, now) {
2816
2816
  return vtxos.filter((vtxo) => {
2817
- if (chunk7TXSPRN5_cjs.canRecoverOnchain(vtxo, now)) {
2817
+ if (chunkE7HB3GKK_cjs.canRecoverOnchain(vtxo, now)) {
2818
2818
  return true;
2819
2819
  }
2820
- if (chunk7TXSPRN5_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
2820
+ if (chunkE7HB3GKK_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
2821
2821
  return true;
2822
2822
  }
2823
2823
  return false;
@@ -2848,7 +2848,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
2848
2848
  }
2849
2849
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
2850
2850
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
2851
- const expiresAt = chunk7TXSPRN5_cjs.normalizeVtxo(vtxo).expiresAt;
2851
+ const expiresAt = chunkE7HB3GKK_cjs.normalizeVtxo(vtxo).expiresAt;
2852
2852
  if (expiresAt === void 0) return false;
2853
2853
  const now = Date.now();
2854
2854
  const batchExpiry = expiresAt.getTime();
@@ -2857,7 +2857,7 @@ function isVtxoExpiringSoon(vtxo, thresholdMs) {
2857
2857
  }
2858
2858
  function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
2859
2859
  return vtxos.filter(
2860
- (vtxo) => isVtxoExpiringSoon(vtxo, thresholdMs) || chunk7TXSPRN5_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount)
2860
+ (vtxo) => isVtxoExpiringSoon(vtxo, thresholdMs) || chunkE7HB3GKK_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount)
2861
2861
  );
2862
2862
  }
2863
2863
  function isMigrationCapable(wallet) {
@@ -3339,11 +3339,11 @@ var VtxoManager = class _VtxoManager {
3339
3339
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
3340
3340
  );
3341
3341
  }
3342
- const tx = new chunkEB3ALGTM_cjs.Transaction();
3342
+ const tx = new chunkQDXQULVM_cjs.Transaction();
3343
3343
  for (const utxo of expiredUtxos) {
3344
- const utxoScript = chunk7TXSPRN5_cjs.VtxoScript.decode(utxo.tapTree);
3344
+ const utxoScript = chunkE7HB3GKK_cjs.VtxoScript.decode(utxo.tapTree);
3345
3345
  const utxoExitLeaf = utxoScript.leaves.find(
3346
- (leaf) => chunk7TXSPRN5_cjs.CSVMultisigTapscript.isScriptValid(chunk7TXSPRN5_cjs.scriptFromTapLeafScript(leaf)) === true
3346
+ (leaf) => chunkE7HB3GKK_cjs.CSVMultisigTapscript.isScriptValid(chunkE7HB3GKK_cjs.scriptFromTapLeafScript(leaf)) === true
3347
3347
  );
3348
3348
  if (!utxoExitLeaf) {
3349
3349
  throw new Error(
@@ -3358,7 +3358,7 @@ var VtxoManager = class _VtxoManager {
3358
3358
  amount: BigInt(utxo.value)
3359
3359
  },
3360
3360
  tapLeafScript: [utxoExitLeaf],
3361
- sequence: chunk7TXSPRN5_cjs.getSequence(utxoExitLeaf)
3361
+ sequence: chunkE7HB3GKK_cjs.getSequence(utxoExitLeaf)
3362
3362
  });
3363
3363
  }
3364
3364
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -3592,8 +3592,8 @@ var VtxoManager = class _VtxoManager {
3592
3592
  if (!serverPubKey) continue;
3593
3593
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
3594
3594
  if (cls.status === "CURRENT") continue;
3595
- const recoverable = vtxos.filter((v) => v.isSwept && !chunk7TXSPRN5_cjs.hasTerminalSpend(v));
3596
- const spendable = vtxos.filter((v) => !chunk7TXSPRN5_cjs.hasTerminalSpend(v) && !v.isSwept);
3595
+ const recoverable = vtxos.filter((v) => v.isSwept && !chunkE7HB3GKK_cjs.hasTerminalSpend(v));
3596
+ const spendable = vtxos.filter((v) => !chunkE7HB3GKK_cjs.hasTerminalSpend(v) && !v.isSwept);
3597
3597
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
3598
3598
  let recoverableCount = 0;
3599
3599
  let recoverableValue = 0;
@@ -3606,7 +3606,7 @@ var VtxoManager = class _VtxoManager {
3606
3606
  awaitingSweepCount = spendable.length;
3607
3607
  awaitingSweepValue = value;
3608
3608
  for (const v of spendable) {
3609
- const exp = chunk7TXSPRN5_cjs.toBatchExpiry(v);
3609
+ const exp = chunkE7HB3GKK_cjs.toBatchExpiry(v);
3610
3610
  if (exp !== void 0 && (nextSweepEta === void 0 || exp < nextSweepEta)) {
3611
3611
  nextSweepEta = exp;
3612
3612
  }
@@ -3867,7 +3867,7 @@ var VtxoManager = class _VtxoManager {
3867
3867
  /** Decodes the boarding tapscript exit path to extract the CSV timelock. */
3868
3868
  getBoardingTimelock() {
3869
3869
  const wallet = this.getSweepWallet();
3870
- const exitScript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(
3870
+ const exitScript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(
3871
3871
  base.hex.decode(wallet.boardingTapscript.exitScript)
3872
3872
  );
3873
3873
  return exitScript.params.timelock;
@@ -3998,8 +3998,8 @@ var VtxoManager = class _VtxoManager {
3998
3998
  * or doesn't carry the metadata.
3999
3999
  */
4000
4000
  extractSpentOutpoint(error) {
4001
- const ark = chunkEB3ALGTM_cjs.maybeArkError(error);
4002
- if (!chunkEB3ALGTM_cjs.isArkError(ark, chunkEB3ALGTM_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
4001
+ const ark = chunkQDXQULVM_cjs.maybeArkError(error);
4002
+ if (!chunkQDXQULVM_cjs.isArkError(ark, chunkQDXQULVM_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
4003
4003
  const raw = ark.metadata?.vtxo_outpoint;
4004
4004
  if (typeof raw !== "string") return void 0;
4005
4005
  const [txid, voutStr] = raw.split(":");
@@ -4189,7 +4189,7 @@ var VtxoManager = class _VtxoManager {
4189
4189
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
4190
4190
  break;
4191
4191
  }
4192
- const inputFee = estimator.evalOffchainInput(chunk7TXSPRN5_cjs.toOffchainInputFeeParams(v));
4192
+ const inputFee = estimator.evalOffchainInput(chunkE7HB3GKK_cjs.toOffchainInputFeeParams(v));
4193
4193
  if (inputFee.satoshis >= v.value) {
4194
4194
  continue;
4195
4195
  }
@@ -4209,7 +4209,7 @@ var VtxoManager = class _VtxoManager {
4209
4209
  const arkAddress = await this.wallet.getAddress();
4210
4210
  const outputFee = estimator.evalOffchainOutput({
4211
4211
  amount: totalAmount,
4212
- script: base.hex.encode(chunk7TXSPRN5_cjs.ArkAddress.decode(arkAddress).pkScript)
4212
+ script: base.hex.encode(chunkE7HB3GKK_cjs.ArkAddress.decode(arkAddress).pkScript)
4213
4213
  });
4214
4214
  totalAmount -= BigInt(outputFee.satoshis);
4215
4215
  if (totalAmount < dustAmount) return;
@@ -4289,7 +4289,7 @@ var ArkNote = class _ArkNote {
4289
4289
  this.value = value;
4290
4290
  this.HRP = HRP;
4291
4291
  const preimageHash = utils_js.sha256(this.preimage);
4292
- this.vtxoScript = new chunk7TXSPRN5_cjs.VtxoScript([noteTapscript(preimageHash)]);
4292
+ this.vtxoScript = new chunkE7HB3GKK_cjs.VtxoScript([noteTapscript(preimageHash)]);
4293
4293
  const leaf = this.vtxoScript.leaves[0];
4294
4294
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
4295
4295
  this.tapTree = this.vtxoScript.encode();
@@ -4456,7 +4456,7 @@ var ArkadeCash = class _ArkadeCash {
4456
4456
  const privateKey = data.slice(1, 33);
4457
4457
  const serverPubKey = data.slice(33, 65);
4458
4458
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
4459
- const csvTimelock = chunk7TXSPRN5_cjs.sequenceToTimelock(sequence);
4459
+ const csvTimelock = chunkE7HB3GKK_cjs.sequenceToTimelock(sequence);
4460
4460
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock, decoded.prefix);
4461
4461
  }
4462
4462
  toString() {
@@ -4464,7 +4464,7 @@ var ArkadeCash = class _ArkadeCash {
4464
4464
  data[0] = _ArkadeCash.Version;
4465
4465
  data.set(this._privateKey, 1);
4466
4466
  data.set(this._serverPubKey, 33);
4467
- const sequence = chunk7TXSPRN5_cjs.timelockToSequence(this.csvTimelock);
4467
+ const sequence = chunkE7HB3GKK_cjs.timelockToSequence(this.csvTimelock);
4468
4468
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
4469
4469
  const words = base.bech32m.toWords(data);
4470
4470
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -4473,7 +4473,7 @@ var ArkadeCash = class _ArkadeCash {
4473
4473
  return SingleKey.fromPrivateKey(this._privateKey);
4474
4474
  }
4475
4475
  get vtxoScript() {
4476
- return new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
4476
+ return new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
4477
4477
  pubKey: this._publicKey,
4478
4478
  serverPubKey: this._serverPubKey,
4479
4479
  csvTimelock: this.csvTimelock
@@ -4734,7 +4734,7 @@ async function captureExitBranch(params) {
4734
4734
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
4735
4735
  if (nonCommitment.length > 0) {
4736
4736
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
4737
- psbtByTxid.set(chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
4737
+ psbtByTxid.set(chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
4738
4738
  }
4739
4739
  }
4740
4740
  }
@@ -4777,10 +4777,10 @@ var IndexerExitDataSource = class {
4777
4777
  while (hasMore) {
4778
4778
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
4779
4779
  { txid: vtxo.txid, vout: vtxo.vout },
4780
- { pageIndex, pageSize: chunk5XMVTK5S_cjs.DEFAULT_PAGE_SIZE }
4780
+ { pageIndex, pageSize: chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE }
4781
4781
  );
4782
4782
  chain.push(...page);
4783
- hasMore = meta ? page.length === chunk5XMVTK5S_cjs.DEFAULT_PAGE_SIZE : false;
4783
+ hasMore = meta ? page.length === chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE : false;
4784
4784
  pageIndex++;
4785
4785
  }
4786
4786
  return chain;
@@ -4792,12 +4792,12 @@ var IndexerExitDataSource = class {
4792
4792
  while (hasMore) {
4793
4793
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
4794
4794
  pageIndex,
4795
- pageSize: chunk5XMVTK5S_cjs.DEFAULT_PAGE_SIZE
4795
+ pageSize: chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE
4796
4796
  });
4797
4797
  for (const psbt of txs) {
4798
- out.set(chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
4798
+ out.set(chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
4799
4799
  }
4800
- hasMore = page ? txs.length === chunk5XMVTK5S_cjs.DEFAULT_PAGE_SIZE : false;
4800
+ hasMore = page ? txs.length === chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE : false;
4801
4801
  pageIndex++;
4802
4802
  }
4803
4803
  return out;
@@ -4818,7 +4818,7 @@ function chainedTxTypeToChainTxType(t) {
4818
4818
  }
4819
4819
  }
4820
4820
  function psbtInputTxids(psbtBase64) {
4821
- const tx = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
4821
+ const tx = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
4822
4822
  const ids = [];
4823
4823
  for (let i = 0; i < tx.inputsLength; i++) {
4824
4824
  const txid = tx.getInput(i).txid;
@@ -4921,7 +4921,7 @@ function createExitChainResolver(params) {
4921
4921
 
4922
4922
  // src/providers/availability.ts
4923
4923
  function isRetryableProviderError(error) {
4924
- return error instanceof chunkEB3ALGTM_cjs.ProviderUnavailableError || error instanceof chunkEB3ALGTM_cjs.FetchError || chunkEB3ALGTM_cjs.isFetchTimeoutError(error);
4924
+ return error instanceof chunkQDXQULVM_cjs.ProviderUnavailableError || error instanceof chunkQDXQULVM_cjs.FetchError || chunkQDXQULVM_cjs.isFetchTimeoutError(error);
4925
4925
  }
4926
4926
 
4927
4927
  // src/utils/syncCursors.ts
@@ -5174,7 +5174,7 @@ async function resolveArkInfo(arkProvider, walletRepository) {
5174
5174
  if (!isRetryableProviderError(err)) throw err;
5175
5175
  const snapshot = await loadArkInfoSnapshot(walletRepository);
5176
5176
  if (!snapshot) {
5177
- throw new chunkEB3ALGTM_cjs.ProviderUnavailableError(
5177
+ throw new chunkQDXQULVM_cjs.ProviderUnavailableError(
5178
5178
  "Arkade server info is unavailable and no cached snapshot exists",
5179
5179
  { cause: err }
5180
5180
  );
@@ -5547,7 +5547,7 @@ function subtractAssets(spent, change) {
5547
5547
  return Array.from(map, ([assetId, amount]) => ({ assetId, amount }));
5548
5548
  }
5549
5549
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, getTxCreatedAt) {
5550
- const fromOldestVtxo = vtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
5550
+ const fromOldestVtxo = vtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
5551
5551
  const unmatchedSettledBoardingTxs = allBoardingTxs.filter(isSettledBoardingReceive).sort((a, b) => a.createdAt - b.createdAt);
5552
5552
  const sent = [];
5553
5553
  let received = [];
@@ -5709,7 +5709,7 @@ var AssetManager = class extends ReadonlyAssetManager {
5709
5709
  const virtualCoins = await this.wallet.getVtxos({
5710
5710
  withRecoverable: false
5711
5711
  });
5712
- const controlAssetRef = params.controlAssetId ? chunkEB3ALGTM_cjs.AssetRef.fromId(chunkEB3ALGTM_cjs.AssetId.fromString(params.controlAssetId)) : null;
5712
+ const controlAssetRef = params.controlAssetId ? chunkQDXQULVM_cjs.AssetRef.fromId(chunkQDXQULVM_cjs.AssetId.fromString(params.controlAssetId)) : null;
5713
5713
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
5714
5714
  let totalBtcSelected = 0n;
5715
5715
  const assetChanges = /* @__PURE__ */ new Map();
@@ -5722,8 +5722,8 @@ var AssetManager = class extends ReadonlyAssetManager {
5722
5722
  }
5723
5723
  }
5724
5724
  const groups = [];
5725
- const issuedAssetOutput = chunkEB3ALGTM_cjs.AssetOutput.create(0, params.amount);
5726
- const issuedAssetGroup = chunkEB3ALGTM_cjs.AssetGroup.create(
5725
+ const issuedAssetOutput = chunkQDXQULVM_cjs.AssetOutput.create(0, params.amount);
5726
+ const issuedAssetGroup = chunkQDXQULVM_cjs.AssetGroup.create(
5727
5727
  null,
5728
5728
  controlAssetRef,
5729
5729
  [],
@@ -5738,28 +5738,28 @@ var AssetManager = class extends ReadonlyAssetManager {
5738
5738
  for (const [inputIndex, assets] of assetInputs) {
5739
5739
  for (const asset of assets) {
5740
5740
  if (asset.assetId !== assetId) continue;
5741
- changeInputs.push(chunkEB3ALGTM_cjs.AssetInput.create(inputIndex, asset.amount));
5741
+ changeInputs.push(chunkQDXQULVM_cjs.AssetInput.create(inputIndex, asset.amount));
5742
5742
  }
5743
5743
  }
5744
5744
  groups.push(
5745
- chunkEB3ALGTM_cjs.AssetGroup.create(
5746
- chunkEB3ALGTM_cjs.AssetId.fromString(assetId),
5745
+ chunkQDXQULVM_cjs.AssetGroup.create(
5746
+ chunkQDXQULVM_cjs.AssetId.fromString(assetId),
5747
5747
  null,
5748
5748
  changeInputs,
5749
- [chunkEB3ALGTM_cjs.AssetOutput.create(0, amount)],
5749
+ [chunkQDXQULVM_cjs.AssetOutput.create(0, amount)],
5750
5750
  []
5751
5751
  )
5752
5752
  );
5753
5753
  }
5754
5754
  }
5755
5755
  const address = await this.wallet.getAddress();
5756
- const outputAddress = chunk7TXSPRN5_cjs.ArkAddress.decode(address);
5756
+ const outputAddress = chunkE7HB3GKK_cjs.ArkAddress.decode(address);
5757
5757
  const outputs = [
5758
5758
  {
5759
5759
  script: outputAddress.pkScript,
5760
5760
  amount: BigInt(totalBtcSelected)
5761
5761
  },
5762
- Extension.create([chunkEB3ALGTM_cjs.Packet.create(groups)]).txOut()
5762
+ Extension.create([chunkQDXQULVM_cjs.Packet.create(groups)]).txOut()
5763
5763
  ];
5764
5764
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(
5765
5765
  coinSelection.inputs,
@@ -5767,7 +5767,7 @@ var AssetManager = class extends ReadonlyAssetManager {
5767
5767
  );
5768
5768
  return {
5769
5769
  arkTxId: arkTxid,
5770
- assetId: chunkEB3ALGTM_cjs.AssetId.create(arkTxid, 0).toString()
5770
+ assetId: chunkQDXQULVM_cjs.AssetId.create(arkTxid, 0).toString()
5771
5771
  };
5772
5772
  }
5773
5773
  /**
@@ -5839,16 +5839,16 @@ var AssetManager = class extends ReadonlyAssetManager {
5839
5839
  for (const [inputIndex, assets] of assetInputs) {
5840
5840
  for (const asset of assets) {
5841
5841
  if (asset.assetId !== params.assetId) continue;
5842
- reissueInputs.push(chunkEB3ALGTM_cjs.AssetInput.create(inputIndex, asset.amount));
5842
+ reissueInputs.push(chunkQDXQULVM_cjs.AssetInput.create(inputIndex, asset.amount));
5843
5843
  }
5844
5844
  }
5845
5845
  const totalAssetAmount = assetToReissueAmount + params.amount;
5846
- const reissueAssetIdObj = chunkEB3ALGTM_cjs.AssetId.fromString(params.assetId);
5847
- const reissueAssetGroup = chunkEB3ALGTM_cjs.AssetGroup.create(
5846
+ const reissueAssetIdObj = chunkQDXQULVM_cjs.AssetId.fromString(params.assetId);
5847
+ const reissueAssetGroup = chunkQDXQULVM_cjs.AssetGroup.create(
5848
5848
  reissueAssetIdObj,
5849
5849
  null,
5850
5850
  reissueInputs,
5851
- [chunkEB3ALGTM_cjs.AssetOutput.create(0, totalAssetAmount)],
5851
+ [chunkQDXQULVM_cjs.AssetOutput.create(0, totalAssetAmount)],
5852
5852
  []
5853
5853
  );
5854
5854
  const groups = [reissueAssetGroup];
@@ -5857,27 +5857,27 @@ var AssetManager = class extends ReadonlyAssetManager {
5857
5857
  for (const [inputIndex, assets] of assetInputs) {
5858
5858
  for (const asset of assets) {
5859
5859
  if (asset.assetId !== assetId) continue;
5860
- changeInputs.push(chunkEB3ALGTM_cjs.AssetInput.create(inputIndex, asset.amount));
5860
+ changeInputs.push(chunkQDXQULVM_cjs.AssetInput.create(inputIndex, asset.amount));
5861
5861
  }
5862
5862
  }
5863
5863
  groups.push(
5864
- chunkEB3ALGTM_cjs.AssetGroup.create(
5865
- chunkEB3ALGTM_cjs.AssetId.fromString(assetId),
5864
+ chunkQDXQULVM_cjs.AssetGroup.create(
5865
+ chunkQDXQULVM_cjs.AssetId.fromString(assetId),
5866
5866
  null,
5867
5867
  changeInputs,
5868
- [chunkEB3ALGTM_cjs.AssetOutput.create(0, amount)],
5868
+ [chunkQDXQULVM_cjs.AssetOutput.create(0, amount)],
5869
5869
  []
5870
5870
  )
5871
5871
  );
5872
5872
  }
5873
5873
  const address = await this.wallet.getAddress();
5874
- const outputAddress = chunk7TXSPRN5_cjs.ArkAddress.decode(address);
5874
+ const outputAddress = chunkE7HB3GKK_cjs.ArkAddress.decode(address);
5875
5875
  const outputs = [
5876
5876
  {
5877
5877
  script: outputAddress.pkScript,
5878
5878
  amount: BigInt(totalBtcSelected)
5879
5879
  },
5880
- Extension.create([chunkEB3ALGTM_cjs.Packet.create(groups)]).txOut()
5880
+ Extension.create([chunkQDXQULVM_cjs.Packet.create(groups)]).txOut()
5881
5881
  ];
5882
5882
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
5883
5883
  return arkTxid;
@@ -5944,27 +5944,27 @@ var AssetManager = class extends ReadonlyAssetManager {
5944
5944
  for (const [inputIndex, assets] of assetInputs) {
5945
5945
  for (const asset of assets) {
5946
5946
  if (asset.assetId !== assetId) continue;
5947
- changeInputs.push(chunkEB3ALGTM_cjs.AssetInput.create(inputIndex, asset.amount));
5947
+ changeInputs.push(chunkQDXQULVM_cjs.AssetInput.create(inputIndex, asset.amount));
5948
5948
  }
5949
5949
  }
5950
5950
  groups.push(
5951
- chunkEB3ALGTM_cjs.AssetGroup.create(
5952
- chunkEB3ALGTM_cjs.AssetId.fromString(assetId),
5951
+ chunkQDXQULVM_cjs.AssetGroup.create(
5952
+ chunkQDXQULVM_cjs.AssetId.fromString(assetId),
5953
5953
  null,
5954
5954
  changeInputs,
5955
- amount > 0n ? [chunkEB3ALGTM_cjs.AssetOutput.create(0, amount)] : [],
5955
+ amount > 0n ? [chunkQDXQULVM_cjs.AssetOutput.create(0, amount)] : [],
5956
5956
  []
5957
5957
  )
5958
5958
  );
5959
5959
  }
5960
5960
  const address = await this.wallet.getAddress();
5961
- const outputAddress = chunk7TXSPRN5_cjs.ArkAddress.decode(address);
5961
+ const outputAddress = chunkE7HB3GKK_cjs.ArkAddress.decode(address);
5962
5962
  const outputs = [
5963
5963
  {
5964
5964
  script: outputAddress.pkScript,
5965
5965
  amount: BigInt(totalBtcSelected)
5966
5966
  },
5967
- Extension.create([chunkEB3ALGTM_cjs.Packet.create(groups)]).txOut()
5967
+ Extension.create([chunkQDXQULVM_cjs.Packet.create(groups)]).txOut()
5968
5968
  ];
5969
5969
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
5970
5970
  return arkTxid;
@@ -5989,7 +5989,7 @@ function castMetadata(metadata) {
5989
5989
  } else {
5990
5990
  throw new Error("Invalid metadata value type");
5991
5991
  }
5992
- md.push(chunkEB3ALGTM_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
5992
+ md.push(chunkQDXQULVM_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
5993
5993
  }
5994
5994
  return md;
5995
5995
  }
@@ -6010,10 +6010,10 @@ var DelegateManagerImpl = class {
6010
6010
  if (vtxos.length === 0) {
6011
6011
  return { delegated: [], failed: [] };
6012
6012
  }
6013
- const destinationScript = chunk7TXSPRN5_cjs.ArkAddress.decode(destination).pkScript;
6013
+ const destinationScript = chunkE7HB3GKK_cjs.ArkAddress.decode(destination).pkScript;
6014
6014
  const arkInfo = await this.arkInfoProvider.getInfo();
6015
6015
  const delegateInfo = await this.delegateProvider.getDelegateInfo();
6016
- const eligible = vtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo).filter(
6016
+ const eligible = vtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo).filter(
6017
6017
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
6018
6018
  );
6019
6019
  if (eligible.length === 0) {
@@ -6042,11 +6042,11 @@ var DelegateManagerImpl = class {
6042
6042
  const groupByExpiry = /* @__PURE__ */ new Map();
6043
6043
  let recoverableVtxos = [];
6044
6044
  for (const vtxo of eligible) {
6045
- if (chunk7TXSPRN5_cjs.canRecoverOnchain(vtxo, now)) {
6045
+ if (chunkE7HB3GKK_cjs.canRecoverOnchain(vtxo, now)) {
6046
6046
  recoverableVtxos.push(vtxo);
6047
6047
  continue;
6048
6048
  }
6049
- const expiry = chunk7TXSPRN5_cjs.toBatchExpiry(vtxo);
6049
+ const expiry = chunkE7HB3GKK_cjs.toBatchExpiry(vtxo);
6050
6050
  if (!expiry) continue;
6051
6051
  const dayKey = getDayTimestamp(expiry);
6052
6052
  groupByExpiry.set(dayKey, [...groupByExpiry.get(dayKey) ?? [], vtxo]);
@@ -6111,7 +6111,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
6111
6111
  }
6112
6112
  if (!delegateAt) {
6113
6113
  const now = { timestamp: /* @__PURE__ */ new Date() };
6114
- const expiryTimestamp = vtxos.filter((coin) => !chunk7TXSPRN5_cjs.canRecoverOnchain(coin, now) && chunk7TXSPRN5_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunk7TXSPRN5_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
6114
+ const expiryTimestamp = vtxos.filter((coin) => !chunkE7HB3GKK_cjs.canRecoverOnchain(coin, now) && chunkE7HB3GKK_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunkE7HB3GKK_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
6115
6115
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
6116
6116
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
6117
6117
  } else {
@@ -6140,7 +6140,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
6140
6140
  let amount = 0n;
6141
6141
  for (const coin of vtxos) {
6142
6142
  const inputFee = estimator.evalOffchainInput({
6143
- ...chunk7TXSPRN5_cjs.toOffchainInputFeeParams(coin),
6143
+ ...chunkE7HB3GKK_cjs.toOffchainInputFeeParams(coin),
6144
6144
  type: "vtxo"
6145
6145
  });
6146
6146
  if (inputFee.value >= coin.value) {
@@ -6154,7 +6154,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
6154
6154
  const delegateFee = BigInt(Number(fee));
6155
6155
  if (delegateFee > 0n) {
6156
6156
  outputs.push({
6157
- script: chunk7TXSPRN5_cjs.ArkAddress.decode(delegateAddress).pkScript,
6157
+ script: chunkE7HB3GKK_cjs.ArkAddress.decode(delegateAddress).pkScript,
6158
6158
  amount: delegateFee
6159
6159
  });
6160
6160
  }
@@ -6187,10 +6187,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
6187
6187
  destinationScript
6188
6188
  );
6189
6189
  const forfeitOutputScript = btcSigner.OutScript.encode(
6190
- btcSigner.Address(chunk7TXSPRN5_cjs.getNetwork(network)).decode(forfeitAddress)
6190
+ btcSigner.Address(chunkE7HB3GKK_cjs.getNetwork(network)).decode(forfeitAddress)
6191
6191
  );
6192
6192
  const forfeits = await Promise.all(
6193
- vtxos.filter((v) => !chunk7TXSPRN5_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
6193
+ vtxos.filter((v) => !chunkE7HB3GKK_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
6194
6194
  const forfeit = await makeDelegateForfeitTx(
6195
6195
  coin,
6196
6196
  dust,
@@ -6215,7 +6215,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
6215
6215
  index: input.vout,
6216
6216
  witnessUtxo: {
6217
6217
  amount: BigInt(input.value),
6218
- script: chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).pkScript
6218
+ script: chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).pkScript
6219
6219
  },
6220
6220
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
6221
6221
  tapLeafScript: [delegateTapLeaf]
@@ -6273,7 +6273,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
6273
6273
  expire_at: 0,
6274
6274
  cosigners_public_keys: cosignerPubKeys
6275
6275
  };
6276
- const proof = chunkEB3ALGTM_cjs.Intent.create(message, coins, outputs);
6276
+ const proof = chunkQDXQULVM_cjs.Intent.create(message, coins, outputs);
6277
6277
  const signedProof = await identity.sign(proof);
6278
6278
  return {
6279
6279
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -6291,10 +6291,10 @@ function getDayTimestamp(timestamp) {
6291
6291
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
6292
6292
  if (!vtxo.tapTree) return void 0;
6293
6293
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
6294
- const vtxoScript = chunk7TXSPRN5_cjs.VtxoScript.decode(vtxo.tapTree);
6294
+ const vtxoScript = chunkE7HB3GKK_cjs.VtxoScript.decode(vtxo.tapTree);
6295
6295
  return vtxoScript.leaves.find((tapLeaf) => {
6296
- const arkTapscript = chunk7TXSPRN5_cjs.decodeTapscript(chunk7TXSPRN5_cjs.scriptFromTapLeafScript(tapLeaf));
6297
- if (!chunk7TXSPRN5_cjs.MultisigTapscript.is(arkTapscript)) return false;
6296
+ const arkTapscript = chunkE7HB3GKK_cjs.decodeTapscript(chunkE7HB3GKK_cjs.scriptFromTapLeafScript(tapLeaf));
6297
+ if (!chunkE7HB3GKK_cjs.MultisigTapscript.is(arkTapscript)) return false;
6298
6298
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
6299
6299
  });
6300
6300
  }
@@ -6482,7 +6482,7 @@ async function closeDatabase(dbName) {
6482
6482
  return true;
6483
6483
  }
6484
6484
  function scriptFromArkAddress(address) {
6485
- return base.hex.encode(chunk7TXSPRN5_cjs.ArkAddress.decode(address).pkScript);
6485
+ return base.hex.encode(chunkE7HB3GKK_cjs.ArkAddress.decode(address).pkScript);
6486
6486
  }
6487
6487
 
6488
6488
  // src/repositories/indexedDB/schema.ts
@@ -6979,7 +6979,7 @@ function validateVtxosForScript(vtxos, script, context) {
6979
6979
  }
6980
6980
  async function getVtxosForContract(repo, contract) {
6981
6981
  const vtxos = repo.getVtxosForScript ? await repo.getVtxosForScript(contract.script) : filterVtxosForScript(await repo.getVtxos(contract.address), contract.script);
6982
- return vtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo);
6982
+ return vtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo);
6983
6983
  }
6984
6984
  async function saveVtxosForContract(repo, contract, vtxos) {
6985
6985
  if (repo.saveVtxosForScript) {
@@ -7183,7 +7183,7 @@ var deserializeTapLeaf = (t) => {
7183
7183
  const s = base.hex.decode(t.s);
7184
7184
  return [cb, s];
7185
7185
  };
7186
- var deserializeVtxo = (o) => chunk7TXSPRN5_cjs.normalizeVtxo({
7186
+ var deserializeVtxo = (o) => chunkE7HB3GKK_cjs.normalizeVtxo({
7187
7187
  ...o,
7188
7188
  createdAt: new Date(o.createdAt),
7189
7189
  tapTree: base.hex.decode(o.tapTree),
@@ -8118,6 +8118,9 @@ var ContractWatcher = class {
8118
8118
  reconnectAttempts = 0;
8119
8119
  reconnectTimeoutId;
8120
8120
  failsafePollIntervalId;
8121
+ /** See {@link withCoalescedSubscription}. */
8122
+ subscriptionBatchDepth = 0;
8123
+ subscriptionUpdateDeferred = false;
8121
8124
  /**
8122
8125
  * Create a contract watcher with the given providers and polling settings.
8123
8126
  *
@@ -8319,7 +8322,7 @@ var ContractWatcher = class {
8319
8322
  this.connectionState = "connected";
8320
8323
  this.reconnectAttempts = 0;
8321
8324
  this.listenLoop().catch((e) => {
8322
- if (chunkEB3ALGTM_cjs.isEventSourceError(e)) {
8325
+ if (chunkQDXQULVM_cjs.isEventSourceError(e)) {
8323
8326
  console.debug("ContractWatcher subscription disconnected; reconnecting");
8324
8327
  } else {
8325
8328
  console.error(e);
@@ -8427,7 +8430,40 @@ var ContractWatcher = class {
8427
8430
  console.error("ContractWatcher poll failed:", error);
8428
8431
  }
8429
8432
  }
8433
+ /**
8434
+ * Run `fn` with subscription updates coalesced into a single
8435
+ * `subscribeForScripts` on the way out.
8436
+ *
8437
+ * {@link addContract} re-subscribes eagerly (the watcher may already be
8438
+ * running), and every subscribe posts the *whole* accumulated script list —
8439
+ * so a restore scan that discovers N contracts sends N growing POSTs,
8440
+ * quadratic in script-slots. Inside this scope those updates are only
8441
+ * marked dirty, flushed once on the way out (success and error path alike).
8442
+ *
8443
+ * A contract added inside the scope is therefore not streaming until the
8444
+ * flush. Nothing in the watcher closes that window — the failsafe poll
8445
+ * replays repository state and cannot see VTXOs no one has fetched yet. The
8446
+ * one caller, `scanContracts`, is covered because `Wallet.restore` follows
8447
+ * it with a bulk `refreshVtxos`. A new caller must provide its own
8448
+ * equivalent catch-up, or keep the scope short enough not to need one.
8449
+ */
8450
+ async withCoalescedSubscription(fn) {
8451
+ this.subscriptionBatchDepth++;
8452
+ try {
8453
+ return await fn();
8454
+ } finally {
8455
+ this.subscriptionBatchDepth--;
8456
+ if (this.subscriptionBatchDepth === 0 && this.subscriptionUpdateDeferred) {
8457
+ this.subscriptionUpdateDeferred = false;
8458
+ if (this.isWatching) await this.tryUpdateSubscription();
8459
+ }
8460
+ }
8461
+ }
8430
8462
  async tryUpdateSubscription() {
8463
+ if (this.subscriptionBatchDepth > 0) {
8464
+ this.subscriptionUpdateDeferred = true;
8465
+ return;
8466
+ }
8431
8467
  const hadSubscription = this.subscriptionId !== void 0;
8432
8468
  try {
8433
8469
  await this.updateSubscription();
@@ -8515,14 +8551,14 @@ var ContractWatcher = class {
8515
8551
  const timestamp = Date.now();
8516
8552
  if (update.newVtxos?.length) {
8517
8553
  this.processSubscriptionVtxos(
8518
- update.newVtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo),
8554
+ update.newVtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo),
8519
8555
  "vtxo_received",
8520
8556
  timestamp
8521
8557
  );
8522
8558
  }
8523
8559
  if (update.spentVtxos?.length) {
8524
8560
  this.processSubscriptionVtxos(
8525
- update.spentVtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo),
8561
+ update.spentVtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo),
8526
8562
  "vtxo_spent",
8527
8563
  timestamp
8528
8564
  );
@@ -8655,7 +8691,7 @@ async function reconcileIntents(deps) {
8655
8691
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
8656
8692
  if (outpoints.length > 0) {
8657
8693
  try {
8658
- const { vtxos } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
8694
+ const { vtxos } = await chunkE7HB3GKK_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
8659
8695
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
8660
8696
  } catch (e) {
8661
8697
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -8857,7 +8893,7 @@ var ContractManager = class _ContractManager {
8857
8893
  * `persisted` is `true`.
8858
8894
  */
8859
8895
  async upsertContract(params) {
8860
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(params.type);
8896
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(params.type);
8861
8897
  if (!handler) {
8862
8898
  throw new Error(`No handler registered for contract type '${params.type}'`);
8863
8899
  }
@@ -8908,21 +8944,27 @@ var ContractManager = class _ContractManager {
8908
8944
  * Safety-critical invariants (spec §2.C / §4):
8909
8945
  * - `opts.materialize(i)` throwing is structural/fatal: it is NOT
8910
8946
  * wrapped — it propagates and aborts the scan.
8911
- * - A `discoverAt` rejection is collected into `handlerErrors` and makes
8912
- * its index *indeterminate*: it does NOT advance the gap counter, and
8913
- * the scan stops verifying there, reporting `truncatedAt`. Only an index
8947
+ * - A discovery rejection is collected into `handlerErrors` and makes its
8948
+ * index *indeterminate*: it does NOT advance the gap counter, and the
8949
+ * scan stops verifying there, reporting `truncatedAt`. Only an index
8914
8950
  * every handler answered for can be a confirmed miss.
8915
8951
  * - `persistAndWatchContract` rejecting is operational/fatal and
8916
- * propagates (only `discoverAt` is guarded).
8917
- * - Within an index the handler probes run concurrently (independent
8918
- * network reads); their hits are persisted sequentially in
8919
- * `discoverables` order to preserve the first-wins collision tie-break.
8920
- * - Indices are probed `batchSize` at a time (a second concurrency layer
8921
- * over the per-index probes), but each window is CAPPED to
8952
+ * propagates (only the handler calls are guarded).
8953
+ * - A handler exposing {@link Discoverable.discoverRange} is asked for the
8954
+ * whole window in ONE call instead of one per index — the batching that
8955
+ * keeps a large restore from bursting into an operator's rate limiter.
8956
+ * Its failures are therefore range-wide: every index in the window goes
8957
+ * indeterminate and truncation lands on the window's first index. Its
8958
+ * answer must cover every requested index; an incomplete map is treated
8959
+ * as a rejection (see `Discoverable.discoverRange`).
8960
+ * - Handlers are probed concurrently (independent network reads); their
8961
+ * hits are persisted sequentially in `discoverables` order to preserve
8962
+ * the first-wins collision tie-break.
8963
+ * - Indices are probed `batchSize` at a time, but each window is CAPPED to
8922
8964
  * `gapLimit - unused` indices — the most a serial scan could still reach
8923
8965
  * before the gap window is guaranteed to close. So every index probed in
8924
8966
  * a window is one a one-index-at-a-time scan would also reach: nothing is
8925
- * over-scanned, nothing is discarded, and `materialize`/`discoverAt` are
8967
+ * over-scanned, nothing is discarded, and `materialize`/discovery are
8926
8968
  * invoked on exactly the same index set. The window's hits are still
8927
8969
  * processed strictly in ascending index order, so the discovered set,
8928
8970
  * persisted rows, `highestConfirmedUsedIndex`, and `handlerErrors` are
@@ -8931,8 +8973,14 @@ var ContractManager = class _ContractManager {
8931
8973
  * can surface hits above the failed index that a serial scan would never
8932
8974
  * have reached, so a truncated batched scan discovers a superset — never
8933
8975
  * a subset — of the serial one.
8976
+ * - The whole scan runs inside one coalesced subscription scope, so N
8977
+ * discovered contracts cost ONE `subscribeForScripts` instead of N
8978
+ * growing ones (see {@link ContractWatcher.withCoalescedSubscription}).
8934
8979
  */
8935
- async scanContracts(opts) {
8980
+ scanContracts(opts) {
8981
+ return this.watcher.withCoalescedSubscription(() => this.runScan(opts));
8982
+ }
8983
+ async runScan(opts) {
8936
8984
  const gapLimit = opts.gapLimit ?? 20;
8937
8985
  if (!Number.isInteger(gapLimit) || gapLimit <= 0) {
8938
8986
  throw new Error(
@@ -8945,7 +8993,7 @@ var ContractManager = class _ContractManager {
8945
8993
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
8946
8994
  );
8947
8995
  }
8948
- const registered = chunk5XMVTK5S_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk5XMVTK5S_cjs.contractHandlers.get(t)).filter(isDiscoverable);
8996
+ const registered = chunkLJQ2VQBE_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkLJQ2VQBE_cjs.contractHandlers.get(t)).filter(isDiscoverable);
8949
8997
  const discoverables = [
8950
8998
  ...registered.filter((h) => h.type === "boarding"),
8951
8999
  ...registered.filter((h) => h.type !== "boarding")
@@ -8956,43 +9004,80 @@ var ContractManager = class _ContractManager {
8956
9004
  let truncatedAt;
8957
9005
  let unused = 0;
8958
9006
  let i = 0;
8959
- const probeIndex = async (index) => {
8960
- const descriptor = opts.materialize(index);
8961
- return Promise.all(
8962
- discoverables.map(async (h) => {
8963
- try {
8964
- return {
8965
- ok: true,
8966
- found: await h.discoverAt(index, descriptor, opts.deps)
8967
- };
8968
- } catch (error) {
8969
- return { ok: false, error };
8970
- }
8971
- })
8972
- );
9007
+ const probeHandler = async (h, entries) => {
9008
+ const probe = {
9009
+ found: /* @__PURE__ */ new Map(),
9010
+ indeterminate: /* @__PURE__ */ new Set(),
9011
+ // Keyed by the index the failure is ANCHORED at, so errors stay
9012
+ // reported in ascending-index order below, exactly as the
9013
+ // per-index path reports them.
9014
+ errors: /* @__PURE__ */ new Map()
9015
+ };
9016
+ if (!h.discoverRange) {
9017
+ await Promise.all(
9018
+ entries.map(async ({ index, descriptor }) => {
9019
+ try {
9020
+ probe.found.set(
9021
+ index,
9022
+ await h.discoverAt(index, descriptor, opts.deps)
9023
+ );
9024
+ } catch (error) {
9025
+ probe.indeterminate.add(index);
9026
+ probe.errors.set(index, { handler: h.type, index, error });
9027
+ }
9028
+ })
9029
+ );
9030
+ return probe;
9031
+ }
9032
+ const from = entries[0].index;
9033
+ const to = entries[entries.length - 1].index;
9034
+ const failRange = (error) => {
9035
+ for (const e of entries) probe.indeterminate.add(e.index);
9036
+ probe.errors.set(from, {
9037
+ handler: h.type,
9038
+ index: from,
9039
+ ...to > from && { toIndex: to },
9040
+ error
9041
+ });
9042
+ };
9043
+ let ranged;
9044
+ try {
9045
+ ranged = await h.discoverRange(entries, opts.deps);
9046
+ } catch (error) {
9047
+ failRange(error);
9048
+ return probe;
9049
+ }
9050
+ for (const e of entries) {
9051
+ const found = ranged.get(e.index);
9052
+ if (found) probe.found.set(e.index, found);
9053
+ }
9054
+ const missing = entries.find((e) => !ranged.has(e.index));
9055
+ if (missing) {
9056
+ failRange(
9057
+ new Error(
9058
+ `${h.type}.discoverRange resolved without index ${missing.index} of the requested range [${from}..${to}]`
9059
+ )
9060
+ );
9061
+ }
9062
+ return probe;
8973
9063
  };
8974
9064
  while (i <= maxIdx && unused < gapLimit) {
8975
9065
  const windowEnd = Math.min(maxIdx, i + Math.min(batchSize, gapLimit - unused) - 1);
8976
- const windowIndices = [];
8977
- for (let idx = i; idx <= windowEnd; idx++) windowIndices.push(idx);
8978
- const windowProbes = await Promise.all(windowIndices.map(probeIndex));
8979
- for (let w = 0; w < windowIndices.length; w++) {
8980
- const index = windowIndices[w];
8981
- const probes = windowProbes[w];
9066
+ const entries = [];
9067
+ for (let idx = i; idx <= windowEnd; idx++) {
9068
+ entries.push({ index: idx, descriptor: opts.materialize(idx) });
9069
+ }
9070
+ const windowProbes = await Promise.all(
9071
+ discoverables.map((h) => probeHandler(h, entries))
9072
+ );
9073
+ for (const { index } of entries) {
8982
9074
  let hitAtThisIndex = false;
8983
9075
  let indeterminate = false;
8984
- for (let h = 0; h < discoverables.length; h++) {
8985
- const probe = probes[h];
8986
- if (!probe.ok) {
8987
- handlerErrors.push({
8988
- handler: discoverables[h].type,
8989
- index,
8990
- error: probe.error
8991
- });
8992
- indeterminate = true;
8993
- continue;
8994
- }
8995
- for (const c of probe.found) {
9076
+ for (const probe of windowProbes) {
9077
+ const error = probe.errors.get(index);
9078
+ if (error) handlerErrors.push(error);
9079
+ if (probe.indeterminate.has(index)) indeterminate = true;
9080
+ for (const c of probe.found.get(index) ?? []) {
8996
9081
  await this.persistAndWatchContract(c);
8997
9082
  hitAtThisIndex = true;
8998
9083
  }
@@ -9064,7 +9149,7 @@ var ContractManager = class _ContractManager {
9064
9149
  }
9065
9150
  const tapscriptCache = /* @__PURE__ */ new Map();
9066
9151
  return vtxos.map(
9067
- (vtxo) => extendVirtualCoinForContract(chunk7TXSPRN5_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
9152
+ (vtxo) => extendVirtualCoinForContract(chunkE7HB3GKK_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
9068
9153
  );
9069
9154
  }
9070
9155
  buildContractsDbFilter(filter) {
@@ -9145,7 +9230,7 @@ var ContractManager = class _ContractManager {
9145
9230
  const { contractScript, collaborative = true, walletPubKey, vtxo } = options;
9146
9231
  const [contract] = await this.getContracts({ script: contractScript });
9147
9232
  if (!contract) return [];
9148
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(contract.type);
9233
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(contract.type);
9149
9234
  if (!handler) return [];
9150
9235
  const script = handler.createScript(contract.params);
9151
9236
  const context = {
@@ -9165,7 +9250,7 @@ var ContractManager = class _ContractManager {
9165
9250
  const { contractScript, collaborative = true, walletPubKey } = options;
9166
9251
  const [contract] = await this.getContracts({ script: contractScript });
9167
9252
  if (!contract) return [];
9168
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(contract.type);
9253
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(contract.type);
9169
9254
  if (!handler) return [];
9170
9255
  const script = handler.createScript(contract.params);
9171
9256
  const context = {
@@ -9233,7 +9318,7 @@ var ContractManager = class _ContractManager {
9233
9318
  }
9234
9319
  async refreshOutpoints(outpoints) {
9235
9320
  if (outpoints.length === 0) return;
9236
- const { vtxos } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.config.indexerProvider, {
9321
+ const { vtxos } = await chunkE7HB3GKK_cjs.getNormalizedVtxos(this.config.indexerProvider, {
9237
9322
  outpoints
9238
9323
  });
9239
9324
  if (vtxos.length === 0) return;
@@ -9359,12 +9444,12 @@ var ContractManager = class _ContractManager {
9359
9444
  * window (e.g. a spend that hasn't settled yet).
9360
9445
  */
9361
9446
  async reconcilePendingFrontier(contracts) {
9362
- const scripts = contracts.map((c) => c.script);
9363
9447
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
9364
- const { vtxos } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.config.indexerProvider, {
9365
- scripts,
9366
- pendingOnly: true
9367
- });
9448
+ const vtxos = await chunkE7HB3GKK_cjs.getAllNormalizedVtxos(
9449
+ this.config.indexerProvider,
9450
+ contracts.map((c) => c.script),
9451
+ { pendingOnly: true }
9452
+ );
9368
9453
  const owned = vtxos.filter((v) => scriptToContract.has(v.script));
9369
9454
  const annotated = await this.annotateVtxos(owned);
9370
9455
  const byContract = /* @__PURE__ */ new Map();
@@ -9432,7 +9517,7 @@ var ContractManager = class _ContractManager {
9432
9517
  }
9433
9518
  return result;
9434
9519
  }
9435
- async fetchContractVtxosBulk(contracts, pageSize = chunk5XMVTK5S_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
9520
+ async fetchContractVtxosBulk(contracts, pageSize = chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
9436
9521
  if (contracts.length === 0) {
9437
9522
  return /* @__PURE__ */ new Map();
9438
9523
  }
@@ -9440,7 +9525,6 @@ var ContractManager = class _ContractManager {
9440
9525
  const result = new Map(
9441
9526
  contracts.map((c) => [c.script, []])
9442
9527
  );
9443
- const scripts = contracts.map((c) => c.script);
9444
9528
  const windowOpts = syncWindow ? {
9445
9529
  ...syncWindow.after !== void 0 && {
9446
9530
  after: syncWindow.after
@@ -9449,26 +9533,18 @@ var ContractManager = class _ContractManager {
9449
9533
  before: syncWindow.before
9450
9534
  }
9451
9535
  } : {};
9452
- let pageIndex = 0;
9453
- let hasMore = true;
9454
- while (hasMore) {
9455
- const { vtxos, page } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.config.indexerProvider, {
9456
- scripts,
9457
- ...windowOpts,
9458
- pageIndex,
9459
- pageSize
9536
+ const vtxos = await chunkE7HB3GKK_cjs.getAllNormalizedVtxos(
9537
+ this.config.indexerProvider,
9538
+ contracts.map((c) => c.script),
9539
+ { ...windowOpts, pageSize }
9540
+ );
9541
+ const owned = vtxos.filter((v) => scriptToContract.has(v.script));
9542
+ const annotated = await this.annotateVtxos(owned);
9543
+ for (const vtxo of annotated) {
9544
+ result.get(vtxo.script).push({
9545
+ ...vtxo,
9546
+ contractScript: vtxo.script
9460
9547
  });
9461
- const owned = vtxos.filter((v) => scriptToContract.has(v.script));
9462
- const annotated = await this.annotateVtxos(owned);
9463
- for (const vtxo of annotated) {
9464
- result.get(vtxo.script).push({
9465
- ...vtxo,
9466
- contractScript: vtxo.script
9467
- });
9468
- }
9469
- hasMore = page ? vtxos.length === pageSize : false;
9470
- pageIndex++;
9471
- if (hasMore) await new Promise((r) => setTimeout(r, 500));
9472
9548
  }
9473
9549
  return result;
9474
9550
  }
@@ -9610,7 +9686,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
9610
9686
  */
9611
9687
  materializeDescriptorAt(index) {
9612
9688
  const descriptor = this.identity.descriptor;
9613
- const network = chunk5XMVTK5S_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
9689
+ const network = chunkLJQ2VQBE_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
9614
9690
  const expansion = descriptorsScure.expand({ descriptor, network, index });
9615
9691
  const keyInfo = expansion.expansionMap?.["@0"];
9616
9692
  if (!keyInfo?.keyExpression) {
@@ -9754,7 +9830,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
9754
9830
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
9755
9831
  if (!provider) return void 0;
9756
9832
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
9757
- const expectedContractType = setup.offchainTapscript instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script ? "delegate" : "default";
9833
+ const expectedContractType = setup.offchainTapscript instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script ? "delegate" : "default";
9758
9834
  const factoryOpts = {
9759
9835
  walletRepository: setup.walletRepository,
9760
9836
  contractRepository: setup.contractRepository,
@@ -9937,7 +10013,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
9937
10013
  const newAddress = newTapscript.address(wallet.network.hrp, wallet.arkServerPublicKey).encode();
9938
10014
  const manager = await wallet.getContractManager();
9939
10015
  const csvTimelock = newTapscript.options.csvTimelock;
9940
- const csvTimelockStr = chunk7TXSPRN5_cjs.timelockToSequence(csvTimelock).toString();
10016
+ const csvTimelockStr = chunkE7HB3GKK_cjs.timelockToSequence(csvTimelock).toString();
9941
10017
  const serverPubKeyHex = base.hex.encode(newTapscript.options.serverPubKey);
9942
10018
  const baseParams = {
9943
10019
  script: newScript,
@@ -9951,11 +10027,11 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
9951
10027
  // produce unsigned PSBTs that the server rejects with
9952
10028
  // `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
9953
10029
  metadata: {
9954
- source: chunk5XMVTK5S_cjs.WALLET_RECEIVE_SOURCE,
10030
+ source: chunkLJQ2VQBE_cjs.WALLET_RECEIVE_SOURCE,
9955
10031
  signingDescriptor: descriptor
9956
10032
  }
9957
10033
  };
9958
- if (newTapscript instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script) {
10034
+ if (newTapscript instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script) {
9959
10035
  await manager.createContract({
9960
10036
  ...baseParams,
9961
10037
  type: "delegate",
@@ -9987,7 +10063,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
9987
10063
  };
9988
10064
  function deriveLeafPubkey(descriptor) {
9989
10065
  try {
9990
- return chunk5XMVTK5S_cjs.deriveDescriptorLeafPubKey(descriptor);
10066
+ return chunkLJQ2VQBE_cjs.deriveDescriptorLeafPubKey(descriptor);
9991
10067
  } catch (e) {
9992
10068
  throw new NonRangeableDescriptorError(
9993
10069
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -9996,10 +10072,10 @@ function deriveLeafPubkey(descriptor) {
9996
10072
  }
9997
10073
  }
9998
10074
  function rebuildTapscript(current, pubKey) {
9999
- if (current instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script) {
10000
- return new chunk5XMVTK5S_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
10075
+ if (current instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script) {
10076
+ return new chunkLJQ2VQBE_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
10001
10077
  }
10002
- return new chunk5XMVTK5S_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
10078
+ return new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
10003
10079
  }
10004
10080
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
10005
10081
  const candidates = await contractRepository.getContracts({
@@ -10008,7 +10084,7 @@ async function pickActiveReceive(contractRepository, serverPubKey, expectedType)
10008
10084
  });
10009
10085
  const serverPubKeyHex = base.hex.encode(serverPubKey);
10010
10086
  const matching = candidates.filter(
10011
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk5XMVTK5S_cjs.WALLET_RECEIVE_SOURCE
10087
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkLJQ2VQBE_cjs.WALLET_RECEIVE_SOURCE
10012
10088
  ).sort((a, b) => {
10013
10089
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
10014
10090
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -10184,12 +10260,12 @@ var InputSignerRouter = class {
10184
10260
  };
10185
10261
 
10186
10262
  // src/wallet/wallet.ts
10187
- var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunk7TXSPRN5_cjs.DEFAULT_ARKADE_SERVER_URL;
10263
+ var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunkE7HB3GKK_cjs.DEFAULT_ARKADE_SERVER_URL;
10188
10264
  function intentProofJobs(coins) {
10189
10265
  if (coins.length === 0) return [];
10190
10266
  const coinJobs = coins.map((coin, i) => ({
10191
10267
  index: i + 1,
10192
- lookupScript: chunk7TXSPRN5_cjs.VtxoScript.decode(coin.tapTree).pkScript
10268
+ lookupScript: chunkE7HB3GKK_cjs.VtxoScript.decode(coin.tapTree).pkScript
10193
10269
  }));
10194
10270
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
10195
10271
  }
@@ -10213,7 +10289,7 @@ function dedupeTimelocks(timelocks) {
10213
10289
  const seen = /* @__PURE__ */ new Set();
10214
10290
  const deduped = [];
10215
10291
  for (const timelock of timelocks) {
10216
- const sequence = chunk7TXSPRN5_cjs.timelockToSequence(timelock).toString();
10292
+ const sequence = chunkE7HB3GKK_cjs.timelockToSequence(timelock).toString();
10217
10293
  if (seen.has(sequence)) continue;
10218
10294
  seen.add(sequence);
10219
10295
  deduped.push(timelock);
@@ -10230,7 +10306,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
10230
10306
  state: "active"
10231
10307
  });
10232
10308
  const newest = candidates.filter(
10233
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk5XMVTK5S_cjs.WALLET_RECEIVE_SOURCE
10309
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkLJQ2VQBE_cjs.WALLET_RECEIVE_SOURCE
10234
10310
  ).sort((a, b) => {
10235
10311
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
10236
10312
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -10238,7 +10314,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
10238
10314
  if (!newest?.params.pubKey) return baseline;
10239
10315
  try {
10240
10316
  const pubKey = base.hex.decode(newest.params.pubKey);
10241
- return new chunk5XMVTK5S_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
10317
+ return new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
10242
10318
  } catch (e) {
10243
10319
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
10244
10320
  return baseline;
@@ -10558,7 +10634,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
10558
10634
  */
10559
10635
  static async setupWalletConfig(config, pubKey) {
10560
10636
  const arkadeServerUrl = getArkadeServerUrl(config);
10561
- const arkProvider = config.arkProvider || new chunkEB3ALGTM_cjs.RestArkProvider(arkadeServerUrl);
10637
+ const arkProvider = config.arkProvider || new chunkQDXQULVM_cjs.RestArkProvider(arkadeServerUrl);
10562
10638
  let indexerProvider = config.indexerProvider;
10563
10639
  if (!indexerProvider) {
10564
10640
  let indexerUrl = config.indexerUrl;
@@ -10575,7 +10651,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
10575
10651
  indexerUrl = arkadeServerUrl;
10576
10652
  }
10577
10653
  }
10578
- indexerProvider = new chunkEB3ALGTM_cjs.RestIndexerProvider(indexerUrl);
10654
+ indexerProvider = new chunkQDXQULVM_cjs.RestIndexerProvider(indexerUrl);
10579
10655
  }
10580
10656
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
10581
10657
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -10584,7 +10660,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
10584
10660
  source: serverInfoSource,
10585
10661
  lastOnlineAt: serverInfoLastOnlineAt
10586
10662
  } = await resolveArkInfo(arkProvider, walletRepository);
10587
- const network = chunk7TXSPRN5_cjs.getNetwork(info.network);
10663
+ const network = chunkE7HB3GKK_cjs.getNetwork(info.network);
10588
10664
  if ("descriptor" in config.identity) {
10589
10665
  const descriptor = config.identity.descriptor;
10590
10666
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -10631,11 +10707,11 @@ var ReadonlyWallet = class _ReadonlyWallet {
10631
10707
  serverPubKey,
10632
10708
  csvTimelock: exitTimelock
10633
10709
  };
10634
- const offchainTapscript = !delegatePubKey ? new chunk5XMVTK5S_cjs.DefaultVtxo.Script(offchainOptions) : new chunk5XMVTK5S_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
10635
- const boardingTapscript = chunk5XMVTK5S_cjs.BoardingContractHandler.createScript({
10710
+ const offchainTapscript = !delegatePubKey ? new chunkLJQ2VQBE_cjs.DefaultVtxo.Script(offchainOptions) : new chunkLJQ2VQBE_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
10711
+ const boardingTapscript = chunkLJQ2VQBE_cjs.BoardingContractHandler.createScript({
10636
10712
  pubKey: base.hex.encode(pubKey),
10637
10713
  serverPubKey: base.hex.encode(serverPubKey),
10638
- csvTimelock: chunk7TXSPRN5_cjs.timelockToSequence(boardingTimelock).toString()
10714
+ csvTimelock: chunkE7HB3GKK_cjs.timelockToSequence(boardingTimelock).toString()
10639
10715
  });
10640
10716
  return {
10641
10717
  arkProvider,
@@ -10741,19 +10817,19 @@ var ReadonlyWallet = class _ReadonlyWallet {
10741
10817
  let pendingRecovery = 0;
10742
10818
  const now = { timestamp: /* @__PURE__ */ new Date() };
10743
10819
  const settled = vtxos.filter(
10744
- (coin) => chunk7TXSPRN5_cjs.canSpendOffchain(coin, now) && !coin.isPreconfirmed && !isPendingRecovery(coin)
10820
+ (coin) => chunkE7HB3GKK_cjs.canSpendOffchain(coin, now) && !coin.isPreconfirmed && !isPendingRecovery(coin)
10745
10821
  ).reduce((sum, coin) => sum + coin.value, 0);
10746
10822
  const preconfirmed = vtxos.filter(
10747
- (coin) => chunk7TXSPRN5_cjs.canSpendOffchain(coin, now) && coin.isPreconfirmed && !isPendingRecovery(coin)
10823
+ (coin) => chunkE7HB3GKK_cjs.canSpendOffchain(coin, now) && coin.isPreconfirmed && !isPendingRecovery(coin)
10748
10824
  ).reduce((sum, coin) => sum + coin.value, 0);
10749
- const available = unlockedVtxos.filter((coin) => chunk7TXSPRN5_cjs.canSpendOffchain(coin, now) && !isPendingRecovery(coin)).reduce((sum, coin) => sum + coin.value, 0);
10750
- recoverable = vtxos.filter((coin) => chunk7TXSPRN5_cjs.canRecoverOnchain(coin, now) && !isPendingRecovery(coin)).reduce((sum, coin) => sum + coin.value, 0);
10825
+ const available = unlockedVtxos.filter((coin) => chunkE7HB3GKK_cjs.canSpendOffchain(coin, now) && !isPendingRecovery(coin)).reduce((sum, coin) => sum + coin.value, 0);
10826
+ recoverable = vtxos.filter((coin) => chunkE7HB3GKK_cjs.canRecoverOnchain(coin, now) && !isPendingRecovery(coin)).reduce((sum, coin) => sum + coin.value, 0);
10751
10827
  pendingRecovery = vtxos.filter(isPendingRecovery).reduce((sum, coin) => sum + coin.value, 0);
10752
10828
  const totalBoarding = confirmed + unconfirmed;
10753
10829
  const totalOffchain = settled + preconfirmed + recoverable + pendingRecovery;
10754
10830
  const assetBalances = /* @__PURE__ */ new Map();
10755
10831
  for (const vtxo of vtxos) {
10756
- if (chunk7TXSPRN5_cjs.hasTerminalSpend(vtxo)) continue;
10832
+ if (chunkE7HB3GKK_cjs.hasTerminalSpend(vtxo)) continue;
10757
10833
  if (vtxo.assets) {
10758
10834
  for (const a of vtxo.assets) {
10759
10835
  const current = assetBalances.get(a.assetId) ?? 0n;
@@ -10794,8 +10870,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
10794
10870
  if (this._pendingSpendOutpoints.has(`${vtxo.txid}:${vtxo.vout}`)) {
10795
10871
  return false;
10796
10872
  }
10797
- if (!chunk7TXSPRN5_cjs.hasTerminalSpend(vtxo)) {
10798
- if (!f.withRecoverable && chunk7TXSPRN5_cjs.canRecoverOnchain(vtxo, now)) {
10873
+ if (!chunkE7HB3GKK_cjs.hasTerminalSpend(vtxo)) {
10874
+ if (!f.withRecoverable && chunkE7HB3GKK_cjs.canRecoverOnchain(vtxo, now)) {
10799
10875
  return false;
10800
10876
  }
10801
10877
  return true;
@@ -10828,7 +10904,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
10828
10904
  const response = await contractManager.getContractsWithVtxos();
10829
10905
  const allVtxos = response.flatMap((_) => _.vtxos);
10830
10906
  const { boardingTxs, commitmentsToIgnore } = await this.getBoardingTxs();
10831
- const getTxCreatedAt = (txid) => chunk7TXSPRN5_cjs.getNormalizedVtxos(this.indexerProvider, { outpoints: [{ txid, vout: 0 }] }).then((res) => res.vtxos[0]?.createdAt.getTime()).catch((err) => {
10907
+ const getTxCreatedAt = (txid) => chunkE7HB3GKK_cjs.getNormalizedVtxos(this.indexerProvider, { outpoints: [{ txid, vout: 0 }] }).then((res) => res.vtxos[0]?.createdAt.getTime()).catch((err) => {
10832
10908
  if (isRetryableProviderError(err)) return void 0;
10833
10909
  throw err;
10834
10910
  });
@@ -10920,7 +10996,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
10920
10996
  },
10921
10997
  isUnrolled: true,
10922
10998
  ...boardingFacts,
10923
- virtualStatus: chunk7TXSPRN5_cjs.toVirtualStatus(boardingFacts),
10999
+ virtualStatus: chunkE7HB3GKK_cjs.toVirtualStatus(boardingFacts),
10924
11000
  spentBy: "",
10925
11001
  createdAt: tx.status.confirmed ? new Date(tx.status.block_time * 1e3) : /* @__PURE__ */ new Date(0),
10926
11002
  script: scriptHex
@@ -10976,9 +11052,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
10976
11052
  async getBoardingTapscripts(allowedSigners) {
10977
11053
  const byScript = /* @__PURE__ */ new Map();
10978
11054
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
10979
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunk5XMVTK5S_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11055
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkLJQ2VQBE_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
10980
11056
  add(
10981
- new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
11057
+ new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
10982
11058
  pubKey: await this.identity.xOnlyPublicKey(),
10983
11059
  serverPubKey: this.boardingTapscript.options.serverPubKey,
10984
11060
  csvTimelock: boardingCsv
@@ -10993,7 +11069,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
10993
11069
  for (const c of boardingContracts) {
10994
11070
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
10995
11071
  try {
10996
- add(chunk5XMVTK5S_cjs.BoardingContractHandler.createScript(c.params));
11072
+ add(chunkLJQ2VQBE_cjs.BoardingContractHandler.createScript(c.params));
10997
11073
  } catch (e) {
10998
11074
  console.warn("Skipping malformed boarding contract", c.script, e);
10999
11075
  }
@@ -11031,7 +11107,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
11031
11107
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
11032
11108
  // not the wallet's current boarding timelock, which a signer
11033
11109
  // rotation may have changed.
11034
- csvTimelock: chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
11110
+ csvTimelock: chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
11035
11111
  coins: utxos
11036
11112
  });
11037
11113
  }
@@ -11164,9 +11240,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
11164
11240
  /** Fetch Arkade transaction ids that are still pending final settlement. */
11165
11241
  async fetchPendingTxs() {
11166
11242
  const scripts = await this.getWalletScripts();
11167
- let { vtxos } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.indexerProvider, {
11168
- scripts
11169
- });
11243
+ const vtxos = await chunkE7HB3GKK_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
11170
11244
  return vtxos.filter(
11171
11245
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
11172
11246
  ).map((_) => _.arkTxId);
@@ -11197,7 +11271,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
11197
11271
  });
11198
11272
  for (const contract of contracts) {
11199
11273
  if (map.has(contract.script)) continue;
11200
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(contract.type);
11274
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(contract.type);
11201
11275
  if (handler) {
11202
11276
  const script = handler.createScript(contract.params);
11203
11277
  map.set(contract.script, script);
@@ -11291,7 +11365,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
11291
11365
  watcherConfig: this.watcherConfig
11292
11366
  });
11293
11367
  const baselinePubkey = await this.identity.xOnlyPublicKey();
11294
- const delegatePubKey = this.offchainTapscript instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
11368
+ const delegatePubKey = this.offchainTapscript instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
11295
11369
  const baselineSigners = [
11296
11370
  this.offchainTapscript.options.serverPubKey,
11297
11371
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
@@ -11299,8 +11373,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
11299
11373
  const seenBaselineScripts = /* @__PURE__ */ new Set();
11300
11374
  for (const serverPubKey of baselineSigners) {
11301
11375
  for (const csvTimelock of this.walletContractTimelocks) {
11302
- const csvTimelockStr = chunk7TXSPRN5_cjs.timelockToSequence(csvTimelock).toString();
11303
- const defaultScript = new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
11376
+ const csvTimelockStr = chunkE7HB3GKK_cjs.timelockToSequence(csvTimelock).toString();
11377
+ const defaultScript = new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
11304
11378
  pubKey: baselinePubkey,
11305
11379
  serverPubKey,
11306
11380
  csvTimelock
@@ -11321,7 +11395,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
11321
11395
  });
11322
11396
  }
11323
11397
  if (delegatePubKey) {
11324
- const delegateScript = new chunk5XMVTK5S_cjs.DelegateVtxo.Script({
11398
+ const delegateScript = new chunkLJQ2VQBE_cjs.DelegateVtxo.Script({
11325
11399
  pubKey: baselinePubkey,
11326
11400
  serverPubKey,
11327
11401
  delegatePubKey,
@@ -11345,9 +11419,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
11345
11419
  }
11346
11420
  }
11347
11421
  }
11348
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunk5XMVTK5S_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11422
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkLJQ2VQBE_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11349
11423
  for (const serverPubKey of baselineSigners) {
11350
- const baselineBoarding = new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
11424
+ const baselineBoarding = new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
11351
11425
  pubKey: baselinePubkey,
11352
11426
  serverPubKey,
11353
11427
  csvTimelock: boardingCsvTimelock
@@ -11360,7 +11434,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
11360
11434
  params: {
11361
11435
  pubKey: base.hex.encode(baselineBoarding.options.pubKey),
11362
11436
  serverPubKey: base.hex.encode(serverPubKey),
11363
- csvTimelock: chunk7TXSPRN5_cjs.timelockToSequence(boardingCsvTimelock).toString()
11437
+ csvTimelock: chunkE7HB3GKK_cjs.timelockToSequence(boardingCsvTimelock).toString()
11364
11438
  },
11365
11439
  script: boardingScriptHex,
11366
11440
  address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
@@ -11583,25 +11657,25 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11583
11657
  return this.getBoardingAddress();
11584
11658
  }
11585
11659
  const descriptor = await provider.getNextSigningDescriptor();
11586
- const pubKey = chunk5XMVTK5S_cjs.deriveDescriptorLeafPubKey(descriptor);
11587
- const newBoarding = new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
11660
+ const pubKey = chunkLJQ2VQBE_cjs.deriveDescriptorLeafPubKey(descriptor);
11661
+ const newBoarding = new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
11588
11662
  ...this._boardingTapscript.options,
11589
11663
  pubKey
11590
11664
  });
11591
- const csvTimelock = newBoarding.options.csvTimelock ?? chunk5XMVTK5S_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11665
+ const csvTimelock = newBoarding.options.csvTimelock ?? chunkLJQ2VQBE_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11592
11666
  const manager = await this.getContractManager();
11593
11667
  await manager.createContract({
11594
11668
  type: "boarding",
11595
11669
  params: {
11596
11670
  pubKey: base.hex.encode(pubKey),
11597
11671
  serverPubKey: base.hex.encode(newBoarding.options.serverPubKey),
11598
- csvTimelock: chunk7TXSPRN5_cjs.timelockToSequence(csvTimelock).toString()
11672
+ csvTimelock: chunkE7HB3GKK_cjs.timelockToSequence(csvTimelock).toString()
11599
11673
  },
11600
11674
  script: base.hex.encode(newBoarding.pkScript),
11601
11675
  address: newBoarding.address(this.network.hrp, this.arkServerPublicKey).encode(),
11602
11676
  state: "active",
11603
11677
  metadata: {
11604
- source: chunk5XMVTK5S_cjs.WALLET_RECEIVE_SOURCE,
11678
+ source: chunkLJQ2VQBE_cjs.WALLET_RECEIVE_SOURCE,
11605
11679
  signingDescriptor: descriptor
11606
11680
  }
11607
11681
  });
@@ -11640,7 +11714,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11640
11714
  const xonly = toXOnlyPubKey(newServerPubKey);
11641
11715
  let newServerUnrollScript;
11642
11716
  try {
11643
- newServerUnrollScript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
11717
+ newServerUnrollScript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
11644
11718
  } catch (e) {
11645
11719
  throw new Error("Invalid checkpointTapscript from server");
11646
11720
  }
@@ -11668,21 +11742,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11668
11742
  const [currentBoardingRow] = await manager.getContracts({
11669
11743
  script: currentBoardingScript
11670
11744
  });
11671
- const newOffchain = this.offchainTapscript instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script ? new chunk5XMVTK5S_cjs.DelegateVtxo.Script({
11745
+ const newOffchain = this.offchainTapscript instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script ? new chunkLJQ2VQBE_cjs.DelegateVtxo.Script({
11672
11746
  ...this.offchainTapscript.options,
11673
11747
  serverPubKey: xonly
11674
- }) : new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
11748
+ }) : new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
11675
11749
  ...this.offchainTapscript.options,
11676
11750
  serverPubKey: xonly
11677
11751
  });
11678
- const newBoarding = new chunk5XMVTK5S_cjs.DefaultVtxo.Script({
11752
+ const newBoarding = new chunkLJQ2VQBE_cjs.DefaultVtxo.Script({
11679
11753
  ...this._boardingTapscript.options,
11680
11754
  serverPubKey: xonly
11681
11755
  });
11682
- const offchainCsv = chunk7TXSPRN5_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
11756
+ const offchainCsv = chunkE7HB3GKK_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
11683
11757
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
11684
11758
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
11685
- if (newOffchain instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script) {
11759
+ if (newOffchain instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script) {
11686
11760
  await manager.createContract({
11687
11761
  type: "delegate",
11688
11762
  params: {
@@ -11710,13 +11784,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11710
11784
  metadata: currentOffchainRow?.metadata
11711
11785
  });
11712
11786
  }
11713
- const boardingCsv = newBoarding.options.csvTimelock ?? chunk5XMVTK5S_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11787
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkLJQ2VQBE_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
11714
11788
  await manager.createContract({
11715
11789
  type: "boarding",
11716
11790
  params: {
11717
11791
  pubKey: base.hex.encode(newBoarding.options.pubKey),
11718
11792
  serverPubKey: base.hex.encode(xonly),
11719
- csvTimelock: chunk7TXSPRN5_cjs.timelockToSequence(boardingCsv).toString()
11793
+ csvTimelock: chunkE7HB3GKK_cjs.timelockToSequence(boardingCsv).toString()
11720
11794
  },
11721
11795
  script: base.hex.encode(newBoarding.pkScript),
11722
11796
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -11744,14 +11818,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11744
11818
  _restoreInFlight;
11745
11819
  _addPendingSpends(inputs) {
11746
11820
  for (const input of inputs) {
11747
- if (chunk7TXSPRN5_cjs.isVirtualCoin(input)) {
11821
+ if (chunkE7HB3GKK_cjs.isVirtualCoin(input)) {
11748
11822
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
11749
11823
  }
11750
11824
  }
11751
11825
  }
11752
11826
  _removePendingSpends(inputs) {
11753
11827
  for (const input of inputs) {
11754
- if (chunk7TXSPRN5_cjs.isVirtualCoin(input)) {
11828
+ if (chunkE7HB3GKK_cjs.isVirtualCoin(input)) {
11755
11829
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
11756
11830
  }
11757
11831
  }
@@ -11811,7 +11885,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11811
11885
  const hd = provider instanceof HDDescriptorProvider;
11812
11886
  const staticDescriptor = hd ? void 0 : `tr(${base.hex.encode(await this.identity.xOnlyPublicKey())})`;
11813
11887
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
11814
- const delegatePubKey = this.offchainTapscript instanceof chunk5XMVTK5S_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
11888
+ const delegatePubKey = this.offchainTapscript instanceof chunkLJQ2VQBE_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
11815
11889
  const arkInfo = await this.arkProvider.getInfo();
11816
11890
  const currentSignerPubKey = toXOnlyPubKey(base.hex.decode(arkInfo.signerPubkey));
11817
11891
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
@@ -11830,7 +11904,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11830
11904
  csvTimelocks: this.walletContractTimelocks,
11831
11905
  // Boarding-exit CSV so the boarding handler can build its
11832
11906
  // candidate script (distinct from the unilateral-exit matrix).
11833
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunk5XMVTK5S_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
11907
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkLJQ2VQBE_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
11834
11908
  delegatePubKey
11835
11909
  };
11836
11910
  const result = await manager.scanContracts({
@@ -11842,7 +11916,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11842
11916
  if (hd && result.highestConfirmedUsedIndex >= 0) {
11843
11917
  await provider.advanceLastIndexUsed(result.highestConfirmedUsedIndex);
11844
11918
  }
11845
- await manager.refreshVtxos({ includeInactive: true });
11919
+ await manager.refreshVtxos({ includeInactive: true, after: 0 });
11846
11920
  const causes = result.handlerErrors.map(
11847
11921
  (e) => e.error instanceof Error ? e.error : new Error(String(e.error))
11848
11922
  );
@@ -11941,7 +12015,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
11941
12015
  let serverUnrollScript;
11942
12016
  try {
11943
12017
  const raw = base.hex.decode(setup.info.checkpointTapscript);
11944
- serverUnrollScript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(raw);
12018
+ serverUnrollScript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(raw);
11945
12019
  } catch (e) {
11946
12020
  throw new Error("Invalid checkpointTapscript from server");
11947
12021
  }
@@ -12078,7 +12152,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12078
12152
  inputs: params.selectedVtxos,
12079
12153
  changeAmount: BigInt(changeAmount)
12080
12154
  };
12081
- const outputAddress = chunk7TXSPRN5_cjs.ArkAddress.decode(params.address);
12155
+ const outputAddress = chunkE7HB3GKK_cjs.ArkAddress.decode(params.address);
12082
12156
  const outputScript = BigInt(params.amount) < this.dustAmount ? outputAddress.subdustPkScript : outputAddress.pkScript;
12083
12157
  const outputs = [
12084
12158
  {
@@ -12131,13 +12205,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12131
12205
  }
12132
12206
  }
12133
12207
  const offchainAddress = await this.getAddress();
12134
- const offchainPkScript = chunk7TXSPRN5_cjs.ArkAddress.decode(offchainAddress).pkScript;
12208
+ const offchainPkScript = chunkE7HB3GKK_cjs.ArkAddress.decode(offchainAddress).pkScript;
12135
12209
  const offchainOutputScript = base.hex.encode(offchainPkScript);
12136
12210
  if (!params) {
12137
12211
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
12138
12212
  const estimator = new Estimator(fees.intentFee);
12139
12213
  let amount = 0;
12140
- const exitScript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(
12214
+ const exitScript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(
12141
12215
  base.hex.decode(this.boardingTapscript.exitScript)
12142
12216
  );
12143
12217
  const boardingTimelock = exitScript.params.timelock;
@@ -12166,7 +12240,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12166
12240
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
12167
12241
  break;
12168
12242
  }
12169
- const inputFee = estimator.evalOffchainInput(chunk7TXSPRN5_cjs.toOffchainInputFeeParams(vtxo));
12243
+ const inputFee = estimator.evalOffchainInput(chunkE7HB3GKK_cjs.toOffchainInputFeeParams(vtxo));
12170
12244
  if (inputFee.satoshis >= vtxo.value) {
12171
12245
  continue;
12172
12246
  }
@@ -12211,7 +12285,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12211
12285
  for (const [index, output] of params.outputs.entries()) {
12212
12286
  let script;
12213
12287
  try {
12214
- const addr = chunk7TXSPRN5_cjs.ArkAddress.decode(output.address);
12288
+ const addr = chunkE7HB3GKK_cjs.ArkAddress.decode(output.address);
12215
12289
  script = addr.pkScript;
12216
12290
  hasOffchainOutputs = true;
12217
12291
  } catch {
@@ -12397,7 +12471,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12397
12471
  async maybeRotateBoardingAfterBoard(inputs) {
12398
12472
  if (!this._descriptorProvider) return;
12399
12473
  const consumedBoarding = inputs.some(
12400
- (input) => typeof input !== "string" && !chunk7TXSPRN5_cjs.isVirtualCoin(input)
12474
+ (input) => typeof input !== "string" && !chunkE7HB3GKK_cjs.isVirtualCoin(input)
12401
12475
  );
12402
12476
  if (!consumedBoarding) return;
12403
12477
  try {
@@ -12413,7 +12487,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12413
12487
  let connectorIndex = 0;
12414
12488
  const connectorsLeaves = connectorsGraph?.leaves() || [];
12415
12489
  for (const input of inputs) {
12416
- if (!chunk7TXSPRN5_cjs.isVirtualCoin(input)) {
12490
+ if (!chunkE7HB3GKK_cjs.isVirtualCoin(input)) {
12417
12491
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
12418
12492
  const settlementInput = settlementPsbt.getInput(i);
12419
12493
  if (!settlementInput.txid || settlementInput.index === void 0) {
@@ -12444,7 +12518,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12444
12518
  }
12445
12519
  continue;
12446
12520
  }
12447
- if (chunk7TXSPRN5_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
12521
+ if (chunkE7HB3GKK_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
12448
12522
  continue;
12449
12523
  }
12450
12524
  if (connectorsLeaves.length === 0) {
@@ -12472,7 +12546,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12472
12546
  index: input.vout,
12473
12547
  witnessUtxo: {
12474
12548
  amount: BigInt(input.value),
12475
- script: chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).pkScript
12549
+ script: chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).pkScript
12476
12550
  },
12477
12551
  sighashType: btcSigner.SigHash.DEFAULT,
12478
12552
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -12491,7 +12565,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12491
12565
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
12492
12566
  {
12493
12567
  index: 0,
12494
- lookupScript: chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).pkScript
12568
+ lookupScript: chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).pkScript
12495
12569
  }
12496
12570
  ]);
12497
12571
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -12549,7 +12623,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12549
12623
  if (skip) {
12550
12624
  return { skip };
12551
12625
  }
12552
- const sweepTapscript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.encode({
12626
+ const sweepTapscript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.encode({
12553
12627
  timelock: {
12554
12628
  value: event.batchExpiry,
12555
12629
  type: event.batchExpiry >= 512n ? "seconds" : "blocks"
@@ -12655,9 +12729,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12655
12729
  ...existing ?? {},
12656
12730
  intentTxId,
12657
12731
  registerProof: intent.proof,
12658
- registerProofMessage: chunkEB3ALGTM_cjs.Intent.encodeMessage(intent.message),
12732
+ registerProofMessage: chunkQDXQULVM_cjs.Intent.encodeMessage(intent.message),
12659
12733
  deleteProof: deleteIntent.proof,
12660
- deleteProofMessage: chunkEB3ALGTM_cjs.Intent.encodeMessage(deleteIntent.message),
12734
+ deleteProofMessage: chunkQDXQULVM_cjs.Intent.encodeMessage(deleteIntent.message),
12661
12735
  intentVtxos: inputs.map((i) => ({
12662
12736
  txid: i.txid,
12663
12737
  vout: i.vout
@@ -12689,7 +12763,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12689
12763
  try {
12690
12764
  return await this.arkProvider.registerIntent(intent);
12691
12765
  } catch (error) {
12692
- if (error instanceof chunkEB3ALGTM_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
12766
+ if (error instanceof chunkQDXQULVM_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
12693
12767
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
12694
12768
  await this.arkProvider.deleteIntent(deleteIntent);
12695
12769
  return this.arkProvider.registerIntent(intent);
@@ -12705,7 +12779,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12705
12779
  expire_at: 0,
12706
12780
  cosigners_public_keys: cosignerPubKeys
12707
12781
  };
12708
- const proof = chunkEB3ALGTM_cjs.Intent.create(message, coins, outputs);
12782
+ const proof = chunkQDXQULVM_cjs.Intent.create(message, coins, outputs);
12709
12783
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
12710
12784
  return {
12711
12785
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -12717,7 +12791,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12717
12791
  type: "delete",
12718
12792
  expire_at: 0
12719
12793
  };
12720
- const proof = chunkEB3ALGTM_cjs.Intent.create(message, coins, []);
12794
+ const proof = chunkQDXQULVM_cjs.Intent.create(message, coins, []);
12721
12795
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
12722
12796
  return {
12723
12797
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -12729,7 +12803,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12729
12803
  type: "get-pending-tx",
12730
12804
  expire_at: 0
12731
12805
  };
12732
- const proof = chunkEB3ALGTM_cjs.Intent.create(message, coins, []);
12806
+ const proof = chunkQDXQULVM_cjs.Intent.create(message, coins, []);
12733
12807
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
12734
12808
  return {
12735
12809
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -12750,10 +12824,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12750
12824
  if (!vtxos || vtxos.length === 0) {
12751
12825
  const scriptMap = await this.getScriptMap();
12752
12826
  const allExtended = [];
12753
- const allScripts = [...scriptMap.keys()];
12754
- const { vtxos: fetchedVtxos } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.indexerProvider, {
12755
- scripts: allScripts
12756
- });
12827
+ const fetchedVtxos = await chunkE7HB3GKK_cjs.getAllNormalizedVtxos(this.indexerProvider, [
12828
+ ...scriptMap.keys()
12829
+ ]);
12757
12830
  for (const vtxo of fetchedVtxos) {
12758
12831
  const vtxoScript = scriptMap.get(vtxo.script);
12759
12832
  if (!vtxoScript) continue;
@@ -12923,7 +12996,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12923
12996
  if (vtxos.length === 0) {
12924
12997
  throw new Error("No VTXOs found for this arkadeCash");
12925
12998
  }
12926
- const myPkScript = chunk7TXSPRN5_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
12999
+ const myPkScript = chunkE7HB3GKK_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
12927
13000
  let { spendable, unclaimed } = this.classifyCashVtxos(vtxos);
12928
13001
  let swept = 0;
12929
13002
  const drainable = vtxos.filter((vtxo) => !isSubdust(vtxo, this.dustAmount));
@@ -12950,7 +13023,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12950
13023
  }
12951
13024
  if (spendable.length > 0) {
12952
13025
  const info = await this.arkProvider.getInfo();
12953
- const serverUnrollScript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(
13026
+ const serverUnrollScript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(
12954
13027
  base.hex.decode(info.checkpointTapscript)
12955
13028
  );
12956
13029
  for (const vtxo of spendable) {
@@ -12996,7 +13069,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
12996
13069
  const spendable = [];
12997
13070
  const unclaimed = [];
12998
13071
  for (const vtxo of vtxos) {
12999
- if (chunk7TXSPRN5_cjs.hasTerminalSpend(vtxo)) {
13072
+ if (chunkE7HB3GKK_cjs.hasTerminalSpend(vtxo)) {
13000
13073
  unclaimed.push(cashReport(vtxo, "already-spent"));
13001
13074
  } else if (isSubdust(vtxo, this.dustAmount)) {
13002
13075
  unclaimed.push(cashReport(vtxo, "subdust"));
@@ -13016,7 +13089,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13016
13089
  const all = [];
13017
13090
  const seen = /* @__PURE__ */ new Set();
13018
13091
  for (let pageIndex = 0; ; pageIndex++) {
13019
- const { vtxos, page } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.indexerProvider, {
13092
+ const { vtxos, page } = await chunkE7HB3GKK_cjs.getNormalizedVtxos(this.indexerProvider, {
13020
13093
  scripts,
13021
13094
  pageIndex,
13022
13095
  pageSize
@@ -13063,7 +13136,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13063
13136
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
13064
13137
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
13065
13138
  const message = { type: "get-pending-tx", expire_at: 0 };
13066
- const proof = chunkEB3ALGTM_cjs.Intent.create(message, batch, []);
13139
+ const proof = chunkQDXQULVM_cjs.Intent.create(message, batch, []);
13067
13140
  const signedProof = await identity.sign(
13068
13141
  proof,
13069
13142
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -13358,10 +13431,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13358
13431
  const serverPubKey = this.arkServerPublicKey;
13359
13432
  const serverUnrollScript = this.serverUnrollScript;
13360
13433
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
13361
- const normalizedInputs = inputs.map(chunk7TXSPRN5_cjs.normalizeVtxo);
13362
- const at = now ?? await chunk7TXSPRN5_cjs.resolveTimeHeight(this.onchainProvider);
13434
+ const normalizedInputs = inputs.map(chunkE7HB3GKK_cjs.normalizeVtxo);
13435
+ const at = now ?? await chunkE7HB3GKK_cjs.resolveTimeHeight(this.onchainProvider);
13363
13436
  for (const input of normalizedInputs) {
13364
- if (!chunk7TXSPRN5_cjs.canSpendOffchain(input, at)) {
13437
+ if (!chunkE7HB3GKK_cjs.canSpendOffchain(input, at)) {
13365
13438
  throw new Error(
13366
13439
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
13367
13440
  );
@@ -13426,7 +13499,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13426
13499
  );
13427
13500
  const arkTxJobs = inputs.map((input, index) => ({
13428
13501
  index,
13429
- lookupScript: chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).pkScript
13502
+ lookupScript: chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).pkScript
13430
13503
  }));
13431
13504
  const identity = this.identity;
13432
13505
  const signer = {
@@ -13504,21 +13577,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13504
13577
  );
13505
13578
  spentVtxos.push({
13506
13579
  ...spentFacts,
13507
- virtualStatus: chunk7TXSPRN5_cjs.toVirtualStatus(spentFacts),
13580
+ virtualStatus: chunkE7HB3GKK_cjs.toVirtualStatus(spentFacts),
13508
13581
  spentBy: checkpoint.id,
13509
13582
  arkTxId: arkTxid
13510
13583
  });
13511
13584
  } else {
13512
13585
  spentVtxos.push({
13513
13586
  ...spentFacts,
13514
- virtualStatus: chunk7TXSPRN5_cjs.toVirtualStatus(spentFacts),
13587
+ virtualStatus: chunkE7HB3GKK_cjs.toVirtualStatus(spentFacts),
13515
13588
  arkTxId: arkTxid
13516
13589
  });
13517
13590
  }
13518
13591
  for (const id of vtxo.commitmentTxIds) {
13519
13592
  commitmentTxIds.add(id);
13520
13593
  }
13521
- const vtxoExpiry = chunk7TXSPRN5_cjs.toBatchExpiry(vtxo);
13594
+ const vtxoExpiry = chunkE7HB3GKK_cjs.toBatchExpiry(vtxo);
13522
13595
  if (vtxoExpiry) {
13523
13596
  batchExpiry = Math.min(batchExpiry, vtxoExpiry);
13524
13597
  }
@@ -13531,7 +13604,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13531
13604
  isSwept: false,
13532
13605
  isPreconfirmed: true,
13533
13606
  commitmentTxIds: Array.from(commitmentTxIds),
13534
- ...chunk7TXSPRN5_cjs.parseLegacyExpiry(batchExpiry)
13607
+ ...chunkE7HB3GKK_cjs.parseLegacyExpiry(batchExpiry)
13535
13608
  };
13536
13609
  changeVtxo = {
13537
13610
  txid: arkTxid,
@@ -13543,7 +13616,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13543
13616
  tapTree: offchainTapscript.encode(),
13544
13617
  value: Number(changeAmount),
13545
13618
  ...changeFacts,
13546
- virtualStatus: chunk7TXSPRN5_cjs.toVirtualStatus(changeFacts),
13619
+ virtualStatus: chunkE7HB3GKK_cjs.toVirtualStatus(changeFacts),
13547
13620
  spentBy: "",
13548
13621
  status: {
13549
13622
  confirmed: false
@@ -13612,12 +13685,12 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13612
13685
  const spentVtxos = [];
13613
13686
  const inputArkTxIds = /* @__PURE__ */ new Set();
13614
13687
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
13615
- const vtxoInputs = inputs.filter(chunk7TXSPRN5_cjs.isVirtualCoin);
13688
+ const vtxoInputs = inputs.filter(chunkE7HB3GKK_cjs.isVirtualCoin);
13616
13689
  const cm = await this.getContractManager();
13617
13690
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
13618
13691
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
13619
13692
  for (const input of inputs) {
13620
- if (chunk7TXSPRN5_cjs.isVirtualCoin(input)) {
13693
+ if (chunkE7HB3GKK_cjs.isVirtualCoin(input)) {
13621
13694
  const outpoint = `${input.txid}:${input.vout}`;
13622
13695
  const vtxo = annotatedByKey.get(outpoint);
13623
13696
  if (!vtxo) {
@@ -13629,13 +13702,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13629
13702
  const settledFacts = { ...vtxo, isSpent: true };
13630
13703
  spentVtxos.push({
13631
13704
  ...settledFacts,
13632
- virtualStatus: chunk7TXSPRN5_cjs.toVirtualStatus(settledFacts),
13705
+ virtualStatus: chunkE7HB3GKK_cjs.toVirtualStatus(settledFacts),
13633
13706
  settledBy: commitmentTxid
13634
13707
  });
13635
13708
  } else {
13636
13709
  let sourceAddress;
13637
13710
  try {
13638
- sourceAddress = chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
13711
+ sourceAddress = chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
13639
13712
  this.network
13640
13713
  );
13641
13714
  } catch {
@@ -13693,9 +13766,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13693
13766
  }
13694
13767
  };
13695
13768
  function selectVirtualCoins(coins, targetAmount) {
13696
- const sortedCoins = coins.map(chunk7TXSPRN5_cjs.normalizeVtxo).sort((a, b) => {
13697
- const expiryA = chunk7TXSPRN5_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
13698
- const expiryB = chunk7TXSPRN5_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
13769
+ const sortedCoins = coins.map(chunkE7HB3GKK_cjs.normalizeVtxo).sort((a, b) => {
13770
+ const expiryA = chunkE7HB3GKK_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
13771
+ const expiryB = chunkE7HB3GKK_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
13699
13772
  if (expiryA !== expiryB) {
13700
13773
  return expiryA - expiryB;
13701
13774
  }
@@ -13946,7 +14019,7 @@ var MessageBus = class {
13946
14019
  this.initialized = true;
13947
14020
  }
13948
14021
  async buildServices(config) {
13949
- const arkProvider = new chunkEB3ALGTM_cjs.RestArkProvider(config.arkServer.url);
14022
+ const arkProvider = new chunkQDXQULVM_cjs.RestArkProvider(config.arkServer.url);
13950
14023
  const storage = {
13951
14024
  walletRepository: this.walletRepository,
13952
14025
  contractRepository: this.contractRepository
@@ -14329,7 +14402,7 @@ var Ramps = class {
14329
14402
  }
14330
14403
  amount = amount ?? totalAmount;
14331
14404
  const offchainAddress = await this.wallet.getAddress();
14332
- const offchainAddr = chunk7TXSPRN5_cjs.ArkAddress.decode(offchainAddress);
14405
+ const offchainAddr = chunkE7HB3GKK_cjs.ArkAddress.decode(offchainAddress);
14333
14406
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
14334
14407
  const outputFee = estimator.evalOffchainOutput({
14335
14408
  amount,
@@ -14389,7 +14462,7 @@ var Ramps = class {
14389
14462
  const filteredVtxos = [];
14390
14463
  let totalAmount = 0n;
14391
14464
  for (const vtxo of vtxos) {
14392
- const inputFee = estimator.evalOffchainInput(chunk7TXSPRN5_cjs.toOffchainInputFeeParams(vtxo));
14465
+ const inputFee = estimator.evalOffchainInput(chunkE7HB3GKK_cjs.toOffchainInputFeeParams(vtxo));
14393
14466
  if (inputFee.satoshis >= vtxo.value) {
14394
14467
  continue;
14395
14468
  }
@@ -14421,7 +14494,7 @@ var Ramps = class {
14421
14494
  let destinationScript;
14422
14495
  for (const networkName of networkNames) {
14423
14496
  try {
14424
- const network = chunk7TXSPRN5_cjs.networks[networkName];
14497
+ const network = chunkE7HB3GKK_cjs.networks[networkName];
14425
14498
  const addr = btcSigner.Address(network).decode(destinationAddress);
14426
14499
  destinationScript = btcSigner.OutScript.encode(addr);
14427
14500
  break;
@@ -15106,7 +15179,7 @@ var WalletMessageHandler = class {
15106
15179
  // Wallet methods
15107
15180
  async handleInitWallet({ payload }) {
15108
15181
  const { arkServerUrl } = payload;
15109
- this.indexerProvider = new chunkEB3ALGTM_cjs.RestIndexerProvider(arkServerUrl);
15182
+ this.indexerProvider = new chunkQDXQULVM_cjs.RestIndexerProvider(arkServerUrl);
15110
15183
  await this.onWalletInitialized();
15111
15184
  }
15112
15185
  async handleGetBalance() {
@@ -15130,12 +15203,12 @@ var WalletMessageHandler = class {
15130
15203
  let recoverable = 0;
15131
15204
  let pendingRecovery = 0;
15132
15205
  for (const vtxo of allVtxos) {
15133
- if (chunk7TXSPRN5_cjs.hasTerminalSpend(vtxo)) continue;
15206
+ if (chunkE7HB3GKK_cjs.hasTerminalSpend(vtxo)) continue;
15134
15207
  if (pendingOutpoints.has(`${vtxo.txid}:${vtxo.vout}`)) {
15135
15208
  pendingRecovery += vtxo.value;
15136
- } else if (chunk7TXSPRN5_cjs.canRecoverOnchain(vtxo, now)) {
15209
+ } else if (chunkE7HB3GKK_cjs.canRecoverOnchain(vtxo, now)) {
15137
15210
  recoverable += vtxo.value;
15138
- } else if (chunk7TXSPRN5_cjs.canSpendOffchain(vtxo, now)) {
15211
+ } else if (chunkE7HB3GKK_cjs.canSpendOffchain(vtxo, now)) {
15139
15212
  if (vtxo.isPreconfirmed) {
15140
15213
  preconfirmed += vtxo.value;
15141
15214
  } else {
@@ -15147,7 +15220,7 @@ var WalletMessageHandler = class {
15147
15220
  const totalOffchain = settled + preconfirmed + recoverable + pendingRecovery;
15148
15221
  const assetBalances = /* @__PURE__ */ new Map();
15149
15222
  for (const vtxo of allVtxos) {
15150
- if (chunk7TXSPRN5_cjs.hasTerminalSpend(vtxo)) continue;
15223
+ if (chunkE7HB3GKK_cjs.hasTerminalSpend(vtxo)) continue;
15151
15224
  if (vtxo.assets) {
15152
15225
  for (const a of vtxo.assets) {
15153
15226
  const current = assetBalances.get(a.assetId) ?? 0n;
@@ -15183,7 +15256,7 @@ var WalletMessageHandler = class {
15183
15256
  */
15184
15257
  async getSpendableVtxos() {
15185
15258
  const vtxos = await this.getVtxosFromRepo();
15186
- return vtxos.filter((v) => !chunk7TXSPRN5_cjs.hasTerminalSpend(v));
15259
+ return vtxos.filter((v) => !chunkE7HB3GKK_cjs.hasTerminalSpend(v));
15187
15260
  }
15188
15261
  async onWalletInitialized() {
15189
15262
  if (!this.readonlyWallet || !this.arkProvider || !this.indexerProvider || !this.walletRepository) {
@@ -15395,10 +15468,10 @@ var WalletMessageHandler = class {
15395
15468
  if (dustAmount != null && isSubdust(v, dustAmount)) {
15396
15469
  return false;
15397
15470
  }
15398
- if (chunk7TXSPRN5_cjs.isRecoverable(v)) {
15471
+ if (chunkE7HB3GKK_cjs.isRecoverable(v)) {
15399
15472
  return false;
15400
15473
  }
15401
- if (chunk7TXSPRN5_cjs.isExpired(v)) {
15474
+ if (chunkE7HB3GKK_cjs.isExpired(v)) {
15402
15475
  return false;
15403
15476
  }
15404
15477
  return true;
@@ -15491,7 +15564,7 @@ var WalletMessageHandler = class {
15491
15564
  }));
15492
15565
  const BATCH_SIZE = 100;
15493
15566
  for (let i = 0; i < outpoints.length; i += BATCH_SIZE) {
15494
- const res = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.indexerProvider, {
15567
+ const res = await chunkE7HB3GKK_cjs.getNormalizedVtxos(this.indexerProvider, {
15495
15568
  outpoints: outpoints.slice(i, i + BATCH_SIZE)
15496
15569
  });
15497
15570
  for (const v of res.vtxos) {
@@ -16193,7 +16266,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
16193
16266
  };
16194
16267
  try {
16195
16268
  const response = await this.sendMessage(message);
16196
- return response.payload.vtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo);
16269
+ return response.payload.vtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo);
16197
16270
  } catch (error) {
16198
16271
  throw new Error(`Failed to get vtxos: ${error}`);
16199
16272
  }
@@ -16306,7 +16379,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
16306
16379
  };
16307
16380
  try {
16308
16381
  const response = await sendContractMessage(message);
16309
- return response.payload.vtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo);
16382
+ return response.payload.vtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo);
16310
16383
  } catch (e) {
16311
16384
  throw new Error("Failed to annotate vtxos");
16312
16385
  }
@@ -16751,7 +16824,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
16751
16824
  };
16752
16825
  try {
16753
16826
  const response = await wallet.sendMessage(message);
16754
- return response.payload.vtxos.map(chunk7TXSPRN5_cjs.normalizeVtxo);
16827
+ return response.payload.vtxos.map(chunkE7HB3GKK_cjs.normalizeVtxo);
16755
16828
  } catch (e) {
16756
16829
  throw new Error(`Failed to get expiring vtxos: ${e}`);
16757
16830
  }
@@ -16863,12 +16936,12 @@ var OnchainWallet = class _OnchainWallet {
16863
16936
  * @returns Configured onchain wallet
16864
16937
  * @throws Error if the configured identity cannot produce a valid x-only public key
16865
16938
  */
16866
- static async create(identity, networkName = chunk7TXSPRN5_cjs.DEFAULT_NETWORK_NAME, provider) {
16939
+ static async create(identity, networkName = chunkE7HB3GKK_cjs.DEFAULT_NETWORK_NAME, provider) {
16867
16940
  const pubkey = await identity.xOnlyPublicKey();
16868
16941
  if (!pubkey) {
16869
16942
  throw new Error("Invalid configured public key");
16870
16943
  }
16871
- const network = chunk7TXSPRN5_cjs.getNetwork(networkName);
16944
+ const network = chunkE7HB3GKK_cjs.getNetwork(networkName);
16872
16945
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
16873
16946
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
16874
16947
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -16974,7 +17047,7 @@ var OnchainWallet = class _OnchainWallet {
16974
17047
  if (!inputs) {
16975
17048
  throw new Error("Fee estimation failed");
16976
17049
  }
16977
- let tx = new chunkEB3ALGTM_cjs.Transaction();
17050
+ let tx = new chunkQDXQULVM_cjs.Transaction();
16978
17051
  for (const input of inputs) {
16979
17052
  tx.addInput({
16980
17053
  txid: input.txid,
@@ -17032,7 +17105,7 @@ var OnchainWallet = class _OnchainWallet {
17032
17105
  * @throws If the parent has no anchor, or funding cannot be selected/signed
17033
17106
  */
17034
17107
  async bumpAnchor(parentHex, feeRate) {
17035
- const parent = chunkEB3ALGTM_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
17108
+ const parent = chunkQDXQULVM_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
17036
17109
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
17037
17110
  const child = await this.buildBumpPackage(parent, feeRate, coins);
17038
17111
  return [parent.hex, child.hex];
@@ -17797,7 +17870,7 @@ exports.BIP322 = void 0;
17797
17870
  async function sign2(message, identity, network) {
17798
17871
  const xOnlyPubKey = await identity.xOnlyPublicKey();
17799
17872
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
17800
- const toSpend = chunkEB3ALGTM_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
17873
+ const toSpend = chunkQDXQULVM_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
17801
17874
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
17802
17875
  const signed = await identity.sign(toSign, [0]);
17803
17876
  signed.finalizeIdx(0);
@@ -17855,7 +17928,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
17855
17928
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
17856
17929
  return false;
17857
17930
  }
17858
- const toSpend = chunkEB3ALGTM_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
17931
+ const toSpend = chunkQDXQULVM_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
17859
17932
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
17860
17933
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
17861
17934
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -17876,7 +17949,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
17876
17949
  }
17877
17950
  const sighashType = sigWithHash[sigWithHash.length - 1];
17878
17951
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
17879
- const toSpend = chunkEB3ALGTM_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
17952
+ const toSpend = chunkQDXQULVM_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
17880
17953
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
17881
17954
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
17882
17955
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -17929,7 +18002,7 @@ function encodeCompactSize(n) {
17929
18002
  return buf;
17930
18003
  }
17931
18004
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
17932
- const tx = new chunkEB3ALGTM_cjs.Transaction({ version: 0 });
18005
+ const tx = new chunkQDXQULVM_cjs.Transaction({ version: 0 });
17933
18006
  tx.addInput({
17934
18007
  txid: toSpend.id,
17935
18008
  index: 0,
@@ -17943,12 +18016,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
17943
18016
  });
17944
18017
  tx.addOutput({
17945
18018
  amount: 0n,
17946
- script: chunkEB3ALGTM_cjs.OP_RETURN_EMPTY_PKSCRIPT
18019
+ script: chunkQDXQULVM_cjs.OP_RETURN_EMPTY_PKSCRIPT
17947
18020
  });
17948
18021
  return tx;
17949
18022
  }
17950
18023
  function craftBIP322ToSignSimple(toSpend, pkScript) {
17951
- const tx = new chunkEB3ALGTM_cjs.Transaction({ version: 0 });
18024
+ const tx = new chunkQDXQULVM_cjs.Transaction({ version: 0 });
17952
18025
  tx.addInput({
17953
18026
  txid: toSpend.id,
17954
18027
  index: 0,
@@ -17960,7 +18033,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
17960
18033
  });
17961
18034
  tx.addOutput({
17962
18035
  amount: 0n,
17963
- script: chunkEB3ALGTM_cjs.OP_RETURN_EMPTY_PKSCRIPT
18036
+ script: chunkQDXQULVM_cjs.OP_RETURN_EMPTY_PKSCRIPT
17964
18037
  });
17965
18038
  return tx;
17966
18039
  }
@@ -18091,7 +18164,7 @@ var RestEmulatorProvider = class {
18091
18164
  }
18092
18165
  };
18093
18166
  function finalizeVirtualTx(type, psbtBase64) {
18094
- const tx = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
18167
+ const tx = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
18095
18168
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
18096
18169
  const input = tx.getInput(0);
18097
18170
  if (!input) {
@@ -18118,14 +18191,14 @@ var ExitPathError = class extends Error {
18118
18191
  reason;
18119
18192
  };
18120
18193
  function delayWeight(sequence) {
18121
- const t = chunk7TXSPRN5_cjs.sequenceToTimelock(sequence);
18194
+ const t = chunkE7HB3GKK_cjs.sequenceToTimelock(sequence);
18122
18195
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
18123
18196
  }
18124
18197
  async function resolveUnilateralPath(params) {
18125
18198
  const { vtxo, scriptHex, contractRepository } = params;
18126
18199
  const contract = contractRepository ? (await contractRepository.getContracts({ script: scriptHex }))[0] : void 0;
18127
18200
  if (contract) {
18128
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(contract.type);
18201
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(contract.type);
18129
18202
  if (!handler) {
18130
18203
  throw new ExitPathError(
18131
18204
  "no-handler",
@@ -18148,12 +18221,12 @@ async function resolveUnilateralPath(params) {
18148
18221
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
18149
18222
  return { selection: paths[0], label: `${contract.type}:unilateral` };
18150
18223
  }
18151
- const decoded = chunk7TXSPRN5_cjs.VtxoScript.decode(vtxo.tapTree);
18224
+ const decoded = chunkE7HB3GKK_cjs.VtxoScript.decode(vtxo.tapTree);
18152
18225
  let best;
18153
18226
  for (const exit of decoded.exitPaths()) {
18154
18227
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
18155
18228
  if (!leaf) continue;
18156
- const sequence = chunk7TXSPRN5_cjs.timelockToSequence(exit.params.timelock);
18229
+ const sequence = chunkE7HB3GKK_cjs.timelockToSequence(exit.params.timelock);
18157
18230
  const weight = delayWeight(sequence);
18158
18231
  if (!best || weight < best.weight) {
18159
18232
  best = { selection: { leaf, sequence }, weight };
@@ -18339,14 +18412,14 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
18339
18412
  }
18340
18413
  const resolved = await resolveUnilateralPath({
18341
18414
  vtxo,
18342
- scriptHex: base.hex.encode(chunk7TXSPRN5_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
18415
+ scriptHex: base.hex.encode(chunkE7HB3GKK_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
18343
18416
  contractRepository: wallet.contractRepository,
18344
18417
  walletPubKeyHex: base.hex.encode(await wallet.identity.xOnlyPublicKey()),
18345
18418
  currentTime: Date.now()
18346
18419
  });
18347
18420
  const spendingLeaf = resolved.selection.leaf;
18348
18421
  const sequence = resolved.selection.sequence;
18349
- const timelock = chunk7TXSPRN5_cjs.sequenceToTimelock(sequence);
18422
+ const timelock = chunkE7HB3GKK_cjs.sequenceToTimelock(sequence);
18350
18423
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
18351
18424
  if (!elapsed) {
18352
18425
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -18359,7 +18432,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
18359
18432
  sequence,
18360
18433
  witnessUtxo: {
18361
18434
  amount: BigInt(vtxo.value),
18362
- script: chunk7TXSPRN5_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
18435
+ script: chunkE7HB3GKK_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
18363
18436
  },
18364
18437
  sighashType: btcSigner.SigHash.DEFAULT
18365
18438
  });
@@ -18369,7 +18442,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
18369
18442
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
18370
18443
  );
18371
18444
  }
18372
- const tx = new chunkEB3ALGTM_cjs.Transaction({ version: 2 });
18445
+ const tx = new chunkQDXQULVM_cjs.Transaction({ version: 2 });
18373
18446
  for (const input of inputs) {
18374
18447
  tx.addInput(input);
18375
18448
  }
@@ -18436,7 +18509,7 @@ async function buildSignedSweep(params) {
18436
18509
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
18437
18510
  );
18438
18511
  }
18439
- const tx = new chunkEB3ALGTM_cjs.Transaction({ version: 2 });
18512
+ const tx = new chunkQDXQULVM_cjs.Transaction({ version: 2 });
18440
18513
  tx.addInput({
18441
18514
  txid: vtxo.txid,
18442
18515
  index: vtxo.vout,
@@ -18461,7 +18534,7 @@ async function buildSignedSweep(params) {
18461
18534
  finalScriptWitness: [
18462
18535
  tapScriptSig[0][1],
18463
18536
  ...path.extraWitness,
18464
- chunk7TXSPRN5_cjs.scriptFromTapLeafScript(path.leaf),
18537
+ chunkE7HB3GKK_cjs.scriptFromTapLeafScript(path.leaf),
18465
18538
  btcSigner.TaprootControlBlock.encode(controlBlock)
18466
18539
  ]
18467
18540
  });
@@ -18491,7 +18564,7 @@ async function resolveFeeRate(opts) {
18491
18564
  }
18492
18565
  async function selectExitVtxos(opts) {
18493
18566
  if (!opts.vtxos) return opts.wallet.getVtxos();
18494
- const res = await chunk7TXSPRN5_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
18567
+ const res = await chunkE7HB3GKK_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
18495
18568
  const tapTrees = /* @__PURE__ */ new Map();
18496
18569
  const out = [];
18497
18570
  for (const vtxo of res.vtxos) {
@@ -18506,7 +18579,7 @@ async function selectExitVtxos(opts) {
18506
18579
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
18507
18580
  );
18508
18581
  }
18509
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(contract.type);
18582
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(contract.type);
18510
18583
  if (!handler) {
18511
18584
  throw new Error(`no contract handler registered for type '${contract.type}'`);
18512
18585
  }
@@ -18536,7 +18609,7 @@ async function computeExitLayout(opts, feeRate) {
18536
18609
  if (pendingNodes.length > 0) {
18537
18610
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
18538
18611
  for (const psbt of txs) {
18539
- psbts.set(chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
18612
+ psbts.set(chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
18540
18613
  }
18541
18614
  }
18542
18615
  const childVsize = Number(
@@ -18572,7 +18645,7 @@ async function computeExitLayout(opts, feeRate) {
18572
18645
  try {
18573
18646
  const resolved = await resolveUnilateralPath({
18574
18647
  vtxo,
18575
- scriptHex: base.hex.encode(chunk7TXSPRN5_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
18648
+ scriptHex: base.hex.encode(chunkE7HB3GKK_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
18576
18649
  contractRepository: wallet.contractRepository,
18577
18650
  walletPubKeyHex,
18578
18651
  currentTime: Date.now()
@@ -18591,7 +18664,7 @@ async function computeExitLayout(opts, feeRate) {
18591
18664
  });
18592
18665
  continue;
18593
18666
  }
18594
- const t = chunk7TXSPRN5_cjs.sequenceToTimelock(resolved.selection.sequence);
18667
+ const t = chunkE7HB3GKK_cjs.sequenceToTimelock(resolved.selection.sequence);
18595
18668
  const delay = { type: t.type, value: Number(t.value) };
18596
18669
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
18597
18670
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -18898,7 +18971,7 @@ async function prepare(opts) {
18898
18971
  txid: sweep.vtxo.txid,
18899
18972
  vout: sweep.vtxo.vout,
18900
18973
  value: sweep.vtxo.value,
18901
- pkScript: chunk7TXSPRN5_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
18974
+ pkScript: chunkE7HB3GKK_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
18902
18975
  },
18903
18976
  path: sweep.resolved.selection,
18904
18977
  outputAddress: opts.sweepAddress,
@@ -18983,7 +19056,7 @@ async function prepare(opts) {
18983
19056
  if (newFee <= splitterFee) break;
18984
19057
  splitterFee = newFee;
18985
19058
  }
18986
- const splitter = new chunkEB3ALGTM_cjs.Transaction({ version: 2 });
19059
+ const splitter = new chunkQDXQULVM_cjs.Transaction({ version: 2 });
18987
19060
  for (const coin of selected.inputs) {
18988
19061
  splitter.addInput({
18989
19062
  txid: coin.txid,
@@ -19126,41 +19199,41 @@ var UnilateralExit = {
19126
19199
  // src/arkade/index.ts
19127
19200
  var arkade_exports = {};
19128
19201
  chunk5BLDMQED_cjs.__export(arkade_exports, {
19129
- ARKADE_OP: () => chunk5XMVTK5S_cjs.ARKADE_OP,
19130
- ARKADE_OPCODES: () => chunk5XMVTK5S_cjs.ARKADE_OPCODES,
19131
- ARKADE_OPCODE_NAMES: () => chunk5XMVTK5S_cjs.ARKADE_OPCODE_NAMES,
19132
- ARKADE_OPCODE_VALUES: () => chunk5XMVTK5S_cjs.ARKADE_OPCODE_VALUES,
19133
- ARKADE_OPS: () => chunk5XMVTK5S_cjs.ARKADE_OPS,
19202
+ ARKADE_OP: () => chunkLJQ2VQBE_cjs.ARKADE_OP,
19203
+ ARKADE_OPCODES: () => chunkLJQ2VQBE_cjs.ARKADE_OPCODES,
19204
+ ARKADE_OPCODE_NAMES: () => chunkLJQ2VQBE_cjs.ARKADE_OPCODE_NAMES,
19205
+ ARKADE_OPCODE_VALUES: () => chunkLJQ2VQBE_cjs.ARKADE_OPCODE_VALUES,
19206
+ ARKADE_OPS: () => chunkLJQ2VQBE_cjs.ARKADE_OPS,
19134
19207
  Arkade: () => Arkade,
19135
19208
  ArkadeContract: () => ArkadeContract,
19136
- ArkadeProgramScript: () => chunk5XMVTK5S_cjs.ArkadeProgramScript,
19137
- ArkadeScript: () => chunk5XMVTK5S_cjs.ArkadeScript,
19209
+ ArkadeProgramScript: () => chunkLJQ2VQBE_cjs.ArkadeProgramScript,
19210
+ ArkadeScript: () => chunkLJQ2VQBE_cjs.ArkadeScript,
19138
19211
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
19139
- BigNum: () => chunk5XMVTK5S_cjs.bignum_exports,
19212
+ BigNum: () => chunkLJQ2VQBE_cjs.bignum_exports,
19140
19213
  OP: () => btcSigner.OP,
19141
- OPCODE_NAMES: () => chunk5XMVTK5S_cjs.OPCODE_NAMES,
19142
- OPCODE_VALUES: () => chunk5XMVTK5S_cjs.OPCODE_VALUES,
19143
- SUPPORTED_PROGRAM_VERSION: () => chunk5XMVTK5S_cjs.SUPPORTED_PROGRAM_VERSION,
19214
+ OPCODE_NAMES: () => chunkLJQ2VQBE_cjs.OPCODE_NAMES,
19215
+ OPCODE_VALUES: () => chunkLJQ2VQBE_cjs.OPCODE_VALUES,
19216
+ SUPPORTED_PROGRAM_VERSION: () => chunkLJQ2VQBE_cjs.SUPPORTED_PROGRAM_VERSION,
19144
19217
  Script: () => btcSigner.Script,
19145
- arkadeScriptHash: () => chunk5XMVTK5S_cjs.arkadeScriptHash,
19146
- arkadeWitnessHash: () => chunk5XMVTK5S_cjs.arkadeWitnessHash,
19147
- asmToBytes: () => chunk5XMVTK5S_cjs.asmToBytes,
19148
- bytesToASM: () => chunk5XMVTK5S_cjs.bytesToASM,
19149
- computeArkadeScriptPublicKey: () => chunk5XMVTK5S_cjs.computeArkadeScriptPublicKey,
19218
+ arkadeScriptHash: () => chunkLJQ2VQBE_cjs.arkadeScriptHash,
19219
+ arkadeWitnessHash: () => chunkLJQ2VQBE_cjs.arkadeWitnessHash,
19220
+ asmToBytes: () => chunkLJQ2VQBE_cjs.asmToBytes,
19221
+ bytesToASM: () => chunkLJQ2VQBE_cjs.bytesToASM,
19222
+ computeArkadeScriptPublicKey: () => chunkLJQ2VQBE_cjs.computeArkadeScriptPublicKey,
19150
19223
  createArkadeBatchHandler: () => createArkadeBatchHandler,
19151
- deserializeArkadeContractParams: () => chunk5XMVTK5S_cjs.deserializeArkadeContractParams,
19152
- fromASM: () => chunk5XMVTK5S_cjs.fromASM,
19153
- getOpcodeName: () => chunk5XMVTK5S_cjs.getOpcodeName,
19154
- getOpcodeValue: () => chunk5XMVTK5S_cjs.getOpcodeValue,
19155
- parseArtifact: () => chunk5XMVTK5S_cjs.parseArtifact,
19156
- resolveAsm: () => chunk5XMVTK5S_cjs.resolveAsm,
19157
- serializeArkadeContractParams: () => chunk5XMVTK5S_cjs.serializeArkadeContractParams,
19158
- stringifyArtifact: () => chunk5XMVTK5S_cjs.stringifyArtifact,
19159
- toASM: () => chunk5XMVTK5S_cjs.toASM,
19160
- validateProgram: () => chunk5XMVTK5S_cjs.validateProgram,
19161
- witnessRefToBytes: () => chunk5XMVTK5S_cjs.witnessRefToBytes
19224
+ deserializeArkadeContractParams: () => chunkLJQ2VQBE_cjs.deserializeArkadeContractParams,
19225
+ fromASM: () => chunkLJQ2VQBE_cjs.fromASM,
19226
+ getOpcodeName: () => chunkLJQ2VQBE_cjs.getOpcodeName,
19227
+ getOpcodeValue: () => chunkLJQ2VQBE_cjs.getOpcodeValue,
19228
+ parseArtifact: () => chunkLJQ2VQBE_cjs.parseArtifact,
19229
+ resolveAsm: () => chunkLJQ2VQBE_cjs.resolveAsm,
19230
+ serializeArkadeContractParams: () => chunkLJQ2VQBE_cjs.serializeArkadeContractParams,
19231
+ stringifyArtifact: () => chunkLJQ2VQBE_cjs.stringifyArtifact,
19232
+ toASM: () => chunkLJQ2VQBE_cjs.toASM,
19233
+ validateProgram: () => chunkLJQ2VQBE_cjs.validateProgram,
19234
+ witnessRefToBytes: () => chunkLJQ2VQBE_cjs.witnessRefToBytes
19162
19235
  });
19163
- var isVtxoCoin = (input) => chunk7TXSPRN5_cjs.isVirtualCoin(input);
19236
+ var isVtxoCoin = (input) => chunkE7HB3GKK_cjs.isVirtualCoin(input);
19164
19237
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients) {
19165
19238
  let batchId;
19166
19239
  let sweepTapTreeRoot;
@@ -19172,7 +19245,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
19172
19245
  if (!event.intentIdHashes.includes(intentIdHashStr)) return { skip: true };
19173
19246
  await arkProvider.confirmRegistration(intentId);
19174
19247
  batchId = event.id;
19175
- const sweepTapscript = chunk7TXSPRN5_cjs.CSVMultisigTapscript.encode({
19248
+ const sweepTapscript = chunkE7HB3GKK_cjs.CSVMultisigTapscript.encode({
19176
19249
  timelock: {
19177
19250
  value: event.batchExpiry,
19178
19251
  // BIP-65: values >= 512 are interpreted as seconds, below as blocks
@@ -19190,7 +19263,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
19190
19263
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
19191
19264
  return { skip: true };
19192
19265
  }
19193
- const commitmentTx = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
19266
+ const commitmentTx = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
19194
19267
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
19195
19268
  if (recipients && recipients.length > 0) {
19196
19269
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -19221,7 +19294,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
19221
19294
  if (connectorTree) {
19222
19295
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
19223
19296
  }
19224
- let commitmentPsbt = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
19297
+ let commitmentPsbt = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
19225
19298
  const signedForfeits = [];
19226
19299
  let connectorIndex = 0;
19227
19300
  const connectorLeaves = connectorTree?.leaves() || [];
@@ -19248,7 +19321,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
19248
19321
  boardingIndices.push(boardingIdx);
19249
19322
  continue;
19250
19323
  }
19251
- if (chunk7TXSPRN5_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
19324
+ if (chunkE7HB3GKK_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
19252
19325
  continue;
19253
19326
  }
19254
19327
  if (connectorIndex >= connectorLeaves.length) {
@@ -19269,7 +19342,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
19269
19342
  index: input.vout,
19270
19343
  witnessUtxo: {
19271
19344
  amount: BigInt(input.value),
19272
- script: chunk7TXSPRN5_cjs.VtxoScript.decode(input.tapTree).pkScript
19345
+ script: chunkE7HB3GKK_cjs.VtxoScript.decode(input.tapTree).pkScript
19273
19346
  },
19274
19347
  sighashType: btcSigner.SigHash.DEFAULT,
19275
19348
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -19352,7 +19425,7 @@ var Arkade = class _Arkade {
19352
19425
  static async connect(opts) {
19353
19426
  const info = await opts.arkade.getInfo();
19354
19427
  const serverKey = base.hex.decode(info.signerPubkey).slice(1);
19355
- const checkpoint = chunk7TXSPRN5_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
19428
+ const checkpoint = chunkE7HB3GKK_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
19356
19429
  let emulatorKey;
19357
19430
  if (opts.emulator) {
19358
19431
  const eInfo = await opts.emulator.getInfo();
@@ -19366,7 +19439,7 @@ var Arkade = class _Arkade {
19366
19439
  return new _Arkade({
19367
19440
  arkProvider: opts.arkade,
19368
19441
  emulator: opts.emulator,
19369
- network: opts.network ?? chunk7TXSPRN5_cjs.DEFAULT_NETWORK,
19442
+ network: opts.network ?? chunkE7HB3GKK_cjs.DEFAULT_NETWORK,
19370
19443
  serverKey,
19371
19444
  emulatorKey,
19372
19445
  checkpoint,
@@ -19387,7 +19460,7 @@ var Arkade = class _Arkade {
19387
19460
  * key respectively; explicit args always win.
19388
19461
  */
19389
19462
  contract(program, args = {}) {
19390
- const declared = (program.params ?? []).map(chunk5XMVTK5S_cjs.inputName);
19463
+ const declared = (program.params ?? []).map(chunkLJQ2VQBE_cjs.inputName);
19391
19464
  if (declared.includes("server") && args.server === void 0) {
19392
19465
  args = { ...args, server: this.serverKey };
19393
19466
  }
@@ -19407,7 +19480,7 @@ var ArkadeContract = class _ArkadeContract {
19407
19480
  userKey: client.userKey,
19408
19481
  emulatorKey: client.emulatorKey
19409
19482
  };
19410
- this.vtxoScript = new chunk5XMVTK5S_cjs.ArkadeProgramScript(program, args, this.keys);
19483
+ this.vtxoScript = new chunkLJQ2VQBE_cjs.ArkadeProgramScript(program, args, this.keys);
19411
19484
  this.tapTree = this.vtxoScript.encode();
19412
19485
  this.compiled = this.vtxoScript.compiled;
19413
19486
  }
@@ -19435,7 +19508,7 @@ var ArkadeContract = class _ArkadeContract {
19435
19508
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
19436
19509
  );
19437
19510
  }
19438
- const typed = chunk5XMVTK5S_cjs.deserializeArkadeContractParams(contract.params);
19511
+ const typed = chunkLJQ2VQBE_cjs.deserializeArkadeContractParams(contract.params);
19439
19512
  return new _ArkadeContract(client, typed.program, typed.args, {
19440
19513
  serverKey: typed.serverKey,
19441
19514
  userKey: typed.userKey,
@@ -19476,7 +19549,7 @@ var ArkadeContract = class _ArkadeContract {
19476
19549
  toContractParams() {
19477
19550
  return {
19478
19551
  type: "arkade",
19479
- params: chunk5XMVTK5S_cjs.serializeArkadeContractParams({
19552
+ params: chunkLJQ2VQBE_cjs.serializeArkadeContractParams({
19480
19553
  program: this.program,
19481
19554
  args: this.args,
19482
19555
  serverKey: this.keys.serverKey,
@@ -19521,13 +19594,13 @@ var ArkadeContract = class _ArkadeContract {
19521
19594
  const [registered] = await manager.getContracts({ script: scriptHex });
19522
19595
  if (registered) {
19523
19596
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
19524
- return (withVtxos?.vtxos ?? []).filter((v) => !chunk7TXSPRN5_cjs.hasTerminalSpend(v));
19597
+ return (withVtxos?.vtxos ?? []).filter((v) => !chunkE7HB3GKK_cjs.hasTerminalSpend(v));
19525
19598
  }
19526
19599
  }
19527
19600
  if (!this.client.indexer) {
19528
19601
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
19529
19602
  }
19530
- const { vtxos } = await chunk7TXSPRN5_cjs.getNormalizedVtxos(this.client.indexer, {
19603
+ const { vtxos } = await chunkE7HB3GKK_cjs.getNormalizedVtxos(this.client.indexer, {
19531
19604
  scripts: [scriptHex],
19532
19605
  spendableOnly: true
19533
19606
  });
@@ -19629,12 +19702,12 @@ var ArkadeTransactionBuilder = class {
19629
19702
  this.contract.client.checkpoint
19630
19703
  );
19631
19704
  if (coin.sourceTx) {
19632
- chunkEB3ALGTM_cjs.setArkPsbtField(arkTx, 0, chunkEB3ALGTM_cjs.PrevArkTxField, coin.sourceTx);
19705
+ chunkQDXQULVM_cjs.setArkPsbtField(arkTx, 0, chunkQDXQULVM_cjs.PrevArkTxField, coin.sourceTx);
19633
19706
  }
19634
19707
  const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
19635
19708
  if (condition.length > 0) {
19636
- chunkEB3ALGTM_cjs.setArkPsbtField(arkTx, 0, chunkEB3ALGTM_cjs.ConditionWitness, condition);
19637
- chunkEB3ALGTM_cjs.setArkPsbtField(checkpoints[0], 0, chunkEB3ALGTM_cjs.ConditionWitness, condition);
19709
+ chunkQDXQULVM_cjs.setArkPsbtField(arkTx, 0, chunkQDXQULVM_cjs.ConditionWitness, condition);
19710
+ chunkQDXQULVM_cjs.setArkPsbtField(checkpoints[0], 0, chunkQDXQULVM_cjs.ConditionWitness, condition);
19638
19711
  }
19639
19712
  const packets = [];
19640
19713
  if (this.assetSpecs.length > 0) {
@@ -19673,7 +19746,7 @@ var ArkadeTransactionBuilder = class {
19673
19746
  base.base64.encode(signedArk2.toPSBT()),
19674
19747
  signedCps.map((c) => base.base64.encode(c.toPSBT()))
19675
19748
  );
19676
- const txid = chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
19749
+ const txid = chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
19677
19750
  return {
19678
19751
  txid,
19679
19752
  signedArkTx: res2.signedArkTx,
@@ -19691,7 +19764,7 @@ var ArkadeTransactionBuilder = class {
19691
19764
  const finalCps = await Promise.all(
19692
19765
  res.signedCheckpointTxs.map(
19693
19766
  async (b) => base.base64.encode(
19694
- (await client.identity.sign(chunkEB3ALGTM_cjs.Transaction.fromPSBT(base.base64.decode(b)), [0])).toPSBT()
19767
+ (await client.identity.sign(chunkQDXQULVM_cjs.Transaction.fromPSBT(base.base64.decode(b)), [0])).toPSBT()
19695
19768
  )
19696
19769
  )
19697
19770
  );
@@ -19732,23 +19805,23 @@ var ArkadeTransactionBuilder = class {
19732
19805
  }
19733
19806
  buildAssetPacket() {
19734
19807
  const groups = this.assetSpecs.map((s) => {
19735
- const id = typeof s.assetId === "string" ? chunkEB3ALGTM_cjs.AssetId.fromString(s.assetId) : chunkEB3ALGTM_cjs.AssetId.fromBytes(s.assetId);
19736
- return chunkEB3ALGTM_cjs.AssetGroup.create(
19808
+ const id = typeof s.assetId === "string" ? chunkQDXQULVM_cjs.AssetId.fromString(s.assetId) : chunkQDXQULVM_cjs.AssetId.fromBytes(s.assetId);
19809
+ return chunkQDXQULVM_cjs.AssetGroup.create(
19737
19810
  id,
19738
19811
  null,
19739
- s.inputs.map((i) => chunkEB3ALGTM_cjs.AssetInput.create(i.vin, i.amount)),
19740
- s.outputs.map((o) => chunkEB3ALGTM_cjs.AssetOutput.create(o.vout, o.amount)),
19741
- (s.metadata ?? []).map((m) => chunkEB3ALGTM_cjs.Metadata.create(m.key, m.value))
19812
+ s.inputs.map((i) => chunkQDXQULVM_cjs.AssetInput.create(i.vin, i.amount)),
19813
+ s.outputs.map((o) => chunkQDXQULVM_cjs.AssetOutput.create(o.vout, o.amount)),
19814
+ (s.metadata ?? []).map((m) => chunkQDXQULVM_cjs.Metadata.create(m.key, m.value))
19742
19815
  );
19743
19816
  });
19744
- return chunkEB3ALGTM_cjs.Packet.create(groups);
19817
+ return chunkQDXQULVM_cjs.Packet.create(groups);
19745
19818
  }
19746
19819
  witnessBytes(ref) {
19747
- return chunk5XMVTK5S_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
19820
+ return chunkLJQ2VQBE_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
19748
19821
  }
19749
19822
  };
19750
19823
  function bindInputs(fn, callArgs) {
19751
- const names = (fn.def.inputs ?? []).map(chunk5XMVTK5S_cjs.inputName);
19824
+ const names = (fn.def.inputs ?? []).map(chunkLJQ2VQBE_cjs.inputName);
19752
19825
  if (callArgs.length !== names.length) {
19753
19826
  throw new Error(`${fn.name}: expected ${names.length} argument(s), got ${callArgs.length}`);
19754
19827
  }
@@ -19801,7 +19874,7 @@ function decodeArkContract(encoded) {
19801
19874
  }
19802
19875
  function contractFromArkContract(encoded, options = {}) {
19803
19876
  const parsed = decodeArkContract(encoded);
19804
- const handler = chunk5XMVTK5S_cjs.contractHandlers.get(parsed.type);
19877
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.get(parsed.type);
19805
19878
  if (!handler) {
19806
19879
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
19807
19880
  }
@@ -19815,9 +19888,9 @@ function contractFromArkContract(encoded, options = {}) {
19815
19888
  metadata: options.metadata
19816
19889
  };
19817
19890
  }
19818
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunk7TXSPRN5_cjs.DEFAULT_NETWORK.hrp, options = {}) {
19891
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkE7HB3GKK_cjs.DEFAULT_NETWORK.hrp, options = {}) {
19819
19892
  const parsed = decodeArkContract(encoded);
19820
- const handler = chunk5XMVTK5S_cjs.contractHandlers.getOrThrow(parsed.type);
19893
+ const handler = chunkLJQ2VQBE_cjs.contractHandlers.getOrThrow(parsed.type);
19821
19894
  const params = parsed.data;
19822
19895
  const vtxoScript = handler.createScript(params);
19823
19896
  return {
@@ -19964,5 +20037,5 @@ exports.validateVtxoTxGraph = validateVtxoTxGraph;
19964
20037
  exports.verifyTapscriptSignatures = verifyTapscriptSignatures;
19965
20038
  exports.waitForIncomingFunds = waitForIncomingFunds;
19966
20039
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
19967
- //# sourceMappingURL=chunk-ENZ4YPR2.cjs.map
19968
- //# sourceMappingURL=chunk-ENZ4YPR2.cjs.map
20040
+ //# sourceMappingURL=chunk-2LAJ3RTH.cjs.map
20041
+ //# sourceMappingURL=chunk-2LAJ3RTH.cjs.map