@arkade-os/sdk 0.4.70 → 0.4.71

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 (73) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/adapters/indexedDB.cjs +5 -5
  6. package/dist/adapters/indexedDB.js +4 -4
  7. package/dist/{asyncStorageTaskQueue-BgUJN-3X.d.ts → asyncStorageTaskQueue-CjKAUiuj.d.ts} +2 -2
  8. package/dist/{asyncStorageTaskQueue-Cstx6hS7.d.cts → asyncStorageTaskQueue-DgXf4iuU.d.cts} +2 -2
  9. package/dist/{chunk-TXSF2DKX.js → chunk-2ZX4Z2IP.js} +3 -3
  10. package/dist/{chunk-TXSF2DKX.js.map → chunk-2ZX4Z2IP.js.map} +1 -1
  11. package/dist/{chunk-57636V35.cjs → chunk-5J5PDZRR.cjs} +3 -3
  12. package/dist/{chunk-57636V35.cjs.map → chunk-5J5PDZRR.cjs.map} +1 -1
  13. package/dist/{chunk-B73Q75IL.cjs → chunk-7PHMT3T4.cjs} +10 -10
  14. package/dist/{chunk-B73Q75IL.cjs.map → chunk-7PHMT3T4.cjs.map} +1 -1
  15. package/dist/{chunk-6UM55KPZ.js → chunk-ALZ2CZ3T.js} +3 -3
  16. package/dist/{chunk-6UM55KPZ.js.map → chunk-ALZ2CZ3T.js.map} +1 -1
  17. package/dist/{chunk-JVHO6XHG.js → chunk-E5JNYFOF.js} +272 -31
  18. package/dist/chunk-E5JNYFOF.js.map +1 -0
  19. package/dist/{chunk-3KW4TWP2.cjs → chunk-FM263GKH.cjs} +17 -17
  20. package/dist/{chunk-3KW4TWP2.cjs.map → chunk-FM263GKH.cjs.map} +1 -1
  21. package/dist/{chunk-JJ7AXR4O.cjs → chunk-I7ZNWBBU.cjs} +17 -17
  22. package/dist/{chunk-JJ7AXR4O.cjs.map → chunk-I7ZNWBBU.cjs.map} +1 -1
  23. package/dist/{chunk-XTCOSZ34.cjs → chunk-MK5EPTTB.cjs} +704 -462
  24. package/dist/chunk-MK5EPTTB.cjs.map +1 -0
  25. package/dist/{chunk-IUFTICRY.js → chunk-NOWVA5CM.js} +4 -4
  26. package/dist/{chunk-IUFTICRY.js.map → chunk-NOWVA5CM.js.map} +1 -1
  27. package/dist/{chunk-3OKEUDHU.cjs → chunk-P6EXRY5L.cjs} +49 -49
  28. package/dist/{chunk-3OKEUDHU.cjs.map → chunk-P6EXRY5L.cjs.map} +1 -1
  29. package/dist/{chunk-UG3EZDLF.js → chunk-SCSLCU66.js} +4 -4
  30. package/dist/{chunk-UG3EZDLF.js.map → chunk-SCSLCU66.js.map} +1 -1
  31. package/dist/{chunk-F5E7LI6G.js → chunk-ZT3EM4CE.js} +3 -3
  32. package/dist/{chunk-F5E7LI6G.js.map → chunk-ZT3EM4CE.js.map} +1 -1
  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-BPdzTbwN.d.ts → delegate-CKJdsC99.d.ts} +1 -1
  38. package/dist/{delegate-DrwIar11.d.cts → delegate-D-gEEqrP.d.cts} +1 -1
  39. package/dist/{hdWalletCapable-DyxCiNVE.d.ts → hdWalletCapable-BJ4pvkai.d.ts} +2 -2
  40. package/dist/{hdWalletCapable-D4WH35z0.d.cts → hdWalletCapable-CwLPmWct.d.cts} +2 -2
  41. package/dist/{index-BqhpAqqj.d.cts → index-BE1uFXrV.d.cts} +2 -2
  42. package/dist/{index-TZJvbIaA.d.ts → index-Boppyqav.d.ts} +2 -2
  43. package/dist/{index-dWRqYSdS.d.ts → index-CyGnhCSS.d.cts} +98 -2
  44. package/dist/{index-dWRqYSdS.d.cts → index-CyGnhCSS.d.ts} +98 -2
  45. package/dist/index.cjs +301 -297
  46. package/dist/index.d.cts +46 -11
  47. package/dist/index.d.ts +46 -11
  48. package/dist/index.js +4 -4
  49. package/dist/repositories/realm/index.cjs +19 -19
  50. package/dist/repositories/realm/index.d.cts +2 -2
  51. package/dist/repositories/realm/index.d.ts +2 -2
  52. package/dist/repositories/realm/index.js +5 -5
  53. package/dist/repositories/sqlite/index.cjs +18 -18
  54. package/dist/repositories/sqlite/index.d.cts +2 -2
  55. package/dist/repositories/sqlite/index.d.ts +2 -2
  56. package/dist/repositories/sqlite/index.js +5 -5
  57. package/dist/{taskRunner-CzYKyJ9c.d.cts → taskRunner-CjmMH_rW.d.cts} +2 -2
  58. package/dist/{taskRunner-D2fnbqYw.d.ts → taskRunner-l3zyfW_Q.d.ts} +2 -2
  59. package/dist/wallet/expo/background.cjs +14 -14
  60. package/dist/wallet/expo/background.d.cts +3 -3
  61. package/dist/wallet/expo/background.d.ts +3 -3
  62. package/dist/wallet/expo/background.js +6 -6
  63. package/dist/wallet/expo/index.cjs +14 -14
  64. package/dist/wallet/expo/index.d.cts +4 -4
  65. package/dist/wallet/expo/index.d.ts +4 -4
  66. package/dist/wallet/expo/index.js +5 -5
  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-JVHO6XHG.js.map +0 -1
  73. package/dist/chunk-XTCOSZ34.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk3KW4TWP2_cjs = require('./chunk-3KW4TWP2.cjs');
4
- var chunk3OKEUDHU_cjs = require('./chunk-3OKEUDHU.cjs');
5
- var chunk57636V35_cjs = require('./chunk-57636V35.cjs');
3
+ var chunkFM263GKH_cjs = require('./chunk-FM263GKH.cjs');
4
+ var chunkP6EXRY5L_cjs = require('./chunk-P6EXRY5L.cjs');
5
+ var chunk5J5PDZRR_cjs = require('./chunk-5J5PDZRR.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 = chunk57636V35_cjs.getArkPsbtFields(tx.root, 0, chunk57636V35_cjs.CosignerPublicKey).map(
191
+ const cosigners = chunk5J5PDZRR_cjs.getArkPsbtFields(tx.root, 0, chunk5J5PDZRR_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 = chunk57636V35_cjs.getArkPsbtFields(g.root, 0, chunk57636V35_cjs.CosignerPublicKey).map((c) => c.key);
243
+ const cosigners = chunk5J5PDZRR_cjs.getArkPsbtFields(g.root, 0, chunk5J5PDZRR_cjs.CosignerPublicKey).map((c) => c.key);
244
244
  const { finalKey } = aggregateKeys(cosigners, true, {
245
245
  taprootTweak: this.scriptRoot
246
246
  });
@@ -323,7 +323,7 @@ var SingleKey = class _SingleKey {
323
323
  async sign(tx, inputIndexes) {
324
324
  const txCpy = tx.clone();
325
325
  if (!inputIndexes) {
326
- chunk57636V35_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
326
+ chunk5J5PDZRR_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
327
327
  try {
328
328
  if (!txCpy.sign(this.key, ALLOWED_SIGHASH)) {
329
329
  throw new Error("Failed to sign transaction");
@@ -432,7 +432,7 @@ var SeedIdentity = class _SeedIdentity {
432
432
  let network;
433
433
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
434
434
  descriptor = opts.descriptor;
435
- network = chunk3OKEUDHU_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
435
+ network = chunkP6EXRY5L_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
436
436
  } else {
437
437
  network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
438
438
  descriptor = descriptorsScure.scriptExpressions.trBIP32({
@@ -530,7 +530,7 @@ var SeedIdentity = class _SeedIdentity {
530
530
  * `StaticDescriptorProvider` for legacy single-key wallets.
531
531
  */
532
532
  isOurs(descriptor) {
533
- return chunk3OKEUDHU_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
533
+ return chunkP6EXRY5L_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
534
534
  }
535
535
  /**
536
536
  * Signs each request with the key derived from its descriptor.
@@ -579,7 +579,7 @@ var SeedIdentity = class _SeedIdentity {
579
579
  }
580
580
  // ── internal helpers ─────────────────────────────────────────────
581
581
  derivePrivateKeyForDescriptor(descriptor) {
582
- const network = chunk3OKEUDHU_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
582
+ const network = chunkP6EXRY5L_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
583
583
  const expansion = descriptorsScure.expand({ descriptor, network });
584
584
  if (expansion.isRanged) {
585
585
  throw new Error(
@@ -604,7 +604,7 @@ var SeedIdentity = class _SeedIdentity {
604
604
  signTxWithKey(tx, key, inputIndexes) {
605
605
  const txCpy = tx.clone();
606
606
  if (!inputIndexes) {
607
- chunk57636V35_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
607
+ chunk5J5PDZRR_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
608
608
  try {
609
609
  if (!txCpy.sign(key, ALLOWED_SIGHASH2)) {
610
610
  throw new Error("Failed to sign transaction");
@@ -666,7 +666,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
666
666
  */
667
667
  descriptor;
668
668
  constructor(descriptor) {
669
- const network = chunk3OKEUDHU_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
669
+ const network = chunkP6EXRY5L_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
670
670
  let expansion;
671
671
  try {
672
672
  expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
@@ -716,7 +716,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
716
716
  * `StaticDescriptorProvider` for legacy single-key wallets.
717
717
  */
718
718
  isOurs(descriptor) {
719
- return chunk3OKEUDHU_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
719
+ return chunkP6EXRY5L_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
720
720
  }
721
721
  };
722
722
  function serializeSeedOwnedSigningIdentity(identity) {
@@ -878,10 +878,10 @@ var DescriptorIdentity = class {
878
878
  this.base = base;
879
879
  }
880
880
  async xOnlyPublicKey() {
881
- return chunk3OKEUDHU_cjs.deriveDescriptorLeafPubKey(this.descriptor);
881
+ return chunkP6EXRY5L_cjs.deriveDescriptorLeafPubKey(this.descriptor);
882
882
  }
883
883
  async compressedPublicKey() {
884
- return chunk3OKEUDHU_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
884
+ return chunkP6EXRY5L_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
885
885
  }
886
886
  async sign(tx, inputIndexes) {
887
887
  const [signed] = await this.signer.signWithDescriptor([
@@ -949,12 +949,12 @@ var WalletCannotAllocateAddressError = class extends Error {
949
949
  };
950
950
  async function resolveDescriptorSigner(descriptor, identity, provider) {
951
951
  const owner = provider?.isOurs(descriptor) ? provider : isHDCapableIdentity(identity) && identity.isOurs(descriptor) ? identity : void 0;
952
- if (owner && chunk3OKEUDHU_cjs.parseHDDescriptor(descriptor)) {
952
+ if (owner && chunkP6EXRY5L_cjs.parseHDDescriptor(descriptor)) {
953
953
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
954
954
  }
955
955
  let key;
956
956
  try {
957
- key = chunk3OKEUDHU_cjs.deriveDescriptorLeafPubKey(descriptor);
957
+ key = chunkP6EXRY5L_cjs.deriveDescriptorLeafPubKey(descriptor);
958
958
  } catch {
959
959
  throw new ForeignDescriptorError(descriptor);
960
960
  }
@@ -1329,14 +1329,14 @@ function buildSaltedPreimageMessage(xonly, salt) {
1329
1329
  }
1330
1330
  var PREIMAGE_INDEX = 0;
1331
1331
  function isPerArtifactDescriptor(descriptor) {
1332
- return chunk3OKEUDHU_cjs.parseHDDescriptor(descriptor) !== null;
1332
+ return chunkP6EXRY5L_cjs.parseHDDescriptor(descriptor) !== null;
1333
1333
  }
1334
1334
  async function provisionDescriptor(wallet) {
1335
1335
  const allocated = isHDAllocationCapable(wallet) ? await wallet.getNextSigningDescriptor() : void 0;
1336
- return allocated ?? await chunk3OKEUDHU_cjs.identityDescriptor(wallet.identity);
1336
+ return allocated ?? await chunkP6EXRY5L_cjs.identityDescriptor(wallet.identity);
1337
1337
  }
1338
1338
  async function provisionRefundKey(wallet) {
1339
- const descriptor = await chunk3OKEUDHU_cjs.identityDescriptor(wallet.identity);
1339
+ const descriptor = await chunkP6EXRY5L_cjs.identityDescriptor(wallet.identity);
1340
1340
  const signer = await contractSigner(wallet, descriptor);
1341
1341
  const pubkey = await signer.xOnlyPublicKey();
1342
1342
  const identityPubkey = await wallet.identity.xOnlyPublicKey();
@@ -1346,7 +1346,7 @@ async function provisionRefundKey(wallet) {
1346
1346
  );
1347
1347
  }
1348
1348
  const address = await wallet.getAddress();
1349
- const { pkScript } = chunk57636V35_cjs.ArkAddress.decode(address);
1349
+ const { pkScript } = chunk5J5PDZRR_cjs.ArkAddress.decode(address);
1350
1350
  return { descriptor, pubkey, pkScript, address };
1351
1351
  }
1352
1352
  async function provisionClaimSecret(wallet, opts = {}) {
@@ -1392,7 +1392,7 @@ async function contractSigner(wallet, descriptor) {
1392
1392
  const signer = isHDWalletCapable(wallet) ? await wallet.signerForDescriptor(descriptor) : wallet.identity;
1393
1393
  let expected;
1394
1394
  try {
1395
- expected = chunk3OKEUDHU_cjs.deriveDescriptorLeafPubKey(descriptor);
1395
+ expected = chunkP6EXRY5L_cjs.deriveDescriptorLeafPubKey(descriptor);
1396
1396
  } catch (cause) {
1397
1397
  throw new ForeignDescriptorError(descriptor, { cause });
1398
1398
  }
@@ -1611,14 +1611,14 @@ var RestDelegateProvider = class {
1611
1611
  */
1612
1612
  async delegate(intent, forfeitTxs, options) {
1613
1613
  const url = `${this.url}/v1/delegate`;
1614
- const response = await chunk57636V35_cjs.baseFetch(url, {
1614
+ const response = await chunk5J5PDZRR_cjs.baseFetch(url, {
1615
1615
  method: "POST",
1616
1616
  headers: {
1617
1617
  "Content-Type": "application/json"
1618
1618
  },
1619
1619
  body: JSON.stringify({
1620
1620
  intent: {
1621
- message: chunk57636V35_cjs.Intent.encodeMessage(intent.message),
1621
+ message: chunk5J5PDZRR_cjs.Intent.encodeMessage(intent.message),
1622
1622
  proof: intent.proof
1623
1623
  },
1624
1624
  forfeit_txs: forfeitTxs,
@@ -1638,7 +1638,7 @@ var RestDelegateProvider = class {
1638
1638
  */
1639
1639
  async getDelegateInfo() {
1640
1640
  const url = `${this.url}/v1/delegator/info`;
1641
- const response = await chunk57636V35_cjs.rateGate.runHttp(url, () => chunk57636V35_cjs.baseFetch(url));
1641
+ const response = await chunk5J5PDZRR_cjs.rateGate.runHttp(url, () => chunk5J5PDZRR_cjs.baseFetch(url));
1642
1642
  if (!response.ok) {
1643
1643
  const errorText2 = await response.text();
1644
1644
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1663,7 +1663,7 @@ var ESPLORA_URL = {
1663
1663
  regtest: "http://localhost:3000/api"
1664
1664
  };
1665
1665
  var EsploraProvider = class {
1666
- constructor(baseUrl = ESPLORA_URL[chunk57636V35_cjs.DEFAULT_NETWORK_NAME], opts) {
1666
+ constructor(baseUrl = ESPLORA_URL[chunk5J5PDZRR_cjs.DEFAULT_NETWORK_NAME], opts) {
1667
1667
  this.baseUrl = baseUrl;
1668
1668
  this.pollingInterval = opts?.pollingInterval ?? 15e3;
1669
1669
  this.forcePolling = opts?.forcePolling ?? false;
@@ -1682,14 +1682,14 @@ var EsploraProvider = class {
1682
1682
  */
1683
1683
  addressWatches = /* @__PURE__ */ new Map();
1684
1684
  async getCoins(address) {
1685
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1685
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1686
1686
  if (!response.ok) {
1687
1687
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1688
1688
  }
1689
1689
  return response.json();
1690
1690
  }
1691
1691
  async getFeeRate() {
1692
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1692
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1693
1693
  if (response.status === 404) {
1694
1694
  return void 0;
1695
1695
  }
@@ -1710,7 +1710,7 @@ var EsploraProvider = class {
1710
1710
  }
1711
1711
  }
1712
1712
  async getTxOutspends(txid) {
1713
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1713
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1714
1714
  if (!response.ok) {
1715
1715
  const error = await response.text();
1716
1716
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -1718,7 +1718,7 @@ var EsploraProvider = class {
1718
1718
  return response.json();
1719
1719
  }
1720
1720
  async getTransactions(address) {
1721
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1721
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1722
1722
  if (!response.ok) {
1723
1723
  const error = await response.text();
1724
1724
  throw new Error(`Failed to get transactions: ${error}`);
@@ -1731,14 +1731,14 @@ var EsploraProvider = class {
1731
1731
  * usable as a change probe for the polling fallback.
1732
1732
  */
1733
1733
  async getAddressStats(address) {
1734
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1734
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1735
1735
  if (!response.ok) {
1736
1736
  throw new Error(`Failed to get address stats: ${response.statusText}`);
1737
1737
  }
1738
1738
  return response.json();
1739
1739
  }
1740
1740
  async getRawTransaction(txid) {
1741
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1741
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1742
1742
  if (!response.ok) {
1743
1743
  const error = await response.text();
1744
1744
  throw new Error(`Failed to get raw transaction ${txid}: ${error}`);
@@ -1746,7 +1746,7 @@ var EsploraProvider = class {
1746
1746
  return base.hex.decode((await response.text()).trim());
1747
1747
  }
1748
1748
  async getTxStatus(txid) {
1749
- const txresponse = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1749
+ const txresponse = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1750
1750
  if (!txresponse.ok) {
1751
1751
  throw new Error(txresponse.statusText);
1752
1752
  }
@@ -1754,7 +1754,7 @@ var EsploraProvider = class {
1754
1754
  if (!tx.status.confirmed) {
1755
1755
  return { confirmed: false };
1756
1756
  }
1757
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1757
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1758
1758
  if (!response.ok) {
1759
1759
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
1760
1760
  }
@@ -2038,9 +2038,9 @@ var EsploraProvider = class {
2038
2038
  return { subscribers, teardown, started };
2039
2039
  }
2040
2040
  async getChainTip() {
2041
- let tipBlocks = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/blocks`);
2041
+ let tipBlocks = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/blocks`);
2042
2042
  if (tipBlocks.status === 404) {
2043
- tipBlocks = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2043
+ tipBlocks = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2044
2044
  }
2045
2045
  if (!tipBlocks.ok) {
2046
2046
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
@@ -2062,7 +2062,7 @@ var EsploraProvider = class {
2062
2062
  };
2063
2063
  }
2064
2064
  async broadcastPackage(parent, child) {
2065
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2065
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2066
2066
  method: "POST",
2067
2067
  headers: {
2068
2068
  "Content-Type": "application/json"
@@ -2078,7 +2078,7 @@ var EsploraProvider = class {
2078
2078
  return result;
2079
2079
  }
2080
2080
  async broadcastTx(tx) {
2081
- const response = await chunk57636V35_cjs.baseFetch(`${this.baseUrl}/tx`, {
2081
+ const response = await chunk5J5PDZRR_cjs.baseFetch(`${this.baseUrl}/tx`, {
2082
2082
  method: "POST",
2083
2083
  headers: {
2084
2084
  "Content-Type": "text/plain"
@@ -2261,7 +2261,7 @@ function findP2AOutput(tx) {
2261
2261
  var CHILD_DUST_AMOUNT = 546;
2262
2262
  function buildAnchorChild(params) {
2263
2263
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
2264
- const child = new chunk57636V35_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2264
+ const child = new chunk5J5PDZRR_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2265
2265
  child.addInput(findP2AOutput(parent));
2266
2266
  const estimator = TxWeightEstimator.create().addP2AInput();
2267
2267
  for (const _ of fundingCoins) {
@@ -2309,7 +2309,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
2309
2309
  );
2310
2310
  }
2311
2311
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
2312
- const tx = new chunk57636V35_cjs.Transaction({
2312
+ const tx = new chunk5J5PDZRR_cjs.Transaction({
2313
2313
  version: 3,
2314
2314
  lockTime: txLocktime
2315
2315
  });
@@ -2385,7 +2385,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
2385
2385
  if (previousScriptKey.length !== 32) {
2386
2386
  throw new Error(`parent output ${childIndex} has invalid script`);
2387
2387
  }
2388
- const cosigners = chunk57636V35_cjs.getArkPsbtFields(child.root, 0, chunk57636V35_cjs.CosignerPublicKey);
2388
+ const cosigners = chunk5J5PDZRR_cjs.getArkPsbtFields(child.root, 0, chunk5J5PDZRR_cjs.CosignerPublicKey);
2389
2389
  if (cosigners.length === 0) {
2390
2390
  throw ErrMissingCosignersPublicKeys;
2391
2391
  }
@@ -2443,7 +2443,7 @@ var EmulatorPacket = class _EmulatorPacket {
2443
2443
  return new _EmulatorPacket(entries);
2444
2444
  }
2445
2445
  static fromBytes(data) {
2446
- const reader = new chunk3KW4TWP2_cjs.BufferReader(data);
2446
+ const reader = new chunkFM263GKH_cjs.BufferReader(data);
2447
2447
  const entryCount = reader.readCompactSize();
2448
2448
  const entries = [];
2449
2449
  for (let i = 0; i < entryCount; i++) {
@@ -2461,7 +2461,7 @@ var EmulatorPacket = class _EmulatorPacket {
2461
2461
  return _EmulatorPacket.PACKET_TYPE;
2462
2462
  }
2463
2463
  serialize() {
2464
- const writer = new chunk3KW4TWP2_cjs.BufferWriter();
2464
+ const writer = new chunkFM263GKH_cjs.BufferWriter();
2465
2465
  writer.writeCompactSize(this.entries.length);
2466
2466
  for (const entry of this.entries) {
2467
2467
  writer.writeUint16LE(entry.vin);
@@ -2548,7 +2548,7 @@ var Extension = class _Extension {
2548
2548
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
2549
2549
  );
2550
2550
  }
2551
- const reader = new chunk3KW4TWP2_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2551
+ const reader = new chunkFM263GKH_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2552
2552
  const packets = [];
2553
2553
  while (reader.remaining() > 0) {
2554
2554
  const packetType = reader.readByte();
@@ -2622,7 +2622,7 @@ var Extension = class _Extension {
2622
2622
  */
2623
2623
  getAssetPacket() {
2624
2624
  for (const p of this.packets) {
2625
- if (p instanceof chunk3KW4TWP2_cjs.Packet) {
2625
+ if (p instanceof chunkFM263GKH_cjs.Packet) {
2626
2626
  return p;
2627
2627
  }
2628
2628
  }
@@ -2660,8 +2660,8 @@ var Extension = class _Extension {
2660
2660
  };
2661
2661
  function parsePacket(packetType, data) {
2662
2662
  switch (packetType) {
2663
- case chunk3KW4TWP2_cjs.Packet.PACKET_TYPE:
2664
- return chunk3KW4TWP2_cjs.Packet.fromBytes(data);
2663
+ case chunkFM263GKH_cjs.Packet.PACKET_TYPE:
2664
+ return chunkFM263GKH_cjs.Packet.fromBytes(data);
2665
2665
  case EmulatorPacket.PACKET_TYPE:
2666
2666
  return EmulatorPacket.fromBytes(data);
2667
2667
  default:
@@ -2708,16 +2708,16 @@ function buildOpReturnScript(data) {
2708
2708
  }
2709
2709
  return script;
2710
2710
  }
2711
- var ErrOffchainOutputNotFound = (address) => new chunk57636V35_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2712
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunk57636V35_cjs.ServerResponseMismatchError(
2711
+ var ErrOffchainOutputNotFound = (address) => new chunk5J5PDZRR_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2712
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
2713
2713
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
2714
2714
  );
2715
- var ErrAssetGroupNotFound = (assetId) => new chunk57636V35_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2716
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunk57636V35_cjs.ServerResponseMismatchError(
2715
+ var ErrAssetGroupNotFound = (assetId) => new chunk5J5PDZRR_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2716
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
2717
2717
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
2718
2718
  );
2719
- var ErrOnchainOutputNotFound = (address) => new chunk57636V35_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2720
- var ErrUnvalidatedOffchainOutput = (address) => new chunk57636V35_cjs.ServerResponseMismatchError(
2719
+ var ErrOnchainOutputNotFound = (address) => new chunk5J5PDZRR_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2720
+ var ErrUnvalidatedOffchainOutput = (address) => new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
2721
2721
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2722
2722
  );
2723
2723
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
@@ -2726,7 +2726,7 @@ var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain ou
2726
2726
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
2727
2727
  if (!validatedCommitmentTxid) return;
2728
2728
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
2729
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
2729
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
2730
2730
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
2731
2731
  );
2732
2732
  }
@@ -2736,7 +2736,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
2736
2736
  for (const recipient of recipients) {
2737
2737
  let arkAddress;
2738
2738
  try {
2739
- arkAddress = chunk57636V35_cjs.ArkAddress.decode(recipient.address);
2739
+ arkAddress = chunk5J5PDZRR_cjs.ArkAddress.decode(recipient.address);
2740
2740
  } catch {
2741
2741
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2742
2742
  continue;
@@ -2748,7 +2748,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2748
2748
  const usedOnchainOutputs = /* @__PURE__ */ new Set();
2749
2749
  for (const recipient of recipients) {
2750
2750
  try {
2751
- chunk57636V35_cjs.ArkAddress.decode(recipient.address);
2751
+ chunk5J5PDZRR_cjs.ArkAddress.decode(recipient.address);
2752
2752
  } catch {
2753
2753
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2754
2754
  continue;
@@ -2981,7 +2981,7 @@ function assetMintResolver() {
2981
2981
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
2982
2982
  const minted = tx.assets.filter((a) => {
2983
2983
  try {
2984
- return base.hex.encode(chunk3KW4TWP2_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2984
+ return base.hex.encode(chunkFM263GKH_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2985
2985
  } catch {
2986
2986
  return false;
2987
2987
  }
@@ -3024,7 +3024,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3024
3024
  const existing = inputsByAssetId.get(asset.assetId);
3025
3025
  inputsByAssetId.set(asset.assetId, [
3026
3026
  ...existing ?? [],
3027
- chunk3KW4TWP2_cjs.AssetInput.create(inputIndex, asset.amount)
3027
+ chunkFM263GKH_cjs.AssetInput.create(inputIndex, asset.amount)
3028
3028
  ]);
3029
3029
  }
3030
3030
  }
@@ -3036,7 +3036,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3036
3036
  const existing = outputsByAssetId.get(asset.assetId);
3037
3037
  outputsByAssetId.set(asset.assetId, [
3038
3038
  ...existing ?? [],
3039
- chunk3KW4TWP2_cjs.AssetOutput.create(outputIndex, asset.amount)
3039
+ chunkFM263GKH_cjs.AssetOutput.create(outputIndex, asset.amount)
3040
3040
  ]);
3041
3041
  }
3042
3042
  }
@@ -3047,7 +3047,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3047
3047
  const existing = outputsByAssetId.get(asset.assetId);
3048
3048
  outputsByAssetId.set(asset.assetId, [
3049
3049
  ...existing ?? [],
3050
- chunk3KW4TWP2_cjs.AssetOutput.create(outputIndex, asset.amount)
3050
+ chunkFM263GKH_cjs.AssetOutput.create(outputIndex, asset.amount)
3051
3051
  ]);
3052
3052
  }
3053
3053
  }
@@ -3056,11 +3056,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3056
3056
  for (const assetIdStr of allAssetIds) {
3057
3057
  const inputs = inputsByAssetId.get(assetIdStr);
3058
3058
  const outputs = outputsByAssetId.get(assetIdStr);
3059
- const assetId = chunk3KW4TWP2_cjs.AssetId.fromString(assetIdStr);
3060
- const group = chunk3KW4TWP2_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3059
+ const assetId = chunkFM263GKH_cjs.AssetId.fromString(assetIdStr);
3060
+ const group = chunkFM263GKH_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3061
3061
  groups.push(group);
3062
3062
  }
3063
- return chunk3KW4TWP2_cjs.Packet.create(groups);
3063
+ return chunkFM263GKH_cjs.Packet.create(groups);
3064
3064
  }
3065
3065
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
3066
3066
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -3097,7 +3097,7 @@ function selectedCoinsToAssetInputs(selectedCoins) {
3097
3097
  }
3098
3098
  function toXOnlySignerHex(pubkeyHex) {
3099
3099
  const bytes = base.hex.decode(pubkeyHex);
3100
- if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunk3OKEUDHU_cjs.toXOnly(bytes, "signer key"));
3100
+ if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkP6EXRY5L_cjs.toXOnly(bytes, "signer key"));
3101
3101
  throw new Error(`invalid signer pubkey length: expected 32 or 33 bytes, got ${bytes.length}`);
3102
3102
  }
3103
3103
  function signerSetFromInfo(info) {
@@ -3144,13 +3144,13 @@ var toTimelock = (value) => ({
3144
3144
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
3145
3145
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
3146
3146
  if (policy.requireSeconds && timelock.type === "blocks") {
3147
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3147
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3148
3148
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
3149
3149
  );
3150
3150
  }
3151
3151
  const seconds = toSeconds(timelock);
3152
3152
  if (seconds < policy.minSeconds) {
3153
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3153
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3154
3154
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it`
3155
3155
  );
3156
3156
  }
@@ -3171,7 +3171,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
3171
3171
  }
3172
3172
  function assertValidBatchExpiry(batchExpiry, policy) {
3173
3173
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
3174
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3174
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3175
3175
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
3176
3176
  );
3177
3177
  }
@@ -3201,21 +3201,21 @@ function resolveCheckpointExitDelayPolicy(network, overrides) {
3201
3201
  function assertValidServerUnrollScript(checkpointTapscript, policy) {
3202
3202
  let script;
3203
3203
  try {
3204
- script = chunk57636V35_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3204
+ script = chunk5J5PDZRR_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3205
3205
  } catch (e) {
3206
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3206
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3207
3207
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
3208
3208
  );
3209
3209
  }
3210
3210
  if (policy.advertisedForfeitPubkey !== void 0) {
3211
3211
  const { pubkeys } = script.params;
3212
3212
  if (pubkeys.length !== 1) {
3213
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3213
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3214
3214
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
3215
3215
  );
3216
3216
  }
3217
3217
  if (!utils_js.equalBytes(pubkeys[0], policy.advertisedForfeitPubkey)) {
3218
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3218
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3219
3219
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(policy.advertisedForfeitPubkey)}`
3220
3220
  );
3221
3221
  }
@@ -3259,8 +3259,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
3259
3259
  function buildVirtualTx(inputs, outputs) {
3260
3260
  let lockTime = 0n;
3261
3261
  for (const input of inputs) {
3262
- const tapscript = chunk57636V35_cjs.decodeTapscript(chunk57636V35_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3263
- if (chunk57636V35_cjs.CLTVMultisigTapscript.is(tapscript)) {
3262
+ const tapscript = chunk5J5PDZRR_cjs.decodeTapscript(chunk5J5PDZRR_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3263
+ if (chunk5J5PDZRR_cjs.CLTVMultisigTapscript.is(tapscript)) {
3264
3264
  if (lockTime !== 0n) {
3265
3265
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
3266
3266
  throw new Error("cannot mix seconds and blocks locktime");
@@ -3271,7 +3271,7 @@ function buildVirtualTx(inputs, outputs) {
3271
3271
  }
3272
3272
  }
3273
3273
  }
3274
- const tx = new chunk57636V35_cjs.Transaction({
3274
+ const tx = new chunk5J5PDZRR_cjs.Transaction({
3275
3275
  version: 3,
3276
3276
  lockTime: Number(lockTime)
3277
3277
  });
@@ -3281,12 +3281,12 @@ function buildVirtualTx(inputs, outputs) {
3281
3281
  index: input.vout,
3282
3282
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
3283
3283
  witnessUtxo: {
3284
- script: chunk57636V35_cjs.VtxoScript.decode(input.tapTree).pkScript,
3284
+ script: chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).pkScript,
3285
3285
  amount: BigInt(input.value)
3286
3286
  },
3287
3287
  tapLeafScript: [input.tapLeafScript]
3288
3288
  });
3289
- chunk57636V35_cjs.setArkPsbtField(tx, i, chunk57636V35_cjs.VtxoTaprootTree, input.tapTree);
3289
+ chunk5J5PDZRR_cjs.setArkPsbtField(tx, i, chunk5J5PDZRR_cjs.VtxoTaprootTree, input.tapTree);
3290
3290
  }
3291
3291
  for (const output of outputs) {
3292
3292
  tx.addOutput(output);
@@ -3295,8 +3295,8 @@ function buildVirtualTx(inputs, outputs) {
3295
3295
  return tx;
3296
3296
  }
3297
3297
  function buildCheckpointTx(vtxo, serverUnrollScript) {
3298
- const collaborativeClosure = chunk57636V35_cjs.decodeTapscript(chunk57636V35_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3299
- const checkpointVtxoScript = new chunk57636V35_cjs.VtxoScript([
3298
+ const collaborativeClosure = chunk5J5PDZRR_cjs.decodeTapscript(chunk5J5PDZRR_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3299
+ const checkpointVtxoScript = new chunk5J5PDZRR_cjs.VtxoScript([
3300
3300
  serverUnrollScript.script,
3301
3301
  collaborativeClosure.script
3302
3302
  ]);
@@ -3372,7 +3372,7 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
3372
3372
  const sighashType = signature.length === 65 ? signature[64] : btcSigner.SigHash.DEFAULT;
3373
3373
  const sig = signature.subarray(0, 64);
3374
3374
  if (!allowedSighashTypes.includes(sighashType)) {
3375
- const sighashName = chunk57636V35_cjs.formatSighash(sighashType);
3375
+ const sighashName = chunk5J5PDZRR_cjs.formatSighash(sighashType);
3376
3376
  throw new Error(
3377
3377
  `Unallowed sighash type ${sighashName} for input ${inputIndex}, pubkey ${pubKeyHex}.`
3378
3378
  );
@@ -3446,7 +3446,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
3446
3446
  }
3447
3447
  function isValidArkAddress(address) {
3448
3448
  try {
3449
- chunk57636V35_cjs.ArkAddress.decode(address);
3449
+ chunk5J5PDZRR_cjs.ArkAddress.decode(address);
3450
3450
  return true;
3451
3451
  } catch (e) {
3452
3452
  return false;
@@ -3454,16 +3454,16 @@ function isValidArkAddress(address) {
3454
3454
  }
3455
3455
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3456
3456
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3457
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3457
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3458
3458
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3459
3459
  );
3460
3460
  }
3461
3461
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3462
3462
  return serverCheckpointTxs.map((encoded, index) => {
3463
- const server = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3463
+ const server = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3464
3464
  const local = byTxid.get(server.id);
3465
3465
  if (!local) {
3466
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3466
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3467
3467
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3468
3468
  );
3469
3469
  }
@@ -3473,14 +3473,14 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3473
3473
  }
3474
3474
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3475
3475
  if (response.arkTxid !== signedArkTx.id) {
3476
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3476
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3477
3477
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3478
3478
  );
3479
3479
  }
3480
3480
  if (response.finalArkTx === void 0) return;
3481
- const finalTxid = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3481
+ const finalTxid = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3482
3482
  if (finalTxid !== signedArkTx.id) {
3483
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3483
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3484
3484
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3485
3485
  );
3486
3486
  }
@@ -3499,10 +3499,10 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeyHex,
3499
3499
  [serverPubkeyHex],
3500
3500
  void 0,
3501
3501
  void 0,
3502
- payment_js.tapLeafHash(chunk57636V35_cjs.scriptFromTapLeafScript(leaf))
3502
+ payment_js.tapLeafHash(chunk5J5PDZRR_cjs.scriptFromTapLeafScript(leaf))
3503
3503
  );
3504
3504
  } catch (error) {
3505
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3505
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3506
3506
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
3507
3507
  );
3508
3508
  }
@@ -3511,20 +3511,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3511
3511
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
3512
3512
  for (const [index, checkpoint] of checkpoints.entries()) {
3513
3513
  if (checkpoint.inputsLength !== 1) {
3514
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3514
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3515
3515
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
3516
3516
  );
3517
3517
  }
3518
3518
  const spent = checkpoint.getInput(0);
3519
3519
  if (!spent.txid || spent.index === void 0) {
3520
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3520
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3521
3521
  `${context}: checkpoint ${index} has no input outpoint`
3522
3522
  );
3523
3523
  }
3524
3524
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
3525
3525
  const input = byOutpoint.get(outpoint);
3526
3526
  if (!input) {
3527
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3527
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3528
3528
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
3529
3529
  );
3530
3530
  }
@@ -3532,7 +3532,7 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3532
3532
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
3533
3533
  );
3534
3534
  if (!rebuilt) {
3535
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3535
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3536
3536
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
3537
3537
  );
3538
3538
  }
@@ -3558,9 +3558,9 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3558
3558
  const matched = matchServerCheckpoints(signedCheckpointTxs, offchainTx.checkpoints, "submitTx");
3559
3559
  matched.forEach(({ server }, index) => {
3560
3560
  try {
3561
- chunk57636V35_cjs.assertAllowedSighashTypes(server);
3561
+ chunk5J5PDZRR_cjs.assertAllowedSighashTypes(server);
3562
3562
  } catch (error) {
3563
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3563
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3564
3564
  `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
3565
3565
  );
3566
3566
  }
@@ -3568,12 +3568,12 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3568
3568
  const verify = options?.verifyServerSignatures;
3569
3569
  if (verify) {
3570
3570
  if (response.finalArkTx === void 0) {
3571
- throw new chunk57636V35_cjs.ServerResponseMismatchError(
3571
+ throw new chunk5J5PDZRR_cjs.ServerResponseMismatchError(
3572
3572
  "submitTx: server returned no final ark tx to verify its signatures against"
3573
3573
  );
3574
3574
  }
3575
- const finalArkTx = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3576
- const serverPubkeyHex = base.hex.encode(chunk3OKEUDHU_cjs.toXOnly(verify.serverPubkey, "server key"));
3575
+ const finalArkTx = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3576
+ const serverPubkeyHex = base.hex.encode(chunkP6EXRY5L_cjs.toXOnly(verify.serverPubkey, "server key"));
3577
3577
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
3578
3578
  assertServerSignedLeaf(
3579
3579
  finalArkTx,
@@ -3629,17 +3629,37 @@ function claimWithPreimageIdentity(identity, preimage) {
3629
3629
  return {
3630
3630
  ...identity,
3631
3631
  sign: async (tx, inputIndexes) => {
3632
- const signed = chunk57636V35_cjs.Transaction.fromPSBT(
3632
+ const signed = chunk5J5PDZRR_cjs.Transaction.fromPSBT(
3633
3633
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
3634
3634
  );
3635
3635
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
3636
3636
  for (const index of indexes) {
3637
- chunk57636V35_cjs.setArkPsbtField(signed, index, chunk57636V35_cjs.ConditionWitness, [preimage]);
3637
+ chunk5J5PDZRR_cjs.setArkPsbtField(signed, index, chunk5J5PDZRR_cjs.ConditionWitness, [preimage]);
3638
3638
  }
3639
3639
  return signed;
3640
3640
  }
3641
3641
  };
3642
3642
  }
3643
+
3644
+ // src/contracts/types.ts
3645
+ function watchStateOf(contract) {
3646
+ return contract.watch ?? "watched";
3647
+ }
3648
+ function isWatchedContract(contract) {
3649
+ return watchStateOf(contract) !== "retained";
3650
+ }
3651
+ function hasCandidates(handler) {
3652
+ return !!handler && typeof handler.candidatesAt === "function";
3653
+ }
3654
+ function isDiscoverable(handler) {
3655
+ return !!handler && typeof handler.discoverAt === "function";
3656
+ }
3657
+ function isTapscriptDeriving(handler) {
3658
+ return !!handler && typeof handler.deriveTapscripts === "function";
3659
+ }
3660
+ function isContractVtxoEvent(event) {
3661
+ return "contract" in event && event.contract !== void 0;
3662
+ }
3643
3663
  var AmountVariableName = "amount";
3644
3664
  var ExpiryVariableName = "expiry";
3645
3665
  var BirthVariableName = "birth";
@@ -3795,23 +3815,6 @@ function parseProgram(text, env) {
3795
3815
  }
3796
3816
  return { program, text };
3797
3817
  }
3798
-
3799
- // src/contracts/types.ts
3800
- function watchStateOf(contract) {
3801
- return contract.watch ?? "watched";
3802
- }
3803
- function isWatchedContract(contract) {
3804
- return watchStateOf(contract) !== "retained";
3805
- }
3806
- function hasCandidates(handler) {
3807
- return !!handler && typeof handler.candidatesAt === "function";
3808
- }
3809
- function isDiscoverable(handler) {
3810
- return !!handler && typeof handler.discoverAt === "function";
3811
- }
3812
- function isTapscriptDeriving(handler) {
3813
- return !!handler && typeof handler.deriveTapscripts === "function";
3814
- }
3815
3818
  var DUST_AMOUNT = 546;
3816
3819
  var FALLBACK_WALLET_DUST_AMOUNT = 330n;
3817
3820
  function getDustAmount(wallet) {
@@ -3826,7 +3829,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
3826
3829
  };
3827
3830
  }
3828
3831
  function deriveContractTapscripts(contract) {
3829
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
3832
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
3830
3833
  if (!handler) {
3831
3834
  throw new Error(`No handler for contract type '${contract.type}'`);
3832
3835
  }
@@ -3897,7 +3900,7 @@ function getRandomId() {
3897
3900
  }
3898
3901
  function isValidArkAddress2(address) {
3899
3902
  try {
3900
- chunk57636V35_cjs.ArkAddress.decode(address);
3903
+ chunk5J5PDZRR_cjs.ArkAddress.decode(address);
3901
3904
  return true;
3902
3905
  } catch (e) {
3903
3906
  return false;
@@ -3925,7 +3928,7 @@ function assertRecipientArkAddress(encoded, address, context) {
3925
3928
  function assertTapTreeDerivesAddress(encoded, tapTree, address) {
3926
3929
  let derived;
3927
3930
  try {
3928
- derived = chunk57636V35_cjs.VtxoScript.decode(tapTree).pkScript;
3931
+ derived = chunk5J5PDZRR_cjs.VtxoScript.decode(tapTree).pkScript;
3929
3932
  } catch (e) {
3930
3933
  throw new Error(
3931
3934
  `Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
@@ -3942,7 +3945,7 @@ function validateRecipients(recipients, dustAmount, context) {
3942
3945
  for (const recipient of recipients) {
3943
3946
  let address;
3944
3947
  try {
3945
- address = chunk57636V35_cjs.ArkAddress.decode(recipient.address);
3948
+ address = chunk5J5PDZRR_cjs.ArkAddress.decode(recipient.address);
3946
3949
  } catch (e) {
3947
3950
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
3948
3951
  }
@@ -3967,7 +3970,7 @@ function validateRecipients(recipients, dustAmount, context) {
3967
3970
 
3968
3971
  // src/contracts/spendability.ts
3969
3972
  function isContractGenericallySpendable(contract) {
3970
- return chunk3OKEUDHU_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
3973
+ return chunkP6EXRY5L_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
3971
3974
  }
3972
3975
  function gatedContracts(contracts) {
3973
3976
  const gated = /* @__PURE__ */ new Map();
@@ -3980,7 +3983,7 @@ function gateExclusion(gated) {
3980
3983
  return (vtxo) => {
3981
3984
  const type = vtxo.script === void 0 ? void 0 : gated.get(vtxo.script);
3982
3985
  if (type === void 0) return void 0;
3983
- if (!chunk3OKEUDHU_cjs.contractHandlers.has(type)) {
3986
+ if (!chunkP6EXRY5L_cjs.contractHandlers.has(type)) {
3984
3987
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
3985
3988
  }
3986
3989
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -4016,7 +4019,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
4016
4019
  continue;
4017
4020
  }
4018
4021
  for (const v of vtxos) {
4019
- if (!chunk57636V35_cjs.hasTerminalSpend(v) && !v.isSwept && !v.isUnrolled) {
4022
+ if (!chunk5J5PDZRR_cjs.hasTerminalSpend(v) && !v.isSwept && !v.isUnrolled) {
4020
4023
  out.add(`${v.txid}:${v.vout}`);
4021
4024
  }
4022
4025
  }
@@ -4051,10 +4054,10 @@ function byValueDescending(vtxos) {
4051
4054
  return [...vtxos].sort((a, b) => b.value - a.value);
4052
4055
  }
4053
4056
  async function fetchTimeHeight(wallet) {
4054
- return chunk57636V35_cjs.resolveTimeHeight(wallet.onchainProvider);
4057
+ return chunk5J5PDZRR_cjs.resolveTimeHeight(wallet.onchainProvider);
4055
4058
  }
4056
4059
  function canMigrateBySend(vtxo, now) {
4057
- if (!chunk57636V35_cjs.canSpendOffchain(vtxo, now)) return false;
4060
+ if (!chunk5J5PDZRR_cjs.canSpendOffchain(vtxo, now)) return false;
4058
4061
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
4059
4062
  }
4060
4063
  function byExpiryAscending(vtxos, now) {
@@ -4062,7 +4065,7 @@ function byExpiryAscending(vtxos, now) {
4062
4065
  if (vtxo.isSwept) return -Infinity;
4063
4066
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
4064
4067
  if (vtxo.expiresAtHeight !== void 0) {
4065
- return chunk57636V35_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4068
+ return chunk5J5PDZRR_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4066
4069
  }
4067
4070
  return Infinity;
4068
4071
  };
@@ -4089,7 +4092,7 @@ function priceSettlementInputs(vtxos, estimator) {
4089
4092
  const payable = [];
4090
4093
  const net = /* @__PURE__ */ new Map();
4091
4094
  for (const vtxo of vtxos) {
4092
- const inputFee = estimator.evalOffchainInput(chunk57636V35_cjs.toOffchainInputFeeParams(vtxo));
4095
+ const inputFee = estimator.evalOffchainInput(chunk5J5PDZRR_cjs.toOffchainInputFeeParams(vtxo));
4093
4096
  if (inputFee.satoshis >= vtxo.value) {
4094
4097
  continue;
4095
4098
  }
@@ -4115,7 +4118,7 @@ function deductOffchainOutputFee(subtotal, estimator, arkAddress) {
4115
4118
  }
4116
4119
  const outputFee = estimator.evalOffchainOutput({
4117
4120
  amount: subtotal,
4118
- script: base.hex.encode(chunk57636V35_cjs.ArkAddress.decode(arkAddress).pkScript)
4121
+ script: base.hex.encode(chunk5J5PDZRR_cjs.ArkAddress.decode(arkAddress).pkScript)
4119
4122
  });
4120
4123
  return subtotal - BigInt(outputFee.satoshis);
4121
4124
  }
@@ -4133,10 +4136,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
4133
4136
  };
4134
4137
  function getRecoverableVtxos(vtxos, dustAmount, now) {
4135
4138
  return vtxos.filter((vtxo) => {
4136
- if (chunk57636V35_cjs.canRecoverOnchain(vtxo, now)) {
4139
+ if (chunk5J5PDZRR_cjs.canRecoverOnchain(vtxo, now)) {
4137
4140
  return true;
4138
4141
  }
4139
- if (chunk57636V35_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4142
+ if (chunk5J5PDZRR_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4140
4143
  return true;
4141
4144
  }
4142
4145
  return false;
@@ -4168,7 +4171,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
4168
4171
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
4169
4172
  if (vtxo.isUnrolled) return false;
4170
4173
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
4171
- const expiresAt = chunk57636V35_cjs.normalizeVtxo(vtxo).expiresAt;
4174
+ const expiresAt = chunk5J5PDZRR_cjs.normalizeVtxo(vtxo).expiresAt;
4172
4175
  if (expiresAt === void 0) return false;
4173
4176
  const now = Date.now();
4174
4177
  const batchExpiry = expiresAt.getTime();
@@ -4179,7 +4182,7 @@ function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
4179
4182
  return vtxos.filter(
4180
4183
  // The leading exclusion covers the `isSubdust` arm too, which is a value
4181
4184
  // property and would otherwise re-admit an exited coin on its own.
4182
- (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunk57636V35_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4185
+ (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunk5J5PDZRR_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4183
4186
  );
4184
4187
  }
4185
4188
  function isMigrationCapable(wallet) {
@@ -4778,11 +4781,11 @@ var VtxoManager = class _VtxoManager {
4778
4781
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
4779
4782
  );
4780
4783
  }
4781
- const tx = new chunk57636V35_cjs.Transaction();
4784
+ const tx = new chunk5J5PDZRR_cjs.Transaction();
4782
4785
  for (const utxo of expiredUtxos) {
4783
- const utxoScript = chunk57636V35_cjs.VtxoScript.decode(utxo.tapTree);
4786
+ const utxoScript = chunk5J5PDZRR_cjs.VtxoScript.decode(utxo.tapTree);
4784
4787
  const utxoExitLeaf = utxoScript.leaves.find(
4785
- (leaf) => chunk57636V35_cjs.CSVMultisigTapscript.isScriptValid(chunk57636V35_cjs.scriptFromTapLeafScript(leaf)) === true
4788
+ (leaf) => chunk5J5PDZRR_cjs.CSVMultisigTapscript.isScriptValid(chunk5J5PDZRR_cjs.scriptFromTapLeafScript(leaf)) === true
4786
4789
  );
4787
4790
  if (!utxoExitLeaf) {
4788
4791
  throw new Error(
@@ -4797,7 +4800,7 @@ var VtxoManager = class _VtxoManager {
4797
4800
  amount: BigInt(utxo.value)
4798
4801
  },
4799
4802
  tapLeafScript: [utxoExitLeaf],
4800
- sequence: chunk57636V35_cjs.getSequence(utxoExitLeaf)
4803
+ sequence: chunk5J5PDZRR_cjs.getSequence(utxoExitLeaf)
4801
4804
  });
4802
4805
  }
4803
4806
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -5040,8 +5043,8 @@ var VtxoManager = class _VtxoManager {
5040
5043
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
5041
5044
  if (cls.status === "CURRENT") continue;
5042
5045
  const live = vtxos.filter((v) => !v.isUnrolled);
5043
- const recoverable = live.filter((v) => v.isSwept && !chunk57636V35_cjs.hasTerminalSpend(v));
5044
- const spendable = live.filter((v) => !chunk57636V35_cjs.hasTerminalSpend(v) && !v.isSwept);
5046
+ const recoverable = live.filter((v) => v.isSwept && !chunk5J5PDZRR_cjs.hasTerminalSpend(v));
5047
+ const spendable = live.filter((v) => !chunk5J5PDZRR_cjs.hasTerminalSpend(v) && !v.isSwept);
5045
5048
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
5046
5049
  let recoverableCount = 0;
5047
5050
  let recoverableValue = 0;
@@ -5054,7 +5057,7 @@ var VtxoManager = class _VtxoManager {
5054
5057
  awaitingSweepCount = spendable.length;
5055
5058
  awaitingSweepValue = value;
5056
5059
  for (const v of spendable) {
5057
- const exp = chunk57636V35_cjs.toBatchExpiry(v);
5060
+ const exp = chunk5J5PDZRR_cjs.toBatchExpiry(v);
5058
5061
  if (exp !== void 0 && (nextSweepEta === void 0 || exp < nextSweepEta)) {
5059
5062
  nextSweepEta = exp;
5060
5063
  }
@@ -5315,7 +5318,7 @@ var VtxoManager = class _VtxoManager {
5315
5318
  /** Decodes the boarding tapscript exit path to extract the CSV timelock. */
5316
5319
  getBoardingTimelock() {
5317
5320
  const wallet = this.getSweepWallet();
5318
- const exitScript = chunk57636V35_cjs.CSVMultisigTapscript.decode(
5321
+ const exitScript = chunk5J5PDZRR_cjs.CSVMultisigTapscript.decode(
5319
5322
  base.hex.decode(wallet.boardingTapscript.exitScript)
5320
5323
  );
5321
5324
  return exitScript.params.timelock;
@@ -5361,7 +5364,7 @@ var VtxoManager = class _VtxoManager {
5361
5364
  this.wallet.getAddress()
5362
5365
  ]);
5363
5366
  const stopWatching = contractManager.onContractEvent((event) => {
5364
- if (event.type !== "vtxo_received") {
5367
+ if (event.type !== "vtxo_received" || !isContractVtxoEvent(event)) {
5365
5368
  return;
5366
5369
  }
5367
5370
  const msSinceLastRenewal = Date.now() - this.lastRenewalTimestamp;
@@ -5446,8 +5449,8 @@ var VtxoManager = class _VtxoManager {
5446
5449
  * or doesn't carry the metadata.
5447
5450
  */
5448
5451
  extractSpentOutpoint(error) {
5449
- const ark = chunk57636V35_cjs.maybeArkError(error);
5450
- if (!chunk57636V35_cjs.isArkError(ark, chunk57636V35_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5452
+ const ark = chunk5J5PDZRR_cjs.maybeArkError(error);
5453
+ if (!chunk5J5PDZRR_cjs.isArkError(ark, chunk5J5PDZRR_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5451
5454
  const raw = ark.metadata?.vtxo_outpoint;
5452
5455
  if (typeof raw !== "string") return void 0;
5453
5456
  const [txid, voutStr] = raw.split(":");
@@ -5637,7 +5640,7 @@ var VtxoManager = class _VtxoManager {
5637
5640
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
5638
5641
  break;
5639
5642
  }
5640
- const inputFee = estimator.evalOffchainInput(chunk57636V35_cjs.toOffchainInputFeeParams(v));
5643
+ const inputFee = estimator.evalOffchainInput(chunk5J5PDZRR_cjs.toOffchainInputFeeParams(v));
5641
5644
  if (inputFee.satoshis >= v.value) {
5642
5645
  continue;
5643
5646
  }
@@ -5657,7 +5660,7 @@ var VtxoManager = class _VtxoManager {
5657
5660
  const arkAddress = await this.wallet.getAddress();
5658
5661
  const outputFee = estimator.evalOffchainOutput({
5659
5662
  amount: totalAmount,
5660
- script: base.hex.encode(chunk57636V35_cjs.ArkAddress.decode(arkAddress).pkScript)
5663
+ script: base.hex.encode(chunk5J5PDZRR_cjs.ArkAddress.decode(arkAddress).pkScript)
5661
5664
  });
5662
5665
  totalAmount -= BigInt(outputFee.satoshis);
5663
5666
  if (totalAmount < dustAmount) return;
@@ -5737,7 +5740,7 @@ var ArkNote = class _ArkNote {
5737
5740
  this.value = value;
5738
5741
  this.HRP = HRP;
5739
5742
  const preimageHash = utils_js.sha256(this.preimage);
5740
- this.vtxoScript = new chunk57636V35_cjs.VtxoScript([noteTapscript(preimageHash)]);
5743
+ this.vtxoScript = new chunk5J5PDZRR_cjs.VtxoScript([noteTapscript(preimageHash)]);
5741
5744
  const leaf = this.vtxoScript.leaves[0];
5742
5745
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
5743
5746
  this.tapTree = this.vtxoScript.encode();
@@ -5904,7 +5907,7 @@ var ArkadeCash = class _ArkadeCash {
5904
5907
  const privateKey = data.slice(1, 33);
5905
5908
  const serverPubKey = data.slice(33, 65);
5906
5909
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
5907
- const csvTimelock = chunk57636V35_cjs.sequenceToTimelock(sequence);
5910
+ const csvTimelock = chunk5J5PDZRR_cjs.sequenceToTimelock(sequence);
5908
5911
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock, decoded.prefix);
5909
5912
  }
5910
5913
  toString() {
@@ -5912,7 +5915,7 @@ var ArkadeCash = class _ArkadeCash {
5912
5915
  data[0] = _ArkadeCash.Version;
5913
5916
  data.set(this._privateKey, 1);
5914
5917
  data.set(this._serverPubKey, 33);
5915
- const sequence = chunk57636V35_cjs.timelockToSequence(this.csvTimelock);
5918
+ const sequence = chunk5J5PDZRR_cjs.timelockToSequence(this.csvTimelock);
5916
5919
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
5917
5920
  const words = base.bech32m.toWords(data);
5918
5921
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -5921,7 +5924,7 @@ var ArkadeCash = class _ArkadeCash {
5921
5924
  return SingleKey.fromPrivateKey(this._privateKey);
5922
5925
  }
5923
5926
  get vtxoScript() {
5924
- return new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
5927
+ return new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
5925
5928
  pubKey: this._publicKey,
5926
5929
  serverPubKey: this._serverPubKey,
5927
5930
  csvTimelock: this.csvTimelock
@@ -6182,7 +6185,7 @@ async function captureExitBranch(params) {
6182
6185
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
6183
6186
  if (nonCommitment.length > 0) {
6184
6187
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
6185
- psbtByTxid.set(chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6188
+ psbtByTxid.set(chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6186
6189
  }
6187
6190
  }
6188
6191
  }
@@ -6225,10 +6228,10 @@ var IndexerExitDataSource = class {
6225
6228
  while (hasMore) {
6226
6229
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
6227
6230
  { txid: vtxo.txid, vout: vtxo.vout },
6228
- { pageIndex, pageSize: chunk57636V35_cjs.DEFAULT_PAGE_SIZE }
6231
+ { pageIndex, pageSize: chunk5J5PDZRR_cjs.DEFAULT_PAGE_SIZE }
6229
6232
  );
6230
6233
  chain.push(...page);
6231
- hasMore = meta ? page.length === chunk57636V35_cjs.DEFAULT_PAGE_SIZE : false;
6234
+ hasMore = meta ? page.length === chunk5J5PDZRR_cjs.DEFAULT_PAGE_SIZE : false;
6232
6235
  pageIndex++;
6233
6236
  }
6234
6237
  return chain;
@@ -6240,12 +6243,12 @@ var IndexerExitDataSource = class {
6240
6243
  while (hasMore) {
6241
6244
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
6242
6245
  pageIndex,
6243
- pageSize: chunk57636V35_cjs.DEFAULT_PAGE_SIZE
6246
+ pageSize: chunk5J5PDZRR_cjs.DEFAULT_PAGE_SIZE
6244
6247
  });
6245
6248
  for (const psbt of txs) {
6246
- out.set(chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6249
+ out.set(chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6247
6250
  }
6248
- hasMore = page ? txs.length === chunk57636V35_cjs.DEFAULT_PAGE_SIZE : false;
6251
+ hasMore = page ? txs.length === chunk5J5PDZRR_cjs.DEFAULT_PAGE_SIZE : false;
6249
6252
  pageIndex++;
6250
6253
  }
6251
6254
  return out;
@@ -6266,7 +6269,7 @@ function chainedTxTypeToChainTxType(t) {
6266
6269
  }
6267
6270
  }
6268
6271
  function psbtInputTxids(psbtBase64) {
6269
- const tx = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
6272
+ const tx = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
6270
6273
  const ids = [];
6271
6274
  for (let i = 0; i < tx.inputsLength; i++) {
6272
6275
  const txid = tx.getInput(i).txid;
@@ -6625,10 +6628,10 @@ async function resolveArkInfo(arkProvider, walletRepository) {
6625
6628
  try {
6626
6629
  info = await arkProvider.getInfo();
6627
6630
  } catch (err) {
6628
- if (!chunk57636V35_cjs.isRetryableProviderError(err)) throw err;
6631
+ if (!chunk5J5PDZRR_cjs.isRetryableProviderError(err)) throw err;
6629
6632
  const snapshot = await loadArkInfoSnapshot(walletRepository);
6630
6633
  if (!snapshot) {
6631
- throw new chunk57636V35_cjs.ProviderUnavailableError(
6634
+ throw new chunk5J5PDZRR_cjs.ProviderUnavailableError(
6632
6635
  "Arkade server info is unavailable and no cached snapshot exists",
6633
6636
  { cause: err }
6634
6637
  );
@@ -7018,7 +7021,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos) {
7018
7021
  return [...txids];
7019
7022
  }
7020
7023
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt) {
7021
- const fromOldestVtxo = vtxos.map(chunk57636V35_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7024
+ const fromOldestVtxo = vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7022
7025
  const txidsNeedingCreatedAt = resolveTxCreatedAt ? collectArkTxidsNeedingCreatedAt(fromOldestVtxo) : [];
7023
7026
  const resolvedCreatedAt = resolveTxCreatedAt && txidsNeedingCreatedAt.length > 0 ? await resolveTxCreatedAt(txidsNeedingCreatedAt) : /* @__PURE__ */ new Map();
7024
7027
  const unmatchedSettledBoardingTxs = allBoardingTxs.filter(isSettledBoardingReceive).sort((a, b) => a.createdAt - b.createdAt);
@@ -7182,7 +7185,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7182
7185
  const virtualCoins = await this.wallet.getSpendableVtxos({
7183
7186
  withRecoverable: false
7184
7187
  });
7185
- const controlAssetRef = params.controlAssetId ? chunk3KW4TWP2_cjs.AssetRef.fromId(chunk3KW4TWP2_cjs.AssetId.fromString(params.controlAssetId)) : null;
7188
+ const controlAssetRef = params.controlAssetId ? chunkFM263GKH_cjs.AssetRef.fromId(chunkFM263GKH_cjs.AssetId.fromString(params.controlAssetId)) : null;
7186
7189
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
7187
7190
  let totalBtcSelected = 0n;
7188
7191
  const assetChanges = /* @__PURE__ */ new Map();
@@ -7195,8 +7198,8 @@ var AssetManager = class extends ReadonlyAssetManager {
7195
7198
  }
7196
7199
  }
7197
7200
  const groups = [];
7198
- const issuedAssetOutput = chunk3KW4TWP2_cjs.AssetOutput.create(0, params.amount);
7199
- const issuedAssetGroup = chunk3KW4TWP2_cjs.AssetGroup.create(
7201
+ const issuedAssetOutput = chunkFM263GKH_cjs.AssetOutput.create(0, params.amount);
7202
+ const issuedAssetGroup = chunkFM263GKH_cjs.AssetGroup.create(
7200
7203
  null,
7201
7204
  controlAssetRef,
7202
7205
  [],
@@ -7211,28 +7214,28 @@ var AssetManager = class extends ReadonlyAssetManager {
7211
7214
  for (const [inputIndex, assets] of assetInputs) {
7212
7215
  for (const asset of assets) {
7213
7216
  if (asset.assetId !== assetId) continue;
7214
- changeInputs.push(chunk3KW4TWP2_cjs.AssetInput.create(inputIndex, asset.amount));
7217
+ changeInputs.push(chunkFM263GKH_cjs.AssetInput.create(inputIndex, asset.amount));
7215
7218
  }
7216
7219
  }
7217
7220
  groups.push(
7218
- chunk3KW4TWP2_cjs.AssetGroup.create(
7219
- chunk3KW4TWP2_cjs.AssetId.fromString(assetId),
7221
+ chunkFM263GKH_cjs.AssetGroup.create(
7222
+ chunkFM263GKH_cjs.AssetId.fromString(assetId),
7220
7223
  null,
7221
7224
  changeInputs,
7222
- [chunk3KW4TWP2_cjs.AssetOutput.create(0, amount)],
7225
+ [chunkFM263GKH_cjs.AssetOutput.create(0, amount)],
7223
7226
  []
7224
7227
  )
7225
7228
  );
7226
7229
  }
7227
7230
  }
7228
7231
  const address = await this.wallet.getAddress();
7229
- const outputAddress = chunk57636V35_cjs.ArkAddress.decode(address);
7232
+ const outputAddress = chunk5J5PDZRR_cjs.ArkAddress.decode(address);
7230
7233
  const outputs = [
7231
7234
  {
7232
7235
  script: outputAddress.pkScript,
7233
7236
  amount: BigInt(totalBtcSelected)
7234
7237
  },
7235
- Extension.create([chunk3KW4TWP2_cjs.Packet.create(groups)]).txOut()
7238
+ Extension.create([chunkFM263GKH_cjs.Packet.create(groups)]).txOut()
7236
7239
  ];
7237
7240
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(
7238
7241
  coinSelection.inputs,
@@ -7240,7 +7243,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7240
7243
  );
7241
7244
  return {
7242
7245
  arkTxId: arkTxid,
7243
- assetId: chunk3KW4TWP2_cjs.AssetId.create(arkTxid, 0).toString()
7246
+ assetId: chunkFM263GKH_cjs.AssetId.create(arkTxid, 0).toString()
7244
7247
  };
7245
7248
  }
7246
7249
  /**
@@ -7312,16 +7315,16 @@ var AssetManager = class extends ReadonlyAssetManager {
7312
7315
  for (const [inputIndex, assets] of assetInputs) {
7313
7316
  for (const asset of assets) {
7314
7317
  if (asset.assetId !== params.assetId) continue;
7315
- reissueInputs.push(chunk3KW4TWP2_cjs.AssetInput.create(inputIndex, asset.amount));
7318
+ reissueInputs.push(chunkFM263GKH_cjs.AssetInput.create(inputIndex, asset.amount));
7316
7319
  }
7317
7320
  }
7318
7321
  const totalAssetAmount = assetToReissueAmount + params.amount;
7319
- const reissueAssetIdObj = chunk3KW4TWP2_cjs.AssetId.fromString(params.assetId);
7320
- const reissueAssetGroup = chunk3KW4TWP2_cjs.AssetGroup.create(
7322
+ const reissueAssetIdObj = chunkFM263GKH_cjs.AssetId.fromString(params.assetId);
7323
+ const reissueAssetGroup = chunkFM263GKH_cjs.AssetGroup.create(
7321
7324
  reissueAssetIdObj,
7322
7325
  null,
7323
7326
  reissueInputs,
7324
- [chunk3KW4TWP2_cjs.AssetOutput.create(0, totalAssetAmount)],
7327
+ [chunkFM263GKH_cjs.AssetOutput.create(0, totalAssetAmount)],
7325
7328
  []
7326
7329
  );
7327
7330
  const groups = [reissueAssetGroup];
@@ -7330,27 +7333,27 @@ var AssetManager = class extends ReadonlyAssetManager {
7330
7333
  for (const [inputIndex, assets] of assetInputs) {
7331
7334
  for (const asset of assets) {
7332
7335
  if (asset.assetId !== assetId) continue;
7333
- changeInputs.push(chunk3KW4TWP2_cjs.AssetInput.create(inputIndex, asset.amount));
7336
+ changeInputs.push(chunkFM263GKH_cjs.AssetInput.create(inputIndex, asset.amount));
7334
7337
  }
7335
7338
  }
7336
7339
  groups.push(
7337
- chunk3KW4TWP2_cjs.AssetGroup.create(
7338
- chunk3KW4TWP2_cjs.AssetId.fromString(assetId),
7340
+ chunkFM263GKH_cjs.AssetGroup.create(
7341
+ chunkFM263GKH_cjs.AssetId.fromString(assetId),
7339
7342
  null,
7340
7343
  changeInputs,
7341
- [chunk3KW4TWP2_cjs.AssetOutput.create(0, amount)],
7344
+ [chunkFM263GKH_cjs.AssetOutput.create(0, amount)],
7342
7345
  []
7343
7346
  )
7344
7347
  );
7345
7348
  }
7346
7349
  const address = await this.wallet.getAddress();
7347
- const outputAddress = chunk57636V35_cjs.ArkAddress.decode(address);
7350
+ const outputAddress = chunk5J5PDZRR_cjs.ArkAddress.decode(address);
7348
7351
  const outputs = [
7349
7352
  {
7350
7353
  script: outputAddress.pkScript,
7351
7354
  amount: BigInt(totalBtcSelected)
7352
7355
  },
7353
- Extension.create([chunk3KW4TWP2_cjs.Packet.create(groups)]).txOut()
7356
+ Extension.create([chunkFM263GKH_cjs.Packet.create(groups)]).txOut()
7354
7357
  ];
7355
7358
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
7356
7359
  return arkTxid;
@@ -7417,27 +7420,27 @@ var AssetManager = class extends ReadonlyAssetManager {
7417
7420
  for (const [inputIndex, assets] of assetInputs) {
7418
7421
  for (const asset of assets) {
7419
7422
  if (asset.assetId !== assetId) continue;
7420
- changeInputs.push(chunk3KW4TWP2_cjs.AssetInput.create(inputIndex, asset.amount));
7423
+ changeInputs.push(chunkFM263GKH_cjs.AssetInput.create(inputIndex, asset.amount));
7421
7424
  }
7422
7425
  }
7423
7426
  groups.push(
7424
- chunk3KW4TWP2_cjs.AssetGroup.create(
7425
- chunk3KW4TWP2_cjs.AssetId.fromString(assetId),
7427
+ chunkFM263GKH_cjs.AssetGroup.create(
7428
+ chunkFM263GKH_cjs.AssetId.fromString(assetId),
7426
7429
  null,
7427
7430
  changeInputs,
7428
- amount > 0n ? [chunk3KW4TWP2_cjs.AssetOutput.create(0, amount)] : [],
7431
+ amount > 0n ? [chunkFM263GKH_cjs.AssetOutput.create(0, amount)] : [],
7429
7432
  []
7430
7433
  )
7431
7434
  );
7432
7435
  }
7433
7436
  const address = await this.wallet.getAddress();
7434
- const outputAddress = chunk57636V35_cjs.ArkAddress.decode(address);
7437
+ const outputAddress = chunk5J5PDZRR_cjs.ArkAddress.decode(address);
7435
7438
  const outputs = [
7436
7439
  {
7437
7440
  script: outputAddress.pkScript,
7438
7441
  amount: BigInt(totalBtcSelected)
7439
7442
  },
7440
- Extension.create([chunk3KW4TWP2_cjs.Packet.create(groups)]).txOut()
7443
+ Extension.create([chunkFM263GKH_cjs.Packet.create(groups)]).txOut()
7441
7444
  ];
7442
7445
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
7443
7446
  return arkTxid;
@@ -7462,7 +7465,7 @@ function castMetadata(metadata) {
7462
7465
  } else {
7463
7466
  throw new Error("Invalid metadata value type");
7464
7467
  }
7465
- md.push(chunk3KW4TWP2_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7468
+ md.push(chunkFM263GKH_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7466
7469
  }
7467
7470
  return md;
7468
7471
  }
@@ -7483,10 +7486,10 @@ var DelegateManagerImpl = class {
7483
7486
  if (vtxos.length === 0) {
7484
7487
  return { delegated: [], failed: [] };
7485
7488
  }
7486
- const destinationScript = chunk57636V35_cjs.ArkAddress.decode(destination).pkScript;
7489
+ const destinationScript = chunk5J5PDZRR_cjs.ArkAddress.decode(destination).pkScript;
7487
7490
  const arkInfo = await this.arkInfoProvider.getInfo();
7488
7491
  const delegateInfo = await this.delegateProvider.getDelegateInfo();
7489
- const eligible = vtxos.map(chunk57636V35_cjs.normalizeVtxo).filter(
7492
+ const eligible = vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo).filter(
7490
7493
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
7491
7494
  );
7492
7495
  if (eligible.length === 0) {
@@ -7515,11 +7518,11 @@ var DelegateManagerImpl = class {
7515
7518
  const groupByExpiry = /* @__PURE__ */ new Map();
7516
7519
  let recoverableVtxos = [];
7517
7520
  for (const vtxo of eligible) {
7518
- if (chunk57636V35_cjs.canRecoverOnchain(vtxo, now)) {
7521
+ if (chunk5J5PDZRR_cjs.canRecoverOnchain(vtxo, now)) {
7519
7522
  recoverableVtxos.push(vtxo);
7520
7523
  continue;
7521
7524
  }
7522
- const expiry = chunk57636V35_cjs.toBatchExpiry(vtxo);
7525
+ const expiry = chunk5J5PDZRR_cjs.toBatchExpiry(vtxo);
7523
7526
  if (!expiry) continue;
7524
7527
  const dayKey = getDayTimestamp(expiry);
7525
7528
  groupByExpiry.set(dayKey, [...groupByExpiry.get(dayKey) ?? [], vtxo]);
@@ -7584,7 +7587,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7584
7587
  }
7585
7588
  if (!delegateAt) {
7586
7589
  const now = { timestamp: /* @__PURE__ */ new Date() };
7587
- const expiryTimestamp = vtxos.filter((coin) => !chunk57636V35_cjs.canRecoverOnchain(coin, now) && chunk57636V35_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunk57636V35_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7590
+ const expiryTimestamp = vtxos.filter((coin) => !chunk5J5PDZRR_cjs.canRecoverOnchain(coin, now) && chunk5J5PDZRR_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunk5J5PDZRR_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7588
7591
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
7589
7592
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7590
7593
  } else {
@@ -7613,7 +7616,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7613
7616
  let amount = 0n;
7614
7617
  for (const coin of vtxos) {
7615
7618
  const inputFee = estimator.evalOffchainInput({
7616
- ...chunk57636V35_cjs.toOffchainInputFeeParams(coin),
7619
+ ...chunk5J5PDZRR_cjs.toOffchainInputFeeParams(coin),
7617
7620
  type: "vtxo"
7618
7621
  });
7619
7622
  if (inputFee.value >= coin.value) {
@@ -7627,7 +7630,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7627
7630
  const delegateFee = BigInt(Number(fee));
7628
7631
  if (delegateFee > 0n) {
7629
7632
  outputs.push({
7630
- script: chunk57636V35_cjs.ArkAddress.decode(delegateAddress).pkScript,
7633
+ script: chunk5J5PDZRR_cjs.ArkAddress.decode(delegateAddress).pkScript,
7631
7634
  amount: delegateFee
7632
7635
  });
7633
7636
  }
@@ -7660,10 +7663,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7660
7663
  destinationScript
7661
7664
  );
7662
7665
  const forfeitOutputScript = btcSigner.OutScript.encode(
7663
- btcSigner.Address(chunk57636V35_cjs.getNetwork(network)).decode(forfeitAddress)
7666
+ btcSigner.Address(chunk5J5PDZRR_cjs.getNetwork(network)).decode(forfeitAddress)
7664
7667
  );
7665
7668
  const forfeits = await Promise.all(
7666
- vtxos.filter((v) => !chunk57636V35_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
7669
+ vtxos.filter((v) => !chunk5J5PDZRR_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
7667
7670
  const forfeit = await makeDelegateForfeitTx(
7668
7671
  coin,
7669
7672
  dust,
@@ -7688,7 +7691,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
7688
7691
  index: input.vout,
7689
7692
  witnessUtxo: {
7690
7693
  amount: BigInt(input.value),
7691
- script: chunk57636V35_cjs.VtxoScript.decode(input.tapTree).pkScript
7694
+ script: chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).pkScript
7692
7695
  },
7693
7696
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
7694
7697
  tapLeafScript: [delegateTapLeaf]
@@ -7746,7 +7749,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
7746
7749
  expire_at: 0,
7747
7750
  cosigners_public_keys: cosignerPubKeys
7748
7751
  };
7749
- const proof = chunk57636V35_cjs.Intent.create(message, coins, outputs);
7752
+ const proof = chunk5J5PDZRR_cjs.Intent.create(message, coins, outputs);
7750
7753
  const signedProof = await identity.sign(proof);
7751
7754
  return {
7752
7755
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -7764,10 +7767,10 @@ function getDayTimestamp(timestamp) {
7764
7767
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
7765
7768
  if (!vtxo.tapTree) return void 0;
7766
7769
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
7767
- const vtxoScript = chunk57636V35_cjs.VtxoScript.decode(vtxo.tapTree);
7770
+ const vtxoScript = chunk5J5PDZRR_cjs.VtxoScript.decode(vtxo.tapTree);
7768
7771
  return vtxoScript.leaves.find((tapLeaf) => {
7769
- const arkTapscript = chunk57636V35_cjs.decodeTapscript(chunk57636V35_cjs.scriptFromTapLeafScript(tapLeaf));
7770
- if (!chunk57636V35_cjs.MultisigTapscript.is(arkTapscript)) return false;
7772
+ const arkTapscript = chunk5J5PDZRR_cjs.decodeTapscript(chunk5J5PDZRR_cjs.scriptFromTapLeafScript(tapLeaf));
7773
+ if (!chunk5J5PDZRR_cjs.MultisigTapscript.is(arkTapscript)) return false;
7771
7774
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
7772
7775
  });
7773
7776
  }
@@ -8048,7 +8051,7 @@ function createManagedConnection(dbName, version, initDatabase2) {
8048
8051
  };
8049
8052
  }
8050
8053
  function scriptFromArkAddress(address) {
8051
- return base.hex.encode(chunk57636V35_cjs.ArkAddress.decode(address).pkScript);
8054
+ return base.hex.encode(chunk5J5PDZRR_cjs.ArkAddress.decode(address).pkScript);
8052
8055
  }
8053
8056
 
8054
8057
  // src/repositories/indexedDB/schema.ts
@@ -8543,7 +8546,7 @@ function validateVtxosForScript(vtxos, script, context) {
8543
8546
  }
8544
8547
  async function getVtxosForContract(repo, contract) {
8545
8548
  const vtxos = repo.getVtxosForScript ? await repo.getVtxosForScript(contract.script) : filterVtxosForScript(await repo.getVtxos(contract.address), contract.script);
8546
- return vtxos.map(chunk57636V35_cjs.normalizeVtxo);
8549
+ return vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo);
8547
8550
  }
8548
8551
  async function saveVtxosForContract(repo, contract, vtxos) {
8549
8552
  if (repo.saveVtxosForScript) {
@@ -8685,7 +8688,7 @@ function decodeArkContract(encoded) {
8685
8688
  }
8686
8689
  function contractFromArkContract(encoded, options = {}) {
8687
8690
  const parsed = decodeArkContract(encoded);
8688
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(parsed.type);
8691
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(parsed.type);
8689
8692
  if (!handler) {
8690
8693
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
8691
8694
  }
@@ -8699,9 +8702,9 @@ function contractFromArkContract(encoded, options = {}) {
8699
8702
  metadata: options.metadata
8700
8703
  };
8701
8704
  }
8702
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunk57636V35_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8705
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunk5J5PDZRR_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8703
8706
  const parsed = decodeArkContract(encoded);
8704
- const handler = chunk3OKEUDHU_cjs.contractHandlers.getOrThrow(parsed.type);
8707
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.getOrThrow(parsed.type);
8705
8708
  const params = parsed.data;
8706
8709
  const vtxoScript = handler.createScript(params);
8707
8710
  return {
@@ -8733,6 +8736,8 @@ var DEFAULT_CONTRACT_WATCHER_CONFIG = {
8733
8736
  var ContractWatcher = class {
8734
8737
  config;
8735
8738
  contracts = /* @__PURE__ */ new Map();
8739
+ /** In-memory and process-lifetime; never persisted. */
8740
+ watchedScripts = /* @__PURE__ */ new Map();
8736
8741
  subscriptionId;
8737
8742
  abortController;
8738
8743
  isWatching = false;
@@ -8853,6 +8858,47 @@ var ContractWatcher = class {
8853
8858
  getWatchedContracts() {
8854
8859
  return this.getAllContracts().filter(isWatchedContract);
8855
8860
  }
8861
+ /**
8862
+ * Every script the subscription must carry. Wider than
8863
+ * {@link getWatchedContracts}, which stays the sync scope.
8864
+ */
8865
+ getSubscribedScripts() {
8866
+ const scripts = new Set(this.getWatchedContracts().map((c) => c.script));
8867
+ for (const script of this.watchedScripts.keys()) {
8868
+ scripts.add(script);
8869
+ }
8870
+ return Array.from(scripts);
8871
+ }
8872
+ /** @see IContractManager.watchScript for the delivery and filter contract. */
8873
+ async addWatchedScript(script, options) {
8874
+ const existing = this.watchedScripts.get(script);
8875
+ if (existing) {
8876
+ if (options?.label !== void 0) existing.label = options.label;
8877
+ return;
8878
+ }
8879
+ this.watchedScripts.set(script, {
8880
+ label: options?.label,
8881
+ lastKnownVtxos: /* @__PURE__ */ new Map()
8882
+ });
8883
+ if (this.isWatching) {
8884
+ await this.pollWatchedScripts([script]);
8885
+ await this.tryUpdateSubscription();
8886
+ }
8887
+ }
8888
+ /** Stop watching a script added by {@link addWatchedScript}. */
8889
+ async removeWatchedScript(script) {
8890
+ if (!this.watchedScripts.delete(script)) return;
8891
+ if (this.isWatching) {
8892
+ await this.tryUpdateSubscription();
8893
+ }
8894
+ }
8895
+ /** Every script registered via {@link addWatchedScript}. */
8896
+ getWatchedScripts() {
8897
+ return Array.from(this.watchedScripts.entries()).map(([script, state]) => ({
8898
+ script,
8899
+ label: state.label
8900
+ }));
8901
+ }
8856
8902
  /**
8857
8903
  * Get virtual outputs for contracts, grouped by contract script.
8858
8904
  * @see WalletRepository for `repo`
@@ -8955,9 +9001,9 @@ var ContractWatcher = class {
8955
9001
  this.connectionState = "connected";
8956
9002
  this.reconnectAttempts = 0;
8957
9003
  this.listenLoop().catch((e) => {
8958
- if (chunk57636V35_cjs.isEventSourceError(e)) {
9004
+ if (chunk5J5PDZRR_cjs.isEventSourceError(e)) {
8959
9005
  console.debug("ContractWatcher subscription disconnected; reconnecting");
8960
- } else if (!chunk57636V35_cjs.isEventSourceUnavailableError(e)) {
9006
+ } else if (!chunk5J5PDZRR_cjs.isEventSourceUnavailableError(e)) {
8961
9007
  console.error(e);
8962
9008
  }
8963
9009
  this.connectionState = "disconnected";
@@ -8969,7 +9015,7 @@ var ContractWatcher = class {
8969
9015
  this.scheduleReconnect();
8970
9016
  });
8971
9017
  } catch (error) {
8972
- if (!chunk57636V35_cjs.isEventSourceUnavailableError(error)) {
9018
+ if (!chunk5J5PDZRR_cjs.isEventSourceUnavailableError(error)) {
8973
9019
  console.error("ContractWatcher connection failed:", error);
8974
9020
  }
8975
9021
  this.connectionState = "disconnected";
@@ -8995,7 +9041,7 @@ var ContractWatcher = class {
8995
9041
  * slower; what it loses is push latency.
8996
9042
  */
8997
9043
  reportEventSourceUnavailable(error) {
8998
- if (!chunk57636V35_cjs.isEventSourceUnavailableError(error)) return false;
9044
+ if (!chunk5J5PDZRR_cjs.isEventSourceUnavailableError(error)) return false;
8999
9045
  if (!this.eventSourceReported) {
9000
9046
  this.eventSourceReported = true;
9001
9047
  console.warn(
@@ -9044,8 +9090,72 @@ var ContractWatcher = class {
9044
9090
  }
9045
9091
  async pollAllContracts() {
9046
9092
  const scripts = this.getWatchedContracts().map((c) => c.script);
9093
+ if (scripts.length > 0) {
9094
+ await this.pollContracts(scripts);
9095
+ }
9096
+ await this.pollWatchedScripts(Array.from(this.watchedScripts.keys()));
9097
+ }
9098
+ /**
9099
+ * Poll watch-only scripts against the indexer and emit the delta.
9100
+ *
9101
+ * Separate from {@link pollContracts} because that one diffs the wallet
9102
+ * repository, which is permanently empty for a script this wallet does not
9103
+ * own — reusing it would report every live output as spent on every tick.
9104
+ * Not a second poll loop: same timer and callers, different source.
9105
+ */
9106
+ async pollWatchedScripts(candidates) {
9107
+ if (!this.eventCallback) return;
9108
+ const scripts = candidates.filter((s) => {
9109
+ const state = this.contracts.get(s);
9110
+ return this.watchedScripts.has(s) && (state === void 0 || !isWatchedContract(state.contract));
9111
+ });
9047
9112
  if (scripts.length === 0) return;
9048
- await this.pollContracts(scripts);
9113
+ const now = Date.now();
9114
+ let current;
9115
+ try {
9116
+ current = await chunk5J5PDZRR_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9117
+ spendableOnly: true
9118
+ });
9119
+ } catch (error) {
9120
+ console.error("ContractWatcher watch-only poll failed:", error);
9121
+ return;
9122
+ }
9123
+ const byScript = /* @__PURE__ */ new Map();
9124
+ for (const vtxo of current) {
9125
+ let bucket = byScript.get(vtxo.script);
9126
+ if (!bucket) {
9127
+ bucket = [];
9128
+ byScript.set(vtxo.script, bucket);
9129
+ }
9130
+ bucket.push(vtxo);
9131
+ }
9132
+ for (const script of scripts) {
9133
+ const state = this.watchedScripts.get(script);
9134
+ if (!state) continue;
9135
+ const currentVtxos = byScript.get(script) || [];
9136
+ const currentKeys = new Set(currentVtxos.map((v) => `${v.txid}:${v.vout}`));
9137
+ const newVtxos = [];
9138
+ for (const vtxo of currentVtxos) {
9139
+ const key = `${vtxo.txid}:${vtxo.vout}`;
9140
+ if (!state.lastKnownVtxos.has(key)) {
9141
+ newVtxos.push(vtxo);
9142
+ state.lastKnownVtxos.set(key, vtxo);
9143
+ }
9144
+ }
9145
+ const spentVtxos = [];
9146
+ for (const [key, vtxo] of state.lastKnownVtxos) {
9147
+ if (!currentKeys.has(key)) {
9148
+ spentVtxos.push(vtxo);
9149
+ state.lastKnownVtxos.delete(key);
9150
+ }
9151
+ }
9152
+ if (newVtxos.length > 0) {
9153
+ this.emitWatchedScriptEvent(script, newVtxos, "vtxo_received", now);
9154
+ }
9155
+ if (spentVtxos.length > 0) {
9156
+ this.emitWatchedScriptEvent(script, spentVtxos, "vtxo_spent", now);
9157
+ }
9158
+ }
9049
9159
  }
9050
9160
  /**
9051
9161
  * Poll specific contracts and emit events for changes.
@@ -9146,10 +9256,10 @@ var ContractWatcher = class {
9146
9256
  /**
9147
9257
  * Update the subscription with scripts that should be watched.
9148
9258
  *
9149
- * @see getWatchedContracts
9259
+ * @see getSubscribedScripts
9150
9260
  */
9151
9261
  async updateSubscription() {
9152
- const scriptsToWatch = this.getWatchedContracts().map((c) => c.script);
9262
+ const scriptsToWatch = this.getSubscribedScripts();
9153
9263
  if (scriptsToWatch.length === 0) {
9154
9264
  if (this.subscriptionId) {
9155
9265
  try {
@@ -9211,14 +9321,14 @@ var ContractWatcher = class {
9211
9321
  const timestamp = Date.now();
9212
9322
  if (update.newVtxos?.length) {
9213
9323
  this.processSubscriptionVtxos(
9214
- update.newVtxos.map(chunk57636V35_cjs.normalizeVtxo),
9324
+ update.newVtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo),
9215
9325
  "vtxo_received",
9216
9326
  timestamp
9217
9327
  );
9218
9328
  }
9219
9329
  if (update.spentVtxos?.length) {
9220
9330
  this.processSubscriptionVtxos(
9221
- update.spentVtxos.map(chunk57636V35_cjs.normalizeVtxo),
9331
+ update.spentVtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo),
9222
9332
  "vtxo_spent",
9223
9333
  timestamp
9224
9334
  );
@@ -9233,16 +9343,26 @@ var ContractWatcher = class {
9233
9343
  */
9234
9344
  processSubscriptionVtxos(vtxos, eventType, timestamp) {
9235
9345
  const byContract = /* @__PURE__ */ new Map();
9346
+ const byWatchedScript = /* @__PURE__ */ new Map();
9236
9347
  let unknownScript = 0;
9348
+ const now = { timestamp: /* @__PURE__ */ new Date() };
9237
9349
  for (const vtxo of vtxos) {
9238
- if (!this.contracts.has(vtxo.script)) {
9350
+ const state = this.contracts.get(vtxo.script);
9351
+ const watchOnly = this.watchedScripts.has(vtxo.script);
9352
+ const preferContract = state !== void 0 && (!watchOnly || isWatchedContract(state.contract));
9353
+ const target = preferContract ? byContract : watchOnly ? byWatchedScript : void 0;
9354
+ if (!target) {
9239
9355
  unknownScript++;
9240
9356
  continue;
9241
9357
  }
9242
- let bucket = byContract.get(vtxo.script);
9358
+ if (target === byWatchedScript && eventType === "vtxo_received") {
9359
+ const n = chunk5J5PDZRR_cjs.normalizeVtxo(vtxo);
9360
+ if (chunk5J5PDZRR_cjs.hasTerminalSpend(n) || n.isSwept || chunk5J5PDZRR_cjs.isPastExpiry(n, now)) continue;
9361
+ }
9362
+ let bucket = target.get(vtxo.script);
9243
9363
  if (!bucket) {
9244
9364
  bucket = [];
9245
- byContract.set(vtxo.script, bucket);
9365
+ target.set(vtxo.script, bucket);
9246
9366
  }
9247
9367
  bucket.push(vtxo);
9248
9368
  }
@@ -9265,6 +9385,29 @@ var ContractWatcher = class {
9265
9385
  }
9266
9386
  this.emitVtxoEvent(contractScript, bucketVtxos, eventType, timestamp);
9267
9387
  }
9388
+ for (const [script, bucketVtxos] of byWatchedScript) {
9389
+ const state = this.watchedScripts.get(script);
9390
+ if (state) {
9391
+ for (const vtxo of bucketVtxos) {
9392
+ const key = `${vtxo.txid}:${vtxo.vout}`;
9393
+ if (eventType === "vtxo_received") {
9394
+ state.lastKnownVtxos.set(key, vtxo);
9395
+ } else {
9396
+ state.lastKnownVtxos.delete(key);
9397
+ }
9398
+ }
9399
+ }
9400
+ this.emitWatchedScriptEvent(script, bucketVtxos, eventType, timestamp);
9401
+ }
9402
+ }
9403
+ /** As {@link emitVtxoEvent}, less the `contract` and the annotation. */
9404
+ emitWatchedScriptEvent(script, vtxos, eventType, timestamp) {
9405
+ if (!this.eventCallback) return;
9406
+ if (eventType === "vtxo_received") {
9407
+ this.eventCallback({ type: "vtxo_received", contractScript: script, vtxos, timestamp });
9408
+ return;
9409
+ }
9410
+ this.eventCallback({ type: "vtxo_spent", contractScript: script, vtxos, timestamp });
9268
9411
  }
9269
9412
  /**
9270
9413
  * Emit a virtual output event for a contract.
@@ -9313,7 +9456,7 @@ var NON_TERMINAL_INTENT_STATES = ALL_INTENT_STATES.filter(
9313
9456
  (s) => !isTerminalIntentState(s)
9314
9457
  );
9315
9458
  function isConsumed(vtxo) {
9316
- return vtxo !== void 0 && chunk57636V35_cjs.hasTerminalSpend(vtxo);
9459
+ return vtxo !== void 0 && chunk5J5PDZRR_cjs.hasTerminalSpend(vtxo);
9317
9460
  }
9318
9461
  async function classifyIntent(intent, vtxosByOutpoint, now) {
9319
9462
  if (isTerminalIntentState(intent.state)) return void 0;
@@ -9356,7 +9499,7 @@ async function reconcileIntents(deps) {
9356
9499
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
9357
9500
  if (outpoints.length > 0) {
9358
9501
  try {
9359
- const { vtxos } = await chunk57636V35_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9502
+ const { vtxos } = await chunk5J5PDZRR_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9360
9503
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
9361
9504
  } catch (e) {
9362
9505
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -9530,7 +9673,7 @@ var ContractManager = class _ContractManager {
9530
9673
  await this.reconcileWatched();
9531
9674
  this.markSyncOnline();
9532
9675
  } catch (err) {
9533
- if (!chunk57636V35_cjs.isRetryableProviderError(err)) throw err;
9676
+ if (!chunk5J5PDZRR_cjs.isRetryableProviderError(err)) throw err;
9534
9677
  this.markSyncDegraded(err);
9535
9678
  }
9536
9679
  this.initialized = true;
@@ -9662,7 +9805,7 @@ var ContractManager = class _ContractManager {
9662
9805
  const from = Math.max(0, watermark - lookAhead.size);
9663
9806
  const to = watermark + lookAhead.size;
9664
9807
  const deps = lookAhead.candidateDeps();
9665
- const handlers = chunk3OKEUDHU_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk3OKEUDHU_cjs.contractHandlers.get(t)).filter(hasCandidates);
9808
+ const handlers = chunkP6EXRY5L_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkP6EXRY5L_cjs.contractHandlers.get(t)).filter(hasCandidates);
9666
9809
  const band = /* @__PURE__ */ new Map();
9667
9810
  for (let index = from; index <= to; index++) {
9668
9811
  const descriptor = lookAhead.materialize(index);
@@ -9673,7 +9816,7 @@ var ContractManager = class _ContractManager {
9673
9816
  index,
9674
9817
  params: {
9675
9818
  ...candidate,
9676
- ...chunk3OKEUDHU_cjs.speculativeReceiveMetadata(descriptor)
9819
+ ...chunkP6EXRY5L_cjs.speculativeReceiveMetadata(descriptor)
9677
9820
  }
9678
9821
  });
9679
9822
  }
@@ -9735,7 +9878,7 @@ var ContractManager = class _ContractManager {
9735
9878
  });
9736
9879
  for (const entry of pending) entry.catchUpPending = false;
9737
9880
  } catch (err) {
9738
- if (!chunk57636V35_cjs.isRetryableProviderError(err)) throw err;
9881
+ if (!chunk5J5PDZRR_cjs.isRetryableProviderError(err)) throw err;
9739
9882
  this.markSyncDegraded(err);
9740
9883
  }
9741
9884
  }
@@ -9785,7 +9928,7 @@ var ContractManager = class _ContractManager {
9785
9928
  await this.fetchContractVxosFromIndexer([contract]);
9786
9929
  this.markSyncOnline();
9787
9930
  } catch (err) {
9788
- if (!chunk57636V35_cjs.isRetryableProviderError(err)) throw err;
9931
+ if (!chunk5J5PDZRR_cjs.isRetryableProviderError(err)) throw err;
9789
9932
  this.markSyncDegraded(err);
9790
9933
  }
9791
9934
  await this.watcher.addContract(contract);
@@ -9822,7 +9965,7 @@ var ContractManager = class _ContractManager {
9822
9965
  return result;
9823
9966
  }
9824
9967
  async upsertContractRow(params) {
9825
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(params.type);
9968
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(params.type);
9826
9969
  if (!handler) {
9827
9970
  throw new Error(`No handler registered for contract type '${params.type}'`);
9828
9971
  }
@@ -9922,7 +10065,7 @@ var ContractManager = class _ContractManager {
9922
10065
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
9923
10066
  );
9924
10067
  }
9925
- const registered = chunk3OKEUDHU_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk3OKEUDHU_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10068
+ const registered = chunkP6EXRY5L_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkP6EXRY5L_cjs.contractHandlers.get(t)).filter(isDiscoverable);
9926
10069
  const discoverables = [
9927
10070
  ...registered.filter((h) => h.type === "boarding"),
9928
10071
  ...registered.filter((h) => h.type !== "boarding")
@@ -10057,7 +10200,7 @@ var ContractManager = class _ContractManager {
10057
10200
  await this.syncContracts({ contracts, pageSize });
10058
10201
  this.markSyncOnline();
10059
10202
  } catch (err) {
10060
- if (!chunk57636V35_cjs.isRetryableProviderError(err)) throw err;
10203
+ if (!chunk5J5PDZRR_cjs.isRetryableProviderError(err)) throw err;
10061
10204
  this.markSyncDegraded(err);
10062
10205
  }
10063
10206
  const vtxos = await this.getVtxosForContracts(contracts);
@@ -10078,7 +10221,7 @@ var ContractManager = class _ContractManager {
10078
10221
  }
10079
10222
  const tapscriptCache = tapscripts ?? /* @__PURE__ */ new Map();
10080
10223
  return vtxos.map(
10081
- (vtxo) => extendVirtualCoinForContract(chunk57636V35_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
10224
+ (vtxo) => extendVirtualCoinForContract(chunk5J5PDZRR_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
10082
10225
  );
10083
10226
  }
10084
10227
  /** @inheritdoc */
@@ -10122,14 +10265,14 @@ var ContractManager = class _ContractManager {
10122
10265
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
10123
10266
  const asking = vtxos.filter((vtxo) => {
10124
10267
  const contract = byScript.get(vtxo.script);
10125
- return contract !== void 0 && chunk3OKEUDHU_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10268
+ return contract !== void 0 && chunkP6EXRY5L_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10126
10269
  });
10127
10270
  if (asking.length === 0) return refused;
10128
10271
  const tip = await this.currentChainTip();
10129
10272
  const walletKey = await walletPubKey?.();
10130
10273
  for (const vtxo of asking) {
10131
10274
  const contract = byScript.get(vtxo.script);
10132
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
10275
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
10133
10276
  if (!handler?.assertSpendableNow) continue;
10134
10277
  const context = {
10135
10278
  collaborative: true,
@@ -10144,7 +10287,7 @@ var ContractManager = class _ContractManager {
10144
10287
  // the next handler to answer a CSV question would meet a
10145
10288
  // TypeError instead of a `false`. Carry the coin only when it
10146
10289
  // really is one.
10147
- vtxo: chunk57636V35_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10290
+ vtxo: chunk5J5PDZRR_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10148
10291
  };
10149
10292
  try {
10150
10293
  await handler.assertSpendableNow(
@@ -10300,7 +10443,7 @@ var ContractManager = class _ContractManager {
10300
10443
  const { contractScript, collaborative = true, walletPubKey, vtxo } = options;
10301
10444
  const [contract] = await this.getContracts({ script: contractScript });
10302
10445
  if (!contract) return [];
10303
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
10446
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
10304
10447
  if (!handler) return [];
10305
10448
  const script = handler.createScript(contract.params);
10306
10449
  const tip = await this.currentChainTip();
@@ -10328,7 +10471,7 @@ var ContractManager = class _ContractManager {
10328
10471
  const { contractScript, collaborative = true, walletPubKey } = options;
10329
10472
  const [contract] = await this.getContracts({ script: contractScript });
10330
10473
  if (!contract) return [];
10331
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
10474
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
10332
10475
  if (!handler) return [];
10333
10476
  const script = handler.createScript(contract.params);
10334
10477
  const context = {
@@ -10384,7 +10527,7 @@ var ContractManager = class _ContractManager {
10384
10527
  }
10385
10528
  async refreshOutpoints(outpoints) {
10386
10529
  if (outpoints.length === 0) return;
10387
- const { vtxos } = await chunk57636V35_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10530
+ const { vtxos } = await chunk5J5PDZRR_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10388
10531
  outpoints
10389
10532
  });
10390
10533
  if (vtxos.length === 0) return;
@@ -10420,6 +10563,18 @@ var ContractManager = class _ContractManager {
10420
10563
  async isWatching() {
10421
10564
  return this.watcher.isCurrentlyWatching();
10422
10565
  }
10566
+ /** @see IContractManager.watchScript */
10567
+ async watchScript(script, options) {
10568
+ await this.watcher.addWatchedScript(script, options);
10569
+ }
10570
+ /** @see IContractManager.unwatchScript */
10571
+ async unwatchScript(script) {
10572
+ await this.watcher.removeWatchedScript(script);
10573
+ }
10574
+ /** @see IContractManager.getWatchedScripts */
10575
+ async getWatchedScripts() {
10576
+ return this.watcher.getWatchedScripts();
10577
+ }
10423
10578
  /**
10424
10579
  * Emit an event to all registered callbacks.
10425
10580
  */
@@ -10440,11 +10595,15 @@ var ContractManager = class _ContractManager {
10440
10595
  try {
10441
10596
  switch (event.type) {
10442
10597
  // Delta-sync only the changed virtual outputs for this contract.
10598
+ // The guard below is the ownership boundary: a watch-only script
10599
+ // reports these same types, so it must precede `syncContracts`.
10443
10600
  case "vtxo_received":
10601
+ if (!isContractVtxoEvent(event)) break;
10444
10602
  await this.syncContracts({ contracts: [event.contract] });
10445
10603
  this.markSyncOnline();
10446
10604
  break;
10447
10605
  case "vtxo_spent":
10606
+ if (!isContractVtxoEvent(event)) break;
10448
10607
  await this.syncContracts({ contracts: [event.contract] });
10449
10608
  this.markSyncOnline();
10450
10609
  if (this.config.onVtxosSpent) {
@@ -10463,7 +10622,7 @@ var ContractManager = class _ContractManager {
10463
10622
  break;
10464
10623
  }
10465
10624
  } catch (err) {
10466
- if (!chunk57636V35_cjs.isRetryableProviderError(err)) throw err;
10625
+ if (!chunk5J5PDZRR_cjs.isRetryableProviderError(err)) throw err;
10467
10626
  this.markSyncDegraded(err);
10468
10627
  }
10469
10628
  this.emitEvent(event);
@@ -10542,7 +10701,7 @@ var ContractManager = class _ContractManager {
10542
10701
  */
10543
10702
  async reconcilePendingFrontier(contracts) {
10544
10703
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
10545
- const vtxos = await chunk57636V35_cjs.getAllNormalizedVtxos(
10704
+ const vtxos = await chunk5J5PDZRR_cjs.getAllNormalizedVtxos(
10546
10705
  this.config.indexerProvider,
10547
10706
  contracts.map((c) => c.script),
10548
10707
  { pendingOnly: true }
@@ -10625,7 +10784,7 @@ var ContractManager = class _ContractManager {
10625
10784
  }
10626
10785
  return result;
10627
10786
  }
10628
- async fetchContractVtxosBulk(contracts, pageSize = chunk57636V35_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10787
+ async fetchContractVtxosBulk(contracts, pageSize = chunk5J5PDZRR_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10629
10788
  if (contracts.length === 0) {
10630
10789
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
10631
10790
  }
@@ -10641,7 +10800,7 @@ var ContractManager = class _ContractManager {
10641
10800
  before: syncWindow.before
10642
10801
  }
10643
10802
  } : {};
10644
- const vtxos = await chunk57636V35_cjs.getAllNormalizedVtxos(
10803
+ const vtxos = await chunk5J5PDZRR_cjs.getAllNormalizedVtxos(
10645
10804
  this.config.indexerProvider,
10646
10805
  contracts.map((c) => c.script),
10647
10806
  { ...windowOpts, pageSize }
@@ -10786,7 +10945,7 @@ var deserializeTapLeaf = (t) => {
10786
10945
  const s = base.hex.decode(t.s);
10787
10946
  return [cb, s];
10788
10947
  };
10789
- var deserializeVtxo = (o) => chunk57636V35_cjs.normalizeVtxo({
10948
+ var deserializeVtxo = (o) => chunk5J5PDZRR_cjs.normalizeVtxo({
10790
10949
  ...o,
10791
10950
  createdAt: new Date(o.createdAt),
10792
10951
  tapTree: base.hex.decode(o.tapTree),
@@ -11609,7 +11768,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11609
11768
  */
11610
11769
  materializeDescriptorAt(index) {
11611
11770
  const descriptor = this.identity.descriptor;
11612
- const network = chunk3OKEUDHU_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11771
+ const network = chunkP6EXRY5L_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11613
11772
  const expansion = descriptorsScure.expand({ descriptor, network, index });
11614
11773
  const keyInfo = expansion.expansionMap?.["@0"];
11615
11774
  if (!keyInfo?.keyExpression) {
@@ -11757,7 +11916,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
11757
11916
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
11758
11917
  if (!provider) return void 0;
11759
11918
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
11760
- const expectedContractType = setup.offchainTapscript instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script ? "delegate" : "default";
11919
+ const expectedContractType = setup.offchainTapscript instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script ? "delegate" : "default";
11761
11920
  const factoryOpts = {
11762
11921
  walletRepository: setup.walletRepository,
11763
11922
  contractRepository: setup.contractRepository,
@@ -11958,7 +12117,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
11958
12117
  };
11959
12118
  function deriveLeafPubkey(descriptor) {
11960
12119
  try {
11961
- return chunk3OKEUDHU_cjs.deriveDescriptorLeafPubKey(descriptor);
12120
+ return chunkP6EXRY5L_cjs.deriveDescriptorLeafPubKey(descriptor);
11962
12121
  } catch (e) {
11963
12122
  throw new NonRangeableDescriptorError(
11964
12123
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -11970,7 +12129,7 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11970
12129
  const pubKey = deriveLeafPubkey(descriptor);
11971
12130
  const tapscript = rebuildTapscript(current, pubKey);
11972
12131
  const serverPubKey = tapscript.options.serverPubKey;
11973
- const csvTimelock = chunk57636V35_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12132
+ const csvTimelock = chunk5J5PDZRR_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
11974
12133
  const base$1 = {
11975
12134
  script: base.hex.encode(tapscript.pkScript),
11976
12135
  address: tapscript.address(hrp, serverPubKey).encode(),
@@ -11981,11 +12140,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11981
12140
  // index-0 key. Without it, spends produce unsigned PSBTs that the
11982
12141
  // server rejects with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
11983
12142
  metadata: {
11984
- ...tagSource && { source: chunk3OKEUDHU_cjs.WALLET_RECEIVE_SOURCE },
12143
+ ...tagSource && { source: chunkP6EXRY5L_cjs.WALLET_RECEIVE_SOURCE },
11985
12144
  signingDescriptor: descriptor
11986
12145
  }
11987
12146
  };
11988
- const params = tapscript instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script ? {
12147
+ const params = tapscript instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script ? {
11989
12148
  ...base$1,
11990
12149
  type: "delegate",
11991
12150
  params: {
@@ -12006,10 +12165,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12006
12165
  return { tapscript, params };
12007
12166
  }
12008
12167
  function rebuildTapscript(current, pubKey) {
12009
- if (current instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script) {
12010
- return new chunk3OKEUDHU_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12168
+ if (current instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script) {
12169
+ return new chunkP6EXRY5L_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12011
12170
  }
12012
- return new chunk3OKEUDHU_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12171
+ return new chunkP6EXRY5L_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12013
12172
  }
12014
12173
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
12015
12174
  const candidates = await contractRepository.getContracts({
@@ -12018,7 +12177,7 @@ async function pickActiveReceive(contractRepository, serverPubKey, expectedType)
12018
12177
  });
12019
12178
  const serverPubKeyHex = base.hex.encode(serverPubKey);
12020
12179
  const matching = candidates.filter(
12021
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk3OKEUDHU_cjs.WALLET_RECEIVE_SOURCE
12180
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkP6EXRY5L_cjs.WALLET_RECEIVE_SOURCE
12022
12181
  ).sort((a, b) => {
12023
12182
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12024
12183
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12074,7 +12233,7 @@ function computeOffchainBalance(vtxos, caps) {
12074
12233
  }
12075
12234
  };
12076
12235
  for (const vtxo of vtxos) {
12077
- if (chunk57636V35_cjs.hasTerminalSpend(vtxo)) continue;
12236
+ if (chunk5J5PDZRR_cjs.hasTerminalSpend(vtxo)) continue;
12078
12237
  addAssets(owned, vtxo);
12079
12238
  if (vtxo.isUnrolled) {
12080
12239
  unrolled += vtxo.value;
@@ -12084,11 +12243,11 @@ function computeOffchainBalance(vtxos, caps) {
12084
12243
  pendingRecovery += vtxo.value;
12085
12244
  continue;
12086
12245
  }
12087
- if (chunk57636V35_cjs.canRecoverOnchain(vtxo, now)) {
12246
+ if (chunk5J5PDZRR_cjs.canRecoverOnchain(vtxo, now)) {
12088
12247
  recoverable += vtxo.value;
12089
12248
  continue;
12090
12249
  }
12091
- if (!chunk57636V35_cjs.canSpendOffchain(vtxo, now)) continue;
12250
+ if (!chunk5J5PDZRR_cjs.canSpendOffchain(vtxo, now)) continue;
12092
12251
  if (vtxo.isPreconfirmed) {
12093
12252
  preconfirmed += vtxo.value;
12094
12253
  } else {
@@ -12258,12 +12417,12 @@ var InputSignerRouter = class {
12258
12417
  };
12259
12418
 
12260
12419
  // src/wallet/wallet.ts
12261
- var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunk57636V35_cjs.DEFAULT_ARKADE_SERVER_URL;
12420
+ var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunk5J5PDZRR_cjs.DEFAULT_ARKADE_SERVER_URL;
12262
12421
  function intentProofJobs(coins) {
12263
12422
  if (coins.length === 0) return [];
12264
12423
  const coinJobs = coins.map((coin, i) => ({
12265
12424
  index: i + 1,
12266
- lookupScript: chunk57636V35_cjs.VtxoScript.decode(coin.tapTree).pkScript
12425
+ lookupScript: chunk5J5PDZRR_cjs.VtxoScript.decode(coin.tapTree).pkScript
12267
12426
  }));
12268
12427
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
12269
12428
  }
@@ -12295,7 +12454,7 @@ function dedupeTimelocks(timelocks) {
12295
12454
  const seen = /* @__PURE__ */ new Set();
12296
12455
  const deduped = [];
12297
12456
  for (const timelock of timelocks) {
12298
- const sequence = chunk57636V35_cjs.timelockToSequence(timelock).toString();
12457
+ const sequence = chunk5J5PDZRR_cjs.timelockToSequence(timelock).toString();
12299
12458
  if (seen.has(sequence)) continue;
12300
12459
  seen.add(sequence);
12301
12460
  deduped.push(timelock);
@@ -12312,7 +12471,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
12312
12471
  state: "active"
12313
12472
  });
12314
12473
  const newest = candidates.filter(
12315
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk3OKEUDHU_cjs.WALLET_RECEIVE_SOURCE
12474
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkP6EXRY5L_cjs.WALLET_RECEIVE_SOURCE
12316
12475
  ).sort((a, b) => {
12317
12476
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12318
12477
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12320,7 +12479,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
12320
12479
  if (!newest?.params.pubKey) return baseline;
12321
12480
  try {
12322
12481
  const pubKey = base.hex.decode(newest.params.pubKey);
12323
- return new chunk3OKEUDHU_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12482
+ return new chunkP6EXRY5L_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12324
12483
  } catch (e) {
12325
12484
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
12326
12485
  return baseline;
@@ -12339,10 +12498,10 @@ function filterSnapshotVtxos(snapshot, filter, pendingSpendOutpoints) {
12339
12498
  if (vtxo.isUnrolled) {
12340
12499
  return !!f.withUnrolled;
12341
12500
  }
12342
- if (chunk57636V35_cjs.hasTerminalSpend(vtxo)) {
12501
+ if (chunk5J5PDZRR_cjs.hasTerminalSpend(vtxo)) {
12343
12502
  return false;
12344
12503
  }
12345
- if (!f.withRecoverable && chunk57636V35_cjs.canRecoverOnchain(vtxo, now)) {
12504
+ if (!f.withRecoverable && chunk5J5PDZRR_cjs.canRecoverOnchain(vtxo, now)) {
12346
12505
  return false;
12347
12506
  }
12348
12507
  return true;
@@ -12682,7 +12841,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12682
12841
  */
12683
12842
  static async setupWalletConfig(config, pubKey) {
12684
12843
  const arkadeServerUrl = getArkadeServerUrl(config);
12685
- const arkProvider = config.arkProvider || new chunk57636V35_cjs.RestArkProvider(arkadeServerUrl);
12844
+ const arkProvider = config.arkProvider || new chunk5J5PDZRR_cjs.RestArkProvider(arkadeServerUrl);
12686
12845
  let indexerProvider = config.indexerProvider;
12687
12846
  if (!indexerProvider) {
12688
12847
  let indexerUrl = config.indexerUrl;
@@ -12699,7 +12858,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12699
12858
  indexerUrl = arkadeServerUrl;
12700
12859
  }
12701
12860
  }
12702
- indexerProvider = new chunk3KW4TWP2_cjs.RestIndexerProvider(indexerUrl);
12861
+ indexerProvider = new chunkFM263GKH_cjs.RestIndexerProvider(indexerUrl);
12703
12862
  }
12704
12863
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
12705
12864
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -12708,7 +12867,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12708
12867
  source: serverInfoSource,
12709
12868
  lastOnlineAt: serverInfoLastOnlineAt
12710
12869
  } = await resolveArkInfo(arkProvider, walletRepository);
12711
- const network = chunk57636V35_cjs.getNetwork(info.network);
12870
+ const network = chunk5J5PDZRR_cjs.getNetwork(info.network);
12712
12871
  if ("descriptor" in config.identity) {
12713
12872
  const descriptor = config.identity.descriptor;
12714
12873
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -12748,18 +12907,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
12748
12907
  value: info.boardingExitDelay,
12749
12908
  type: info.boardingExitDelay < 512n ? "blocks" : "seconds"
12750
12909
  };
12751
- const serverPubKey = chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
12752
- const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12910
+ const serverPubKey = chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
12911
+ const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12753
12912
  const offchainOptions = {
12754
12913
  pubKey,
12755
12914
  serverPubKey,
12756
12915
  csvTimelock: exitTimelock
12757
12916
  };
12758
- const offchainTapscript = !delegatePubKey ? new chunk3OKEUDHU_cjs.DefaultVtxo.Script(offchainOptions) : new chunk3OKEUDHU_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
12759
- const boardingTapscript = chunk3OKEUDHU_cjs.BoardingContractHandler.createScript({
12917
+ const offchainTapscript = !delegatePubKey ? new chunkP6EXRY5L_cjs.DefaultVtxo.Script(offchainOptions) : new chunkP6EXRY5L_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
12918
+ const boardingTapscript = chunkP6EXRY5L_cjs.BoardingContractHandler.createScript({
12760
12919
  pubKey: base.hex.encode(pubKey),
12761
12920
  serverPubKey: base.hex.encode(serverPubKey),
12762
- csvTimelock: chunk57636V35_cjs.timelockToSequence(boardingTimelock).toString()
12921
+ csvTimelock: chunk5J5PDZRR_cjs.timelockToSequence(boardingTimelock).toString()
12763
12922
  });
12764
12923
  return {
12765
12924
  arkProvider,
@@ -12925,7 +13084,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12925
13084
  if (!filter?.withUnrolled) {
12926
13085
  logExcludedVtxos(
12927
13086
  "getSpendableVtxos",
12928
- snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunk57636V35_cjs.hasTerminalSpend(vtxo)),
13087
+ snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunk5J5PDZRR_cjs.hasTerminalSpend(vtxo)),
12929
13088
  [() => UNROLLED_REASON]
12930
13089
  );
12931
13090
  }
@@ -13068,7 +13227,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13068
13227
  const response = await contractManager.getContractsWithVtxos();
13069
13228
  const allVtxos = response.flatMap((_) => _.vtxos);
13070
13229
  const { boardingTxs, commitmentsToIgnore } = await this.getBoardingTxs();
13071
- const resolveTxCreatedAt = (txids) => chunk57636V35_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13230
+ const resolveTxCreatedAt = (txids) => chunk5J5PDZRR_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13072
13231
  return buildTransactionHistory(
13073
13232
  allVtxos,
13074
13233
  boardingTxs,
@@ -13162,7 +13321,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13162
13321
  },
13163
13322
  isUnrolled: true,
13164
13323
  ...boardingFacts,
13165
- virtualStatus: chunk57636V35_cjs.toVirtualStatus(boardingFacts),
13324
+ virtualStatus: chunk5J5PDZRR_cjs.toVirtualStatus(boardingFacts),
13166
13325
  spentBy: "",
13167
13326
  createdAt: tx.status.confirmed ? new Date(tx.status.block_time * 1e3) : /* @__PURE__ */ new Date(0),
13168
13327
  script: scriptHex
@@ -13218,9 +13377,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13218
13377
  async getBoardingTapscripts(allowedSigners) {
13219
13378
  const byScript = /* @__PURE__ */ new Map();
13220
13379
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
13221
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunk3OKEUDHU_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13380
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkP6EXRY5L_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13222
13381
  add(
13223
- new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
13382
+ new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
13224
13383
  pubKey: await this.identity.xOnlyPublicKey(),
13225
13384
  serverPubKey: this.boardingTapscript.options.serverPubKey,
13226
13385
  csvTimelock: boardingCsv
@@ -13235,7 +13394,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13235
13394
  for (const c of boardingContracts) {
13236
13395
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
13237
13396
  try {
13238
- add(chunk3OKEUDHU_cjs.BoardingContractHandler.createScript(c.params));
13397
+ add(chunkP6EXRY5L_cjs.BoardingContractHandler.createScript(c.params));
13239
13398
  } catch (e) {
13240
13399
  console.warn("Skipping malformed boarding contract", c.script, e);
13241
13400
  }
@@ -13273,7 +13432,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13273
13432
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
13274
13433
  // not the wallet's current boarding timelock, which a signer
13275
13434
  // rotation may have changed.
13276
- csvTimelock: chunk57636V35_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
13435
+ csvTimelock: chunk5J5PDZRR_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
13277
13436
  coins: utxos
13278
13437
  });
13279
13438
  }
@@ -13371,7 +13530,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13371
13530
  const cm = await this.getContractManager();
13372
13531
  let annotationQueue = Promise.resolve();
13373
13532
  indexerStopFunc = cm.onContractEvent((event) => {
13374
- if (event.type !== "vtxo_received" && event.type !== "vtxo_spent") {
13533
+ if (!isContractVtxoEvent(event)) {
13375
13534
  return;
13376
13535
  }
13377
13536
  if (event.contract.type !== "default" && event.contract.type !== "delegate") {
@@ -13406,7 +13565,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13406
13565
  /** Fetch Arkade transaction ids that are still pending final settlement. */
13407
13566
  async fetchPendingTxs() {
13408
13567
  const scripts = await this.getWalletScripts();
13409
- const vtxos = await chunk57636V35_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
13568
+ const vtxos = await chunk5J5PDZRR_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
13410
13569
  return vtxos.filter(
13411
13570
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
13412
13571
  ).map((_) => _.arkTxId);
@@ -13437,7 +13596,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13437
13596
  });
13438
13597
  for (const contract of contracts) {
13439
13598
  if (map.has(contract.script)) continue;
13440
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
13599
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
13441
13600
  if (handler) {
13442
13601
  const script = handler.createScript(contract.params);
13443
13602
  map.set(contract.script, script);
@@ -13549,7 +13708,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13549
13708
  }
13550
13709
  });
13551
13710
  const baselinePubkey = await this.identity.xOnlyPublicKey();
13552
- const delegatePubKey = this.offchainTapscript instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13711
+ const delegatePubKey = this.offchainTapscript instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13553
13712
  const baselineSigners = [
13554
13713
  this.offchainTapscript.options.serverPubKey,
13555
13714
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
@@ -13557,8 +13716,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
13557
13716
  const seenBaselineScripts = /* @__PURE__ */ new Set();
13558
13717
  for (const serverPubKey of baselineSigners) {
13559
13718
  for (const csvTimelock of this.walletContractTimelocks) {
13560
- const csvTimelockStr = chunk57636V35_cjs.timelockToSequence(csvTimelock).toString();
13561
- const defaultScript = new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
13719
+ const csvTimelockStr = chunk5J5PDZRR_cjs.timelockToSequence(csvTimelock).toString();
13720
+ const defaultScript = new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
13562
13721
  pubKey: baselinePubkey,
13563
13722
  serverPubKey,
13564
13723
  csvTimelock
@@ -13579,7 +13738,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13579
13738
  });
13580
13739
  }
13581
13740
  if (delegatePubKey) {
13582
- const delegateScript = new chunk3OKEUDHU_cjs.DelegateVtxo.Script({
13741
+ const delegateScript = new chunkP6EXRY5L_cjs.DelegateVtxo.Script({
13583
13742
  pubKey: baselinePubkey,
13584
13743
  serverPubKey,
13585
13744
  delegatePubKey,
@@ -13603,9 +13762,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13603
13762
  }
13604
13763
  }
13605
13764
  }
13606
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunk3OKEUDHU_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13765
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkP6EXRY5L_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13607
13766
  for (const serverPubKey of baselineSigners) {
13608
- const baselineBoarding = new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
13767
+ const baselineBoarding = new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
13609
13768
  pubKey: baselinePubkey,
13610
13769
  serverPubKey,
13611
13770
  csvTimelock: boardingCsvTimelock
@@ -13618,7 +13777,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13618
13777
  params: {
13619
13778
  pubKey: base.hex.encode(baselineBoarding.options.pubKey),
13620
13779
  serverPubKey: base.hex.encode(serverPubKey),
13621
- csvTimelock: chunk57636V35_cjs.timelockToSequence(boardingCsvTimelock).toString()
13780
+ csvTimelock: chunk5J5PDZRR_cjs.timelockToSequence(boardingCsvTimelock).toString()
13622
13781
  },
13623
13782
  script: boardingScriptHex,
13624
13783
  address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
@@ -13818,7 +13977,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13818
13977
  serverPubKey: this.offchainTapscript.options.serverPubKey,
13819
13978
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
13820
13979
  csvTimelocks: this.walletContractTimelocks,
13821
- delegatePubKey: this.offchainTapscript instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
13980
+ delegatePubKey: this.offchainTapscript instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
13822
13981
  };
13823
13982
  }
13824
13983
  _signerRouter;
@@ -14063,7 +14222,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14063
14222
  const [row] = await manager.getContracts({ script: base.hex.encode(display.pkScript) });
14064
14223
  const persisted = row?.metadata?.signingDescriptor;
14065
14224
  if (typeof persisted === "string") return persisted;
14066
- return chunk3OKEUDHU_cjs.identityDescriptor(this.identity);
14225
+ return chunkP6EXRY5L_cjs.identityDescriptor(this.identity);
14067
14226
  }
14068
14227
  /**
14069
14228
  * Build, persist and shape one address of `type` owned by `descriptor` —
@@ -14079,7 +14238,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14079
14238
  async mintAddress(manager, type, descriptor, tagSource, allocated) {
14080
14239
  if (type === "boarding") {
14081
14240
  const built2 = this.buildBoardingContract(
14082
- chunk3OKEUDHU_cjs.deriveDescriptorLeafPubKey(descriptor),
14241
+ chunkP6EXRY5L_cjs.deriveDescriptorLeafPubKey(descriptor),
14083
14242
  descriptor,
14084
14243
  tagSource
14085
14244
  );
@@ -14124,11 +14283,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14124
14283
  * {@link buildReceiveContract}.
14125
14284
  */
14126
14285
  buildBoardingContract(pubKey, descriptor, tagSource) {
14127
- const tapscript = new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
14286
+ const tapscript = new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
14128
14287
  ...this._boardingTapscript.options,
14129
14288
  pubKey
14130
14289
  });
14131
- const csvTimelock = tapscript.options.csvTimelock ?? chunk3OKEUDHU_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14290
+ const csvTimelock = tapscript.options.csvTimelock ?? chunkP6EXRY5L_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14132
14291
  return {
14133
14292
  tapscript,
14134
14293
  params: {
@@ -14136,13 +14295,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14136
14295
  params: {
14137
14296
  pubKey: base.hex.encode(pubKey),
14138
14297
  serverPubKey: base.hex.encode(tapscript.options.serverPubKey),
14139
- csvTimelock: chunk57636V35_cjs.timelockToSequence(csvTimelock).toString()
14298
+ csvTimelock: chunk5J5PDZRR_cjs.timelockToSequence(csvTimelock).toString()
14140
14299
  },
14141
14300
  script: base.hex.encode(tapscript.pkScript),
14142
14301
  address: tapscript.address(this.network.hrp, this.arkServerPublicKey).encode(),
14143
14302
  state: "active",
14144
14303
  metadata: {
14145
- ...tagSource && { source: chunk3OKEUDHU_cjs.WALLET_RECEIVE_SOURCE },
14304
+ ...tagSource && { source: chunkP6EXRY5L_cjs.WALLET_RECEIVE_SOURCE },
14146
14305
  signingDescriptor: descriptor
14147
14306
  }
14148
14307
  }
@@ -14171,7 +14330,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14171
14330
  if (this._descriptorProvider instanceof HDDescriptorProvider) {
14172
14331
  return (await this.getContractManager()).getNextSigningDescriptor();
14173
14332
  }
14174
- return chunk3OKEUDHU_cjs.identityDescriptor(this.identity);
14333
+ return chunkP6EXRY5L_cjs.identityDescriptor(this.identity);
14175
14334
  }
14176
14335
  /**
14177
14336
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -14267,7 +14426,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14267
14426
  * the stable public API.
14268
14427
  */
14269
14428
  async rotateServerSigner(newServerPubKey, checkpointTapscript) {
14270
- const xonly = chunk3OKEUDHU_cjs.toXOnly(newServerPubKey, "ark signer key");
14429
+ const xonly = chunkP6EXRY5L_cjs.toXOnly(newServerPubKey, "ark signer key");
14271
14430
  const newServerUnrollScript = assertValidServerUnrollScript(
14272
14431
  checkpointTapscript,
14273
14432
  resolveCheckpointExitDelayPolicy(this.network, this.checkpointExitDelayPolicy)
@@ -14296,21 +14455,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14296
14455
  const [currentBoardingRow] = await manager.getContracts({
14297
14456
  script: currentBoardingScript
14298
14457
  });
14299
- const newOffchain = this.offchainTapscript instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script ? new chunk3OKEUDHU_cjs.DelegateVtxo.Script({
14458
+ const newOffchain = this.offchainTapscript instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script ? new chunkP6EXRY5L_cjs.DelegateVtxo.Script({
14300
14459
  ...this.offchainTapscript.options,
14301
14460
  serverPubKey: xonly
14302
- }) : new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
14461
+ }) : new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
14303
14462
  ...this.offchainTapscript.options,
14304
14463
  serverPubKey: xonly
14305
14464
  });
14306
- const newBoarding = new chunk3OKEUDHU_cjs.DefaultVtxo.Script({
14465
+ const newBoarding = new chunkP6EXRY5L_cjs.DefaultVtxo.Script({
14307
14466
  ...this._boardingTapscript.options,
14308
14467
  serverPubKey: xonly
14309
14468
  });
14310
- const offchainCsv = chunk57636V35_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14469
+ const offchainCsv = chunk5J5PDZRR_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14311
14470
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
14312
14471
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
14313
- if (newOffchain instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script) {
14472
+ if (newOffchain instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script) {
14314
14473
  await manager.createContract({
14315
14474
  type: "delegate",
14316
14475
  params: {
@@ -14338,13 +14497,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14338
14497
  metadata: currentOffchainRow?.metadata
14339
14498
  });
14340
14499
  }
14341
- const boardingCsv = newBoarding.options.csvTimelock ?? chunk3OKEUDHU_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14500
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkP6EXRY5L_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14342
14501
  await manager.createContract({
14343
14502
  type: "boarding",
14344
14503
  params: {
14345
14504
  pubKey: base.hex.encode(newBoarding.options.pubKey),
14346
14505
  serverPubKey: base.hex.encode(xonly),
14347
- csvTimelock: chunk57636V35_cjs.timelockToSequence(boardingCsv).toString()
14506
+ csvTimelock: chunk5J5PDZRR_cjs.timelockToSequence(boardingCsv).toString()
14348
14507
  },
14349
14508
  script: base.hex.encode(newBoarding.pkScript),
14350
14509
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -14377,14 +14536,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14377
14536
  _restoreInFlight;
14378
14537
  _addPendingSpends(inputs) {
14379
14538
  for (const input of inputs) {
14380
- if (chunk57636V35_cjs.isVirtualCoin(input)) {
14539
+ if (chunk5J5PDZRR_cjs.isVirtualCoin(input)) {
14381
14540
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
14382
14541
  }
14383
14542
  }
14384
14543
  }
14385
14544
  _removePendingSpends(inputs) {
14386
14545
  for (const input of inputs) {
14387
- if (chunk57636V35_cjs.isVirtualCoin(input)) {
14546
+ if (chunk5J5PDZRR_cjs.isVirtualCoin(input)) {
14388
14547
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
14389
14548
  }
14390
14549
  }
@@ -14442,13 +14601,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14442
14601
  const manager = await this.getContractManager();
14443
14602
  const provider = this._descriptorProvider;
14444
14603
  const hd = provider instanceof HDDescriptorProvider;
14445
- const staticDescriptor = hd ? void 0 : await chunk3OKEUDHU_cjs.identityDescriptor(this.identity);
14604
+ const staticDescriptor = hd ? void 0 : await chunkP6EXRY5L_cjs.identityDescriptor(this.identity);
14446
14605
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
14447
- const delegatePubKey = this.offchainTapscript instanceof chunk3OKEUDHU_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14606
+ const delegatePubKey = this.offchainTapscript instanceof chunkP6EXRY5L_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14448
14607
  const arkInfo = await this.arkProvider.getInfo();
14449
- const currentSignerPubKey = chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
14608
+ const currentSignerPubKey = chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
14450
14609
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
14451
- (s) => chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
14610
+ (s) => chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
14452
14611
  );
14453
14612
  const deps = {
14454
14613
  indexerProvider: this.indexerProvider,
@@ -14463,7 +14622,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14463
14622
  csvTimelocks: this.walletContractTimelocks,
14464
14623
  // Boarding-exit CSV so the boarding handler can build its
14465
14624
  // candidate script (distinct from the unilateral-exit matrix).
14466
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunk3OKEUDHU_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
14625
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkP6EXRY5L_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
14467
14626
  delegatePubKey
14468
14627
  };
14469
14628
  const result = await manager.scanContracts({
@@ -14577,7 +14736,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14577
14736
  throw new Error("Invalid configured public key");
14578
14737
  }
14579
14738
  const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
14580
- const forfeitPubkey = chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
14739
+ const forfeitPubkey = chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
14581
14740
  const forfeitAddress = btcSigner.Address(setup.network).decode(setup.info.forfeitAddress);
14582
14741
  const forfeitOutputScript = btcSigner.OutScript.encode(forfeitAddress);
14583
14742
  const checkpointExitDelayOverrides = {
@@ -14726,7 +14885,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14726
14885
  inputs: params.selectedVtxos,
14727
14886
  changeAmount: BigInt(changeAmount)
14728
14887
  };
14729
- const outputAddress = chunk57636V35_cjs.ArkAddress.decode(params.address);
14888
+ const outputAddress = chunk5J5PDZRR_cjs.ArkAddress.decode(params.address);
14730
14889
  assertRecipientArkAddress(
14731
14890
  params.address,
14732
14891
  outputAddress,
@@ -14792,13 +14951,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14792
14951
  void this.logUngatedInputs("settle({ inputs })", params.inputs);
14793
14952
  }
14794
14953
  const offchainAddress = await this.getAddress();
14795
- const offchainPkScript = chunk57636V35_cjs.ArkAddress.decode(offchainAddress).pkScript;
14954
+ const offchainPkScript = chunk5J5PDZRR_cjs.ArkAddress.decode(offchainAddress).pkScript;
14796
14955
  const offchainOutputScript = base.hex.encode(offchainPkScript);
14797
14956
  if (!params) {
14798
14957
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
14799
14958
  const estimator = new Estimator(fees.intentFee);
14800
14959
  let amount = 0;
14801
- const exitScript = chunk57636V35_cjs.CSVMultisigTapscript.decode(
14960
+ const exitScript = chunk5J5PDZRR_cjs.CSVMultisigTapscript.decode(
14802
14961
  base.hex.decode(this.boardingTapscript.exitScript)
14803
14962
  );
14804
14963
  const boardingTimelock = exitScript.params.timelock;
@@ -14827,7 +14986,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14827
14986
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
14828
14987
  break;
14829
14988
  }
14830
- const inputFee = estimator.evalOffchainInput(chunk57636V35_cjs.toOffchainInputFeeParams(vtxo));
14989
+ const inputFee = estimator.evalOffchainInput(chunk5J5PDZRR_cjs.toOffchainInputFeeParams(vtxo));
14831
14990
  if (inputFee.satoshis >= vtxo.value) {
14832
14991
  continue;
14833
14992
  }
@@ -14874,7 +15033,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14874
15033
  let script;
14875
15034
  let arkAddress;
14876
15035
  try {
14877
- arkAddress = chunk57636V35_cjs.ArkAddress.decode(output.address);
15036
+ arkAddress = chunk5J5PDZRR_cjs.ArkAddress.decode(output.address);
14878
15037
  } catch {
14879
15038
  arkAddress = void 0;
14880
15039
  }
@@ -14964,7 +15123,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14964
15123
  const abortController = new AbortController();
14965
15124
  let stream;
14966
15125
  let committedTxid;
14967
- const settleInputVtxos = params.inputs.filter(chunk57636V35_cjs.isVirtualCoin);
15126
+ const settleInputVtxos = params.inputs.filter(chunk5J5PDZRR_cjs.isVirtualCoin);
14968
15127
  const contractManager = await this.getContractManager();
14969
15128
  await contractManager.assertAnnotatable(settleInputVtxos);
14970
15129
  await contractManager.assertSpendableNow?.(
@@ -15076,7 +15235,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15076
15235
  async maybeRotateBoardingAfterBoard(inputs) {
15077
15236
  if (!this._descriptorProvider) return;
15078
15237
  const consumedBoarding = inputs.some(
15079
- (input) => typeof input !== "string" && !chunk57636V35_cjs.isVirtualCoin(input)
15238
+ (input) => typeof input !== "string" && !chunk5J5PDZRR_cjs.isVirtualCoin(input)
15080
15239
  );
15081
15240
  if (!consumedBoarding) return;
15082
15241
  try {
@@ -15100,7 +15259,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15100
15259
  let connectorIndex = 0;
15101
15260
  const connectorsLeaves = connectorsGraph?.leaves() || [];
15102
15261
  for (const input of inputs) {
15103
- if (!chunk57636V35_cjs.isVirtualCoin(input)) {
15262
+ if (!chunk5J5PDZRR_cjs.isVirtualCoin(input)) {
15104
15263
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
15105
15264
  const settlementInput = settlementPsbt.getInput(i);
15106
15265
  if (!settlementInput.txid || settlementInput.index === void 0) {
@@ -15131,7 +15290,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15131
15290
  }
15132
15291
  continue;
15133
15292
  }
15134
- if (chunk57636V35_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
15293
+ if (chunk5J5PDZRR_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
15135
15294
  continue;
15136
15295
  }
15137
15296
  if (connectorsLeaves.length === 0) {
@@ -15159,7 +15318,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15159
15318
  index: input.vout,
15160
15319
  witnessUtxo: {
15161
15320
  amount: BigInt(input.value),
15162
- script: chunk57636V35_cjs.VtxoScript.decode(input.tapTree).pkScript
15321
+ script: chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).pkScript
15163
15322
  },
15164
15323
  sighashType: btcSigner.SigHash.DEFAULT,
15165
15324
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -15178,7 +15337,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15178
15337
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
15179
15338
  {
15180
15339
  index: 0,
15181
- lookupScript: chunk57636V35_cjs.VtxoScript.decode(input.tapTree).pkScript
15340
+ lookupScript: chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).pkScript
15182
15341
  }
15183
15342
  ]);
15184
15343
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -15236,7 +15395,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15236
15395
  resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
15237
15396
  );
15238
15397
  await this.arkProvider.confirmRegistration(intentId);
15239
- const sweepTapscript = chunk57636V35_cjs.CSVMultisigTapscript.encode({
15398
+ const sweepTapscript = chunk5J5PDZRR_cjs.CSVMultisigTapscript.encode({
15240
15399
  timelock,
15241
15400
  pubkeys: [this.forfeitPubkey]
15242
15401
  }).script;
@@ -15251,10 +15410,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15251
15410
  throw new Error("Sweep tap tree root not set");
15252
15411
  }
15253
15412
  const xOnlyPublicKeys = event.cosignersPublicKeys.map(
15254
- (k) => base.hex.encode(chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15413
+ (k) => base.hex.encode(chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15255
15414
  );
15256
15415
  const signerPublicKey = await session.getPublicKey();
15257
- const xonlySignerPublicKey = chunk3OKEUDHU_cjs.toXOnly(signerPublicKey, "signer key");
15416
+ const xonlySignerPublicKey = chunkP6EXRY5L_cjs.toXOnly(signerPublicKey, "signer key");
15258
15417
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
15259
15418
  return { skip: true };
15260
15419
  }
@@ -15344,9 +15503,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15344
15503
  ...existing ?? {},
15345
15504
  intentTxId,
15346
15505
  registerProof: intent.proof,
15347
- registerProofMessage: chunk57636V35_cjs.Intent.encodeMessage(intent.message),
15506
+ registerProofMessage: chunk5J5PDZRR_cjs.Intent.encodeMessage(intent.message),
15348
15507
  deleteProof: deleteIntent.proof,
15349
- deleteProofMessage: chunk57636V35_cjs.Intent.encodeMessage(deleteIntent.message),
15508
+ deleteProofMessage: chunk5J5PDZRR_cjs.Intent.encodeMessage(deleteIntent.message),
15350
15509
  intentVtxos: inputs.map((i) => ({
15351
15510
  txid: i.txid,
15352
15511
  vout: i.vout
@@ -15378,7 +15537,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15378
15537
  try {
15379
15538
  return await this.arkProvider.registerIntent(intent);
15380
15539
  } catch (error) {
15381
- if (error instanceof chunk57636V35_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
15540
+ if (error instanceof chunk5J5PDZRR_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
15382
15541
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
15383
15542
  await this.arkProvider.deleteIntent(deleteIntent);
15384
15543
  return this.arkProvider.registerIntent(intent);
@@ -15394,7 +15553,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15394
15553
  expire_at: 0,
15395
15554
  cosigners_public_keys: cosignerPubKeys
15396
15555
  };
15397
- const proof = chunk57636V35_cjs.Intent.create(message, coins, outputs);
15556
+ const proof = chunk5J5PDZRR_cjs.Intent.create(message, coins, outputs);
15398
15557
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15399
15558
  return {
15400
15559
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15406,7 +15565,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15406
15565
  type: "delete",
15407
15566
  expire_at: 0
15408
15567
  };
15409
- const proof = chunk57636V35_cjs.Intent.create(message, coins, []);
15568
+ const proof = chunk5J5PDZRR_cjs.Intent.create(message, coins, []);
15410
15569
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15411
15570
  return {
15412
15571
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15418,7 +15577,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15418
15577
  type: "get-pending-tx",
15419
15578
  expire_at: 0
15420
15579
  };
15421
- const proof = chunk57636V35_cjs.Intent.create(message, coins, []);
15580
+ const proof = chunk5J5PDZRR_cjs.Intent.create(message, coins, []);
15422
15581
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15423
15582
  return {
15424
15583
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15439,7 +15598,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15439
15598
  if (!vtxos || vtxos.length === 0) {
15440
15599
  const scriptMap = await this.getScriptMap();
15441
15600
  const allExtended = [];
15442
- const fetchedVtxos = await chunk57636V35_cjs.getAllNormalizedVtxos(this.indexerProvider, [
15601
+ const fetchedVtxos = await chunk5J5PDZRR_cjs.getAllNormalizedVtxos(this.indexerProvider, [
15443
15602
  ...scriptMap.keys()
15444
15603
  ]);
15445
15604
  for (const vtxo of fetchedVtxos) {
@@ -15483,7 +15642,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15483
15642
  try {
15484
15643
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((c) => {
15485
15644
  const tx = btcSigner.Transaction.fromPSBT(base.base64.decode(c));
15486
- chunk57636V35_cjs.assertAllowedSighashTypes(tx);
15645
+ chunk5J5PDZRR_cjs.assertAllowedSighashTypes(tx);
15487
15646
  return tx;
15488
15647
  });
15489
15648
  assertCheckpointsMatchInputs(
@@ -15555,11 +15714,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15555
15714
  * against the current key alone would leave it pending forever.
15556
15715
  */
15557
15716
  checkpointUnrollCandidates(info) {
15558
- const current = chunk57636V35_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
15717
+ const current = chunk5J5PDZRR_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
15559
15718
  const candidates = [this._serverUnrollScript, current];
15560
15719
  for (const deprecated of signerSetFromInfo(info).deprecated.keys()) {
15561
15720
  candidates.push(
15562
- chunk57636V35_cjs.CSVMultisigTapscript.encode({
15721
+ chunk5J5PDZRR_cjs.CSVMultisigTapscript.encode({
15563
15722
  ...current.params,
15564
15723
  pubkeys: [base.hex.decode(deprecated)]
15565
15724
  })
@@ -15650,7 +15809,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15650
15809
  if (vtxos.length === 0) {
15651
15810
  throw new Error("No VTXOs found for this arkadeCash");
15652
15811
  }
15653
- const myPkScript = chunk57636V35_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
15812
+ const myPkScript = chunk5J5PDZRR_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
15654
15813
  let { spendable, unclaimed } = this.classifyCashVtxos(vtxos);
15655
15814
  let swept = 0;
15656
15815
  const drainable = vtxos.filter(
@@ -15726,7 +15885,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15726
15885
  const spendable = [];
15727
15886
  const unclaimed = [];
15728
15887
  for (const vtxo of vtxos) {
15729
- if (chunk57636V35_cjs.hasTerminalSpend(vtxo)) {
15888
+ if (chunk5J5PDZRR_cjs.hasTerminalSpend(vtxo)) {
15730
15889
  unclaimed.push(cashReport(vtxo, "already-spent"));
15731
15890
  } else if (vtxo.isUnrolled) {
15732
15891
  unclaimed.push(cashReport(vtxo, "exited"));
@@ -15748,7 +15907,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15748
15907
  const all = [];
15749
15908
  const seen = /* @__PURE__ */ new Set();
15750
15909
  for (let pageIndex = 0; ; pageIndex++) {
15751
- const { vtxos, page } = await chunk57636V35_cjs.getNormalizedVtxos(this.indexerProvider, {
15910
+ const { vtxos, page } = await chunk5J5PDZRR_cjs.getNormalizedVtxos(this.indexerProvider, {
15752
15911
  scripts,
15753
15912
  pageIndex,
15754
15913
  pageSize
@@ -15795,7 +15954,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15795
15954
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
15796
15955
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
15797
15956
  const message = { type: "get-pending-tx", expire_at: 0 };
15798
- const proof = chunk57636V35_cjs.Intent.create(message, batch, []);
15957
+ const proof = chunk5J5PDZRR_cjs.Intent.create(message, batch, []);
15799
15958
  const signedProof = await identity.sign(
15800
15959
  proof,
15801
15960
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -15817,7 +15976,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15817
15976
  try {
15818
15977
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((checkpoint) => {
15819
15978
  const tx = btcSigner.Transaction.fromPSBT(base.base64.decode(checkpoint));
15820
- chunk57636V35_cjs.assertAllowedSighashTypes(tx);
15979
+ chunk5J5PDZRR_cjs.assertAllowedSighashTypes(tx);
15821
15980
  return tx;
15822
15981
  });
15823
15982
  assertCheckpointsMatchInputs(
@@ -16016,7 +16175,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16016
16175
  script: recipient.script,
16017
16176
  amount: BigInt(recipient.amount),
16018
16177
  // Already checked against the recipient address in `validateRecipients`.
16019
- ...recipient.tapTree ? { tapTree: chunk57636V35_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
16178
+ ...recipient.tapTree ? { tapTree: chunk5J5PDZRR_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
16020
16179
  }));
16021
16180
  const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
16022
16181
  let changeAmount = totalBtcSelected - totalBtcOutput;
@@ -16160,10 +16319,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16160
16319
  const serverPubKey = this.arkServerPublicKey;
16161
16320
  const serverUnrollScript = this.serverUnrollScript;
16162
16321
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
16163
- const normalizedInputs = inputs.map(chunk57636V35_cjs.normalizeVtxo);
16164
- const at = now ?? await chunk57636V35_cjs.resolveTimeHeight(this.onchainProvider);
16322
+ const normalizedInputs = inputs.map(chunk5J5PDZRR_cjs.normalizeVtxo);
16323
+ const at = now ?? await chunk5J5PDZRR_cjs.resolveTimeHeight(this.onchainProvider);
16165
16324
  for (const input of normalizedInputs) {
16166
- if (!chunk57636V35_cjs.canSpendOffchain(input, at)) {
16325
+ if (!chunk5J5PDZRR_cjs.canSpendOffchain(input, at)) {
16167
16326
  throw new Error(
16168
16327
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
16169
16328
  );
@@ -16233,7 +16392,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16233
16392
  );
16234
16393
  const arkTxJobs = inputs.map((input, index) => ({
16235
16394
  index,
16236
- lookupScript: chunk57636V35_cjs.VtxoScript.decode(input.tapTree).pkScript
16395
+ lookupScript: chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).pkScript
16237
16396
  }));
16238
16397
  const identity = this.identity;
16239
16398
  const signer = {
@@ -16319,14 +16478,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16319
16478
  const spentBy = checkpointIdByOutpoint.get(`${vtxo.txid}:${vtxo.vout}`);
16320
16479
  spentVtxos.push({
16321
16480
  ...spentFacts,
16322
- virtualStatus: chunk57636V35_cjs.toVirtualStatus(spentFacts),
16481
+ virtualStatus: chunk5J5PDZRR_cjs.toVirtualStatus(spentFacts),
16323
16482
  ...spentBy ? { spentBy } : {},
16324
16483
  arkTxId: arkTxid
16325
16484
  });
16326
16485
  for (const id of vtxo.commitmentTxIds) {
16327
16486
  commitmentTxIds.add(id);
16328
16487
  }
16329
- const vtxoExpiry = chunk57636V35_cjs.toBatchExpiry(vtxo);
16488
+ const vtxoExpiry = chunk5J5PDZRR_cjs.toBatchExpiry(vtxo);
16330
16489
  if (vtxoExpiry) {
16331
16490
  batchExpiry = Math.min(batchExpiry, vtxoExpiry);
16332
16491
  }
@@ -16339,7 +16498,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16339
16498
  isSwept: false,
16340
16499
  isPreconfirmed: true,
16341
16500
  commitmentTxIds: Array.from(commitmentTxIds),
16342
- ...chunk57636V35_cjs.parseLegacyExpiry(batchExpiry)
16501
+ ...chunk5J5PDZRR_cjs.parseLegacyExpiry(batchExpiry)
16343
16502
  };
16344
16503
  changeVtxo = {
16345
16504
  txid: arkTxid,
@@ -16351,7 +16510,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16351
16510
  tapTree: offchainTapscript.encode(),
16352
16511
  value: Number(changeAmount),
16353
16512
  ...changeFacts,
16354
- virtualStatus: chunk57636V35_cjs.toVirtualStatus(changeFacts),
16513
+ virtualStatus: chunk5J5PDZRR_cjs.toVirtualStatus(changeFacts),
16355
16514
  spentBy: "",
16356
16515
  status: {
16357
16516
  confirmed: false
@@ -16420,12 +16579,12 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16420
16579
  const spentVtxos = [];
16421
16580
  const inputArkTxIds = /* @__PURE__ */ new Set();
16422
16581
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
16423
- const vtxoInputs = inputs.filter(chunk57636V35_cjs.isVirtualCoin);
16582
+ const vtxoInputs = inputs.filter(chunk5J5PDZRR_cjs.isVirtualCoin);
16424
16583
  const cm = await this.getContractManager();
16425
16584
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
16426
16585
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
16427
16586
  for (const input of inputs) {
16428
- if (chunk57636V35_cjs.isVirtualCoin(input)) {
16587
+ if (chunk5J5PDZRR_cjs.isVirtualCoin(input)) {
16429
16588
  const outpoint = `${input.txid}:${input.vout}`;
16430
16589
  const vtxo = annotatedByKey.get(outpoint);
16431
16590
  if (!vtxo) {
@@ -16437,13 +16596,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16437
16596
  const settledFacts = { ...vtxo, isSpent: true };
16438
16597
  spentVtxos.push({
16439
16598
  ...settledFacts,
16440
- virtualStatus: chunk57636V35_cjs.toVirtualStatus(settledFacts),
16599
+ virtualStatus: chunk5J5PDZRR_cjs.toVirtualStatus(settledFacts),
16441
16600
  settledBy: commitmentTxid
16442
16601
  });
16443
16602
  } else {
16444
16603
  let sourceAddress;
16445
16604
  try {
16446
- sourceAddress = chunk57636V35_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
16605
+ sourceAddress = chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
16447
16606
  this.network
16448
16607
  );
16449
16608
  } catch {
@@ -16501,9 +16660,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16501
16660
  }
16502
16661
  };
16503
16662
  function selectVirtualCoins(coins, targetAmount) {
16504
- const sortedCoins = coins.map(chunk57636V35_cjs.normalizeVtxo).sort((a, b) => {
16505
- const expiryA = chunk57636V35_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
16506
- const expiryB = chunk57636V35_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
16663
+ const sortedCoins = coins.map(chunk5J5PDZRR_cjs.normalizeVtxo).sort((a, b) => {
16664
+ const expiryA = chunk5J5PDZRR_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
16665
+ const expiryB = chunk5J5PDZRR_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
16507
16666
  if (expiryA !== expiryB) {
16508
16667
  return expiryA - expiryB;
16509
16668
  }
@@ -16872,7 +17031,7 @@ var MessageBus = class {
16872
17031
  this.initialized = true;
16873
17032
  }
16874
17033
  async buildServices(config) {
16875
- const arkProvider = new chunk57636V35_cjs.RestArkProvider(config.arkServer.url);
17034
+ const arkProvider = new chunk5J5PDZRR_cjs.RestArkProvider(config.arkServer.url);
16876
17035
  const storage = {
16877
17036
  walletRepository: this.walletRepository,
16878
17037
  contractRepository: this.contractRepository,
@@ -17214,7 +17373,7 @@ var offboardNetworkNames = [
17214
17373
  function offboardDestinationScript(destinationAddress) {
17215
17374
  for (const networkName of offboardNetworkNames) {
17216
17375
  try {
17217
- const network = chunk57636V35_cjs.networks[networkName];
17376
+ const network = chunk5J5PDZRR_cjs.networks[networkName];
17218
17377
  const addr = btcSigner.Address(network).decode(destinationAddress);
17219
17378
  return btcSigner.OutScript.encode(addr);
17220
17379
  } catch {
@@ -17278,7 +17437,7 @@ var Ramps = class {
17278
17437
  }
17279
17438
  amount = amount ?? totalAmount;
17280
17439
  const offchainAddress = await this.wallet.getAddress();
17281
- const offchainAddr = chunk57636V35_cjs.ArkAddress.decode(offchainAddress);
17440
+ const offchainAddr = chunk5J5PDZRR_cjs.ArkAddress.decode(offchainAddress);
17282
17441
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
17283
17442
  const outputFee = estimator.evalOffchainOutput({
17284
17443
  amount,
@@ -17338,7 +17497,7 @@ var Ramps = class {
17338
17497
  const filteredVtxos = [];
17339
17498
  let totalAmount = 0n;
17340
17499
  for (const vtxo of vtxos) {
17341
- const inputFee = estimator.evalOffchainInput(chunk57636V35_cjs.toOffchainInputFeeParams(vtxo));
17500
+ const inputFee = estimator.evalOffchainInput(chunk5J5PDZRR_cjs.toOffchainInputFeeParams(vtxo));
17342
17501
  if (inputFee.satoshis >= vtxo.value) {
17343
17502
  continue;
17344
17503
  }
@@ -17443,6 +17602,9 @@ var DelegateNotConfiguredError = class extends Error {
17443
17602
  };
17444
17603
  var DelegatorNotConfiguredError = DelegateNotConfiguredError;
17445
17604
  var DEFAULT_MESSAGE_TAG = "WALLET_UPDATER";
17605
+ function unsupportedByManager(method) {
17606
+ return new Error(`Contract manager does not support ${method}`);
17607
+ }
17446
17608
  var serializeMigrationVtxoRef = (ref) => ({
17447
17609
  txid: ref.txid,
17448
17610
  vout: ref.vout,
@@ -17827,6 +17989,39 @@ var WalletMessageHandler = class {
17827
17989
  payload: { contracts }
17828
17990
  });
17829
17991
  }
17992
+ case "WATCH_SCRIPT": {
17993
+ const manager = await this.readonlyWallet.getContractManager();
17994
+ if (!manager.watchScript) throw unsupportedByManager("watchScript");
17995
+ await manager.watchScript(message.payload.script, {
17996
+ label: message.payload.label
17997
+ });
17998
+ return this.tagged({
17999
+ id,
18000
+ type: "SCRIPT_WATCHED",
18001
+ payload: { script: message.payload.script }
18002
+ });
18003
+ }
18004
+ case "UNWATCH_SCRIPT": {
18005
+ const manager = await this.readonlyWallet.getContractManager();
18006
+ if (!manager.unwatchScript) throw unsupportedByManager("unwatchScript");
18007
+ await manager.unwatchScript(message.payload.script);
18008
+ return this.tagged({
18009
+ id,
18010
+ type: "SCRIPT_UNWATCHED",
18011
+ payload: { script: message.payload.script }
18012
+ });
18013
+ }
18014
+ case "GET_WATCHED_SCRIPTS": {
18015
+ const manager = await this.readonlyWallet.getContractManager();
18016
+ if (!manager.getWatchedScripts) {
18017
+ throw unsupportedByManager("getWatchedScripts");
18018
+ }
18019
+ return this.tagged({
18020
+ id,
18021
+ type: "WATCHED_SCRIPTS",
18022
+ payload: { scripts: await manager.getWatchedScripts() }
18023
+ });
18024
+ }
17830
18025
  case "ANNOTATE_VTXOS": {
17831
18026
  const manager = await this.readonlyWallet.getContractManager();
17832
18027
  const annotated = await manager.annotateVtxos(message.payload.vtxos);
@@ -18174,7 +18369,7 @@ var WalletMessageHandler = class {
18174
18369
  // Wallet methods
18175
18370
  async handleInitWallet({ payload }) {
18176
18371
  const { arkServerUrl } = payload;
18177
- this.indexerProvider = new chunk3KW4TWP2_cjs.RestIndexerProvider(arkServerUrl);
18372
+ this.indexerProvider = new chunkFM263GKH_cjs.RestIndexerProvider(arkServerUrl);
18178
18373
  await this.onWalletInitialized();
18179
18374
  }
18180
18375
  /**
@@ -18463,7 +18658,7 @@ var WalletMessageHandler = class {
18463
18658
  if (v.isUnrolled) {
18464
18659
  return withUnrolled;
18465
18660
  }
18466
- if (chunk57636V35_cjs.hasTerminalSpend(v)) {
18661
+ if (chunk5J5PDZRR_cjs.hasTerminalSpend(v)) {
18467
18662
  return false;
18468
18663
  }
18469
18664
  if (includeRecoverable) {
@@ -18472,10 +18667,10 @@ var WalletMessageHandler = class {
18472
18667
  if (dustAmount != null && isSubdust(v, dustAmount)) {
18473
18668
  return false;
18474
18669
  }
18475
- if (chunk57636V35_cjs.isRecoverable(v)) {
18670
+ if (chunk5J5PDZRR_cjs.isRecoverable(v)) {
18476
18671
  return false;
18477
18672
  }
18478
- if (chunk57636V35_cjs.isExpired(v)) {
18673
+ if (chunk5J5PDZRR_cjs.isExpired(v)) {
18479
18674
  return false;
18480
18675
  }
18481
18676
  return true;
@@ -18573,7 +18768,7 @@ var WalletMessageHandler = class {
18573
18768
  if (!this.readonlyWallet) return null;
18574
18769
  const { boardingTxs, commitmentsToIgnore } = await this.readonlyWallet.getBoardingTxs();
18575
18770
  const indexerProvider = this.indexerProvider;
18576
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunk57636V35_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
18771
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunk5J5PDZRR_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
18577
18772
  return buildTransactionHistory(vtxos, boardingTxs, commitmentsToIgnore, resolveTxCreatedAt);
18578
18773
  }
18579
18774
  async ensureContractEventBroadcasting() {
@@ -18630,6 +18825,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
18630
18825
  GET_TRANSACTION_HISTORY: 2e4,
18631
18826
  GET_CONTRACTS: 2e4,
18632
18827
  GET_CONTRACTS_WITH_VTXOS: 2e4,
18828
+ GET_WATCHED_SCRIPTS: 1e4,
18633
18829
  ANNOTATE_VTXOS: 2e4,
18634
18830
  GET_SPENDABLE_PATHS: 2e4,
18635
18831
  GET_ALL_SPENDING_PATHS: 2e4,
@@ -18666,6 +18862,10 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
18666
18862
  SIGN_TRANSACTION: 3e4,
18667
18863
  CREATE_CONTRACT: 3e4,
18668
18864
  UPDATE_CONTRACT: 3e4,
18865
+ // Registering a watch is an in-memory map write plus one subscription
18866
+ // update — no indexer round trip on the request path.
18867
+ WATCH_SCRIPT: 1e4,
18868
+ UNWATCH_SCRIPT: 1e4,
18669
18869
  DELETE_CONTRACT: 1e4,
18670
18870
  REFRESH_VTXOS: 3e4,
18671
18871
  REFRESH_OUTPOINTS: 3e4
@@ -18686,6 +18886,7 @@ var DEDUPABLE_REQUEST_TYPES = /* @__PURE__ */ new Set([
18686
18886
  "GET_SPENDABLE_VTXOS",
18687
18887
  "GET_CONTRACTS",
18688
18888
  "GET_CONTRACTS_WITH_VTXOS",
18889
+ "GET_WATCHED_SCRIPTS",
18689
18890
  "ANNOTATE_VTXOS",
18690
18891
  "GET_SPENDABLE_PATHS",
18691
18892
  "GET_ALL_SPENDING_PATHS",
@@ -19269,7 +19470,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19269
19470
  };
19270
19471
  try {
19271
19472
  const response = await this.sendMessage(message);
19272
- return response.payload.vtxos.map(chunk57636V35_cjs.normalizeVtxo);
19473
+ return response.payload.vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo);
19273
19474
  } catch (error) {
19274
19475
  throw new Error(`Failed to get vtxos: ${error}`);
19275
19476
  }
@@ -19294,7 +19495,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19294
19495
  };
19295
19496
  try {
19296
19497
  const response = await this.sendMessage(message);
19297
- return response.payload.vtxos.map(chunk57636V35_cjs.normalizeVtxo);
19498
+ return response.payload.vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo);
19298
19499
  } catch (error) {
19299
19500
  throw new Error(`Failed to get spendable vtxos: ${error}`);
19300
19501
  }
@@ -19394,6 +19595,46 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19394
19595
  throw new Error("Failed to get contracts with vtxos");
19395
19596
  }
19396
19597
  },
19598
+ async watchScript(script, options) {
19599
+ const message = {
19600
+ type: "WATCH_SCRIPT",
19601
+ id: getRandomId(),
19602
+ tag: messageTag,
19603
+ payload: { script, label: options?.label }
19604
+ };
19605
+ try {
19606
+ await sendContractMessage(message);
19607
+ } catch (e) {
19608
+ throw new Error("Failed to watch script");
19609
+ }
19610
+ },
19611
+ async unwatchScript(script) {
19612
+ const message = {
19613
+ type: "UNWATCH_SCRIPT",
19614
+ id: getRandomId(),
19615
+ tag: messageTag,
19616
+ payload: { script }
19617
+ };
19618
+ try {
19619
+ await sendContractMessage(message);
19620
+ } catch (e) {
19621
+ throw new Error("Failed to unwatch script");
19622
+ }
19623
+ },
19624
+ async getWatchedScripts() {
19625
+ const message = {
19626
+ type: "GET_WATCHED_SCRIPTS",
19627
+ id: getRandomId(),
19628
+ tag: messageTag,
19629
+ payload: {}
19630
+ };
19631
+ try {
19632
+ const response = await sendContractMessage(message);
19633
+ return response.payload.scripts;
19634
+ } catch (e) {
19635
+ throw new Error("Failed to get watched scripts");
19636
+ }
19637
+ },
19397
19638
  getSyncState() {
19398
19639
  return syncState;
19399
19640
  },
@@ -19425,7 +19666,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19425
19666
  };
19426
19667
  try {
19427
19668
  const response = await sendContractMessage(message);
19428
- return response.payload.vtxos.map(chunk57636V35_cjs.normalizeVtxo);
19669
+ return response.payload.vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo);
19429
19670
  } catch (e) {
19430
19671
  throw new Error("Failed to annotate vtxos");
19431
19672
  }
@@ -20026,7 +20267,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
20026
20267
  };
20027
20268
  try {
20028
20269
  const response = await wallet.sendMessage(message);
20029
- return response.payload.vtxos.map(chunk57636V35_cjs.normalizeVtxo);
20270
+ return response.payload.vtxos.map(chunk5J5PDZRR_cjs.normalizeVtxo);
20030
20271
  } catch (e) {
20031
20272
  throw new Error(`Failed to get expiring vtxos: ${e}`);
20032
20273
  }
@@ -20138,12 +20379,12 @@ var OnchainWallet = class _OnchainWallet {
20138
20379
  * @returns Configured onchain wallet
20139
20380
  * @throws Error if the configured identity cannot produce a valid x-only public key
20140
20381
  */
20141
- static async create(identity, networkName = chunk57636V35_cjs.DEFAULT_NETWORK_NAME, provider) {
20382
+ static async create(identity, networkName = chunk5J5PDZRR_cjs.DEFAULT_NETWORK_NAME, provider) {
20142
20383
  const pubkey = await identity.xOnlyPublicKey();
20143
20384
  if (!pubkey) {
20144
20385
  throw new Error("Invalid configured public key");
20145
20386
  }
20146
- const network = chunk57636V35_cjs.getNetwork(networkName);
20387
+ const network = chunk5J5PDZRR_cjs.getNetwork(networkName);
20147
20388
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
20148
20389
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
20149
20390
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -20249,7 +20490,7 @@ var OnchainWallet = class _OnchainWallet {
20249
20490
  if (!inputs) {
20250
20491
  throw new Error("Fee estimation failed");
20251
20492
  }
20252
- let tx = new chunk57636V35_cjs.Transaction();
20493
+ let tx = new chunk5J5PDZRR_cjs.Transaction();
20253
20494
  for (const input of inputs) {
20254
20495
  tx.addInput({
20255
20496
  txid: input.txid,
@@ -20307,7 +20548,7 @@ var OnchainWallet = class _OnchainWallet {
20307
20548
  * @throws If the parent has no anchor, or funding cannot be selected/signed
20308
20549
  */
20309
20550
  async bumpAnchor(parentHex, feeRate) {
20310
- const parent = chunk57636V35_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
20551
+ const parent = chunk5J5PDZRR_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
20311
20552
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
20312
20553
  const child = await this.buildBumpPackage(parent, feeRate, coins);
20313
20554
  return [parent.hex, child.hex];
@@ -21214,7 +21455,7 @@ async function resolvePrevTxs(txids, source, onchain) {
21214
21455
  try {
21215
21456
  const { txs } = await source.getVirtualTxs(wanted);
21216
21457
  for (const psbt of txs) {
21217
- const tx = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
21458
+ const tx = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
21218
21459
  resolved.set(tx.id, tx.toBytes());
21219
21460
  }
21220
21461
  } catch (err) {
@@ -21247,7 +21488,7 @@ async function resolvePrevTxs(txids, source, onchain) {
21247
21488
  async function attachPrevArkTxs(tx, txids, source, onchain) {
21248
21489
  const pending = [];
21249
21490
  for (let i = 0; i < tx.inputsLength; i++) {
21250
- if (chunk57636V35_cjs.getArkPsbtFields(tx, i, chunk57636V35_cjs.PrevArkTxField).length === 0) pending.push(i);
21491
+ if (chunk5J5PDZRR_cjs.getArkPsbtFields(tx, i, chunk5J5PDZRR_cjs.PrevArkTxField).length === 0) pending.push(i);
21251
21492
  }
21252
21493
  if (pending.length === 0) return;
21253
21494
  const resolved = await resolvePrevTxs(
@@ -21256,13 +21497,13 @@ async function attachPrevArkTxs(tx, txids, source, onchain) {
21256
21497
  onchain
21257
21498
  );
21258
21499
  for (const i of pending) {
21259
- chunk57636V35_cjs.setArkPsbtField(tx, i, chunk57636V35_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
21500
+ chunk5J5PDZRR_cjs.setArkPsbtField(tx, i, chunk5J5PDZRR_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
21260
21501
  }
21261
21502
  }
21262
21503
  async function attachPrevoutTxs(tx, source) {
21263
21504
  const pending = [];
21264
21505
  for (let i = 0; i < tx.inputsLength; i++) {
21265
- if (chunk57636V35_cjs.getArkPsbtFields(tx, i, chunk57636V35_cjs.PrevoutTxField).length > 0) continue;
21506
+ if (chunk5J5PDZRR_cjs.getArkPsbtFields(tx, i, chunk5J5PDZRR_cjs.PrevoutTxField).length > 0) continue;
21266
21507
  const input = tx.getInput(i);
21267
21508
  if (!input?.txid) throw new PrevTxUnavailableError(`input ${i} has no outpoint`);
21268
21509
  pending.push({ index: i, txid: base.hex.encode(input.txid) });
@@ -21273,7 +21514,7 @@ async function attachPrevoutTxs(tx, source) {
21273
21514
  resolved.set(txid, await source.getRawTransaction(txid));
21274
21515
  }
21275
21516
  for (const { index, txid } of pending) {
21276
- chunk57636V35_cjs.setArkPsbtField(tx, index, chunk57636V35_cjs.PrevoutTxField, resolved.get(txid));
21517
+ chunk5J5PDZRR_cjs.setArkPsbtField(tx, index, chunk5J5PDZRR_cjs.PrevoutTxField, resolved.get(txid));
21277
21518
  }
21278
21519
  }
21279
21520
  async function withPrevTxs(coins, source, onchain) {
@@ -21299,7 +21540,7 @@ exports.BIP322 = void 0;
21299
21540
  async function sign2(message, identity, network) {
21300
21541
  const xOnlyPubKey = await identity.xOnlyPublicKey();
21301
21542
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
21302
- const toSpend = chunk57636V35_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
21543
+ const toSpend = chunk5J5PDZRR_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
21303
21544
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
21304
21545
  const signed = await identity.sign(toSign, [0]);
21305
21546
  signed.finalizeIdx(0);
@@ -21357,7 +21598,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
21357
21598
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
21358
21599
  return false;
21359
21600
  }
21360
- const toSpend = chunk57636V35_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21601
+ const toSpend = chunk5J5PDZRR_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21361
21602
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
21362
21603
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
21363
21604
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -21378,7 +21619,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
21378
21619
  }
21379
21620
  const sighashType = sigWithHash[sigWithHash.length - 1];
21380
21621
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
21381
- const toSpend = chunk57636V35_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21622
+ const toSpend = chunk5J5PDZRR_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21382
21623
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
21383
21624
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
21384
21625
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -21431,7 +21672,7 @@ function encodeCompactSize(n) {
21431
21672
  return buf;
21432
21673
  }
21433
21674
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
21434
- const tx = new chunk57636V35_cjs.Transaction({ version: 0 });
21675
+ const tx = new chunk5J5PDZRR_cjs.Transaction({ version: 0 });
21435
21676
  tx.addInput({
21436
21677
  txid: toSpend.id,
21437
21678
  index: 0,
@@ -21445,12 +21686,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
21445
21686
  });
21446
21687
  tx.addOutput({
21447
21688
  amount: 0n,
21448
- script: chunk57636V35_cjs.OP_RETURN_EMPTY_PKSCRIPT
21689
+ script: chunk5J5PDZRR_cjs.OP_RETURN_EMPTY_PKSCRIPT
21449
21690
  });
21450
21691
  return tx;
21451
21692
  }
21452
21693
  function craftBIP322ToSignSimple(toSpend, pkScript) {
21453
- const tx = new chunk57636V35_cjs.Transaction({ version: 0 });
21694
+ const tx = new chunk5J5PDZRR_cjs.Transaction({ version: 0 });
21454
21695
  tx.addInput({
21455
21696
  txid: toSpend.id,
21456
21697
  index: 0,
@@ -21462,7 +21703,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
21462
21703
  });
21463
21704
  tx.addOutput({
21464
21705
  amount: 0n,
21465
- script: chunk57636V35_cjs.OP_RETURN_EMPTY_PKSCRIPT
21706
+ script: chunk5J5PDZRR_cjs.OP_RETURN_EMPTY_PKSCRIPT
21466
21707
  });
21467
21708
  return tx;
21468
21709
  }
@@ -21593,7 +21834,7 @@ var RestEmulatorProvider = class {
21593
21834
  }
21594
21835
  };
21595
21836
  function finalizeVirtualTx(type, psbtBase64) {
21596
- const tx = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
21837
+ const tx = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
21597
21838
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
21598
21839
  const input = tx.getInput(0);
21599
21840
  if (!input) {
@@ -21620,14 +21861,14 @@ var ExitPathError = class extends Error {
21620
21861
  reason;
21621
21862
  };
21622
21863
  function delayWeight(sequence) {
21623
- const t = chunk57636V35_cjs.sequenceToTimelock(sequence);
21864
+ const t = chunk5J5PDZRR_cjs.sequenceToTimelock(sequence);
21624
21865
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
21625
21866
  }
21626
21867
  async function resolveUnilateralPath(params) {
21627
21868
  const { vtxo, scriptHex, contractRepository } = params;
21628
21869
  const contract = contractRepository ? (await contractRepository.getContracts({ script: scriptHex }))[0] : void 0;
21629
21870
  if (contract) {
21630
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
21871
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
21631
21872
  if (!handler) {
21632
21873
  throw new ExitPathError(
21633
21874
  "no-handler",
@@ -21650,12 +21891,12 @@ async function resolveUnilateralPath(params) {
21650
21891
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
21651
21892
  return { selection: paths[0], label: `${contract.type}:unilateral` };
21652
21893
  }
21653
- const decoded = chunk57636V35_cjs.VtxoScript.decode(vtxo.tapTree);
21894
+ const decoded = chunk5J5PDZRR_cjs.VtxoScript.decode(vtxo.tapTree);
21654
21895
  let best;
21655
21896
  for (const exit of decoded.exitPaths()) {
21656
21897
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
21657
21898
  if (!leaf) continue;
21658
- const sequence = chunk57636V35_cjs.timelockToSequence(exit.params.timelock);
21899
+ const sequence = chunk5J5PDZRR_cjs.timelockToSequence(exit.params.timelock);
21659
21900
  const weight = delayWeight(sequence);
21660
21901
  if (!best || weight < best.weight) {
21661
21902
  best = { selection: { leaf, sequence }, weight };
@@ -21875,7 +22116,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21875
22116
  let totalAmount = 0n;
21876
22117
  const txWeightEstimator = TxWeightEstimator.create();
21877
22118
  for (const vtxo of vtxos) {
21878
- if (!chunk57636V35_cjs.canSweepOnchain(vtxo)) {
22119
+ if (!chunk5J5PDZRR_cjs.canSweepOnchain(vtxo)) {
21879
22120
  throw new Error(
21880
22121
  `Vtxo ${vtxo.txid}:${vtxo.vout} cannot be swept onchain: it is not fully unrolled (use unroll first), or its exit output was already spent`
21881
22122
  );
@@ -21886,14 +22127,14 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21886
22127
  }
21887
22128
  const resolved = await resolveUnilateralPath({
21888
22129
  vtxo,
21889
- scriptHex: base.hex.encode(chunk57636V35_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22130
+ scriptHex: base.hex.encode(chunk5J5PDZRR_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21890
22131
  contractRepository: wallet.contractRepository,
21891
22132
  walletPubKeyHex: base.hex.encode(await wallet.identity.xOnlyPublicKey()),
21892
22133
  currentTime: Date.now()
21893
22134
  });
21894
22135
  const spendingLeaf = resolved.selection.leaf;
21895
22136
  const sequence = resolved.selection.sequence;
21896
- const timelock = chunk57636V35_cjs.sequenceToTimelock(sequence);
22137
+ const timelock = chunk5J5PDZRR_cjs.sequenceToTimelock(sequence);
21897
22138
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
21898
22139
  if (!elapsed) {
21899
22140
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -21906,7 +22147,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21906
22147
  sequence,
21907
22148
  witnessUtxo: {
21908
22149
  amount: BigInt(vtxo.value),
21909
- script: chunk57636V35_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
22150
+ script: chunk5J5PDZRR_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
21910
22151
  },
21911
22152
  sighashType: btcSigner.SigHash.DEFAULT
21912
22153
  });
@@ -21916,7 +22157,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21916
22157
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
21917
22158
  );
21918
22159
  }
21919
- const tx = new chunk57636V35_cjs.Transaction({ version: 2 });
22160
+ const tx = new chunk5J5PDZRR_cjs.Transaction({ version: 2 });
21920
22161
  for (const input of inputs) {
21921
22162
  tx.addInput(input);
21922
22163
  }
@@ -21999,7 +22240,7 @@ async function buildSignedSweep(params) {
21999
22240
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
22000
22241
  );
22001
22242
  }
22002
- const tx = new chunk57636V35_cjs.Transaction({ version: 2 });
22243
+ const tx = new chunk5J5PDZRR_cjs.Transaction({ version: 2 });
22003
22244
  tx.addInput({
22004
22245
  txid: vtxo.txid,
22005
22246
  index: vtxo.vout,
@@ -22024,7 +22265,7 @@ async function buildSignedSweep(params) {
22024
22265
  finalScriptWitness: [
22025
22266
  tapScriptSig[0][1],
22026
22267
  ...path.extraWitness,
22027
- chunk57636V35_cjs.scriptFromTapLeafScript(path.leaf),
22268
+ chunk5J5PDZRR_cjs.scriptFromTapLeafScript(path.leaf),
22028
22269
  btcSigner.TaprootControlBlock.encode(controlBlock)
22029
22270
  ]
22030
22271
  });
@@ -22054,7 +22295,7 @@ async function resolveFeeRate(opts) {
22054
22295
  }
22055
22296
  async function selectExitVtxos(opts) {
22056
22297
  if (!opts.vtxos) return opts.wallet.getVtxos();
22057
- const res = await chunk57636V35_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
22298
+ const res = await chunk5J5PDZRR_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
22058
22299
  const tapTrees = /* @__PURE__ */ new Map();
22059
22300
  const out = [];
22060
22301
  for (const vtxo of res.vtxos) {
@@ -22069,7 +22310,7 @@ async function selectExitVtxos(opts) {
22069
22310
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
22070
22311
  );
22071
22312
  }
22072
- const handler = chunk3OKEUDHU_cjs.contractHandlers.get(contract.type);
22313
+ const handler = chunkP6EXRY5L_cjs.contractHandlers.get(contract.type);
22073
22314
  if (!handler) {
22074
22315
  throw new Error(`no contract handler registered for type '${contract.type}'`);
22075
22316
  }
@@ -22099,7 +22340,7 @@ async function computeExitLayout(opts, feeRate) {
22099
22340
  if (pendingNodes.length > 0) {
22100
22341
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
22101
22342
  for (const psbt of txs) {
22102
- psbts.set(chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
22343
+ psbts.set(chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
22103
22344
  }
22104
22345
  }
22105
22346
  const childVsize = Number(
@@ -22135,7 +22376,7 @@ async function computeExitLayout(opts, feeRate) {
22135
22376
  try {
22136
22377
  const resolved = await resolveUnilateralPath({
22137
22378
  vtxo,
22138
- scriptHex: base.hex.encode(chunk57636V35_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22379
+ scriptHex: base.hex.encode(chunk5J5PDZRR_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22139
22380
  contractRepository: wallet.contractRepository,
22140
22381
  walletPubKeyHex,
22141
22382
  currentTime: Date.now()
@@ -22154,7 +22395,7 @@ async function computeExitLayout(opts, feeRate) {
22154
22395
  });
22155
22396
  continue;
22156
22397
  }
22157
- const t = chunk57636V35_cjs.sequenceToTimelock(resolved.selection.sequence);
22398
+ const t = chunk5J5PDZRR_cjs.sequenceToTimelock(resolved.selection.sequence);
22158
22399
  const delay = { type: t.type, value: Number(t.value) };
22159
22400
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
22160
22401
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -22555,7 +22796,7 @@ async function prepare(opts) {
22555
22796
  txid: sweep.vtxo.txid,
22556
22797
  vout: sweep.vtxo.vout,
22557
22798
  value: sweep.vtxo.value,
22558
- pkScript: chunk57636V35_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
22799
+ pkScript: chunk5J5PDZRR_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
22559
22800
  },
22560
22801
  path: sweep.resolved.selection,
22561
22802
  outputAddress: opts.sweepAddress,
@@ -22643,7 +22884,7 @@ async function prepare(opts) {
22643
22884
  if (newFee <= splitterFee) break;
22644
22885
  splitterFee = newFee;
22645
22886
  }
22646
- const splitter = new chunk57636V35_cjs.Transaction({ version: 2 });
22887
+ const splitter = new chunk5J5PDZRR_cjs.Transaction({ version: 2 });
22647
22888
  for (const coin of selected.inputs) {
22648
22889
  splitter.addInput({
22649
22890
  txid: coin.txid,
@@ -22787,41 +23028,41 @@ var UnilateralExit = {
22787
23028
  // src/arkade/index.ts
22788
23029
  var arkade_exports = {};
22789
23030
  chunk5BLDMQED_cjs.__export(arkade_exports, {
22790
- ARKADE_OP: () => chunk3OKEUDHU_cjs.ARKADE_OP,
22791
- ARKADE_OPCODES: () => chunk3OKEUDHU_cjs.ARKADE_OPCODES,
22792
- ARKADE_OPCODE_NAMES: () => chunk3OKEUDHU_cjs.ARKADE_OPCODE_NAMES,
22793
- ARKADE_OPCODE_VALUES: () => chunk3OKEUDHU_cjs.ARKADE_OPCODE_VALUES,
22794
- ARKADE_OPS: () => chunk3OKEUDHU_cjs.ARKADE_OPS,
23031
+ ARKADE_OP: () => chunkP6EXRY5L_cjs.ARKADE_OP,
23032
+ ARKADE_OPCODES: () => chunkP6EXRY5L_cjs.ARKADE_OPCODES,
23033
+ ARKADE_OPCODE_NAMES: () => chunkP6EXRY5L_cjs.ARKADE_OPCODE_NAMES,
23034
+ ARKADE_OPCODE_VALUES: () => chunkP6EXRY5L_cjs.ARKADE_OPCODE_VALUES,
23035
+ ARKADE_OPS: () => chunkP6EXRY5L_cjs.ARKADE_OPS,
22795
23036
  Arkade: () => Arkade,
22796
23037
  ArkadeContract: () => ArkadeContract,
22797
- ArkadeProgramScript: () => chunk3OKEUDHU_cjs.ArkadeProgramScript,
22798
- ArkadeScript: () => chunk3OKEUDHU_cjs.ArkadeScript,
23038
+ ArkadeProgramScript: () => chunkP6EXRY5L_cjs.ArkadeProgramScript,
23039
+ ArkadeScript: () => chunkP6EXRY5L_cjs.ArkadeScript,
22799
23040
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
22800
- BigNum: () => chunk3OKEUDHU_cjs.bignum_exports,
23041
+ BigNum: () => chunkP6EXRY5L_cjs.bignum_exports,
22801
23042
  OP: () => btcSigner.OP,
22802
- OPCODE_NAMES: () => chunk3OKEUDHU_cjs.OPCODE_NAMES,
22803
- OPCODE_VALUES: () => chunk3OKEUDHU_cjs.OPCODE_VALUES,
22804
- SUPPORTED_PROGRAM_VERSION: () => chunk3OKEUDHU_cjs.SUPPORTED_PROGRAM_VERSION,
23043
+ OPCODE_NAMES: () => chunkP6EXRY5L_cjs.OPCODE_NAMES,
23044
+ OPCODE_VALUES: () => chunkP6EXRY5L_cjs.OPCODE_VALUES,
23045
+ SUPPORTED_PROGRAM_VERSION: () => chunkP6EXRY5L_cjs.SUPPORTED_PROGRAM_VERSION,
22805
23046
  Script: () => btcSigner.Script,
22806
- arkadeScriptHash: () => chunk3OKEUDHU_cjs.arkadeScriptHash,
22807
- arkadeWitnessHash: () => chunk3OKEUDHU_cjs.arkadeWitnessHash,
22808
- asmToBytes: () => chunk3OKEUDHU_cjs.asmToBytes,
22809
- bytesToASM: () => chunk3OKEUDHU_cjs.bytesToASM,
22810
- computeArkadeScriptPublicKey: () => chunk3OKEUDHU_cjs.computeArkadeScriptPublicKey,
23047
+ arkadeScriptHash: () => chunkP6EXRY5L_cjs.arkadeScriptHash,
23048
+ arkadeWitnessHash: () => chunkP6EXRY5L_cjs.arkadeWitnessHash,
23049
+ asmToBytes: () => chunkP6EXRY5L_cjs.asmToBytes,
23050
+ bytesToASM: () => chunkP6EXRY5L_cjs.bytesToASM,
23051
+ computeArkadeScriptPublicKey: () => chunkP6EXRY5L_cjs.computeArkadeScriptPublicKey,
22811
23052
  createArkadeBatchHandler: () => createArkadeBatchHandler,
22812
- deserializeArkadeContractParams: () => chunk3OKEUDHU_cjs.deserializeArkadeContractParams,
22813
- fromASM: () => chunk3OKEUDHU_cjs.fromASM,
22814
- getOpcodeName: () => chunk3OKEUDHU_cjs.getOpcodeName,
22815
- getOpcodeValue: () => chunk3OKEUDHU_cjs.getOpcodeValue,
22816
- parseArtifact: () => chunk3OKEUDHU_cjs.parseArtifact,
22817
- resolveAsm: () => chunk3OKEUDHU_cjs.resolveAsm,
22818
- serializeArkadeContractParams: () => chunk3OKEUDHU_cjs.serializeArkadeContractParams,
22819
- stringifyArtifact: () => chunk3OKEUDHU_cjs.stringifyArtifact,
22820
- toASM: () => chunk3OKEUDHU_cjs.toASM,
22821
- validateProgram: () => chunk3OKEUDHU_cjs.validateProgram,
22822
- witnessRefToBytes: () => chunk3OKEUDHU_cjs.witnessRefToBytes
23053
+ deserializeArkadeContractParams: () => chunkP6EXRY5L_cjs.deserializeArkadeContractParams,
23054
+ fromASM: () => chunkP6EXRY5L_cjs.fromASM,
23055
+ getOpcodeName: () => chunkP6EXRY5L_cjs.getOpcodeName,
23056
+ getOpcodeValue: () => chunkP6EXRY5L_cjs.getOpcodeValue,
23057
+ parseArtifact: () => chunkP6EXRY5L_cjs.parseArtifact,
23058
+ resolveAsm: () => chunkP6EXRY5L_cjs.resolveAsm,
23059
+ serializeArkadeContractParams: () => chunkP6EXRY5L_cjs.serializeArkadeContractParams,
23060
+ stringifyArtifact: () => chunkP6EXRY5L_cjs.stringifyArtifact,
23061
+ toASM: () => chunkP6EXRY5L_cjs.toASM,
23062
+ validateProgram: () => chunkP6EXRY5L_cjs.validateProgram,
23063
+ witnessRefToBytes: () => chunkP6EXRY5L_cjs.witnessRefToBytes
22823
23064
  });
22824
- var isVtxoCoin = (input) => chunk57636V35_cjs.isVirtualCoin(input);
23065
+ var isVtxoCoin = (input) => chunk5J5PDZRR_cjs.isVirtualCoin(input);
22825
23066
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
22826
23067
  let batchId;
22827
23068
  let sweepTapTreeRoot;
@@ -22842,23 +23083,23 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22842
23083
  );
22843
23084
  await arkProvider.confirmRegistration(intentId);
22844
23085
  batchId = event.id;
22845
- const sweepTapscript = chunk57636V35_cjs.CSVMultisigTapscript.encode({
23086
+ const sweepTapscript = chunk5J5PDZRR_cjs.CSVMultisigTapscript.encode({
22846
23087
  timelock,
22847
- pubkeys: [chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
23088
+ pubkeys: [chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
22848
23089
  }).script;
22849
23090
  sweepTapTreeRoot = payment_js.tapLeafHash(sweepTapscript);
22850
23091
  return { skip: false };
22851
23092
  },
22852
23093
  onTreeSigningStarted: async (event, vtxoTree) => {
22853
23094
  const signerPubKey = await session.getPublicKey();
22854
- const xonlySignerPubKey = chunk3OKEUDHU_cjs.toXOnly(signerPubKey, "signer key");
23095
+ const xonlySignerPubKey = chunkP6EXRY5L_cjs.toXOnly(signerPubKey, "signer key");
22855
23096
  const xOnlyPubkeys = event.cosignersPublicKeys.map(
22856
- (k) => base.hex.encode(chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
23097
+ (k) => base.hex.encode(chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
22857
23098
  );
22858
23099
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
22859
23100
  return { skip: true };
22860
23101
  }
22861
- const commitmentTx = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
23102
+ const commitmentTx = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
22862
23103
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
22863
23104
  if (recipients && recipients.length > 0) {
22864
23105
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -22890,7 +23131,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22890
23131
  if (connectorTree) {
22891
23132
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
22892
23133
  }
22893
- let commitmentPsbt = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
23134
+ let commitmentPsbt = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
22894
23135
  assertFinalCommitmentMatchesValidated(
22895
23136
  commitmentPsbt,
22896
23137
  validatedCommitmentTxid,
@@ -22925,7 +23166,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22925
23166
  boardingIndices.push(boardingIdx);
22926
23167
  continue;
22927
23168
  }
22928
- if (chunk57636V35_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
23169
+ if (chunk5J5PDZRR_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
22929
23170
  continue;
22930
23171
  }
22931
23172
  if (connectorIndex >= connectorLeaves.length) {
@@ -22946,7 +23187,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22946
23187
  index: input.vout,
22947
23188
  witnessUtxo: {
22948
23189
  amount: BigInt(input.value),
22949
- script: chunk57636V35_cjs.VtxoScript.decode(input.tapTree).pkScript
23190
+ script: chunk5J5PDZRR_cjs.VtxoScript.decode(input.tapTree).pkScript
22950
23191
  },
22951
23192
  sighashType: btcSigner.SigHash.DEFAULT,
22952
23193
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -23037,16 +23278,16 @@ var Arkade = class _Arkade {
23037
23278
  /** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
23038
23279
  static async connect(opts) {
23039
23280
  const info = await opts.arkade.getInfo();
23040
- const serverKey = chunk3OKEUDHU_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
23041
- const checkpoint = chunk57636V35_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
23042
- const network = opts.network ?? chunk57636V35_cjs.DEFAULT_NETWORK;
23281
+ const serverKey = chunkP6EXRY5L_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
23282
+ const checkpoint = chunk5J5PDZRR_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
23283
+ const network = opts.network ?? chunk5J5PDZRR_cjs.DEFAULT_NETWORK;
23043
23284
  let emulatorKey;
23044
23285
  if (opts.emulator) {
23045
- emulatorKey = base.hex.decode(chunk57636V35_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
23286
+ emulatorKey = base.hex.decode(chunk5J5PDZRR_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
23046
23287
  }
23047
23288
  let userKey;
23048
23289
  if (opts.identity) {
23049
- userKey = chunk3OKEUDHU_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
23290
+ userKey = chunkP6EXRY5L_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
23050
23291
  }
23051
23292
  return new _Arkade({
23052
23293
  arkProvider: opts.arkade,
@@ -23072,7 +23313,7 @@ var Arkade = class _Arkade {
23072
23313
  * key respectively; explicit args always win.
23073
23314
  */
23074
23315
  contract(program, args = {}) {
23075
- const declared = (program.params ?? []).map(chunk3OKEUDHU_cjs.inputName);
23316
+ const declared = (program.params ?? []).map(chunkP6EXRY5L_cjs.inputName);
23076
23317
  if (declared.includes("server") && args.server === void 0) {
23077
23318
  args = { ...args, server: this.serverKey };
23078
23319
  }
@@ -23092,7 +23333,7 @@ var ArkadeContract = class _ArkadeContract {
23092
23333
  userKey: client.userKey,
23093
23334
  emulatorKey: client.emulatorKey
23094
23335
  };
23095
- this.vtxoScript = new chunk3OKEUDHU_cjs.ArkadeProgramScript(program, args, this.keys);
23336
+ this.vtxoScript = new chunkP6EXRY5L_cjs.ArkadeProgramScript(program, args, this.keys);
23096
23337
  this.tapTree = this.vtxoScript.encode();
23097
23338
  this.compiled = this.vtxoScript.compiled;
23098
23339
  }
@@ -23120,7 +23361,7 @@ var ArkadeContract = class _ArkadeContract {
23120
23361
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
23121
23362
  );
23122
23363
  }
23123
- const typed = chunk3OKEUDHU_cjs.deserializeArkadeContractParams(contract.params);
23364
+ const typed = chunkP6EXRY5L_cjs.deserializeArkadeContractParams(contract.params);
23124
23365
  return new _ArkadeContract(client, typed.program, typed.args, {
23125
23366
  serverKey: typed.serverKey,
23126
23367
  userKey: typed.userKey,
@@ -23161,7 +23402,7 @@ var ArkadeContract = class _ArkadeContract {
23161
23402
  toContractParams() {
23162
23403
  return {
23163
23404
  type: "arkade",
23164
- params: chunk3OKEUDHU_cjs.serializeArkadeContractParams({
23405
+ params: chunkP6EXRY5L_cjs.serializeArkadeContractParams({
23165
23406
  program: this.program,
23166
23407
  args: this.args,
23167
23408
  serverKey: this.keys.serverKey,
@@ -23211,18 +23452,18 @@ var ArkadeContract = class _ArkadeContract {
23211
23452
  if (registered) {
23212
23453
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
23213
23454
  return (withVtxos?.vtxos ?? []).filter(
23214
- (v) => !chunk57636V35_cjs.hasTerminalSpend(v) && !v.isUnrolled
23455
+ (v) => !chunk5J5PDZRR_cjs.hasTerminalSpend(v) && !v.isUnrolled
23215
23456
  );
23216
23457
  }
23217
23458
  }
23218
23459
  if (!this.client.indexer) {
23219
23460
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
23220
23461
  }
23221
- const { vtxos } = await chunk57636V35_cjs.getNormalizedVtxos(this.client.indexer, {
23462
+ const { vtxos } = await chunk5J5PDZRR_cjs.getNormalizedVtxos(this.client.indexer, {
23222
23463
  scripts: [scriptHex],
23223
23464
  spendableOnly: true
23224
23465
  });
23225
- return vtxos.filter((v) => !chunk57636V35_cjs.hasTerminalSpend(v) && !v.isUnrolled);
23466
+ return vtxos.filter((v) => !chunk5J5PDZRR_cjs.hasTerminalSpend(v) && !v.isUnrolled);
23226
23467
  }
23227
23468
  /** Total spendable balance (requires an indexer). */
23228
23469
  async getBalance() {
@@ -23320,7 +23561,7 @@ var ArkadeTransactionBuilder = class {
23320
23561
  this.contract.client.checkpoint
23321
23562
  );
23322
23563
  if (coin.sourceTx) {
23323
- chunk57636V35_cjs.setArkPsbtField(arkTx, 0, chunk57636V35_cjs.PrevArkTxField, coin.sourceTx);
23564
+ chunk5J5PDZRR_cjs.setArkPsbtField(arkTx, 0, chunk5J5PDZRR_cjs.PrevArkTxField, coin.sourceTx);
23324
23565
  }
23325
23566
  if (this.fn.arkadeScript) {
23326
23567
  const indexer = this.contract.client.indexer;
@@ -23337,8 +23578,8 @@ var ArkadeTransactionBuilder = class {
23337
23578
  }
23338
23579
  const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
23339
23580
  if (condition.length > 0) {
23340
- chunk57636V35_cjs.setArkPsbtField(arkTx, 0, chunk57636V35_cjs.ConditionWitness, condition);
23341
- chunk57636V35_cjs.setArkPsbtField(checkpoints[0], 0, chunk57636V35_cjs.ConditionWitness, condition);
23581
+ chunk5J5PDZRR_cjs.setArkPsbtField(arkTx, 0, chunk5J5PDZRR_cjs.ConditionWitness, condition);
23582
+ chunk5J5PDZRR_cjs.setArkPsbtField(checkpoints[0], 0, chunk5J5PDZRR_cjs.ConditionWitness, condition);
23342
23583
  }
23343
23584
  const packets = [];
23344
23585
  if (this.assetSpecs.length > 0) {
@@ -23377,7 +23618,7 @@ var ArkadeTransactionBuilder = class {
23377
23618
  base.base64.encode(signedArk2.toPSBT()),
23378
23619
  signedCps.map((c) => base.base64.encode(c.toPSBT()))
23379
23620
  );
23380
- const txid = chunk57636V35_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
23621
+ const txid = chunk5J5PDZRR_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
23381
23622
  return {
23382
23623
  txid,
23383
23624
  signedArkTx: res2.signedArkTx,
@@ -23436,23 +23677,23 @@ var ArkadeTransactionBuilder = class {
23436
23677
  }
23437
23678
  buildAssetPacket() {
23438
23679
  const groups = this.assetSpecs.map((s) => {
23439
- const id = typeof s.assetId === "string" ? chunk3KW4TWP2_cjs.AssetId.fromString(s.assetId) : chunk3KW4TWP2_cjs.AssetId.fromBytes(s.assetId);
23440
- return chunk3KW4TWP2_cjs.AssetGroup.create(
23680
+ const id = typeof s.assetId === "string" ? chunkFM263GKH_cjs.AssetId.fromString(s.assetId) : chunkFM263GKH_cjs.AssetId.fromBytes(s.assetId);
23681
+ return chunkFM263GKH_cjs.AssetGroup.create(
23441
23682
  id,
23442
23683
  null,
23443
- s.inputs.map((i) => chunk3KW4TWP2_cjs.AssetInput.create(i.vin, i.amount)),
23444
- s.outputs.map((o) => chunk3KW4TWP2_cjs.AssetOutput.create(o.vout, o.amount)),
23445
- (s.metadata ?? []).map((m) => chunk3KW4TWP2_cjs.Metadata.create(m.key, m.value))
23684
+ s.inputs.map((i) => chunkFM263GKH_cjs.AssetInput.create(i.vin, i.amount)),
23685
+ s.outputs.map((o) => chunkFM263GKH_cjs.AssetOutput.create(o.vout, o.amount)),
23686
+ (s.metadata ?? []).map((m) => chunkFM263GKH_cjs.Metadata.create(m.key, m.value))
23446
23687
  );
23447
23688
  });
23448
- return chunk3KW4TWP2_cjs.Packet.create(groups);
23689
+ return chunkFM263GKH_cjs.Packet.create(groups);
23449
23690
  }
23450
23691
  witnessBytes(ref) {
23451
- return chunk3OKEUDHU_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
23692
+ return chunkP6EXRY5L_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
23452
23693
  }
23453
23694
  };
23454
23695
  function bindInputs(fn, callArgs) {
23455
- const names = (fn.def.inputs ?? []).map(chunk3OKEUDHU_cjs.inputName);
23696
+ const names = (fn.def.inputs ?? []).map(chunkP6EXRY5L_cjs.inputName);
23456
23697
  if (callArgs.length !== names.length) {
23457
23698
  throw new Error(`${fn.name}: expected ${names.length} argument(s), got ${callArgs.length}`);
23458
23699
  }
@@ -24072,6 +24313,7 @@ exports.isArkContract = isArkContract;
24072
24313
  exports.isBatchSignable = isBatchSignable;
24073
24314
  exports.isBtcAddress = isBtcAddress;
24074
24315
  exports.isContractGenericallySpendable = isContractGenericallySpendable;
24316
+ exports.isContractVtxoEvent = isContractVtxoEvent;
24075
24317
  exports.isCooperativelyMigratable = isCooperativelyMigratable;
24076
24318
  exports.isDeterministicSigner = isDeterministicSigner;
24077
24319
  exports.isDiscoverable = isDiscoverable;
@@ -24134,5 +24376,5 @@ exports.waitForIncomingFunds = waitForIncomingFunds;
24134
24376
  exports.walletFeeSource = walletFeeSource;
24135
24377
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
24136
24378
  exports.withPrevTxs = withPrevTxs;
24137
- //# sourceMappingURL=chunk-XTCOSZ34.cjs.map
24138
- //# sourceMappingURL=chunk-XTCOSZ34.cjs.map
24379
+ //# sourceMappingURL=chunk-MK5EPTTB.cjs.map
24380
+ //# sourceMappingURL=chunk-MK5EPTTB.cjs.map