@arkade-os/sdk 0.4.72 → 0.4.73

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 (57) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.js +3 -3
  3. package/dist/adapters/indexedDB.cjs +5 -5
  4. package/dist/adapters/indexedDB.js +4 -4
  5. package/dist/{asyncStorageTaskQueue-DhhNZc4v.d.ts → asyncStorageTaskQueue-C5IwA_Hs.d.ts} +2 -2
  6. package/dist/{asyncStorageTaskQueue-s5lUGWxu.d.cts → asyncStorageTaskQueue-DA2OdpJ0.d.cts} +2 -2
  7. package/dist/{chunk-NPM5YZBC.cjs → chunk-2D7F5IU3.cjs} +49 -49
  8. package/dist/{chunk-NPM5YZBC.cjs.map → chunk-2D7F5IU3.cjs.map} +1 -1
  9. package/dist/{chunk-CZPBPMO2.js → chunk-5YCAC6XE.js} +4 -4
  10. package/dist/{chunk-CZPBPMO2.js.map → chunk-5YCAC6XE.js.map} +1 -1
  11. package/dist/{chunk-U5I3ITV7.cjs → chunk-C4RKZY7D.cjs} +597 -470
  12. package/dist/chunk-C4RKZY7D.cjs.map +1 -0
  13. package/dist/{chunk-4C5PMGBB.cjs → chunk-D5DLGVN4.cjs} +17 -17
  14. package/dist/{chunk-4C5PMGBB.cjs.map → chunk-D5DLGVN4.cjs.map} +1 -1
  15. package/dist/{chunk-CB6QPAO5.js → chunk-G5RPUZJE.js} +3 -3
  16. package/dist/{chunk-CB6QPAO5.js.map → chunk-G5RPUZJE.js.map} +1 -1
  17. package/dist/{chunk-6FTHFJAN.cjs → chunk-KJ5E646Y.cjs} +3 -3
  18. package/dist/{chunk-6FTHFJAN.cjs.map → chunk-KJ5E646Y.cjs.map} +1 -1
  19. package/dist/{chunk-KDMHEWTD.cjs → chunk-L7IEXVXI.cjs} +10 -10
  20. package/dist/{chunk-KDMHEWTD.cjs.map → chunk-L7IEXVXI.cjs.map} +1 -1
  21. package/dist/{chunk-IGER5FPC.js → chunk-M6HIWM5N.js} +3 -3
  22. package/dist/{chunk-IGER5FPC.js.map → chunk-M6HIWM5N.js.map} +1 -1
  23. package/dist/{chunk-5GQFYVWP.js → chunk-OV4GLPZI.js} +3 -3
  24. package/dist/{chunk-5GQFYVWP.js.map → chunk-OV4GLPZI.js.map} +1 -1
  25. package/dist/{chunk-S5PUFSXC.js → chunk-QX2M67YI.js} +4 -4
  26. package/dist/{chunk-S5PUFSXC.js.map → chunk-QX2M67YI.js.map} +1 -1
  27. package/dist/{chunk-BHLYB44A.js → chunk-YHJJSLE5.js} +162 -35
  28. package/dist/chunk-YHJJSLE5.js.map +1 -0
  29. package/dist/{chunk-4BWZ437E.cjs → chunk-ZLDO4QDR.cjs} +17 -17
  30. package/dist/{chunk-4BWZ437E.cjs.map → chunk-ZLDO4QDR.cjs.map} +1 -1
  31. package/dist/contracts/handlers/index.cjs +9 -9
  32. package/dist/contracts/handlers/index.js +2 -2
  33. package/dist/index.cjs +300 -300
  34. package/dist/index.d.cts +3 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.js +4 -4
  37. package/dist/repositories/realm/index.cjs +19 -19
  38. package/dist/repositories/realm/index.js +5 -5
  39. package/dist/repositories/sqlite/index.cjs +18 -18
  40. package/dist/repositories/sqlite/index.js +5 -5
  41. package/dist/{taskRunner-BH_FxaNI.d.cts → taskRunner-C_uAJDsn.d.cts} +1 -1
  42. package/dist/{taskRunner-DrVz2QZs.d.ts → taskRunner-DARTFnZN.d.ts} +1 -1
  43. package/dist/wallet/expo/background.cjs +14 -14
  44. package/dist/wallet/expo/background.d.cts +2 -2
  45. package/dist/wallet/expo/background.d.ts +2 -2
  46. package/dist/wallet/expo/background.js +6 -6
  47. package/dist/wallet/expo/index.cjs +14 -14
  48. package/dist/wallet/expo/index.d.cts +1 -1
  49. package/dist/wallet/expo/index.d.ts +1 -1
  50. package/dist/wallet/expo/index.js +5 -5
  51. package/dist/worker/expo/index.cjs +9 -9
  52. package/dist/worker/expo/index.d.cts +3 -3
  53. package/dist/worker/expo/index.d.ts +3 -3
  54. package/dist/worker/expo/index.js +5 -5
  55. package/package.json +1 -1
  56. package/dist/chunk-BHLYB44A.js.map +0 -1
  57. package/dist/chunk-U5I3ITV7.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk4C5PMGBB_cjs = require('./chunk-4C5PMGBB.cjs');
4
- var chunkNPM5YZBC_cjs = require('./chunk-NPM5YZBC.cjs');
5
- var chunk6FTHFJAN_cjs = require('./chunk-6FTHFJAN.cjs');
3
+ var chunkD5DLGVN4_cjs = require('./chunk-D5DLGVN4.cjs');
4
+ var chunk2D7F5IU3_cjs = require('./chunk-2D7F5IU3.cjs');
5
+ var chunkKJ5E646Y_cjs = require('./chunk-KJ5E646Y.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 = chunk6FTHFJAN_cjs.getArkPsbtFields(tx.root, 0, chunk6FTHFJAN_cjs.CosignerPublicKey).map(
191
+ const cosigners = chunkKJ5E646Y_cjs.getArkPsbtFields(tx.root, 0, chunkKJ5E646Y_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 = chunk6FTHFJAN_cjs.getArkPsbtFields(g.root, 0, chunk6FTHFJAN_cjs.CosignerPublicKey).map((c) => c.key);
243
+ const cosigners = chunkKJ5E646Y_cjs.getArkPsbtFields(g.root, 0, chunkKJ5E646Y_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
- chunk6FTHFJAN_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
326
+ chunkKJ5E646Y_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 = chunkNPM5YZBC_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
435
+ network = chunk2D7F5IU3_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 chunkNPM5YZBC_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
533
+ return chunk2D7F5IU3_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 = chunkNPM5YZBC_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
582
+ const network = chunk2D7F5IU3_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
- chunk6FTHFJAN_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
607
+ chunkKJ5E646Y_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 = chunkNPM5YZBC_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
669
+ const network = chunk2D7F5IU3_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 chunkNPM5YZBC_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
719
+ return chunk2D7F5IU3_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 chunkNPM5YZBC_cjs.deriveDescriptorLeafPubKey(this.descriptor);
881
+ return chunk2D7F5IU3_cjs.deriveDescriptorLeafPubKey(this.descriptor);
882
882
  }
883
883
  async compressedPublicKey() {
884
- return chunkNPM5YZBC_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
884
+ return chunk2D7F5IU3_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 && chunkNPM5YZBC_cjs.parseHDDescriptor(descriptor)) {
952
+ if (owner && chunk2D7F5IU3_cjs.parseHDDescriptor(descriptor)) {
953
953
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
954
954
  }
955
955
  let key;
956
956
  try {
957
- key = chunkNPM5YZBC_cjs.deriveDescriptorLeafPubKey(descriptor);
957
+ key = chunk2D7F5IU3_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 chunkNPM5YZBC_cjs.parseHDDescriptor(descriptor) !== null;
1332
+ return chunk2D7F5IU3_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 chunkNPM5YZBC_cjs.identityDescriptor(wallet.identity);
1336
+ return allocated ?? await chunk2D7F5IU3_cjs.identityDescriptor(wallet.identity);
1337
1337
  }
1338
1338
  async function provisionRefundKey(wallet) {
1339
- const descriptor = await chunkNPM5YZBC_cjs.identityDescriptor(wallet.identity);
1339
+ const descriptor = await chunk2D7F5IU3_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 } = chunk6FTHFJAN_cjs.ArkAddress.decode(address);
1349
+ const { pkScript } = chunkKJ5E646Y_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 = chunkNPM5YZBC_cjs.deriveDescriptorLeafPubKey(descriptor);
1395
+ expected = chunk2D7F5IU3_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 chunk6FTHFJAN_cjs.baseFetch(url, {
1614
+ const response = await chunkKJ5E646Y_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: chunk6FTHFJAN_cjs.Intent.encodeMessage(intent.message),
1621
+ message: chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.rateGate.runHttp(url, () => chunk6FTHFJAN_cjs.baseFetch(url));
1641
+ const response = await chunkKJ5E646Y_cjs.rateGate.runHttp(url, () => chunkKJ5E646Y_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[chunk6FTHFJAN_cjs.DEFAULT_NETWORK_NAME], opts) {
1666
+ constructor(baseUrl = ESPLORA_URL[chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1685
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1692
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1713
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1721
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1734
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1741
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1749
+ const txresponse = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1757
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/blocks`);
2041
+ let tipBlocks = await chunkKJ5E646Y_cjs.baseFetch(`${this.baseUrl}/blocks`);
2042
2042
  if (tipBlocks.status === 404) {
2043
- tipBlocks = await chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2043
+ tipBlocks = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2065
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.baseFetch(`${this.baseUrl}/tx`, {
2081
+ const response = await chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2264
+ const child = new chunkKJ5E646Y_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 chunk6FTHFJAN_cjs.Transaction({
2312
+ const tx = new chunkKJ5E646Y_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 = chunk6FTHFJAN_cjs.getArkPsbtFields(child.root, 0, chunk6FTHFJAN_cjs.CosignerPublicKey);
2388
+ const cosigners = chunkKJ5E646Y_cjs.getArkPsbtFields(child.root, 0, chunkKJ5E646Y_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 chunk4C5PMGBB_cjs.BufferReader(data);
2446
+ const reader = new chunkD5DLGVN4_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 chunk4C5PMGBB_cjs.BufferWriter();
2464
+ const writer = new chunkD5DLGVN4_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 chunk4C5PMGBB_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2551
+ const reader = new chunkD5DLGVN4_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 chunk4C5PMGBB_cjs.Packet) {
2625
+ if (p instanceof chunkD5DLGVN4_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 chunk4C5PMGBB_cjs.Packet.PACKET_TYPE:
2664
- return chunk4C5PMGBB_cjs.Packet.fromBytes(data);
2663
+ case chunkD5DLGVN4_cjs.Packet.PACKET_TYPE:
2664
+ return chunkD5DLGVN4_cjs.Packet.fromBytes(data);
2665
2665
  case EmulatorPacket.PACKET_TYPE:
2666
2666
  return EmulatorPacket.fromBytes(data);
2667
2667
  default:
@@ -2708,25 +2708,31 @@ function buildOpReturnScript(data) {
2708
2708
  }
2709
2709
  return script;
2710
2710
  }
2711
- var ErrOffchainOutputNotFound = (address) => new chunk6FTHFJAN_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2712
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
2711
+ var ErrOffchainOutputNotFound = (address) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2712
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
2713
2713
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
2714
2714
  );
2715
- var ErrAssetGroupNotFound = (assetId) => new chunk6FTHFJAN_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2716
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
2715
+ var ErrAssetGroupNotFound = (assetId) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2716
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
2717
2717
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
2718
2718
  );
2719
- var ErrOnchainOutputNotFound = (address) => new chunk6FTHFJAN_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2720
- var ErrUnvalidatedOffchainOutput = (address) => new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
2719
+ var ErrOnchainOutputNotFound = (address) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2720
+ var ErrUnvalidatedOffchainOutput = (address) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
2721
2721
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2722
2722
  );
2723
+ var ErrIntentOutputNotFound = (index, kind) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
2724
+ `${kind} output ${index} of the intent proof is not present in what the server built`
2725
+ );
2726
+ var ErrUnvalidatedIntentOutput = (index) => new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
2727
+ `offchain output ${index} of the intent proof cannot be validated: virtual output tree signing did not run`
2728
+ );
2723
2729
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
2724
2730
  var ErrInvalidOnchainOutputAssets = (address) => new Error(`onchain output ${address} cannot have assets`);
2725
2731
  var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain output ${address}, missing amount`);
2726
2732
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
2727
2733
  if (!validatedCommitmentTxid) return;
2728
2734
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
2729
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
2735
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
2730
2736
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
2731
2737
  );
2732
2738
  }
@@ -2736,7 +2742,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
2736
2742
  for (const recipient of recipients) {
2737
2743
  let arkAddress;
2738
2744
  try {
2739
- arkAddress = chunk6FTHFJAN_cjs.ArkAddress.decode(recipient.address);
2745
+ arkAddress = chunkKJ5E646Y_cjs.ArkAddress.decode(recipient.address);
2740
2746
  } catch {
2741
2747
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2742
2748
  continue;
@@ -2748,7 +2754,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2748
2754
  const usedOnchainOutputs = /* @__PURE__ */ new Set();
2749
2755
  for (const recipient of recipients) {
2750
2756
  try {
2751
- chunk6FTHFJAN_cjs.ArkAddress.decode(recipient.address);
2757
+ chunkKJ5E646Y_cjs.ArkAddress.decode(recipient.address);
2752
2758
  } catch {
2753
2759
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2754
2760
  continue;
@@ -2756,6 +2762,74 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2756
2762
  throw ErrUnvalidatedOffchainOutput(recipient.address);
2757
2763
  }
2758
2764
  }
2765
+ function declaredIntentOutputs(signedProof, onchainOutputIndexes) {
2766
+ const proof = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2767
+ const onchain = new Set(onchainOutputIndexes);
2768
+ const declared = [];
2769
+ for (let i = 0; i < proof.outputsLength; i++) {
2770
+ const output = proof.getOutput(i);
2771
+ if (!output?.script || output.script.length === 0 || !output.amount) continue;
2772
+ declared.push({
2773
+ index: i,
2774
+ script: output.script,
2775
+ amount: output.amount,
2776
+ onchain: onchain.has(i)
2777
+ });
2778
+ }
2779
+ return declared;
2780
+ }
2781
+ function validateBatchAgainstIntent(commitmentTx, vtxoTreeLeaves, declared) {
2782
+ const usedOnchain = /* @__PURE__ */ new Set();
2783
+ const usedLeaf = /* @__PURE__ */ new Set();
2784
+ for (const output of declared) {
2785
+ if (output.onchain) {
2786
+ if (!takeOnchainOutput(commitmentTx, output, usedOnchain)) {
2787
+ throw ErrIntentOutputNotFound(output.index, "onchain");
2788
+ }
2789
+ continue;
2790
+ }
2791
+ if (!takeLeafOutput(vtxoTreeLeaves, output, usedLeaf)) {
2792
+ throw ErrIntentOutputNotFound(output.index, "offchain");
2793
+ }
2794
+ }
2795
+ }
2796
+ function validateBatchAgainstIntentWithoutTree(commitmentTx, declared) {
2797
+ const usedOnchain = /* @__PURE__ */ new Set();
2798
+ for (const output of declared) {
2799
+ if (!output.onchain) {
2800
+ throw ErrUnvalidatedIntentOutput(output.index);
2801
+ }
2802
+ if (!takeOnchainOutput(commitmentTx, output, usedOnchain)) {
2803
+ throw ErrIntentOutputNotFound(output.index, "onchain");
2804
+ }
2805
+ }
2806
+ }
2807
+ function takeOnchainOutput(commitmentTx, declared, used) {
2808
+ for (let i = 0; i < commitmentTx.outputsLength; i++) {
2809
+ if (used.has(i)) continue;
2810
+ const output = commitmentTx.getOutput(i);
2811
+ if (!output?.script || output.amount !== declared.amount) continue;
2812
+ if (!utils_js.equalBytes(output.script, declared.script)) continue;
2813
+ used.add(i);
2814
+ return true;
2815
+ }
2816
+ return false;
2817
+ }
2818
+ function takeLeafOutput(leaves, declared, used) {
2819
+ for (let leafIdx = 0; leafIdx < leaves.length; leafIdx++) {
2820
+ const leaf = leaves[leafIdx];
2821
+ for (let i = 0; i < leaf.outputsLength; i++) {
2822
+ const key = `${leafIdx}:${i}`;
2823
+ if (used.has(key)) continue;
2824
+ const output = leaf.getOutput(i);
2825
+ if (!output?.script || output.amount !== declared.amount) continue;
2826
+ if (!utils_js.equalBytes(output.script, declared.script)) continue;
2827
+ used.add(key);
2828
+ return true;
2829
+ }
2830
+ }
2831
+ return false;
2832
+ }
2759
2833
  function validateOnchainRecipient(commitmentTx, recipient, network, usedOutputs) {
2760
2834
  const addr = btcSigner.Address(network).decode(recipient.address);
2761
2835
  const expectedPkScript = btcSigner.OutScript.encode(addr);
@@ -2981,7 +3055,7 @@ function assetMintResolver() {
2981
3055
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
2982
3056
  const minted = tx.assets.filter((a) => {
2983
3057
  try {
2984
- return base.hex.encode(chunk4C5PMGBB_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3058
+ return base.hex.encode(chunkD5DLGVN4_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2985
3059
  } catch {
2986
3060
  return false;
2987
3061
  }
@@ -3057,7 +3131,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3057
3131
  const existing = inputsByAssetId.get(asset.assetId);
3058
3132
  inputsByAssetId.set(asset.assetId, [
3059
3133
  ...existing ?? [],
3060
- chunk4C5PMGBB_cjs.AssetInput.create(inputIndex, asset.amount)
3134
+ chunkD5DLGVN4_cjs.AssetInput.create(inputIndex, asset.amount)
3061
3135
  ]);
3062
3136
  }
3063
3137
  }
@@ -3069,7 +3143,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3069
3143
  const existing = outputsByAssetId.get(asset.assetId);
3070
3144
  outputsByAssetId.set(asset.assetId, [
3071
3145
  ...existing ?? [],
3072
- chunk4C5PMGBB_cjs.AssetOutput.create(outputIndex, asset.amount)
3146
+ chunkD5DLGVN4_cjs.AssetOutput.create(outputIndex, asset.amount)
3073
3147
  ]);
3074
3148
  }
3075
3149
  }
@@ -3080,7 +3154,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3080
3154
  const existing = outputsByAssetId.get(asset.assetId);
3081
3155
  outputsByAssetId.set(asset.assetId, [
3082
3156
  ...existing ?? [],
3083
- chunk4C5PMGBB_cjs.AssetOutput.create(outputIndex, asset.amount)
3157
+ chunkD5DLGVN4_cjs.AssetOutput.create(outputIndex, asset.amount)
3084
3158
  ]);
3085
3159
  }
3086
3160
  }
@@ -3089,11 +3163,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3089
3163
  for (const assetIdStr of allAssetIds) {
3090
3164
  const inputs = inputsByAssetId.get(assetIdStr);
3091
3165
  const outputs = outputsByAssetId.get(assetIdStr);
3092
- const assetId = chunk4C5PMGBB_cjs.AssetId.fromString(assetIdStr);
3093
- const group = chunk4C5PMGBB_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3166
+ const assetId = chunkD5DLGVN4_cjs.AssetId.fromString(assetIdStr);
3167
+ const group = chunkD5DLGVN4_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3094
3168
  groups.push(group);
3095
3169
  }
3096
- return chunk4C5PMGBB_cjs.Packet.create(groups);
3170
+ return chunkD5DLGVN4_cjs.Packet.create(groups);
3097
3171
  }
3098
3172
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
3099
3173
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -3130,7 +3204,7 @@ function selectedCoinsToAssetInputs(selectedCoins) {
3130
3204
  }
3131
3205
  function toXOnlySignerHex(pubkeyHex) {
3132
3206
  const bytes = base.hex.decode(pubkeyHex);
3133
- if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkNPM5YZBC_cjs.toXOnly(bytes, "signer key"));
3207
+ if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunk2D7F5IU3_cjs.toXOnly(bytes, "signer key"));
3134
3208
  throw new Error(`invalid signer pubkey length: expected 32 or 33 bytes, got ${bytes.length}`);
3135
3209
  }
3136
3210
  function signerSetFromInfo(info) {
@@ -3177,13 +3251,13 @@ var toTimelock = (value) => ({
3177
3251
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
3178
3252
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
3179
3253
  if (policy.requireSeconds && timelock.type === "blocks") {
3180
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3254
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3181
3255
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
3182
3256
  );
3183
3257
  }
3184
3258
  const seconds = toSeconds(timelock);
3185
3259
  if (seconds < policy.minSeconds) {
3186
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3260
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3187
3261
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it`
3188
3262
  );
3189
3263
  }
@@ -3204,7 +3278,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
3204
3278
  }
3205
3279
  function assertValidBatchExpiry(batchExpiry, policy) {
3206
3280
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
3207
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3281
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3208
3282
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
3209
3283
  );
3210
3284
  }
@@ -3234,21 +3308,21 @@ function resolveCheckpointExitDelayPolicy(network, overrides) {
3234
3308
  function assertValidServerUnrollScript(checkpointTapscript, policy) {
3235
3309
  let script;
3236
3310
  try {
3237
- script = chunk6FTHFJAN_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3311
+ script = chunkKJ5E646Y_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3238
3312
  } catch (e) {
3239
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3313
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3240
3314
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
3241
3315
  );
3242
3316
  }
3243
3317
  if (policy.advertisedForfeitPubkey !== void 0) {
3244
3318
  const { pubkeys } = script.params;
3245
3319
  if (pubkeys.length !== 1) {
3246
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3320
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3247
3321
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
3248
3322
  );
3249
3323
  }
3250
3324
  if (!utils_js.equalBytes(pubkeys[0], policy.advertisedForfeitPubkey)) {
3251
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3325
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3252
3326
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(policy.advertisedForfeitPubkey)}`
3253
3327
  );
3254
3328
  }
@@ -3292,8 +3366,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
3292
3366
  function buildVirtualTx(inputs, outputs) {
3293
3367
  let lockTime = 0n;
3294
3368
  for (const input of inputs) {
3295
- const tapscript = chunk6FTHFJAN_cjs.decodeTapscript(chunk6FTHFJAN_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3296
- if (chunk6FTHFJAN_cjs.CLTVMultisigTapscript.is(tapscript)) {
3369
+ const tapscript = chunkKJ5E646Y_cjs.decodeTapscript(chunkKJ5E646Y_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3370
+ if (chunkKJ5E646Y_cjs.CLTVMultisigTapscript.is(tapscript)) {
3297
3371
  if (lockTime !== 0n) {
3298
3372
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
3299
3373
  throw new Error("cannot mix seconds and blocks locktime");
@@ -3304,7 +3378,7 @@ function buildVirtualTx(inputs, outputs) {
3304
3378
  }
3305
3379
  }
3306
3380
  }
3307
- const tx = new chunk6FTHFJAN_cjs.Transaction({
3381
+ const tx = new chunkKJ5E646Y_cjs.Transaction({
3308
3382
  version: 3,
3309
3383
  lockTime: Number(lockTime)
3310
3384
  });
@@ -3314,12 +3388,12 @@ function buildVirtualTx(inputs, outputs) {
3314
3388
  index: input.vout,
3315
3389
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
3316
3390
  witnessUtxo: {
3317
- script: chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).pkScript,
3391
+ script: chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).pkScript,
3318
3392
  amount: BigInt(input.value)
3319
3393
  },
3320
3394
  tapLeafScript: [input.tapLeafScript]
3321
3395
  });
3322
- chunk6FTHFJAN_cjs.setArkPsbtField(tx, i, chunk6FTHFJAN_cjs.VtxoTaprootTree, input.tapTree);
3396
+ chunkKJ5E646Y_cjs.setArkPsbtField(tx, i, chunkKJ5E646Y_cjs.VtxoTaprootTree, input.tapTree);
3323
3397
  }
3324
3398
  for (const output of outputs) {
3325
3399
  tx.addOutput(output);
@@ -3328,8 +3402,8 @@ function buildVirtualTx(inputs, outputs) {
3328
3402
  return tx;
3329
3403
  }
3330
3404
  function buildCheckpointTx(vtxo, serverUnrollScript) {
3331
- const collaborativeClosure = chunk6FTHFJAN_cjs.decodeTapscript(chunk6FTHFJAN_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3332
- const checkpointVtxoScript = new chunk6FTHFJAN_cjs.VtxoScript([
3405
+ const collaborativeClosure = chunkKJ5E646Y_cjs.decodeTapscript(chunkKJ5E646Y_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3406
+ const checkpointVtxoScript = new chunkKJ5E646Y_cjs.VtxoScript([
3333
3407
  serverUnrollScript.script,
3334
3408
  collaborativeClosure.script
3335
3409
  ]);
@@ -3405,7 +3479,7 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
3405
3479
  const sighashType = signature.length === 65 ? signature[64] : btcSigner.SigHash.DEFAULT;
3406
3480
  const sig = signature.subarray(0, 64);
3407
3481
  if (!allowedSighashTypes.includes(sighashType)) {
3408
- const sighashName = chunk6FTHFJAN_cjs.formatSighash(sighashType);
3482
+ const sighashName = chunkKJ5E646Y_cjs.formatSighash(sighashType);
3409
3483
  throw new Error(
3410
3484
  `Unallowed sighash type ${sighashName} for input ${inputIndex}, pubkey ${pubKeyHex}.`
3411
3485
  );
@@ -3479,7 +3553,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
3479
3553
  }
3480
3554
  function isValidArkAddress(address) {
3481
3555
  try {
3482
- chunk6FTHFJAN_cjs.ArkAddress.decode(address);
3556
+ chunkKJ5E646Y_cjs.ArkAddress.decode(address);
3483
3557
  return true;
3484
3558
  } catch (e) {
3485
3559
  return false;
@@ -3487,16 +3561,16 @@ function isValidArkAddress(address) {
3487
3561
  }
3488
3562
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3489
3563
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3490
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3564
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3491
3565
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3492
3566
  );
3493
3567
  }
3494
3568
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3495
3569
  return serverCheckpointTxs.map((encoded, index) => {
3496
- const server = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3570
+ const server = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3497
3571
  const local = byTxid.get(server.id);
3498
3572
  if (!local) {
3499
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3573
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3500
3574
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3501
3575
  );
3502
3576
  }
@@ -3506,36 +3580,53 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3506
3580
  }
3507
3581
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3508
3582
  if (response.arkTxid !== signedArkTx.id) {
3509
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3583
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3510
3584
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3511
3585
  );
3512
3586
  }
3513
3587
  if (response.finalArkTx === void 0) return;
3514
- const finalTxid = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3588
+ const finalTxid = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3515
3589
  if (finalTxid !== signedArkTx.id) {
3516
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3590
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3517
3591
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3518
3592
  );
3519
3593
  }
3520
3594
  }
3521
- function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeyHex, context) {
3595
+ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, context) {
3522
3596
  const leaf = localTx.getInput(inputIndex).tapLeafScript?.[0];
3523
3597
  if (!leaf) {
3524
3598
  throw new Error(
3525
3599
  `${context}: input ${inputIndex} carries no spend leaf to verify the server signature against`
3526
3600
  );
3527
3601
  }
3602
+ const script = chunkKJ5E646Y_cjs.scriptFromTapLeafScript(leaf);
3603
+ let leafPubkeys;
3604
+ try {
3605
+ leafPubkeys = chunkKJ5E646Y_cjs.decodeTapscript(script).params.pubkeys.map(
3606
+ (key) => base.hex.encode(chunk2D7F5IU3_cjs.toXOnly(key, "leaf key"))
3607
+ );
3608
+ } catch (error) {
3609
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3610
+ `${context}: input ${inputIndex} spend leaf cannot be decoded (${error instanceof Error ? error.message : String(error)})`
3611
+ );
3612
+ }
3613
+ const signer = leafPubkeys.find((key) => serverPubkeys.has(key));
3614
+ if (!signer) {
3615
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3616
+ `${context}: input ${inputIndex} spend leaf names no signer key the server advertises`
3617
+ );
3618
+ }
3528
3619
  try {
3529
3620
  verifyTapscriptSignatures(
3530
3621
  serverTx,
3531
3622
  inputIndex,
3532
- [serverPubkeyHex],
3623
+ [signer],
3533
3624
  void 0,
3534
3625
  void 0,
3535
- payment_js.tapLeafHash(chunk6FTHFJAN_cjs.scriptFromTapLeafScript(leaf))
3626
+ payment_js.tapLeafHash(script)
3536
3627
  );
3537
3628
  } catch (error) {
3538
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3629
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3539
3630
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
3540
3631
  );
3541
3632
  }
@@ -3544,20 +3635,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3544
3635
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
3545
3636
  for (const [index, checkpoint] of checkpoints.entries()) {
3546
3637
  if (checkpoint.inputsLength !== 1) {
3547
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3638
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3548
3639
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
3549
3640
  );
3550
3641
  }
3551
3642
  const spent = checkpoint.getInput(0);
3552
3643
  if (!spent.txid || spent.index === void 0) {
3553
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3644
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3554
3645
  `${context}: checkpoint ${index} has no input outpoint`
3555
3646
  );
3556
3647
  }
3557
3648
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
3558
3649
  const input = byOutpoint.get(outpoint);
3559
3650
  if (!input) {
3560
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3651
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3561
3652
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
3562
3653
  );
3563
3654
  }
@@ -3565,7 +3656,7 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3565
3656
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
3566
3657
  );
3567
3658
  if (!rebuilt) {
3568
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3659
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3569
3660
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
3570
3661
  );
3571
3662
  }
@@ -3591,9 +3682,9 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3591
3682
  const matched = matchServerCheckpoints(signedCheckpointTxs, offchainTx.checkpoints, "submitTx");
3592
3683
  matched.forEach(({ server }, index) => {
3593
3684
  try {
3594
- chunk6FTHFJAN_cjs.assertAllowedSighashTypes(server);
3685
+ chunkKJ5E646Y_cjs.assertAllowedSighashTypes(server);
3595
3686
  } catch (error) {
3596
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3687
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3597
3688
  `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
3598
3689
  );
3599
3690
  }
@@ -3601,29 +3692,27 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3601
3692
  const verify = options?.verifyServerSignatures;
3602
3693
  if (verify) {
3603
3694
  if (response.finalArkTx === void 0) {
3604
- throw new chunk6FTHFJAN_cjs.ServerResponseMismatchError(
3695
+ throw new chunkKJ5E646Y_cjs.ServerResponseMismatchError(
3605
3696
  "submitTx: server returned no final ark tx to verify its signatures against"
3606
3697
  );
3607
3698
  }
3608
- const finalArkTx = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3609
- const serverPubkeyHex = base.hex.encode(chunkNPM5YZBC_cjs.toXOnly(verify.serverPubkey, "server key"));
3699
+ const finalArkTx = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3700
+ const serverPubkeys = new Set(
3701
+ [verify.serverPubkey, ...verify.deprecatedServerPubkeys ?? []].map(
3702
+ (key) => base.hex.encode(chunk2D7F5IU3_cjs.toXOnly(key, "server key"))
3703
+ )
3704
+ );
3610
3705
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
3611
3706
  assertServerSignedLeaf(
3612
3707
  finalArkTx,
3613
3708
  offchainTx.arkTx,
3614
3709
  i,
3615
- serverPubkeyHex,
3710
+ serverPubkeys,
3616
3711
  "submitTx ark tx"
3617
3712
  );
3618
3713
  }
3619
3714
  matched.forEach(
3620
- ({ server, local }, index) => assertServerSignedLeaf(
3621
- server,
3622
- local,
3623
- 0,
3624
- serverPubkeyHex,
3625
- `submitTx checkpoint ${index}`
3626
- )
3715
+ ({ server, local }, index) => assertServerSignedLeaf(server, local, 0, serverPubkeys, `submitTx checkpoint ${index}`)
3627
3716
  );
3628
3717
  }
3629
3718
  let finalCheckpoints;
@@ -3662,12 +3751,12 @@ function claimWithPreimageIdentity(identity, preimage) {
3662
3751
  return {
3663
3752
  ...identity,
3664
3753
  sign: async (tx, inputIndexes) => {
3665
- const signed = chunk6FTHFJAN_cjs.Transaction.fromPSBT(
3754
+ const signed = chunkKJ5E646Y_cjs.Transaction.fromPSBT(
3666
3755
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
3667
3756
  );
3668
3757
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
3669
3758
  for (const index of indexes) {
3670
- chunk6FTHFJAN_cjs.setArkPsbtField(signed, index, chunk6FTHFJAN_cjs.ConditionWitness, [preimage]);
3759
+ chunkKJ5E646Y_cjs.setArkPsbtField(signed, index, chunkKJ5E646Y_cjs.ConditionWitness, [preimage]);
3671
3760
  }
3672
3761
  return signed;
3673
3762
  }
@@ -3862,7 +3951,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
3862
3951
  };
3863
3952
  }
3864
3953
  function deriveContractTapscripts(contract) {
3865
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
3954
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
3866
3955
  if (!handler) {
3867
3956
  throw new Error(`No handler for contract type '${contract.type}'`);
3868
3957
  }
@@ -3933,7 +4022,7 @@ function getRandomId() {
3933
4022
  }
3934
4023
  function isValidArkAddress2(address) {
3935
4024
  try {
3936
- chunk6FTHFJAN_cjs.ArkAddress.decode(address);
4025
+ chunkKJ5E646Y_cjs.ArkAddress.decode(address);
3937
4026
  return true;
3938
4027
  } catch (e) {
3939
4028
  return false;
@@ -3961,7 +4050,7 @@ function assertRecipientArkAddress(encoded, address, context) {
3961
4050
  function assertTapTreeDerivesAddress(encoded, tapTree, address) {
3962
4051
  let derived;
3963
4052
  try {
3964
- derived = chunk6FTHFJAN_cjs.VtxoScript.decode(tapTree).pkScript;
4053
+ derived = chunkKJ5E646Y_cjs.VtxoScript.decode(tapTree).pkScript;
3965
4054
  } catch (e) {
3966
4055
  throw new Error(
3967
4056
  `Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
@@ -3978,7 +4067,7 @@ function validateRecipients(recipients, dustAmount, context) {
3978
4067
  for (const recipient of recipients) {
3979
4068
  let address;
3980
4069
  try {
3981
- address = chunk6FTHFJAN_cjs.ArkAddress.decode(recipient.address);
4070
+ address = chunkKJ5E646Y_cjs.ArkAddress.decode(recipient.address);
3982
4071
  } catch (e) {
3983
4072
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
3984
4073
  }
@@ -4003,7 +4092,7 @@ function validateRecipients(recipients, dustAmount, context) {
4003
4092
 
4004
4093
  // src/contracts/spendability.ts
4005
4094
  function isContractGenericallySpendable(contract) {
4006
- return chunkNPM5YZBC_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
4095
+ return chunk2D7F5IU3_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
4007
4096
  }
4008
4097
  function gatedContracts(contracts) {
4009
4098
  const gated = /* @__PURE__ */ new Map();
@@ -4025,7 +4114,7 @@ function gateExclusion(gated) {
4025
4114
  return (vtxo) => {
4026
4115
  const type = gatedTypeOf(vtxo, gated);
4027
4116
  if (type === void 0) return void 0;
4028
- if (!chunkNPM5YZBC_cjs.contractHandlers.has(type)) {
4117
+ if (!chunk2D7F5IU3_cjs.contractHandlers.has(type)) {
4029
4118
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
4030
4119
  }
4031
4120
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -4061,7 +4150,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
4061
4150
  continue;
4062
4151
  }
4063
4152
  for (const v of vtxos) {
4064
- if (!chunk6FTHFJAN_cjs.hasTerminalSpend(v) && !v.isSwept && !v.isUnrolled) {
4153
+ if (!chunkKJ5E646Y_cjs.hasTerminalSpend(v) && !v.isSwept && !v.isUnrolled) {
4065
4154
  out.add(`${v.txid}:${v.vout}`);
4066
4155
  }
4067
4156
  }
@@ -4096,10 +4185,10 @@ function byValueDescending(vtxos) {
4096
4185
  return [...vtxos].sort((a, b) => b.value - a.value);
4097
4186
  }
4098
4187
  async function fetchTimeHeight(wallet) {
4099
- return chunk6FTHFJAN_cjs.resolveTimeHeight(wallet.onchainProvider);
4188
+ return chunkKJ5E646Y_cjs.resolveTimeHeight(wallet.onchainProvider);
4100
4189
  }
4101
4190
  function canMigrateBySend(vtxo, now) {
4102
- if (!chunk6FTHFJAN_cjs.canSpendOffchain(vtxo, now)) return false;
4191
+ if (!chunkKJ5E646Y_cjs.canSpendOffchain(vtxo, now)) return false;
4103
4192
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
4104
4193
  }
4105
4194
  function byExpiryAscending(vtxos, now) {
@@ -4107,7 +4196,7 @@ function byExpiryAscending(vtxos, now) {
4107
4196
  if (vtxo.isSwept) return -Infinity;
4108
4197
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
4109
4198
  if (vtxo.expiresAtHeight !== void 0) {
4110
- return chunk6FTHFJAN_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4199
+ return chunkKJ5E646Y_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4111
4200
  }
4112
4201
  return Infinity;
4113
4202
  };
@@ -4134,7 +4223,7 @@ function priceSettlementInputs(vtxos, estimator) {
4134
4223
  const payable = [];
4135
4224
  const net = /* @__PURE__ */ new Map();
4136
4225
  for (const vtxo of vtxos) {
4137
- const inputFee = estimator.evalOffchainInput(chunk6FTHFJAN_cjs.toOffchainInputFeeParams(vtxo));
4226
+ const inputFee = estimator.evalOffchainInput(chunkKJ5E646Y_cjs.toOffchainInputFeeParams(vtxo));
4138
4227
  if (inputFee.satoshis >= vtxo.value) {
4139
4228
  continue;
4140
4229
  }
@@ -4160,7 +4249,7 @@ function deductOffchainOutputFee(subtotal, estimator, arkAddress) {
4160
4249
  }
4161
4250
  const outputFee = estimator.evalOffchainOutput({
4162
4251
  amount: subtotal,
4163
- script: base.hex.encode(chunk6FTHFJAN_cjs.ArkAddress.decode(arkAddress).pkScript)
4252
+ script: base.hex.encode(chunkKJ5E646Y_cjs.ArkAddress.decode(arkAddress).pkScript)
4164
4253
  });
4165
4254
  return subtotal - BigInt(outputFee.satoshis);
4166
4255
  }
@@ -4178,10 +4267,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
4178
4267
  };
4179
4268
  function getRecoverableVtxos(vtxos, dustAmount, now) {
4180
4269
  return vtxos.filter((vtxo) => {
4181
- if (chunk6FTHFJAN_cjs.canRecoverOnchain(vtxo, now)) {
4270
+ if (chunkKJ5E646Y_cjs.canRecoverOnchain(vtxo, now)) {
4182
4271
  return true;
4183
4272
  }
4184
- if (chunk6FTHFJAN_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4273
+ if (chunkKJ5E646Y_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4185
4274
  return true;
4186
4275
  }
4187
4276
  return false;
@@ -4213,7 +4302,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
4213
4302
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
4214
4303
  if (vtxo.isUnrolled) return false;
4215
4304
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
4216
- const expiresAt = chunk6FTHFJAN_cjs.normalizeVtxo(vtxo).expiresAt;
4305
+ const expiresAt = chunkKJ5E646Y_cjs.normalizeVtxo(vtxo).expiresAt;
4217
4306
  if (expiresAt === void 0) return false;
4218
4307
  const now = Date.now();
4219
4308
  const batchExpiry = expiresAt.getTime();
@@ -4224,7 +4313,7 @@ function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
4224
4313
  return vtxos.filter(
4225
4314
  // The leading exclusion covers the `isSubdust` arm too, which is a value
4226
4315
  // property and would otherwise re-admit an exited coin on its own.
4227
- (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunk6FTHFJAN_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4316
+ (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkKJ5E646Y_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4228
4317
  );
4229
4318
  }
4230
4319
  function isMigrationCapable(wallet) {
@@ -4823,11 +4912,11 @@ var VtxoManager = class _VtxoManager {
4823
4912
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
4824
4913
  );
4825
4914
  }
4826
- const tx = new chunk6FTHFJAN_cjs.Transaction();
4915
+ const tx = new chunkKJ5E646Y_cjs.Transaction();
4827
4916
  for (const utxo of expiredUtxos) {
4828
- const utxoScript = chunk6FTHFJAN_cjs.VtxoScript.decode(utxo.tapTree);
4917
+ const utxoScript = chunkKJ5E646Y_cjs.VtxoScript.decode(utxo.tapTree);
4829
4918
  const utxoExitLeaf = utxoScript.leaves.find(
4830
- (leaf) => chunk6FTHFJAN_cjs.CSVMultisigTapscript.isScriptValid(chunk6FTHFJAN_cjs.scriptFromTapLeafScript(leaf)) === true
4919
+ (leaf) => chunkKJ5E646Y_cjs.CSVMultisigTapscript.isScriptValid(chunkKJ5E646Y_cjs.scriptFromTapLeafScript(leaf)) === true
4831
4920
  );
4832
4921
  if (!utxoExitLeaf) {
4833
4922
  throw new Error(
@@ -4842,7 +4931,7 @@ var VtxoManager = class _VtxoManager {
4842
4931
  amount: BigInt(utxo.value)
4843
4932
  },
4844
4933
  tapLeafScript: [utxoExitLeaf],
4845
- sequence: chunk6FTHFJAN_cjs.getSequence(utxoExitLeaf)
4934
+ sequence: chunkKJ5E646Y_cjs.getSequence(utxoExitLeaf)
4846
4935
  });
4847
4936
  }
4848
4937
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -5085,8 +5174,8 @@ var VtxoManager = class _VtxoManager {
5085
5174
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
5086
5175
  if (cls.status === "CURRENT") continue;
5087
5176
  const live = vtxos.filter((v) => !v.isUnrolled);
5088
- const recoverable = live.filter((v) => v.isSwept && !chunk6FTHFJAN_cjs.hasTerminalSpend(v));
5089
- const spendable = live.filter((v) => !chunk6FTHFJAN_cjs.hasTerminalSpend(v) && !v.isSwept);
5177
+ const recoverable = live.filter((v) => v.isSwept && !chunkKJ5E646Y_cjs.hasTerminalSpend(v));
5178
+ const spendable = live.filter((v) => !chunkKJ5E646Y_cjs.hasTerminalSpend(v) && !v.isSwept);
5090
5179
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
5091
5180
  let recoverableCount = 0;
5092
5181
  let recoverableValue = 0;
@@ -5099,7 +5188,7 @@ var VtxoManager = class _VtxoManager {
5099
5188
  awaitingSweepCount = spendable.length;
5100
5189
  awaitingSweepValue = value;
5101
5190
  for (const v of spendable) {
5102
- const exp = chunk6FTHFJAN_cjs.toBatchExpiry(v);
5191
+ const exp = chunkKJ5E646Y_cjs.toBatchExpiry(v);
5103
5192
  if (exp !== void 0 && (nextSweepEta === void 0 || exp < nextSweepEta)) {
5104
5193
  nextSweepEta = exp;
5105
5194
  }
@@ -5360,7 +5449,7 @@ var VtxoManager = class _VtxoManager {
5360
5449
  /** Decodes the boarding tapscript exit path to extract the CSV timelock. */
5361
5450
  getBoardingTimelock() {
5362
5451
  const wallet = this.getSweepWallet();
5363
- const exitScript = chunk6FTHFJAN_cjs.CSVMultisigTapscript.decode(
5452
+ const exitScript = chunkKJ5E646Y_cjs.CSVMultisigTapscript.decode(
5364
5453
  base.hex.decode(wallet.boardingTapscript.exitScript)
5365
5454
  );
5366
5455
  return exitScript.params.timelock;
@@ -5491,8 +5580,8 @@ var VtxoManager = class _VtxoManager {
5491
5580
  * or doesn't carry the metadata.
5492
5581
  */
5493
5582
  extractSpentOutpoint(error) {
5494
- const ark = chunk6FTHFJAN_cjs.maybeArkError(error);
5495
- if (!chunk6FTHFJAN_cjs.isArkError(ark, chunk6FTHFJAN_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5583
+ const ark = chunkKJ5E646Y_cjs.maybeArkError(error);
5584
+ if (!chunkKJ5E646Y_cjs.isArkError(ark, chunkKJ5E646Y_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5496
5585
  const raw = ark.metadata?.vtxo_outpoint;
5497
5586
  if (typeof raw !== "string") return void 0;
5498
5587
  const [txid, voutStr] = raw.split(":");
@@ -5682,7 +5771,7 @@ var VtxoManager = class _VtxoManager {
5682
5771
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
5683
5772
  break;
5684
5773
  }
5685
- const inputFee = estimator.evalOffchainInput(chunk6FTHFJAN_cjs.toOffchainInputFeeParams(v));
5774
+ const inputFee = estimator.evalOffchainInput(chunkKJ5E646Y_cjs.toOffchainInputFeeParams(v));
5686
5775
  if (inputFee.satoshis >= v.value) {
5687
5776
  continue;
5688
5777
  }
@@ -5702,7 +5791,7 @@ var VtxoManager = class _VtxoManager {
5702
5791
  const arkAddress = await this.wallet.getAddress();
5703
5792
  const outputFee = estimator.evalOffchainOutput({
5704
5793
  amount: totalAmount,
5705
- script: base.hex.encode(chunk6FTHFJAN_cjs.ArkAddress.decode(arkAddress).pkScript)
5794
+ script: base.hex.encode(chunkKJ5E646Y_cjs.ArkAddress.decode(arkAddress).pkScript)
5706
5795
  });
5707
5796
  totalAmount -= BigInt(outputFee.satoshis);
5708
5797
  if (totalAmount < dustAmount) return;
@@ -5782,7 +5871,7 @@ var ArkNote = class _ArkNote {
5782
5871
  this.value = value;
5783
5872
  this.HRP = HRP;
5784
5873
  const preimageHash = utils_js.sha256(this.preimage);
5785
- this.vtxoScript = new chunk6FTHFJAN_cjs.VtxoScript([noteTapscript(preimageHash)]);
5874
+ this.vtxoScript = new chunkKJ5E646Y_cjs.VtxoScript([noteTapscript(preimageHash)]);
5786
5875
  const leaf = this.vtxoScript.leaves[0];
5787
5876
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
5788
5877
  this.tapTree = this.vtxoScript.encode();
@@ -5949,7 +6038,7 @@ var ArkadeCash = class _ArkadeCash {
5949
6038
  const privateKey = data.slice(1, 33);
5950
6039
  const serverPubKey = data.slice(33, 65);
5951
6040
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
5952
- const csvTimelock = chunk6FTHFJAN_cjs.sequenceToTimelock(sequence);
6041
+ const csvTimelock = chunkKJ5E646Y_cjs.sequenceToTimelock(sequence);
5953
6042
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock, decoded.prefix);
5954
6043
  }
5955
6044
  toString() {
@@ -5957,7 +6046,7 @@ var ArkadeCash = class _ArkadeCash {
5957
6046
  data[0] = _ArkadeCash.Version;
5958
6047
  data.set(this._privateKey, 1);
5959
6048
  data.set(this._serverPubKey, 33);
5960
- const sequence = chunk6FTHFJAN_cjs.timelockToSequence(this.csvTimelock);
6049
+ const sequence = chunkKJ5E646Y_cjs.timelockToSequence(this.csvTimelock);
5961
6050
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
5962
6051
  const words = base.bech32m.toWords(data);
5963
6052
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -5966,7 +6055,7 @@ var ArkadeCash = class _ArkadeCash {
5966
6055
  return SingleKey.fromPrivateKey(this._privateKey);
5967
6056
  }
5968
6057
  get vtxoScript() {
5969
- return new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
6058
+ return new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
5970
6059
  pubKey: this._publicKey,
5971
6060
  serverPubKey: this._serverPubKey,
5972
6061
  csvTimelock: this.csvTimelock
@@ -6227,7 +6316,7 @@ async function captureExitBranch(params) {
6227
6316
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
6228
6317
  if (nonCommitment.length > 0) {
6229
6318
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
6230
- psbtByTxid.set(chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6319
+ psbtByTxid.set(chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6231
6320
  }
6232
6321
  }
6233
6322
  }
@@ -6270,10 +6359,10 @@ var IndexerExitDataSource = class {
6270
6359
  while (hasMore) {
6271
6360
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
6272
6361
  { txid: vtxo.txid, vout: vtxo.vout },
6273
- { pageIndex, pageSize: chunk6FTHFJAN_cjs.DEFAULT_PAGE_SIZE }
6362
+ { pageIndex, pageSize: chunkKJ5E646Y_cjs.DEFAULT_PAGE_SIZE }
6274
6363
  );
6275
6364
  chain.push(...page);
6276
- hasMore = meta ? page.length === chunk6FTHFJAN_cjs.DEFAULT_PAGE_SIZE : false;
6365
+ hasMore = meta ? page.length === chunkKJ5E646Y_cjs.DEFAULT_PAGE_SIZE : false;
6277
6366
  pageIndex++;
6278
6367
  }
6279
6368
  return chain;
@@ -6285,12 +6374,12 @@ var IndexerExitDataSource = class {
6285
6374
  while (hasMore) {
6286
6375
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
6287
6376
  pageIndex,
6288
- pageSize: chunk6FTHFJAN_cjs.DEFAULT_PAGE_SIZE
6377
+ pageSize: chunkKJ5E646Y_cjs.DEFAULT_PAGE_SIZE
6289
6378
  });
6290
6379
  for (const psbt of txs) {
6291
- out.set(chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6380
+ out.set(chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6292
6381
  }
6293
- hasMore = page ? txs.length === chunk6FTHFJAN_cjs.DEFAULT_PAGE_SIZE : false;
6382
+ hasMore = page ? txs.length === chunkKJ5E646Y_cjs.DEFAULT_PAGE_SIZE : false;
6294
6383
  pageIndex++;
6295
6384
  }
6296
6385
  return out;
@@ -6311,7 +6400,7 @@ function chainedTxTypeToChainTxType(t) {
6311
6400
  }
6312
6401
  }
6313
6402
  function psbtInputTxids(psbtBase64) {
6314
- const tx = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
6403
+ const tx = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
6315
6404
  const ids = [];
6316
6405
  for (let i = 0; i < tx.inputsLength; i++) {
6317
6406
  const txid = tx.getInput(i).txid;
@@ -6670,10 +6759,10 @@ async function resolveArkInfo(arkProvider, walletRepository) {
6670
6759
  try {
6671
6760
  info = await arkProvider.getInfo();
6672
6761
  } catch (err) {
6673
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
6762
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
6674
6763
  const snapshot = await loadArkInfoSnapshot(walletRepository);
6675
6764
  if (!snapshot) {
6676
- throw new chunk6FTHFJAN_cjs.ProviderUnavailableError(
6765
+ throw new chunkKJ5E646Y_cjs.ProviderUnavailableError(
6677
6766
  "Arkade server info is unavailable and no cached snapshot exists",
6678
6767
  { cause: err }
6679
6768
  );
@@ -7080,7 +7169,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos, localCreatedAt) {
7080
7169
  return [...txids];
7081
7170
  }
7082
7171
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt, gatedScripts = /* @__PURE__ */ new Map()) {
7083
- const normalized = vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7172
+ const normalized = vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7084
7173
  const localCreatedAt = localCreatedAtByTxid(normalized);
7085
7174
  const gatedVtxos = normalized.filter((vtxo) => isGatedVtxo(vtxo, gatedScripts));
7086
7175
  const ownVtxos = normalized.filter((vtxo) => !isGatedVtxo(vtxo, gatedScripts));
@@ -7254,7 +7343,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7254
7343
  const virtualCoins = await this.wallet.getSpendableVtxos({
7255
7344
  withRecoverable: false
7256
7345
  });
7257
- const controlAssetRef = params.controlAssetId ? chunk4C5PMGBB_cjs.AssetRef.fromId(chunk4C5PMGBB_cjs.AssetId.fromString(params.controlAssetId)) : null;
7346
+ const controlAssetRef = params.controlAssetId ? chunkD5DLGVN4_cjs.AssetRef.fromId(chunkD5DLGVN4_cjs.AssetId.fromString(params.controlAssetId)) : null;
7258
7347
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
7259
7348
  let totalBtcSelected = 0n;
7260
7349
  const assetChanges = /* @__PURE__ */ new Map();
@@ -7267,8 +7356,8 @@ var AssetManager = class extends ReadonlyAssetManager {
7267
7356
  }
7268
7357
  }
7269
7358
  const groups = [];
7270
- const issuedAssetOutput = chunk4C5PMGBB_cjs.AssetOutput.create(0, params.amount);
7271
- const issuedAssetGroup = chunk4C5PMGBB_cjs.AssetGroup.create(
7359
+ const issuedAssetOutput = chunkD5DLGVN4_cjs.AssetOutput.create(0, params.amount);
7360
+ const issuedAssetGroup = chunkD5DLGVN4_cjs.AssetGroup.create(
7272
7361
  null,
7273
7362
  controlAssetRef,
7274
7363
  [],
@@ -7283,28 +7372,28 @@ var AssetManager = class extends ReadonlyAssetManager {
7283
7372
  for (const [inputIndex, assets] of assetInputs) {
7284
7373
  for (const asset of assets) {
7285
7374
  if (asset.assetId !== assetId) continue;
7286
- changeInputs.push(chunk4C5PMGBB_cjs.AssetInput.create(inputIndex, asset.amount));
7375
+ changeInputs.push(chunkD5DLGVN4_cjs.AssetInput.create(inputIndex, asset.amount));
7287
7376
  }
7288
7377
  }
7289
7378
  groups.push(
7290
- chunk4C5PMGBB_cjs.AssetGroup.create(
7291
- chunk4C5PMGBB_cjs.AssetId.fromString(assetId),
7379
+ chunkD5DLGVN4_cjs.AssetGroup.create(
7380
+ chunkD5DLGVN4_cjs.AssetId.fromString(assetId),
7292
7381
  null,
7293
7382
  changeInputs,
7294
- [chunk4C5PMGBB_cjs.AssetOutput.create(0, amount)],
7383
+ [chunkD5DLGVN4_cjs.AssetOutput.create(0, amount)],
7295
7384
  []
7296
7385
  )
7297
7386
  );
7298
7387
  }
7299
7388
  }
7300
7389
  const address = await this.wallet.getAddress();
7301
- const outputAddress = chunk6FTHFJAN_cjs.ArkAddress.decode(address);
7390
+ const outputAddress = chunkKJ5E646Y_cjs.ArkAddress.decode(address);
7302
7391
  const outputs = [
7303
7392
  {
7304
7393
  script: outputAddress.pkScript,
7305
7394
  amount: BigInt(totalBtcSelected)
7306
7395
  },
7307
- Extension.create([chunk4C5PMGBB_cjs.Packet.create(groups)]).txOut()
7396
+ Extension.create([chunkD5DLGVN4_cjs.Packet.create(groups)]).txOut()
7308
7397
  ];
7309
7398
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(
7310
7399
  coinSelection.inputs,
@@ -7312,7 +7401,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7312
7401
  );
7313
7402
  return {
7314
7403
  arkTxId: arkTxid,
7315
- assetId: chunk4C5PMGBB_cjs.AssetId.create(arkTxid, 0).toString()
7404
+ assetId: chunkD5DLGVN4_cjs.AssetId.create(arkTxid, 0).toString()
7316
7405
  };
7317
7406
  }
7318
7407
  /**
@@ -7384,16 +7473,16 @@ var AssetManager = class extends ReadonlyAssetManager {
7384
7473
  for (const [inputIndex, assets] of assetInputs) {
7385
7474
  for (const asset of assets) {
7386
7475
  if (asset.assetId !== params.assetId) continue;
7387
- reissueInputs.push(chunk4C5PMGBB_cjs.AssetInput.create(inputIndex, asset.amount));
7476
+ reissueInputs.push(chunkD5DLGVN4_cjs.AssetInput.create(inputIndex, asset.amount));
7388
7477
  }
7389
7478
  }
7390
7479
  const totalAssetAmount = assetToReissueAmount + params.amount;
7391
- const reissueAssetIdObj = chunk4C5PMGBB_cjs.AssetId.fromString(params.assetId);
7392
- const reissueAssetGroup = chunk4C5PMGBB_cjs.AssetGroup.create(
7480
+ const reissueAssetIdObj = chunkD5DLGVN4_cjs.AssetId.fromString(params.assetId);
7481
+ const reissueAssetGroup = chunkD5DLGVN4_cjs.AssetGroup.create(
7393
7482
  reissueAssetIdObj,
7394
7483
  null,
7395
7484
  reissueInputs,
7396
- [chunk4C5PMGBB_cjs.AssetOutput.create(0, totalAssetAmount)],
7485
+ [chunkD5DLGVN4_cjs.AssetOutput.create(0, totalAssetAmount)],
7397
7486
  []
7398
7487
  );
7399
7488
  const groups = [reissueAssetGroup];
@@ -7402,27 +7491,27 @@ var AssetManager = class extends ReadonlyAssetManager {
7402
7491
  for (const [inputIndex, assets] of assetInputs) {
7403
7492
  for (const asset of assets) {
7404
7493
  if (asset.assetId !== assetId) continue;
7405
- changeInputs.push(chunk4C5PMGBB_cjs.AssetInput.create(inputIndex, asset.amount));
7494
+ changeInputs.push(chunkD5DLGVN4_cjs.AssetInput.create(inputIndex, asset.amount));
7406
7495
  }
7407
7496
  }
7408
7497
  groups.push(
7409
- chunk4C5PMGBB_cjs.AssetGroup.create(
7410
- chunk4C5PMGBB_cjs.AssetId.fromString(assetId),
7498
+ chunkD5DLGVN4_cjs.AssetGroup.create(
7499
+ chunkD5DLGVN4_cjs.AssetId.fromString(assetId),
7411
7500
  null,
7412
7501
  changeInputs,
7413
- [chunk4C5PMGBB_cjs.AssetOutput.create(0, amount)],
7502
+ [chunkD5DLGVN4_cjs.AssetOutput.create(0, amount)],
7414
7503
  []
7415
7504
  )
7416
7505
  );
7417
7506
  }
7418
7507
  const address = await this.wallet.getAddress();
7419
- const outputAddress = chunk6FTHFJAN_cjs.ArkAddress.decode(address);
7508
+ const outputAddress = chunkKJ5E646Y_cjs.ArkAddress.decode(address);
7420
7509
  const outputs = [
7421
7510
  {
7422
7511
  script: outputAddress.pkScript,
7423
7512
  amount: BigInt(totalBtcSelected)
7424
7513
  },
7425
- Extension.create([chunk4C5PMGBB_cjs.Packet.create(groups)]).txOut()
7514
+ Extension.create([chunkD5DLGVN4_cjs.Packet.create(groups)]).txOut()
7426
7515
  ];
7427
7516
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
7428
7517
  return arkTxid;
@@ -7489,27 +7578,27 @@ var AssetManager = class extends ReadonlyAssetManager {
7489
7578
  for (const [inputIndex, assets] of assetInputs) {
7490
7579
  for (const asset of assets) {
7491
7580
  if (asset.assetId !== assetId) continue;
7492
- changeInputs.push(chunk4C5PMGBB_cjs.AssetInput.create(inputIndex, asset.amount));
7581
+ changeInputs.push(chunkD5DLGVN4_cjs.AssetInput.create(inputIndex, asset.amount));
7493
7582
  }
7494
7583
  }
7495
7584
  groups.push(
7496
- chunk4C5PMGBB_cjs.AssetGroup.create(
7497
- chunk4C5PMGBB_cjs.AssetId.fromString(assetId),
7585
+ chunkD5DLGVN4_cjs.AssetGroup.create(
7586
+ chunkD5DLGVN4_cjs.AssetId.fromString(assetId),
7498
7587
  null,
7499
7588
  changeInputs,
7500
- amount > 0n ? [chunk4C5PMGBB_cjs.AssetOutput.create(0, amount)] : [],
7589
+ amount > 0n ? [chunkD5DLGVN4_cjs.AssetOutput.create(0, amount)] : [],
7501
7590
  []
7502
7591
  )
7503
7592
  );
7504
7593
  }
7505
7594
  const address = await this.wallet.getAddress();
7506
- const outputAddress = chunk6FTHFJAN_cjs.ArkAddress.decode(address);
7595
+ const outputAddress = chunkKJ5E646Y_cjs.ArkAddress.decode(address);
7507
7596
  const outputs = [
7508
7597
  {
7509
7598
  script: outputAddress.pkScript,
7510
7599
  amount: BigInt(totalBtcSelected)
7511
7600
  },
7512
- Extension.create([chunk4C5PMGBB_cjs.Packet.create(groups)]).txOut()
7601
+ Extension.create([chunkD5DLGVN4_cjs.Packet.create(groups)]).txOut()
7513
7602
  ];
7514
7603
  const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
7515
7604
  return arkTxid;
@@ -7534,7 +7623,7 @@ function castMetadata(metadata) {
7534
7623
  } else {
7535
7624
  throw new Error("Invalid metadata value type");
7536
7625
  }
7537
- md.push(chunk4C5PMGBB_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7626
+ md.push(chunkD5DLGVN4_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7538
7627
  }
7539
7628
  return md;
7540
7629
  }
@@ -7555,10 +7644,10 @@ var DelegateManagerImpl = class {
7555
7644
  if (vtxos.length === 0) {
7556
7645
  return { delegated: [], failed: [] };
7557
7646
  }
7558
- const destinationScript = chunk6FTHFJAN_cjs.ArkAddress.decode(destination).pkScript;
7647
+ const destinationScript = chunkKJ5E646Y_cjs.ArkAddress.decode(destination).pkScript;
7559
7648
  const arkInfo = await this.arkInfoProvider.getInfo();
7560
7649
  const delegateInfo = await this.delegateProvider.getDelegateInfo();
7561
- const eligible = vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo).filter(
7650
+ const eligible = vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo).filter(
7562
7651
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
7563
7652
  );
7564
7653
  if (eligible.length === 0) {
@@ -7587,11 +7676,11 @@ var DelegateManagerImpl = class {
7587
7676
  const groupByExpiry = /* @__PURE__ */ new Map();
7588
7677
  let recoverableVtxos = [];
7589
7678
  for (const vtxo of eligible) {
7590
- if (chunk6FTHFJAN_cjs.canRecoverOnchain(vtxo, now)) {
7679
+ if (chunkKJ5E646Y_cjs.canRecoverOnchain(vtxo, now)) {
7591
7680
  recoverableVtxos.push(vtxo);
7592
7681
  continue;
7593
7682
  }
7594
- const expiry = chunk6FTHFJAN_cjs.toBatchExpiry(vtxo);
7683
+ const expiry = chunkKJ5E646Y_cjs.toBatchExpiry(vtxo);
7595
7684
  if (!expiry) continue;
7596
7685
  const dayKey = getDayTimestamp(expiry);
7597
7686
  groupByExpiry.set(dayKey, [...groupByExpiry.get(dayKey) ?? [], vtxo]);
@@ -7656,16 +7745,11 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7656
7745
  }
7657
7746
  if (!delegateAt) {
7658
7747
  const now = { timestamp: /* @__PURE__ */ new Date() };
7659
- const expiryTimestamp = vtxos.filter((coin) => !chunk6FTHFJAN_cjs.canRecoverOnchain(coin, now) && chunk6FTHFJAN_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunk6FTHFJAN_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7748
+ const expiryTimestamp = vtxos.filter((coin) => !chunkKJ5E646Y_cjs.canRecoverOnchain(coin, now) && chunkKJ5E646Y_cjs.toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, chunkKJ5E646Y_cjs.toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7660
7749
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
7661
7750
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7662
7751
  } else {
7663
- const remainingTimeMs = expiryTimestamp - Date.now();
7664
- if (remainingTimeMs <= 0) {
7665
- delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7666
- } else {
7667
- delegateAt = new Date(expiryTimestamp - remainingTimeMs * 0.1);
7668
- }
7752
+ delegateAt = defaultDelegateAt(expiryTimestamp, arkInfo.sessionDuration);
7669
7753
  }
7670
7754
  }
7671
7755
  const { fees, dust, forfeitAddress, network } = arkInfo;
@@ -7685,7 +7769,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7685
7769
  let amount = 0n;
7686
7770
  for (const coin of vtxos) {
7687
7771
  const inputFee = estimator.evalOffchainInput({
7688
- ...chunk6FTHFJAN_cjs.toOffchainInputFeeParams(coin),
7772
+ ...chunkKJ5E646Y_cjs.toOffchainInputFeeParams(coin),
7689
7773
  type: "vtxo"
7690
7774
  });
7691
7775
  if (inputFee.value >= coin.value) {
@@ -7699,7 +7783,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7699
7783
  const delegateFee = BigInt(Number(fee));
7700
7784
  if (delegateFee > 0n) {
7701
7785
  outputs.push({
7702
- script: chunk6FTHFJAN_cjs.ArkAddress.decode(delegateAddress).pkScript,
7786
+ script: chunkKJ5E646Y_cjs.ArkAddress.decode(delegateAddress).pkScript,
7703
7787
  amount: delegateFee
7704
7788
  });
7705
7789
  }
@@ -7732,10 +7816,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7732
7816
  destinationScript
7733
7817
  );
7734
7818
  const forfeitOutputScript = btcSigner.OutScript.encode(
7735
- btcSigner.Address(chunk6FTHFJAN_cjs.getNetwork(network)).decode(forfeitAddress)
7819
+ btcSigner.Address(chunkKJ5E646Y_cjs.getNetwork(network)).decode(forfeitAddress)
7736
7820
  );
7737
7821
  const forfeits = await Promise.all(
7738
- vtxos.filter((v) => !chunk6FTHFJAN_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
7822
+ vtxos.filter((v) => !chunkKJ5E646Y_cjs.canRecoverOnchain(v, { timestamp: /* @__PURE__ */ new Date() })).map(async (coin) => {
7739
7823
  const forfeit = await makeDelegateForfeitTx(
7740
7824
  coin,
7741
7825
  dust,
@@ -7760,7 +7844,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
7760
7844
  index: input.vout,
7761
7845
  witnessUtxo: {
7762
7846
  amount: BigInt(input.value),
7763
- script: chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).pkScript
7847
+ script: chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).pkScript
7764
7848
  },
7765
7849
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
7766
7850
  tapLeafScript: [delegateTapLeaf]
@@ -7818,13 +7902,21 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
7818
7902
  expire_at: 0,
7819
7903
  cosigners_public_keys: cosignerPubKeys
7820
7904
  };
7821
- const proof = chunk6FTHFJAN_cjs.Intent.create(message, coins, outputs);
7905
+ const proof = chunkKJ5E646Y_cjs.Intent.create(message, coins, outputs);
7822
7906
  const signedProof = await identity.sign(proof);
7823
7907
  return {
7824
7908
  proof: base.base64.encode(signedProof.toPSBT()),
7825
7909
  message
7826
7910
  };
7827
7911
  }
7912
+ function defaultDelegateAt(expiryTimestamp, sessionDurationSeconds, now = Date.now()) {
7913
+ const remainingTimeMs = expiryTimestamp - now;
7914
+ if (remainingTimeMs <= 0) return new Date(now + 6e4);
7915
+ const sessionLeadMs = Number(sessionDurationSeconds * 1000n);
7916
+ const leadTimeMs = Math.max(remainingTimeMs * 0.1, sessionLeadMs);
7917
+ const delegateAt = expiryTimestamp - leadTimeMs;
7918
+ return new Date(delegateAt > now ? delegateAt : now + 2e3);
7919
+ }
7828
7920
  function findDestinationOutputIndex(outputs, destinationScript) {
7829
7921
  return outputs.findIndex((o) => o.script && utils_js.equalBytes(o.script, destinationScript));
7830
7922
  }
@@ -7836,10 +7928,10 @@ function getDayTimestamp(timestamp) {
7836
7928
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
7837
7929
  if (!vtxo.tapTree) return void 0;
7838
7930
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
7839
- const vtxoScript = chunk6FTHFJAN_cjs.VtxoScript.decode(vtxo.tapTree);
7931
+ const vtxoScript = chunkKJ5E646Y_cjs.VtxoScript.decode(vtxo.tapTree);
7840
7932
  return vtxoScript.leaves.find((tapLeaf) => {
7841
- const arkTapscript = chunk6FTHFJAN_cjs.decodeTapscript(chunk6FTHFJAN_cjs.scriptFromTapLeafScript(tapLeaf));
7842
- if (!chunk6FTHFJAN_cjs.MultisigTapscript.is(arkTapscript)) return false;
7933
+ const arkTapscript = chunkKJ5E646Y_cjs.decodeTapscript(chunkKJ5E646Y_cjs.scriptFromTapLeafScript(tapLeaf));
7934
+ if (!chunkKJ5E646Y_cjs.MultisigTapscript.is(arkTapscript)) return false;
7843
7935
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
7844
7936
  });
7845
7937
  }
@@ -8120,7 +8212,7 @@ function createManagedConnection(dbName, version, initDatabase2) {
8120
8212
  };
8121
8213
  }
8122
8214
  function scriptFromArkAddress(address) {
8123
- return base.hex.encode(chunk6FTHFJAN_cjs.ArkAddress.decode(address).pkScript);
8215
+ return base.hex.encode(chunkKJ5E646Y_cjs.ArkAddress.decode(address).pkScript);
8124
8216
  }
8125
8217
 
8126
8218
  // src/repositories/indexedDB/schema.ts
@@ -8615,7 +8707,7 @@ function validateVtxosForScript(vtxos, script, context) {
8615
8707
  }
8616
8708
  async function getVtxosForContract(repo, contract) {
8617
8709
  const vtxos = repo.getVtxosForScript ? await repo.getVtxosForScript(contract.script) : filterVtxosForScript(await repo.getVtxos(contract.address), contract.script);
8618
- return vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo);
8710
+ return vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo);
8619
8711
  }
8620
8712
  async function saveVtxosForContract(repo, contract, vtxos) {
8621
8713
  if (repo.saveVtxosForScript) {
@@ -8757,7 +8849,7 @@ function decodeArkContract(encoded) {
8757
8849
  }
8758
8850
  function contractFromArkContract(encoded, options = {}) {
8759
8851
  const parsed = decodeArkContract(encoded);
8760
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(parsed.type);
8852
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(parsed.type);
8761
8853
  if (!handler) {
8762
8854
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
8763
8855
  }
@@ -8771,9 +8863,9 @@ function contractFromArkContract(encoded, options = {}) {
8771
8863
  metadata: options.metadata
8772
8864
  };
8773
8865
  }
8774
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunk6FTHFJAN_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8866
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkKJ5E646Y_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8775
8867
  const parsed = decodeArkContract(encoded);
8776
- const handler = chunkNPM5YZBC_cjs.contractHandlers.getOrThrow(parsed.type);
8868
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.getOrThrow(parsed.type);
8777
8869
  const params = parsed.data;
8778
8870
  const vtxoScript = handler.createScript(params);
8779
8871
  return {
@@ -9070,9 +9162,9 @@ var ContractWatcher = class {
9070
9162
  this.connectionState = "connected";
9071
9163
  this.reconnectAttempts = 0;
9072
9164
  this.listenLoop().catch((e) => {
9073
- if (chunk6FTHFJAN_cjs.isEventSourceError(e)) {
9165
+ if (chunkKJ5E646Y_cjs.isEventSourceError(e)) {
9074
9166
  console.debug("ContractWatcher subscription disconnected; reconnecting");
9075
- } else if (!chunk6FTHFJAN_cjs.isEventSourceUnavailableError(e)) {
9167
+ } else if (!chunkKJ5E646Y_cjs.isEventSourceUnavailableError(e)) {
9076
9168
  console.error(e);
9077
9169
  }
9078
9170
  this.connectionState = "disconnected";
@@ -9084,7 +9176,7 @@ var ContractWatcher = class {
9084
9176
  this.scheduleReconnect();
9085
9177
  });
9086
9178
  } catch (error) {
9087
- if (!chunk6FTHFJAN_cjs.isEventSourceUnavailableError(error)) {
9179
+ if (!chunkKJ5E646Y_cjs.isEventSourceUnavailableError(error)) {
9088
9180
  console.error("ContractWatcher connection failed:", error);
9089
9181
  }
9090
9182
  this.connectionState = "disconnected";
@@ -9110,7 +9202,7 @@ var ContractWatcher = class {
9110
9202
  * slower; what it loses is push latency.
9111
9203
  */
9112
9204
  reportEventSourceUnavailable(error) {
9113
- if (!chunk6FTHFJAN_cjs.isEventSourceUnavailableError(error)) return false;
9205
+ if (!chunkKJ5E646Y_cjs.isEventSourceUnavailableError(error)) return false;
9114
9206
  if (!this.eventSourceReported) {
9115
9207
  this.eventSourceReported = true;
9116
9208
  console.warn(
@@ -9182,7 +9274,7 @@ var ContractWatcher = class {
9182
9274
  const now = Date.now();
9183
9275
  let current;
9184
9276
  try {
9185
- current = await chunk6FTHFJAN_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9277
+ current = await chunkKJ5E646Y_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9186
9278
  spendableOnly: true
9187
9279
  });
9188
9280
  } catch (error) {
@@ -9391,14 +9483,14 @@ var ContractWatcher = class {
9391
9483
  const timestamp = Date.now();
9392
9484
  if (update.newVtxos?.length) {
9393
9485
  this.processSubscriptionVtxos(
9394
- update.newVtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo),
9486
+ update.newVtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo),
9395
9487
  "vtxo_received",
9396
9488
  timestamp
9397
9489
  );
9398
9490
  }
9399
9491
  if (update.spentVtxos?.length) {
9400
9492
  this.processSubscriptionVtxos(
9401
- update.spentVtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo),
9493
+ update.spentVtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo),
9402
9494
  "vtxo_spent",
9403
9495
  timestamp
9404
9496
  );
@@ -9426,8 +9518,8 @@ var ContractWatcher = class {
9426
9518
  continue;
9427
9519
  }
9428
9520
  if (target === byWatchedScript && eventType === "vtxo_received") {
9429
- const n = chunk6FTHFJAN_cjs.normalizeVtxo(vtxo);
9430
- if (chunk6FTHFJAN_cjs.hasTerminalSpend(n) || n.isSwept || chunk6FTHFJAN_cjs.isPastExpiry(n, now)) continue;
9521
+ const n = chunkKJ5E646Y_cjs.normalizeVtxo(vtxo);
9522
+ if (chunkKJ5E646Y_cjs.hasTerminalSpend(n) || n.isSwept || chunkKJ5E646Y_cjs.isPastExpiry(n, now)) continue;
9431
9523
  }
9432
9524
  let bucket = target.get(vtxo.script);
9433
9525
  if (!bucket) {
@@ -9526,7 +9618,7 @@ var NON_TERMINAL_INTENT_STATES = ALL_INTENT_STATES.filter(
9526
9618
  (s) => !isTerminalIntentState(s)
9527
9619
  );
9528
9620
  function isConsumed(vtxo) {
9529
- return vtxo !== void 0 && chunk6FTHFJAN_cjs.hasTerminalSpend(vtxo);
9621
+ return vtxo !== void 0 && chunkKJ5E646Y_cjs.hasTerminalSpend(vtxo);
9530
9622
  }
9531
9623
  async function classifyIntent(intent, vtxosByOutpoint, now) {
9532
9624
  if (isTerminalIntentState(intent.state)) return void 0;
@@ -9569,7 +9661,7 @@ async function reconcileIntents(deps) {
9569
9661
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
9570
9662
  if (outpoints.length > 0) {
9571
9663
  try {
9572
- const { vtxos } = await chunk6FTHFJAN_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9664
+ const { vtxos } = await chunkKJ5E646Y_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9573
9665
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
9574
9666
  } catch (e) {
9575
9667
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -9748,7 +9840,7 @@ var ContractManager = class _ContractManager {
9748
9840
  await this.reconcileWatched();
9749
9841
  this.markSyncOnline();
9750
9842
  } catch (err) {
9751
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
9843
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
9752
9844
  this.markSyncDegraded(err);
9753
9845
  }
9754
9846
  this.initialized = true;
@@ -9880,7 +9972,7 @@ var ContractManager = class _ContractManager {
9880
9972
  const from = Math.max(0, watermark - lookAhead.size);
9881
9973
  const to = watermark + lookAhead.size;
9882
9974
  const deps = lookAhead.candidateDeps();
9883
- const handlers = chunkNPM5YZBC_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkNPM5YZBC_cjs.contractHandlers.get(t)).filter(hasCandidates);
9975
+ const handlers = chunk2D7F5IU3_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk2D7F5IU3_cjs.contractHandlers.get(t)).filter(hasCandidates);
9884
9976
  const band = /* @__PURE__ */ new Map();
9885
9977
  for (let index = from; index <= to; index++) {
9886
9978
  const descriptor = lookAhead.materialize(index);
@@ -9891,7 +9983,7 @@ var ContractManager = class _ContractManager {
9891
9983
  index,
9892
9984
  params: {
9893
9985
  ...candidate,
9894
- ...chunkNPM5YZBC_cjs.speculativeReceiveMetadata(descriptor)
9986
+ ...chunk2D7F5IU3_cjs.speculativeReceiveMetadata(descriptor)
9895
9987
  }
9896
9988
  });
9897
9989
  }
@@ -9953,7 +10045,7 @@ var ContractManager = class _ContractManager {
9953
10045
  });
9954
10046
  for (const entry of pending) entry.catchUpPending = false;
9955
10047
  } catch (err) {
9956
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
10048
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
9957
10049
  this.markSyncDegraded(err);
9958
10050
  }
9959
10051
  }
@@ -10003,7 +10095,7 @@ var ContractManager = class _ContractManager {
10003
10095
  await this.fetchContractVxosFromIndexer([contract]);
10004
10096
  this.markSyncOnline();
10005
10097
  } catch (err) {
10006
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
10098
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
10007
10099
  this.markSyncDegraded(err);
10008
10100
  }
10009
10101
  await this.watcher.addContract(contract);
@@ -10037,7 +10129,7 @@ var ContractManager = class _ContractManager {
10037
10129
  await this.fetchContractVxosFromIndexer(fresh);
10038
10130
  this.markSyncOnline();
10039
10131
  } catch (err) {
10040
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
10132
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
10041
10133
  this.markSyncDegraded(err);
10042
10134
  }
10043
10135
  for (const contract of fresh) await this.watcher.addContract(contract);
@@ -10075,7 +10167,7 @@ var ContractManager = class _ContractManager {
10075
10167
  return result;
10076
10168
  }
10077
10169
  async upsertContractRow(params) {
10078
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(params.type);
10170
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(params.type);
10079
10171
  if (!handler) {
10080
10172
  throw new Error(`No handler registered for contract type '${params.type}'`);
10081
10173
  }
@@ -10175,7 +10267,7 @@ var ContractManager = class _ContractManager {
10175
10267
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
10176
10268
  );
10177
10269
  }
10178
- const registered = chunkNPM5YZBC_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkNPM5YZBC_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10270
+ const registered = chunk2D7F5IU3_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk2D7F5IU3_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10179
10271
  const discoverables = [
10180
10272
  ...registered.filter((h) => h.type === "boarding"),
10181
10273
  ...registered.filter((h) => h.type !== "boarding")
@@ -10313,7 +10405,7 @@ var ContractManager = class _ContractManager {
10313
10405
  await this.syncContracts({ contracts, pageSize });
10314
10406
  this.markSyncOnline();
10315
10407
  } catch (err) {
10316
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
10408
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
10317
10409
  this.markSyncDegraded(err);
10318
10410
  }
10319
10411
  }
@@ -10335,7 +10427,7 @@ var ContractManager = class _ContractManager {
10335
10427
  }
10336
10428
  const tapscriptCache = tapscripts ?? /* @__PURE__ */ new Map();
10337
10429
  return vtxos.map(
10338
- (vtxo) => extendVirtualCoinForContract(chunk6FTHFJAN_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
10430
+ (vtxo) => extendVirtualCoinForContract(chunkKJ5E646Y_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
10339
10431
  );
10340
10432
  }
10341
10433
  /** @inheritdoc */
@@ -10379,14 +10471,14 @@ var ContractManager = class _ContractManager {
10379
10471
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
10380
10472
  const asking = vtxos.filter((vtxo) => {
10381
10473
  const contract = byScript.get(vtxo.script);
10382
- return contract !== void 0 && chunkNPM5YZBC_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10474
+ return contract !== void 0 && chunk2D7F5IU3_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10383
10475
  });
10384
10476
  if (asking.length === 0) return refused;
10385
10477
  const tip = await this.currentChainTip();
10386
10478
  const walletKey = await walletPubKey?.();
10387
10479
  for (const vtxo of asking) {
10388
10480
  const contract = byScript.get(vtxo.script);
10389
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
10481
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
10390
10482
  if (!handler?.assertSpendableNow) continue;
10391
10483
  const context = {
10392
10484
  collaborative: true,
@@ -10401,7 +10493,7 @@ var ContractManager = class _ContractManager {
10401
10493
  // the next handler to answer a CSV question would meet a
10402
10494
  // TypeError instead of a `false`. Carry the coin only when it
10403
10495
  // really is one.
10404
- vtxo: chunk6FTHFJAN_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10496
+ vtxo: chunkKJ5E646Y_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10405
10497
  };
10406
10498
  try {
10407
10499
  await handler.assertSpendableNow(
@@ -10557,7 +10649,7 @@ var ContractManager = class _ContractManager {
10557
10649
  const { contractScript, collaborative = true, walletPubKey, vtxo } = options;
10558
10650
  const [contract] = await this.getContracts({ script: contractScript });
10559
10651
  if (!contract) return [];
10560
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
10652
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
10561
10653
  if (!handler) return [];
10562
10654
  const script = handler.createScript(contract.params);
10563
10655
  const tip = await this.currentChainTip();
@@ -10585,7 +10677,7 @@ var ContractManager = class _ContractManager {
10585
10677
  const { contractScript, collaborative = true, walletPubKey } = options;
10586
10678
  const [contract] = await this.getContracts({ script: contractScript });
10587
10679
  if (!contract) return [];
10588
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
10680
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
10589
10681
  if (!handler) return [];
10590
10682
  const script = handler.createScript(contract.params);
10591
10683
  const context = {
@@ -10641,7 +10733,7 @@ var ContractManager = class _ContractManager {
10641
10733
  }
10642
10734
  async refreshOutpoints(outpoints) {
10643
10735
  if (outpoints.length === 0) return;
10644
- const { vtxos } = await chunk6FTHFJAN_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10736
+ const { vtxos } = await chunkKJ5E646Y_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10645
10737
  outpoints
10646
10738
  });
10647
10739
  if (vtxos.length === 0) return;
@@ -10737,7 +10829,7 @@ var ContractManager = class _ContractManager {
10737
10829
  break;
10738
10830
  }
10739
10831
  } catch (err) {
10740
- if (!chunk6FTHFJAN_cjs.isRetryableProviderError(err)) throw err;
10832
+ if (!chunkKJ5E646Y_cjs.isRetryableProviderError(err)) throw err;
10741
10833
  this.markSyncDegraded(err);
10742
10834
  }
10743
10835
  this.emitEvent(event);
@@ -10828,7 +10920,7 @@ var ContractManager = class _ContractManager {
10828
10920
  */
10829
10921
  async reconcilePendingFrontier(contracts) {
10830
10922
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
10831
- const vtxos = await chunk6FTHFJAN_cjs.getAllNormalizedVtxos(
10923
+ const vtxos = await chunkKJ5E646Y_cjs.getAllNormalizedVtxos(
10832
10924
  this.config.indexerProvider,
10833
10925
  contracts.map((c) => c.script),
10834
10926
  { pendingOnly: true }
@@ -10911,7 +11003,7 @@ var ContractManager = class _ContractManager {
10911
11003
  }
10912
11004
  return result;
10913
11005
  }
10914
- async fetchContractVtxosBulk(contracts, pageSize = chunk6FTHFJAN_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
11006
+ async fetchContractVtxosBulk(contracts, pageSize = chunkKJ5E646Y_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10915
11007
  if (contracts.length === 0) {
10916
11008
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
10917
11009
  }
@@ -10927,7 +11019,7 @@ var ContractManager = class _ContractManager {
10927
11019
  before: syncWindow.before
10928
11020
  }
10929
11021
  } : {};
10930
- const vtxos = await chunk6FTHFJAN_cjs.getAllNormalizedVtxos(
11022
+ const vtxos = await chunkKJ5E646Y_cjs.getAllNormalizedVtxos(
10931
11023
  this.config.indexerProvider,
10932
11024
  contracts.map((c) => c.script),
10933
11025
  { ...windowOpts, pageSize }
@@ -11072,7 +11164,7 @@ var deserializeTapLeaf = (t) => {
11072
11164
  const s = base.hex.decode(t.s);
11073
11165
  return [cb, s];
11074
11166
  };
11075
- var deserializeVtxo = (o) => chunk6FTHFJAN_cjs.normalizeVtxo({
11167
+ var deserializeVtxo = (o) => chunkKJ5E646Y_cjs.normalizeVtxo({
11076
11168
  ...o,
11077
11169
  createdAt: new Date(o.createdAt),
11078
11170
  tapTree: base.hex.decode(o.tapTree),
@@ -11895,7 +11987,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11895
11987
  */
11896
11988
  materializeDescriptorAt(index) {
11897
11989
  const descriptor = this.identity.descriptor;
11898
- const network = chunkNPM5YZBC_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11990
+ const network = chunk2D7F5IU3_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11899
11991
  const expansion = descriptorsScure.expand({ descriptor, network, index });
11900
11992
  const keyInfo = expansion.expansionMap?.["@0"];
11901
11993
  if (!keyInfo?.keyExpression) {
@@ -12043,7 +12135,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
12043
12135
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
12044
12136
  if (!provider) return void 0;
12045
12137
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
12046
- const expectedContractType = setup.offchainTapscript instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script ? "delegate" : "default";
12138
+ const expectedContractType = setup.offchainTapscript instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script ? "delegate" : "default";
12047
12139
  const factoryOpts = {
12048
12140
  walletRepository: setup.walletRepository,
12049
12141
  contractRepository: setup.contractRepository,
@@ -12244,7 +12336,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
12244
12336
  };
12245
12337
  function deriveLeafPubkey(descriptor) {
12246
12338
  try {
12247
- return chunkNPM5YZBC_cjs.deriveDescriptorLeafPubKey(descriptor);
12339
+ return chunk2D7F5IU3_cjs.deriveDescriptorLeafPubKey(descriptor);
12248
12340
  } catch (e) {
12249
12341
  throw new NonRangeableDescriptorError(
12250
12342
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -12256,7 +12348,7 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12256
12348
  const pubKey = deriveLeafPubkey(descriptor);
12257
12349
  const tapscript = rebuildTapscript(current, pubKey);
12258
12350
  const serverPubKey = tapscript.options.serverPubKey;
12259
- const csvTimelock = chunk6FTHFJAN_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12351
+ const csvTimelock = chunkKJ5E646Y_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12260
12352
  const base$1 = {
12261
12353
  script: base.hex.encode(tapscript.pkScript),
12262
12354
  address: tapscript.address(hrp, serverPubKey).encode(),
@@ -12267,11 +12359,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12267
12359
  // index-0 key. Without it, spends produce unsigned PSBTs that the
12268
12360
  // server rejects with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
12269
12361
  metadata: {
12270
- ...tagSource && { source: chunkNPM5YZBC_cjs.WALLET_RECEIVE_SOURCE },
12362
+ ...tagSource && { source: chunk2D7F5IU3_cjs.WALLET_RECEIVE_SOURCE },
12271
12363
  signingDescriptor: descriptor
12272
12364
  }
12273
12365
  };
12274
- const params = tapscript instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script ? {
12366
+ const params = tapscript instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script ? {
12275
12367
  ...base$1,
12276
12368
  type: "delegate",
12277
12369
  params: {
@@ -12292,10 +12384,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12292
12384
  return { tapscript, params };
12293
12385
  }
12294
12386
  function rebuildTapscript(current, pubKey) {
12295
- if (current instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script) {
12296
- return new chunkNPM5YZBC_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12387
+ if (current instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script) {
12388
+ return new chunk2D7F5IU3_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12297
12389
  }
12298
- return new chunkNPM5YZBC_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12390
+ return new chunk2D7F5IU3_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12299
12391
  }
12300
12392
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
12301
12393
  const candidates = await contractRepository.getContracts({
@@ -12304,7 +12396,7 @@ async function pickActiveReceive(contractRepository, serverPubKey, expectedType)
12304
12396
  });
12305
12397
  const serverPubKeyHex = base.hex.encode(serverPubKey);
12306
12398
  const matching = candidates.filter(
12307
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkNPM5YZBC_cjs.WALLET_RECEIVE_SOURCE
12399
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk2D7F5IU3_cjs.WALLET_RECEIVE_SOURCE
12308
12400
  ).sort((a, b) => {
12309
12401
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12310
12402
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12360,7 +12452,7 @@ function computeOffchainBalance(vtxos, caps) {
12360
12452
  }
12361
12453
  };
12362
12454
  for (const vtxo of vtxos) {
12363
- if (chunk6FTHFJAN_cjs.hasTerminalSpend(vtxo)) continue;
12455
+ if (chunkKJ5E646Y_cjs.hasTerminalSpend(vtxo)) continue;
12364
12456
  addAssets(owned, vtxo);
12365
12457
  if (vtxo.isUnrolled) {
12366
12458
  unrolled += vtxo.value;
@@ -12370,11 +12462,11 @@ function computeOffchainBalance(vtxos, caps) {
12370
12462
  pendingRecovery += vtxo.value;
12371
12463
  continue;
12372
12464
  }
12373
- if (chunk6FTHFJAN_cjs.canRecoverOnchain(vtxo, now)) {
12465
+ if (chunkKJ5E646Y_cjs.canRecoverOnchain(vtxo, now)) {
12374
12466
  recoverable += vtxo.value;
12375
12467
  continue;
12376
12468
  }
12377
- if (!chunk6FTHFJAN_cjs.canSpendOffchain(vtxo, now)) continue;
12469
+ if (!chunkKJ5E646Y_cjs.canSpendOffchain(vtxo, now)) continue;
12378
12470
  if (vtxo.isPreconfirmed) {
12379
12471
  preconfirmed += vtxo.value;
12380
12472
  } else {
@@ -12544,12 +12636,12 @@ var InputSignerRouter = class {
12544
12636
  };
12545
12637
 
12546
12638
  // src/wallet/wallet.ts
12547
- var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunk6FTHFJAN_cjs.DEFAULT_ARKADE_SERVER_URL;
12639
+ var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || chunkKJ5E646Y_cjs.DEFAULT_ARKADE_SERVER_URL;
12548
12640
  function intentProofJobs(coins) {
12549
12641
  if (coins.length === 0) return [];
12550
12642
  const coinJobs = coins.map((coin, i) => ({
12551
12643
  index: i + 1,
12552
- lookupScript: chunk6FTHFJAN_cjs.VtxoScript.decode(coin.tapTree).pkScript
12644
+ lookupScript: chunkKJ5E646Y_cjs.VtxoScript.decode(coin.tapTree).pkScript
12553
12645
  }));
12554
12646
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
12555
12647
  }
@@ -12581,7 +12673,7 @@ function dedupeTimelocks(timelocks) {
12581
12673
  const seen = /* @__PURE__ */ new Set();
12582
12674
  const deduped = [];
12583
12675
  for (const timelock of timelocks) {
12584
- const sequence = chunk6FTHFJAN_cjs.timelockToSequence(timelock).toString();
12676
+ const sequence = chunkKJ5E646Y_cjs.timelockToSequence(timelock).toString();
12585
12677
  if (seen.has(sequence)) continue;
12586
12678
  seen.add(sequence);
12587
12679
  deduped.push(timelock);
@@ -12598,7 +12690,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
12598
12690
  state: "active"
12599
12691
  });
12600
12692
  const newest = candidates.filter(
12601
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkNPM5YZBC_cjs.WALLET_RECEIVE_SOURCE
12693
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk2D7F5IU3_cjs.WALLET_RECEIVE_SOURCE
12602
12694
  ).sort((a, b) => {
12603
12695
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12604
12696
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12606,7 +12698,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
12606
12698
  if (!newest?.params.pubKey) return baseline;
12607
12699
  try {
12608
12700
  const pubKey = base.hex.decode(newest.params.pubKey);
12609
- return new chunkNPM5YZBC_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12701
+ return new chunk2D7F5IU3_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12610
12702
  } catch (e) {
12611
12703
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
12612
12704
  return baseline;
@@ -12625,10 +12717,10 @@ function filterSnapshotVtxos(snapshot, filter, pendingSpendOutpoints) {
12625
12717
  if (vtxo.isUnrolled) {
12626
12718
  return !!f.withUnrolled;
12627
12719
  }
12628
- if (chunk6FTHFJAN_cjs.hasTerminalSpend(vtxo)) {
12720
+ if (chunkKJ5E646Y_cjs.hasTerminalSpend(vtxo)) {
12629
12721
  return false;
12630
12722
  }
12631
- if (!f.withRecoverable && chunk6FTHFJAN_cjs.canRecoverOnchain(vtxo, now)) {
12723
+ if (!f.withRecoverable && chunkKJ5E646Y_cjs.canRecoverOnchain(vtxo, now)) {
12632
12724
  return false;
12633
12725
  }
12634
12726
  return true;
@@ -12968,7 +13060,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12968
13060
  */
12969
13061
  static async setupWalletConfig(config, pubKey) {
12970
13062
  const arkadeServerUrl = getArkadeServerUrl(config);
12971
- const arkProvider = config.arkProvider || new chunk6FTHFJAN_cjs.RestArkProvider(arkadeServerUrl);
13063
+ const arkProvider = config.arkProvider || new chunkKJ5E646Y_cjs.RestArkProvider(arkadeServerUrl);
12972
13064
  let indexerProvider = config.indexerProvider;
12973
13065
  if (!indexerProvider) {
12974
13066
  let indexerUrl = config.indexerUrl;
@@ -12985,7 +13077,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12985
13077
  indexerUrl = arkadeServerUrl;
12986
13078
  }
12987
13079
  }
12988
- indexerProvider = new chunk4C5PMGBB_cjs.RestIndexerProvider(indexerUrl);
13080
+ indexerProvider = new chunkD5DLGVN4_cjs.RestIndexerProvider(indexerUrl);
12989
13081
  }
12990
13082
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
12991
13083
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -12994,7 +13086,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12994
13086
  source: serverInfoSource,
12995
13087
  lastOnlineAt: serverInfoLastOnlineAt
12996
13088
  } = await resolveArkInfo(arkProvider, walletRepository);
12997
- const network = chunk6FTHFJAN_cjs.getNetwork(info.network);
13089
+ const network = chunkKJ5E646Y_cjs.getNetwork(info.network);
12998
13090
  if ("descriptor" in config.identity) {
12999
13091
  const descriptor = config.identity.descriptor;
13000
13092
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -13034,18 +13126,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
13034
13126
  value: info.boardingExitDelay,
13035
13127
  type: info.boardingExitDelay < 512n ? "blocks" : "seconds"
13036
13128
  };
13037
- const serverPubKey = chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
13038
- const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
13129
+ const serverPubKey = chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
13130
+ const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
13039
13131
  const offchainOptions = {
13040
13132
  pubKey,
13041
13133
  serverPubKey,
13042
13134
  csvTimelock: exitTimelock
13043
13135
  };
13044
- const offchainTapscript = !delegatePubKey ? new chunkNPM5YZBC_cjs.DefaultVtxo.Script(offchainOptions) : new chunkNPM5YZBC_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
13045
- const boardingTapscript = chunkNPM5YZBC_cjs.BoardingContractHandler.createScript({
13136
+ const offchainTapscript = !delegatePubKey ? new chunk2D7F5IU3_cjs.DefaultVtxo.Script(offchainOptions) : new chunk2D7F5IU3_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
13137
+ const boardingTapscript = chunk2D7F5IU3_cjs.BoardingContractHandler.createScript({
13046
13138
  pubKey: base.hex.encode(pubKey),
13047
13139
  serverPubKey: base.hex.encode(serverPubKey),
13048
- csvTimelock: chunk6FTHFJAN_cjs.timelockToSequence(boardingTimelock).toString()
13140
+ csvTimelock: chunkKJ5E646Y_cjs.timelockToSequence(boardingTimelock).toString()
13049
13141
  });
13050
13142
  return {
13051
13143
  arkProvider,
@@ -13211,7 +13303,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13211
13303
  if (!filter?.withUnrolled) {
13212
13304
  logExcludedVtxos(
13213
13305
  "getSpendableVtxos",
13214
- snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunk6FTHFJAN_cjs.hasTerminalSpend(vtxo)),
13306
+ snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkKJ5E646Y_cjs.hasTerminalSpend(vtxo)),
13215
13307
  [() => UNROLLED_REASON]
13216
13308
  );
13217
13309
  }
@@ -13355,7 +13447,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13355
13447
  this.getBoardingTxs()
13356
13448
  ]);
13357
13449
  const allVtxos = snapshot.flatMap((_) => _.vtxos);
13358
- const resolveTxCreatedAt = (txids) => chunk6FTHFJAN_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13450
+ const resolveTxCreatedAt = (txids) => chunkKJ5E646Y_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13359
13451
  return buildTransactionHistory(
13360
13452
  allVtxos,
13361
13453
  boardingTxs,
@@ -13450,7 +13542,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13450
13542
  },
13451
13543
  isUnrolled: true,
13452
13544
  ...boardingFacts,
13453
- virtualStatus: chunk6FTHFJAN_cjs.toVirtualStatus(boardingFacts),
13545
+ virtualStatus: chunkKJ5E646Y_cjs.toVirtualStatus(boardingFacts),
13454
13546
  spentBy: "",
13455
13547
  createdAt: tx.status.confirmed ? new Date(tx.status.block_time * 1e3) : /* @__PURE__ */ new Date(0),
13456
13548
  script: scriptHex
@@ -13506,9 +13598,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13506
13598
  async getBoardingTapscripts(allowedSigners) {
13507
13599
  const byScript = /* @__PURE__ */ new Map();
13508
13600
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
13509
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkNPM5YZBC_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13601
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunk2D7F5IU3_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13510
13602
  add(
13511
- new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
13603
+ new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
13512
13604
  pubKey: await this.identity.xOnlyPublicKey(),
13513
13605
  serverPubKey: this.boardingTapscript.options.serverPubKey,
13514
13606
  csvTimelock: boardingCsv
@@ -13523,7 +13615,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13523
13615
  for (const c of boardingContracts) {
13524
13616
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
13525
13617
  try {
13526
- add(chunkNPM5YZBC_cjs.BoardingContractHandler.createScript(c.params));
13618
+ add(chunk2D7F5IU3_cjs.BoardingContractHandler.createScript(c.params));
13527
13619
  } catch (e) {
13528
13620
  console.warn("Skipping malformed boarding contract", c.script, e);
13529
13621
  }
@@ -13561,7 +13653,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13561
13653
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
13562
13654
  // not the wallet's current boarding timelock, which a signer
13563
13655
  // rotation may have changed.
13564
- csvTimelock: chunk6FTHFJAN_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
13656
+ csvTimelock: chunkKJ5E646Y_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
13565
13657
  coins: utxos
13566
13658
  });
13567
13659
  }
@@ -13694,7 +13786,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13694
13786
  /** Fetch Arkade transaction ids that are still pending final settlement. */
13695
13787
  async fetchPendingTxs() {
13696
13788
  const scripts = await this.getWalletScripts();
13697
- const vtxos = await chunk6FTHFJAN_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
13789
+ const vtxos = await chunkKJ5E646Y_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
13698
13790
  return vtxos.filter(
13699
13791
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
13700
13792
  ).map((_) => _.arkTxId);
@@ -13725,7 +13817,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13725
13817
  });
13726
13818
  for (const contract of contracts) {
13727
13819
  if (map.has(contract.script)) continue;
13728
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
13820
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
13729
13821
  if (handler) {
13730
13822
  const script = handler.createScript(contract.params);
13731
13823
  map.set(contract.script, script);
@@ -13837,7 +13929,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13837
13929
  }
13838
13930
  });
13839
13931
  const baselinePubkey = await this.identity.xOnlyPublicKey();
13840
- const delegatePubKey = this.offchainTapscript instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13932
+ const delegatePubKey = this.offchainTapscript instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13841
13933
  const baselineSigners = [
13842
13934
  this.offchainTapscript.options.serverPubKey,
13843
13935
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
@@ -13845,8 +13937,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
13845
13937
  const seenBaselineScripts = /* @__PURE__ */ new Set();
13846
13938
  for (const serverPubKey of baselineSigners) {
13847
13939
  for (const csvTimelock of this.walletContractTimelocks) {
13848
- const csvTimelockStr = chunk6FTHFJAN_cjs.timelockToSequence(csvTimelock).toString();
13849
- const defaultScript = new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
13940
+ const csvTimelockStr = chunkKJ5E646Y_cjs.timelockToSequence(csvTimelock).toString();
13941
+ const defaultScript = new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
13850
13942
  pubKey: baselinePubkey,
13851
13943
  serverPubKey,
13852
13944
  csvTimelock
@@ -13867,7 +13959,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13867
13959
  });
13868
13960
  }
13869
13961
  if (delegatePubKey) {
13870
- const delegateScript = new chunkNPM5YZBC_cjs.DelegateVtxo.Script({
13962
+ const delegateScript = new chunk2D7F5IU3_cjs.DelegateVtxo.Script({
13871
13963
  pubKey: baselinePubkey,
13872
13964
  serverPubKey,
13873
13965
  delegatePubKey,
@@ -13891,9 +13983,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13891
13983
  }
13892
13984
  }
13893
13985
  }
13894
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkNPM5YZBC_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13986
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunk2D7F5IU3_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13895
13987
  for (const serverPubKey of baselineSigners) {
13896
- const baselineBoarding = new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
13988
+ const baselineBoarding = new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
13897
13989
  pubKey: baselinePubkey,
13898
13990
  serverPubKey,
13899
13991
  csvTimelock: boardingCsvTimelock
@@ -13906,7 +13998,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13906
13998
  params: {
13907
13999
  pubKey: base.hex.encode(baselineBoarding.options.pubKey),
13908
14000
  serverPubKey: base.hex.encode(serverPubKey),
13909
- csvTimelock: chunk6FTHFJAN_cjs.timelockToSequence(boardingCsvTimelock).toString()
14001
+ csvTimelock: chunkKJ5E646Y_cjs.timelockToSequence(boardingCsvTimelock).toString()
13910
14002
  },
13911
14003
  script: boardingScriptHex,
13912
14004
  address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
@@ -14106,7 +14198,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14106
14198
  serverPubKey: this.offchainTapscript.options.serverPubKey,
14107
14199
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
14108
14200
  csvTimelocks: this.walletContractTimelocks,
14109
- delegatePubKey: this.offchainTapscript instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
14201
+ delegatePubKey: this.offchainTapscript instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
14110
14202
  };
14111
14203
  }
14112
14204
  _signerRouter;
@@ -14351,7 +14443,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14351
14443
  const [row] = await manager.getContracts({ script: base.hex.encode(display.pkScript) });
14352
14444
  const persisted = row?.metadata?.signingDescriptor;
14353
14445
  if (typeof persisted === "string") return persisted;
14354
- return chunkNPM5YZBC_cjs.identityDescriptor(this.identity);
14446
+ return chunk2D7F5IU3_cjs.identityDescriptor(this.identity);
14355
14447
  }
14356
14448
  /**
14357
14449
  * Build, persist and shape one address of `type` owned by `descriptor` —
@@ -14367,7 +14459,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14367
14459
  async mintAddress(manager, type, descriptor, tagSource, allocated) {
14368
14460
  if (type === "boarding") {
14369
14461
  const built2 = this.buildBoardingContract(
14370
- chunkNPM5YZBC_cjs.deriveDescriptorLeafPubKey(descriptor),
14462
+ chunk2D7F5IU3_cjs.deriveDescriptorLeafPubKey(descriptor),
14371
14463
  descriptor,
14372
14464
  tagSource
14373
14465
  );
@@ -14412,11 +14504,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14412
14504
  * {@link buildReceiveContract}.
14413
14505
  */
14414
14506
  buildBoardingContract(pubKey, descriptor, tagSource) {
14415
- const tapscript = new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
14507
+ const tapscript = new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
14416
14508
  ...this._boardingTapscript.options,
14417
14509
  pubKey
14418
14510
  });
14419
- const csvTimelock = tapscript.options.csvTimelock ?? chunkNPM5YZBC_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14511
+ const csvTimelock = tapscript.options.csvTimelock ?? chunk2D7F5IU3_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14420
14512
  return {
14421
14513
  tapscript,
14422
14514
  params: {
@@ -14424,13 +14516,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14424
14516
  params: {
14425
14517
  pubKey: base.hex.encode(pubKey),
14426
14518
  serverPubKey: base.hex.encode(tapscript.options.serverPubKey),
14427
- csvTimelock: chunk6FTHFJAN_cjs.timelockToSequence(csvTimelock).toString()
14519
+ csvTimelock: chunkKJ5E646Y_cjs.timelockToSequence(csvTimelock).toString()
14428
14520
  },
14429
14521
  script: base.hex.encode(tapscript.pkScript),
14430
14522
  address: tapscript.address(this.network.hrp, this.arkServerPublicKey).encode(),
14431
14523
  state: "active",
14432
14524
  metadata: {
14433
- ...tagSource && { source: chunkNPM5YZBC_cjs.WALLET_RECEIVE_SOURCE },
14525
+ ...tagSource && { source: chunk2D7F5IU3_cjs.WALLET_RECEIVE_SOURCE },
14434
14526
  signingDescriptor: descriptor
14435
14527
  }
14436
14528
  }
@@ -14459,7 +14551,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14459
14551
  if (this._descriptorProvider instanceof HDDescriptorProvider) {
14460
14552
  return (await this.getContractManager()).getNextSigningDescriptor();
14461
14553
  }
14462
- return chunkNPM5YZBC_cjs.identityDescriptor(this.identity);
14554
+ return chunk2D7F5IU3_cjs.identityDescriptor(this.identity);
14463
14555
  }
14464
14556
  /**
14465
14557
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -14555,7 +14647,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14555
14647
  * the stable public API.
14556
14648
  */
14557
14649
  async rotateServerSigner(newServerPubKey, checkpointTapscript) {
14558
- const xonly = chunkNPM5YZBC_cjs.toXOnly(newServerPubKey, "ark signer key");
14650
+ const xonly = chunk2D7F5IU3_cjs.toXOnly(newServerPubKey, "ark signer key");
14559
14651
  const newServerUnrollScript = assertValidServerUnrollScript(
14560
14652
  checkpointTapscript,
14561
14653
  resolveCheckpointExitDelayPolicy(this.network, this.checkpointExitDelayPolicy)
@@ -14584,21 +14676,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14584
14676
  const [currentBoardingRow] = await manager.getContracts({
14585
14677
  script: currentBoardingScript
14586
14678
  });
14587
- const newOffchain = this.offchainTapscript instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script ? new chunkNPM5YZBC_cjs.DelegateVtxo.Script({
14679
+ const newOffchain = this.offchainTapscript instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script ? new chunk2D7F5IU3_cjs.DelegateVtxo.Script({
14588
14680
  ...this.offchainTapscript.options,
14589
14681
  serverPubKey: xonly
14590
- }) : new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
14682
+ }) : new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
14591
14683
  ...this.offchainTapscript.options,
14592
14684
  serverPubKey: xonly
14593
14685
  });
14594
- const newBoarding = new chunkNPM5YZBC_cjs.DefaultVtxo.Script({
14686
+ const newBoarding = new chunk2D7F5IU3_cjs.DefaultVtxo.Script({
14595
14687
  ...this._boardingTapscript.options,
14596
14688
  serverPubKey: xonly
14597
14689
  });
14598
- const offchainCsv = chunk6FTHFJAN_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14690
+ const offchainCsv = chunkKJ5E646Y_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14599
14691
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
14600
14692
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
14601
- if (newOffchain instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script) {
14693
+ if (newOffchain instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script) {
14602
14694
  await manager.createContract({
14603
14695
  type: "delegate",
14604
14696
  params: {
@@ -14626,13 +14718,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14626
14718
  metadata: currentOffchainRow?.metadata
14627
14719
  });
14628
14720
  }
14629
- const boardingCsv = newBoarding.options.csvTimelock ?? chunkNPM5YZBC_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14721
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunk2D7F5IU3_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14630
14722
  await manager.createContract({
14631
14723
  type: "boarding",
14632
14724
  params: {
14633
14725
  pubKey: base.hex.encode(newBoarding.options.pubKey),
14634
14726
  serverPubKey: base.hex.encode(xonly),
14635
- csvTimelock: chunk6FTHFJAN_cjs.timelockToSequence(boardingCsv).toString()
14727
+ csvTimelock: chunkKJ5E646Y_cjs.timelockToSequence(boardingCsv).toString()
14636
14728
  },
14637
14729
  script: base.hex.encode(newBoarding.pkScript),
14638
14730
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -14665,14 +14757,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14665
14757
  _restoreInFlight;
14666
14758
  _addPendingSpends(inputs) {
14667
14759
  for (const input of inputs) {
14668
- if (chunk6FTHFJAN_cjs.isVirtualCoin(input)) {
14760
+ if (chunkKJ5E646Y_cjs.isVirtualCoin(input)) {
14669
14761
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
14670
14762
  }
14671
14763
  }
14672
14764
  }
14673
14765
  _removePendingSpends(inputs) {
14674
14766
  for (const input of inputs) {
14675
- if (chunk6FTHFJAN_cjs.isVirtualCoin(input)) {
14767
+ if (chunkKJ5E646Y_cjs.isVirtualCoin(input)) {
14676
14768
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
14677
14769
  }
14678
14770
  }
@@ -14733,13 +14825,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14733
14825
  const manager = await this.getContractManager();
14734
14826
  const provider = this._descriptorProvider;
14735
14827
  const hd = provider instanceof HDDescriptorProvider;
14736
- const staticDescriptor = hd ? void 0 : await chunkNPM5YZBC_cjs.identityDescriptor(this.identity);
14828
+ const staticDescriptor = hd ? void 0 : await chunk2D7F5IU3_cjs.identityDescriptor(this.identity);
14737
14829
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
14738
- const delegatePubKey = this.offchainTapscript instanceof chunkNPM5YZBC_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14830
+ const delegatePubKey = this.offchainTapscript instanceof chunk2D7F5IU3_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14739
14831
  const arkInfo = await this.arkProvider.getInfo();
14740
- const currentSignerPubKey = chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
14832
+ const currentSignerPubKey = chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
14741
14833
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
14742
- (s) => chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
14834
+ (s) => chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
14743
14835
  );
14744
14836
  const deps = {
14745
14837
  indexerProvider: this.indexerProvider,
@@ -14754,7 +14846,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14754
14846
  csvTimelocks: this.walletContractTimelocks,
14755
14847
  // Boarding-exit CSV so the boarding handler can build its
14756
14848
  // candidate script (distinct from the unilateral-exit matrix).
14757
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkNPM5YZBC_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
14849
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunk2D7F5IU3_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
14758
14850
  delegatePubKey
14759
14851
  };
14760
14852
  const result = await manager.scanContracts({
@@ -14868,7 +14960,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14868
14960
  throw new Error("Invalid configured public key");
14869
14961
  }
14870
14962
  const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
14871
- const forfeitPubkey = chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
14963
+ const forfeitPubkey = chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
14872
14964
  const forfeitAddress = btcSigner.Address(setup.network).decode(setup.info.forfeitAddress);
14873
14965
  const forfeitOutputScript = btcSigner.OutScript.encode(forfeitAddress);
14874
14966
  const checkpointExitDelayOverrides = {
@@ -15017,7 +15109,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15017
15109
  inputs: params.selectedVtxos,
15018
15110
  changeAmount: BigInt(changeAmount)
15019
15111
  };
15020
- const outputAddress = chunk6FTHFJAN_cjs.ArkAddress.decode(params.address);
15112
+ const outputAddress = chunkKJ5E646Y_cjs.ArkAddress.decode(params.address);
15021
15113
  assertRecipientArkAddress(
15022
15114
  params.address,
15023
15115
  outputAddress,
@@ -15083,13 +15175,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15083
15175
  void this.logUngatedInputs("settle({ inputs })", params.inputs);
15084
15176
  }
15085
15177
  const offchainAddress = await this.getAddress();
15086
- const offchainPkScript = chunk6FTHFJAN_cjs.ArkAddress.decode(offchainAddress).pkScript;
15178
+ const offchainPkScript = chunkKJ5E646Y_cjs.ArkAddress.decode(offchainAddress).pkScript;
15087
15179
  const offchainOutputScript = base.hex.encode(offchainPkScript);
15088
15180
  if (!params) {
15089
15181
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
15090
15182
  const estimator = new Estimator(fees.intentFee);
15091
15183
  let amount = 0;
15092
- const exitScript = chunk6FTHFJAN_cjs.CSVMultisigTapscript.decode(
15184
+ const exitScript = chunkKJ5E646Y_cjs.CSVMultisigTapscript.decode(
15093
15185
  base.hex.decode(this.boardingTapscript.exitScript)
15094
15186
  );
15095
15187
  const boardingTimelock = exitScript.params.timelock;
@@ -15118,7 +15210,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15118
15210
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
15119
15211
  break;
15120
15212
  }
15121
- const inputFee = estimator.evalOffchainInput(chunk6FTHFJAN_cjs.toOffchainInputFeeParams(vtxo));
15213
+ const inputFee = estimator.evalOffchainInput(chunkKJ5E646Y_cjs.toOffchainInputFeeParams(vtxo));
15122
15214
  if (inputFee.satoshis >= vtxo.value) {
15123
15215
  continue;
15124
15216
  }
@@ -15165,7 +15257,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15165
15257
  let script;
15166
15258
  let arkAddress;
15167
15259
  try {
15168
- arkAddress = chunk6FTHFJAN_cjs.ArkAddress.decode(output.address);
15260
+ arkAddress = chunkKJ5E646Y_cjs.ArkAddress.decode(output.address);
15169
15261
  } catch {
15170
15262
  arkAddress = void 0;
15171
15263
  }
@@ -15255,7 +15347,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15255
15347
  const abortController = new AbortController();
15256
15348
  let stream;
15257
15349
  let committedTxid;
15258
- const settleInputVtxos = params.inputs.filter(chunk6FTHFJAN_cjs.isVirtualCoin);
15350
+ const settleInputVtxos = params.inputs.filter(chunkKJ5E646Y_cjs.isVirtualCoin);
15259
15351
  const contractManager = await this.getContractManager();
15260
15352
  await contractManager.assertAnnotatable(settleInputVtxos);
15261
15353
  await contractManager.assertSpendableNow?.(
@@ -15367,7 +15459,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15367
15459
  async maybeRotateBoardingAfterBoard(inputs) {
15368
15460
  if (!this._descriptorProvider) return;
15369
15461
  const consumedBoarding = inputs.some(
15370
- (input) => typeof input !== "string" && !chunk6FTHFJAN_cjs.isVirtualCoin(input)
15462
+ (input) => typeof input !== "string" && !chunkKJ5E646Y_cjs.isVirtualCoin(input)
15371
15463
  );
15372
15464
  if (!consumedBoarding) return;
15373
15465
  try {
@@ -15391,7 +15483,8 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15391
15483
  let connectorIndex = 0;
15392
15484
  const connectorsLeaves = connectorsGraph?.leaves() || [];
15393
15485
  for (const input of inputs) {
15394
- if (!chunk6FTHFJAN_cjs.isVirtualCoin(input)) {
15486
+ if (!chunkKJ5E646Y_cjs.isVirtualCoin(input)) {
15487
+ let matched = false;
15395
15488
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
15396
15489
  const settlementInput = settlementPsbt.getInput(i);
15397
15490
  if (!settlementInput.txid || settlementInput.index === void 0) {
@@ -15418,11 +15511,17 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15418
15511
  throw new Error(await this.unsignableBoardingInputError(input, script));
15419
15512
  }
15420
15513
  hasBoardingUtxos = true;
15514
+ matched = true;
15421
15515
  break;
15422
15516
  }
15517
+ if (!matched && !(input instanceof ArkNote)) {
15518
+ throw new Error(
15519
+ `boarding input ${input.txid}:${input.vout} is not an input of the commitment tx`
15520
+ );
15521
+ }
15423
15522
  continue;
15424
15523
  }
15425
- if (chunk6FTHFJAN_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
15524
+ if (chunkKJ5E646Y_cjs.canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
15426
15525
  continue;
15427
15526
  }
15428
15527
  if (connectorsLeaves.length === 0) {
@@ -15450,7 +15549,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15450
15549
  index: input.vout,
15451
15550
  witnessUtxo: {
15452
15551
  amount: BigInt(input.value),
15453
- script: chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).pkScript
15552
+ script: chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).pkScript
15454
15553
  },
15455
15554
  sighashType: btcSigner.SigHash.DEFAULT,
15456
15555
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -15469,7 +15568,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15469
15568
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
15470
15569
  {
15471
15570
  index: 0,
15472
- lookupScript: chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).pkScript
15571
+ lookupScript: chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).pkScript
15473
15572
  }
15474
15573
  ]);
15475
15574
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -15527,7 +15626,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15527
15626
  resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
15528
15627
  );
15529
15628
  await this.arkProvider.confirmRegistration(intentId);
15530
- const sweepTapscript = chunk6FTHFJAN_cjs.CSVMultisigTapscript.encode({
15629
+ const sweepTapscript = chunkKJ5E646Y_cjs.CSVMultisigTapscript.encode({
15531
15630
  timelock,
15532
15631
  pubkeys: [this.forfeitPubkey]
15533
15632
  }).script;
@@ -15542,10 +15641,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15542
15641
  throw new Error("Sweep tap tree root not set");
15543
15642
  }
15544
15643
  const xOnlyPublicKeys = event.cosignersPublicKeys.map(
15545
- (k) => base.hex.encode(chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15644
+ (k) => base.hex.encode(chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15546
15645
  );
15547
15646
  const signerPublicKey = await session.getPublicKey();
15548
- const xonlySignerPublicKey = chunkNPM5YZBC_cjs.toXOnly(signerPublicKey, "signer key");
15647
+ const xonlySignerPublicKey = chunk2D7F5IU3_cjs.toXOnly(signerPublicKey, "signer key");
15549
15648
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
15550
15649
  return { skip: true };
15551
15650
  }
@@ -15635,9 +15734,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15635
15734
  ...existing ?? {},
15636
15735
  intentTxId,
15637
15736
  registerProof: intent.proof,
15638
- registerProofMessage: chunk6FTHFJAN_cjs.Intent.encodeMessage(intent.message),
15737
+ registerProofMessage: chunkKJ5E646Y_cjs.Intent.encodeMessage(intent.message),
15639
15738
  deleteProof: deleteIntent.proof,
15640
- deleteProofMessage: chunk6FTHFJAN_cjs.Intent.encodeMessage(deleteIntent.message),
15739
+ deleteProofMessage: chunkKJ5E646Y_cjs.Intent.encodeMessage(deleteIntent.message),
15641
15740
  intentVtxos: inputs.map((i) => ({
15642
15741
  txid: i.txid,
15643
15742
  vout: i.vout
@@ -15669,7 +15768,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15669
15768
  try {
15670
15769
  return await this.arkProvider.registerIntent(intent);
15671
15770
  } catch (error) {
15672
- if (error instanceof chunk6FTHFJAN_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
15771
+ if (error instanceof chunkKJ5E646Y_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
15673
15772
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
15674
15773
  await this.arkProvider.deleteIntent(deleteIntent);
15675
15774
  return this.arkProvider.registerIntent(intent);
@@ -15685,7 +15784,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15685
15784
  expire_at: 0,
15686
15785
  cosigners_public_keys: cosignerPubKeys
15687
15786
  };
15688
- const proof = chunk6FTHFJAN_cjs.Intent.create(message, coins, outputs);
15787
+ const proof = chunkKJ5E646Y_cjs.Intent.create(message, coins, outputs);
15689
15788
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15690
15789
  return {
15691
15790
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15697,7 +15796,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15697
15796
  type: "delete",
15698
15797
  expire_at: 0
15699
15798
  };
15700
- const proof = chunk6FTHFJAN_cjs.Intent.create(message, coins, []);
15799
+ const proof = chunkKJ5E646Y_cjs.Intent.create(message, coins, []);
15701
15800
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15702
15801
  return {
15703
15802
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15709,7 +15808,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15709
15808
  type: "get-pending-tx",
15710
15809
  expire_at: 0
15711
15810
  };
15712
- const proof = chunk6FTHFJAN_cjs.Intent.create(message, coins, []);
15811
+ const proof = chunkKJ5E646Y_cjs.Intent.create(message, coins, []);
15713
15812
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15714
15813
  return {
15715
15814
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15730,7 +15829,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15730
15829
  if (!vtxos || vtxos.length === 0) {
15731
15830
  const scriptMap = await this.getScriptMap();
15732
15831
  const allExtended = [];
15733
- const fetchedVtxos = await chunk6FTHFJAN_cjs.getAllNormalizedVtxos(this.indexerProvider, [
15832
+ const fetchedVtxos = await chunkKJ5E646Y_cjs.getAllNormalizedVtxos(this.indexerProvider, [
15734
15833
  ...scriptMap.keys()
15735
15834
  ]);
15736
15835
  for (const vtxo of fetchedVtxos) {
@@ -15774,7 +15873,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15774
15873
  try {
15775
15874
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((c) => {
15776
15875
  const tx = btcSigner.Transaction.fromPSBT(base.base64.decode(c));
15777
- chunk6FTHFJAN_cjs.assertAllowedSighashTypes(tx);
15876
+ chunkKJ5E646Y_cjs.assertAllowedSighashTypes(tx);
15778
15877
  return tx;
15779
15878
  });
15780
15879
  assertCheckpointsMatchInputs(
@@ -15846,11 +15945,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15846
15945
  * against the current key alone would leave it pending forever.
15847
15946
  */
15848
15947
  checkpointUnrollCandidates(info) {
15849
- const current = chunk6FTHFJAN_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
15948
+ const current = chunkKJ5E646Y_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
15850
15949
  const candidates = [this._serverUnrollScript, current];
15851
15950
  for (const deprecated of signerSetFromInfo(info).deprecated.keys()) {
15852
15951
  candidates.push(
15853
- chunk6FTHFJAN_cjs.CSVMultisigTapscript.encode({
15952
+ chunkKJ5E646Y_cjs.CSVMultisigTapscript.encode({
15854
15953
  ...current.params,
15855
15954
  pubkeys: [base.hex.decode(deprecated)]
15856
15955
  })
@@ -15941,7 +16040,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15941
16040
  if (vtxos.length === 0) {
15942
16041
  throw new Error("No VTXOs found for this arkadeCash");
15943
16042
  }
15944
- const myPkScript = chunk6FTHFJAN_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
16043
+ const myPkScript = chunkKJ5E646Y_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
15945
16044
  let { spendable, unclaimed } = this.classifyCashVtxos(vtxos);
15946
16045
  let swept = 0;
15947
16046
  const drainable = vtxos.filter(
@@ -16017,7 +16116,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16017
16116
  const spendable = [];
16018
16117
  const unclaimed = [];
16019
16118
  for (const vtxo of vtxos) {
16020
- if (chunk6FTHFJAN_cjs.hasTerminalSpend(vtxo)) {
16119
+ if (chunkKJ5E646Y_cjs.hasTerminalSpend(vtxo)) {
16021
16120
  unclaimed.push(cashReport(vtxo, "already-spent"));
16022
16121
  } else if (vtxo.isUnrolled) {
16023
16122
  unclaimed.push(cashReport(vtxo, "exited"));
@@ -16039,7 +16138,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16039
16138
  const all = [];
16040
16139
  const seen = /* @__PURE__ */ new Set();
16041
16140
  for (let pageIndex = 0; ; pageIndex++) {
16042
- const { vtxos, page } = await chunk6FTHFJAN_cjs.getNormalizedVtxos(this.indexerProvider, {
16141
+ const { vtxos, page } = await chunkKJ5E646Y_cjs.getNormalizedVtxos(this.indexerProvider, {
16043
16142
  scripts,
16044
16143
  pageIndex,
16045
16144
  pageSize
@@ -16086,7 +16185,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16086
16185
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
16087
16186
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
16088
16187
  const message = { type: "get-pending-tx", expire_at: 0 };
16089
- const proof = chunk6FTHFJAN_cjs.Intent.create(message, batch, []);
16188
+ const proof = chunkKJ5E646Y_cjs.Intent.create(message, batch, []);
16090
16189
  const signedProof = await identity.sign(
16091
16190
  proof,
16092
16191
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -16108,7 +16207,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16108
16207
  try {
16109
16208
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((checkpoint) => {
16110
16209
  const tx = btcSigner.Transaction.fromPSBT(base.base64.decode(checkpoint));
16111
- chunk6FTHFJAN_cjs.assertAllowedSighashTypes(tx);
16210
+ chunkKJ5E646Y_cjs.assertAllowedSighashTypes(tx);
16112
16211
  return tx;
16113
16212
  });
16114
16213
  assertCheckpointsMatchInputs(
@@ -16307,7 +16406,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16307
16406
  script: recipient.script,
16308
16407
  amount: BigInt(recipient.amount),
16309
16408
  // Already checked against the recipient address in `validateRecipients`.
16310
- ...recipient.tapTree ? { tapTree: chunk6FTHFJAN_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
16409
+ ...recipient.tapTree ? { tapTree: chunkKJ5E646Y_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
16311
16410
  }));
16312
16411
  const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
16313
16412
  let changeAmount = totalBtcSelected - totalBtcOutput;
@@ -16451,10 +16550,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16451
16550
  const serverPubKey = this.arkServerPublicKey;
16452
16551
  const serverUnrollScript = this.serverUnrollScript;
16453
16552
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
16454
- const normalizedInputs = inputs.map(chunk6FTHFJAN_cjs.normalizeVtxo);
16455
- const at = now ?? await chunk6FTHFJAN_cjs.resolveTimeHeight(this.onchainProvider);
16553
+ const normalizedInputs = inputs.map(chunkKJ5E646Y_cjs.normalizeVtxo);
16554
+ const at = now ?? await chunkKJ5E646Y_cjs.resolveTimeHeight(this.onchainProvider);
16456
16555
  for (const input of normalizedInputs) {
16457
- if (!chunk6FTHFJAN_cjs.canSpendOffchain(input, at)) {
16556
+ if (!chunkKJ5E646Y_cjs.canSpendOffchain(input, at)) {
16458
16557
  throw new Error(
16459
16558
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
16460
16559
  );
@@ -16524,7 +16623,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16524
16623
  );
16525
16624
  const arkTxJobs = inputs.map((input, index) => ({
16526
16625
  index,
16527
- lookupScript: chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).pkScript
16626
+ lookupScript: chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).pkScript
16528
16627
  }));
16529
16628
  const identity = this.identity;
16530
16629
  const signer = {
@@ -16560,18 +16659,33 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16560
16659
  this.inputSigningJobsFromWitnessUtxos(checkpoint)
16561
16660
  )
16562
16661
  };
16563
- return submitOffchainTx(this.arkProvider, offchainTx, signer, {
16564
- // Mark pending before submitting — if we crash between submit and
16565
- // finalize, the next init recovers via finalizePendingTxs.
16566
- beforeSubmit: () => this.setPendingTxFlag(true),
16567
- afterFinalize: async () => {
16568
- try {
16569
- await this.setPendingTxFlag(false);
16570
- } catch (error) {
16571
- console.error("Failed to clear pending tx flag:", error);
16662
+ return submitOffchainTx(
16663
+ this.arkProvider,
16664
+ offchainTx,
16665
+ signer,
16666
+ {
16667
+ // Mark pending before submitting — if we crash between submit and
16668
+ // finalize, the next init recovers via finalizePendingTxs.
16669
+ beforeSubmit: () => this.setPendingTxFlag(true),
16670
+ afterFinalize: async () => {
16671
+ try {
16672
+ await this.setPendingTxFlag(false);
16673
+ } catch (error) {
16674
+ console.error("Failed to clear pending tx flag:", error);
16675
+ }
16676
+ }
16677
+ },
16678
+ {
16679
+ // Deprecated keys too: a vtxo built before a rotation is still
16680
+ // spent under the signer its leaf names.
16681
+ verifyServerSignatures: {
16682
+ serverPubkey: this._arkServerPublicKey,
16683
+ deprecatedServerPubkeys: [...this._deprecatedSigners.keys()].map(
16684
+ (h) => base.hex.decode(h)
16685
+ )
16572
16686
  }
16573
16687
  }
16574
- });
16688
+ );
16575
16689
  }
16576
16690
  // mark virtual outputs as spent, save change outputs if any.
16577
16691
  // `offchainTapscript` and `serverPubKey` are the epoch snapshot the
@@ -16610,14 +16724,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16610
16724
  const spentBy = checkpointIdByOutpoint.get(`${vtxo.txid}:${vtxo.vout}`);
16611
16725
  spentVtxos.push({
16612
16726
  ...spentFacts,
16613
- virtualStatus: chunk6FTHFJAN_cjs.toVirtualStatus(spentFacts),
16727
+ virtualStatus: chunkKJ5E646Y_cjs.toVirtualStatus(spentFacts),
16614
16728
  ...spentBy ? { spentBy } : {},
16615
16729
  arkTxId: arkTxid
16616
16730
  });
16617
16731
  for (const id of vtxo.commitmentTxIds) {
16618
16732
  commitmentTxIds.add(id);
16619
16733
  }
16620
- const vtxoExpiry = chunk6FTHFJAN_cjs.toBatchExpiry(vtxo);
16734
+ const vtxoExpiry = chunkKJ5E646Y_cjs.toBatchExpiry(vtxo);
16621
16735
  if (vtxoExpiry) {
16622
16736
  batchExpiry = Math.min(batchExpiry, vtxoExpiry);
16623
16737
  }
@@ -16630,7 +16744,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16630
16744
  isSwept: false,
16631
16745
  isPreconfirmed: true,
16632
16746
  commitmentTxIds: Array.from(commitmentTxIds),
16633
- ...chunk6FTHFJAN_cjs.parseLegacyExpiry(batchExpiry)
16747
+ ...chunkKJ5E646Y_cjs.parseLegacyExpiry(batchExpiry)
16634
16748
  };
16635
16749
  changeVtxo = {
16636
16750
  txid: arkTxid,
@@ -16642,7 +16756,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16642
16756
  tapTree: offchainTapscript.encode(),
16643
16757
  value: Number(changeAmount),
16644
16758
  ...changeFacts,
16645
- virtualStatus: chunk6FTHFJAN_cjs.toVirtualStatus(changeFacts),
16759
+ virtualStatus: chunkKJ5E646Y_cjs.toVirtualStatus(changeFacts),
16646
16760
  spentBy: "",
16647
16761
  status: {
16648
16762
  confirmed: false
@@ -16711,12 +16825,12 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16711
16825
  const spentVtxos = [];
16712
16826
  const inputArkTxIds = /* @__PURE__ */ new Set();
16713
16827
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
16714
- const vtxoInputs = inputs.filter(chunk6FTHFJAN_cjs.isVirtualCoin);
16828
+ const vtxoInputs = inputs.filter(chunkKJ5E646Y_cjs.isVirtualCoin);
16715
16829
  const cm = await this.getContractManager();
16716
16830
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
16717
16831
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
16718
16832
  for (const input of inputs) {
16719
- if (chunk6FTHFJAN_cjs.isVirtualCoin(input)) {
16833
+ if (chunkKJ5E646Y_cjs.isVirtualCoin(input)) {
16720
16834
  const outpoint = `${input.txid}:${input.vout}`;
16721
16835
  const vtxo = annotatedByKey.get(outpoint);
16722
16836
  if (!vtxo) {
@@ -16728,13 +16842,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16728
16842
  const settledFacts = { ...vtxo, isSpent: true };
16729
16843
  spentVtxos.push({
16730
16844
  ...settledFacts,
16731
- virtualStatus: chunk6FTHFJAN_cjs.toVirtualStatus(settledFacts),
16845
+ virtualStatus: chunkKJ5E646Y_cjs.toVirtualStatus(settledFacts),
16732
16846
  settledBy: commitmentTxid
16733
16847
  });
16734
16848
  } else {
16735
16849
  let sourceAddress;
16736
16850
  try {
16737
- sourceAddress = chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
16851
+ sourceAddress = chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
16738
16852
  this.network
16739
16853
  );
16740
16854
  } catch {
@@ -16792,9 +16906,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16792
16906
  }
16793
16907
  };
16794
16908
  function selectVirtualCoins(coins, targetAmount) {
16795
- const sortedCoins = coins.map(chunk6FTHFJAN_cjs.normalizeVtxo).sort((a, b) => {
16796
- const expiryA = chunk6FTHFJAN_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
16797
- const expiryB = chunk6FTHFJAN_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
16909
+ const sortedCoins = coins.map(chunkKJ5E646Y_cjs.normalizeVtxo).sort((a, b) => {
16910
+ const expiryA = chunkKJ5E646Y_cjs.toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
16911
+ const expiryB = chunkKJ5E646Y_cjs.toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
16798
16912
  if (expiryA !== expiryB) {
16799
16913
  return expiryA - expiryB;
16800
16914
  }
@@ -17163,7 +17277,7 @@ var MessageBus = class {
17163
17277
  this.initialized = true;
17164
17278
  }
17165
17279
  async buildServices(config) {
17166
- const arkProvider = new chunk6FTHFJAN_cjs.RestArkProvider(config.arkServer.url);
17280
+ const arkProvider = new chunkKJ5E646Y_cjs.RestArkProvider(config.arkServer.url);
17167
17281
  const storage = {
17168
17282
  walletRepository: this.walletRepository,
17169
17283
  contractRepository: this.contractRepository,
@@ -17505,7 +17619,7 @@ var offboardNetworkNames = [
17505
17619
  function offboardDestinationScript(destinationAddress) {
17506
17620
  for (const networkName of offboardNetworkNames) {
17507
17621
  try {
17508
- const network = chunk6FTHFJAN_cjs.networks[networkName];
17622
+ const network = chunkKJ5E646Y_cjs.networks[networkName];
17509
17623
  const addr = btcSigner.Address(network).decode(destinationAddress);
17510
17624
  return btcSigner.OutScript.encode(addr);
17511
17625
  } catch {
@@ -17569,7 +17683,7 @@ var Ramps = class {
17569
17683
  }
17570
17684
  amount = amount ?? totalAmount;
17571
17685
  const offchainAddress = await this.wallet.getAddress();
17572
- const offchainAddr = chunk6FTHFJAN_cjs.ArkAddress.decode(offchainAddress);
17686
+ const offchainAddr = chunkKJ5E646Y_cjs.ArkAddress.decode(offchainAddress);
17573
17687
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
17574
17688
  const outputFee = estimator.evalOffchainOutput({
17575
17689
  amount,
@@ -17629,7 +17743,7 @@ var Ramps = class {
17629
17743
  const filteredVtxos = [];
17630
17744
  let totalAmount = 0n;
17631
17745
  for (const vtxo of vtxos) {
17632
- const inputFee = estimator.evalOffchainInput(chunk6FTHFJAN_cjs.toOffchainInputFeeParams(vtxo));
17746
+ const inputFee = estimator.evalOffchainInput(chunkKJ5E646Y_cjs.toOffchainInputFeeParams(vtxo));
17633
17747
  if (inputFee.satoshis >= vtxo.value) {
17634
17748
  continue;
17635
17749
  }
@@ -18500,7 +18614,7 @@ var WalletMessageHandler = class {
18500
18614
  // Wallet methods
18501
18615
  async handleInitWallet({ payload }) {
18502
18616
  const { arkServerUrl } = payload;
18503
- this.indexerProvider = new chunk4C5PMGBB_cjs.RestIndexerProvider(arkServerUrl);
18617
+ this.indexerProvider = new chunkD5DLGVN4_cjs.RestIndexerProvider(arkServerUrl);
18504
18618
  await this.onWalletInitialized();
18505
18619
  }
18506
18620
  /**
@@ -18788,7 +18902,7 @@ var WalletMessageHandler = class {
18788
18902
  if (v.isUnrolled) {
18789
18903
  return withUnrolled;
18790
18904
  }
18791
- if (chunk6FTHFJAN_cjs.hasTerminalSpend(v)) {
18905
+ if (chunkKJ5E646Y_cjs.hasTerminalSpend(v)) {
18792
18906
  return false;
18793
18907
  }
18794
18908
  if (includeRecoverable) {
@@ -18797,10 +18911,10 @@ var WalletMessageHandler = class {
18797
18911
  if (dustAmount != null && isSubdust(v, dustAmount)) {
18798
18912
  return false;
18799
18913
  }
18800
- if (chunk6FTHFJAN_cjs.isRecoverable(v)) {
18914
+ if (chunkKJ5E646Y_cjs.isRecoverable(v)) {
18801
18915
  return false;
18802
18916
  }
18803
- if (chunk6FTHFJAN_cjs.isExpired(v)) {
18917
+ if (chunkKJ5E646Y_cjs.isExpired(v)) {
18804
18918
  return false;
18805
18919
  }
18806
18920
  return true;
@@ -18908,7 +19022,7 @@ var WalletMessageHandler = class {
18908
19022
  this.readonlyWallet.getBoardingTxs()
18909
19023
  ]);
18910
19024
  const indexerProvider = this.indexerProvider;
18911
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunk6FTHFJAN_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
19025
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunkKJ5E646Y_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
18912
19026
  return buildTransactionHistory(
18913
19027
  vtxos,
18914
19028
  boardingTxs,
@@ -19616,7 +19730,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19616
19730
  };
19617
19731
  try {
19618
19732
  const response = await this.sendMessage(message);
19619
- return response.payload.vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo);
19733
+ return response.payload.vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo);
19620
19734
  } catch (error) {
19621
19735
  throw new Error(`Failed to get vtxos: ${error}`);
19622
19736
  }
@@ -19641,7 +19755,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19641
19755
  };
19642
19756
  try {
19643
19757
  const response = await this.sendMessage(message);
19644
- return response.payload.vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo);
19758
+ return response.payload.vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo);
19645
19759
  } catch (error) {
19646
19760
  throw new Error(`Failed to get spendable vtxos: ${error}`);
19647
19761
  }
@@ -19812,7 +19926,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19812
19926
  };
19813
19927
  try {
19814
19928
  const response = await sendContractMessage(message);
19815
- return response.payload.vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo);
19929
+ return response.payload.vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo);
19816
19930
  } catch (e) {
19817
19931
  throw new Error("Failed to annotate vtxos");
19818
19932
  }
@@ -20424,7 +20538,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
20424
20538
  };
20425
20539
  try {
20426
20540
  const response = await wallet.sendMessage(message);
20427
- return response.payload.vtxos.map(chunk6FTHFJAN_cjs.normalizeVtxo);
20541
+ return response.payload.vtxos.map(chunkKJ5E646Y_cjs.normalizeVtxo);
20428
20542
  } catch (e) {
20429
20543
  throw new Error(`Failed to get expiring vtxos: ${e}`);
20430
20544
  }
@@ -20536,12 +20650,12 @@ var OnchainWallet = class _OnchainWallet {
20536
20650
  * @returns Configured onchain wallet
20537
20651
  * @throws Error if the configured identity cannot produce a valid x-only public key
20538
20652
  */
20539
- static async create(identity, networkName = chunk6FTHFJAN_cjs.DEFAULT_NETWORK_NAME, provider) {
20653
+ static async create(identity, networkName = chunkKJ5E646Y_cjs.DEFAULT_NETWORK_NAME, provider) {
20540
20654
  const pubkey = await identity.xOnlyPublicKey();
20541
20655
  if (!pubkey) {
20542
20656
  throw new Error("Invalid configured public key");
20543
20657
  }
20544
- const network = chunk6FTHFJAN_cjs.getNetwork(networkName);
20658
+ const network = chunkKJ5E646Y_cjs.getNetwork(networkName);
20545
20659
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
20546
20660
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
20547
20661
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -20647,7 +20761,7 @@ var OnchainWallet = class _OnchainWallet {
20647
20761
  if (!inputs) {
20648
20762
  throw new Error("Fee estimation failed");
20649
20763
  }
20650
- let tx = new chunk6FTHFJAN_cjs.Transaction();
20764
+ let tx = new chunkKJ5E646Y_cjs.Transaction();
20651
20765
  for (const input of inputs) {
20652
20766
  tx.addInput({
20653
20767
  txid: input.txid,
@@ -20705,7 +20819,7 @@ var OnchainWallet = class _OnchainWallet {
20705
20819
  * @throws If the parent has no anchor, or funding cannot be selected/signed
20706
20820
  */
20707
20821
  async bumpAnchor(parentHex, feeRate) {
20708
- const parent = chunk6FTHFJAN_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
20822
+ const parent = chunkKJ5E646Y_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
20709
20823
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
20710
20824
  const child = await this.buildBumpPackage(parent, feeRate, coins);
20711
20825
  return [parent.hex, child.hex];
@@ -21612,7 +21726,7 @@ async function resolvePrevTxs(txids, source, onchain) {
21612
21726
  try {
21613
21727
  const { txs } = await source.getVirtualTxs(wanted);
21614
21728
  for (const psbt of txs) {
21615
- const tx = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
21729
+ const tx = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
21616
21730
  resolved.set(tx.id, tx.toBytes());
21617
21731
  }
21618
21732
  } catch (err) {
@@ -21645,7 +21759,7 @@ async function resolvePrevTxs(txids, source, onchain) {
21645
21759
  async function attachPrevArkTxs(tx, txids, source, onchain) {
21646
21760
  const pending = [];
21647
21761
  for (let i = 0; i < tx.inputsLength; i++) {
21648
- if (chunk6FTHFJAN_cjs.getArkPsbtFields(tx, i, chunk6FTHFJAN_cjs.PrevArkTxField).length === 0) pending.push(i);
21762
+ if (chunkKJ5E646Y_cjs.getArkPsbtFields(tx, i, chunkKJ5E646Y_cjs.PrevArkTxField).length === 0) pending.push(i);
21649
21763
  }
21650
21764
  if (pending.length === 0) return;
21651
21765
  const resolved = await resolvePrevTxs(
@@ -21654,13 +21768,13 @@ async function attachPrevArkTxs(tx, txids, source, onchain) {
21654
21768
  onchain
21655
21769
  );
21656
21770
  for (const i of pending) {
21657
- chunk6FTHFJAN_cjs.setArkPsbtField(tx, i, chunk6FTHFJAN_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
21771
+ chunkKJ5E646Y_cjs.setArkPsbtField(tx, i, chunkKJ5E646Y_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
21658
21772
  }
21659
21773
  }
21660
21774
  async function attachPrevoutTxs(tx, source) {
21661
21775
  const pending = [];
21662
21776
  for (let i = 0; i < tx.inputsLength; i++) {
21663
- if (chunk6FTHFJAN_cjs.getArkPsbtFields(tx, i, chunk6FTHFJAN_cjs.PrevoutTxField).length > 0) continue;
21777
+ if (chunkKJ5E646Y_cjs.getArkPsbtFields(tx, i, chunkKJ5E646Y_cjs.PrevoutTxField).length > 0) continue;
21664
21778
  const input = tx.getInput(i);
21665
21779
  if (!input?.txid) throw new PrevTxUnavailableError(`input ${i} has no outpoint`);
21666
21780
  pending.push({ index: i, txid: base.hex.encode(input.txid) });
@@ -21671,7 +21785,7 @@ async function attachPrevoutTxs(tx, source) {
21671
21785
  resolved.set(txid, await source.getRawTransaction(txid));
21672
21786
  }
21673
21787
  for (const { index, txid } of pending) {
21674
- chunk6FTHFJAN_cjs.setArkPsbtField(tx, index, chunk6FTHFJAN_cjs.PrevoutTxField, resolved.get(txid));
21788
+ chunkKJ5E646Y_cjs.setArkPsbtField(tx, index, chunkKJ5E646Y_cjs.PrevoutTxField, resolved.get(txid));
21675
21789
  }
21676
21790
  }
21677
21791
  async function withPrevTxs(coins, source, onchain) {
@@ -21697,7 +21811,7 @@ exports.BIP322 = void 0;
21697
21811
  async function sign2(message, identity, network) {
21698
21812
  const xOnlyPubKey = await identity.xOnlyPublicKey();
21699
21813
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
21700
- const toSpend = chunk6FTHFJAN_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
21814
+ const toSpend = chunkKJ5E646Y_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
21701
21815
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
21702
21816
  const signed = await identity.sign(toSign, [0]);
21703
21817
  signed.finalizeIdx(0);
@@ -21755,7 +21869,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
21755
21869
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
21756
21870
  return false;
21757
21871
  }
21758
- const toSpend = chunk6FTHFJAN_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21872
+ const toSpend = chunkKJ5E646Y_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21759
21873
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
21760
21874
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
21761
21875
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -21776,7 +21890,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
21776
21890
  }
21777
21891
  const sighashType = sigWithHash[sigWithHash.length - 1];
21778
21892
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
21779
- const toSpend = chunk6FTHFJAN_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21893
+ const toSpend = chunkKJ5E646Y_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
21780
21894
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
21781
21895
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
21782
21896
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -21829,7 +21943,7 @@ function encodeCompactSize(n) {
21829
21943
  return buf;
21830
21944
  }
21831
21945
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
21832
- const tx = new chunk6FTHFJAN_cjs.Transaction({ version: 0 });
21946
+ const tx = new chunkKJ5E646Y_cjs.Transaction({ version: 0 });
21833
21947
  tx.addInput({
21834
21948
  txid: toSpend.id,
21835
21949
  index: 0,
@@ -21843,12 +21957,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
21843
21957
  });
21844
21958
  tx.addOutput({
21845
21959
  amount: 0n,
21846
- script: chunk6FTHFJAN_cjs.OP_RETURN_EMPTY_PKSCRIPT
21960
+ script: chunkKJ5E646Y_cjs.OP_RETURN_EMPTY_PKSCRIPT
21847
21961
  });
21848
21962
  return tx;
21849
21963
  }
21850
21964
  function craftBIP322ToSignSimple(toSpend, pkScript) {
21851
- const tx = new chunk6FTHFJAN_cjs.Transaction({ version: 0 });
21965
+ const tx = new chunkKJ5E646Y_cjs.Transaction({ version: 0 });
21852
21966
  tx.addInput({
21853
21967
  txid: toSpend.id,
21854
21968
  index: 0,
@@ -21860,7 +21974,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
21860
21974
  });
21861
21975
  tx.addOutput({
21862
21976
  amount: 0n,
21863
- script: chunk6FTHFJAN_cjs.OP_RETURN_EMPTY_PKSCRIPT
21977
+ script: chunkKJ5E646Y_cjs.OP_RETURN_EMPTY_PKSCRIPT
21864
21978
  });
21865
21979
  return tx;
21866
21980
  }
@@ -21873,7 +21987,7 @@ var RestEmulatorProvider = class {
21873
21987
  serverUrl;
21874
21988
  async getInfo() {
21875
21989
  const url = `${this.serverUrl}/v1/info`;
21876
- const response = await chunk6FTHFJAN_cjs.baseFetch(url);
21990
+ const response = await chunkKJ5E646Y_cjs.baseFetch(url);
21877
21991
  if (!response.ok) {
21878
21992
  const errorText2 = await response.text();
21879
21993
  throw new Error(`Failed to get emulator info: ${errorText2}`);
@@ -21991,7 +22105,7 @@ var RestEmulatorProvider = class {
21991
22105
  }
21992
22106
  };
21993
22107
  function finalizeVirtualTx(type, psbtBase64) {
21994
- const tx = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
22108
+ const tx = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
21995
22109
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
21996
22110
  const input = tx.getInput(0);
21997
22111
  if (!input) {
@@ -22018,14 +22132,14 @@ var ExitPathError = class extends Error {
22018
22132
  reason;
22019
22133
  };
22020
22134
  function delayWeight(sequence) {
22021
- const t = chunk6FTHFJAN_cjs.sequenceToTimelock(sequence);
22135
+ const t = chunkKJ5E646Y_cjs.sequenceToTimelock(sequence);
22022
22136
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
22023
22137
  }
22024
22138
  async function resolveUnilateralPath(params) {
22025
22139
  const { vtxo, scriptHex, contractRepository } = params;
22026
22140
  const contract = contractRepository ? (await contractRepository.getContracts({ script: scriptHex }))[0] : void 0;
22027
22141
  if (contract) {
22028
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
22142
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
22029
22143
  if (!handler) {
22030
22144
  throw new ExitPathError(
22031
22145
  "no-handler",
@@ -22048,12 +22162,12 @@ async function resolveUnilateralPath(params) {
22048
22162
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
22049
22163
  return { selection: paths[0], label: `${contract.type}:unilateral` };
22050
22164
  }
22051
- const decoded = chunk6FTHFJAN_cjs.VtxoScript.decode(vtxo.tapTree);
22165
+ const decoded = chunkKJ5E646Y_cjs.VtxoScript.decode(vtxo.tapTree);
22052
22166
  let best;
22053
22167
  for (const exit of decoded.exitPaths()) {
22054
22168
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
22055
22169
  if (!leaf) continue;
22056
- const sequence = chunk6FTHFJAN_cjs.timelockToSequence(exit.params.timelock);
22170
+ const sequence = chunkKJ5E646Y_cjs.timelockToSequence(exit.params.timelock);
22057
22171
  const weight = delayWeight(sequence);
22058
22172
  if (!best || weight < best.weight) {
22059
22173
  best = { selection: { leaf, sequence }, weight };
@@ -22273,7 +22387,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
22273
22387
  let totalAmount = 0n;
22274
22388
  const txWeightEstimator = TxWeightEstimator.create();
22275
22389
  for (const vtxo of vtxos) {
22276
- if (!chunk6FTHFJAN_cjs.canSweepOnchain(vtxo)) {
22390
+ if (!chunkKJ5E646Y_cjs.canSweepOnchain(vtxo)) {
22277
22391
  throw new Error(
22278
22392
  `Vtxo ${vtxo.txid}:${vtxo.vout} cannot be swept onchain: it is not fully unrolled (use unroll first), or its exit output was already spent`
22279
22393
  );
@@ -22284,14 +22398,14 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
22284
22398
  }
22285
22399
  const resolved = await resolveUnilateralPath({
22286
22400
  vtxo,
22287
- scriptHex: base.hex.encode(chunk6FTHFJAN_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22401
+ scriptHex: base.hex.encode(chunkKJ5E646Y_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22288
22402
  contractRepository: wallet.contractRepository,
22289
22403
  walletPubKeyHex: base.hex.encode(await wallet.identity.xOnlyPublicKey()),
22290
22404
  currentTime: Date.now()
22291
22405
  });
22292
22406
  const spendingLeaf = resolved.selection.leaf;
22293
22407
  const sequence = resolved.selection.sequence;
22294
- const timelock = chunk6FTHFJAN_cjs.sequenceToTimelock(sequence);
22408
+ const timelock = chunkKJ5E646Y_cjs.sequenceToTimelock(sequence);
22295
22409
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
22296
22410
  if (!elapsed) {
22297
22411
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -22304,7 +22418,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
22304
22418
  sequence,
22305
22419
  witnessUtxo: {
22306
22420
  amount: BigInt(vtxo.value),
22307
- script: chunk6FTHFJAN_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
22421
+ script: chunkKJ5E646Y_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
22308
22422
  },
22309
22423
  sighashType: btcSigner.SigHash.DEFAULT
22310
22424
  });
@@ -22314,7 +22428,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
22314
22428
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
22315
22429
  );
22316
22430
  }
22317
- const tx = new chunk6FTHFJAN_cjs.Transaction({ version: 2 });
22431
+ const tx = new chunkKJ5E646Y_cjs.Transaction({ version: 2 });
22318
22432
  for (const input of inputs) {
22319
22433
  tx.addInput(input);
22320
22434
  }
@@ -22397,7 +22511,7 @@ async function buildSignedSweep(params) {
22397
22511
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
22398
22512
  );
22399
22513
  }
22400
- const tx = new chunk6FTHFJAN_cjs.Transaction({ version: 2 });
22514
+ const tx = new chunkKJ5E646Y_cjs.Transaction({ version: 2 });
22401
22515
  tx.addInput({
22402
22516
  txid: vtxo.txid,
22403
22517
  index: vtxo.vout,
@@ -22422,7 +22536,7 @@ async function buildSignedSweep(params) {
22422
22536
  finalScriptWitness: [
22423
22537
  tapScriptSig[0][1],
22424
22538
  ...path.extraWitness,
22425
- chunk6FTHFJAN_cjs.scriptFromTapLeafScript(path.leaf),
22539
+ chunkKJ5E646Y_cjs.scriptFromTapLeafScript(path.leaf),
22426
22540
  btcSigner.TaprootControlBlock.encode(controlBlock)
22427
22541
  ]
22428
22542
  });
@@ -22452,7 +22566,7 @@ async function resolveFeeRate(opts) {
22452
22566
  }
22453
22567
  async function selectExitVtxos(opts) {
22454
22568
  if (!opts.vtxos) return opts.wallet.getVtxos();
22455
- const res = await chunk6FTHFJAN_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
22569
+ const res = await chunkKJ5E646Y_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
22456
22570
  const tapTrees = /* @__PURE__ */ new Map();
22457
22571
  const out = [];
22458
22572
  for (const vtxo of res.vtxos) {
@@ -22467,7 +22581,7 @@ async function selectExitVtxos(opts) {
22467
22581
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
22468
22582
  );
22469
22583
  }
22470
- const handler = chunkNPM5YZBC_cjs.contractHandlers.get(contract.type);
22584
+ const handler = chunk2D7F5IU3_cjs.contractHandlers.get(contract.type);
22471
22585
  if (!handler) {
22472
22586
  throw new Error(`no contract handler registered for type '${contract.type}'`);
22473
22587
  }
@@ -22497,7 +22611,7 @@ async function computeExitLayout(opts, feeRate) {
22497
22611
  if (pendingNodes.length > 0) {
22498
22612
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
22499
22613
  for (const psbt of txs) {
22500
- psbts.set(chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
22614
+ psbts.set(chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
22501
22615
  }
22502
22616
  }
22503
22617
  const childVsize = Number(
@@ -22533,7 +22647,7 @@ async function computeExitLayout(opts, feeRate) {
22533
22647
  try {
22534
22648
  const resolved = await resolveUnilateralPath({
22535
22649
  vtxo,
22536
- scriptHex: base.hex.encode(chunk6FTHFJAN_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22650
+ scriptHex: base.hex.encode(chunkKJ5E646Y_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
22537
22651
  contractRepository: wallet.contractRepository,
22538
22652
  walletPubKeyHex,
22539
22653
  currentTime: Date.now()
@@ -22552,7 +22666,7 @@ async function computeExitLayout(opts, feeRate) {
22552
22666
  });
22553
22667
  continue;
22554
22668
  }
22555
- const t = chunk6FTHFJAN_cjs.sequenceToTimelock(resolved.selection.sequence);
22669
+ const t = chunkKJ5E646Y_cjs.sequenceToTimelock(resolved.selection.sequence);
22556
22670
  const delay = { type: t.type, value: Number(t.value) };
22557
22671
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
22558
22672
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -22953,7 +23067,7 @@ async function prepare(opts) {
22953
23067
  txid: sweep.vtxo.txid,
22954
23068
  vout: sweep.vtxo.vout,
22955
23069
  value: sweep.vtxo.value,
22956
- pkScript: chunk6FTHFJAN_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
23070
+ pkScript: chunkKJ5E646Y_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
22957
23071
  },
22958
23072
  path: sweep.resolved.selection,
22959
23073
  outputAddress: opts.sweepAddress,
@@ -23041,7 +23155,7 @@ async function prepare(opts) {
23041
23155
  if (newFee <= splitterFee) break;
23042
23156
  splitterFee = newFee;
23043
23157
  }
23044
- const splitter = new chunk6FTHFJAN_cjs.Transaction({ version: 2 });
23158
+ const splitter = new chunkKJ5E646Y_cjs.Transaction({ version: 2 });
23045
23159
  for (const coin of selected.inputs) {
23046
23160
  splitter.addInput({
23047
23161
  txid: coin.txid,
@@ -23185,41 +23299,41 @@ var UnilateralExit = {
23185
23299
  // src/arkade/index.ts
23186
23300
  var arkade_exports = {};
23187
23301
  chunk5BLDMQED_cjs.__export(arkade_exports, {
23188
- ARKADE_OP: () => chunkNPM5YZBC_cjs.ARKADE_OP,
23189
- ARKADE_OPCODES: () => chunkNPM5YZBC_cjs.ARKADE_OPCODES,
23190
- ARKADE_OPCODE_NAMES: () => chunkNPM5YZBC_cjs.ARKADE_OPCODE_NAMES,
23191
- ARKADE_OPCODE_VALUES: () => chunkNPM5YZBC_cjs.ARKADE_OPCODE_VALUES,
23192
- ARKADE_OPS: () => chunkNPM5YZBC_cjs.ARKADE_OPS,
23302
+ ARKADE_OP: () => chunk2D7F5IU3_cjs.ARKADE_OP,
23303
+ ARKADE_OPCODES: () => chunk2D7F5IU3_cjs.ARKADE_OPCODES,
23304
+ ARKADE_OPCODE_NAMES: () => chunk2D7F5IU3_cjs.ARKADE_OPCODE_NAMES,
23305
+ ARKADE_OPCODE_VALUES: () => chunk2D7F5IU3_cjs.ARKADE_OPCODE_VALUES,
23306
+ ARKADE_OPS: () => chunk2D7F5IU3_cjs.ARKADE_OPS,
23193
23307
  Arkade: () => Arkade,
23194
23308
  ArkadeContract: () => ArkadeContract,
23195
- ArkadeProgramScript: () => chunkNPM5YZBC_cjs.ArkadeProgramScript,
23196
- ArkadeScript: () => chunkNPM5YZBC_cjs.ArkadeScript,
23309
+ ArkadeProgramScript: () => chunk2D7F5IU3_cjs.ArkadeProgramScript,
23310
+ ArkadeScript: () => chunk2D7F5IU3_cjs.ArkadeScript,
23197
23311
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
23198
- BigNum: () => chunkNPM5YZBC_cjs.bignum_exports,
23312
+ BigNum: () => chunk2D7F5IU3_cjs.bignum_exports,
23199
23313
  OP: () => btcSigner.OP,
23200
- OPCODE_NAMES: () => chunkNPM5YZBC_cjs.OPCODE_NAMES,
23201
- OPCODE_VALUES: () => chunkNPM5YZBC_cjs.OPCODE_VALUES,
23202
- SUPPORTED_PROGRAM_VERSION: () => chunkNPM5YZBC_cjs.SUPPORTED_PROGRAM_VERSION,
23314
+ OPCODE_NAMES: () => chunk2D7F5IU3_cjs.OPCODE_NAMES,
23315
+ OPCODE_VALUES: () => chunk2D7F5IU3_cjs.OPCODE_VALUES,
23316
+ SUPPORTED_PROGRAM_VERSION: () => chunk2D7F5IU3_cjs.SUPPORTED_PROGRAM_VERSION,
23203
23317
  Script: () => btcSigner.Script,
23204
- arkadeScriptHash: () => chunkNPM5YZBC_cjs.arkadeScriptHash,
23205
- arkadeWitnessHash: () => chunkNPM5YZBC_cjs.arkadeWitnessHash,
23206
- asmToBytes: () => chunkNPM5YZBC_cjs.asmToBytes,
23207
- bytesToASM: () => chunkNPM5YZBC_cjs.bytesToASM,
23208
- computeArkadeScriptPublicKey: () => chunkNPM5YZBC_cjs.computeArkadeScriptPublicKey,
23318
+ arkadeScriptHash: () => chunk2D7F5IU3_cjs.arkadeScriptHash,
23319
+ arkadeWitnessHash: () => chunk2D7F5IU3_cjs.arkadeWitnessHash,
23320
+ asmToBytes: () => chunk2D7F5IU3_cjs.asmToBytes,
23321
+ bytesToASM: () => chunk2D7F5IU3_cjs.bytesToASM,
23322
+ computeArkadeScriptPublicKey: () => chunk2D7F5IU3_cjs.computeArkadeScriptPublicKey,
23209
23323
  createArkadeBatchHandler: () => createArkadeBatchHandler,
23210
- deserializeArkadeContractParams: () => chunkNPM5YZBC_cjs.deserializeArkadeContractParams,
23211
- fromASM: () => chunkNPM5YZBC_cjs.fromASM,
23212
- getOpcodeName: () => chunkNPM5YZBC_cjs.getOpcodeName,
23213
- getOpcodeValue: () => chunkNPM5YZBC_cjs.getOpcodeValue,
23214
- parseArtifact: () => chunkNPM5YZBC_cjs.parseArtifact,
23215
- resolveAsm: () => chunkNPM5YZBC_cjs.resolveAsm,
23216
- serializeArkadeContractParams: () => chunkNPM5YZBC_cjs.serializeArkadeContractParams,
23217
- stringifyArtifact: () => chunkNPM5YZBC_cjs.stringifyArtifact,
23218
- toASM: () => chunkNPM5YZBC_cjs.toASM,
23219
- validateProgram: () => chunkNPM5YZBC_cjs.validateProgram,
23220
- witnessRefToBytes: () => chunkNPM5YZBC_cjs.witnessRefToBytes
23324
+ deserializeArkadeContractParams: () => chunk2D7F5IU3_cjs.deserializeArkadeContractParams,
23325
+ fromASM: () => chunk2D7F5IU3_cjs.fromASM,
23326
+ getOpcodeName: () => chunk2D7F5IU3_cjs.getOpcodeName,
23327
+ getOpcodeValue: () => chunk2D7F5IU3_cjs.getOpcodeValue,
23328
+ parseArtifact: () => chunk2D7F5IU3_cjs.parseArtifact,
23329
+ resolveAsm: () => chunk2D7F5IU3_cjs.resolveAsm,
23330
+ serializeArkadeContractParams: () => chunk2D7F5IU3_cjs.serializeArkadeContractParams,
23331
+ stringifyArtifact: () => chunk2D7F5IU3_cjs.stringifyArtifact,
23332
+ toASM: () => chunk2D7F5IU3_cjs.toASM,
23333
+ validateProgram: () => chunk2D7F5IU3_cjs.validateProgram,
23334
+ witnessRefToBytes: () => chunk2D7F5IU3_cjs.witnessRefToBytes
23221
23335
  });
23222
- var isVtxoCoin = (input) => chunk6FTHFJAN_cjs.isVirtualCoin(input);
23336
+ var isVtxoCoin = (input) => chunkKJ5E646Y_cjs.isVirtualCoin(input);
23223
23337
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
23224
23338
  let batchId;
23225
23339
  let sweepTapTreeRoot;
@@ -23240,26 +23354,32 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
23240
23354
  );
23241
23355
  await arkProvider.confirmRegistration(intentId);
23242
23356
  batchId = event.id;
23243
- const sweepTapscript = chunk6FTHFJAN_cjs.CSVMultisigTapscript.encode({
23357
+ const sweepTapscript = chunkKJ5E646Y_cjs.CSVMultisigTapscript.encode({
23244
23358
  timelock,
23245
- pubkeys: [chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
23359
+ pubkeys: [chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
23246
23360
  }).script;
23247
23361
  sweepTapTreeRoot = payment_js.tapLeafHash(sweepTapscript);
23248
23362
  return { skip: false };
23249
23363
  },
23250
23364
  onTreeSigningStarted: async (event, vtxoTree) => {
23251
23365
  const signerPubKey = await session.getPublicKey();
23252
- const xonlySignerPubKey = chunkNPM5YZBC_cjs.toXOnly(signerPubKey, "signer key");
23366
+ const xonlySignerPubKey = chunk2D7F5IU3_cjs.toXOnly(signerPubKey, "signer key");
23253
23367
  const xOnlyPubkeys = event.cosignersPublicKeys.map(
23254
- (k) => base.hex.encode(chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
23368
+ (k) => base.hex.encode(chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
23255
23369
  );
23256
23370
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
23257
23371
  return { skip: true };
23258
23372
  }
23259
- const commitmentTx = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
23373
+ const commitmentTx = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
23260
23374
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
23261
23375
  if (recipients && recipients.length > 0) {
23262
23376
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
23377
+ } else {
23378
+ validateBatchAgainstIntent(
23379
+ commitmentTx,
23380
+ vtxoTree.leaves(),
23381
+ declaredIntentOutputs(signedProof, message.onchain_output_indexes)
23382
+ );
23263
23383
  }
23264
23384
  const sharedOutput = commitmentTx.getOutput(0);
23265
23385
  if (!sharedOutput?.amount) {
@@ -23288,14 +23408,21 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
23288
23408
  if (connectorTree) {
23289
23409
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
23290
23410
  }
23291
- let commitmentPsbt = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
23411
+ let commitmentPsbt = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
23292
23412
  assertFinalCommitmentMatchesValidated(
23293
23413
  commitmentPsbt,
23294
23414
  validatedCommitmentTxid,
23295
23415
  "arkade batch finalization"
23296
23416
  );
23297
- if (!validatedCommitmentTxid && recipients && recipients.length > 0) {
23298
- validateBatchRecipientsWithoutTree(commitmentPsbt, recipients, network);
23417
+ if (!validatedCommitmentTxid) {
23418
+ if (recipients && recipients.length > 0) {
23419
+ validateBatchRecipientsWithoutTree(commitmentPsbt, recipients, network);
23420
+ } else {
23421
+ validateBatchAgainstIntentWithoutTree(
23422
+ commitmentPsbt,
23423
+ declaredIntentOutputs(signedProof, message.onchain_output_indexes)
23424
+ );
23425
+ }
23299
23426
  }
23300
23427
  const signedForfeits = [];
23301
23428
  let connectorIndex = 0;
@@ -23323,7 +23450,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
23323
23450
  boardingIndices.push(boardingIdx);
23324
23451
  continue;
23325
23452
  }
23326
- if (chunk6FTHFJAN_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
23453
+ if (chunkKJ5E646Y_cjs.isRecoverable(input) || isSubdust(input, info.dust)) {
23327
23454
  continue;
23328
23455
  }
23329
23456
  if (connectorIndex >= connectorLeaves.length) {
@@ -23344,7 +23471,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
23344
23471
  index: input.vout,
23345
23472
  witnessUtxo: {
23346
23473
  amount: BigInt(input.value),
23347
- script: chunk6FTHFJAN_cjs.VtxoScript.decode(input.tapTree).pkScript
23474
+ script: chunkKJ5E646Y_cjs.VtxoScript.decode(input.tapTree).pkScript
23348
23475
  },
23349
23476
  sighashType: btcSigner.SigHash.DEFAULT,
23350
23477
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -23435,16 +23562,16 @@ var Arkade = class _Arkade {
23435
23562
  /** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
23436
23563
  static async connect(opts) {
23437
23564
  const info = await opts.arkade.getInfo();
23438
- const serverKey = chunkNPM5YZBC_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
23439
- const checkpoint = chunk6FTHFJAN_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
23440
- const network = opts.network ?? chunk6FTHFJAN_cjs.DEFAULT_NETWORK;
23565
+ const serverKey = chunk2D7F5IU3_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
23566
+ const checkpoint = chunkKJ5E646Y_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
23567
+ const network = opts.network ?? chunkKJ5E646Y_cjs.DEFAULT_NETWORK;
23441
23568
  let emulatorKey;
23442
23569
  if (opts.emulator) {
23443
- emulatorKey = base.hex.decode(chunk6FTHFJAN_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
23570
+ emulatorKey = base.hex.decode(chunkKJ5E646Y_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
23444
23571
  }
23445
23572
  let userKey;
23446
23573
  if (opts.identity) {
23447
- userKey = chunkNPM5YZBC_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
23574
+ userKey = chunk2D7F5IU3_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
23448
23575
  }
23449
23576
  return new _Arkade({
23450
23577
  arkProvider: opts.arkade,
@@ -23470,7 +23597,7 @@ var Arkade = class _Arkade {
23470
23597
  * key respectively; explicit args always win.
23471
23598
  */
23472
23599
  contract(program, args = {}) {
23473
- const declared = (program.params ?? []).map(chunkNPM5YZBC_cjs.inputName);
23600
+ const declared = (program.params ?? []).map(chunk2D7F5IU3_cjs.inputName);
23474
23601
  if (declared.includes("server") && args.server === void 0) {
23475
23602
  args = { ...args, server: this.serverKey };
23476
23603
  }
@@ -23490,7 +23617,7 @@ var ArkadeContract = class _ArkadeContract {
23490
23617
  userKey: client.userKey,
23491
23618
  emulatorKey: client.emulatorKey
23492
23619
  };
23493
- this.vtxoScript = new chunkNPM5YZBC_cjs.ArkadeProgramScript(program, args, this.keys);
23620
+ this.vtxoScript = new chunk2D7F5IU3_cjs.ArkadeProgramScript(program, args, this.keys);
23494
23621
  this.tapTree = this.vtxoScript.encode();
23495
23622
  this.compiled = this.vtxoScript.compiled;
23496
23623
  }
@@ -23518,7 +23645,7 @@ var ArkadeContract = class _ArkadeContract {
23518
23645
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
23519
23646
  );
23520
23647
  }
23521
- const typed = chunkNPM5YZBC_cjs.deserializeArkadeContractParams(contract.params);
23648
+ const typed = chunk2D7F5IU3_cjs.deserializeArkadeContractParams(contract.params);
23522
23649
  return new _ArkadeContract(client, typed.program, typed.args, {
23523
23650
  serverKey: typed.serverKey,
23524
23651
  userKey: typed.userKey,
@@ -23559,7 +23686,7 @@ var ArkadeContract = class _ArkadeContract {
23559
23686
  toContractParams() {
23560
23687
  return {
23561
23688
  type: "arkade",
23562
- params: chunkNPM5YZBC_cjs.serializeArkadeContractParams({
23689
+ params: chunk2D7F5IU3_cjs.serializeArkadeContractParams({
23563
23690
  program: this.program,
23564
23691
  args: this.args,
23565
23692
  serverKey: this.keys.serverKey,
@@ -23609,18 +23736,18 @@ var ArkadeContract = class _ArkadeContract {
23609
23736
  if (registered) {
23610
23737
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
23611
23738
  return (withVtxos?.vtxos ?? []).filter(
23612
- (v) => !chunk6FTHFJAN_cjs.hasTerminalSpend(v) && !v.isUnrolled
23739
+ (v) => !chunkKJ5E646Y_cjs.hasTerminalSpend(v) && !v.isUnrolled
23613
23740
  );
23614
23741
  }
23615
23742
  }
23616
23743
  if (!this.client.indexer) {
23617
23744
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
23618
23745
  }
23619
- const { vtxos } = await chunk6FTHFJAN_cjs.getNormalizedVtxos(this.client.indexer, {
23746
+ const { vtxos } = await chunkKJ5E646Y_cjs.getNormalizedVtxos(this.client.indexer, {
23620
23747
  scripts: [scriptHex],
23621
23748
  spendableOnly: true
23622
23749
  });
23623
- return vtxos.filter((v) => !chunk6FTHFJAN_cjs.hasTerminalSpend(v) && !v.isUnrolled);
23750
+ return vtxos.filter((v) => !chunkKJ5E646Y_cjs.hasTerminalSpend(v) && !v.isUnrolled);
23624
23751
  }
23625
23752
  /** Total spendable balance (requires an indexer). */
23626
23753
  async getBalance() {
@@ -23718,7 +23845,7 @@ var ArkadeTransactionBuilder = class {
23718
23845
  this.contract.client.checkpoint
23719
23846
  );
23720
23847
  if (coin.sourceTx) {
23721
- chunk6FTHFJAN_cjs.setArkPsbtField(arkTx, 0, chunk6FTHFJAN_cjs.PrevArkTxField, coin.sourceTx);
23848
+ chunkKJ5E646Y_cjs.setArkPsbtField(arkTx, 0, chunkKJ5E646Y_cjs.PrevArkTxField, coin.sourceTx);
23722
23849
  }
23723
23850
  if (this.fn.arkadeScript) {
23724
23851
  const indexer = this.contract.client.indexer;
@@ -23735,8 +23862,8 @@ var ArkadeTransactionBuilder = class {
23735
23862
  }
23736
23863
  const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
23737
23864
  if (condition.length > 0) {
23738
- chunk6FTHFJAN_cjs.setArkPsbtField(arkTx, 0, chunk6FTHFJAN_cjs.ConditionWitness, condition);
23739
- chunk6FTHFJAN_cjs.setArkPsbtField(checkpoints[0], 0, chunk6FTHFJAN_cjs.ConditionWitness, condition);
23865
+ chunkKJ5E646Y_cjs.setArkPsbtField(arkTx, 0, chunkKJ5E646Y_cjs.ConditionWitness, condition);
23866
+ chunkKJ5E646Y_cjs.setArkPsbtField(checkpoints[0], 0, chunkKJ5E646Y_cjs.ConditionWitness, condition);
23740
23867
  }
23741
23868
  const packets = [];
23742
23869
  if (this.assetSpecs.length > 0) {
@@ -23775,7 +23902,7 @@ var ArkadeTransactionBuilder = class {
23775
23902
  base.base64.encode(signedArk2.toPSBT()),
23776
23903
  signedCps.map((c) => base.base64.encode(c.toPSBT()))
23777
23904
  );
23778
- const txid = chunk6FTHFJAN_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
23905
+ const txid = chunkKJ5E646Y_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
23779
23906
  return {
23780
23907
  txid,
23781
23908
  signedArkTx: res2.signedArkTx,
@@ -23834,23 +23961,23 @@ var ArkadeTransactionBuilder = class {
23834
23961
  }
23835
23962
  buildAssetPacket() {
23836
23963
  const groups = this.assetSpecs.map((s) => {
23837
- const id = typeof s.assetId === "string" ? chunk4C5PMGBB_cjs.AssetId.fromString(s.assetId) : chunk4C5PMGBB_cjs.AssetId.fromBytes(s.assetId);
23838
- return chunk4C5PMGBB_cjs.AssetGroup.create(
23964
+ const id = typeof s.assetId === "string" ? chunkD5DLGVN4_cjs.AssetId.fromString(s.assetId) : chunkD5DLGVN4_cjs.AssetId.fromBytes(s.assetId);
23965
+ return chunkD5DLGVN4_cjs.AssetGroup.create(
23839
23966
  id,
23840
23967
  null,
23841
- s.inputs.map((i) => chunk4C5PMGBB_cjs.AssetInput.create(i.vin, i.amount)),
23842
- s.outputs.map((o) => chunk4C5PMGBB_cjs.AssetOutput.create(o.vout, o.amount)),
23843
- (s.metadata ?? []).map((m) => chunk4C5PMGBB_cjs.Metadata.create(m.key, m.value))
23968
+ s.inputs.map((i) => chunkD5DLGVN4_cjs.AssetInput.create(i.vin, i.amount)),
23969
+ s.outputs.map((o) => chunkD5DLGVN4_cjs.AssetOutput.create(o.vout, o.amount)),
23970
+ (s.metadata ?? []).map((m) => chunkD5DLGVN4_cjs.Metadata.create(m.key, m.value))
23844
23971
  );
23845
23972
  });
23846
- return chunk4C5PMGBB_cjs.Packet.create(groups);
23973
+ return chunkD5DLGVN4_cjs.Packet.create(groups);
23847
23974
  }
23848
23975
  witnessBytes(ref) {
23849
- return chunkNPM5YZBC_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
23976
+ return chunk2D7F5IU3_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
23850
23977
  }
23851
23978
  };
23852
23979
  function bindInputs(fn, callArgs) {
23853
- const names = (fn.def.inputs ?? []).map(chunkNPM5YZBC_cjs.inputName);
23980
+ const names = (fn.def.inputs ?? []).map(chunk2D7F5IU3_cjs.inputName);
23854
23981
  if (callArgs.length !== names.length) {
23855
23982
  throw new Error(`${fn.name}: expected ${names.length} argument(s), got ${callArgs.length}`);
23856
23983
  }
@@ -24534,5 +24661,5 @@ exports.waitForIncomingFunds = waitForIncomingFunds;
24534
24661
  exports.walletFeeSource = walletFeeSource;
24535
24662
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
24536
24663
  exports.withPrevTxs = withPrevTxs;
24537
- //# sourceMappingURL=chunk-U5I3ITV7.cjs.map
24538
- //# sourceMappingURL=chunk-U5I3ITV7.cjs.map
24664
+ //# sourceMappingURL=chunk-C4RKZY7D.cjs.map
24665
+ //# sourceMappingURL=chunk-C4RKZY7D.cjs.map