@arkade-os/sdk 0.4.65 → 0.4.66

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 (79) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +3 -6
  3. package/dist/adapters/expo.d.ts +3 -6
  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/{asyncStorageTaskQueue-Dq_UcvDx.d.ts → asyncStorageTaskQueue-B6SijMi3.d.ts} +1 -1
  8. package/dist/{asyncStorageTaskQueue-Chwe60Ce.d.cts → asyncStorageTaskQueue-BZcIN7sA.d.cts} +1 -1
  9. package/dist/{chunk-3G5V564P.js → chunk-2JZGPXU4.js} +32 -6
  10. package/dist/chunk-2JZGPXU4.js.map +1 -0
  11. package/dist/{chunk-XN55B6EP.cjs → chunk-3S3JZUEN.cjs} +46 -19
  12. package/dist/chunk-3S3JZUEN.cjs.map +1 -0
  13. package/dist/{chunk-RESN6QHP.js → chunk-55ZZ6RBL.js} +4 -4
  14. package/dist/{chunk-RESN6QHP.js.map → chunk-55ZZ6RBL.js.map} +1 -1
  15. package/dist/{chunk-GFZNEMGL.cjs → chunk-5E6IZNRG.cjs} +428 -427
  16. package/dist/chunk-5E6IZNRG.cjs.map +1 -0
  17. package/dist/{chunk-XMOIRDLF.js → chunk-CYOI4PEA.js} +14 -6
  18. package/dist/chunk-CYOI4PEA.js.map +1 -0
  19. package/dist/{chunk-5YTSQSLE.js → chunk-DSC3G6QZ.js} +32 -31
  20. package/dist/chunk-DSC3G6QZ.js.map +1 -0
  21. package/dist/{chunk-SJQM5AVB.cjs → chunk-IM6IKNSL.cjs} +17 -17
  22. package/dist/{chunk-SJQM5AVB.cjs.map → chunk-IM6IKNSL.cjs.map} +1 -1
  23. package/dist/{chunk-TFSVXMTM.js → chunk-J33ZEM3A.js} +26 -18
  24. package/dist/chunk-J33ZEM3A.js.map +1 -0
  25. package/dist/{chunk-7X744EFF.cjs → chunk-LL47QIHD.cjs} +10 -10
  26. package/dist/{chunk-7X744EFF.cjs.map → chunk-LL47QIHD.cjs.map} +1 -1
  27. package/dist/{chunk-BABJ77NG.cjs → chunk-PXPPZF5K.cjs} +59 -50
  28. package/dist/chunk-PXPPZF5K.cjs.map +1 -0
  29. package/dist/{chunk-TYTPVPKD.js → chunk-R5POS3RS.js} +4 -4
  30. package/dist/{chunk-TYTPVPKD.js.map → chunk-R5POS3RS.js.map} +1 -1
  31. package/dist/{chunk-G552MISJ.cjs → chunk-ZIRFXBKL.cjs} +26 -18
  32. package/dist/chunk-ZIRFXBKL.cjs.map +1 -0
  33. package/dist/contracts/handlers/index.cjs +9 -9
  34. package/dist/contracts/handlers/index.d.cts +3 -3
  35. package/dist/contracts/handlers/index.d.ts +3 -3
  36. package/dist/contracts/handlers/index.js +2 -2
  37. package/dist/{delegate-Dv_9OVHv.d.ts → delegate-T-vgxMYZ.d.ts} +1 -1
  38. package/dist/{delegate-BBQW61ym.d.cts → delegate-YXupcWWJ.d.cts} +1 -1
  39. package/dist/{index-fDDiA1-L.d.ts → index-D_FgwLH9.d.ts} +2 -2
  40. package/dist/{index-BtTtQFUX.d.cts → index-e7LYXk1d.d.cts} +2 -2
  41. package/dist/{index-CFOMyVMt.d.cts → index-uUE_uQPn.d.cts} +70 -33
  42. package/dist/{index-CFOMyVMt.d.ts → index-uUE_uQPn.d.ts} +70 -33
  43. package/dist/index.cjs +284 -276
  44. package/dist/index.d.cts +30 -9
  45. package/dist/index.d.ts +30 -9
  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-CIKOS2OO.d.cts → taskRunner-BOVcIH1N.d.cts} +1 -1
  56. package/dist/{taskRunner-BDzWbpct.d.ts → taskRunner-DNyD1kXG.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-C2NvHjWB.d.cts → wallet-CNibc3yJ.d.ts} +3 -3
  66. package/dist/{wallet-DJUnN939.d.ts → wallet-DJN1QgFt.d.cts} +3 -3
  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-3G5V564P.js.map +0 -1
  73. package/dist/chunk-5YTSQSLE.js.map +0 -1
  74. package/dist/chunk-BABJ77NG.cjs.map +0 -1
  75. package/dist/chunk-G552MISJ.cjs.map +0 -1
  76. package/dist/chunk-GFZNEMGL.cjs.map +0 -1
  77. package/dist/chunk-TFSVXMTM.js.map +0 -1
  78. package/dist/chunk-XMOIRDLF.js.map +0 -1
  79. package/dist/chunk-XN55B6EP.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkXN55B6EP_cjs = require('./chunk-XN55B6EP.cjs');
4
- var chunkBABJ77NG_cjs = require('./chunk-BABJ77NG.cjs');
5
- var chunkG552MISJ_cjs = require('./chunk-G552MISJ.cjs');
3
+ var chunk3S3JZUEN_cjs = require('./chunk-3S3JZUEN.cjs');
4
+ var chunkPXPPZF5K_cjs = require('./chunk-PXPPZF5K.cjs');
5
+ var chunkZIRFXBKL_cjs = require('./chunk-ZIRFXBKL.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');
@@ -188,7 +188,7 @@ var TreeSignerSession = class _TreeSignerSession {
188
188
  noncesByPubkey.set(base.hex.encode(myPublicKey.subarray(1)), myNonce);
189
189
  const tx = this.graph.find(txid);
190
190
  if (!tx) throw new Error(`missing tx for txid ${txid}`);
191
- const cosigners = chunkG552MISJ_cjs.getArkPsbtFields(tx.root, 0, chunkG552MISJ_cjs.CosignerPublicKey).map(
191
+ const cosigners = chunkZIRFXBKL_cjs.getArkPsbtFields(tx.root, 0, chunkZIRFXBKL_cjs.CosignerPublicKey).map(
192
192
  (c) => base.hex.encode(c.key.subarray(1))
193
193
  // xonly pubkey
194
194
  );
@@ -240,7 +240,7 @@ var TreeSignerSession = class _TreeSignerSession {
240
240
  if (!aggNonce) throw new Error("missing aggregate nonce");
241
241
  const prevoutAmounts = [];
242
242
  const prevoutScripts = [];
243
- const cosigners = chunkG552MISJ_cjs.getArkPsbtFields(g.root, 0, chunkG552MISJ_cjs.CosignerPublicKey).map((c) => c.key);
243
+ const cosigners = chunkZIRFXBKL_cjs.getArkPsbtFields(g.root, 0, chunkZIRFXBKL_cjs.CosignerPublicKey).map((c) => c.key);
244
244
  const { finalKey } = aggregateKeys(cosigners, true, {
245
245
  taprootTweak: this.scriptRoot
246
246
  });
@@ -431,7 +431,7 @@ var SeedIdentity = class _SeedIdentity {
431
431
  let network;
432
432
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
433
433
  descriptor = opts.descriptor;
434
- network = chunkBABJ77NG_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
434
+ network = chunkPXPPZF5K_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
435
435
  } else {
436
436
  network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
437
437
  descriptor = descriptorsScure.scriptExpressions.trBIP32({
@@ -529,7 +529,7 @@ var SeedIdentity = class _SeedIdentity {
529
529
  * `StaticDescriptorProvider` for legacy single-key wallets.
530
530
  */
531
531
  isOurs(descriptor) {
532
- return chunkBABJ77NG_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
532
+ return chunkPXPPZF5K_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
533
533
  }
534
534
  /**
535
535
  * Signs each request with the key derived from its descriptor.
@@ -578,7 +578,7 @@ var SeedIdentity = class _SeedIdentity {
578
578
  }
579
579
  // ── internal helpers ─────────────────────────────────────────────
580
580
  derivePrivateKeyForDescriptor(descriptor) {
581
- const network = chunkBABJ77NG_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
581
+ const network = chunkPXPPZF5K_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
582
582
  const expansion = descriptorsScure.expand({ descriptor, network });
583
583
  if (expansion.isRanged) {
584
584
  throw new Error(
@@ -664,7 +664,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
664
664
  */
665
665
  descriptor;
666
666
  constructor(descriptor) {
667
- const network = chunkBABJ77NG_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
667
+ const network = chunkPXPPZF5K_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
668
668
  let expansion;
669
669
  try {
670
670
  expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
@@ -714,7 +714,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
714
714
  * `StaticDescriptorProvider` for legacy single-key wallets.
715
715
  */
716
716
  isOurs(descriptor) {
717
- return chunkBABJ77NG_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
717
+ return chunkPXPPZF5K_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
718
718
  }
719
719
  };
720
720
  function serializeSeedOwnedSigningIdentity(identity) {
@@ -876,10 +876,10 @@ var DescriptorIdentity = class {
876
876
  this.base = base;
877
877
  }
878
878
  async xOnlyPublicKey() {
879
- return chunkBABJ77NG_cjs.deriveDescriptorLeafPubKey(this.descriptor);
879
+ return chunkPXPPZF5K_cjs.deriveDescriptorLeafPubKey(this.descriptor);
880
880
  }
881
881
  async compressedPublicKey() {
882
- return chunkBABJ77NG_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
882
+ return chunkPXPPZF5K_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
883
883
  }
884
884
  async sign(tx, inputIndexes) {
885
885
  const [signed] = await this.signer.signWithDescriptor([
@@ -941,12 +941,12 @@ var ForeignDescriptorError = class extends Error {
941
941
  };
942
942
  async function resolveDescriptorSigner(descriptor, identity, provider) {
943
943
  const owner = provider?.isOurs(descriptor) ? provider : isHDCapableIdentity(identity) && identity.isOurs(descriptor) ? identity : void 0;
944
- if (owner && chunkBABJ77NG_cjs.parseHDDescriptor(descriptor)) {
944
+ if (owner && chunkPXPPZF5K_cjs.parseHDDescriptor(descriptor)) {
945
945
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
946
946
  }
947
947
  let key;
948
948
  try {
949
- key = chunkBABJ77NG_cjs.deriveDescriptorLeafPubKey(descriptor);
949
+ key = chunkPXPPZF5K_cjs.deriveDescriptorLeafPubKey(descriptor);
950
950
  } catch {
951
951
  throw new ForeignDescriptorError(descriptor);
952
952
  }
@@ -1317,11 +1317,11 @@ function buildSaltedPreimageMessage(xonly, salt) {
1317
1317
  }
1318
1318
  var PREIMAGE_INDEX = 0;
1319
1319
  function isPerArtifactDescriptor(descriptor) {
1320
- return chunkBABJ77NG_cjs.parseHDDescriptor(descriptor) !== null;
1320
+ return chunkPXPPZF5K_cjs.parseHDDescriptor(descriptor) !== null;
1321
1321
  }
1322
1322
  async function provisionDescriptor(wallet) {
1323
1323
  const allocated = isHDAllocationCapable(wallet) ? await wallet.getNextSigningDescriptor() : void 0;
1324
- return allocated ?? await chunkBABJ77NG_cjs.identityDescriptor(wallet.identity);
1324
+ return allocated ?? await chunkPXPPZF5K_cjs.identityDescriptor(wallet.identity);
1325
1325
  }
1326
1326
  async function provisionRefundKey(wallet) {
1327
1327
  const descriptor = await provisionDescriptor(wallet);
@@ -1369,7 +1369,7 @@ async function contractSigner(wallet, descriptor) {
1369
1369
  const signer = isHDWalletCapable(wallet) ? await wallet.signerForDescriptor(descriptor) : wallet.identity;
1370
1370
  let expected;
1371
1371
  try {
1372
- expected = chunkBABJ77NG_cjs.deriveDescriptorLeafPubKey(descriptor);
1372
+ expected = chunkPXPPZF5K_cjs.deriveDescriptorLeafPubKey(descriptor);
1373
1373
  } catch (cause) {
1374
1374
  throw new ForeignDescriptorError(descriptor, { cause });
1375
1375
  }
@@ -1588,14 +1588,14 @@ var RestDelegateProvider = class {
1588
1588
  */
1589
1589
  async delegate(intent, forfeitTxs, options) {
1590
1590
  const url = `${this.url}/v1/delegate`;
1591
- const response = await chunkG552MISJ_cjs.baseFetch(url, {
1591
+ const response = await chunkZIRFXBKL_cjs.baseFetch(url, {
1592
1592
  method: "POST",
1593
1593
  headers: {
1594
1594
  "Content-Type": "application/json"
1595
1595
  },
1596
1596
  body: JSON.stringify({
1597
1597
  intent: {
1598
- message: chunkG552MISJ_cjs.Intent.encodeMessage(intent.message),
1598
+ message: chunkZIRFXBKL_cjs.Intent.encodeMessage(intent.message),
1599
1599
  proof: intent.proof
1600
1600
  },
1601
1601
  forfeit_txs: forfeitTxs,
@@ -1615,7 +1615,7 @@ var RestDelegateProvider = class {
1615
1615
  */
1616
1616
  async getDelegateInfo() {
1617
1617
  const url = `${this.url}/v1/delegator/info`;
1618
- const response = await chunkG552MISJ_cjs.rateGate.runHttp(url, () => chunkG552MISJ_cjs.baseFetch(url));
1618
+ const response = await chunkZIRFXBKL_cjs.rateGate.runHttp(url, () => chunkZIRFXBKL_cjs.baseFetch(url));
1619
1619
  if (!response.ok) {
1620
1620
  const errorText2 = await response.text();
1621
1621
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1642,7 +1642,7 @@ var ESPLORA_URL = {
1642
1642
  regtest: "http://localhost:3000/api"
1643
1643
  };
1644
1644
  var EsploraProvider = class {
1645
- constructor(baseUrl = ESPLORA_URL[chunkG552MISJ_cjs.DEFAULT_NETWORK_NAME], opts) {
1645
+ constructor(baseUrl = ESPLORA_URL[chunkZIRFXBKL_cjs.DEFAULT_NETWORK_NAME], opts) {
1646
1646
  this.baseUrl = baseUrl;
1647
1647
  this.pollingInterval = opts?.pollingInterval ?? 15e3;
1648
1648
  this.forcePolling = opts?.forcePolling ?? false;
@@ -1651,14 +1651,14 @@ var EsploraProvider = class {
1651
1651
  pollingInterval;
1652
1652
  forcePolling;
1653
1653
  async getCoins(address) {
1654
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1654
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1655
1655
  if (!response.ok) {
1656
1656
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1657
1657
  }
1658
1658
  return response.json();
1659
1659
  }
1660
1660
  async getFeeRate() {
1661
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1661
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1662
1662
  if (response.status === 404) {
1663
1663
  return void 0;
1664
1664
  }
@@ -1679,7 +1679,7 @@ var EsploraProvider = class {
1679
1679
  }
1680
1680
  }
1681
1681
  async getTxOutspends(txid) {
1682
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1682
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1683
1683
  if (!response.ok) {
1684
1684
  const error = await response.text();
1685
1685
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -1687,7 +1687,7 @@ var EsploraProvider = class {
1687
1687
  return response.json();
1688
1688
  }
1689
1689
  async getTransactions(address) {
1690
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1690
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1691
1691
  if (!response.ok) {
1692
1692
  const error = await response.text();
1693
1693
  throw new Error(`Failed to get transactions: ${error}`);
@@ -1695,7 +1695,7 @@ var EsploraProvider = class {
1695
1695
  return response.json();
1696
1696
  }
1697
1697
  async getTxStatus(txid) {
1698
- const txresponse = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1698
+ const txresponse = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1699
1699
  if (!txresponse.ok) {
1700
1700
  throw new Error(txresponse.statusText);
1701
1701
  }
@@ -1703,7 +1703,7 @@ var EsploraProvider = class {
1703
1703
  if (!tx.status.confirmed) {
1704
1704
  return { confirmed: false };
1705
1705
  }
1706
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1706
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1707
1707
  if (!response.ok) {
1708
1708
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
1709
1709
  }
@@ -1787,7 +1787,7 @@ var EsploraProvider = class {
1787
1787
  return stopFunc;
1788
1788
  }
1789
1789
  async getChainTip() {
1790
- const tipBlocks = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/blocks`);
1790
+ const tipBlocks = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/blocks`);
1791
1791
  if (!tipBlocks.ok) {
1792
1792
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
1793
1793
  }
@@ -1806,7 +1806,7 @@ var EsploraProvider = class {
1806
1806
  };
1807
1807
  }
1808
1808
  async broadcastPackage(parent, child) {
1809
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
1809
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
1810
1810
  method: "POST",
1811
1811
  headers: {
1812
1812
  "Content-Type": "application/json"
@@ -1820,7 +1820,7 @@ var EsploraProvider = class {
1820
1820
  return response.json();
1821
1821
  }
1822
1822
  async broadcastTx(tx) {
1823
- const response = await chunkG552MISJ_cjs.baseFetch(`${this.baseUrl}/tx`, {
1823
+ const response = await chunkZIRFXBKL_cjs.baseFetch(`${this.baseUrl}/tx`, {
1824
1824
  method: "POST",
1825
1825
  headers: {
1826
1826
  "Content-Type": "text/plain"
@@ -1982,7 +1982,7 @@ function findP2AOutput(tx) {
1982
1982
  var CHILD_DUST_AMOUNT = 546;
1983
1983
  function buildAnchorChild(params) {
1984
1984
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
1985
- const child = new chunkG552MISJ_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
1985
+ const child = new chunkZIRFXBKL_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
1986
1986
  child.addInput(findP2AOutput(parent));
1987
1987
  const estimator = TxWeightEstimator.create().addP2AInput();
1988
1988
  for (const _ of fundingCoins) {
@@ -2030,7 +2030,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
2030
2030
  );
2031
2031
  }
2032
2032
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
2033
- const tx = new chunkG552MISJ_cjs.Transaction({
2033
+ const tx = new chunkZIRFXBKL_cjs.Transaction({
2034
2034
  version: 3,
2035
2035
  lockTime: txLocktime
2036
2036
  });
@@ -2106,7 +2106,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
2106
2106
  if (previousScriptKey.length !== 32) {
2107
2107
  throw new Error(`parent output ${childIndex} has invalid script`);
2108
2108
  }
2109
- const cosigners = chunkG552MISJ_cjs.getArkPsbtFields(child.root, 0, chunkG552MISJ_cjs.CosignerPublicKey);
2109
+ const cosigners = chunkZIRFXBKL_cjs.getArkPsbtFields(child.root, 0, chunkZIRFXBKL_cjs.CosignerPublicKey);
2110
2110
  if (cosigners.length === 0) {
2111
2111
  throw ErrMissingCosignersPublicKeys;
2112
2112
  }
@@ -2164,7 +2164,7 @@ var EmulatorPacket = class _EmulatorPacket {
2164
2164
  return new _EmulatorPacket(entries);
2165
2165
  }
2166
2166
  static fromBytes(data) {
2167
- const reader = new chunkXN55B6EP_cjs.BufferReader(data);
2167
+ const reader = new chunk3S3JZUEN_cjs.BufferReader(data);
2168
2168
  const entryCount = reader.readCompactSize();
2169
2169
  const entries = [];
2170
2170
  for (let i = 0; i < entryCount; i++) {
@@ -2182,7 +2182,7 @@ var EmulatorPacket = class _EmulatorPacket {
2182
2182
  return _EmulatorPacket.PACKET_TYPE;
2183
2183
  }
2184
2184
  serialize() {
2185
- const writer = new chunkXN55B6EP_cjs.BufferWriter();
2185
+ const writer = new chunk3S3JZUEN_cjs.BufferWriter();
2186
2186
  writer.writeCompactSize(this.entries.length);
2187
2187
  for (const entry of this.entries) {
2188
2188
  writer.writeUint16LE(entry.vin);
@@ -2269,7 +2269,7 @@ var Extension = class _Extension {
2269
2269
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
2270
2270
  );
2271
2271
  }
2272
- const reader = new chunkXN55B6EP_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2272
+ const reader = new chunk3S3JZUEN_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2273
2273
  const packets = [];
2274
2274
  while (reader.remaining() > 0) {
2275
2275
  const packetType = reader.readByte();
@@ -2343,7 +2343,7 @@ var Extension = class _Extension {
2343
2343
  */
2344
2344
  getAssetPacket() {
2345
2345
  for (const p of this.packets) {
2346
- if (p instanceof chunkXN55B6EP_cjs.Packet) {
2346
+ if (p instanceof chunk3S3JZUEN_cjs.Packet) {
2347
2347
  return p;
2348
2348
  }
2349
2349
  }
@@ -2381,8 +2381,8 @@ var Extension = class _Extension {
2381
2381
  };
2382
2382
  function parsePacket(packetType, data) {
2383
2383
  switch (packetType) {
2384
- case chunkXN55B6EP_cjs.Packet.PACKET_TYPE:
2385
- return chunkXN55B6EP_cjs.Packet.fromBytes(data);
2384
+ case chunk3S3JZUEN_cjs.Packet.PACKET_TYPE:
2385
+ return chunk3S3JZUEN_cjs.Packet.fromBytes(data);
2386
2386
  case EmulatorPacket.PACKET_TYPE:
2387
2387
  return EmulatorPacket.fromBytes(data);
2388
2388
  default:
@@ -2429,16 +2429,16 @@ function buildOpReturnScript(data) {
2429
2429
  }
2430
2430
  return script;
2431
2431
  }
2432
- var ErrOffchainOutputNotFound = (address) => new chunkG552MISJ_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2433
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkG552MISJ_cjs.ServerResponseMismatchError(
2432
+ var ErrOffchainOutputNotFound = (address) => new chunkZIRFXBKL_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2433
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2434
2434
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
2435
2435
  );
2436
- var ErrAssetGroupNotFound = (assetId) => new chunkG552MISJ_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2437
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkG552MISJ_cjs.ServerResponseMismatchError(
2436
+ var ErrAssetGroupNotFound = (assetId) => new chunkZIRFXBKL_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2437
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2438
2438
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
2439
2439
  );
2440
- var ErrOnchainOutputNotFound = (address) => new chunkG552MISJ_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2441
- var ErrUnvalidatedOffchainOutput = (address) => new chunkG552MISJ_cjs.ServerResponseMismatchError(
2440
+ var ErrOnchainOutputNotFound = (address) => new chunkZIRFXBKL_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2441
+ var ErrUnvalidatedOffchainOutput = (address) => new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2442
2442
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2443
2443
  );
2444
2444
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
@@ -2447,7 +2447,7 @@ var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain ou
2447
2447
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
2448
2448
  if (!validatedCommitmentTxid) return;
2449
2449
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
2450
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2450
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2451
2451
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
2452
2452
  );
2453
2453
  }
@@ -2457,7 +2457,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
2457
2457
  for (const recipient of recipients) {
2458
2458
  let arkAddress;
2459
2459
  try {
2460
- arkAddress = chunkG552MISJ_cjs.ArkAddress.decode(recipient.address);
2460
+ arkAddress = chunkZIRFXBKL_cjs.ArkAddress.decode(recipient.address);
2461
2461
  } catch {
2462
2462
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2463
2463
  continue;
@@ -2469,7 +2469,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2469
2469
  const usedOnchainOutputs = /* @__PURE__ */ new Set();
2470
2470
  for (const recipient of recipients) {
2471
2471
  try {
2472
- chunkG552MISJ_cjs.ArkAddress.decode(recipient.address);
2472
+ chunkZIRFXBKL_cjs.ArkAddress.decode(recipient.address);
2473
2473
  } catch {
2474
2474
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2475
2475
  continue;
@@ -2702,7 +2702,7 @@ function assetMintResolver() {
2702
2702
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
2703
2703
  const minted = tx.assets.filter((a) => {
2704
2704
  try {
2705
- return base.hex.encode(chunkXN55B6EP_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2705
+ return base.hex.encode(chunk3S3JZUEN_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2706
2706
  } catch {
2707
2707
  return false;
2708
2708
  }
@@ -2745,7 +2745,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2745
2745
  const existing = inputsByAssetId.get(asset.assetId);
2746
2746
  inputsByAssetId.set(asset.assetId, [
2747
2747
  ...existing ?? [],
2748
- chunkXN55B6EP_cjs.AssetInput.create(inputIndex, asset.amount)
2748
+ chunk3S3JZUEN_cjs.AssetInput.create(inputIndex, asset.amount)
2749
2749
  ]);
2750
2750
  }
2751
2751
  }
@@ -2757,7 +2757,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2757
2757
  const existing = outputsByAssetId.get(asset.assetId);
2758
2758
  outputsByAssetId.set(asset.assetId, [
2759
2759
  ...existing ?? [],
2760
- chunkXN55B6EP_cjs.AssetOutput.create(outputIndex, asset.amount)
2760
+ chunk3S3JZUEN_cjs.AssetOutput.create(outputIndex, asset.amount)
2761
2761
  ]);
2762
2762
  }
2763
2763
  }
@@ -2768,7 +2768,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2768
2768
  const existing = outputsByAssetId.get(asset.assetId);
2769
2769
  outputsByAssetId.set(asset.assetId, [
2770
2770
  ...existing ?? [],
2771
- chunkXN55B6EP_cjs.AssetOutput.create(outputIndex, asset.amount)
2771
+ chunk3S3JZUEN_cjs.AssetOutput.create(outputIndex, asset.amount)
2772
2772
  ]);
2773
2773
  }
2774
2774
  }
@@ -2777,11 +2777,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2777
2777
  for (const assetIdStr of allAssetIds) {
2778
2778
  const inputs = inputsByAssetId.get(assetIdStr);
2779
2779
  const outputs = outputsByAssetId.get(assetIdStr);
2780
- const assetId = chunkXN55B6EP_cjs.AssetId.fromString(assetIdStr);
2781
- const group = chunkXN55B6EP_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
2780
+ const assetId = chunk3S3JZUEN_cjs.AssetId.fromString(assetIdStr);
2781
+ const group = chunk3S3JZUEN_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
2782
2782
  groups.push(group);
2783
2783
  }
2784
- return chunkXN55B6EP_cjs.Packet.create(groups);
2784
+ return chunk3S3JZUEN_cjs.Packet.create(groups);
2785
2785
  }
2786
2786
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
2787
2787
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -2818,8 +2818,7 @@ function selectedCoinsToAssetInputs(selectedCoins) {
2818
2818
  }
2819
2819
  function toXOnlySignerHex(pubkeyHex) {
2820
2820
  const bytes = base.hex.decode(pubkeyHex);
2821
- if (bytes.length === 33) return base.hex.encode(bytes.slice(1));
2822
- if (bytes.length === 32) return base.hex.encode(bytes);
2821
+ if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkPXPPZF5K_cjs.toXOnly(bytes, "signer key"));
2823
2822
  throw new Error(`invalid signer pubkey length: expected 32 or 33 bytes, got ${bytes.length}`);
2824
2823
  }
2825
2824
  function signerSetFromInfo(info) {
@@ -2866,13 +2865,13 @@ var toTimelock = (value) => ({
2866
2865
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
2867
2866
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
2868
2867
  if (policy.requireSeconds && timelock.type === "blocks") {
2869
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2868
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2870
2869
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
2871
2870
  );
2872
2871
  }
2873
2872
  const seconds = toSeconds(timelock);
2874
2873
  if (seconds < policy.minSeconds) {
2875
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2874
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2876
2875
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it`
2877
2876
  );
2878
2877
  }
@@ -2893,7 +2892,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
2893
2892
  }
2894
2893
  function assertValidBatchExpiry(batchExpiry, policy) {
2895
2894
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
2896
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2895
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2897
2896
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
2898
2897
  );
2899
2898
  }
@@ -2923,21 +2922,21 @@ function resolveCheckpointExitDelayPolicy(network, overrides) {
2923
2922
  function assertValidServerUnrollScript(checkpointTapscript, policy) {
2924
2923
  let script;
2925
2924
  try {
2926
- script = chunkG552MISJ_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
2925
+ script = chunkZIRFXBKL_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
2927
2926
  } catch (e) {
2928
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2927
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2929
2928
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
2930
2929
  );
2931
2930
  }
2932
2931
  if (policy.advertisedForfeitPubkey !== void 0) {
2933
2932
  const { pubkeys } = script.params;
2934
2933
  if (pubkeys.length !== 1) {
2935
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2934
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2936
2935
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
2937
2936
  );
2938
2937
  }
2939
2938
  if (!utils_js.equalBytes(pubkeys[0], policy.advertisedForfeitPubkey)) {
2940
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
2939
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
2941
2940
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(policy.advertisedForfeitPubkey)}`
2942
2941
  );
2943
2942
  }
@@ -2981,8 +2980,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
2981
2980
  function buildVirtualTx(inputs, outputs) {
2982
2981
  let lockTime = 0n;
2983
2982
  for (const input of inputs) {
2984
- const tapscript = chunkG552MISJ_cjs.decodeTapscript(chunkG552MISJ_cjs.scriptFromTapLeafScript(input.tapLeafScript));
2985
- if (chunkG552MISJ_cjs.CLTVMultisigTapscript.is(tapscript)) {
2983
+ const tapscript = chunkZIRFXBKL_cjs.decodeTapscript(chunkZIRFXBKL_cjs.scriptFromTapLeafScript(input.tapLeafScript));
2984
+ if (chunkZIRFXBKL_cjs.CLTVMultisigTapscript.is(tapscript)) {
2986
2985
  if (lockTime !== 0n) {
2987
2986
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
2988
2987
  throw new Error("cannot mix seconds and blocks locktime");
@@ -2993,7 +2992,7 @@ function buildVirtualTx(inputs, outputs) {
2993
2992
  }
2994
2993
  }
2995
2994
  }
2996
- const tx = new chunkG552MISJ_cjs.Transaction({
2995
+ const tx = new chunkZIRFXBKL_cjs.Transaction({
2997
2996
  version: 3,
2998
2997
  lockTime: Number(lockTime)
2999
2998
  });
@@ -3003,12 +3002,12 @@ function buildVirtualTx(inputs, outputs) {
3003
3002
  index: input.vout,
3004
3003
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
3005
3004
  witnessUtxo: {
3006
- script: chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).pkScript,
3005
+ script: chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).pkScript,
3007
3006
  amount: BigInt(input.value)
3008
3007
  },
3009
3008
  tapLeafScript: [input.tapLeafScript]
3010
3009
  });
3011
- chunkG552MISJ_cjs.setArkPsbtField(tx, i, chunkG552MISJ_cjs.VtxoTaprootTree, input.tapTree);
3010
+ chunkZIRFXBKL_cjs.setArkPsbtField(tx, i, chunkZIRFXBKL_cjs.VtxoTaprootTree, input.tapTree);
3012
3011
  }
3013
3012
  for (const output of outputs) {
3014
3013
  tx.addOutput(output);
@@ -3017,8 +3016,8 @@ function buildVirtualTx(inputs, outputs) {
3017
3016
  return tx;
3018
3017
  }
3019
3018
  function buildCheckpointTx(vtxo, serverUnrollScript) {
3020
- const collaborativeClosure = chunkG552MISJ_cjs.decodeTapscript(chunkG552MISJ_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3021
- const checkpointVtxoScript = new chunkG552MISJ_cjs.VtxoScript([
3019
+ const collaborativeClosure = chunkZIRFXBKL_cjs.decodeTapscript(chunkZIRFXBKL_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3020
+ const checkpointVtxoScript = new chunkZIRFXBKL_cjs.VtxoScript([
3022
3021
  serverUnrollScript.script,
3023
3022
  collaborativeClosure.script
3024
3023
  ]);
@@ -3171,7 +3170,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
3171
3170
  }
3172
3171
  function isValidArkAddress(address) {
3173
3172
  try {
3174
- chunkG552MISJ_cjs.ArkAddress.decode(address);
3173
+ chunkZIRFXBKL_cjs.ArkAddress.decode(address);
3175
3174
  return true;
3176
3175
  } catch (e) {
3177
3176
  return false;
@@ -3179,16 +3178,16 @@ function isValidArkAddress(address) {
3179
3178
  }
3180
3179
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3181
3180
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3182
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3181
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3183
3182
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3184
3183
  );
3185
3184
  }
3186
3185
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3187
3186
  return serverCheckpointTxs.map((encoded, index) => {
3188
- const server = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3187
+ const server = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3189
3188
  const local = byTxid.get(server.id);
3190
3189
  if (!local) {
3191
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3190
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3192
3191
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3193
3192
  );
3194
3193
  }
@@ -3198,14 +3197,14 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3198
3197
  }
3199
3198
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3200
3199
  if (response.arkTxid !== signedArkTx.id) {
3201
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3200
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3202
3201
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3203
3202
  );
3204
3203
  }
3205
3204
  if (response.finalArkTx === void 0) return;
3206
- const finalTxid = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3205
+ const finalTxid = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3207
3206
  if (finalTxid !== signedArkTx.id) {
3208
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3207
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3209
3208
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3210
3209
  );
3211
3210
  }
@@ -3224,10 +3223,10 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeyHex,
3224
3223
  [serverPubkeyHex],
3225
3224
  void 0,
3226
3225
  void 0,
3227
- payment_js.tapLeafHash(chunkG552MISJ_cjs.scriptFromTapLeafScript(leaf))
3226
+ payment_js.tapLeafHash(chunkZIRFXBKL_cjs.scriptFromTapLeafScript(leaf))
3228
3227
  );
3229
3228
  } catch (error) {
3230
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3229
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3231
3230
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
3232
3231
  );
3233
3232
  }
@@ -3236,20 +3235,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3236
3235
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
3237
3236
  for (const [index, checkpoint] of checkpoints.entries()) {
3238
3237
  if (checkpoint.inputsLength !== 1) {
3239
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3238
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3240
3239
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
3241
3240
  );
3242
3241
  }
3243
3242
  const spent = checkpoint.getInput(0);
3244
3243
  if (!spent.txid || spent.index === void 0) {
3245
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3244
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3246
3245
  `${context}: checkpoint ${index} has no input outpoint`
3247
3246
  );
3248
3247
  }
3249
3248
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
3250
3249
  const input = byOutpoint.get(outpoint);
3251
3250
  if (!input) {
3252
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3251
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3253
3252
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
3254
3253
  );
3255
3254
  }
@@ -3257,7 +3256,7 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3257
3256
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
3258
3257
  );
3259
3258
  if (!rebuilt) {
3260
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3259
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3261
3260
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
3262
3261
  );
3263
3262
  }
@@ -3284,14 +3283,12 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3284
3283
  const verify = options?.verifyServerSignatures;
3285
3284
  if (verify) {
3286
3285
  if (response.finalArkTx === void 0) {
3287
- throw new chunkG552MISJ_cjs.ServerResponseMismatchError(
3286
+ throw new chunkZIRFXBKL_cjs.ServerResponseMismatchError(
3288
3287
  "submitTx: server returned no final ark tx to verify its signatures against"
3289
3288
  );
3290
3289
  }
3291
- const finalArkTx = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3292
- const serverPubkeyHex = base.hex.encode(
3293
- verify.serverPubkey.length === 33 ? verify.serverPubkey.subarray(1) : verify.serverPubkey
3294
- );
3290
+ const finalArkTx = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3291
+ const serverPubkeyHex = base.hex.encode(chunkPXPPZF5K_cjs.toXOnly(verify.serverPubkey, "server key"));
3295
3292
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
3296
3293
  assertServerSignedLeaf(
3297
3294
  finalArkTx,
@@ -3347,12 +3344,12 @@ function claimWithPreimageIdentity(identity, preimage) {
3347
3344
  return {
3348
3345
  ...identity,
3349
3346
  sign: async (tx, inputIndexes) => {
3350
- const signed = chunkG552MISJ_cjs.Transaction.fromPSBT(
3347
+ const signed = chunkZIRFXBKL_cjs.Transaction.fromPSBT(
3351
3348
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
3352
3349
  );
3353
3350
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
3354
3351
  for (const index of indexes) {
3355
- chunkG552MISJ_cjs.setArkPsbtField(signed, index, chunkG552MISJ_cjs.ConditionWitness, [preimage]);
3352
+ chunkZIRFXBKL_cjs.setArkPsbtField(signed, index, chunkZIRFXBKL_cjs.ConditionWitness, [preimage]);
3356
3353
  }
3357
3354
  return signed;
3358
3355
  }
@@ -3544,7 +3541,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
3544
3541
  };
3545
3542
  }
3546
3543
  function deriveContractTapscripts(contract) {
3547
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
3544
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
3548
3545
  if (!handler) {
3549
3546
  throw new Error(`No handler for contract type '${contract.type}'`);
3550
3547
  }
@@ -3615,7 +3612,7 @@ function getRandomId() {
3615
3612
  }
3616
3613
  function isValidArkAddress2(address) {
3617
3614
  try {
3618
- chunkG552MISJ_cjs.ArkAddress.decode(address);
3615
+ chunkZIRFXBKL_cjs.ArkAddress.decode(address);
3619
3616
  return true;
3620
3617
  } catch (e) {
3621
3618
  return false;
@@ -3643,7 +3640,7 @@ function assertRecipientArkAddress(encoded, address, context) {
3643
3640
  function assertTapTreeDerivesAddress(encoded, tapTree, address) {
3644
3641
  let derived;
3645
3642
  try {
3646
- derived = chunkG552MISJ_cjs.VtxoScript.decode(tapTree).pkScript;
3643
+ derived = chunkZIRFXBKL_cjs.VtxoScript.decode(tapTree).pkScript;
3647
3644
  } catch (e) {
3648
3645
  throw new Error(
3649
3646
  `Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
@@ -3660,7 +3657,7 @@ function validateRecipients(recipients, dustAmount, context) {
3660
3657
  for (const recipient of recipients) {
3661
3658
  let address;
3662
3659
  try {
3663
- address = chunkG552MISJ_cjs.ArkAddress.decode(recipient.address);
3660
+ address = chunkZIRFXBKL_cjs.ArkAddress.decode(recipient.address);
3664
3661
  } catch (e) {
3665
3662
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
3666
3663
  }
@@ -3685,7 +3682,7 @@ function validateRecipients(recipients, dustAmount, context) {
3685
3682
 
3686
3683
  // src/contracts/spendability.ts
3687
3684
  function isContractGenericallySpendable(contract) {
3688
- return chunkBABJ77NG_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
3685
+ return chunkPXPPZF5K_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
3689
3686
  }
3690
3687
  function gatedContracts(contracts) {
3691
3688
  const gated = /* @__PURE__ */ new Map();
@@ -3698,7 +3695,7 @@ function gateExclusion(gated) {
3698
3695
  return (vtxo) => {
3699
3696
  const type = vtxo.script === void 0 ? void 0 : gated.get(vtxo.script);
3700
3697
  if (type === void 0) return void 0;
3701
- if (!chunkBABJ77NG_cjs.contractHandlers.has(type)) {
3698
+ if (!chunkPXPPZF5K_cjs.contractHandlers.has(type)) {
3702
3699
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
3703
3700
  }
3704
3701
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -3734,7 +3731,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
3734
3731
  continue;
3735
3732
  }
3736
3733
  for (const v of vtxos) {
3737
- if (!chunkG552MISJ_cjs.hasTerminalSpend(v) && !v.isSwept) out.add(`${v.txid}:${v.vout}`);
3734
+ if (!chunkZIRFXBKL_cjs.hasTerminalSpend(v) && !v.isSwept) out.add(`${v.txid}:${v.vout}`);
3738
3735
  }
3739
3736
  }
3740
3737
  return out;
@@ -3767,10 +3764,10 @@ function byValueDescending(vtxos) {
3767
3764
  return [...vtxos].sort((a, b) => b.value - a.value);
3768
3765
  }
3769
3766
  async function fetchTimeHeight(wallet) {
3770
- return chunkG552MISJ_cjs.resolveTimeHeight(wallet.onchainProvider);
3767
+ return chunkZIRFXBKL_cjs.resolveTimeHeight(wallet.onchainProvider);
3771
3768
  }
3772
3769
  function canMigrateBySend(vtxo, now) {
3773
- if (!chunkG552MISJ_cjs.canSpendOffchain(vtxo, now)) return false;
3770
+ if (!chunkZIRFXBKL_cjs.canSpendOffchain(vtxo, now)) return false;
3774
3771
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
3775
3772
  }
3776
3773
  function byExpiryAscending(vtxos, now) {
@@ -3778,7 +3775,7 @@ function byExpiryAscending(vtxos, now) {
3778
3775
  if (vtxo.isSwept) return -Infinity;
3779
3776
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
3780
3777
  if (vtxo.expiresAtHeight !== void 0) {
3781
- return chunkG552MISJ_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
3778
+ return chunkZIRFXBKL_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
3782
3779
  }
3783
3780
  return Infinity;
3784
3781
  };
@@ -3805,7 +3802,7 @@ function priceSettlementInputs(vtxos, estimator) {
3805
3802
  const payable = [];
3806
3803
  const net = /* @__PURE__ */ new Map();
3807
3804
  for (const vtxo of vtxos) {
3808
- const inputFee = estimator.evalOffchainInput(chunkG552MISJ_cjs.toOffchainInputFeeParams(vtxo));
3805
+ const inputFee = estimator.evalOffchainInput(chunkZIRFXBKL_cjs.toOffchainInputFeeParams(vtxo));
3809
3806
  if (inputFee.satoshis >= vtxo.value) {
3810
3807
  continue;
3811
3808
  }
@@ -3831,7 +3828,7 @@ function deductOffchainOutputFee(subtotal, estimator, arkAddress) {
3831
3828
  }
3832
3829
  const outputFee = estimator.evalOffchainOutput({
3833
3830
  amount: subtotal,
3834
- script: base.hex.encode(chunkG552MISJ_cjs.ArkAddress.decode(arkAddress).pkScript)
3831
+ script: base.hex.encode(chunkZIRFXBKL_cjs.ArkAddress.decode(arkAddress).pkScript)
3835
3832
  });
3836
3833
  return subtotal - BigInt(outputFee.satoshis);
3837
3834
  }
@@ -3849,10 +3846,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
3849
3846
  };
3850
3847
  function getRecoverableVtxos(vtxos, dustAmount, now) {
3851
3848
  return vtxos.filter((vtxo) => {
3852
- if (chunkG552MISJ_cjs.canRecoverOnchain(vtxo, now)) {
3849
+ if (chunkZIRFXBKL_cjs.canRecoverOnchain(vtxo, now)) {
3853
3850
  return true;
3854
3851
  }
3855
- if (chunkG552MISJ_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
3852
+ if (chunkZIRFXBKL_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
3856
3853
  return true;
3857
3854
  }
3858
3855
  return false;
@@ -3883,7 +3880,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
3883
3880
  }
3884
3881
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
3885
3882
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
3886
- const expiresAt = chunkG552MISJ_cjs.normalizeVtxo(vtxo).expiresAt;
3883
+ const expiresAt = chunkZIRFXBKL_cjs.normalizeVtxo(vtxo).expiresAt;
3887
3884
  if (expiresAt === void 0) return false;
3888
3885
  const now = Date.now();
3889
3886
  const batchExpiry = expiresAt.getTime();
@@ -3892,7 +3889,7 @@ function isVtxoExpiringSoon(vtxo, thresholdMs) {
3892
3889
  }
3893
3890
  function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
3894
3891
  return vtxos.filter(
3895
- (vtxo) => isVtxoExpiringSoon(vtxo, thresholdMs) || chunkG552MISJ_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount)
3892
+ (vtxo) => isVtxoExpiringSoon(vtxo, thresholdMs) || chunkZIRFXBKL_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount)
3896
3893
  );
3897
3894
  }
3898
3895
  function isMigrationCapable(wallet) {
@@ -4491,11 +4488,11 @@ var VtxoManager = class _VtxoManager {
4491
4488
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
4492
4489
  );
4493
4490
  }
4494
- const tx = new chunkG552MISJ_cjs.Transaction();
4491
+ const tx = new chunkZIRFXBKL_cjs.Transaction();
4495
4492
  for (const utxo of expiredUtxos) {
4496
- const utxoScript = chunkG552MISJ_cjs.VtxoScript.decode(utxo.tapTree);
4493
+ const utxoScript = chunkZIRFXBKL_cjs.VtxoScript.decode(utxo.tapTree);
4497
4494
  const utxoExitLeaf = utxoScript.leaves.find(
4498
- (leaf) => chunkG552MISJ_cjs.CSVMultisigTapscript.isScriptValid(chunkG552MISJ_cjs.scriptFromTapLeafScript(leaf)) === true
4495
+ (leaf) => chunkZIRFXBKL_cjs.CSVMultisigTapscript.isScriptValid(chunkZIRFXBKL_cjs.scriptFromTapLeafScript(leaf)) === true
4499
4496
  );
4500
4497
  if (!utxoExitLeaf) {
4501
4498
  throw new Error(
@@ -4510,7 +4507,7 @@ var VtxoManager = class _VtxoManager {
4510
4507
  amount: BigInt(utxo.value)
4511
4508
  },
4512
4509
  tapLeafScript: [utxoExitLeaf],
4513
- sequence: chunkG552MISJ_cjs.getSequence(utxoExitLeaf)
4510
+ sequence: chunkZIRFXBKL_cjs.getSequence(utxoExitLeaf)
4514
4511
  });
4515
4512
  }
4516
4513
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -4744,8 +4741,8 @@ var VtxoManager = class _VtxoManager {
4744
4741
  if (!serverPubKey) continue;
4745
4742
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
4746
4743
  if (cls.status === "CURRENT") continue;
4747
- const recoverable = vtxos.filter((v) => v.isSwept && !chunkG552MISJ_cjs.hasTerminalSpend(v));
4748
- const spendable = vtxos.filter((v) => !chunkG552MISJ_cjs.hasTerminalSpend(v) && !v.isSwept);
4744
+ const recoverable = vtxos.filter((v) => v.isSwept && !chunkZIRFXBKL_cjs.hasTerminalSpend(v));
4745
+ const spendable = vtxos.filter((v) => !chunkZIRFXBKL_cjs.hasTerminalSpend(v) && !v.isSwept);
4749
4746
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
4750
4747
  let recoverableCount = 0;
4751
4748
  let recoverableValue = 0;
@@ -4758,7 +4755,7 @@ var VtxoManager = class _VtxoManager {
4758
4755
  awaitingSweepCount = spendable.length;
4759
4756
  awaitingSweepValue = value;
4760
4757
  for (const v of spendable) {
4761
- const exp = chunkG552MISJ_cjs.toBatchExpiry(v);
4758
+ const exp = chunkZIRFXBKL_cjs.toBatchExpiry(v);
4762
4759
  if (exp !== void 0 && (nextSweepEta === void 0 || exp < nextSweepEta)) {
4763
4760
  nextSweepEta = exp;
4764
4761
  }
@@ -5019,7 +5016,7 @@ var VtxoManager = class _VtxoManager {
5019
5016
  /** Decodes the boarding tapscript exit path to extract the CSV timelock. */
5020
5017
  getBoardingTimelock() {
5021
5018
  const wallet = this.getSweepWallet();
5022
- const exitScript = chunkG552MISJ_cjs.CSVMultisigTapscript.decode(
5019
+ const exitScript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.decode(
5023
5020
  base.hex.decode(wallet.boardingTapscript.exitScript)
5024
5021
  );
5025
5022
  return exitScript.params.timelock;
@@ -5150,8 +5147,8 @@ var VtxoManager = class _VtxoManager {
5150
5147
  * or doesn't carry the metadata.
5151
5148
  */
5152
5149
  extractSpentOutpoint(error) {
5153
- const ark = chunkG552MISJ_cjs.maybeArkError(error);
5154
- if (!chunkG552MISJ_cjs.isArkError(ark, chunkG552MISJ_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5150
+ const ark = chunkZIRFXBKL_cjs.maybeArkError(error);
5151
+ if (!chunkZIRFXBKL_cjs.isArkError(ark, chunkZIRFXBKL_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5155
5152
  const raw = ark.metadata?.vtxo_outpoint;
5156
5153
  if (typeof raw !== "string") return void 0;
5157
5154
  const [txid, voutStr] = raw.split(":");
@@ -5341,7 +5338,7 @@ var VtxoManager = class _VtxoManager {
5341
5338
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
5342
5339
  break;
5343
5340
  }
5344
- const inputFee = estimator.evalOffchainInput(chunkG552MISJ_cjs.toOffchainInputFeeParams(v));
5341
+ const inputFee = estimator.evalOffchainInput(chunkZIRFXBKL_cjs.toOffchainInputFeeParams(v));
5345
5342
  if (inputFee.satoshis >= v.value) {
5346
5343
  continue;
5347
5344
  }
@@ -5361,7 +5358,7 @@ var VtxoManager = class _VtxoManager {
5361
5358
  const arkAddress = await this.wallet.getAddress();
5362
5359
  const outputFee = estimator.evalOffchainOutput({
5363
5360
  amount: totalAmount,
5364
- script: base.hex.encode(chunkG552MISJ_cjs.ArkAddress.decode(arkAddress).pkScript)
5361
+ script: base.hex.encode(chunkZIRFXBKL_cjs.ArkAddress.decode(arkAddress).pkScript)
5365
5362
  });
5366
5363
  totalAmount -= BigInt(outputFee.satoshis);
5367
5364
  if (totalAmount < dustAmount) return;
@@ -5441,7 +5438,7 @@ var ArkNote = class _ArkNote {
5441
5438
  this.value = value;
5442
5439
  this.HRP = HRP;
5443
5440
  const preimageHash = utils_js.sha256(this.preimage);
5444
- this.vtxoScript = new chunkG552MISJ_cjs.VtxoScript([noteTapscript(preimageHash)]);
5441
+ this.vtxoScript = new chunkZIRFXBKL_cjs.VtxoScript([noteTapscript(preimageHash)]);
5445
5442
  const leaf = this.vtxoScript.leaves[0];
5446
5443
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
5447
5444
  this.tapTree = this.vtxoScript.encode();
@@ -5608,7 +5605,7 @@ var ArkadeCash = class _ArkadeCash {
5608
5605
  const privateKey = data.slice(1, 33);
5609
5606
  const serverPubKey = data.slice(33, 65);
5610
5607
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
5611
- const csvTimelock = chunkG552MISJ_cjs.sequenceToTimelock(sequence);
5608
+ const csvTimelock = chunkZIRFXBKL_cjs.sequenceToTimelock(sequence);
5612
5609
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock, decoded.prefix);
5613
5610
  }
5614
5611
  toString() {
@@ -5616,7 +5613,7 @@ var ArkadeCash = class _ArkadeCash {
5616
5613
  data[0] = _ArkadeCash.Version;
5617
5614
  data.set(this._privateKey, 1);
5618
5615
  data.set(this._serverPubKey, 33);
5619
- const sequence = chunkG552MISJ_cjs.timelockToSequence(this.csvTimelock);
5616
+ const sequence = chunkZIRFXBKL_cjs.timelockToSequence(this.csvTimelock);
5620
5617
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
5621
5618
  const words = base.bech32m.toWords(data);
5622
5619
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -5625,7 +5622,7 @@ var ArkadeCash = class _ArkadeCash {
5625
5622
  return SingleKey.fromPrivateKey(this._privateKey);
5626
5623
  }
5627
5624
  get vtxoScript() {
5628
- return new chunkBABJ77NG_cjs.DefaultVtxo.Script({
5625
+ return new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
5629
5626
  pubKey: this._publicKey,
5630
5627
  serverPubKey: this._serverPubKey,
5631
5628
  csvTimelock: this.csvTimelock
@@ -5886,7 +5883,7 @@ async function captureExitBranch(params) {
5886
5883
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
5887
5884
  if (nonCommitment.length > 0) {
5888
5885
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
5889
- psbtByTxid.set(chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5886
+ psbtByTxid.set(chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5890
5887
  }
5891
5888
  }
5892
5889
  }
@@ -5929,10 +5926,10 @@ var IndexerExitDataSource = class {
5929
5926
  while (hasMore) {
5930
5927
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
5931
5928
  { txid: vtxo.txid, vout: vtxo.vout },
5932
- { pageIndex, pageSize: chunkG552MISJ_cjs.DEFAULT_PAGE_SIZE }
5929
+ { pageIndex, pageSize: chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE }
5933
5930
  );
5934
5931
  chain.push(...page);
5935
- hasMore = meta ? page.length === chunkG552MISJ_cjs.DEFAULT_PAGE_SIZE : false;
5932
+ hasMore = meta ? page.length === chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE : false;
5936
5933
  pageIndex++;
5937
5934
  }
5938
5935
  return chain;
@@ -5944,12 +5941,12 @@ var IndexerExitDataSource = class {
5944
5941
  while (hasMore) {
5945
5942
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
5946
5943
  pageIndex,
5947
- pageSize: chunkG552MISJ_cjs.DEFAULT_PAGE_SIZE
5944
+ pageSize: chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE
5948
5945
  });
5949
5946
  for (const psbt of txs) {
5950
- out.set(chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5947
+ out.set(chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5951
5948
  }
5952
- hasMore = page ? txs.length === chunkG552MISJ_cjs.DEFAULT_PAGE_SIZE : false;
5949
+ hasMore = page ? txs.length === chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE : false;
5953
5950
  pageIndex++;
5954
5951
  }
5955
5952
  return out;
@@ -5970,7 +5967,7 @@ function chainedTxTypeToChainTxType(t) {
5970
5967
  }
5971
5968
  }
5972
5969
  function psbtInputTxids(psbtBase64) {
5973
- const tx = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
5970
+ const tx = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
5974
5971
  const ids = [];
5975
5972
  for (let i = 0; i < tx.inputsLength; i++) {
5976
5973
  const txid = tx.getInput(i).txid;
@@ -6151,6 +6148,8 @@ function serializeArkInfoSnapshot(info, savedAt) {
6151
6148
  unilateralExitDelay: info.unilateralExitDelay.toString(),
6152
6149
  boardingExitDelay: info.boardingExitDelay.toString(),
6153
6150
  vtxoTreeExpiry: info.vtxoTreeExpiry?.toString(),
6151
+ maxTxWeight: info.maxTxWeight?.toString(),
6152
+ maxOpReturnOutputs: info.maxOpReturnOutputs?.toString(),
6154
6153
  sessionDuration: info.sessionDuration.toString(),
6155
6154
  dust: info.dust.toString(),
6156
6155
  fees: info.fees,
@@ -6201,6 +6200,8 @@ function hydrateArkInfo(snapshot) {
6201
6200
  signerPubkey: a.signerPubkey,
6202
6201
  unilateralExitDelay: BigInt(a.unilateralExitDelay),
6203
6202
  vtxoTreeExpiry: a.vtxoTreeExpiry !== void 0 ? BigInt(a.vtxoTreeExpiry) : void 0,
6203
+ maxTxWeight: a.maxTxWeight !== void 0 ? BigInt(a.maxTxWeight) : void 0,
6204
+ maxOpReturnOutputs: a.maxOpReturnOutputs !== void 0 ? BigInt(a.maxOpReturnOutputs) : void 0,
6204
6205
  utxoMaxAmount: BigInt(a.utxoMaxAmount),
6205
6206
  utxoMinAmount: BigInt(a.utxoMinAmount),
6206
6207
  version: a.version,
@@ -6273,8 +6274,10 @@ function parseStoredArkInfoSnapshot(raw) {
6273
6274
  ]) {
6274
6275
  assertDecimalString(a[field], `arkInfo.${field}`);
6275
6276
  }
6276
- if (a.vtxoTreeExpiry !== void 0) {
6277
- assertDecimalString(a.vtxoTreeExpiry, "arkInfo.vtxoTreeExpiry");
6277
+ for (const field of ["vtxoTreeExpiry", "maxTxWeight", "maxOpReturnOutputs"]) {
6278
+ if (a[field] !== void 0) {
6279
+ assertDecimalString(a[field], `arkInfo.${field}`);
6280
+ }
6278
6281
  }
6279
6282
  assertFeeInfo(a.fees, "arkInfo.fees");
6280
6283
  if (!Array.isArray(a.deprecatedSigners)) {
@@ -6323,10 +6326,10 @@ async function resolveArkInfo(arkProvider, walletRepository) {
6323
6326
  try {
6324
6327
  info = await arkProvider.getInfo();
6325
6328
  } catch (err) {
6326
- if (!chunkG552MISJ_cjs.isRetryableProviderError(err)) throw err;
6329
+ if (!chunkZIRFXBKL_cjs.isRetryableProviderError(err)) throw err;
6327
6330
  const snapshot = await loadArkInfoSnapshot(walletRepository);
6328
6331
  if (!snapshot) {
6329
- throw new chunkG552MISJ_cjs.ProviderUnavailableError(
6332
+ throw new chunkZIRFXBKL_cjs.ProviderUnavailableError(
6330
6333
  "Arkade server info is unavailable and no cached snapshot exists",
6331
6334
  { cause: err }
6332
6335
  );
@@ -6709,7 +6712,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos) {
6709
6712
  return [...txids];
6710
6713
  }
6711
6714
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt) {
6712
- const fromOldestVtxo = vtxos.map(chunkG552MISJ_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
6715
+ const fromOldestVtxo = vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
6713
6716
  const txidsNeedingCreatedAt = resolveTxCreatedAt ? collectArkTxidsNeedingCreatedAt(fromOldestVtxo) : [];
6714
6717
  const resolvedCreatedAt = resolveTxCreatedAt && txidsNeedingCreatedAt.length > 0 ? await resolveTxCreatedAt(txidsNeedingCreatedAt) : /* @__PURE__ */ new Map();
6715
6718
  const unmatchedSettledBoardingTxs = allBoardingTxs.filter(isSettledBoardingReceive).sort((a, b) => a.createdAt - b.createdAt);
@@ -6873,7 +6876,7 @@ var AssetManager = class extends ReadonlyAssetManager {
6873
6876
  const virtualCoins = await this.wallet.getSpendableVtxos({
6874
6877
  withRecoverable: false
6875
6878
  });
6876
- const controlAssetRef = params.controlAssetId ? chunkXN55B6EP_cjs.AssetRef.fromId(chunkXN55B6EP_cjs.AssetId.fromString(params.controlAssetId)) : null;
6879
+ const controlAssetRef = params.controlAssetId ? chunk3S3JZUEN_cjs.AssetRef.fromId(chunk3S3JZUEN_cjs.AssetId.fromString(params.controlAssetId)) : null;
6877
6880
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
6878
6881
  let totalBtcSelected = 0n;
6879
6882
  const assetChanges = /* @__PURE__ */ new Map();
@@ -6886,8 +6889,8 @@ var AssetManager = class extends ReadonlyAssetManager {
6886
6889
  }
6887
6890
  }
6888
6891
  const groups = [];
6889
- const issuedAssetOutput = chunkXN55B6EP_cjs.AssetOutput.create(0, params.amount);
6890
- const issuedAssetGroup = chunkXN55B6EP_cjs.AssetGroup.create(
6892
+ const issuedAssetOutput = chunk3S3JZUEN_cjs.AssetOutput.create(0, params.amount);
6893
+ const issuedAssetGroup = chunk3S3JZUEN_cjs.AssetGroup.create(
6891
6894
  null,
6892
6895
  controlAssetRef,
6893
6896
  [],
@@ -6902,28 +6905,28 @@ var AssetManager = class extends ReadonlyAssetManager {
6902
6905
  for (const [inputIndex, assets] of assetInputs) {
6903
6906
  for (const asset of assets) {
6904
6907
  if (asset.assetId !== assetId) continue;
6905
- changeInputs.push(chunkXN55B6EP_cjs.AssetInput.create(inputIndex, asset.amount));
6908
+ changeInputs.push(chunk3S3JZUEN_cjs.AssetInput.create(inputIndex, asset.amount));
6906
6909
  }
6907
6910
  }
6908
6911
  groups.push(
6909
- chunkXN55B6EP_cjs.AssetGroup.create(
6910
- chunkXN55B6EP_cjs.AssetId.fromString(assetId),
6912
+ chunk3S3JZUEN_cjs.AssetGroup.create(
6913
+ chunk3S3JZUEN_cjs.AssetId.fromString(assetId),
6911
6914
  null,
6912
6915
  changeInputs,
6913
- [chunkXN55B6EP_cjs.AssetOutput.create(0, amount)],
6916
+ [chunk3S3JZUEN_cjs.AssetOutput.create(0, amount)],
6914
6917
  []
6915
6918
  )
6916
6919
  );
6917
6920
  }
6918
6921
  }
6919
6922
  const address = await this.wallet.getAddress();
6920
- const outputAddress = chunkG552MISJ_cjs.ArkAddress.decode(address);
6923
+ const outputAddress = chunkZIRFXBKL_cjs.ArkAddress.decode(address);
6921
6924
  const outputs = [
6922
6925
  {
6923
6926
  script: outputAddress.pkScript,
6924
6927
  amount: BigInt(totalBtcSelected)
6925
6928
  },
6926
- Extension.create([chunkXN55B6EP_cjs.Packet.create(groups)]).txOut()
6929
+ Extension.create([chunk3S3JZUEN_cjs.Packet.create(groups)]).txOut()
6927
6930
  ];
6928
6931
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(
6929
6932
  coinSelection.inputs,
@@ -6931,7 +6934,7 @@ var AssetManager = class extends ReadonlyAssetManager {
6931
6934
  );
6932
6935
  return {
6933
6936
  arkTxId: arkTxid,
6934
- assetId: chunkXN55B6EP_cjs.AssetId.create(arkTxid, 0).toString()
6937
+ assetId: chunk3S3JZUEN_cjs.AssetId.create(arkTxid, 0).toString()
6935
6938
  };
6936
6939
  }
6937
6940
  /**
@@ -7003,16 +7006,16 @@ var AssetManager = class extends ReadonlyAssetManager {
7003
7006
  for (const [inputIndex, assets] of assetInputs) {
7004
7007
  for (const asset of assets) {
7005
7008
  if (asset.assetId !== params.assetId) continue;
7006
- reissueInputs.push(chunkXN55B6EP_cjs.AssetInput.create(inputIndex, asset.amount));
7009
+ reissueInputs.push(chunk3S3JZUEN_cjs.AssetInput.create(inputIndex, asset.amount));
7007
7010
  }
7008
7011
  }
7009
7012
  const totalAssetAmount = assetToReissueAmount + params.amount;
7010
- const reissueAssetIdObj = chunkXN55B6EP_cjs.AssetId.fromString(params.assetId);
7011
- const reissueAssetGroup = chunkXN55B6EP_cjs.AssetGroup.create(
7013
+ const reissueAssetIdObj = chunk3S3JZUEN_cjs.AssetId.fromString(params.assetId);
7014
+ const reissueAssetGroup = chunk3S3JZUEN_cjs.AssetGroup.create(
7012
7015
  reissueAssetIdObj,
7013
7016
  null,
7014
7017
  reissueInputs,
7015
- [chunkXN55B6EP_cjs.AssetOutput.create(0, totalAssetAmount)],
7018
+ [chunk3S3JZUEN_cjs.AssetOutput.create(0, totalAssetAmount)],
7016
7019
  []
7017
7020
  );
7018
7021
  const groups = [reissueAssetGroup];
@@ -7021,27 +7024,27 @@ var AssetManager = class extends ReadonlyAssetManager {
7021
7024
  for (const [inputIndex, assets] of assetInputs) {
7022
7025
  for (const asset of assets) {
7023
7026
  if (asset.assetId !== assetId) continue;
7024
- changeInputs.push(chunkXN55B6EP_cjs.AssetInput.create(inputIndex, asset.amount));
7027
+ changeInputs.push(chunk3S3JZUEN_cjs.AssetInput.create(inputIndex, asset.amount));
7025
7028
  }
7026
7029
  }
7027
7030
  groups.push(
7028
- chunkXN55B6EP_cjs.AssetGroup.create(
7029
- chunkXN55B6EP_cjs.AssetId.fromString(assetId),
7031
+ chunk3S3JZUEN_cjs.AssetGroup.create(
7032
+ chunk3S3JZUEN_cjs.AssetId.fromString(assetId),
7030
7033
  null,
7031
7034
  changeInputs,
7032
- [chunkXN55B6EP_cjs.AssetOutput.create(0, amount)],
7035
+ [chunk3S3JZUEN_cjs.AssetOutput.create(0, amount)],
7033
7036
  []
7034
7037
  )
7035
7038
  );
7036
7039
  }
7037
7040
  const address = await this.wallet.getAddress();
7038
- const outputAddress = chunkG552MISJ_cjs.ArkAddress.decode(address);
7041
+ const outputAddress = chunkZIRFXBKL_cjs.ArkAddress.decode(address);
7039
7042
  const outputs = [
7040
7043
  {
7041
7044
  script: outputAddress.pkScript,
7042
7045
  amount: BigInt(totalBtcSelected)
7043
7046
  },
7044
- Extension.create([chunkXN55B6EP_cjs.Packet.create(groups)]).txOut()
7047
+ Extension.create([chunk3S3JZUEN_cjs.Packet.create(groups)]).txOut()
7045
7048
  ];
7046
7049
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
7047
7050
  return arkTxid;
@@ -7108,27 +7111,27 @@ var AssetManager = class extends ReadonlyAssetManager {
7108
7111
  for (const [inputIndex, assets] of assetInputs) {
7109
7112
  for (const asset of assets) {
7110
7113
  if (asset.assetId !== assetId) continue;
7111
- changeInputs.push(chunkXN55B6EP_cjs.AssetInput.create(inputIndex, asset.amount));
7114
+ changeInputs.push(chunk3S3JZUEN_cjs.AssetInput.create(inputIndex, asset.amount));
7112
7115
  }
7113
7116
  }
7114
7117
  groups.push(
7115
- chunkXN55B6EP_cjs.AssetGroup.create(
7116
- chunkXN55B6EP_cjs.AssetId.fromString(assetId),
7118
+ chunk3S3JZUEN_cjs.AssetGroup.create(
7119
+ chunk3S3JZUEN_cjs.AssetId.fromString(assetId),
7117
7120
  null,
7118
7121
  changeInputs,
7119
- amount > 0n ? [chunkXN55B6EP_cjs.AssetOutput.create(0, amount)] : [],
7122
+ amount > 0n ? [chunk3S3JZUEN_cjs.AssetOutput.create(0, amount)] : [],
7120
7123
  []
7121
7124
  )
7122
7125
  );
7123
7126
  }
7124
7127
  const address = await this.wallet.getAddress();
7125
- const outputAddress = chunkG552MISJ_cjs.ArkAddress.decode(address);
7128
+ const outputAddress = chunkZIRFXBKL_cjs.ArkAddress.decode(address);
7126
7129
  const outputs = [
7127
7130
  {
7128
7131
  script: outputAddress.pkScript,
7129
7132
  amount: BigInt(totalBtcSelected)
7130
7133
  },
7131
- Extension.create([chunkXN55B6EP_cjs.Packet.create(groups)]).txOut()
7134
+ Extension.create([chunk3S3JZUEN_cjs.Packet.create(groups)]).txOut()
7132
7135
  ];
7133
7136
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
7134
7137
  return arkTxid;
@@ -7153,7 +7156,7 @@ function castMetadata(metadata) {
7153
7156
  } else {
7154
7157
  throw new Error("Invalid metadata value type");
7155
7158
  }
7156
- md.push(chunkXN55B6EP_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7159
+ md.push(chunk3S3JZUEN_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7157
7160
  }
7158
7161
  return md;
7159
7162
  }
@@ -7174,10 +7177,10 @@ var DelegateManagerImpl = class {
7174
7177
  if (vtxos.length === 0) {
7175
7178
  return { delegated: [], failed: [] };
7176
7179
  }
7177
- const destinationScript = chunkG552MISJ_cjs.ArkAddress.decode(destination).pkScript;
7180
+ const destinationScript = chunkZIRFXBKL_cjs.ArkAddress.decode(destination).pkScript;
7178
7181
  const arkInfo = await this.arkInfoProvider.getInfo();
7179
7182
  const delegateInfo = await this.delegateProvider.getDelegateInfo();
7180
- const eligible = vtxos.map(chunkG552MISJ_cjs.normalizeVtxo).filter(
7183
+ const eligible = vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo).filter(
7181
7184
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
7182
7185
  );
7183
7186
  if (eligible.length === 0) {
@@ -7206,11 +7209,11 @@ var DelegateManagerImpl = class {
7206
7209
  const groupByExpiry = /* @__PURE__ */ new Map();
7207
7210
  let recoverableVtxos = [];
7208
7211
  for (const vtxo of eligible) {
7209
- if (chunkG552MISJ_cjs.canRecoverOnchain(vtxo, now)) {
7212
+ if (chunkZIRFXBKL_cjs.canRecoverOnchain(vtxo, now)) {
7210
7213
  recoverableVtxos.push(vtxo);
7211
7214
  continue;
7212
7215
  }
7213
- const expiry = chunkG552MISJ_cjs.toBatchExpiry(vtxo);
7216
+ const expiry = chunkZIRFXBKL_cjs.toBatchExpiry(vtxo);
7214
7217
  if (!expiry) continue;
7215
7218
  const dayKey = getDayTimestamp(expiry);
7216
7219
  groupByExpiry.set(dayKey, [...groupByExpiry.get(dayKey) ?? [], vtxo]);
@@ -7275,7 +7278,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7275
7278
  }
7276
7279
  if (!delegateAt) {
7277
7280
  const now = { timestamp: /* @__PURE__ */ new Date() };
7278
- const expiryTimestamp = vtxos.filter((coin) => !chunkG552MISJ_cjs.canRecoverOnchain(coin, now) && chunkG552MISJ_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunkG552MISJ_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7281
+ const expiryTimestamp = vtxos.filter((coin) => !chunkZIRFXBKL_cjs.canRecoverOnchain(coin, now) && chunkZIRFXBKL_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunkZIRFXBKL_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7279
7282
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
7280
7283
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7281
7284
  } else {
@@ -7304,7 +7307,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7304
7307
  let amount = 0n;
7305
7308
  for (const coin of vtxos) {
7306
7309
  const inputFee = estimator.evalOffchainInput({
7307
- ...chunkG552MISJ_cjs.toOffchainInputFeeParams(coin),
7310
+ ...chunkZIRFXBKL_cjs.toOffchainInputFeeParams(coin),
7308
7311
  type: "vtxo"
7309
7312
  });
7310
7313
  if (inputFee.value >= coin.value) {
@@ -7318,7 +7321,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7318
7321
  const delegateFee = BigInt(Number(fee));
7319
7322
  if (delegateFee > 0n) {
7320
7323
  outputs.push({
7321
- script: chunkG552MISJ_cjs.ArkAddress.decode(delegateAddress).pkScript,
7324
+ script: chunkZIRFXBKL_cjs.ArkAddress.decode(delegateAddress).pkScript,
7322
7325
  amount: delegateFee
7323
7326
  });
7324
7327
  }
@@ -7351,10 +7354,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7351
7354
  destinationScript
7352
7355
  );
7353
7356
  const forfeitOutputScript = btcSigner.OutScript.encode(
7354
- btcSigner.Address(chunkG552MISJ_cjs.getNetwork(network)).decode(forfeitAddress)
7357
+ btcSigner.Address(chunkZIRFXBKL_cjs.getNetwork(network)).decode(forfeitAddress)
7355
7358
  );
7356
7359
  const forfeits = await Promise.all(
7357
- vtxos.filter((v) => !chunkG552MISJ_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
7360
+ vtxos.filter((v) => !chunkZIRFXBKL_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
7358
7361
  const forfeit = await makeDelegateForfeitTx(
7359
7362
  coin,
7360
7363
  dust,
@@ -7379,7 +7382,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
7379
7382
  index: input.vout,
7380
7383
  witnessUtxo: {
7381
7384
  amount: BigInt(input.value),
7382
- script: chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).pkScript
7385
+ script: chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).pkScript
7383
7386
  },
7384
7387
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
7385
7388
  tapLeafScript: [delegateTapLeaf]
@@ -7437,7 +7440,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
7437
7440
  expire_at: 0,
7438
7441
  cosigners_public_keys: cosignerPubKeys
7439
7442
  };
7440
- const proof = chunkG552MISJ_cjs.Intent.create(message, coins, outputs);
7443
+ const proof = chunkZIRFXBKL_cjs.Intent.create(message, coins, outputs);
7441
7444
  const signedProof = await identity.sign(proof);
7442
7445
  return {
7443
7446
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -7455,10 +7458,10 @@ function getDayTimestamp(timestamp) {
7455
7458
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
7456
7459
  if (!vtxo.tapTree) return void 0;
7457
7460
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
7458
- const vtxoScript = chunkG552MISJ_cjs.VtxoScript.decode(vtxo.tapTree);
7461
+ const vtxoScript = chunkZIRFXBKL_cjs.VtxoScript.decode(vtxo.tapTree);
7459
7462
  return vtxoScript.leaves.find((tapLeaf) => {
7460
- const arkTapscript = chunkG552MISJ_cjs.decodeTapscript(chunkG552MISJ_cjs.scriptFromTapLeafScript(tapLeaf));
7461
- if (!chunkG552MISJ_cjs.MultisigTapscript.is(arkTapscript)) return false;
7463
+ const arkTapscript = chunkZIRFXBKL_cjs.decodeTapscript(chunkZIRFXBKL_cjs.scriptFromTapLeafScript(tapLeaf));
7464
+ if (!chunkZIRFXBKL_cjs.MultisigTapscript.is(arkTapscript)) return false;
7462
7465
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
7463
7466
  });
7464
7467
  }
@@ -7739,7 +7742,7 @@ function createManagedConnection(dbName, version, initDatabase2) {
7739
7742
  };
7740
7743
  }
7741
7744
  function scriptFromArkAddress(address) {
7742
- return base.hex.encode(chunkG552MISJ_cjs.ArkAddress.decode(address).pkScript);
7745
+ return base.hex.encode(chunkZIRFXBKL_cjs.ArkAddress.decode(address).pkScript);
7743
7746
  }
7744
7747
 
7745
7748
  // src/repositories/indexedDB/schema.ts
@@ -8234,7 +8237,7 @@ function validateVtxosForScript(vtxos, script, context) {
8234
8237
  }
8235
8238
  async function getVtxosForContract(repo, contract) {
8236
8239
  const vtxos = repo.getVtxosForScript ? await repo.getVtxosForScript(contract.script) : filterVtxosForScript(await repo.getVtxos(contract.address), contract.script);
8237
- return vtxos.map(chunkG552MISJ_cjs.normalizeVtxo);
8240
+ return vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo);
8238
8241
  }
8239
8242
  async function saveVtxosForContract(repo, contract, vtxos) {
8240
8243
  if (repo.saveVtxosForScript) {
@@ -8376,7 +8379,7 @@ function decodeArkContract(encoded) {
8376
8379
  }
8377
8380
  function contractFromArkContract(encoded, options = {}) {
8378
8381
  const parsed = decodeArkContract(encoded);
8379
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(parsed.type);
8382
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(parsed.type);
8380
8383
  if (!handler) {
8381
8384
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
8382
8385
  }
@@ -8390,9 +8393,9 @@ function contractFromArkContract(encoded, options = {}) {
8390
8393
  metadata: options.metadata
8391
8394
  };
8392
8395
  }
8393
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkG552MISJ_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8396
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkZIRFXBKL_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8394
8397
  const parsed = decodeArkContract(encoded);
8395
- const handler = chunkBABJ77NG_cjs.contractHandlers.getOrThrow(parsed.type);
8398
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.getOrThrow(parsed.type);
8396
8399
  const params = parsed.data;
8397
8400
  const vtxoScript = handler.createScript(params);
8398
8401
  return {
@@ -8646,9 +8649,9 @@ var ContractWatcher = class {
8646
8649
  this.connectionState = "connected";
8647
8650
  this.reconnectAttempts = 0;
8648
8651
  this.listenLoop().catch((e) => {
8649
- if (chunkG552MISJ_cjs.isEventSourceError(e)) {
8652
+ if (chunkZIRFXBKL_cjs.isEventSourceError(e)) {
8650
8653
  console.debug("ContractWatcher subscription disconnected; reconnecting");
8651
- } else if (!chunkG552MISJ_cjs.isEventSourceUnavailableError(e)) {
8654
+ } else if (!chunkZIRFXBKL_cjs.isEventSourceUnavailableError(e)) {
8652
8655
  console.error(e);
8653
8656
  }
8654
8657
  this.connectionState = "disconnected";
@@ -8660,7 +8663,7 @@ var ContractWatcher = class {
8660
8663
  this.scheduleReconnect();
8661
8664
  });
8662
8665
  } catch (error) {
8663
- if (!chunkG552MISJ_cjs.isEventSourceUnavailableError(error)) {
8666
+ if (!chunkZIRFXBKL_cjs.isEventSourceUnavailableError(error)) {
8664
8667
  console.error("ContractWatcher connection failed:", error);
8665
8668
  }
8666
8669
  this.connectionState = "disconnected";
@@ -8686,7 +8689,7 @@ var ContractWatcher = class {
8686
8689
  * slower; what it loses is push latency.
8687
8690
  */
8688
8691
  reportEventSourceUnavailable(error) {
8689
- if (!chunkG552MISJ_cjs.isEventSourceUnavailableError(error)) return false;
8692
+ if (!chunkZIRFXBKL_cjs.isEventSourceUnavailableError(error)) return false;
8690
8693
  if (!this.eventSourceReported) {
8691
8694
  this.eventSourceReported = true;
8692
8695
  console.warn(
@@ -8902,14 +8905,14 @@ var ContractWatcher = class {
8902
8905
  const timestamp = Date.now();
8903
8906
  if (update.newVtxos?.length) {
8904
8907
  this.processSubscriptionVtxos(
8905
- update.newVtxos.map(chunkG552MISJ_cjs.normalizeVtxo),
8908
+ update.newVtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo),
8906
8909
  "vtxo_received",
8907
8910
  timestamp
8908
8911
  );
8909
8912
  }
8910
8913
  if (update.spentVtxos?.length) {
8911
8914
  this.processSubscriptionVtxos(
8912
- update.spentVtxos.map(chunkG552MISJ_cjs.normalizeVtxo),
8915
+ update.spentVtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo),
8913
8916
  "vtxo_spent",
8914
8917
  timestamp
8915
8918
  );
@@ -9042,7 +9045,7 @@ async function reconcileIntents(deps) {
9042
9045
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
9043
9046
  if (outpoints.length > 0) {
9044
9047
  try {
9045
- const { vtxos } = await chunkG552MISJ_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9048
+ const { vtxos } = await chunkZIRFXBKL_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9046
9049
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
9047
9050
  } catch (e) {
9048
9051
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -9216,7 +9219,7 @@ var ContractManager = class _ContractManager {
9216
9219
  await this.reconcileWatched();
9217
9220
  this.markSyncOnline();
9218
9221
  } catch (err) {
9219
- if (!chunkG552MISJ_cjs.isRetryableProviderError(err)) throw err;
9222
+ if (!chunkZIRFXBKL_cjs.isRetryableProviderError(err)) throw err;
9220
9223
  this.markSyncDegraded(err);
9221
9224
  }
9222
9225
  this.initialized = true;
@@ -9348,7 +9351,7 @@ var ContractManager = class _ContractManager {
9348
9351
  const from = Math.max(0, watermark - lookAhead.size);
9349
9352
  const to = watermark + lookAhead.size;
9350
9353
  const deps = lookAhead.candidateDeps();
9351
- const handlers = chunkBABJ77NG_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkBABJ77NG_cjs.contractHandlers.get(t)).filter(hasCandidates);
9354
+ const handlers = chunkPXPPZF5K_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkPXPPZF5K_cjs.contractHandlers.get(t)).filter(hasCandidates);
9352
9355
  const band = /* @__PURE__ */ new Map();
9353
9356
  for (let index = from; index <= to; index++) {
9354
9357
  const descriptor = lookAhead.materialize(index);
@@ -9359,7 +9362,7 @@ var ContractManager = class _ContractManager {
9359
9362
  index,
9360
9363
  params: {
9361
9364
  ...candidate,
9362
- ...chunkBABJ77NG_cjs.speculativeReceiveMetadata(descriptor)
9365
+ ...chunkPXPPZF5K_cjs.speculativeReceiveMetadata(descriptor)
9363
9366
  }
9364
9367
  });
9365
9368
  }
@@ -9421,7 +9424,7 @@ var ContractManager = class _ContractManager {
9421
9424
  });
9422
9425
  for (const entry of pending) entry.catchUpPending = false;
9423
9426
  } catch (err) {
9424
- if (!chunkG552MISJ_cjs.isRetryableProviderError(err)) throw err;
9427
+ if (!chunkZIRFXBKL_cjs.isRetryableProviderError(err)) throw err;
9425
9428
  this.markSyncDegraded(err);
9426
9429
  }
9427
9430
  }
@@ -9471,7 +9474,7 @@ var ContractManager = class _ContractManager {
9471
9474
  await this.fetchContractVxosFromIndexer([contract]);
9472
9475
  this.markSyncOnline();
9473
9476
  } catch (err) {
9474
- if (!chunkG552MISJ_cjs.isRetryableProviderError(err)) throw err;
9477
+ if (!chunkZIRFXBKL_cjs.isRetryableProviderError(err)) throw err;
9475
9478
  this.markSyncDegraded(err);
9476
9479
  }
9477
9480
  await this.watcher.addContract(contract);
@@ -9508,7 +9511,7 @@ var ContractManager = class _ContractManager {
9508
9511
  return result;
9509
9512
  }
9510
9513
  async upsertContractRow(params) {
9511
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(params.type);
9514
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(params.type);
9512
9515
  if (!handler) {
9513
9516
  throw new Error(`No handler registered for contract type '${params.type}'`);
9514
9517
  }
@@ -9608,7 +9611,7 @@ var ContractManager = class _ContractManager {
9608
9611
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
9609
9612
  );
9610
9613
  }
9611
- const registered = chunkBABJ77NG_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkBABJ77NG_cjs.contractHandlers.get(t)).filter(isDiscoverable);
9614
+ const registered = chunkPXPPZF5K_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkPXPPZF5K_cjs.contractHandlers.get(t)).filter(isDiscoverable);
9612
9615
  const discoverables = [
9613
9616
  ...registered.filter((h) => h.type === "boarding"),
9614
9617
  ...registered.filter((h) => h.type !== "boarding")
@@ -9743,7 +9746,7 @@ var ContractManager = class _ContractManager {
9743
9746
  await this.syncContracts({ contracts, pageSize });
9744
9747
  this.markSyncOnline();
9745
9748
  } catch (err) {
9746
- if (!chunkG552MISJ_cjs.isRetryableProviderError(err)) throw err;
9749
+ if (!chunkZIRFXBKL_cjs.isRetryableProviderError(err)) throw err;
9747
9750
  this.markSyncDegraded(err);
9748
9751
  }
9749
9752
  const vtxos = await this.getVtxosForContracts(contracts);
@@ -9764,7 +9767,7 @@ var ContractManager = class _ContractManager {
9764
9767
  }
9765
9768
  const tapscriptCache = tapscripts ?? /* @__PURE__ */ new Map();
9766
9769
  return vtxos.map(
9767
- (vtxo) => extendVirtualCoinForContract(chunkG552MISJ_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
9770
+ (vtxo) => extendVirtualCoinForContract(chunkZIRFXBKL_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
9768
9771
  );
9769
9772
  }
9770
9773
  /** @inheritdoc */
@@ -9808,14 +9811,14 @@ var ContractManager = class _ContractManager {
9808
9811
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
9809
9812
  const asking = vtxos.filter((vtxo) => {
9810
9813
  const contract = byScript.get(vtxo.script);
9811
- return contract !== void 0 && chunkBABJ77NG_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
9814
+ return contract !== void 0 && chunkPXPPZF5K_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
9812
9815
  });
9813
9816
  if (asking.length === 0) return refused;
9814
9817
  const tip = await this.currentChainTip();
9815
9818
  const walletKey = await walletPubKey?.();
9816
9819
  for (const vtxo of asking) {
9817
9820
  const contract = byScript.get(vtxo.script);
9818
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
9821
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
9819
9822
  if (!handler?.assertSpendableNow) continue;
9820
9823
  const context = {
9821
9824
  collaborative: true,
@@ -9830,7 +9833,7 @@ var ContractManager = class _ContractManager {
9830
9833
  // the next handler to answer a CSV question would meet a
9831
9834
  // TypeError instead of a `false`. Carry the coin only when it
9832
9835
  // really is one.
9833
- vtxo: chunkG552MISJ_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
9836
+ vtxo: chunkZIRFXBKL_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
9834
9837
  };
9835
9838
  try {
9836
9839
  await handler.assertSpendableNow(
@@ -9986,7 +9989,7 @@ var ContractManager = class _ContractManager {
9986
9989
  const { contractScript, collaborative = true, walletPubKey, vtxo } = options;
9987
9990
  const [contract] = await this.getContracts({ script: contractScript });
9988
9991
  if (!contract) return [];
9989
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
9992
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
9990
9993
  if (!handler) return [];
9991
9994
  const script = handler.createScript(contract.params);
9992
9995
  const tip = await this.currentChainTip();
@@ -10014,7 +10017,7 @@ var ContractManager = class _ContractManager {
10014
10017
  const { contractScript, collaborative = true, walletPubKey } = options;
10015
10018
  const [contract] = await this.getContracts({ script: contractScript });
10016
10019
  if (!contract) return [];
10017
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
10020
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
10018
10021
  if (!handler) return [];
10019
10022
  const script = handler.createScript(contract.params);
10020
10023
  const context = {
@@ -10070,7 +10073,7 @@ var ContractManager = class _ContractManager {
10070
10073
  }
10071
10074
  async refreshOutpoints(outpoints) {
10072
10075
  if (outpoints.length === 0) return;
10073
- const { vtxos } = await chunkG552MISJ_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10076
+ const { vtxos } = await chunkZIRFXBKL_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10074
10077
  outpoints
10075
10078
  });
10076
10079
  if (vtxos.length === 0) return;
@@ -10149,7 +10152,7 @@ var ContractManager = class _ContractManager {
10149
10152
  break;
10150
10153
  }
10151
10154
  } catch (err) {
10152
- if (!chunkG552MISJ_cjs.isRetryableProviderError(err)) throw err;
10155
+ if (!chunkZIRFXBKL_cjs.isRetryableProviderError(err)) throw err;
10153
10156
  this.markSyncDegraded(err);
10154
10157
  }
10155
10158
  this.emitEvent(event);
@@ -10228,7 +10231,7 @@ var ContractManager = class _ContractManager {
10228
10231
  */
10229
10232
  async reconcilePendingFrontier(contracts) {
10230
10233
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
10231
- const vtxos = await chunkG552MISJ_cjs.getAllNormalizedVtxos(
10234
+ const vtxos = await chunkZIRFXBKL_cjs.getAllNormalizedVtxos(
10232
10235
  this.config.indexerProvider,
10233
10236
  contracts.map((c) => c.script),
10234
10237
  { pendingOnly: true }
@@ -10311,7 +10314,7 @@ var ContractManager = class _ContractManager {
10311
10314
  }
10312
10315
  return result;
10313
10316
  }
10314
- async fetchContractVtxosBulk(contracts, pageSize = chunkG552MISJ_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10317
+ async fetchContractVtxosBulk(contracts, pageSize = chunkZIRFXBKL_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10315
10318
  if (contracts.length === 0) {
10316
10319
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
10317
10320
  }
@@ -10327,7 +10330,7 @@ var ContractManager = class _ContractManager {
10327
10330
  before: syncWindow.before
10328
10331
  }
10329
10332
  } : {};
10330
- const vtxos = await chunkG552MISJ_cjs.getAllNormalizedVtxos(
10333
+ const vtxos = await chunkZIRFXBKL_cjs.getAllNormalizedVtxos(
10331
10334
  this.config.indexerProvider,
10332
10335
  contracts.map((c) => c.script),
10333
10336
  { ...windowOpts, pageSize }
@@ -10472,7 +10475,7 @@ var deserializeTapLeaf = (t) => {
10472
10475
  const s = base.hex.decode(t.s);
10473
10476
  return [cb, s];
10474
10477
  };
10475
- var deserializeVtxo = (o) => chunkG552MISJ_cjs.normalizeVtxo({
10478
+ var deserializeVtxo = (o) => chunkZIRFXBKL_cjs.normalizeVtxo({
10476
10479
  ...o,
10477
10480
  createdAt: new Date(o.createdAt),
10478
10481
  tapTree: base.hex.decode(o.tapTree),
@@ -11295,7 +11298,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11295
11298
  */
11296
11299
  materializeDescriptorAt(index) {
11297
11300
  const descriptor = this.identity.descriptor;
11298
- const network = chunkBABJ77NG_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11301
+ const network = chunkPXPPZF5K_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11299
11302
  const expansion = descriptorsScure.expand({ descriptor, network, index });
11300
11303
  const keyInfo = expansion.expansionMap?.["@0"];
11301
11304
  if (!keyInfo?.keyExpression) {
@@ -11443,7 +11446,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
11443
11446
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
11444
11447
  if (!provider) return void 0;
11445
11448
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
11446
- const expectedContractType = setup.offchainTapscript instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script ? "delegate" : "default";
11449
+ const expectedContractType = setup.offchainTapscript instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script ? "delegate" : "default";
11447
11450
  const factoryOpts = {
11448
11451
  walletRepository: setup.walletRepository,
11449
11452
  contractRepository: setup.contractRepository,
@@ -11642,7 +11645,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
11642
11645
  };
11643
11646
  function deriveLeafPubkey(descriptor) {
11644
11647
  try {
11645
- return chunkBABJ77NG_cjs.deriveDescriptorLeafPubKey(descriptor);
11648
+ return chunkPXPPZF5K_cjs.deriveDescriptorLeafPubKey(descriptor);
11646
11649
  } catch (e) {
11647
11650
  throw new NonRangeableDescriptorError(
11648
11651
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -11654,7 +11657,7 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11654
11657
  const pubKey = deriveLeafPubkey(descriptor);
11655
11658
  const tapscript = rebuildTapscript(current, pubKey);
11656
11659
  const serverPubKey = tapscript.options.serverPubKey;
11657
- const csvTimelock = chunkG552MISJ_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
11660
+ const csvTimelock = chunkZIRFXBKL_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
11658
11661
  const base$1 = {
11659
11662
  script: base.hex.encode(tapscript.pkScript),
11660
11663
  address: tapscript.address(hrp, serverPubKey).encode(),
@@ -11665,11 +11668,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11665
11668
  // index-0 key. Without it, spends produce unsigned PSBTs that the
11666
11669
  // server rejects with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
11667
11670
  metadata: {
11668
- ...{ source: chunkBABJ77NG_cjs.WALLET_RECEIVE_SOURCE },
11671
+ ...{ source: chunkPXPPZF5K_cjs.WALLET_RECEIVE_SOURCE },
11669
11672
  signingDescriptor: descriptor
11670
11673
  }
11671
11674
  };
11672
- const params = tapscript instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script ? {
11675
+ const params = tapscript instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script ? {
11673
11676
  ...base$1,
11674
11677
  type: "delegate",
11675
11678
  params: {
@@ -11690,10 +11693,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11690
11693
  return { tapscript, params };
11691
11694
  }
11692
11695
  function rebuildTapscript(current, pubKey) {
11693
- if (current instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script) {
11694
- return new chunkBABJ77NG_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
11696
+ if (current instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script) {
11697
+ return new chunkPXPPZF5K_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
11695
11698
  }
11696
- return new chunkBABJ77NG_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
11699
+ return new chunkPXPPZF5K_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
11697
11700
  }
11698
11701
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
11699
11702
  const candidates = await contractRepository.getContracts({
@@ -11702,7 +11705,7 @@ async function pickActiveReceive(contractRepository, serverPubKey, expectedType)
11702
11705
  });
11703
11706
  const serverPubKeyHex = base.hex.encode(serverPubKey);
11704
11707
  const matching = candidates.filter(
11705
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkBABJ77NG_cjs.WALLET_RECEIVE_SOURCE
11708
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkPXPPZF5K_cjs.WALLET_RECEIVE_SOURCE
11706
11709
  ).sort((a, b) => {
11707
11710
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
11708
11711
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -11757,17 +11760,17 @@ function computeOffchainBalance(vtxos, caps) {
11757
11760
  }
11758
11761
  };
11759
11762
  for (const vtxo of vtxos) {
11760
- if (chunkG552MISJ_cjs.hasTerminalSpend(vtxo)) continue;
11763
+ if (chunkZIRFXBKL_cjs.hasTerminalSpend(vtxo)) continue;
11761
11764
  addAssets(owned, vtxo);
11762
11765
  if (isPendingRecovery(vtxo)) {
11763
11766
  pendingRecovery += vtxo.value;
11764
11767
  continue;
11765
11768
  }
11766
- if (chunkG552MISJ_cjs.canRecoverOnchain(vtxo, now)) {
11769
+ if (chunkZIRFXBKL_cjs.canRecoverOnchain(vtxo, now)) {
11767
11770
  recoverable += vtxo.value;
11768
11771
  continue;
11769
11772
  }
11770
- if (!chunkG552MISJ_cjs.canSpendOffchain(vtxo, now)) continue;
11773
+ if (!chunkZIRFXBKL_cjs.canSpendOffchain(vtxo, now)) continue;
11771
11774
  if (vtxo.isPreconfirmed) {
11772
11775
  preconfirmed += vtxo.value;
11773
11776
  } else {
@@ -11936,12 +11939,12 @@ var InputSignerRouter = class {
11936
11939
  };
11937
11940
 
11938
11941
  // src/wallet/wallet.ts
11939
- var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunkG552MISJ_cjs.DEFAULT_ARKADE_SERVER_URL;
11942
+ var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunkZIRFXBKL_cjs.DEFAULT_ARKADE_SERVER_URL;
11940
11943
  function intentProofJobs(coins) {
11941
11944
  if (coins.length === 0) return [];
11942
11945
  const coinJobs = coins.map((coin, i) => ({
11943
11946
  index: i + 1,
11944
- lookupScript: chunkG552MISJ_cjs.VtxoScript.decode(coin.tapTree).pkScript
11947
+ lookupScript: chunkZIRFXBKL_cjs.VtxoScript.decode(coin.tapTree).pkScript
11945
11948
  }));
11946
11949
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
11947
11950
  }
@@ -11963,11 +11966,6 @@ function extractArkProviderUrl(provider) {
11963
11966
  var DEFAULT_LOOK_AHEAD_WINDOW = 20;
11964
11967
  var MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD = 1e3;
11965
11968
  var MAINNET_UNILATERAL_EXIT_DELAY = 605184n;
11966
- function toXOnlyPubKey(pubkey) {
11967
- if (pubkey.length === 33) return pubkey.slice(1);
11968
- if (pubkey.length === 32) return pubkey;
11969
- throw new Error(`invalid signer pubkey length: expected 32 or 33, got ${pubkey.length}`);
11970
- }
11971
11969
  function delayToTimelock(delay) {
11972
11970
  return {
11973
11971
  value: delay,
@@ -11978,7 +11976,7 @@ function dedupeTimelocks(timelocks) {
11978
11976
  const seen = /* @__PURE__ */ new Set();
11979
11977
  const deduped = [];
11980
11978
  for (const timelock of timelocks) {
11981
- const sequence = chunkG552MISJ_cjs.timelockToSequence(timelock).toString();
11979
+ const sequence = chunkZIRFXBKL_cjs.timelockToSequence(timelock).toString();
11982
11980
  if (seen.has(sequence)) continue;
11983
11981
  seen.add(sequence);
11984
11982
  deduped.push(timelock);
@@ -11995,7 +11993,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
11995
11993
  state: "active"
11996
11994
  });
11997
11995
  const newest = candidates.filter(
11998
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkBABJ77NG_cjs.WALLET_RECEIVE_SOURCE
11996
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkPXPPZF5K_cjs.WALLET_RECEIVE_SOURCE
11999
11997
  ).sort((a, b) => {
12000
11998
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12001
11999
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12003,7 +12001,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
12003
12001
  if (!newest?.params.pubKey) return baseline;
12004
12002
  try {
12005
12003
  const pubKey = base.hex.decode(newest.params.pubKey);
12006
- return new chunkBABJ77NG_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12004
+ return new chunkPXPPZF5K_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12007
12005
  } catch (e) {
12008
12006
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
12009
12007
  return baseline;
@@ -12019,8 +12017,8 @@ function filterSnapshotVtxos(snapshot, filter, pendingSpendOutpoints) {
12019
12017
  if (pendingSpendOutpoints.has(`${vtxo.txid}:${vtxo.vout}`)) {
12020
12018
  return false;
12021
12019
  }
12022
- if (!chunkG552MISJ_cjs.hasTerminalSpend(vtxo)) {
12023
- if (!f.withRecoverable && chunkG552MISJ_cjs.canRecoverOnchain(vtxo, now)) {
12020
+ if (!chunkZIRFXBKL_cjs.hasTerminalSpend(vtxo)) {
12021
+ if (!f.withRecoverable && chunkZIRFXBKL_cjs.canRecoverOnchain(vtxo, now)) {
12024
12022
  return false;
12025
12023
  }
12026
12024
  return true;
@@ -12361,7 +12359,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12361
12359
  */
12362
12360
  static async setupWalletConfig(config, pubKey) {
12363
12361
  const arkadeServerUrl = getArkadeServerUrl(config);
12364
- const arkProvider = config.arkProvider || new chunkG552MISJ_cjs.RestArkProvider(arkadeServerUrl);
12362
+ const arkProvider = config.arkProvider || new chunkZIRFXBKL_cjs.RestArkProvider(arkadeServerUrl);
12365
12363
  let indexerProvider = config.indexerProvider;
12366
12364
  if (!indexerProvider) {
12367
12365
  let indexerUrl = config.indexerUrl;
@@ -12378,7 +12376,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12378
12376
  indexerUrl = arkadeServerUrl;
12379
12377
  }
12380
12378
  }
12381
- indexerProvider = new chunkXN55B6EP_cjs.RestIndexerProvider(indexerUrl);
12379
+ indexerProvider = new chunk3S3JZUEN_cjs.RestIndexerProvider(indexerUrl);
12382
12380
  }
12383
12381
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
12384
12382
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -12387,7 +12385,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12387
12385
  source: serverInfoSource,
12388
12386
  lastOnlineAt: serverInfoLastOnlineAt
12389
12387
  } = await resolveArkInfo(arkProvider, walletRepository);
12390
- const network = chunkG552MISJ_cjs.getNetwork(info.network);
12388
+ const network = chunkZIRFXBKL_cjs.getNetwork(info.network);
12391
12389
  if ("descriptor" in config.identity) {
12392
12390
  const descriptor = config.identity.descriptor;
12393
12391
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -12427,18 +12425,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
12427
12425
  value: info.boardingExitDelay,
12428
12426
  type: info.boardingExitDelay < 512n ? "blocks" : "seconds"
12429
12427
  };
12430
- const serverPubKey = base.hex.decode(info.signerPubkey).slice(1);
12431
- const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => base.hex.decode(info2.pubkey).slice(1)).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => base.hex.decode(info2.pubkey).slice(1)).catch(() => void 0) : void 0;
12428
+ const serverPubKey = chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
12429
+ const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12432
12430
  const offchainOptions = {
12433
12431
  pubKey,
12434
12432
  serverPubKey,
12435
12433
  csvTimelock: exitTimelock
12436
12434
  };
12437
- const offchainTapscript = !delegatePubKey ? new chunkBABJ77NG_cjs.DefaultVtxo.Script(offchainOptions) : new chunkBABJ77NG_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
12438
- const boardingTapscript = chunkBABJ77NG_cjs.BoardingContractHandler.createScript({
12435
+ const offchainTapscript = !delegatePubKey ? new chunkPXPPZF5K_cjs.DefaultVtxo.Script(offchainOptions) : new chunkPXPPZF5K_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
12436
+ const boardingTapscript = chunkPXPPZF5K_cjs.BoardingContractHandler.createScript({
12439
12437
  pubKey: base.hex.encode(pubKey),
12440
12438
  serverPubKey: base.hex.encode(serverPubKey),
12441
- csvTimelock: chunkG552MISJ_cjs.timelockToSequence(boardingTimelock).toString()
12439
+ csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(boardingTimelock).toString()
12442
12440
  });
12443
12441
  return {
12444
12442
  arkProvider,
@@ -12735,7 +12733,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12735
12733
  const response = await contractManager.getContractsWithVtxos();
12736
12734
  const allVtxos = response.flatMap((_) => _.vtxos);
12737
12735
  const { boardingTxs, commitmentsToIgnore } = await this.getBoardingTxs();
12738
- const resolveTxCreatedAt = (txids) => chunkG552MISJ_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
12736
+ const resolveTxCreatedAt = (txids) => chunkZIRFXBKL_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
12739
12737
  return buildTransactionHistory(
12740
12738
  allVtxos,
12741
12739
  boardingTxs,
@@ -12829,7 +12827,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12829
12827
  },
12830
12828
  isUnrolled: true,
12831
12829
  ...boardingFacts,
12832
- virtualStatus: chunkG552MISJ_cjs.toVirtualStatus(boardingFacts),
12830
+ virtualStatus: chunkZIRFXBKL_cjs.toVirtualStatus(boardingFacts),
12833
12831
  spentBy: "",
12834
12832
  createdAt: tx.status.confirmed ? new Date(tx.status.block_time * 1e3) : /* @__PURE__ */ new Date(0),
12835
12833
  script: scriptHex
@@ -12885,9 +12883,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
12885
12883
  async getBoardingTapscripts(allowedSigners) {
12886
12884
  const byScript = /* @__PURE__ */ new Map();
12887
12885
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
12888
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkBABJ77NG_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
12886
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkPXPPZF5K_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
12889
12887
  add(
12890
- new chunkBABJ77NG_cjs.DefaultVtxo.Script({
12888
+ new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
12891
12889
  pubKey: await this.identity.xOnlyPublicKey(),
12892
12890
  serverPubKey: this.boardingTapscript.options.serverPubKey,
12893
12891
  csvTimelock: boardingCsv
@@ -12902,7 +12900,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12902
12900
  for (const c of boardingContracts) {
12903
12901
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
12904
12902
  try {
12905
- add(chunkBABJ77NG_cjs.BoardingContractHandler.createScript(c.params));
12903
+ add(chunkPXPPZF5K_cjs.BoardingContractHandler.createScript(c.params));
12906
12904
  } catch (e) {
12907
12905
  console.warn("Skipping malformed boarding contract", c.script, e);
12908
12906
  }
@@ -12940,7 +12938,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12940
12938
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
12941
12939
  // not the wallet's current boarding timelock, which a signer
12942
12940
  // rotation may have changed.
12943
- csvTimelock: chunkG552MISJ_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
12941
+ csvTimelock: chunkZIRFXBKL_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
12944
12942
  coins: utxos
12945
12943
  });
12946
12944
  }
@@ -13073,7 +13071,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13073
13071
  /** Fetch Arkade transaction ids that are still pending final settlement. */
13074
13072
  async fetchPendingTxs() {
13075
13073
  const scripts = await this.getWalletScripts();
13076
- const vtxos = await chunkG552MISJ_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
13074
+ const vtxos = await chunkZIRFXBKL_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
13077
13075
  return vtxos.filter(
13078
13076
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
13079
13077
  ).map((_) => _.arkTxId);
@@ -13104,7 +13102,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13104
13102
  });
13105
13103
  for (const contract of contracts) {
13106
13104
  if (map.has(contract.script)) continue;
13107
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
13105
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
13108
13106
  if (handler) {
13109
13107
  const script = handler.createScript(contract.params);
13110
13108
  map.set(contract.script, script);
@@ -13216,7 +13214,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13216
13214
  }
13217
13215
  });
13218
13216
  const baselinePubkey = await this.identity.xOnlyPublicKey();
13219
- const delegatePubKey = this.offchainTapscript instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13217
+ const delegatePubKey = this.offchainTapscript instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13220
13218
  const baselineSigners = [
13221
13219
  this.offchainTapscript.options.serverPubKey,
13222
13220
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
@@ -13224,8 +13222,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
13224
13222
  const seenBaselineScripts = /* @__PURE__ */ new Set();
13225
13223
  for (const serverPubKey of baselineSigners) {
13226
13224
  for (const csvTimelock of this.walletContractTimelocks) {
13227
- const csvTimelockStr = chunkG552MISJ_cjs.timelockToSequence(csvTimelock).toString();
13228
- const defaultScript = new chunkBABJ77NG_cjs.DefaultVtxo.Script({
13225
+ const csvTimelockStr = chunkZIRFXBKL_cjs.timelockToSequence(csvTimelock).toString();
13226
+ const defaultScript = new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
13229
13227
  pubKey: baselinePubkey,
13230
13228
  serverPubKey,
13231
13229
  csvTimelock
@@ -13246,7 +13244,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13246
13244
  });
13247
13245
  }
13248
13246
  if (delegatePubKey) {
13249
- const delegateScript = new chunkBABJ77NG_cjs.DelegateVtxo.Script({
13247
+ const delegateScript = new chunkPXPPZF5K_cjs.DelegateVtxo.Script({
13250
13248
  pubKey: baselinePubkey,
13251
13249
  serverPubKey,
13252
13250
  delegatePubKey,
@@ -13270,9 +13268,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13270
13268
  }
13271
13269
  }
13272
13270
  }
13273
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkBABJ77NG_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13271
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkPXPPZF5K_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13274
13272
  for (const serverPubKey of baselineSigners) {
13275
- const baselineBoarding = new chunkBABJ77NG_cjs.DefaultVtxo.Script({
13273
+ const baselineBoarding = new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
13276
13274
  pubKey: baselinePubkey,
13277
13275
  serverPubKey,
13278
13276
  csvTimelock: boardingCsvTimelock
@@ -13285,7 +13283,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13285
13283
  params: {
13286
13284
  pubKey: base.hex.encode(baselineBoarding.options.pubKey),
13287
13285
  serverPubKey: base.hex.encode(serverPubKey),
13288
- csvTimelock: chunkG552MISJ_cjs.timelockToSequence(boardingCsvTimelock).toString()
13286
+ csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(boardingCsvTimelock).toString()
13289
13287
  },
13290
13288
  script: boardingScriptHex,
13291
13289
  address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
@@ -13464,7 +13462,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13464
13462
  serverPubKey: this.offchainTapscript.options.serverPubKey,
13465
13463
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
13466
13464
  csvTimelocks: this.walletContractTimelocks,
13467
- delegatePubKey: this.offchainTapscript instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
13465
+ delegatePubKey: this.offchainTapscript instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
13468
13466
  };
13469
13467
  }
13470
13468
  _signerRouter;
@@ -13558,24 +13556,24 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13558
13556
  const manager = await this.getContractManager();
13559
13557
  const descriptor = await manager.getNextSigningDescriptor();
13560
13558
  if (!descriptor) return this.getBoardingAddress();
13561
- const pubKey = chunkBABJ77NG_cjs.deriveDescriptorLeafPubKey(descriptor);
13562
- const newBoarding = new chunkBABJ77NG_cjs.DefaultVtxo.Script({
13559
+ const pubKey = chunkPXPPZF5K_cjs.deriveDescriptorLeafPubKey(descriptor);
13560
+ const newBoarding = new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
13563
13561
  ...this._boardingTapscript.options,
13564
13562
  pubKey
13565
13563
  });
13566
- const csvTimelock = newBoarding.options.csvTimelock ?? chunkBABJ77NG_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13564
+ const csvTimelock = newBoarding.options.csvTimelock ?? chunkPXPPZF5K_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13567
13565
  await manager.createContract({
13568
13566
  type: "boarding",
13569
13567
  params: {
13570
13568
  pubKey: base.hex.encode(pubKey),
13571
13569
  serverPubKey: base.hex.encode(newBoarding.options.serverPubKey),
13572
- csvTimelock: chunkG552MISJ_cjs.timelockToSequence(csvTimelock).toString()
13570
+ csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(csvTimelock).toString()
13573
13571
  },
13574
13572
  script: base.hex.encode(newBoarding.pkScript),
13575
13573
  address: newBoarding.address(this.network.hrp, this.arkServerPublicKey).encode(),
13576
13574
  state: "active",
13577
13575
  metadata: {
13578
- source: chunkBABJ77NG_cjs.WALLET_RECEIVE_SOURCE,
13576
+ source: chunkPXPPZF5K_cjs.WALLET_RECEIVE_SOURCE,
13579
13577
  signingDescriptor: descriptor
13580
13578
  }
13581
13579
  });
@@ -13610,7 +13608,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13610
13608
  if (this._descriptorProvider instanceof HDDescriptorProvider) {
13611
13609
  return (await this.getContractManager()).getNextSigningDescriptor();
13612
13610
  }
13613
- return chunkBABJ77NG_cjs.identityDescriptor(this.identity);
13611
+ return chunkPXPPZF5K_cjs.identityDescriptor(this.identity);
13614
13612
  }
13615
13613
  /**
13616
13614
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -13706,7 +13704,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13706
13704
  * the stable public API.
13707
13705
  */
13708
13706
  async rotateServerSigner(newServerPubKey, checkpointTapscript) {
13709
- const xonly = toXOnlyPubKey(newServerPubKey);
13707
+ const xonly = chunkPXPPZF5K_cjs.toXOnly(newServerPubKey, "ark signer key");
13710
13708
  const newServerUnrollScript = assertValidServerUnrollScript(
13711
13709
  checkpointTapscript,
13712
13710
  resolveCheckpointExitDelayPolicy(this.network, this.checkpointExitDelayPolicy)
@@ -13735,21 +13733,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13735
13733
  const [currentBoardingRow] = await manager.getContracts({
13736
13734
  script: currentBoardingScript
13737
13735
  });
13738
- const newOffchain = this.offchainTapscript instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script ? new chunkBABJ77NG_cjs.DelegateVtxo.Script({
13736
+ const newOffchain = this.offchainTapscript instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script ? new chunkPXPPZF5K_cjs.DelegateVtxo.Script({
13739
13737
  ...this.offchainTapscript.options,
13740
13738
  serverPubKey: xonly
13741
- }) : new chunkBABJ77NG_cjs.DefaultVtxo.Script({
13739
+ }) : new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
13742
13740
  ...this.offchainTapscript.options,
13743
13741
  serverPubKey: xonly
13744
13742
  });
13745
- const newBoarding = new chunkBABJ77NG_cjs.DefaultVtxo.Script({
13743
+ const newBoarding = new chunkPXPPZF5K_cjs.DefaultVtxo.Script({
13746
13744
  ...this._boardingTapscript.options,
13747
13745
  serverPubKey: xonly
13748
13746
  });
13749
- const offchainCsv = chunkG552MISJ_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
13747
+ const offchainCsv = chunkZIRFXBKL_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
13750
13748
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
13751
13749
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
13752
- if (newOffchain instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script) {
13750
+ if (newOffchain instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script) {
13753
13751
  await manager.createContract({
13754
13752
  type: "delegate",
13755
13753
  params: {
@@ -13777,13 +13775,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13777
13775
  metadata: currentOffchainRow?.metadata
13778
13776
  });
13779
13777
  }
13780
- const boardingCsv = newBoarding.options.csvTimelock ?? chunkBABJ77NG_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13778
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkPXPPZF5K_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13781
13779
  await manager.createContract({
13782
13780
  type: "boarding",
13783
13781
  params: {
13784
13782
  pubKey: base.hex.encode(newBoarding.options.pubKey),
13785
13783
  serverPubKey: base.hex.encode(xonly),
13786
- csvTimelock: chunkG552MISJ_cjs.timelockToSequence(boardingCsv).toString()
13784
+ csvTimelock: chunkZIRFXBKL_cjs.timelockToSequence(boardingCsv).toString()
13787
13785
  },
13788
13786
  script: base.hex.encode(newBoarding.pkScript),
13789
13787
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -13816,14 +13814,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13816
13814
  _restoreInFlight;
13817
13815
  _addPendingSpends(inputs) {
13818
13816
  for (const input of inputs) {
13819
- if (chunkG552MISJ_cjs.isVirtualCoin(input)) {
13817
+ if (chunkZIRFXBKL_cjs.isVirtualCoin(input)) {
13820
13818
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
13821
13819
  }
13822
13820
  }
13823
13821
  }
13824
13822
  _removePendingSpends(inputs) {
13825
13823
  for (const input of inputs) {
13826
- if (chunkG552MISJ_cjs.isVirtualCoin(input)) {
13824
+ if (chunkZIRFXBKL_cjs.isVirtualCoin(input)) {
13827
13825
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
13828
13826
  }
13829
13827
  }
@@ -13881,13 +13879,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13881
13879
  const manager = await this.getContractManager();
13882
13880
  const provider = this._descriptorProvider;
13883
13881
  const hd = provider instanceof HDDescriptorProvider;
13884
- const staticDescriptor = hd ? void 0 : await chunkBABJ77NG_cjs.identityDescriptor(this.identity);
13882
+ const staticDescriptor = hd ? void 0 : await chunkPXPPZF5K_cjs.identityDescriptor(this.identity);
13885
13883
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
13886
- const delegatePubKey = this.offchainTapscript instanceof chunkBABJ77NG_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13884
+ const delegatePubKey = this.offchainTapscript instanceof chunkPXPPZF5K_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13887
13885
  const arkInfo = await this.arkProvider.getInfo();
13888
- const currentSignerPubKey = toXOnlyPubKey(base.hex.decode(arkInfo.signerPubkey));
13886
+ const currentSignerPubKey = chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
13889
13887
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
13890
- (s) => toXOnlyPubKey(base.hex.decode(s.pubkey))
13888
+ (s) => chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
13891
13889
  );
13892
13890
  const deps = {
13893
13891
  indexerProvider: this.indexerProvider,
@@ -13902,7 +13900,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13902
13900
  csvTimelocks: this.walletContractTimelocks,
13903
13901
  // Boarding-exit CSV so the boarding handler can build its
13904
13902
  // candidate script (distinct from the unilateral-exit matrix).
13905
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkBABJ77NG_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
13903
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkPXPPZF5K_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
13906
13904
  delegatePubKey
13907
13905
  };
13908
13906
  const result = await manager.scanContracts({
@@ -14016,7 +14014,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14016
14014
  throw new Error("Invalid configured public key");
14017
14015
  }
14018
14016
  const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
14019
- const forfeitPubkey = base.hex.decode(setup.info.forfeitPubkey).slice(1);
14017
+ const forfeitPubkey = chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
14020
14018
  const forfeitAddress = btcSigner.Address(setup.network).decode(setup.info.forfeitAddress);
14021
14019
  const forfeitOutputScript = btcSigner.OutScript.encode(forfeitAddress);
14022
14020
  const checkpointExitDelayOverrides = {
@@ -14165,7 +14163,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14165
14163
  inputs: params.selectedVtxos,
14166
14164
  changeAmount: BigInt(changeAmount)
14167
14165
  };
14168
- const outputAddress = chunkG552MISJ_cjs.ArkAddress.decode(params.address);
14166
+ const outputAddress = chunkZIRFXBKL_cjs.ArkAddress.decode(params.address);
14169
14167
  assertRecipientArkAddress(
14170
14168
  params.address,
14171
14169
  outputAddress,
@@ -14231,13 +14229,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14231
14229
  void this.logUngatedInputs("settle({ inputs })", params.inputs);
14232
14230
  }
14233
14231
  const offchainAddress = await this.getAddress();
14234
- const offchainPkScript = chunkG552MISJ_cjs.ArkAddress.decode(offchainAddress).pkScript;
14232
+ const offchainPkScript = chunkZIRFXBKL_cjs.ArkAddress.decode(offchainAddress).pkScript;
14235
14233
  const offchainOutputScript = base.hex.encode(offchainPkScript);
14236
14234
  if (!params) {
14237
14235
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
14238
14236
  const estimator = new Estimator(fees.intentFee);
14239
14237
  let amount = 0;
14240
- const exitScript = chunkG552MISJ_cjs.CSVMultisigTapscript.decode(
14238
+ const exitScript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.decode(
14241
14239
  base.hex.decode(this.boardingTapscript.exitScript)
14242
14240
  );
14243
14241
  const boardingTimelock = exitScript.params.timelock;
@@ -14266,7 +14264,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14266
14264
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
14267
14265
  break;
14268
14266
  }
14269
- const inputFee = estimator.evalOffchainInput(chunkG552MISJ_cjs.toOffchainInputFeeParams(vtxo));
14267
+ const inputFee = estimator.evalOffchainInput(chunkZIRFXBKL_cjs.toOffchainInputFeeParams(vtxo));
14270
14268
  if (inputFee.satoshis >= vtxo.value) {
14271
14269
  continue;
14272
14270
  }
@@ -14313,7 +14311,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14313
14311
  let script;
14314
14312
  let arkAddress;
14315
14313
  try {
14316
- arkAddress = chunkG552MISJ_cjs.ArkAddress.decode(output.address);
14314
+ arkAddress = chunkZIRFXBKL_cjs.ArkAddress.decode(output.address);
14317
14315
  } catch {
14318
14316
  arkAddress = void 0;
14319
14317
  }
@@ -14403,7 +14401,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14403
14401
  const abortController = new AbortController();
14404
14402
  let stream;
14405
14403
  let committedTxid;
14406
- const settleInputVtxos = params.inputs.filter(chunkG552MISJ_cjs.isVirtualCoin);
14404
+ const settleInputVtxos = params.inputs.filter(chunkZIRFXBKL_cjs.isVirtualCoin);
14407
14405
  const contractManager = await this.getContractManager();
14408
14406
  await contractManager.assertAnnotatable(settleInputVtxos);
14409
14407
  await contractManager.assertSpendableNow?.(
@@ -14512,7 +14510,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14512
14510
  async maybeRotateBoardingAfterBoard(inputs) {
14513
14511
  if (!this._descriptorProvider) return;
14514
14512
  const consumedBoarding = inputs.some(
14515
- (input) => typeof input !== "string" && !chunkG552MISJ_cjs.isVirtualCoin(input)
14513
+ (input) => typeof input !== "string" && !chunkZIRFXBKL_cjs.isVirtualCoin(input)
14516
14514
  );
14517
14515
  if (!consumedBoarding) return;
14518
14516
  try {
@@ -14536,7 +14534,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14536
14534
  let connectorIndex = 0;
14537
14535
  const connectorsLeaves = connectorsGraph?.leaves() || [];
14538
14536
  for (const input of inputs) {
14539
- if (!chunkG552MISJ_cjs.isVirtualCoin(input)) {
14537
+ if (!chunkZIRFXBKL_cjs.isVirtualCoin(input)) {
14540
14538
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
14541
14539
  const settlementInput = settlementPsbt.getInput(i);
14542
14540
  if (!settlementInput.txid || settlementInput.index === void 0) {
@@ -14567,7 +14565,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14567
14565
  }
14568
14566
  continue;
14569
14567
  }
14570
- if (chunkG552MISJ_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
14568
+ if (chunkZIRFXBKL_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
14571
14569
  continue;
14572
14570
  }
14573
14571
  if (connectorsLeaves.length === 0) {
@@ -14595,7 +14593,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14595
14593
  index: input.vout,
14596
14594
  witnessUtxo: {
14597
14595
  amount: BigInt(input.value),
14598
- script: chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).pkScript
14596
+ script: chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).pkScript
14599
14597
  },
14600
14598
  sighashType: btcSigner.SigHash.DEFAULT,
14601
14599
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -14614,7 +14612,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14614
14612
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
14615
14613
  {
14616
14614
  index: 0,
14617
- lookupScript: chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).pkScript
14615
+ lookupScript: chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).pkScript
14618
14616
  }
14619
14617
  ]);
14620
14618
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -14672,7 +14670,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14672
14670
  resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
14673
14671
  );
14674
14672
  await this.arkProvider.confirmRegistration(intentId);
14675
- const sweepTapscript = chunkG552MISJ_cjs.CSVMultisigTapscript.encode({
14673
+ const sweepTapscript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({
14676
14674
  timelock,
14677
14675
  pubkeys: [this.forfeitPubkey]
14678
14676
  }).script;
@@ -14686,9 +14684,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14686
14684
  if (!sweepTapTreeRoot) {
14687
14685
  throw new Error("Sweep tap tree root not set");
14688
14686
  }
14689
- const xOnlyPublicKeys = event.cosignersPublicKeys.map((k) => k.slice(2));
14687
+ const xOnlyPublicKeys = event.cosignersPublicKeys.map(
14688
+ (k) => base.hex.encode(chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
14689
+ );
14690
14690
  const signerPublicKey = await session.getPublicKey();
14691
- const xonlySignerPublicKey = signerPublicKey.subarray(1);
14691
+ const xonlySignerPublicKey = chunkPXPPZF5K_cjs.toXOnly(signerPublicKey, "signer key");
14692
14692
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
14693
14693
  return { skip: true };
14694
14694
  }
@@ -14778,9 +14778,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14778
14778
  ...existing ?? {},
14779
14779
  intentTxId,
14780
14780
  registerProof: intent.proof,
14781
- registerProofMessage: chunkG552MISJ_cjs.Intent.encodeMessage(intent.message),
14781
+ registerProofMessage: chunkZIRFXBKL_cjs.Intent.encodeMessage(intent.message),
14782
14782
  deleteProof: deleteIntent.proof,
14783
- deleteProofMessage: chunkG552MISJ_cjs.Intent.encodeMessage(deleteIntent.message),
14783
+ deleteProofMessage: chunkZIRFXBKL_cjs.Intent.encodeMessage(deleteIntent.message),
14784
14784
  intentVtxos: inputs.map((i) => ({
14785
14785
  txid: i.txid,
14786
14786
  vout: i.vout
@@ -14812,7 +14812,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14812
14812
  try {
14813
14813
  return await this.arkProvider.registerIntent(intent);
14814
14814
  } catch (error) {
14815
- if (error instanceof chunkG552MISJ_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
14815
+ if (error instanceof chunkZIRFXBKL_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
14816
14816
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
14817
14817
  await this.arkProvider.deleteIntent(deleteIntent);
14818
14818
  return this.arkProvider.registerIntent(intent);
@@ -14828,7 +14828,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14828
14828
  expire_at: 0,
14829
14829
  cosigners_public_keys: cosignerPubKeys
14830
14830
  };
14831
- const proof = chunkG552MISJ_cjs.Intent.create(message, coins, outputs);
14831
+ const proof = chunkZIRFXBKL_cjs.Intent.create(message, coins, outputs);
14832
14832
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
14833
14833
  return {
14834
14834
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -14840,7 +14840,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14840
14840
  type: "delete",
14841
14841
  expire_at: 0
14842
14842
  };
14843
- const proof = chunkG552MISJ_cjs.Intent.create(message, coins, []);
14843
+ const proof = chunkZIRFXBKL_cjs.Intent.create(message, coins, []);
14844
14844
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
14845
14845
  return {
14846
14846
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -14852,7 +14852,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14852
14852
  type: "get-pending-tx",
14853
14853
  expire_at: 0
14854
14854
  };
14855
- const proof = chunkG552MISJ_cjs.Intent.create(message, coins, []);
14855
+ const proof = chunkZIRFXBKL_cjs.Intent.create(message, coins, []);
14856
14856
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
14857
14857
  return {
14858
14858
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -14873,7 +14873,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14873
14873
  if (!vtxos || vtxos.length === 0) {
14874
14874
  const scriptMap = await this.getScriptMap();
14875
14875
  const allExtended = [];
14876
- const fetchedVtxos = await chunkG552MISJ_cjs.getAllNormalizedVtxos(this.indexerProvider, [
14876
+ const fetchedVtxos = await chunkZIRFXBKL_cjs.getAllNormalizedVtxos(this.indexerProvider, [
14877
14877
  ...scriptMap.keys()
14878
14878
  ]);
14879
14879
  for (const vtxo of fetchedVtxos) {
@@ -14987,11 +14987,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14987
14987
  * against the current key alone would leave it pending forever.
14988
14988
  */
14989
14989
  checkpointUnrollCandidates(info) {
14990
- const current = chunkG552MISJ_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
14990
+ const current = chunkZIRFXBKL_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
14991
14991
  const candidates = [this._serverUnrollScript, current];
14992
14992
  for (const deprecated of signerSetFromInfo(info).deprecated.keys()) {
14993
14993
  candidates.push(
14994
- chunkG552MISJ_cjs.CSVMultisigTapscript.encode({
14994
+ chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({
14995
14995
  ...current.params,
14996
14996
  pubkeys: [base.hex.decode(deprecated)]
14997
14997
  })
@@ -15082,7 +15082,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15082
15082
  if (vtxos.length === 0) {
15083
15083
  throw new Error("No VTXOs found for this arkadeCash");
15084
15084
  }
15085
- const myPkScript = chunkG552MISJ_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
15085
+ const myPkScript = chunkZIRFXBKL_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
15086
15086
  let { spendable, unclaimed } = this.classifyCashVtxos(vtxos);
15087
15087
  let swept = 0;
15088
15088
  const drainable = vtxos.filter((vtxo) => !isSubdust(vtxo, this.dustAmount));
@@ -15156,7 +15156,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15156
15156
  const spendable = [];
15157
15157
  const unclaimed = [];
15158
15158
  for (const vtxo of vtxos) {
15159
- if (chunkG552MISJ_cjs.hasTerminalSpend(vtxo)) {
15159
+ if (chunkZIRFXBKL_cjs.hasTerminalSpend(vtxo)) {
15160
15160
  unclaimed.push(cashReport(vtxo, "already-spent"));
15161
15161
  } else if (isSubdust(vtxo, this.dustAmount)) {
15162
15162
  unclaimed.push(cashReport(vtxo, "subdust"));
@@ -15176,7 +15176,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15176
15176
  const all = [];
15177
15177
  const seen = /* @__PURE__ */ new Set();
15178
15178
  for (let pageIndex = 0; ; pageIndex++) {
15179
- const { vtxos, page } = await chunkG552MISJ_cjs.getNormalizedVtxos(this.indexerProvider, {
15179
+ const { vtxos, page } = await chunkZIRFXBKL_cjs.getNormalizedVtxos(this.indexerProvider, {
15180
15180
  scripts,
15181
15181
  pageIndex,
15182
15182
  pageSize
@@ -15223,7 +15223,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15223
15223
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
15224
15224
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
15225
15225
  const message = { type: "get-pending-tx", expire_at: 0 };
15226
- const proof = chunkG552MISJ_cjs.Intent.create(message, batch, []);
15226
+ const proof = chunkZIRFXBKL_cjs.Intent.create(message, batch, []);
15227
15227
  const signedProof = await identity.sign(
15228
15228
  proof,
15229
15229
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -15442,7 +15442,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15442
15442
  script: recipient.script,
15443
15443
  amount: BigInt(recipient.amount),
15444
15444
  // Already checked against the recipient address in `validateRecipients`.
15445
- ...recipient.tapTree ? { tapTree: chunkG552MISJ_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
15445
+ ...recipient.tapTree ? { tapTree: chunkZIRFXBKL_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
15446
15446
  }));
15447
15447
  const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
15448
15448
  let changeAmount = totalBtcSelected - totalBtcOutput;
@@ -15586,10 +15586,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15586
15586
  const serverPubKey = this.arkServerPublicKey;
15587
15587
  const serverUnrollScript = this.serverUnrollScript;
15588
15588
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
15589
- const normalizedInputs = inputs.map(chunkG552MISJ_cjs.normalizeVtxo);
15590
- const at = now ?? await chunkG552MISJ_cjs.resolveTimeHeight(this.onchainProvider);
15589
+ const normalizedInputs = inputs.map(chunkZIRFXBKL_cjs.normalizeVtxo);
15590
+ const at = now ?? await chunkZIRFXBKL_cjs.resolveTimeHeight(this.onchainProvider);
15591
15591
  for (const input of normalizedInputs) {
15592
- if (!chunkG552MISJ_cjs.canSpendOffchain(input, at)) {
15592
+ if (!chunkZIRFXBKL_cjs.canSpendOffchain(input, at)) {
15593
15593
  throw new Error(
15594
15594
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
15595
15595
  );
@@ -15659,7 +15659,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15659
15659
  );
15660
15660
  const arkTxJobs = inputs.map((input, index) => ({
15661
15661
  index,
15662
- lookupScript: chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).pkScript
15662
+ lookupScript: chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).pkScript
15663
15663
  }));
15664
15664
  const identity = this.identity;
15665
15665
  const signer = {
@@ -15745,14 +15745,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15745
15745
  const spentBy = checkpointIdByOutpoint.get(`${vtxo.txid}:${vtxo.vout}`);
15746
15746
  spentVtxos.push({
15747
15747
  ...spentFacts,
15748
- virtualStatus: chunkG552MISJ_cjs.toVirtualStatus(spentFacts),
15748
+ virtualStatus: chunkZIRFXBKL_cjs.toVirtualStatus(spentFacts),
15749
15749
  ...spentBy ? { spentBy } : {},
15750
15750
  arkTxId: arkTxid
15751
15751
  });
15752
15752
  for (const id of vtxo.commitmentTxIds) {
15753
15753
  commitmentTxIds.add(id);
15754
15754
  }
15755
- const vtxoExpiry = chunkG552MISJ_cjs.toBatchExpiry(vtxo);
15755
+ const vtxoExpiry = chunkZIRFXBKL_cjs.toBatchExpiry(vtxo);
15756
15756
  if (vtxoExpiry) {
15757
15757
  batchExpiry = Math.min(batchExpiry, vtxoExpiry);
15758
15758
  }
@@ -15765,7 +15765,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15765
15765
  isSwept: false,
15766
15766
  isPreconfirmed: true,
15767
15767
  commitmentTxIds: Array.from(commitmentTxIds),
15768
- ...chunkG552MISJ_cjs.parseLegacyExpiry(batchExpiry)
15768
+ ...chunkZIRFXBKL_cjs.parseLegacyExpiry(batchExpiry)
15769
15769
  };
15770
15770
  changeVtxo = {
15771
15771
  txid: arkTxid,
@@ -15777,7 +15777,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15777
15777
  tapTree: offchainTapscript.encode(),
15778
15778
  value: Number(changeAmount),
15779
15779
  ...changeFacts,
15780
- virtualStatus: chunkG552MISJ_cjs.toVirtualStatus(changeFacts),
15780
+ virtualStatus: chunkZIRFXBKL_cjs.toVirtualStatus(changeFacts),
15781
15781
  spentBy: "",
15782
15782
  status: {
15783
15783
  confirmed: false
@@ -15846,12 +15846,12 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15846
15846
  const spentVtxos = [];
15847
15847
  const inputArkTxIds = /* @__PURE__ */ new Set();
15848
15848
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
15849
- const vtxoInputs = inputs.filter(chunkG552MISJ_cjs.isVirtualCoin);
15849
+ const vtxoInputs = inputs.filter(chunkZIRFXBKL_cjs.isVirtualCoin);
15850
15850
  const cm = await this.getContractManager();
15851
15851
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
15852
15852
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
15853
15853
  for (const input of inputs) {
15854
- if (chunkG552MISJ_cjs.isVirtualCoin(input)) {
15854
+ if (chunkZIRFXBKL_cjs.isVirtualCoin(input)) {
15855
15855
  const outpoint = `${input.txid}:${input.vout}`;
15856
15856
  const vtxo = annotatedByKey.get(outpoint);
15857
15857
  if (!vtxo) {
@@ -15863,13 +15863,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15863
15863
  const settledFacts = { ...vtxo, isSpent: true };
15864
15864
  spentVtxos.push({
15865
15865
  ...settledFacts,
15866
- virtualStatus: chunkG552MISJ_cjs.toVirtualStatus(settledFacts),
15866
+ virtualStatus: chunkZIRFXBKL_cjs.toVirtualStatus(settledFacts),
15867
15867
  settledBy: commitmentTxid
15868
15868
  });
15869
15869
  } else {
15870
15870
  let sourceAddress;
15871
15871
  try {
15872
- sourceAddress = chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
15872
+ sourceAddress = chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
15873
15873
  this.network
15874
15874
  );
15875
15875
  } catch {
@@ -15927,9 +15927,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15927
15927
  }
15928
15928
  };
15929
15929
  function selectVirtualCoins(coins, targetAmount) {
15930
- const sortedCoins = coins.map(chunkG552MISJ_cjs.normalizeVtxo).sort((a, b) => {
15931
- const expiryA = chunkG552MISJ_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
15932
- const expiryB = chunkG552MISJ_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
15930
+ const sortedCoins = coins.map(chunkZIRFXBKL_cjs.normalizeVtxo).sort((a, b) => {
15931
+ const expiryA = chunkZIRFXBKL_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
15932
+ const expiryB = chunkZIRFXBKL_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
15933
15933
  if (expiryA !== expiryB) {
15934
15934
  return expiryA - expiryB;
15935
15935
  }
@@ -16189,7 +16189,7 @@ var MessageBus = class {
16189
16189
  this.initialized = true;
16190
16190
  }
16191
16191
  async buildServices(config) {
16192
- const arkProvider = new chunkG552MISJ_cjs.RestArkProvider(config.arkServer.url);
16192
+ const arkProvider = new chunkZIRFXBKL_cjs.RestArkProvider(config.arkServer.url);
16193
16193
  const storage = {
16194
16194
  walletRepository: this.walletRepository,
16195
16195
  contractRepository: this.contractRepository,
@@ -16531,7 +16531,7 @@ var offboardNetworkNames = [
16531
16531
  function offboardDestinationScript(destinationAddress) {
16532
16532
  for (const networkName of offboardNetworkNames) {
16533
16533
  try {
16534
- const network = chunkG552MISJ_cjs.networks[networkName];
16534
+ const network = chunkZIRFXBKL_cjs.networks[networkName];
16535
16535
  const addr = btcSigner.Address(network).decode(destinationAddress);
16536
16536
  return btcSigner.OutScript.encode(addr);
16537
16537
  } catch {
@@ -16595,7 +16595,7 @@ var Ramps = class {
16595
16595
  }
16596
16596
  amount = amount ?? totalAmount;
16597
16597
  const offchainAddress = await this.wallet.getAddress();
16598
- const offchainAddr = chunkG552MISJ_cjs.ArkAddress.decode(offchainAddress);
16598
+ const offchainAddr = chunkZIRFXBKL_cjs.ArkAddress.decode(offchainAddress);
16599
16599
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
16600
16600
  const outputFee = estimator.evalOffchainOutput({
16601
16601
  amount,
@@ -16655,7 +16655,7 @@ var Ramps = class {
16655
16655
  const filteredVtxos = [];
16656
16656
  let totalAmount = 0n;
16657
16657
  for (const vtxo of vtxos) {
16658
- const inputFee = estimator.evalOffchainInput(chunkG552MISJ_cjs.toOffchainInputFeeParams(vtxo));
16658
+ const inputFee = estimator.evalOffchainInput(chunkZIRFXBKL_cjs.toOffchainInputFeeParams(vtxo));
16659
16659
  if (inputFee.satoshis >= vtxo.value) {
16660
16660
  continue;
16661
16661
  }
@@ -17422,7 +17422,7 @@ var WalletMessageHandler = class {
17422
17422
  // Wallet methods
17423
17423
  async handleInitWallet({ payload }) {
17424
17424
  const { arkServerUrl } = payload;
17425
- this.indexerProvider = new chunkXN55B6EP_cjs.RestIndexerProvider(arkServerUrl);
17425
+ this.indexerProvider = new chunk3S3JZUEN_cjs.RestIndexerProvider(arkServerUrl);
17426
17426
  await this.onWalletInitialized();
17427
17427
  }
17428
17428
  /**
@@ -17689,17 +17689,17 @@ var WalletMessageHandler = class {
17689
17689
  throw new WalletNotInitializedError();
17690
17690
  }
17691
17691
  const allVtxos = await this.getVtxosFromRepo();
17692
- const vtxos = allVtxos.filter((v) => !chunkG552MISJ_cjs.hasTerminalSpend(v));
17692
+ const vtxos = allVtxos.filter((v) => !chunkZIRFXBKL_cjs.hasTerminalSpend(v));
17693
17693
  const dustAmount = this.readonlyWallet.dustAmount;
17694
17694
  const includeRecoverable = message.payload.filter?.withRecoverable ?? false;
17695
17695
  const filteredVtxos = includeRecoverable ? vtxos : vtxos.filter((v) => {
17696
17696
  if (dustAmount != null && isSubdust(v, dustAmount)) {
17697
17697
  return false;
17698
17698
  }
17699
- if (chunkG552MISJ_cjs.isRecoverable(v)) {
17699
+ if (chunkZIRFXBKL_cjs.isRecoverable(v)) {
17700
17700
  return false;
17701
17701
  }
17702
- if (chunkG552MISJ_cjs.isExpired(v)) {
17702
+ if (chunkZIRFXBKL_cjs.isExpired(v)) {
17703
17703
  return false;
17704
17704
  }
17705
17705
  return true;
@@ -17707,7 +17707,7 @@ var WalletMessageHandler = class {
17707
17707
  if (!message.payload.filter?.withUnrolled) {
17708
17708
  return filteredVtxos;
17709
17709
  }
17710
- return filteredVtxos.concat(allVtxos.filter((v) => chunkG552MISJ_cjs.hasTerminalSpend(v) && v.isUnrolled));
17710
+ return filteredVtxos.concat(allVtxos.filter((v) => chunkZIRFXBKL_cjs.hasTerminalSpend(v) && v.isUnrolled));
17711
17711
  }
17712
17712
  /** Tear down handler subscriptions, then delegate the full wipe to the wallet. */
17713
17713
  async clear() {
@@ -17797,7 +17797,7 @@ var WalletMessageHandler = class {
17797
17797
  if (!this.readonlyWallet) return null;
17798
17798
  const { boardingTxs, commitmentsToIgnore } = await this.readonlyWallet.getBoardingTxs();
17799
17799
  const indexerProvider = this.indexerProvider;
17800
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunkG552MISJ_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
17800
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunkZIRFXBKL_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
17801
17801
  return buildTransactionHistory(vtxos, boardingTxs, commitmentsToIgnore, resolveTxCreatedAt);
17802
17802
  }
17803
17803
  async ensureContractEventBroadcasting() {
@@ -18486,7 +18486,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18486
18486
  };
18487
18487
  try {
18488
18488
  const response = await this.sendMessage(message);
18489
- return response.payload.vtxos.map(chunkG552MISJ_cjs.normalizeVtxo);
18489
+ return response.payload.vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo);
18490
18490
  } catch (error) {
18491
18491
  throw new Error(`Failed to get vtxos: ${error}`);
18492
18492
  }
@@ -18511,7 +18511,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18511
18511
  };
18512
18512
  try {
18513
18513
  const response = await this.sendMessage(message);
18514
- return response.payload.vtxos.map(chunkG552MISJ_cjs.normalizeVtxo);
18514
+ return response.payload.vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo);
18515
18515
  } catch (error) {
18516
18516
  throw new Error(`Failed to get spendable vtxos: ${error}`);
18517
18517
  }
@@ -18642,7 +18642,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18642
18642
  };
18643
18643
  try {
18644
18644
  const response = await sendContractMessage(message);
18645
- return response.payload.vtxos.map(chunkG552MISJ_cjs.normalizeVtxo);
18645
+ return response.payload.vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo);
18646
18646
  } catch (e) {
18647
18647
  throw new Error("Failed to annotate vtxos");
18648
18648
  }
@@ -19214,7 +19214,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19214
19214
  };
19215
19215
  try {
19216
19216
  const response = await wallet.sendMessage(message);
19217
- return response.payload.vtxos.map(chunkG552MISJ_cjs.normalizeVtxo);
19217
+ return response.payload.vtxos.map(chunkZIRFXBKL_cjs.normalizeVtxo);
19218
19218
  } catch (e) {
19219
19219
  throw new Error(`Failed to get expiring vtxos: ${e}`);
19220
19220
  }
@@ -19326,12 +19326,12 @@ var OnchainWallet = class _OnchainWallet {
19326
19326
  * @returns Configured onchain wallet
19327
19327
  * @throws Error if the configured identity cannot produce a valid x-only public key
19328
19328
  */
19329
- static async create(identity, networkName = chunkG552MISJ_cjs.DEFAULT_NETWORK_NAME, provider) {
19329
+ static async create(identity, networkName = chunkZIRFXBKL_cjs.DEFAULT_NETWORK_NAME, provider) {
19330
19330
  const pubkey = await identity.xOnlyPublicKey();
19331
19331
  if (!pubkey) {
19332
19332
  throw new Error("Invalid configured public key");
19333
19333
  }
19334
- const network = chunkG552MISJ_cjs.getNetwork(networkName);
19334
+ const network = chunkZIRFXBKL_cjs.getNetwork(networkName);
19335
19335
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
19336
19336
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
19337
19337
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -19437,7 +19437,7 @@ var OnchainWallet = class _OnchainWallet {
19437
19437
  if (!inputs) {
19438
19438
  throw new Error("Fee estimation failed");
19439
19439
  }
19440
- let tx = new chunkG552MISJ_cjs.Transaction();
19440
+ let tx = new chunkZIRFXBKL_cjs.Transaction();
19441
19441
  for (const input of inputs) {
19442
19442
  tx.addInput({
19443
19443
  txid: input.txid,
@@ -19495,7 +19495,7 @@ var OnchainWallet = class _OnchainWallet {
19495
19495
  * @throws If the parent has no anchor, or funding cannot be selected/signed
19496
19496
  */
19497
19497
  async bumpAnchor(parentHex, feeRate) {
19498
- const parent = chunkG552MISJ_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
19498
+ const parent = chunkZIRFXBKL_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
19499
19499
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
19500
19500
  const child = await this.buildBumpPackage(parent, feeRate, coins);
19501
19501
  return [parent.hex, child.hex];
@@ -20260,7 +20260,7 @@ exports.BIP322 = void 0;
20260
20260
  async function sign2(message, identity, network) {
20261
20261
  const xOnlyPubKey = await identity.xOnlyPublicKey();
20262
20262
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
20263
- const toSpend = chunkG552MISJ_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
20263
+ const toSpend = chunkZIRFXBKL_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
20264
20264
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
20265
20265
  const signed = await identity.sign(toSign, [0]);
20266
20266
  signed.finalizeIdx(0);
@@ -20318,7 +20318,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
20318
20318
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
20319
20319
  return false;
20320
20320
  }
20321
- const toSpend = chunkG552MISJ_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20321
+ const toSpend = chunkZIRFXBKL_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20322
20322
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
20323
20323
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
20324
20324
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -20339,7 +20339,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
20339
20339
  }
20340
20340
  const sighashType = sigWithHash[sigWithHash.length - 1];
20341
20341
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
20342
- const toSpend = chunkG552MISJ_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20342
+ const toSpend = chunkZIRFXBKL_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20343
20343
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
20344
20344
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
20345
20345
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -20392,7 +20392,7 @@ function encodeCompactSize(n) {
20392
20392
  return buf;
20393
20393
  }
20394
20394
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
20395
- const tx = new chunkG552MISJ_cjs.Transaction({ version: 0 });
20395
+ const tx = new chunkZIRFXBKL_cjs.Transaction({ version: 0 });
20396
20396
  tx.addInput({
20397
20397
  txid: toSpend.id,
20398
20398
  index: 0,
@@ -20406,12 +20406,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
20406
20406
  });
20407
20407
  tx.addOutput({
20408
20408
  amount: 0n,
20409
- script: chunkG552MISJ_cjs.OP_RETURN_EMPTY_PKSCRIPT
20409
+ script: chunkZIRFXBKL_cjs.OP_RETURN_EMPTY_PKSCRIPT
20410
20410
  });
20411
20411
  return tx;
20412
20412
  }
20413
20413
  function craftBIP322ToSignSimple(toSpend, pkScript) {
20414
- const tx = new chunkG552MISJ_cjs.Transaction({ version: 0 });
20414
+ const tx = new chunkZIRFXBKL_cjs.Transaction({ version: 0 });
20415
20415
  tx.addInput({
20416
20416
  txid: toSpend.id,
20417
20417
  index: 0,
@@ -20423,7 +20423,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
20423
20423
  });
20424
20424
  tx.addOutput({
20425
20425
  amount: 0n,
20426
- script: chunkG552MISJ_cjs.OP_RETURN_EMPTY_PKSCRIPT
20426
+ script: chunkZIRFXBKL_cjs.OP_RETURN_EMPTY_PKSCRIPT
20427
20427
  });
20428
20428
  return tx;
20429
20429
  }
@@ -20554,7 +20554,7 @@ var RestEmulatorProvider = class {
20554
20554
  }
20555
20555
  };
20556
20556
  function finalizeVirtualTx(type, psbtBase64) {
20557
- const tx = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
20557
+ const tx = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
20558
20558
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
20559
20559
  const input = tx.getInput(0);
20560
20560
  if (!input) {
@@ -20581,14 +20581,14 @@ var ExitPathError = class extends Error {
20581
20581
  reason;
20582
20582
  };
20583
20583
  function delayWeight(sequence) {
20584
- const t = chunkG552MISJ_cjs.sequenceToTimelock(sequence);
20584
+ const t = chunkZIRFXBKL_cjs.sequenceToTimelock(sequence);
20585
20585
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
20586
20586
  }
20587
20587
  async function resolveUnilateralPath(params) {
20588
20588
  const { vtxo, scriptHex, contractRepository } = params;
20589
20589
  const contract = contractRepository ? (await contractRepository.getContracts({ script: scriptHex }))[0] : void 0;
20590
20590
  if (contract) {
20591
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
20591
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
20592
20592
  if (!handler) {
20593
20593
  throw new ExitPathError(
20594
20594
  "no-handler",
@@ -20611,12 +20611,12 @@ async function resolveUnilateralPath(params) {
20611
20611
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
20612
20612
  return { selection: paths[0], label: `${contract.type}:unilateral` };
20613
20613
  }
20614
- const decoded = chunkG552MISJ_cjs.VtxoScript.decode(vtxo.tapTree);
20614
+ const decoded = chunkZIRFXBKL_cjs.VtxoScript.decode(vtxo.tapTree);
20615
20615
  let best;
20616
20616
  for (const exit of decoded.exitPaths()) {
20617
20617
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
20618
20618
  if (!leaf) continue;
20619
- const sequence = chunkG552MISJ_cjs.timelockToSequence(exit.params.timelock);
20619
+ const sequence = chunkZIRFXBKL_cjs.timelockToSequence(exit.params.timelock);
20620
20620
  const weight = delayWeight(sequence);
20621
20621
  if (!best || weight < best.weight) {
20622
20622
  best = { selection: { leaf, sequence }, weight };
@@ -20802,14 +20802,14 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
20802
20802
  }
20803
20803
  const resolved = await resolveUnilateralPath({
20804
20804
  vtxo,
20805
- scriptHex: base.hex.encode(chunkG552MISJ_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
20805
+ scriptHex: base.hex.encode(chunkZIRFXBKL_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
20806
20806
  contractRepository: wallet.contractRepository,
20807
20807
  walletPubKeyHex: base.hex.encode(await wallet.identity.xOnlyPublicKey()),
20808
20808
  currentTime: Date.now()
20809
20809
  });
20810
20810
  const spendingLeaf = resolved.selection.leaf;
20811
20811
  const sequence = resolved.selection.sequence;
20812
- const timelock = chunkG552MISJ_cjs.sequenceToTimelock(sequence);
20812
+ const timelock = chunkZIRFXBKL_cjs.sequenceToTimelock(sequence);
20813
20813
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
20814
20814
  if (!elapsed) {
20815
20815
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -20822,7 +20822,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
20822
20822
  sequence,
20823
20823
  witnessUtxo: {
20824
20824
  amount: BigInt(vtxo.value),
20825
- script: chunkG552MISJ_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
20825
+ script: chunkZIRFXBKL_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
20826
20826
  },
20827
20827
  sighashType: btcSigner.SigHash.DEFAULT
20828
20828
  });
@@ -20832,7 +20832,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
20832
20832
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
20833
20833
  );
20834
20834
  }
20835
- const tx = new chunkG552MISJ_cjs.Transaction({ version: 2 });
20835
+ const tx = new chunkZIRFXBKL_cjs.Transaction({ version: 2 });
20836
20836
  for (const input of inputs) {
20837
20837
  tx.addInput(input);
20838
20838
  }
@@ -20899,7 +20899,7 @@ async function buildSignedSweep(params) {
20899
20899
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
20900
20900
  );
20901
20901
  }
20902
- const tx = new chunkG552MISJ_cjs.Transaction({ version: 2 });
20902
+ const tx = new chunkZIRFXBKL_cjs.Transaction({ version: 2 });
20903
20903
  tx.addInput({
20904
20904
  txid: vtxo.txid,
20905
20905
  index: vtxo.vout,
@@ -20924,7 +20924,7 @@ async function buildSignedSweep(params) {
20924
20924
  finalScriptWitness: [
20925
20925
  tapScriptSig[0][1],
20926
20926
  ...path.extraWitness,
20927
- chunkG552MISJ_cjs.scriptFromTapLeafScript(path.leaf),
20927
+ chunkZIRFXBKL_cjs.scriptFromTapLeafScript(path.leaf),
20928
20928
  btcSigner.TaprootControlBlock.encode(controlBlock)
20929
20929
  ]
20930
20930
  });
@@ -20954,7 +20954,7 @@ async function resolveFeeRate(opts) {
20954
20954
  }
20955
20955
  async function selectExitVtxos(opts) {
20956
20956
  if (!opts.vtxos) return opts.wallet.getVtxos();
20957
- const res = await chunkG552MISJ_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
20957
+ const res = await chunkZIRFXBKL_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
20958
20958
  const tapTrees = /* @__PURE__ */ new Map();
20959
20959
  const out = [];
20960
20960
  for (const vtxo of res.vtxos) {
@@ -20969,7 +20969,7 @@ async function selectExitVtxos(opts) {
20969
20969
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
20970
20970
  );
20971
20971
  }
20972
- const handler = chunkBABJ77NG_cjs.contractHandlers.get(contract.type);
20972
+ const handler = chunkPXPPZF5K_cjs.contractHandlers.get(contract.type);
20973
20973
  if (!handler) {
20974
20974
  throw new Error(`no contract handler registered for type '${contract.type}'`);
20975
20975
  }
@@ -20999,7 +20999,7 @@ async function computeExitLayout(opts, feeRate) {
20999
20999
  if (pendingNodes.length > 0) {
21000
21000
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
21001
21001
  for (const psbt of txs) {
21002
- psbts.set(chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
21002
+ psbts.set(chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
21003
21003
  }
21004
21004
  }
21005
21005
  const childVsize = Number(
@@ -21035,7 +21035,7 @@ async function computeExitLayout(opts, feeRate) {
21035
21035
  try {
21036
21036
  const resolved = await resolveUnilateralPath({
21037
21037
  vtxo,
21038
- scriptHex: base.hex.encode(chunkG552MISJ_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21038
+ scriptHex: base.hex.encode(chunkZIRFXBKL_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21039
21039
  contractRepository: wallet.contractRepository,
21040
21040
  walletPubKeyHex,
21041
21041
  currentTime: Date.now()
@@ -21054,7 +21054,7 @@ async function computeExitLayout(opts, feeRate) {
21054
21054
  });
21055
21055
  continue;
21056
21056
  }
21057
- const t = chunkG552MISJ_cjs.sequenceToTimelock(resolved.selection.sequence);
21057
+ const t = chunkZIRFXBKL_cjs.sequenceToTimelock(resolved.selection.sequence);
21058
21058
  const delay = { type: t.type, value: Number(t.value) };
21059
21059
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
21060
21060
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -21393,7 +21393,7 @@ async function prepare(opts) {
21393
21393
  txid: sweep.vtxo.txid,
21394
21394
  vout: sweep.vtxo.vout,
21395
21395
  value: sweep.vtxo.value,
21396
- pkScript: chunkG552MISJ_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
21396
+ pkScript: chunkZIRFXBKL_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
21397
21397
  },
21398
21398
  path: sweep.resolved.selection,
21399
21399
  outputAddress: opts.sweepAddress,
@@ -21478,7 +21478,7 @@ async function prepare(opts) {
21478
21478
  if (newFee <= splitterFee) break;
21479
21479
  splitterFee = newFee;
21480
21480
  }
21481
- const splitter = new chunkG552MISJ_cjs.Transaction({ version: 2 });
21481
+ const splitter = new chunkZIRFXBKL_cjs.Transaction({ version: 2 });
21482
21482
  for (const coin of selected.inputs) {
21483
21483
  splitter.addInput({
21484
21484
  txid: coin.txid,
@@ -21621,41 +21621,41 @@ var UnilateralExit = {
21621
21621
  // src/arkade/index.ts
21622
21622
  var arkade_exports = {};
21623
21623
  chunk5BLDMQED_cjs.__export(arkade_exports, {
21624
- ARKADE_OP: () => chunkBABJ77NG_cjs.ARKADE_OP,
21625
- ARKADE_OPCODES: () => chunkBABJ77NG_cjs.ARKADE_OPCODES,
21626
- ARKADE_OPCODE_NAMES: () => chunkBABJ77NG_cjs.ARKADE_OPCODE_NAMES,
21627
- ARKADE_OPCODE_VALUES: () => chunkBABJ77NG_cjs.ARKADE_OPCODE_VALUES,
21628
- ARKADE_OPS: () => chunkBABJ77NG_cjs.ARKADE_OPS,
21624
+ ARKADE_OP: () => chunkPXPPZF5K_cjs.ARKADE_OP,
21625
+ ARKADE_OPCODES: () => chunkPXPPZF5K_cjs.ARKADE_OPCODES,
21626
+ ARKADE_OPCODE_NAMES: () => chunkPXPPZF5K_cjs.ARKADE_OPCODE_NAMES,
21627
+ ARKADE_OPCODE_VALUES: () => chunkPXPPZF5K_cjs.ARKADE_OPCODE_VALUES,
21628
+ ARKADE_OPS: () => chunkPXPPZF5K_cjs.ARKADE_OPS,
21629
21629
  Arkade: () => Arkade,
21630
21630
  ArkadeContract: () => ArkadeContract,
21631
- ArkadeProgramScript: () => chunkBABJ77NG_cjs.ArkadeProgramScript,
21632
- ArkadeScript: () => chunkBABJ77NG_cjs.ArkadeScript,
21631
+ ArkadeProgramScript: () => chunkPXPPZF5K_cjs.ArkadeProgramScript,
21632
+ ArkadeScript: () => chunkPXPPZF5K_cjs.ArkadeScript,
21633
21633
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
21634
- BigNum: () => chunkBABJ77NG_cjs.bignum_exports,
21634
+ BigNum: () => chunkPXPPZF5K_cjs.bignum_exports,
21635
21635
  OP: () => btcSigner.OP,
21636
- OPCODE_NAMES: () => chunkBABJ77NG_cjs.OPCODE_NAMES,
21637
- OPCODE_VALUES: () => chunkBABJ77NG_cjs.OPCODE_VALUES,
21638
- SUPPORTED_PROGRAM_VERSION: () => chunkBABJ77NG_cjs.SUPPORTED_PROGRAM_VERSION,
21636
+ OPCODE_NAMES: () => chunkPXPPZF5K_cjs.OPCODE_NAMES,
21637
+ OPCODE_VALUES: () => chunkPXPPZF5K_cjs.OPCODE_VALUES,
21638
+ SUPPORTED_PROGRAM_VERSION: () => chunkPXPPZF5K_cjs.SUPPORTED_PROGRAM_VERSION,
21639
21639
  Script: () => btcSigner.Script,
21640
- arkadeScriptHash: () => chunkBABJ77NG_cjs.arkadeScriptHash,
21641
- arkadeWitnessHash: () => chunkBABJ77NG_cjs.arkadeWitnessHash,
21642
- asmToBytes: () => chunkBABJ77NG_cjs.asmToBytes,
21643
- bytesToASM: () => chunkBABJ77NG_cjs.bytesToASM,
21644
- computeArkadeScriptPublicKey: () => chunkBABJ77NG_cjs.computeArkadeScriptPublicKey,
21640
+ arkadeScriptHash: () => chunkPXPPZF5K_cjs.arkadeScriptHash,
21641
+ arkadeWitnessHash: () => chunkPXPPZF5K_cjs.arkadeWitnessHash,
21642
+ asmToBytes: () => chunkPXPPZF5K_cjs.asmToBytes,
21643
+ bytesToASM: () => chunkPXPPZF5K_cjs.bytesToASM,
21644
+ computeArkadeScriptPublicKey: () => chunkPXPPZF5K_cjs.computeArkadeScriptPublicKey,
21645
21645
  createArkadeBatchHandler: () => createArkadeBatchHandler,
21646
- deserializeArkadeContractParams: () => chunkBABJ77NG_cjs.deserializeArkadeContractParams,
21647
- fromASM: () => chunkBABJ77NG_cjs.fromASM,
21648
- getOpcodeName: () => chunkBABJ77NG_cjs.getOpcodeName,
21649
- getOpcodeValue: () => chunkBABJ77NG_cjs.getOpcodeValue,
21650
- parseArtifact: () => chunkBABJ77NG_cjs.parseArtifact,
21651
- resolveAsm: () => chunkBABJ77NG_cjs.resolveAsm,
21652
- serializeArkadeContractParams: () => chunkBABJ77NG_cjs.serializeArkadeContractParams,
21653
- stringifyArtifact: () => chunkBABJ77NG_cjs.stringifyArtifact,
21654
- toASM: () => chunkBABJ77NG_cjs.toASM,
21655
- validateProgram: () => chunkBABJ77NG_cjs.validateProgram,
21656
- witnessRefToBytes: () => chunkBABJ77NG_cjs.witnessRefToBytes
21646
+ deserializeArkadeContractParams: () => chunkPXPPZF5K_cjs.deserializeArkadeContractParams,
21647
+ fromASM: () => chunkPXPPZF5K_cjs.fromASM,
21648
+ getOpcodeName: () => chunkPXPPZF5K_cjs.getOpcodeName,
21649
+ getOpcodeValue: () => chunkPXPPZF5K_cjs.getOpcodeValue,
21650
+ parseArtifact: () => chunkPXPPZF5K_cjs.parseArtifact,
21651
+ resolveAsm: () => chunkPXPPZF5K_cjs.resolveAsm,
21652
+ serializeArkadeContractParams: () => chunkPXPPZF5K_cjs.serializeArkadeContractParams,
21653
+ stringifyArtifact: () => chunkPXPPZF5K_cjs.stringifyArtifact,
21654
+ toASM: () => chunkPXPPZF5K_cjs.toASM,
21655
+ validateProgram: () => chunkPXPPZF5K_cjs.validateProgram,
21656
+ witnessRefToBytes: () => chunkPXPPZF5K_cjs.witnessRefToBytes
21657
21657
  });
21658
- var isVtxoCoin = (input) => chunkG552MISJ_cjs.isVirtualCoin(input);
21658
+ var isVtxoCoin = (input) => chunkZIRFXBKL_cjs.isVirtualCoin(input);
21659
21659
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
21660
21660
  let batchId;
21661
21661
  let sweepTapTreeRoot;
@@ -21676,21 +21676,23 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
21676
21676
  );
21677
21677
  await arkProvider.confirmRegistration(intentId);
21678
21678
  batchId = event.id;
21679
- const sweepTapscript = chunkG552MISJ_cjs.CSVMultisigTapscript.encode({
21679
+ const sweepTapscript = chunkZIRFXBKL_cjs.CSVMultisigTapscript.encode({
21680
21680
  timelock,
21681
- pubkeys: [base.hex.decode(info.forfeitPubkey).subarray(1)]
21681
+ pubkeys: [chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
21682
21682
  }).script;
21683
21683
  sweepTapTreeRoot = payment_js.tapLeafHash(sweepTapscript);
21684
21684
  return { skip: false };
21685
21685
  },
21686
21686
  onTreeSigningStarted: async (event, vtxoTree) => {
21687
21687
  const signerPubKey = await session.getPublicKey();
21688
- const xonlySignerPubKey = signerPubKey.subarray(1);
21689
- const xOnlyPubkeys = event.cosignersPublicKeys.map((k) => k.slice(2));
21688
+ const xonlySignerPubKey = chunkPXPPZF5K_cjs.toXOnly(signerPubKey, "signer key");
21689
+ const xOnlyPubkeys = event.cosignersPublicKeys.map(
21690
+ (k) => base.hex.encode(chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
21691
+ );
21690
21692
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
21691
21693
  return { skip: true };
21692
21694
  }
21693
- const commitmentTx = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
21695
+ const commitmentTx = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
21694
21696
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
21695
21697
  if (recipients && recipients.length > 0) {
21696
21698
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -21722,7 +21724,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
21722
21724
  if (connectorTree) {
21723
21725
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
21724
21726
  }
21725
- let commitmentPsbt = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
21727
+ let commitmentPsbt = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
21726
21728
  assertFinalCommitmentMatchesValidated(
21727
21729
  commitmentPsbt,
21728
21730
  validatedCommitmentTxid,
@@ -21757,7 +21759,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
21757
21759
  boardingIndices.push(boardingIdx);
21758
21760
  continue;
21759
21761
  }
21760
- if (chunkG552MISJ_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
21762
+ if (chunkZIRFXBKL_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
21761
21763
  continue;
21762
21764
  }
21763
21765
  if (connectorIndex >= connectorLeaves.length) {
@@ -21778,7 +21780,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
21778
21780
  index: input.vout,
21779
21781
  witnessUtxo: {
21780
21782
  amount: BigInt(input.value),
21781
- script: chunkG552MISJ_cjs.VtxoScript.decode(input.tapTree).pkScript
21783
+ script: chunkZIRFXBKL_cjs.VtxoScript.decode(input.tapTree).pkScript
21782
21784
  },
21783
21785
  sighashType: btcSigner.SigHash.DEFAULT,
21784
21786
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -21869,17 +21871,16 @@ var Arkade = class _Arkade {
21869
21871
  /** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
21870
21872
  static async connect(opts) {
21871
21873
  const info = await opts.arkade.getInfo();
21872
- const serverKey = base.hex.decode(info.signerPubkey).slice(1);
21873
- const checkpoint = chunkG552MISJ_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
21874
- const network = opts.network ?? chunkG552MISJ_cjs.DEFAULT_NETWORK;
21874
+ const serverKey = chunkPXPPZF5K_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
21875
+ const checkpoint = chunkZIRFXBKL_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
21876
+ const network = opts.network ?? chunkZIRFXBKL_cjs.DEFAULT_NETWORK;
21875
21877
  let emulatorKey;
21876
21878
  if (opts.emulator) {
21877
- emulatorKey = base.hex.decode(chunkG552MISJ_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
21879
+ emulatorKey = base.hex.decode(chunkZIRFXBKL_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
21878
21880
  }
21879
21881
  let userKey;
21880
21882
  if (opts.identity) {
21881
- const pub = await opts.identity.xOnlyPublicKey();
21882
- userKey = pub.length === 33 ? pub.slice(1) : pub;
21883
+ userKey = chunkPXPPZF5K_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
21883
21884
  }
21884
21885
  return new _Arkade({
21885
21886
  arkProvider: opts.arkade,
@@ -21905,7 +21906,7 @@ var Arkade = class _Arkade {
21905
21906
  * key respectively; explicit args always win.
21906
21907
  */
21907
21908
  contract(program, args = {}) {
21908
- const declared = (program.params ?? []).map(chunkBABJ77NG_cjs.inputName);
21909
+ const declared = (program.params ?? []).map(chunkPXPPZF5K_cjs.inputName);
21909
21910
  if (declared.includes("server") && args.server === void 0) {
21910
21911
  args = { ...args, server: this.serverKey };
21911
21912
  }
@@ -21925,7 +21926,7 @@ var ArkadeContract = class _ArkadeContract {
21925
21926
  userKey: client.userKey,
21926
21927
  emulatorKey: client.emulatorKey
21927
21928
  };
21928
- this.vtxoScript = new chunkBABJ77NG_cjs.ArkadeProgramScript(program, args, this.keys);
21929
+ this.vtxoScript = new chunkPXPPZF5K_cjs.ArkadeProgramScript(program, args, this.keys);
21929
21930
  this.tapTree = this.vtxoScript.encode();
21930
21931
  this.compiled = this.vtxoScript.compiled;
21931
21932
  }
@@ -21953,7 +21954,7 @@ var ArkadeContract = class _ArkadeContract {
21953
21954
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
21954
21955
  );
21955
21956
  }
21956
- const typed = chunkBABJ77NG_cjs.deserializeArkadeContractParams(contract.params);
21957
+ const typed = chunkPXPPZF5K_cjs.deserializeArkadeContractParams(contract.params);
21957
21958
  return new _ArkadeContract(client, typed.program, typed.args, {
21958
21959
  serverKey: typed.serverKey,
21959
21960
  userKey: typed.userKey,
@@ -21994,7 +21995,7 @@ var ArkadeContract = class _ArkadeContract {
21994
21995
  toContractParams() {
21995
21996
  return {
21996
21997
  type: "arkade",
21997
- params: chunkBABJ77NG_cjs.serializeArkadeContractParams({
21998
+ params: chunkPXPPZF5K_cjs.serializeArkadeContractParams({
21998
21999
  program: this.program,
21999
22000
  args: this.args,
22000
22001
  serverKey: this.keys.serverKey,
@@ -22039,13 +22040,13 @@ var ArkadeContract = class _ArkadeContract {
22039
22040
  const [registered] = await manager.getContracts({ script: scriptHex });
22040
22041
  if (registered) {
22041
22042
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
22042
- return (withVtxos?.vtxos ?? []).filter((v) => !chunkG552MISJ_cjs.hasTerminalSpend(v));
22043
+ return (withVtxos?.vtxos ?? []).filter((v) => !chunkZIRFXBKL_cjs.hasTerminalSpend(v));
22043
22044
  }
22044
22045
  }
22045
22046
  if (!this.client.indexer) {
22046
22047
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
22047
22048
  }
22048
- const { vtxos } = await chunkG552MISJ_cjs.getNormalizedVtxos(this.client.indexer, {
22049
+ const { vtxos } = await chunkZIRFXBKL_cjs.getNormalizedVtxos(this.client.indexer, {
22049
22050
  scripts: [scriptHex],
22050
22051
  spendableOnly: true
22051
22052
  });
@@ -22147,12 +22148,12 @@ var ArkadeTransactionBuilder = class {
22147
22148
  this.contract.client.checkpoint
22148
22149
  );
22149
22150
  if (coin.sourceTx) {
22150
- chunkG552MISJ_cjs.setArkPsbtField(arkTx, 0, chunkG552MISJ_cjs.PrevArkTxField, coin.sourceTx);
22151
+ chunkZIRFXBKL_cjs.setArkPsbtField(arkTx, 0, chunkZIRFXBKL_cjs.PrevArkTxField, coin.sourceTx);
22151
22152
  }
22152
22153
  const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
22153
22154
  if (condition.length > 0) {
22154
- chunkG552MISJ_cjs.setArkPsbtField(arkTx, 0, chunkG552MISJ_cjs.ConditionWitness, condition);
22155
- chunkG552MISJ_cjs.setArkPsbtField(checkpoints[0], 0, chunkG552MISJ_cjs.ConditionWitness, condition);
22155
+ chunkZIRFXBKL_cjs.setArkPsbtField(arkTx, 0, chunkZIRFXBKL_cjs.ConditionWitness, condition);
22156
+ chunkZIRFXBKL_cjs.setArkPsbtField(checkpoints[0], 0, chunkZIRFXBKL_cjs.ConditionWitness, condition);
22156
22157
  }
22157
22158
  const packets = [];
22158
22159
  if (this.assetSpecs.length > 0) {
@@ -22191,7 +22192,7 @@ var ArkadeTransactionBuilder = class {
22191
22192
  base.base64.encode(signedArk2.toPSBT()),
22192
22193
  signedCps.map((c) => base.base64.encode(c.toPSBT()))
22193
22194
  );
22194
- const txid = chunkG552MISJ_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
22195
+ const txid = chunkZIRFXBKL_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
22195
22196
  return {
22196
22197
  txid,
22197
22198
  signedArkTx: res2.signedArkTx,
@@ -22250,23 +22251,23 @@ var ArkadeTransactionBuilder = class {
22250
22251
  }
22251
22252
  buildAssetPacket() {
22252
22253
  const groups = this.assetSpecs.map((s) => {
22253
- const id = typeof s.assetId === "string" ? chunkXN55B6EP_cjs.AssetId.fromString(s.assetId) : chunkXN55B6EP_cjs.AssetId.fromBytes(s.assetId);
22254
- return chunkXN55B6EP_cjs.AssetGroup.create(
22254
+ const id = typeof s.assetId === "string" ? chunk3S3JZUEN_cjs.AssetId.fromString(s.assetId) : chunk3S3JZUEN_cjs.AssetId.fromBytes(s.assetId);
22255
+ return chunk3S3JZUEN_cjs.AssetGroup.create(
22255
22256
  id,
22256
22257
  null,
22257
- s.inputs.map((i) => chunkXN55B6EP_cjs.AssetInput.create(i.vin, i.amount)),
22258
- s.outputs.map((o) => chunkXN55B6EP_cjs.AssetOutput.create(o.vout, o.amount)),
22259
- (s.metadata ?? []).map((m) => chunkXN55B6EP_cjs.Metadata.create(m.key, m.value))
22258
+ s.inputs.map((i) => chunk3S3JZUEN_cjs.AssetInput.create(i.vin, i.amount)),
22259
+ s.outputs.map((o) => chunk3S3JZUEN_cjs.AssetOutput.create(o.vout, o.amount)),
22260
+ (s.metadata ?? []).map((m) => chunk3S3JZUEN_cjs.Metadata.create(m.key, m.value))
22260
22261
  );
22261
22262
  });
22262
- return chunkXN55B6EP_cjs.Packet.create(groups);
22263
+ return chunk3S3JZUEN_cjs.Packet.create(groups);
22263
22264
  }
22264
22265
  witnessBytes(ref) {
22265
- return chunkBABJ77NG_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
22266
+ return chunkPXPPZF5K_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
22266
22267
  }
22267
22268
  };
22268
22269
  function bindInputs(fn, callArgs) {
22269
- const names = (fn.def.inputs ?? []).map(chunkBABJ77NG_cjs.inputName);
22270
+ const names = (fn.def.inputs ?? []).map(chunkPXPPZF5K_cjs.inputName);
22270
22271
  if (callArgs.length !== names.length) {
22271
22272
  throw new Error(`${fn.name}: expected ${names.length} argument(s), got ${callArgs.length}`);
22272
22273
  }
@@ -22860,5 +22861,5 @@ exports.validateVtxoTxGraph = validateVtxoTxGraph;
22860
22861
  exports.verifyTapscriptSignatures = verifyTapscriptSignatures;
22861
22862
  exports.waitForIncomingFunds = waitForIncomingFunds;
22862
22863
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
22863
- //# sourceMappingURL=chunk-GFZNEMGL.cjs.map
22864
- //# sourceMappingURL=chunk-GFZNEMGL.cjs.map
22864
+ //# sourceMappingURL=chunk-5E6IZNRG.cjs.map
22865
+ //# sourceMappingURL=chunk-5E6IZNRG.cjs.map