@arkade-os/sdk 0.5.0 → 0.5.1

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 (72) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/{asyncStorageTaskQueue-BFv2O1y1.d.ts → asyncStorageTaskQueue-CdWheMqT.d.ts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-qRRQUOE8.d.cts → asyncStorageTaskQueue-DFt5LgW5.d.cts} +2 -2
  8. package/dist/{chunk-K352GMVL.js → chunk-3M22PJVB.js} +3 -3
  9. package/dist/{chunk-K352GMVL.js.map → chunk-3M22PJVB.js.map} +1 -1
  10. package/dist/{chunk-HABGVRLF.js → chunk-6MIGYYWB.js} +3 -3
  11. package/dist/{chunk-HABGVRLF.js.map → chunk-6MIGYYWB.js.map} +1 -1
  12. package/dist/{chunk-K2E6X6JT.js → chunk-FXVEOEYB.js} +4 -4
  13. package/dist/{chunk-K2E6X6JT.js.map → chunk-FXVEOEYB.js.map} +1 -1
  14. package/dist/{chunk-JT5YVMCJ.cjs → chunk-GQUFPTN7.cjs} +16 -16
  15. package/dist/{chunk-JT5YVMCJ.cjs.map → chunk-GQUFPTN7.cjs.map} +1 -1
  16. package/dist/{chunk-GN2K4WBP.cjs → chunk-GW42FS2X.cjs} +48 -48
  17. package/dist/{chunk-GN2K4WBP.cjs.map → chunk-GW42FS2X.cjs.map} +1 -1
  18. package/dist/{chunk-IQWLFYT2.cjs → chunk-HQNQ3CLQ.cjs} +18 -18
  19. package/dist/{chunk-IQWLFYT2.cjs.map → chunk-HQNQ3CLQ.cjs.map} +1 -1
  20. package/dist/{chunk-GOM26K6H.cjs → chunk-JJ6QKTFZ.cjs} +10 -10
  21. package/dist/{chunk-GOM26K6H.cjs.map → chunk-JJ6QKTFZ.cjs.map} +1 -1
  22. package/dist/{chunk-GWJWXVUB.js → chunk-NKKJEA3Z.js} +51 -37
  23. package/dist/chunk-NKKJEA3Z.js.map +1 -0
  24. package/dist/{chunk-ZOEB53NQ.js → chunk-QFB55EOZ.js} +3 -3
  25. package/dist/{chunk-ZOEB53NQ.js.map → chunk-QFB55EOZ.js.map} +1 -1
  26. package/dist/{chunk-AU77RYOC.cjs → chunk-QKNSMVBW.cjs} +546 -532
  27. package/dist/chunk-QKNSMVBW.cjs.map +1 -0
  28. package/dist/{chunk-UUSKJOSX.cjs → chunk-XLHUGP3G.cjs} +3 -3
  29. package/dist/{chunk-UUSKJOSX.cjs.map → chunk-XLHUGP3G.cjs.map} +1 -1
  30. package/dist/{chunk-TZSKLERU.js → chunk-XQRIY5K5.js} +4 -4
  31. package/dist/{chunk-TZSKLERU.js.map → chunk-XQRIY5K5.js.map} +1 -1
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +3 -3
  34. package/dist/contracts/handlers/index.d.ts +3 -3
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-DNbiUgy8.d.ts → delegate-BSbGQabI.d.ts} +1 -1
  37. package/dist/{delegate-B5BmYkEY.d.cts → delegate-CFCfrReG.d.cts} +1 -1
  38. package/dist/{index-CZw-MMfY.d.cts → index-B3fRWO5i.d.cts} +9 -1
  39. package/dist/{index-CZw-MMfY.d.ts → index-B3fRWO5i.d.ts} +9 -1
  40. package/dist/{index-CYeyT3kn.d.ts → index-CzUVvIxA.d.ts} +2 -2
  41. package/dist/{index-B4QuO9sH.d.cts → index-Fpf4mQZr.d.cts} +2 -2
  42. package/dist/index.cjs +313 -313
  43. package/dist/index.d.cts +15 -8
  44. package/dist/index.d.ts +15 -8
  45. package/dist/index.js +4 -4
  46. package/dist/repositories/realm/index.cjs +35 -35
  47. package/dist/repositories/realm/index.d.cts +2 -2
  48. package/dist/repositories/realm/index.d.ts +2 -2
  49. package/dist/repositories/realm/index.js +5 -5
  50. package/dist/repositories/sqlite/index.cjs +33 -33
  51. package/dist/repositories/sqlite/index.d.cts +2 -2
  52. package/dist/repositories/sqlite/index.d.ts +2 -2
  53. package/dist/repositories/sqlite/index.js +5 -5
  54. package/dist/{taskRunner-wm1bhmtP.d.ts → taskRunner-CdfoCMaw.d.ts} +2 -2
  55. package/dist/{taskRunner-B3SLvUfL.d.cts → taskRunner-Dk6oDAtd.d.cts} +2 -2
  56. package/dist/wallet/expo/background.cjs +14 -14
  57. package/dist/wallet/expo/background.d.cts +3 -3
  58. package/dist/wallet/expo/background.d.ts +3 -3
  59. package/dist/wallet/expo/background.js +6 -6
  60. package/dist/wallet/expo/index.cjs +15 -15
  61. package/dist/wallet/expo/index.d.cts +4 -4
  62. package/dist/wallet/expo/index.d.ts +4 -4
  63. package/dist/wallet/expo/index.js +5 -5
  64. package/dist/{wallet-DCZ2-Bea.d.cts → wallet-BQHNgc_v.d.ts} +3 -3
  65. package/dist/{wallet-DGLXuwXT.d.ts → wallet-D9dvXu-K.d.cts} +3 -3
  66. package/dist/worker/expo/index.cjs +9 -9
  67. package/dist/worker/expo/index.d.cts +4 -4
  68. package/dist/worker/expo/index.d.ts +4 -4
  69. package/dist/worker/expo/index.js +5 -5
  70. package/package.json +1 -1
  71. package/dist/chunk-AU77RYOC.cjs.map +0 -1
  72. package/dist/chunk-GWJWXVUB.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkIQWLFYT2_cjs = require('./chunk-IQWLFYT2.cjs');
4
- var chunkGN2K4WBP_cjs = require('./chunk-GN2K4WBP.cjs');
5
- var chunkUUSKJOSX_cjs = require('./chunk-UUSKJOSX.cjs');
3
+ var chunkHQNQ3CLQ_cjs = require('./chunk-HQNQ3CLQ.cjs');
4
+ var chunkGW42FS2X_cjs = require('./chunk-GW42FS2X.cjs');
5
+ var chunkXLHUGP3G_cjs = require('./chunk-XLHUGP3G.cjs');
6
6
  var utils_js = require('@scure/btc-signer/utils.js');
7
7
  var btcSigner = require('@scure/btc-signer');
8
8
  var base = require('@scure/base');
@@ -187,7 +187,7 @@ var TreeSignerSession = class _TreeSignerSession {
187
187
  noncesByPubkey.set(base.hex.encode(myPublicKey.subarray(1)), myNonce);
188
188
  const tx = this.graph.find(txid);
189
189
  if (!tx) throw new Error(`missing tx for txid ${txid}`);
190
- const cosigners = chunkUUSKJOSX_cjs.getArkPsbtFields(tx.root, 0, chunkUUSKJOSX_cjs.CosignerPublicKey).map(
190
+ const cosigners = chunkXLHUGP3G_cjs.getArkPsbtFields(tx.root, 0, chunkXLHUGP3G_cjs.CosignerPublicKey).map(
191
191
  (c) => base.hex.encode(c.key.subarray(1))
192
192
  // xonly pubkey
193
193
  );
@@ -239,7 +239,7 @@ var TreeSignerSession = class _TreeSignerSession {
239
239
  if (!aggNonce) throw new Error("missing aggregate nonce");
240
240
  const prevoutAmounts = [];
241
241
  const prevoutScripts = [];
242
- const cosigners = chunkUUSKJOSX_cjs.getArkPsbtFields(g.root, 0, chunkUUSKJOSX_cjs.CosignerPublicKey).map((c) => c.key);
242
+ const cosigners = chunkXLHUGP3G_cjs.getArkPsbtFields(g.root, 0, chunkXLHUGP3G_cjs.CosignerPublicKey).map((c) => c.key);
243
243
  const { finalKey } = aggregateKeys(cosigners, true, {
244
244
  taprootTweak: this.scriptRoot
245
245
  });
@@ -322,7 +322,7 @@ var SingleKey = class _SingleKey {
322
322
  async sign(tx, inputIndexes) {
323
323
  const txCpy = tx.clone();
324
324
  if (!inputIndexes) {
325
- chunkUUSKJOSX_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
325
+ chunkXLHUGP3G_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
326
326
  try {
327
327
  if (!txCpy.sign(this.key, ALLOWED_SIGHASH)) {
328
328
  throw new Error("Failed to sign transaction");
@@ -422,7 +422,7 @@ var SeedIdentity = class _SeedIdentity {
422
422
  let network;
423
423
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
424
424
  descriptor = opts.descriptor;
425
- network = chunkGN2K4WBP_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
425
+ network = chunkGW42FS2X_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
426
426
  } else {
427
427
  network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
428
428
  descriptor = descriptorsScure.scriptExpressions.trBIP32({
@@ -499,7 +499,7 @@ var SeedIdentity = class _SeedIdentity {
499
499
  }
500
500
  /** Returns true when `descriptor` is derived from this identity's seed. */
501
501
  ownsDescriptor(descriptor) {
502
- return chunkGN2K4WBP_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
502
+ return chunkGW42FS2X_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
503
503
  }
504
504
  /**
505
505
  * Signs each request with the key derived from its descriptor.
@@ -538,7 +538,7 @@ var SeedIdentity = class _SeedIdentity {
538
538
  }
539
539
  // ── internal helpers ─────────────────────────────────────────────
540
540
  derivePrivateKeyForDescriptor(descriptor) {
541
- const network = chunkGN2K4WBP_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
541
+ const network = chunkGW42FS2X_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
542
542
  const expansion = descriptorsScure.expand({ descriptor, network });
543
543
  if (expansion.isRanged) {
544
544
  throw new Error(
@@ -563,7 +563,7 @@ var SeedIdentity = class _SeedIdentity {
563
563
  signTxWithKey(tx, key, inputIndexes) {
564
564
  const txCpy = tx.clone();
565
565
  if (!inputIndexes) {
566
- chunkUUSKJOSX_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
566
+ chunkXLHUGP3G_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
567
567
  try {
568
568
  if (!txCpy.sign(key, ALLOWED_SIGHASH2)) {
569
569
  throw new Error("Failed to sign transaction");
@@ -615,7 +615,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
615
615
  /** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
616
616
  descriptor;
617
617
  constructor(descriptor) {
618
- const network = chunkGN2K4WBP_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
618
+ const network = chunkGW42FS2X_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
619
619
  let expansion;
620
620
  try {
621
621
  expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
@@ -650,7 +650,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
650
650
  }
651
651
  /** Returns true when `descriptor` derives from this identity's xpub. */
652
652
  ownsDescriptor(descriptor) {
653
- return chunkGN2K4WBP_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
653
+ return chunkGW42FS2X_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
654
654
  }
655
655
  };
656
656
  function serializeSeedOwnedSigningIdentity(identity) {
@@ -793,10 +793,10 @@ var DescriptorIdentity = class {
793
793
  this.base = base;
794
794
  }
795
795
  async xOnlyPublicKey() {
796
- return chunkGN2K4WBP_cjs.deriveDescriptorLeafPubKey(this.descriptor);
796
+ return chunkGW42FS2X_cjs.deriveDescriptorLeafPubKey(this.descriptor);
797
797
  }
798
798
  async compressedPublicKey() {
799
- return chunkGN2K4WBP_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
799
+ return chunkGW42FS2X_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
800
800
  }
801
801
  async sign(tx, inputIndexes) {
802
802
  const [signed] = await this.signer.signWithDescriptor([
@@ -856,8 +856,8 @@ var StaticDescriptorProvider = class _StaticDescriptorProvider {
856
856
  }
857
857
  isOurs(descriptor) {
858
858
  try {
859
- const normalized = chunkGN2K4WBP_cjs.normalizeToDescriptor(descriptor);
860
- const pubKey = chunkGN2K4WBP_cjs.extractPubKey(normalized);
859
+ const normalized = chunkGW42FS2X_cjs.normalizeToDescriptor(descriptor);
860
+ const pubKey = chunkGW42FS2X_cjs.extractPubKey(normalized);
861
861
  return pubKey.toLowerCase() === this.pubKeyHex.toLowerCase();
862
862
  } catch {
863
863
  return false;
@@ -1194,7 +1194,7 @@ function unwrapKeyring(provider) {
1194
1194
  }
1195
1195
  function keyOf(descriptor) {
1196
1196
  try {
1197
- return chunkGN2K4WBP_cjs.extractPubKey(chunkGN2K4WBP_cjs.normalizeToDescriptor(descriptor)).toLowerCase();
1197
+ return chunkGW42FS2X_cjs.extractPubKey(chunkGW42FS2X_cjs.normalizeToDescriptor(descriptor)).toLowerCase();
1198
1198
  } catch {
1199
1199
  return void 0;
1200
1200
  }
@@ -1285,12 +1285,12 @@ async function resolveDescriptorSigner(descriptor, identity, provider) {
1285
1285
  signMessageWithDescriptor: (ownedDescriptor, message, signatureType) => identity.signDescriptorMessage(ownedDescriptor, message, signatureType)
1286
1286
  } : void 0;
1287
1287
  const owner = providerOwner ?? identityOwner;
1288
- if (owner && chunkGN2K4WBP_cjs.parseHDDescriptor(descriptor)) {
1288
+ if (owner && chunkGW42FS2X_cjs.parseHDDescriptor(descriptor)) {
1289
1289
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
1290
1290
  }
1291
1291
  let key;
1292
1292
  try {
1293
- key = chunkGN2K4WBP_cjs.deriveDescriptorLeafPubKey(descriptor);
1293
+ key = chunkGW42FS2X_cjs.deriveDescriptorLeafPubKey(descriptor);
1294
1294
  } catch {
1295
1295
  throw new ForeignDescriptorError(descriptor);
1296
1296
  }
@@ -1343,14 +1343,14 @@ function buildSaltedPreimageMessage(xonly, salt) {
1343
1343
  }
1344
1344
  var PREIMAGE_INDEX = 0;
1345
1345
  function isPerArtifactDescriptor(descriptor) {
1346
- return chunkGN2K4WBP_cjs.parseHDDescriptor(descriptor) !== null;
1346
+ return chunkGW42FS2X_cjs.parseHDDescriptor(descriptor) !== null;
1347
1347
  }
1348
1348
  async function provisionDescriptor(wallet) {
1349
1349
  const allocated = isHDAllocationCapable(wallet) ? await wallet.getNextSigningDescriptor() : void 0;
1350
- return allocated ?? await chunkGN2K4WBP_cjs.identityDescriptor(wallet.identity);
1350
+ return allocated ?? await chunkGW42FS2X_cjs.identityDescriptor(wallet.identity);
1351
1351
  }
1352
1352
  async function provisionRefundKey(wallet) {
1353
- const descriptor = await chunkGN2K4WBP_cjs.identityDescriptor(wallet.identity);
1353
+ const descriptor = await chunkGW42FS2X_cjs.identityDescriptor(wallet.identity);
1354
1354
  const signer = await contractSigner(wallet, descriptor);
1355
1355
  const pubkey = await signer.xOnlyPublicKey();
1356
1356
  const identityPubkey = await wallet.identity.xOnlyPublicKey();
@@ -1360,7 +1360,7 @@ async function provisionRefundKey(wallet) {
1360
1360
  );
1361
1361
  }
1362
1362
  const address = await wallet.getAddress();
1363
- const { pkScript } = chunkUUSKJOSX_cjs.ArkAddress.decode(address);
1363
+ const { pkScript } = chunkXLHUGP3G_cjs.ArkAddress.decode(address);
1364
1364
  return { descriptor, pubkey, pkScript, address };
1365
1365
  }
1366
1366
  async function provisionClaimSecret(wallet, opts = {}) {
@@ -1406,7 +1406,7 @@ async function contractSigner(wallet, descriptor) {
1406
1406
  const signer = isHDWalletCapable(wallet) ? await wallet.signerForDescriptor(descriptor) : wallet.identity;
1407
1407
  let expected;
1408
1408
  try {
1409
- expected = chunkGN2K4WBP_cjs.deriveDescriptorLeafPubKey(descriptor);
1409
+ expected = chunkGW42FS2X_cjs.deriveDescriptorLeafPubKey(descriptor);
1410
1410
  } catch (cause) {
1411
1411
  throw new ForeignDescriptorError(descriptor, { cause });
1412
1412
  }
@@ -1488,7 +1488,7 @@ function debugLog(debug, ...args) {
1488
1488
  }
1489
1489
  function normalizeOptions(pathOrOptions) {
1490
1490
  const o = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
1491
- chunkUUSKJOSX_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
1491
+ chunkXLHUGP3G_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
1492
1492
  return {
1493
1493
  path: o.path,
1494
1494
  updateViaCache: o.updateViaCache ?? "none",
@@ -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 chunkUUSKJOSX_cjs.baseFetch(url, {
1614
+ const response = await chunkXLHUGP3G_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: chunkUUSKJOSX_cjs.Intent.encodeMessage(intent.message),
1621
+ message: chunkXLHUGP3G_cjs.Intent.encodeMessage(intent.message),
1622
1622
  proof: intent.proof
1623
1623
  },
1624
1624
  forfeit_txs: forfeitTxs,
@@ -1637,7 +1637,7 @@ var RestDelegateProvider = class {
1637
1637
  */
1638
1638
  async getDelegateInfo() {
1639
1639
  const url = `${this.url}/v1/delegator/info`;
1640
- const response = await chunkUUSKJOSX_cjs.rateGate.runHttp(url, () => chunkUUSKJOSX_cjs.baseFetch(url));
1640
+ const response = await chunkXLHUGP3G_cjs.rateGate.runHttp(url, () => chunkXLHUGP3G_cjs.baseFetch(url));
1641
1641
  if (!response.ok) {
1642
1642
  const errorText2 = await response.text();
1643
1643
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1693,7 +1693,7 @@ async function collectPages(read) {
1693
1693
  return items;
1694
1694
  }
1695
1695
  function scriptFromArkAddress(address) {
1696
- return base.hex.encode(chunkUUSKJOSX_cjs.ArkAddress.decode(address).pkScript);
1696
+ return base.hex.encode(chunkXLHUGP3G_cjs.ArkAddress.decode(address).pkScript);
1697
1697
  }
1698
1698
 
1699
1699
  // src/repositories/walletRepository.ts
@@ -1755,9 +1755,9 @@ async function collectScriptVtxos(repository, script, options) {
1755
1755
  return [...byOutpoint.values()].map((row) => row.vtxo);
1756
1756
  }
1757
1757
  function unspentScriptVtxos(rows, copies) {
1758
- const spent = copies.filter((copy) => chunkUUSKJOSX_cjs.isVtxoSpent(copy.vtxo));
1758
+ const spent = copies.filter((copy) => chunkXLHUGP3G_cjs.isVtxoSpent(copy.vtxo));
1759
1759
  return rows.filter(
1760
- (row) => !chunkUUSKJOSX_cjs.isVtxoSpent(row.vtxo) && !spent.some(
1760
+ (row) => !chunkXLHUGP3G_cjs.isVtxoSpent(row.vtxo) && !spent.some(
1761
1761
  (copy) => copy.address !== row.address && copy.vtxo.txid === row.vtxo.txid && copy.vtxo.vout === row.vtxo.vout && shouldReplaceScriptVtxo(row, copy)
1762
1762
  )
1763
1763
  );
@@ -1840,7 +1840,7 @@ var ESPLORA_URL = {
1840
1840
  regtest: "http://localhost:3000/api"
1841
1841
  };
1842
1842
  var EsploraProvider = class {
1843
- constructor(baseUrl = ESPLORA_URL[chunkUUSKJOSX_cjs.DEFAULT_NETWORK_NAME], opts) {
1843
+ constructor(baseUrl = ESPLORA_URL[chunkXLHUGP3G_cjs.DEFAULT_NETWORK_NAME], opts) {
1844
1844
  this.baseUrl = baseUrl;
1845
1845
  this.pollingInterval = opts?.pollingInterval ?? 15e3;
1846
1846
  this.forcePolling = opts?.forcePolling ?? false;
@@ -1855,7 +1855,7 @@ var EsploraProvider = class {
1855
1855
  */
1856
1856
  addressWatches = /* @__PURE__ */ new Map();
1857
1857
  async getCoins(address) {
1858
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1858
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1859
1859
  if (!response.ok) {
1860
1860
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1861
1861
  }
@@ -1864,12 +1864,12 @@ var EsploraProvider = class {
1864
1864
  async getFeeRate() {
1865
1865
  let url = `${this.baseUrl}/fee-estimates`;
1866
1866
  let key = "1";
1867
- let response = await chunkUUSKJOSX_cjs.baseFetch(url);
1867
+ let response = await chunkXLHUGP3G_cjs.baseFetch(url);
1868
1868
  if (response.status === 404) {
1869
1869
  await response.body?.cancel();
1870
1870
  url = `${this.baseUrl}/v1/fees/recommended`;
1871
1871
  key = "fastestFee";
1872
- response = await chunkUUSKJOSX_cjs.baseFetch(url);
1872
+ response = await chunkXLHUGP3G_cjs.baseFetch(url);
1873
1873
  }
1874
1874
  if (response.status === 404) {
1875
1875
  await response.body?.cancel();
@@ -1906,7 +1906,7 @@ var EsploraProvider = class {
1906
1906
  }
1907
1907
  }
1908
1908
  async getTxOutspends(txid) {
1909
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1909
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1910
1910
  if (!response.ok) {
1911
1911
  const error = await response.text();
1912
1912
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -1914,7 +1914,7 @@ var EsploraProvider = class {
1914
1914
  return response.json();
1915
1915
  }
1916
1916
  async getTransactions(address) {
1917
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1917
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1918
1918
  if (!response.ok) {
1919
1919
  const error = await response.text();
1920
1920
  throw new Error(`Failed to get transactions: ${error}`);
@@ -1923,14 +1923,14 @@ var EsploraProvider = class {
1923
1923
  }
1924
1924
  /** Orders of magnitude smaller than `/address/{addr}/txs`: the polling fallback's probe. */
1925
1925
  async getAddressStats(address) {
1926
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1926
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1927
1927
  if (!response.ok) {
1928
1928
  throw new Error(`Failed to get address stats: ${response.statusText}`);
1929
1929
  }
1930
1930
  return response.json();
1931
1931
  }
1932
1932
  async getRawTransaction(txid) {
1933
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1933
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1934
1934
  if (!response.ok) {
1935
1935
  const error = await response.text();
1936
1936
  throw new Error(`Failed to get raw transaction ${txid}: ${error}`);
@@ -1938,7 +1938,7 @@ var EsploraProvider = class {
1938
1938
  return base.hex.decode((await response.text()).trim());
1939
1939
  }
1940
1940
  async getTxStatus(txid) {
1941
- const txresponse = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1941
+ const txresponse = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1942
1942
  if (!txresponse.ok) {
1943
1943
  throw new Error(txresponse.statusText);
1944
1944
  }
@@ -1946,7 +1946,7 @@ var EsploraProvider = class {
1946
1946
  if (!tx.status.confirmed) {
1947
1947
  return { confirmed: false };
1948
1948
  }
1949
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1949
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1950
1950
  if (!response.ok) {
1951
1951
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
1952
1952
  }
@@ -2220,9 +2220,9 @@ var EsploraProvider = class {
2220
2220
  return { subscribers, teardown, started };
2221
2221
  }
2222
2222
  async getChainTip() {
2223
- let tipBlocks = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/blocks`);
2223
+ let tipBlocks = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/blocks`);
2224
2224
  if (tipBlocks.status === 404) {
2225
- tipBlocks = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2225
+ tipBlocks = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2226
2226
  }
2227
2227
  if (!tipBlocks.ok) {
2228
2228
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
@@ -2243,7 +2243,7 @@ var EsploraProvider = class {
2243
2243
  };
2244
2244
  }
2245
2245
  async broadcastPackage(parent, child) {
2246
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2246
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2247
2247
  method: "POST",
2248
2248
  headers: {
2249
2249
  "Content-Type": "application/json"
@@ -2259,7 +2259,7 @@ var EsploraProvider = class {
2259
2259
  return result;
2260
2260
  }
2261
2261
  async broadcastTx(tx) {
2262
- const response = await chunkUUSKJOSX_cjs.baseFetch(`${this.baseUrl}/tx`, {
2262
+ const response = await chunkXLHUGP3G_cjs.baseFetch(`${this.baseUrl}/tx`, {
2263
2263
  method: "POST",
2264
2264
  headers: {
2265
2265
  "Content-Type": "text/plain"
@@ -2431,7 +2431,7 @@ function findP2AOutput(tx) {
2431
2431
  var CHILD_DUST_AMOUNT = 546;
2432
2432
  function buildAnchorChild(params) {
2433
2433
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
2434
- const child = new chunkUUSKJOSX_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2434
+ const child = new chunkXLHUGP3G_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2435
2435
  const anchor = findP2AOutput(parent);
2436
2436
  child.addInput(anchor);
2437
2437
  const estimator = TxWeightEstimator.create().addP2AInput();
@@ -2480,7 +2480,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
2480
2480
  );
2481
2481
  }
2482
2482
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
2483
- const tx = new chunkUUSKJOSX_cjs.Transaction({
2483
+ const tx = new chunkXLHUGP3G_cjs.Transaction({
2484
2484
  version: 3,
2485
2485
  lockTime: txLocktime
2486
2486
  });
@@ -2507,7 +2507,7 @@ function validateConnectorsTxGraph(settlementTxB64, connectorsGraph) {
2507
2507
  connectorsGraph.validate();
2508
2508
  if (connectorsGraph.root.inputsLength !== 1) throw ErrNumberOfInputs;
2509
2509
  const rootInput = connectorsGraph.root.getInput(0);
2510
- const settlementTx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(settlementTxB64));
2510
+ const settlementTx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(settlementTxB64));
2511
2511
  if (settlementTx.outputsLength <= BATCH_OUTPUT_CONNECTORS_INDEX)
2512
2512
  throw ErrInvalidSettlementTxOutputs;
2513
2513
  const expectedRootTxid = settlementTx.id;
@@ -2556,7 +2556,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
2556
2556
  if (previousScriptKey.length !== 32) {
2557
2557
  throw new Error(`parent output ${childIndex} has invalid script`);
2558
2558
  }
2559
- const cosigners = chunkUUSKJOSX_cjs.getArkPsbtFields(child.root, 0, chunkUUSKJOSX_cjs.CosignerPublicKey);
2559
+ const cosigners = chunkXLHUGP3G_cjs.getArkPsbtFields(child.root, 0, chunkXLHUGP3G_cjs.CosignerPublicKey);
2560
2560
  if (cosigners.length === 0) {
2561
2561
  throw ErrMissingCosignersPublicKeys;
2562
2562
  }
@@ -2614,7 +2614,7 @@ var EmulatorPacket = class _EmulatorPacket {
2614
2614
  return new _EmulatorPacket(entries);
2615
2615
  }
2616
2616
  static fromBytes(data) {
2617
- const reader = new chunkIQWLFYT2_cjs.BufferReader(data);
2617
+ const reader = new chunkHQNQ3CLQ_cjs.BufferReader(data);
2618
2618
  const entryCount = reader.readCompactSize();
2619
2619
  const entries = [];
2620
2620
  for (let i = 0; i < entryCount; i++) {
@@ -2632,7 +2632,7 @@ var EmulatorPacket = class _EmulatorPacket {
2632
2632
  return _EmulatorPacket.PACKET_TYPE;
2633
2633
  }
2634
2634
  serialize() {
2635
- const writer = new chunkIQWLFYT2_cjs.BufferWriter();
2635
+ const writer = new chunkHQNQ3CLQ_cjs.BufferWriter();
2636
2636
  writer.writeCompactSize(this.entries.length);
2637
2637
  for (const entry of this.entries) {
2638
2638
  writer.writeUint16LE(entry.vin);
@@ -2719,7 +2719,7 @@ var Extension = class _Extension {
2719
2719
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
2720
2720
  );
2721
2721
  }
2722
- const reader = new chunkIQWLFYT2_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2722
+ const reader = new chunkHQNQ3CLQ_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2723
2723
  const packets = [];
2724
2724
  while (reader.remaining() > 0) {
2725
2725
  const packetType = reader.readByte();
@@ -2792,7 +2792,7 @@ var Extension = class _Extension {
2792
2792
  * getAssetPacket returns the embedded Packet, or null if not present.
2793
2793
  */
2794
2794
  getAssetPacket() {
2795
- return this.packets.find((p) => p instanceof chunkIQWLFYT2_cjs.Packet) ?? null;
2795
+ return this.packets.find((p) => p instanceof chunkHQNQ3CLQ_cjs.Packet) ?? null;
2796
2796
  }
2797
2797
  /**
2798
2798
  * getEmulatorPacket returns the embedded EmulatorPacket, or null if not present.
@@ -2816,8 +2816,8 @@ var Extension = class _Extension {
2816
2816
  };
2817
2817
  function parsePacket(packetType, data) {
2818
2818
  switch (packetType) {
2819
- case chunkIQWLFYT2_cjs.Packet.PACKET_TYPE:
2820
- return chunkIQWLFYT2_cjs.Packet.fromBytes(data);
2819
+ case chunkHQNQ3CLQ_cjs.Packet.PACKET_TYPE:
2820
+ return chunkHQNQ3CLQ_cjs.Packet.fromBytes(data);
2821
2821
  case EmulatorPacket.PACKET_TYPE:
2822
2822
  return EmulatorPacket.fromBytes(data);
2823
2823
  default:
@@ -2864,22 +2864,22 @@ function buildOpReturnScript(data) {
2864
2864
  }
2865
2865
  return script;
2866
2866
  }
2867
- var ErrOffchainOutputNotFound = (address) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2868
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
2867
+ var ErrOffchainOutputNotFound = (address) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2868
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
2869
2869
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
2870
2870
  );
2871
- var ErrAssetGroupNotFound = (assetId) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2872
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
2871
+ var ErrAssetGroupNotFound = (assetId) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2872
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
2873
2873
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
2874
2874
  );
2875
- var ErrOnchainOutputNotFound = (address) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2876
- var ErrUnvalidatedOffchainOutput = (address) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
2875
+ var ErrOnchainOutputNotFound = (address) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2876
+ var ErrUnvalidatedOffchainOutput = (address) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
2877
2877
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2878
2878
  );
2879
- var ErrIntentOutputNotFound = (index, kind) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
2879
+ var ErrIntentOutputNotFound = (index, kind) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
2880
2880
  `${kind} output ${index} of the intent proof is not present in what the server built`
2881
2881
  );
2882
- var ErrUnvalidatedIntentOutput = (index) => new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
2882
+ var ErrUnvalidatedIntentOutput = (index) => new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
2883
2883
  `offchain output ${index} of the intent proof cannot be validated: virtual output tree signing did not run`
2884
2884
  );
2885
2885
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
@@ -2888,7 +2888,7 @@ var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain ou
2888
2888
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
2889
2889
  if (!validatedCommitmentTxid) return;
2890
2890
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
2891
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
2891
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
2892
2892
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
2893
2893
  );
2894
2894
  }
@@ -2898,7 +2898,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
2898
2898
  for (const recipient of recipients) {
2899
2899
  let arkAddress;
2900
2900
  try {
2901
- arkAddress = chunkUUSKJOSX_cjs.ArkAddress.decode(recipient.address);
2901
+ arkAddress = chunkXLHUGP3G_cjs.ArkAddress.decode(recipient.address);
2902
2902
  } catch {
2903
2903
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2904
2904
  continue;
@@ -2910,7 +2910,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2910
2910
  const usedOnchainOutputs = /* @__PURE__ */ new Set();
2911
2911
  for (const recipient of recipients) {
2912
2912
  try {
2913
- chunkUUSKJOSX_cjs.ArkAddress.decode(recipient.address);
2913
+ chunkXLHUGP3G_cjs.ArkAddress.decode(recipient.address);
2914
2914
  } catch {
2915
2915
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2916
2916
  continue;
@@ -2919,7 +2919,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2919
2919
  }
2920
2920
  }
2921
2921
  function declaredIntentOutputs(signedProof, onchainOutputIndexes) {
2922
- const proof = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2922
+ const proof = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2923
2923
  const onchain = new Set(onchainOutputIndexes);
2924
2924
  const declared = [];
2925
2925
  for (let i = 0; i < proof.outputsLength; i++) {
@@ -3211,7 +3211,7 @@ function assetMintResolver() {
3211
3211
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
3212
3212
  const minted = tx.assets.filter((a) => {
3213
3213
  try {
3214
- return base.hex.encode(chunkIQWLFYT2_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3214
+ return base.hex.encode(chunkHQNQ3CLQ_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3215
3215
  } catch {
3216
3216
  return false;
3217
3217
  }
@@ -3288,7 +3288,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3288
3288
  const existing = inputsByAssetId.get(asset.assetId);
3289
3289
  inputsByAssetId.set(asset.assetId, [
3290
3290
  ...existing ?? [],
3291
- chunkIQWLFYT2_cjs.AssetInput.create(inputIndex, asset.amount)
3291
+ chunkHQNQ3CLQ_cjs.AssetInput.create(inputIndex, asset.amount)
3292
3292
  ]);
3293
3293
  }
3294
3294
  }
@@ -3300,7 +3300,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3300
3300
  const existing = outputsByAssetId.get(asset.assetId);
3301
3301
  outputsByAssetId.set(asset.assetId, [
3302
3302
  ...existing ?? [],
3303
- chunkIQWLFYT2_cjs.AssetOutput.create(outputIndex, asset.amount)
3303
+ chunkHQNQ3CLQ_cjs.AssetOutput.create(outputIndex, asset.amount)
3304
3304
  ]);
3305
3305
  }
3306
3306
  }
@@ -3311,7 +3311,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3311
3311
  const existing = outputsByAssetId.get(asset.assetId);
3312
3312
  outputsByAssetId.set(asset.assetId, [
3313
3313
  ...existing ?? [],
3314
- chunkIQWLFYT2_cjs.AssetOutput.create(outputIndex, asset.amount)
3314
+ chunkHQNQ3CLQ_cjs.AssetOutput.create(outputIndex, asset.amount)
3315
3315
  ]);
3316
3316
  }
3317
3317
  }
@@ -3320,11 +3320,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3320
3320
  for (const assetIdStr of allAssetIds) {
3321
3321
  const inputs = inputsByAssetId.get(assetIdStr);
3322
3322
  const outputs = outputsByAssetId.get(assetIdStr);
3323
- const assetId = chunkIQWLFYT2_cjs.AssetId.fromString(assetIdStr);
3324
- const group = chunkIQWLFYT2_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3323
+ const assetId = chunkHQNQ3CLQ_cjs.AssetId.fromString(assetIdStr);
3324
+ const group = chunkHQNQ3CLQ_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3325
3325
  groups.push(group);
3326
3326
  }
3327
- return chunkIQWLFYT2_cjs.Packet.create(groups);
3327
+ return chunkHQNQ3CLQ_cjs.Packet.create(groups);
3328
3328
  }
3329
3329
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
3330
3330
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -3408,7 +3408,7 @@ function meetsInputExpiryFloor(coin, floor) {
3408
3408
  }
3409
3409
  function toXOnlySignerHex(pubkeyHex) {
3410
3410
  const bytes = base.hex.decode(pubkeyHex);
3411
- if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkGN2K4WBP_cjs.toXOnly(bytes, "signer key"));
3411
+ if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkGW42FS2X_cjs.toXOnly(bytes, "signer key"));
3412
3412
  throw new Error(`invalid signer pubkey length: expected 32 or 33 bytes, got ${bytes.length}`);
3413
3413
  }
3414
3414
  function signerSetFromInfo(info) {
@@ -3455,14 +3455,14 @@ var toTimelock = (value) => ({
3455
3455
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
3456
3456
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
3457
3457
  if (policy.requireSeconds && timelock.type === "blocks") {
3458
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3458
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3459
3459
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
3460
3460
  );
3461
3461
  }
3462
3462
  const seconds = toSeconds(timelock);
3463
3463
  if (seconds < policy.minSeconds) {
3464
3464
  const remedy = overrideOption ? `; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it` : "";
3465
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3465
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3466
3466
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor${remedy}`
3467
3467
  );
3468
3468
  }
@@ -3483,7 +3483,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
3483
3483
  }
3484
3484
  function assertValidBatchExpiry(batchExpiry, policy) {
3485
3485
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
3486
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3486
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3487
3487
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
3488
3488
  );
3489
3489
  }
@@ -3492,21 +3492,21 @@ function assertValidBatchExpiry(batchExpiry, policy) {
3492
3492
  function assertValidServerUnrollScript(checkpointTapscript, network, advertisedForfeitPubkey) {
3493
3493
  let script;
3494
3494
  try {
3495
- script = chunkUUSKJOSX_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3495
+ script = chunkXLHUGP3G_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3496
3496
  } catch (e) {
3497
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3497
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3498
3498
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
3499
3499
  );
3500
3500
  }
3501
3501
  if (advertisedForfeitPubkey !== void 0) {
3502
3502
  const { pubkeys } = script.params;
3503
3503
  if (pubkeys.length !== 1) {
3504
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3504
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3505
3505
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
3506
3506
  );
3507
3507
  }
3508
3508
  if (!utils_js.equalBytes(pubkeys[0], advertisedForfeitPubkey)) {
3509
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3509
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3510
3510
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(advertisedForfeitPubkey)}`
3511
3511
  );
3512
3512
  }
@@ -3549,8 +3549,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
3549
3549
  function buildVirtualTx(inputs, outputs) {
3550
3550
  let lockTime = 0n;
3551
3551
  for (const input of inputs) {
3552
- const tapscript = chunkUUSKJOSX_cjs.decodeTapscript(chunkUUSKJOSX_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3553
- if (chunkUUSKJOSX_cjs.CLTVMultisigTapscript.is(tapscript)) {
3552
+ const tapscript = chunkXLHUGP3G_cjs.decodeTapscript(chunkXLHUGP3G_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3553
+ if (chunkXLHUGP3G_cjs.CLTVMultisigTapscript.is(tapscript)) {
3554
3554
  if (lockTime !== 0n) {
3555
3555
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
3556
3556
  throw new Error("cannot mix seconds and blocks locktime");
@@ -3561,7 +3561,7 @@ function buildVirtualTx(inputs, outputs) {
3561
3561
  }
3562
3562
  }
3563
3563
  }
3564
- const tx = new chunkUUSKJOSX_cjs.Transaction({
3564
+ const tx = new chunkXLHUGP3G_cjs.Transaction({
3565
3565
  version: 3,
3566
3566
  lockTime: Number(lockTime)
3567
3567
  });
@@ -3571,12 +3571,12 @@ function buildVirtualTx(inputs, outputs) {
3571
3571
  index: input.vout,
3572
3572
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
3573
3573
  witnessUtxo: {
3574
- script: chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).pkScript,
3574
+ script: chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).pkScript,
3575
3575
  amount: BigInt(input.value)
3576
3576
  },
3577
3577
  tapLeafScript: [input.tapLeafScript]
3578
3578
  });
3579
- chunkUUSKJOSX_cjs.setArkPsbtField(tx, i, chunkUUSKJOSX_cjs.VtxoTaprootTree, input.tapTree);
3579
+ chunkXLHUGP3G_cjs.setArkPsbtField(tx, i, chunkXLHUGP3G_cjs.VtxoTaprootTree, input.tapTree);
3580
3580
  }
3581
3581
  for (const output of outputs) {
3582
3582
  tx.addOutput(output);
@@ -3587,8 +3587,8 @@ function buildVirtualTx(inputs, outputs) {
3587
3587
  return tx;
3588
3588
  }
3589
3589
  function buildCheckpointTx(vtxo, serverUnrollScript) {
3590
- const collaborativeClosure = chunkUUSKJOSX_cjs.decodeTapscript(chunkUUSKJOSX_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3591
- const checkpointVtxoScript = new chunkUUSKJOSX_cjs.VtxoScript([
3590
+ const collaborativeClosure = chunkXLHUGP3G_cjs.decodeTapscript(chunkXLHUGP3G_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3591
+ const checkpointVtxoScript = new chunkXLHUGP3G_cjs.VtxoScript([
3592
3592
  serverUnrollScript.script,
3593
3593
  collaborativeClosure.script
3594
3594
  ]);
@@ -3664,7 +3664,7 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
3664
3664
  const sighashType = signature.length === 65 ? signature[64] : btcSigner.SigHash.DEFAULT;
3665
3665
  const sig = signature.subarray(0, 64);
3666
3666
  if (!allowedSighashTypes.includes(sighashType)) {
3667
- const sighashName = chunkUUSKJOSX_cjs.formatSighash(sighashType);
3667
+ const sighashName = chunkXLHUGP3G_cjs.formatSighash(sighashType);
3668
3668
  throw new Error(
3669
3669
  `Unallowed sighash type ${sighashName} for input ${inputIndex}, pubkey ${pubKeyHex}.`
3670
3670
  );
@@ -3738,7 +3738,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
3738
3738
  }
3739
3739
  function isValidArkAddress(address) {
3740
3740
  try {
3741
- chunkUUSKJOSX_cjs.ArkAddress.decode(address);
3741
+ chunkXLHUGP3G_cjs.ArkAddress.decode(address);
3742
3742
  return true;
3743
3743
  } catch (e) {
3744
3744
  return false;
@@ -3746,16 +3746,16 @@ function isValidArkAddress(address) {
3746
3746
  }
3747
3747
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3748
3748
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3749
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3749
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3750
3750
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3751
3751
  );
3752
3752
  }
3753
3753
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3754
3754
  return serverCheckpointTxs.map((encoded, index) => {
3755
- const server = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3755
+ const server = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3756
3756
  const local = byTxid.get(server.id);
3757
3757
  if (!local) {
3758
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3758
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3759
3759
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3760
3760
  );
3761
3761
  }
@@ -3765,14 +3765,14 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3765
3765
  }
3766
3766
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3767
3767
  if (response.arkTxid !== signedArkTx.id) {
3768
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3768
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3769
3769
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3770
3770
  );
3771
3771
  }
3772
3772
  if (response.finalArkTx === void 0) return;
3773
- const finalTxid = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3773
+ const finalTxid = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3774
3774
  if (finalTxid !== signedArkTx.id) {
3775
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3775
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3776
3776
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3777
3777
  );
3778
3778
  }
@@ -3784,20 +3784,20 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3784
3784
  `${context}: input ${inputIndex} carries no spend leaf to verify the server signature against`
3785
3785
  );
3786
3786
  }
3787
- const script = chunkUUSKJOSX_cjs.scriptFromTapLeafScript(leaf);
3787
+ const script = chunkXLHUGP3G_cjs.scriptFromTapLeafScript(leaf);
3788
3788
  let leafPubkeys;
3789
3789
  try {
3790
- leafPubkeys = chunkUUSKJOSX_cjs.decodeTapscript(script).params.pubkeys.map(
3791
- (key) => base.hex.encode(chunkGN2K4WBP_cjs.toXOnly(key, "leaf key"))
3790
+ leafPubkeys = chunkXLHUGP3G_cjs.decodeTapscript(script).params.pubkeys.map(
3791
+ (key) => base.hex.encode(chunkGW42FS2X_cjs.toXOnly(key, "leaf key"))
3792
3792
  );
3793
3793
  } catch (error) {
3794
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3794
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3795
3795
  `${context}: input ${inputIndex} spend leaf cannot be decoded (${error instanceof Error ? error.message : String(error)})`
3796
3796
  );
3797
3797
  }
3798
3798
  const signer = leafPubkeys.find((key) => serverPubkeys.has(key));
3799
3799
  if (!signer) {
3800
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3800
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3801
3801
  `${context}: input ${inputIndex} spend leaf names no signer key the server advertises`
3802
3802
  );
3803
3803
  }
@@ -3811,7 +3811,7 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3811
3811
  payment_js.tapLeafHash(script)
3812
3812
  );
3813
3813
  } catch (error) {
3814
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3814
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3815
3815
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
3816
3816
  );
3817
3817
  }
@@ -3820,20 +3820,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3820
3820
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
3821
3821
  for (const [index, checkpoint] of checkpoints.entries()) {
3822
3822
  if (checkpoint.inputsLength !== 1) {
3823
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3823
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3824
3824
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
3825
3825
  );
3826
3826
  }
3827
3827
  const spent = checkpoint.getInput(0);
3828
3828
  if (!spent.txid || spent.index === void 0) {
3829
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3829
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3830
3830
  `${context}: checkpoint ${index} has no input outpoint`
3831
3831
  );
3832
3832
  }
3833
3833
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
3834
3834
  const input = byOutpoint.get(outpoint);
3835
3835
  if (!input) {
3836
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3836
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3837
3837
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
3838
3838
  );
3839
3839
  }
@@ -3841,7 +3841,7 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3841
3841
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
3842
3842
  );
3843
3843
  if (!rebuilt) {
3844
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3844
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3845
3845
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
3846
3846
  );
3847
3847
  }
@@ -3867,9 +3867,9 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3867
3867
  const matched = matchServerCheckpoints(signedCheckpointTxs, offchainTx.checkpoints, "submitTx");
3868
3868
  matched.forEach(({ server }, index) => {
3869
3869
  try {
3870
- chunkUUSKJOSX_cjs.assertAllowedSighashTypes(server);
3870
+ chunkXLHUGP3G_cjs.assertAllowedSighashTypes(server);
3871
3871
  } catch (error) {
3872
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3872
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3873
3873
  `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
3874
3874
  );
3875
3875
  }
@@ -3877,14 +3877,14 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3877
3877
  const verify = options?.verifyServerSignatures;
3878
3878
  if (verify) {
3879
3879
  if (response.finalArkTx === void 0) {
3880
- throw new chunkUUSKJOSX_cjs.ServerResponseMismatchError(
3880
+ throw new chunkXLHUGP3G_cjs.ServerResponseMismatchError(
3881
3881
  "submitTx: server returned no final ark tx to verify its signatures against"
3882
3882
  );
3883
3883
  }
3884
- const finalArkTx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3884
+ const finalArkTx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3885
3885
  const serverPubkeys = new Set(
3886
3886
  [verify.serverPubkey, ...verify.deprecatedServerPubkeys ?? []].map(
3887
- (key) => base.hex.encode(chunkGN2K4WBP_cjs.toXOnly(key, "server key"))
3887
+ (key) => base.hex.encode(chunkGW42FS2X_cjs.toXOnly(key, "server key"))
3888
3888
  )
3889
3889
  );
3890
3890
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
@@ -3948,7 +3948,7 @@ async function submitViaEmulator(emulator, offchainTx, signer, opts) {
3948
3948
  base.base64.encode(arkTx.toPSBT()),
3949
3949
  checkpoints.map((c) => base.base64.encode(c.toPSBT()))
3950
3950
  );
3951
- const txid = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(res.signedArkTx)).id;
3951
+ const txid = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(res.signedArkTx)).id;
3952
3952
  assertSubmittedArkTxid({ arkTxid: txid }, arkTx, "emulator submitTx");
3953
3953
  return { txid, signedArkTx: res.signedArkTx, signedCheckpointTxs: res.signedCheckpointTxs };
3954
3954
  }
@@ -3956,12 +3956,12 @@ function claimWithPreimageIdentity(identity, preimage) {
3956
3956
  return {
3957
3957
  ...identity,
3958
3958
  sign: async (tx, inputIndexes) => {
3959
- const signed = chunkUUSKJOSX_cjs.Transaction.fromPSBT(
3959
+ const signed = chunkXLHUGP3G_cjs.Transaction.fromPSBT(
3960
3960
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
3961
3961
  );
3962
3962
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
3963
3963
  for (const index of indexes) {
3964
- chunkUUSKJOSX_cjs.setArkPsbtField(signed, index, chunkUUSKJOSX_cjs.ConditionWitness, [preimage]);
3964
+ chunkXLHUGP3G_cjs.setArkPsbtField(signed, index, chunkXLHUGP3G_cjs.ConditionWitness, [preimage]);
3965
3965
  }
3966
3966
  return signed;
3967
3967
  }
@@ -4144,7 +4144,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
4144
4144
  };
4145
4145
  }
4146
4146
  function deriveContractTapscripts(contract) {
4147
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
4147
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
4148
4148
  if (!handler) {
4149
4149
  throw new Error(`No handler for contract type '${contract.type}'`);
4150
4150
  }
@@ -4247,7 +4247,7 @@ function assertRecipientArkadeAddress(encoded, address, context) {
4247
4247
  function assertTapTreeDerivesAddress(encoded, tapTree, address) {
4248
4248
  let derived;
4249
4249
  try {
4250
- derived = chunkUUSKJOSX_cjs.VtxoScript.decode(tapTree).pkScript;
4250
+ derived = chunkXLHUGP3G_cjs.VtxoScript.decode(tapTree).pkScript;
4251
4251
  } catch (e) {
4252
4252
  throw new Error(
4253
4253
  `Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
@@ -4264,7 +4264,7 @@ function validateRecipients(recipients, dustAmount, context) {
4264
4264
  for (const recipient of recipients) {
4265
4265
  let address;
4266
4266
  try {
4267
- address = chunkUUSKJOSX_cjs.ArkAddress.decode(recipient.address);
4267
+ address = chunkXLHUGP3G_cjs.ArkAddress.decode(recipient.address);
4268
4268
  } catch (e) {
4269
4269
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
4270
4270
  }
@@ -4289,7 +4289,7 @@ function validateRecipients(recipients, dustAmount, context) {
4289
4289
 
4290
4290
  // src/contracts/spendability.ts
4291
4291
  function isContractGenericallySpendable(contract) {
4292
- return chunkGN2K4WBP_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
4292
+ return chunkGW42FS2X_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
4293
4293
  }
4294
4294
  function gatedContracts(contracts) {
4295
4295
  const gated = /* @__PURE__ */ new Map();
@@ -4311,7 +4311,7 @@ function gateExclusion(gated) {
4311
4311
  return (vtxo) => {
4312
4312
  const type = gatedTypeOf(vtxo, gated);
4313
4313
  if (type === void 0) return void 0;
4314
- if (!chunkGN2K4WBP_cjs.contractHandlers.has(type)) {
4314
+ if (!chunkGW42FS2X_cjs.contractHandlers.has(type)) {
4315
4315
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
4316
4316
  }
4317
4317
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -4347,7 +4347,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
4347
4347
  continue;
4348
4348
  }
4349
4349
  for (const v of vtxos) {
4350
- if (!chunkUUSKJOSX_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
4350
+ if (!chunkXLHUGP3G_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
4351
4351
  out.add(`${v.txid}:${v.vout}`);
4352
4352
  }
4353
4353
  }
@@ -4383,14 +4383,14 @@ function byValueDescending(vtxos) {
4383
4383
  return [...vtxos].sort((a, b) => b.value - a.value);
4384
4384
  }
4385
4385
  async function fetchTimeHeight(wallet) {
4386
- return chunkUUSKJOSX_cjs.resolveTimeHeight(wallet.onchainProvider);
4386
+ return chunkXLHUGP3G_cjs.resolveTimeHeight(wallet.onchainProvider);
4387
4387
  }
4388
4388
  function heldVtxosOf(wallet) {
4389
4389
  const held = wallet.getHeldVtxos;
4390
4390
  return typeof held === "function" ? held.call(wallet) : Promise.resolve([]);
4391
4391
  }
4392
4392
  function canMigrateBySend(vtxo, now) {
4393
- if (!chunkUUSKJOSX_cjs.canSpendOffchain(vtxo, now)) return false;
4393
+ if (!chunkXLHUGP3G_cjs.canSpendOffchain(vtxo, now)) return false;
4394
4394
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
4395
4395
  }
4396
4396
  function byExpiryAscending(vtxos, now) {
@@ -4398,7 +4398,7 @@ function byExpiryAscending(vtxos, now) {
4398
4398
  if (vtxo.isSwept) return -Infinity;
4399
4399
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
4400
4400
  if (vtxo.expiresAtHeight !== void 0) {
4401
- return chunkUUSKJOSX_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4401
+ return chunkXLHUGP3G_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4402
4402
  }
4403
4403
  return Infinity;
4404
4404
  };
@@ -4425,7 +4425,7 @@ function priceSettlementInputs(vtxos, estimator) {
4425
4425
  const payable = [];
4426
4426
  const net = /* @__PURE__ */ new Map();
4427
4427
  for (const vtxo of vtxos) {
4428
- const inputFee = estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(vtxo));
4428
+ const inputFee = estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(vtxo));
4429
4429
  if (inputFee.satoshis >= vtxo.value) {
4430
4430
  continue;
4431
4431
  }
@@ -4454,7 +4454,7 @@ function offchainOutputFee(amount, estimator, arkAddress) {
4454
4454
  }
4455
4455
  const outputFee = estimator.evalOffchainOutput({
4456
4456
  amount,
4457
- script: base.hex.encode(chunkUUSKJOSX_cjs.ArkAddress.decode(arkAddress).pkScript)
4457
+ script: base.hex.encode(chunkXLHUGP3G_cjs.ArkAddress.decode(arkAddress).pkScript)
4458
4458
  });
4459
4459
  return BigInt(outputFee.satoshis);
4460
4460
  }
@@ -4505,10 +4505,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
4505
4505
  };
4506
4506
  function getRecoverableVtxos(vtxos, dustAmount, now) {
4507
4507
  return vtxos.filter((vtxo) => {
4508
- if (chunkUUSKJOSX_cjs.canRecoverOnchain(vtxo, now)) {
4508
+ if (chunkXLHUGP3G_cjs.canRecoverOnchain(vtxo, now)) {
4509
4509
  return true;
4510
4510
  }
4511
- if (chunkUUSKJOSX_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4511
+ if (chunkXLHUGP3G_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4512
4512
  return true;
4513
4513
  }
4514
4514
  return false;
@@ -4540,7 +4540,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
4540
4540
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
4541
4541
  if (vtxo.isUnrolled) return false;
4542
4542
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
4543
- const expiresAt = chunkUUSKJOSX_cjs.normalizeVtxo(vtxo).expiresAt;
4543
+ const expiresAt = chunkXLHUGP3G_cjs.normalizeVtxo(vtxo).expiresAt;
4544
4544
  if (expiresAt === void 0) return false;
4545
4545
  const now = Date.now();
4546
4546
  const batchExpiry = expiresAt.getTime();
@@ -4551,7 +4551,7 @@ function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
4551
4551
  return vtxos.filter(
4552
4552
  // The leading exclusion covers the `isSubdust` arm too, which is a value
4553
4553
  // property and would otherwise re-admit an exited coin on its own.
4554
- (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkUUSKJOSX_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4554
+ (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkXLHUGP3G_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4555
4555
  );
4556
4556
  }
4557
4557
  function isMigrationCapable(wallet) {
@@ -4611,7 +4611,7 @@ var VtxoManager = class _VtxoManager {
4611
4611
  constructor(wallet, settlementConfig) {
4612
4612
  this.wallet = wallet;
4613
4613
  if (settlementConfig !== false) {
4614
- chunkUUSKJOSX_cjs.assertTimerMs("pollIntervalMs", settlementConfig?.pollIntervalMs);
4614
+ chunkXLHUGP3G_cjs.assertTimerMs("pollIntervalMs", settlementConfig?.pollIntervalMs);
4615
4615
  }
4616
4616
  this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
4617
4617
  this.contractEventsSubscriptionReady = this.initializeSubscription();
@@ -4918,7 +4918,7 @@ var VtxoManager = class _VtxoManager {
4918
4918
  * {@link recoverImportedContracts}).
4919
4919
  */
4920
4920
  async recoverOneImportedContract(wallet, contract, vtxos, info, dustAmount) {
4921
- const recoverable = vtxos.filter((vtxo) => vtxo.isSwept && !chunkUUSKJOSX_cjs.isVtxoSpent(vtxo));
4921
+ const recoverable = vtxos.filter((vtxo) => vtxo.isSwept && !chunkXLHUGP3G_cjs.isVtxoSpent(vtxo));
4922
4922
  const estimator = new Estimator(info?.fees.intentFee ?? {});
4923
4923
  const { payable, net } = priceSettlementInputs(recoverable, estimator);
4924
4924
  const vtxoMaxAmount = info?.vtxoMaxAmount ?? -1n;
@@ -4940,7 +4940,7 @@ var VtxoManager = class _VtxoManager {
4940
4940
  if (vtxos.length === 0) return;
4941
4941
  const spent = new Set(batch.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
4942
4942
  const stillSpendable = vtxos.some(
4943
- (vtxo) => !chunkUUSKJOSX_cjs.isVtxoSpent(vtxo) && !spent.has(`${vtxo.txid}:${vtxo.vout}`)
4943
+ (vtxo) => !chunkXLHUGP3G_cjs.isVtxoSpent(vtxo) && !spent.has(`${vtxo.txid}:${vtxo.vout}`)
4944
4944
  );
4945
4945
  if (!stillSpendable) {
4946
4946
  await wallet.removeRecoveryContract(contract.script);
@@ -5232,11 +5232,11 @@ var VtxoManager = class _VtxoManager {
5232
5232
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
5233
5233
  );
5234
5234
  }
5235
- const tx = new chunkUUSKJOSX_cjs.Transaction();
5235
+ const tx = new chunkXLHUGP3G_cjs.Transaction();
5236
5236
  for (const utxo of expiredUtxos) {
5237
- const utxoScript = chunkUUSKJOSX_cjs.VtxoScript.decode(utxo.tapTree);
5237
+ const utxoScript = chunkXLHUGP3G_cjs.VtxoScript.decode(utxo.tapTree);
5238
5238
  const utxoExitLeaf = utxoScript.leaves.find(
5239
- (leaf) => chunkUUSKJOSX_cjs.CSVMultisigTapscript.isScriptValid(chunkUUSKJOSX_cjs.scriptFromTapLeafScript(leaf)) === true
5239
+ (leaf) => chunkXLHUGP3G_cjs.CSVMultisigTapscript.isScriptValid(chunkXLHUGP3G_cjs.scriptFromTapLeafScript(leaf)) === true
5240
5240
  );
5241
5241
  if (!utxoExitLeaf) {
5242
5242
  throw new Error(
@@ -5251,7 +5251,7 @@ var VtxoManager = class _VtxoManager {
5251
5251
  amount: BigInt(utxo.value)
5252
5252
  },
5253
5253
  tapLeafScript: [utxoExitLeaf],
5254
- sequence: chunkUUSKJOSX_cjs.getSequence(utxoExitLeaf)
5254
+ sequence: chunkXLHUGP3G_cjs.getSequence(utxoExitLeaf)
5255
5255
  });
5256
5256
  }
5257
5257
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -5477,8 +5477,8 @@ var VtxoManager = class _VtxoManager {
5477
5477
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
5478
5478
  if (cls.status === "CURRENT") continue;
5479
5479
  const live = vtxos.filter((v) => !v.isUnrolled);
5480
- const recoverable = live.filter((v) => v.isSwept && !chunkUUSKJOSX_cjs.isVtxoSpent(v));
5481
- const spendable = live.filter((v) => !chunkUUSKJOSX_cjs.isVtxoSpent(v) && !v.isSwept);
5480
+ const recoverable = live.filter((v) => v.isSwept && !chunkXLHUGP3G_cjs.isVtxoSpent(v));
5481
+ const spendable = live.filter((v) => !chunkXLHUGP3G_cjs.isVtxoSpent(v) && !v.isSwept);
5482
5482
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
5483
5483
  let recoverableCount = 0;
5484
5484
  let recoverableValue = 0;
@@ -5718,7 +5718,7 @@ var VtxoManager = class _VtxoManager {
5718
5718
  }
5719
5719
  getBoardingTimelock() {
5720
5720
  const wallet = this.getSweepWallet();
5721
- const exitScript = chunkUUSKJOSX_cjs.CSVMultisigTapscript.decode(
5721
+ const exitScript = chunkXLHUGP3G_cjs.CSVMultisigTapscript.decode(
5722
5722
  base.hex.decode(wallet.boardingTapscript.exitScript)
5723
5723
  );
5724
5724
  return exitScript.params.timelock;
@@ -5826,8 +5826,8 @@ var VtxoManager = class _VtxoManager {
5826
5826
  }
5827
5827
  /** The outpoint a `VTXO_ALREADY_SPENT` error carries in `metadata.vtxo_outpoint`, if any. */
5828
5828
  extractSpentOutpoint(error) {
5829
- const ark = chunkUUSKJOSX_cjs.maybeArkError(error);
5830
- if (!chunkUUSKJOSX_cjs.isArkError(ark, chunkUUSKJOSX_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5829
+ const ark = chunkXLHUGP3G_cjs.maybeArkError(error);
5830
+ if (!chunkXLHUGP3G_cjs.isArkError(ark, chunkXLHUGP3G_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5831
5831
  const raw = ark.metadata?.vtxo_outpoint;
5832
5832
  if (typeof raw !== "string") return void 0;
5833
5833
  const [txid, voutStr] = raw.split(":");
@@ -6001,7 +6001,7 @@ var VtxoManager = class _VtxoManager {
6001
6001
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
6002
6002
  break;
6003
6003
  }
6004
- const inputFee = estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(v));
6004
+ const inputFee = estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(v));
6005
6005
  if (inputFee.satoshis >= v.value) {
6006
6006
  continue;
6007
6007
  }
@@ -6021,7 +6021,7 @@ var VtxoManager = class _VtxoManager {
6021
6021
  const arkAddress = await this.wallet.getAddress();
6022
6022
  const outputFee = estimator.evalOffchainOutput({
6023
6023
  amount: totalAmount,
6024
- script: base.hex.encode(chunkUUSKJOSX_cjs.ArkAddress.decode(arkAddress).pkScript)
6024
+ script: base.hex.encode(chunkXLHUGP3G_cjs.ArkAddress.decode(arkAddress).pkScript)
6025
6025
  });
6026
6026
  totalAmount -= BigInt(outputFee.satoshis);
6027
6027
  if (totalAmount < dustAmount) return;
@@ -6105,7 +6105,7 @@ var ArkNote = class _ArkNote {
6105
6105
  this.value = value;
6106
6106
  this.HRP = HRP;
6107
6107
  const preimageHash = utils_js.sha256(this.preimage);
6108
- this.vtxoScript = new chunkUUSKJOSX_cjs.VtxoScript([noteTapscript(preimageHash)]);
6108
+ this.vtxoScript = new chunkXLHUGP3G_cjs.VtxoScript([noteTapscript(preimageHash)]);
6109
6109
  const leaf = this.vtxoScript.leaves[0];
6110
6110
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
6111
6111
  this.tapTree = this.vtxoScript.encode();
@@ -6278,7 +6278,7 @@ var ArkadeCash = class _ArkadeCash {
6278
6278
  const privateKey = data.slice(1, 33);
6279
6279
  const serverPubKey = data.slice(33, 65);
6280
6280
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
6281
- const csvTimelock2 = chunkUUSKJOSX_cjs.sequenceToTimelock(sequence);
6281
+ const csvTimelock2 = chunkXLHUGP3G_cjs.sequenceToTimelock(sequence);
6282
6282
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock2, decoded.prefix);
6283
6283
  }
6284
6284
  toString() {
@@ -6286,7 +6286,7 @@ var ArkadeCash = class _ArkadeCash {
6286
6286
  data[0] = _ArkadeCash.Version;
6287
6287
  data.set(this._privateKey, 1);
6288
6288
  data.set(this._serverPubKey, 33);
6289
- const sequence = chunkUUSKJOSX_cjs.timelockToSequence(this.csvTimelock);
6289
+ const sequence = chunkXLHUGP3G_cjs.timelockToSequence(this.csvTimelock);
6290
6290
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
6291
6291
  const words = base.bech32m.toWords(data);
6292
6292
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -6295,7 +6295,7 @@ var ArkadeCash = class _ArkadeCash {
6295
6295
  return SingleKey.fromPrivateKey(this._privateKey);
6296
6296
  }
6297
6297
  get vtxoScript() {
6298
- return new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
6298
+ return new chunkGW42FS2X_cjs.DefaultVtxo.Script({
6299
6299
  pubKey: this._publicKey,
6300
6300
  serverPubKey: this._serverPubKey,
6301
6301
  csvTimelock: this.csvTimelock
@@ -6311,7 +6311,7 @@ var NON_TERMINAL_INTENT_STATES = ALL_INTENT_STATES.filter(
6311
6311
  (s) => !isTerminalIntentState(s)
6312
6312
  );
6313
6313
  function isConsumed(vtxo) {
6314
- return vtxo !== void 0 && chunkUUSKJOSX_cjs.isVtxoSpent(vtxo);
6314
+ return vtxo !== void 0 && chunkXLHUGP3G_cjs.isVtxoSpent(vtxo);
6315
6315
  }
6316
6316
  async function classifyIntent(intent, vtxosByOutpoint, now) {
6317
6317
  if (isTerminalIntentState(intent.state)) return void 0;
@@ -6354,7 +6354,7 @@ async function reconcileIntents(deps) {
6354
6354
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
6355
6355
  if (outpoints.length > 0) {
6356
6356
  try {
6357
- const { vtxos } = await chunkUUSKJOSX_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
6357
+ const { vtxos } = await chunkXLHUGP3G_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
6358
6358
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
6359
6359
  } catch (e) {
6360
6360
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -6414,7 +6414,7 @@ async function releaseFromServer(intent, deps, now) {
6414
6414
  });
6415
6415
  }
6416
6416
  function isNoMatchingIntentsError(e) {
6417
- return chunkUUSKJOSX_cjs.isArkError(e, chunkUUSKJOSX_cjs.ArkErrorName.INVALID_INTENT_PROOF) && e.message.includes("no matching intents found");
6417
+ return chunkXLHUGP3G_cjs.isArkError(e, chunkXLHUGP3G_cjs.ArkErrorName.INVALID_INTENT_PROOF) && e.message.includes("no matching intents found");
6418
6418
  }
6419
6419
  function terminal(intent, state, now, patch) {
6420
6420
  return { ...intent, ...patch, state, updatedAt: now };
@@ -6633,7 +6633,7 @@ async function captureExitBranch(params) {
6633
6633
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
6634
6634
  if (nonCommitment.length > 0) {
6635
6635
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
6636
- psbtByTxid.set(chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6636
+ psbtByTxid.set(chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6637
6637
  }
6638
6638
  }
6639
6639
  }
@@ -6676,10 +6676,10 @@ var IndexerExitDataSource = class {
6676
6676
  while (hasMore) {
6677
6677
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
6678
6678
  { txid: vtxo.txid, vout: vtxo.vout },
6679
- { pageIndex, pageSize: chunkUUSKJOSX_cjs.DEFAULT_PAGE_SIZE }
6679
+ { pageIndex, pageSize: chunkXLHUGP3G_cjs.DEFAULT_PAGE_SIZE }
6680
6680
  );
6681
6681
  chain.push(...page);
6682
- hasMore = meta ? page.length === chunkUUSKJOSX_cjs.DEFAULT_PAGE_SIZE : false;
6682
+ hasMore = meta ? page.length === chunkXLHUGP3G_cjs.DEFAULT_PAGE_SIZE : false;
6683
6683
  pageIndex++;
6684
6684
  }
6685
6685
  return chain;
@@ -6691,12 +6691,12 @@ var IndexerExitDataSource = class {
6691
6691
  while (hasMore) {
6692
6692
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
6693
6693
  pageIndex,
6694
- pageSize: chunkUUSKJOSX_cjs.DEFAULT_PAGE_SIZE
6694
+ pageSize: chunkXLHUGP3G_cjs.DEFAULT_PAGE_SIZE
6695
6695
  });
6696
6696
  for (const psbt of txs) {
6697
- out.set(chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6697
+ out.set(chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6698
6698
  }
6699
- hasMore = page ? txs.length === chunkUUSKJOSX_cjs.DEFAULT_PAGE_SIZE : false;
6699
+ hasMore = page ? txs.length === chunkXLHUGP3G_cjs.DEFAULT_PAGE_SIZE : false;
6700
6700
  pageIndex++;
6701
6701
  }
6702
6702
  return out;
@@ -6717,7 +6717,7 @@ function chainedTxTypeToChainTxType(t) {
6717
6717
  }
6718
6718
  }
6719
6719
  function psbtInputTxids(psbtBase64) {
6720
- return txInputTxids(chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
6720
+ return txInputTxids(chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
6721
6721
  }
6722
6722
  function txInputTxids(tx) {
6723
6723
  const ids = [];
@@ -7021,10 +7021,10 @@ async function resolveArkInfo(arkProvider, walletRepository, opts) {
7021
7021
  try {
7022
7022
  info = await arkProvider.getInfo();
7023
7023
  } catch (err) {
7024
- if (opts?.requireLive || !chunkUUSKJOSX_cjs.isRetryableProviderError(err)) throw err;
7024
+ if (opts?.requireLive || !chunkXLHUGP3G_cjs.isRetryableProviderError(err)) throw err;
7025
7025
  const snapshot = await loadArkInfoSnapshot(walletRepository);
7026
7026
  if (!snapshot) {
7027
- throw new chunkUUSKJOSX_cjs.ProviderUnavailableError(
7027
+ throw new chunkXLHUGP3G_cjs.ProviderUnavailableError(
7028
7028
  "Arkade server info is unavailable and no cached snapshot exists",
7029
7029
  { cause: err }
7030
7030
  );
@@ -7216,7 +7216,7 @@ function buildGraph(rootTxid, chunksByTxid) {
7216
7216
  return new TxTree(rootTx, children);
7217
7217
  }
7218
7218
  function decodeNode(chunk) {
7219
- const tx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(chunk.tx));
7219
+ const tx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(chunk.tx));
7220
7220
  return { tx, children: chunk.children };
7221
7221
  }
7222
7222
  exports.Batch = void 0;
@@ -7419,7 +7419,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos, localCreatedAt) {
7419
7419
  return [...txids];
7420
7420
  }
7421
7421
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt, gatedScripts = /* @__PURE__ */ new Map()) {
7422
- const normalized = vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7422
+ const normalized = vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7423
7423
  const localCreatedAt = localCreatedAtByTxid(normalized);
7424
7424
  const gatedVtxos = normalized.filter((vtxo) => isGatedVtxo(vtxo, gatedScripts));
7425
7425
  const ownVtxos = normalized.filter((vtxo) => !isGatedVtxo(vtxo, gatedScripts));
@@ -7597,7 +7597,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7597
7597
  withRecoverable: false,
7598
7598
  genericallySpendableOnly: true
7599
7599
  });
7600
- const controlAssetRef = params.controlAssetId ? chunkIQWLFYT2_cjs.AssetRef.fromId(chunkIQWLFYT2_cjs.AssetId.fromString(params.controlAssetId)) : null;
7600
+ const controlAssetRef = params.controlAssetId ? chunkHQNQ3CLQ_cjs.AssetRef.fromId(chunkHQNQ3CLQ_cjs.AssetId.fromString(params.controlAssetId)) : null;
7601
7601
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
7602
7602
  let totalBtcSelected = 0n;
7603
7603
  const assetChanges = /* @__PURE__ */ new Map();
@@ -7610,8 +7610,8 @@ var AssetManager = class extends ReadonlyAssetManager {
7610
7610
  }
7611
7611
  }
7612
7612
  const groups = [];
7613
- const issuedAssetOutput = chunkIQWLFYT2_cjs.AssetOutput.create(0, params.amount);
7614
- const issuedAssetGroup = chunkIQWLFYT2_cjs.AssetGroup.create(
7613
+ const issuedAssetOutput = chunkHQNQ3CLQ_cjs.AssetOutput.create(0, params.amount);
7614
+ const issuedAssetGroup = chunkHQNQ3CLQ_cjs.AssetGroup.create(
7615
7615
  null,
7616
7616
  controlAssetRef,
7617
7617
  [],
@@ -7624,11 +7624,11 @@ var AssetManager = class extends ReadonlyAssetManager {
7624
7624
  for (const [assetId, amount] of assetChanges) {
7625
7625
  const changeInputs = inputsForAsset(assetInputs, assetId);
7626
7626
  groups.push(
7627
- chunkIQWLFYT2_cjs.AssetGroup.create(
7628
- chunkIQWLFYT2_cjs.AssetId.fromString(assetId),
7627
+ chunkHQNQ3CLQ_cjs.AssetGroup.create(
7628
+ chunkHQNQ3CLQ_cjs.AssetId.fromString(assetId),
7629
7629
  null,
7630
7630
  changeInputs,
7631
- [chunkIQWLFYT2_cjs.AssetOutput.create(0, amount)],
7631
+ [chunkHQNQ3CLQ_cjs.AssetOutput.create(0, amount)],
7632
7632
  []
7633
7633
  )
7634
7634
  );
@@ -7643,7 +7643,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7643
7643
  );
7644
7644
  return {
7645
7645
  arkTxId: arkTxid,
7646
- assetId: chunkIQWLFYT2_cjs.AssetId.create(arkTxid, 0).toString()
7646
+ assetId: chunkHQNQ3CLQ_cjs.AssetId.create(arkTxid, 0).toString()
7647
7647
  };
7648
7648
  }
7649
7649
  /**
@@ -7717,23 +7717,23 @@ var AssetManager = class extends ReadonlyAssetManager {
7717
7717
  const assetInputs = selectedCoinsToAssetInputs(selectedCoins);
7718
7718
  const reissueInputs = inputsForAsset(assetInputs, params.assetId);
7719
7719
  const totalAssetAmount = assetToReissueAmount + params.amount;
7720
- const reissueAssetIdObj = chunkIQWLFYT2_cjs.AssetId.fromString(params.assetId);
7721
- const reissueAssetGroup = chunkIQWLFYT2_cjs.AssetGroup.create(
7720
+ const reissueAssetIdObj = chunkHQNQ3CLQ_cjs.AssetId.fromString(params.assetId);
7721
+ const reissueAssetGroup = chunkHQNQ3CLQ_cjs.AssetGroup.create(
7722
7722
  reissueAssetIdObj,
7723
7723
  null,
7724
7724
  reissueInputs,
7725
- [chunkIQWLFYT2_cjs.AssetOutput.create(0, totalAssetAmount)],
7725
+ [chunkHQNQ3CLQ_cjs.AssetOutput.create(0, totalAssetAmount)],
7726
7726
  []
7727
7727
  );
7728
7728
  const groups = [reissueAssetGroup];
7729
7729
  for (const [assetId, amount] of assetChanges) {
7730
7730
  const changeInputs = inputsForAsset(assetInputs, assetId);
7731
7731
  groups.push(
7732
- chunkIQWLFYT2_cjs.AssetGroup.create(
7733
- chunkIQWLFYT2_cjs.AssetId.fromString(assetId),
7732
+ chunkHQNQ3CLQ_cjs.AssetGroup.create(
7733
+ chunkHQNQ3CLQ_cjs.AssetId.fromString(assetId),
7734
7734
  null,
7735
7735
  changeInputs,
7736
- [chunkIQWLFYT2_cjs.AssetOutput.create(0, amount)],
7736
+ [chunkHQNQ3CLQ_cjs.AssetOutput.create(0, amount)],
7737
7737
  []
7738
7738
  )
7739
7739
  );
@@ -7804,11 +7804,11 @@ var AssetManager = class extends ReadonlyAssetManager {
7804
7804
  for (const [assetId, amount] of assetChanges) {
7805
7805
  const changeInputs = inputsForAsset(assetInputs, assetId);
7806
7806
  groups.push(
7807
- chunkIQWLFYT2_cjs.AssetGroup.create(
7808
- chunkIQWLFYT2_cjs.AssetId.fromString(assetId),
7807
+ chunkHQNQ3CLQ_cjs.AssetGroup.create(
7808
+ chunkHQNQ3CLQ_cjs.AssetId.fromString(assetId),
7809
7809
  null,
7810
7810
  changeInputs,
7811
- amount > 0n ? [chunkIQWLFYT2_cjs.AssetOutput.create(0, amount)] : [],
7811
+ amount > 0n ? [chunkHQNQ3CLQ_cjs.AssetOutput.create(0, amount)] : [],
7812
7812
  []
7813
7813
  )
7814
7814
  );
@@ -7821,16 +7821,16 @@ function inputsForAsset(assetInputs, assetId) {
7821
7821
  for (const [inputIndex, assets] of assetInputs) {
7822
7822
  for (const asset of assets) {
7823
7823
  if (asset.assetId !== assetId) continue;
7824
- inputs.push(chunkIQWLFYT2_cjs.AssetInput.create(inputIndex, asset.amount));
7824
+ inputs.push(chunkHQNQ3CLQ_cjs.AssetInput.create(inputIndex, asset.amount));
7825
7825
  }
7826
7826
  }
7827
7827
  return inputs;
7828
7828
  }
7829
7829
  async function submitToSelf(submit, wallet, inputs, amount, groups) {
7830
- const outputAddress = chunkUUSKJOSX_cjs.ArkAddress.decode(await wallet.getAddress());
7830
+ const outputAddress = chunkXLHUGP3G_cjs.ArkAddress.decode(await wallet.getAddress());
7831
7831
  const outputs = [
7832
7832
  { script: outputAddress.pkScript, amount: BigInt(amount) },
7833
- Extension.create([chunkIQWLFYT2_cjs.Packet.create(groups)]).txOut()
7833
+ Extension.create([chunkHQNQ3CLQ_cjs.Packet.create(groups)]).txOut()
7834
7834
  ];
7835
7835
  const { arkTxid } = await submit(inputs, outputs);
7836
7836
  return arkTxid;
@@ -7854,7 +7854,7 @@ function castMetadata(metadata) {
7854
7854
  } else {
7855
7855
  throw new Error("Invalid metadata value type");
7856
7856
  }
7857
- md.push(chunkIQWLFYT2_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7857
+ md.push(chunkHQNQ3CLQ_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7858
7858
  }
7859
7859
  return md;
7860
7860
  }
@@ -7875,10 +7875,10 @@ var DelegateManagerImpl = class {
7875
7875
  if (vtxos.length === 0) {
7876
7876
  return { delegated: [], failed: [] };
7877
7877
  }
7878
- const destinationScript = chunkUUSKJOSX_cjs.ArkAddress.decode(destination).pkScript;
7878
+ const destinationScript = chunkXLHUGP3G_cjs.ArkAddress.decode(destination).pkScript;
7879
7879
  const arkInfo = await this.arkInfoProvider.getInfo();
7880
7880
  const delegateInfo = await this.delegateProvider.getDelegateInfo();
7881
- const eligible = vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo).filter(
7881
+ const eligible = vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo).filter(
7882
7882
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
7883
7883
  );
7884
7884
  if (eligible.length === 0) {
@@ -7910,7 +7910,7 @@ var DelegateManagerImpl = class {
7910
7910
  const groupByExpiry = /* @__PURE__ */ new Map();
7911
7911
  let recoverableVtxos = [];
7912
7912
  for (const vtxo of eligible) {
7913
- if (chunkUUSKJOSX_cjs.canRecoverOnchain(vtxo, now)) {
7913
+ if (chunkXLHUGP3G_cjs.canRecoverOnchain(vtxo, now)) {
7914
7914
  recoverableVtxos.push(vtxo);
7915
7915
  continue;
7916
7916
  }
@@ -7962,34 +7962,27 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7962
7962
  }
7963
7963
  if (!delegateAt) {
7964
7964
  const now = { timestamp: /* @__PURE__ */ new Date() };
7965
- const expiryTimestamp = vtxos.filter((coin) => !chunkUUSKJOSX_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
7965
+ const expiryTimestamp = vtxos.filter((coin) => !chunkXLHUGP3G_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
7966
7966
  (min, coin) => Math.min(min, coin.expiresAt.getTime()),
7967
7967
  Number.MAX_SAFE_INTEGER
7968
7968
  );
7969
7969
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
7970
7970
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7971
7971
  } else {
7972
- delegateAt = defaultDelegateAt(expiryTimestamp, arkInfo.sessionDuration);
7972
+ const nowMs = now.timestamp.getTime();
7973
+ const target = expiryTimestamp - Number(arkInfo.sessionDuration * 3000n);
7974
+ delegateAt = new Date(
7975
+ target > nowMs ? target : expiryTimestamp > nowMs ? nowMs + 2e3 : nowMs + 6e4
7976
+ );
7973
7977
  }
7974
7978
  }
7975
7979
  const { fees, dust, forfeitAddress, network } = arkInfo;
7976
7980
  const delegateAtSeconds = delegateAt.getTime() / 1e3;
7977
- const estimator = new Estimator({
7978
- ...fees.intentFee,
7979
- // replace now() function with the delegateAt timestamp
7980
- offchainInput: fees.intentFee.offchainInput?.replace(
7981
- "now()",
7982
- `double(${delegateAtSeconds})`
7983
- ),
7984
- offchainOutput: fees.intentFee.offchainOutput?.replace(
7985
- "now()",
7986
- `double(${delegateAtSeconds})`
7987
- )
7988
- });
7981
+ const estimator = estimatorAt(fees.intentFee, delegateAt);
7989
7982
  let amount = 0n;
7990
7983
  for (const coin of vtxos) {
7991
7984
  const inputFee = estimator.evalOffchainInput({
7992
- ...chunkUUSKJOSX_cjs.toOffchainInputFeeParams(coin),
7985
+ ...chunkXLHUGP3G_cjs.toOffchainInputFeeParams(coin),
7993
7986
  type: "vtxo"
7994
7987
  });
7995
7988
  if (inputFee.satoshis >= coin.value) {
@@ -8003,7 +7996,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8003
7996
  const delegateFee = BigInt(Number(fee));
8004
7997
  if (delegateFee > 0n) {
8005
7998
  outputs.push({
8006
- script: chunkUUSKJOSX_cjs.ArkAddress.decode(delegateAddress).pkScript,
7999
+ script: chunkXLHUGP3G_cjs.ArkAddress.decode(delegateAddress).pkScript,
8007
8000
  amount: delegateFee
8008
8001
  });
8009
8002
  }
@@ -8036,10 +8029,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8036
8029
  destinationScript
8037
8030
  );
8038
8031
  const forfeitOutputScript = btcSigner.OutScript.encode(
8039
- btcSigner.Address(chunkUUSKJOSX_cjs.getNetwork(network)).decode(forfeitAddress)
8032
+ btcSigner.Address(chunkXLHUGP3G_cjs.getNetwork(network)).decode(forfeitAddress)
8040
8033
  );
8041
8034
  const forfeits = await Promise.all(
8042
- vtxos.filter((v) => chunkUUSKJOSX_cjs.requiresForfeit(v)).map(async (coin) => {
8035
+ vtxos.filter((v) => chunkXLHUGP3G_cjs.requiresForfeit(v)).map(async (coin) => {
8043
8036
  const forfeit = await makeDelegateForfeitTx(
8044
8037
  coin,
8045
8038
  dust,
@@ -8064,7 +8057,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
8064
8057
  index: input.vout,
8065
8058
  witnessUtxo: {
8066
8059
  amount: BigInt(input.value),
8067
- script: chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).pkScript
8060
+ script: chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).pkScript
8068
8061
  },
8069
8062
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
8070
8063
  tapLeafScript: [delegateTapLeaf]
@@ -8122,21 +8115,13 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
8122
8115
  expire_at: 0,
8123
8116
  cosigners_public_keys: cosignerPubKeys
8124
8117
  };
8125
- const proof = chunkUUSKJOSX_cjs.Intent.create(message, coins, outputs);
8118
+ const proof = chunkXLHUGP3G_cjs.Intent.create(message, coins, outputs);
8126
8119
  const signedProof = await identity.sign(proof);
8127
8120
  return {
8128
8121
  proof: base.base64.encode(signedProof.toPSBT()),
8129
8122
  message
8130
8123
  };
8131
8124
  }
8132
- function defaultDelegateAt(expiryTimestamp, sessionDurationSeconds, now = Date.now()) {
8133
- const remainingTimeMs = expiryTimestamp - now;
8134
- if (remainingTimeMs <= 0) return new Date(now + 6e4);
8135
- const sessionLeadMs = Number(sessionDurationSeconds * 1000n);
8136
- const leadTimeMs = Math.max(remainingTimeMs * 0.1, sessionLeadMs);
8137
- const delegateAt = expiryTimestamp - leadTimeMs;
8138
- return new Date(delegateAt > now ? delegateAt : now + 2e3);
8139
- }
8140
8125
  function findDestinationOutputIndex(outputs, destinationScript) {
8141
8126
  return outputs.findIndex((o) => o.script && utils_js.equalBytes(o.script, destinationScript));
8142
8127
  }
@@ -8148,16 +8133,24 @@ function getDayTimestamp(timestamp) {
8148
8133
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
8149
8134
  if (!vtxo.tapTree) return void 0;
8150
8135
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
8151
- const vtxoScript = chunkUUSKJOSX_cjs.VtxoScript.decode(vtxo.tapTree);
8136
+ const vtxoScript = chunkXLHUGP3G_cjs.VtxoScript.decode(vtxo.tapTree);
8152
8137
  return vtxoScript.leaves.find((tapLeaf) => {
8153
- const arkTapscript = chunkUUSKJOSX_cjs.decodeTapscript(chunkUUSKJOSX_cjs.scriptFromTapLeafScript(tapLeaf));
8154
- if (!chunkUUSKJOSX_cjs.MultisigTapscript.is(arkTapscript)) return false;
8138
+ const arkTapscript = chunkXLHUGP3G_cjs.decodeTapscript(chunkXLHUGP3G_cjs.scriptFromTapLeafScript(tapLeaf));
8139
+ if (!chunkXLHUGP3G_cjs.MultisigTapscript.is(arkTapscript)) return false;
8155
8140
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
8156
8141
  });
8157
8142
  }
8158
8143
  function isAnnotated(v) {
8159
8144
  return v.tapTree !== void 0 && v.forfeitTapLeafScript !== void 0 && v.intentTapLeafScript !== void 0;
8160
8145
  }
8146
+ function estimatorAt(intentFee, at) {
8147
+ const now = `double(${at.getTime() / 1e3})`;
8148
+ return new Estimator({
8149
+ ...intentFee,
8150
+ offchainInput: intentFee.offchainInput?.replace("now()", now),
8151
+ offchainOutput: intentFee.offchainOutput?.replace("now()", now)
8152
+ });
8153
+ }
8161
8154
 
8162
8155
  // src/repositories/inMemory/intentRepository.ts
8163
8156
  var InMemoryIntentRepository = class {
@@ -8707,8 +8700,8 @@ function checkSaveVtxosForScript(backend, key, vtxos) {
8707
8700
  }
8708
8701
  async function getVtxosForContract(repo, contract, options) {
8709
8702
  const vtxos = repo.getVtxosForScriptPage ? await collectScriptVtxos(repo, contract.script, options) : filterVtxosForScript(await collectVtxos(repo, contract.address), contract.script);
8710
- const normalized = vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo);
8711
- return options?.unspentOnly ? normalized.filter((vtxo) => !chunkUUSKJOSX_cjs.isVtxoSpent(vtxo)) : normalized;
8703
+ const normalized = vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo);
8704
+ return options?.unspentOnly ? normalized.filter((vtxo) => !chunkXLHUGP3G_cjs.isVtxoSpent(vtxo)) : normalized;
8712
8705
  }
8713
8706
  async function hasVtxosForContract(repo, contract) {
8714
8707
  if (repo.getVtxosForScriptPage) {
@@ -8939,7 +8932,7 @@ function decodeArkContract(encoded) {
8939
8932
  }
8940
8933
  function contractFromArkContract(encoded, options = {}) {
8941
8934
  const parsed = decodeArkContract(encoded);
8942
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(parsed.type);
8935
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(parsed.type);
8943
8936
  if (!handler) {
8944
8937
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
8945
8938
  }
@@ -8953,9 +8946,9 @@ function contractFromArkContract(encoded, options = {}) {
8953
8946
  metadata: options.metadata
8954
8947
  };
8955
8948
  }
8956
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkUUSKJOSX_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8949
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkXLHUGP3G_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8957
8950
  const parsed = decodeArkContract(encoded);
8958
- const handler = chunkGN2K4WBP_cjs.contractHandlers.getOrThrow(parsed.type);
8951
+ const handler = chunkGW42FS2X_cjs.contractHandlers.getOrThrow(parsed.type);
8959
8952
  const params = parsed.data;
8960
8953
  const vtxoScript = handler.createScript(params);
8961
8954
  return {
@@ -9012,10 +9005,10 @@ var ContractWatcher = class {
9012
9005
  eventSourceReported = false;
9013
9006
  /** @see ContractWatcherConfig */
9014
9007
  constructor(config) {
9015
- chunkUUSKJOSX_cjs.assertTimerMs("failsafePollIntervalMs", config.failsafePollIntervalMs);
9016
- chunkUUSKJOSX_cjs.assertTimerMs("reconnectDelayMs", config.reconnectDelayMs);
9017
- chunkUUSKJOSX_cjs.assertTimerMs("maxReconnectDelayMs", config.maxReconnectDelayMs);
9018
- chunkUUSKJOSX_cjs.assertTimerMs("subscriptionRequestTimeoutMs", config.subscriptionRequestTimeoutMs);
9008
+ chunkXLHUGP3G_cjs.assertTimerMs("failsafePollIntervalMs", config.failsafePollIntervalMs);
9009
+ chunkXLHUGP3G_cjs.assertTimerMs("reconnectDelayMs", config.reconnectDelayMs);
9010
+ chunkXLHUGP3G_cjs.assertTimerMs("maxReconnectDelayMs", config.maxReconnectDelayMs);
9011
+ chunkXLHUGP3G_cjs.assertTimerMs("subscriptionRequestTimeoutMs", config.subscriptionRequestTimeoutMs);
9019
9012
  if (config.subscriptionRequestTimeoutMs === 0) {
9020
9013
  throw new Error("subscriptionRequestTimeoutMs must be greater than 0");
9021
9014
  }
@@ -9238,9 +9231,9 @@ var ContractWatcher = class {
9238
9231
  this.reconnectAttempts = 0;
9239
9232
  this.listenLoop().catch((e) => {
9240
9233
  if (!this.isWatching || signal?.aborted) return;
9241
- if (chunkUUSKJOSX_cjs.isEventSourceError(e)) {
9234
+ if (chunkXLHUGP3G_cjs.isEventSourceError(e)) {
9242
9235
  console.debug("ContractWatcher subscription disconnected; reconnecting");
9243
- } else if (!chunkUUSKJOSX_cjs.isEventSourceUnavailableError(e)) {
9236
+ } else if (!chunkXLHUGP3G_cjs.isEventSourceUnavailableError(e)) {
9244
9237
  console.error(e);
9245
9238
  }
9246
9239
  this.connectionState = "disconnected";
@@ -9250,7 +9243,7 @@ var ContractWatcher = class {
9250
9243
  });
9251
9244
  } catch (error) {
9252
9245
  if (!this.isWatching || signal?.aborted) return;
9253
- if (!chunkUUSKJOSX_cjs.isEventSourceUnavailableError(error)) {
9246
+ if (!chunkXLHUGP3G_cjs.isEventSourceUnavailableError(error)) {
9254
9247
  console.error("ContractWatcher connection failed:", error);
9255
9248
  }
9256
9249
  this.connectionState = "disconnected";
@@ -9266,7 +9259,7 @@ var ContractWatcher = class {
9266
9259
  * few seconds.
9267
9260
  */
9268
9261
  reportEventSourceUnavailable(error) {
9269
- if (!chunkUUSKJOSX_cjs.isEventSourceUnavailableError(error)) return false;
9262
+ if (!chunkXLHUGP3G_cjs.isEventSourceUnavailableError(error)) return false;
9270
9263
  if (!this.eventSourceReported) {
9271
9264
  this.eventSourceReported = true;
9272
9265
  console.warn(
@@ -9331,7 +9324,7 @@ var ContractWatcher = class {
9331
9324
  const now = Date.now();
9332
9325
  let current;
9333
9326
  try {
9334
- current = await chunkUUSKJOSX_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9327
+ current = await chunkXLHUGP3G_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9335
9328
  spendableOnly: true
9336
9329
  });
9337
9330
  } catch (error) {
@@ -9613,14 +9606,14 @@ var ContractWatcher = class {
9613
9606
  const timestamp = Date.now();
9614
9607
  if (update.newVtxos?.length) {
9615
9608
  this.processSubscriptionVtxos(
9616
- update.newVtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo),
9609
+ update.newVtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo),
9617
9610
  "vtxo_received",
9618
9611
  timestamp
9619
9612
  );
9620
9613
  }
9621
9614
  if (update.spentVtxos?.length) {
9622
9615
  this.processSubscriptionVtxos(
9623
- update.spentVtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo),
9616
+ update.spentVtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo),
9624
9617
  "vtxo_spent",
9625
9618
  timestamp
9626
9619
  );
@@ -9645,8 +9638,8 @@ var ContractWatcher = class {
9645
9638
  continue;
9646
9639
  }
9647
9640
  if (target === byWatchedScript && eventType === "vtxo_received") {
9648
- const n = chunkUUSKJOSX_cjs.normalizeVtxo(vtxo);
9649
- if (chunkUUSKJOSX_cjs.isVtxoSpent(n) || n.isSwept || chunkUUSKJOSX_cjs.isPastExpiry(n, now)) continue;
9641
+ const n = chunkXLHUGP3G_cjs.normalizeVtxo(vtxo);
9642
+ if (chunkXLHUGP3G_cjs.isVtxoSpent(n) || n.isSwept || chunkXLHUGP3G_cjs.isPastExpiry(n, now)) continue;
9650
9643
  }
9651
9644
  let bucket = target.get(vtxo.script);
9652
9645
  if (!bucket) {
@@ -9787,7 +9780,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9787
9780
  if (!contract) continue;
9788
9781
  try {
9789
9782
  const key = contractKey(contract);
9790
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
9783
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
9791
9784
  const hit = memo?.get(script);
9792
9785
  let tapscripts;
9793
9786
  if (hit && hit.key === key && hit.handler === handler) {
@@ -9808,7 +9801,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9808
9801
  scripts.add(script);
9809
9802
  } catch (err) {
9810
9803
  const reason = `'${contract.type}' at ${script}: ${err instanceof Error ? err.message : String(err)}`;
9811
- if (err instanceof chunkGN2K4WBP_cjs.UnsupportedProgramVersionError) {
9804
+ if (err instanceof chunkGW42FS2X_cjs.UnsupportedProgramVersionError) {
9812
9805
  unsupported.set(script, { key: contractKey(contract), reason });
9813
9806
  } else {
9814
9807
  failures.set(script, reason);
@@ -9819,7 +9812,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9819
9812
  }
9820
9813
  function annotateAgainst(vtxos, byScript, tapscripts = /* @__PURE__ */ new Map()) {
9821
9814
  return vtxos.map(
9822
- (vtxo) => extendVirtualCoinForContract(chunkUUSKJOSX_cjs.normalizeVtxo(vtxo), byScript, tapscripts)
9815
+ (vtxo) => extendVirtualCoinForContract(chunkXLHUGP3G_cjs.normalizeVtxo(vtxo), byScript, tapscripts)
9823
9816
  );
9824
9817
  }
9825
9818
  var SCAN_MAX_INDEX = 1e4;
@@ -9863,8 +9856,8 @@ var ContractManager = class _ContractManager {
9863
9856
  * `dispose()`, so it re-checks this at every await rather than run on a torn-down watcher. */
9864
9857
  disposed = false;
9865
9858
  constructor(config) {
9866
- chunkUUSKJOSX_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", config.vtxoSyncMaxAgeMs);
9867
- chunkUUSKJOSX_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", config.vtxoSyncOverlapMs);
9859
+ chunkXLHUGP3G_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", config.vtxoSyncMaxAgeMs);
9860
+ chunkXLHUGP3G_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", config.vtxoSyncOverlapMs);
9868
9861
  this.config = { ...config };
9869
9862
  this.watcher = new ContractWatcher({
9870
9863
  indexerProvider: config.indexerProvider,
@@ -9900,12 +9893,12 @@ var ContractManager = class _ContractManager {
9900
9893
  }
9901
9894
  /** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
9902
9895
  setVtxoSyncMaxAge(maxAgeMs) {
9903
- chunkUUSKJOSX_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", maxAgeMs);
9896
+ chunkXLHUGP3G_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", maxAgeMs);
9904
9897
  this.config.vtxoSyncMaxAgeMs = maxAgeMs;
9905
9898
  }
9906
9899
  /** @see ContractManagerConfig.vtxoSyncOverlapMs — for factory-built managers. */
9907
9900
  setVtxoSyncOverlap(overlapMs) {
9908
- chunkUUSKJOSX_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", overlapMs);
9901
+ chunkXLHUGP3G_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", overlapMs);
9909
9902
  this.config.vtxoSyncOverlapMs = overlapMs;
9910
9903
  }
9911
9904
  markSyncOnline() {
@@ -9969,10 +9962,10 @@ var ContractManager = class _ContractManager {
9969
9962
  if (this.unsupportedContracts.get(contract.script) === key) return true;
9970
9963
  if (this.tapscriptMemo.get(contract.script)?.key === key) return false;
9971
9964
  try {
9972
- chunkGN2K4WBP_cjs.contractHandlers.get(contract.type)?.createScript(contract.params);
9965
+ chunkGW42FS2X_cjs.contractHandlers.get(contract.type)?.createScript(contract.params);
9973
9966
  return false;
9974
9967
  } catch (err) {
9975
- if (!(err instanceof chunkGN2K4WBP_cjs.UnsupportedProgramVersionError)) return false;
9968
+ if (!(err instanceof chunkGW42FS2X_cjs.UnsupportedProgramVersionError)) return false;
9976
9969
  this.unsupportedContracts.set(contract.script, key);
9977
9970
  return true;
9978
9971
  }
@@ -9985,7 +9978,7 @@ var ContractManager = class _ContractManager {
9985
9978
  this.markSyncOnline();
9986
9979
  return void 0;
9987
9980
  } catch (err) {
9988
- if (!chunkUUSKJOSX_cjs.isRetryableProviderError(err)) throw err;
9981
+ if (!chunkXLHUGP3G_cjs.isRetryableProviderError(err)) throw err;
9989
9982
  this.markSyncDegraded(err);
9990
9983
  return err;
9991
9984
  }
@@ -10008,7 +10001,7 @@ var ContractManager = class _ContractManager {
10008
10001
  try {
10009
10002
  await this.scheduleLookAheadDrain();
10010
10003
  } catch (err) {
10011
- if (!chunkUUSKJOSX_cjs.isRetryableProviderError(err)) throw err;
10004
+ if (!chunkXLHUGP3G_cjs.isRetryableProviderError(err)) throw err;
10012
10005
  this.lookAheadRefillOwed = true;
10013
10006
  this.markSyncDegraded(err);
10014
10007
  }
@@ -10071,7 +10064,7 @@ var ContractManager = class _ContractManager {
10071
10064
  /** No throw: construction returned long ago, so the state is the channel. */
10072
10065
  reportBackgroundFailure(stage, err) {
10073
10066
  this.markSyncDegraded(err);
10074
- if (!chunkUUSKJOSX_cjs.isRetryableProviderError(err)) {
10067
+ if (!chunkXLHUGP3G_cjs.isRetryableProviderError(err)) {
10075
10068
  console.error(`[contracts] background ${stage} failed`, err);
10076
10069
  }
10077
10070
  }
@@ -10173,7 +10166,7 @@ var ContractManager = class _ContractManager {
10173
10166
  const from = Math.max(0, watermark - lookAhead.size);
10174
10167
  const to = watermark + lookAhead.size;
10175
10168
  const deps = lookAhead.candidateDeps();
10176
- const handlers = chunkGN2K4WBP_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkGN2K4WBP_cjs.contractHandlers.get(t)).filter(hasCandidates);
10169
+ const handlers = chunkGW42FS2X_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkGW42FS2X_cjs.contractHandlers.get(t)).filter(hasCandidates);
10177
10170
  const band = /* @__PURE__ */ new Map();
10178
10171
  for (let index = from; index <= to; index++) {
10179
10172
  const descriptor = lookAhead.materialize(index);
@@ -10184,7 +10177,7 @@ var ContractManager = class _ContractManager {
10184
10177
  index,
10185
10178
  params: {
10186
10179
  ...candidate,
10187
- ...chunkGN2K4WBP_cjs.speculativeReceiveMetadata(descriptor)
10180
+ ...chunkGW42FS2X_cjs.speculativeReceiveMetadata(descriptor)
10188
10181
  }
10189
10182
  });
10190
10183
  }
@@ -10243,7 +10236,7 @@ var ContractManager = class _ContractManager {
10243
10236
  });
10244
10237
  for (const entry of pending) entry.catchUpPending = false;
10245
10238
  } catch (err) {
10246
- if (!chunkUUSKJOSX_cjs.isRetryableProviderError(err)) throw err;
10239
+ if (!chunkXLHUGP3G_cjs.isRetryableProviderError(err)) throw err;
10247
10240
  this.markSyncDegraded(err);
10248
10241
  }
10249
10242
  }
@@ -10334,7 +10327,7 @@ var ContractManager = class _ContractManager {
10334
10327
  return result;
10335
10328
  }
10336
10329
  async upsertContractRow(params) {
10337
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(params.type);
10330
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(params.type);
10338
10331
  if (!handler) {
10339
10332
  throw new Error(`No handler registered for contract type '${params.type}'`);
10340
10333
  }
@@ -10433,7 +10426,7 @@ var ContractManager = class _ContractManager {
10433
10426
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
10434
10427
  );
10435
10428
  }
10436
- const registered = chunkGN2K4WBP_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkGN2K4WBP_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10429
+ const registered = chunkGW42FS2X_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkGW42FS2X_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10437
10430
  const discoverables = [
10438
10431
  ...registered.filter((h) => h.type === "boarding"),
10439
10432
  ...registered.filter((h) => h.type !== "boarding")
@@ -10564,7 +10557,7 @@ var ContractManager = class _ContractManager {
10564
10557
  return contracts.filter((contract) => this.isUnsupported(contract));
10565
10558
  }
10566
10559
  async getContractsWithVtxos(filter, pageSize, options) {
10567
- chunkUUSKJOSX_cjs.assertNonNegativeMs("maxSyncAgeMs", options?.maxSyncAgeMs);
10560
+ chunkXLHUGP3G_cjs.assertNonNegativeMs("maxSyncAgeMs", options?.maxSyncAgeMs);
10568
10561
  const contracts = await this.getContracts(filter);
10569
10562
  if (this.syncedWithin(
10570
10563
  contracts,
@@ -10672,14 +10665,14 @@ var ContractManager = class _ContractManager {
10672
10665
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
10673
10666
  const asking = vtxos.filter((vtxo) => {
10674
10667
  const contract = byScript.get(vtxo.script);
10675
- return contract !== void 0 && chunkGN2K4WBP_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10668
+ return contract !== void 0 && chunkGW42FS2X_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10676
10669
  });
10677
10670
  if (asking.length === 0) return refused;
10678
10671
  const tip = await this.currentChainTip();
10679
10672
  const walletDescriptorValue = await walletDescriptor?.();
10680
10673
  for (const vtxo of asking) {
10681
10674
  const contract = byScript.get(vtxo.script);
10682
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
10675
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
10683
10676
  if (!handler?.assertSpendableNow) continue;
10684
10677
  const context = {
10685
10678
  collaborative: true,
@@ -10689,7 +10682,7 @@ var ContractManager = class _ContractManager {
10689
10682
  walletDescriptor: walletDescriptorValue,
10690
10683
  // `isVirtualCoin` only checks `script`, which every input has; `isCsvSpendable`
10691
10684
  // reads `vtxo.status.block_time` unguarded, so require `status` too.
10692
- vtxo: chunkUUSKJOSX_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10685
+ vtxo: chunkXLHUGP3G_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10693
10686
  };
10694
10687
  try {
10695
10688
  await handler.assertSpendableNow(
@@ -10802,7 +10795,7 @@ var ContractManager = class _ContractManager {
10802
10795
  const { contractScript, collaborative = true, walletDescriptor, vtxo } = options;
10803
10796
  const [contract] = await this.getContracts({ script: contractScript });
10804
10797
  if (!contract) return [];
10805
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
10798
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
10806
10799
  if (!handler) return [];
10807
10800
  const script = handler.createScript(contract.params);
10808
10801
  const tip = await this.currentChainTip();
@@ -10824,7 +10817,7 @@ var ContractManager = class _ContractManager {
10824
10817
  const { contractScript, collaborative = true, walletDescriptor } = options;
10825
10818
  const [contract] = await this.getContracts({ script: contractScript });
10826
10819
  if (!contract) return [];
10827
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
10820
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
10828
10821
  if (!handler) return [];
10829
10822
  const script = handler.createScript(contract.params);
10830
10823
  const context = {
@@ -10870,7 +10863,7 @@ var ContractManager = class _ContractManager {
10870
10863
  }
10871
10864
  async refreshOutpoints(outpoints) {
10872
10865
  if (outpoints.length === 0) return;
10873
- const { vtxos } = await chunkUUSKJOSX_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10866
+ const { vtxos } = await chunkXLHUGP3G_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10874
10867
  outpoints
10875
10868
  });
10876
10869
  if (vtxos.length === 0) return;
@@ -10972,7 +10965,7 @@ var ContractManager = class _ContractManager {
10972
10965
  break;
10973
10966
  }
10974
10967
  } catch (err) {
10975
- if (!chunkUUSKJOSX_cjs.isRetryableProviderError(err)) throw err;
10968
+ if (!chunkXLHUGP3G_cjs.isRetryableProviderError(err)) throw err;
10976
10969
  this.markSyncDegraded(err);
10977
10970
  synced = false;
10978
10971
  }
@@ -11060,7 +11053,7 @@ var ContractManager = class _ContractManager {
11060
11053
  */
11061
11054
  async reconcilePendingFrontier(contracts) {
11062
11055
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
11063
- const vtxos = await chunkUUSKJOSX_cjs.getAllNormalizedVtxos(
11056
+ const vtxos = await chunkXLHUGP3G_cjs.getAllNormalizedVtxos(
11064
11057
  this.config.indexerProvider,
11065
11058
  contracts.map((c) => c.script),
11066
11059
  { pendingOnly: true }
@@ -11135,7 +11128,7 @@ var ContractManager = class _ContractManager {
11135
11128
  }
11136
11129
  return result;
11137
11130
  }
11138
- async fetchContractVtxosBulk(contracts, pageSize = chunkUUSKJOSX_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
11131
+ async fetchContractVtxosBulk(contracts, pageSize = chunkXLHUGP3G_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
11139
11132
  if (contracts.length === 0) {
11140
11133
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
11141
11134
  }
@@ -11151,7 +11144,7 @@ var ContractManager = class _ContractManager {
11151
11144
  before: syncWindow.before
11152
11145
  }
11153
11146
  } : {};
11154
- const vtxos = await chunkUUSKJOSX_cjs.getAllNormalizedVtxos(
11147
+ const vtxos = await chunkXLHUGP3G_cjs.getAllNormalizedVtxos(
11155
11148
  this.config.indexerProvider,
11156
11149
  contracts.map((c) => c.script),
11157
11150
  { ...windowOpts, pageSize }
@@ -11254,7 +11247,7 @@ function parseLegacyExpiry(batchExpiry) {
11254
11247
  if (typeof batchExpiry !== "number" || !Number.isFinite(batchExpiry) || batchExpiry <= 0) {
11255
11248
  return {};
11256
11249
  }
11257
- if (batchExpiry >= chunkUUSKJOSX_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
11250
+ if (batchExpiry >= chunkXLHUGP3G_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
11258
11251
  return { expiresAtHeight: batchExpiry / 1e3 };
11259
11252
  }
11260
11253
  function legacyVtxoFacts(status) {
@@ -11492,7 +11485,7 @@ function backfillContractWatchState(store) {
11492
11485
  };
11493
11486
  readPage();
11494
11487
  }
11495
- var unspentFlag = (vtxo) => chunkUUSKJOSX_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
11488
+ var unspentFlag = (vtxo) => chunkXLHUGP3G_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
11496
11489
  function backfillVtxoIndexFields(transaction) {
11497
11490
  const store = transaction.objectStore(STORE_VTXOS);
11498
11491
  const pageSize = 1e3;
@@ -11523,7 +11516,7 @@ var DEFAULT_DB_NAME = "arkade-service-worker";
11523
11516
  var DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS = 1e4;
11524
11517
  function normalizeOptions2(pathOrOptions) {
11525
11518
  const o = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
11526
- chunkUUSKJOSX_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
11519
+ chunkXLHUGP3G_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
11527
11520
  return {
11528
11521
  path: o.path,
11529
11522
  activationTimeoutMs: o.activationTimeoutMs ?? DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS
@@ -11549,7 +11542,9 @@ async function setupServiceWorker(pathOrOptions) {
11549
11542
  }
11550
11543
  const { path, activationTimeoutMs } = normalizeOptions2(pathOrOptions);
11551
11544
  const registration = await navigator.serviceWorker.register(path);
11552
- await registration.update();
11545
+ registration.update().catch(
11546
+ (error) => console.warn("Service worker update failed; continuing with the active worker", error)
11547
+ );
11553
11548
  const serviceWorker = registration.active || registration.waiting || registration.installing;
11554
11549
  if (!serviceWorker) {
11555
11550
  throw new Error("Failed to get service worker instance");
@@ -11742,7 +11737,7 @@ var deserializeTapLeaf = (t) => {
11742
11737
  const s = base.hex.decode(t.s);
11743
11738
  return [cb, s];
11744
11739
  };
11745
- var deserializeVtxo = (o) => chunkUUSKJOSX_cjs.normalizeVtxo({
11740
+ var deserializeVtxo = (o) => chunkXLHUGP3G_cjs.normalizeVtxo({
11746
11741
  ...o,
11747
11742
  createdAt: new Date(o.createdAt),
11748
11743
  tapTree: base.hex.decode(o.tapTree),
@@ -12097,7 +12092,7 @@ var RestEmulatorProvider = class {
12097
12092
  serverUrl;
12098
12093
  async getInfo() {
12099
12094
  const url = `${this.serverUrl}/v1/info`;
12100
- const response = await chunkUUSKJOSX_cjs.baseFetch(url);
12095
+ const response = await chunkXLHUGP3G_cjs.baseFetch(url);
12101
12096
  if (!response.ok) {
12102
12097
  const errorText2 = await response.text();
12103
12098
  throw new Error(`Failed to get emulator info: ${errorText2}`);
@@ -12217,11 +12212,11 @@ var RestEmulatorProvider = class {
12217
12212
 
12218
12213
  // src/arkade/service.ts
12219
12214
  function arkadeServiceUrl(service) {
12220
- return "operatorUrl" in service ? service.operatorUrl : chunkUUSKJOSX_cjs.DEFAULT_ARKADE_SERVER_URL;
12215
+ return "operatorUrl" in service ? service.operatorUrl : chunkXLHUGP3G_cjs.DEFAULT_ARKADE_SERVER_URL;
12221
12216
  }
12222
12217
  async function resolveArkadeService(service, opts = {}) {
12223
12218
  const operatorUrl = arkadeServiceUrl(service);
12224
- const arkProvider = opts.arkProvider ?? new chunkUUSKJOSX_cjs.RestArkProvider(operatorUrl);
12219
+ const arkProvider = opts.arkProvider ?? new chunkXLHUGP3G_cjs.RestArkProvider(operatorUrl);
12225
12220
  const info = opts.info ?? await arkProvider.getInfo();
12226
12221
  if ("network" in service && service.network !== info.network) {
12227
12222
  throw new Error(
@@ -12234,13 +12229,13 @@ async function resolveArkadeService(service, opts = {}) {
12234
12229
  }
12235
12230
  let emulator;
12236
12231
  if ("network" in service) {
12237
- emulator = new RestEmulatorProvider(chunkUUSKJOSX_cjs.DEFAULT_ARKADE_EMULATOR_URL);
12232
+ emulator = new RestEmulatorProvider(chunkXLHUGP3G_cjs.DEFAULT_ARKADE_EMULATOR_URL);
12238
12233
  } else if (service.emulatorUrl) {
12239
12234
  emulator = new RestEmulatorProvider(service.emulatorUrl);
12240
12235
  }
12241
12236
  return {
12242
12237
  arkProvider,
12243
- indexerProvider: new chunkIQWLFYT2_cjs.RestIndexerProvider(operatorUrl),
12238
+ indexerProvider: new chunkHQNQ3CLQ_cjs.RestIndexerProvider(operatorUrl),
12244
12239
  onchainProvider: new EsploraProvider(esploraUrl),
12245
12240
  emulator,
12246
12241
  info
@@ -12324,7 +12319,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
12324
12319
  */
12325
12320
  materializeDescriptorAt(index) {
12326
12321
  const descriptor = this.identity.descriptor;
12327
- const network = chunkGN2K4WBP_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
12322
+ const network = chunkGW42FS2X_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
12328
12323
  const expansion = descriptorsScure.expand({ descriptor, network, index });
12329
12324
  const keyInfo = expansion.expansionMap?.["@0"];
12330
12325
  if (!keyInfo?.keyExpression) {
@@ -12392,7 +12387,7 @@ function signingDescriptorIndex(descriptor) {
12392
12387
  }
12393
12388
  function newestWalletReceiveContract(contracts, serverPubKeyHex) {
12394
12389
  return contracts.filter(
12395
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkGN2K4WBP_cjs.WALLET_RECEIVE_SOURCE
12390
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkGW42FS2X_cjs.WALLET_RECEIVE_SOURCE
12396
12391
  ).sort((a, b) => {
12397
12392
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12398
12393
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12443,7 +12438,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
12443
12438
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
12444
12439
  if (!provider) return void 0;
12445
12440
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
12446
- const expectedContractType = setup.offchainTapscript instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script ? "delegate" : "default";
12441
+ const expectedContractType = setup.offchainTapscript instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script ? "delegate" : "default";
12447
12442
  const factoryOpts = {
12448
12443
  walletRepository: setup.walletRepository,
12449
12444
  contractRepository: setup.contractRepository,
@@ -12600,7 +12595,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
12600
12595
  };
12601
12596
  function deriveLeafPubkey(descriptor) {
12602
12597
  try {
12603
- return chunkGN2K4WBP_cjs.deriveDescriptorLeafPubKey(descriptor);
12598
+ return chunkGW42FS2X_cjs.deriveDescriptorLeafPubKey(descriptor);
12604
12599
  } catch (e) {
12605
12600
  throw new NonRangeableDescriptorError(
12606
12601
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -12612,7 +12607,7 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12612
12607
  const pubKey = deriveLeafPubkey(descriptor);
12613
12608
  const tapscript = rebuildTapscript(current, pubKey);
12614
12609
  const serverPubKey = tapscript.options.serverPubKey;
12615
- const csvTimelock2 = chunkUUSKJOSX_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12610
+ const csvTimelock2 = chunkXLHUGP3G_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12616
12611
  const base$1 = {
12617
12612
  script: base.hex.encode(tapscript.pkScript),
12618
12613
  address: tapscript.address(hrp, serverPubKey).encode(),
@@ -12620,11 +12615,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12620
12615
  // Read at sign time to route rotated-pubkey inputs through `signWithDescriptor`; without
12621
12616
  // it spends are rejected with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
12622
12617
  metadata: {
12623
- ...tagSource && { source: chunkGN2K4WBP_cjs.WALLET_RECEIVE_SOURCE },
12618
+ ...tagSource && { source: chunkGW42FS2X_cjs.WALLET_RECEIVE_SOURCE },
12624
12619
  signingDescriptor: descriptor
12625
12620
  }
12626
12621
  };
12627
- const params = tapscript instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script ? {
12622
+ const params = tapscript instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script ? {
12628
12623
  ...base$1,
12629
12624
  type: "delegate",
12630
12625
  params: {
@@ -12645,10 +12640,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12645
12640
  return { tapscript, params };
12646
12641
  }
12647
12642
  function rebuildTapscript(current, pubKey) {
12648
- if (current instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script) {
12649
- return new chunkGN2K4WBP_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12643
+ if (current instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script) {
12644
+ return new chunkGW42FS2X_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12650
12645
  }
12651
- return new chunkGN2K4WBP_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12646
+ return new chunkGW42FS2X_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12652
12647
  }
12653
12648
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
12654
12649
  const candidates = await collectContracts(contractRepository, {
@@ -12707,7 +12702,7 @@ function computeOffchainBalance(vtxos, caps) {
12707
12702
  }
12708
12703
  };
12709
12704
  for (const vtxo of vtxos) {
12710
- if (chunkUUSKJOSX_cjs.isVtxoSpent(vtxo)) continue;
12705
+ if (chunkXLHUGP3G_cjs.isVtxoSpent(vtxo)) continue;
12711
12706
  addAssets(owned, vtxo);
12712
12707
  if (vtxo.isUnrolled) {
12713
12708
  unrolled += vtxo.value;
@@ -12717,11 +12712,11 @@ function computeOffchainBalance(vtxos, caps) {
12717
12712
  pendingRecovery += vtxo.value;
12718
12713
  continue;
12719
12714
  }
12720
- if (chunkUUSKJOSX_cjs.canRecoverOnchain(vtxo, now)) {
12715
+ if (chunkXLHUGP3G_cjs.canRecoverOnchain(vtxo, now)) {
12721
12716
  recoverable += vtxo.value;
12722
12717
  continue;
12723
12718
  }
12724
- if (!chunkUUSKJOSX_cjs.canSpendOffchain(vtxo, now)) continue;
12719
+ if (!chunkXLHUGP3G_cjs.canSpendOffchain(vtxo, now)) continue;
12725
12720
  if (vtxo.isPreconfirmed) {
12726
12721
  preconfirmed += vtxo.value;
12727
12722
  } else {
@@ -12936,7 +12931,7 @@ function intentProofJobs(coins) {
12936
12931
  if (coins.length === 0) return [];
12937
12932
  const coinJobs = coins.map((coin, i) => ({
12938
12933
  index: i + 1,
12939
- lookupScript: chunkUUSKJOSX_cjs.VtxoScript.decode(coin.tapTree).pkScript
12934
+ lookupScript: chunkXLHUGP3G_cjs.VtxoScript.decode(coin.tapTree).pkScript
12940
12935
  }));
12941
12936
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
12942
12937
  }
@@ -12976,7 +12971,7 @@ function dedupeTimelocks(timelocks) {
12976
12971
  const seen = /* @__PURE__ */ new Set();
12977
12972
  const deduped = [];
12978
12973
  for (const timelock of timelocks) {
12979
- const sequence = chunkUUSKJOSX_cjs.timelockToSequence(timelock).toString();
12974
+ const sequence = chunkXLHUGP3G_cjs.timelockToSequence(timelock).toString();
12980
12975
  if (seen.has(sequence)) continue;
12981
12976
  seen.add(sequence);
12982
12977
  deduped.push(timelock);
@@ -12992,7 +12987,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
12992
12987
  if (!newest?.params.pubKey) return baseline;
12993
12988
  try {
12994
12989
  const pubKey = base.hex.decode(newest.params.pubKey);
12995
- return new chunkGN2K4WBP_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12990
+ return new chunkGW42FS2X_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
12996
12991
  } catch (e) {
12997
12992
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
12998
12993
  return baseline;
@@ -13024,21 +13019,21 @@ function filterFlatVtxos(vtxos, filter, pendingSpendOutpoints) {
13024
13019
  if (vtxo.isUnrolled) {
13025
13020
  return !!f.withUnrolled;
13026
13021
  }
13027
- if (chunkUUSKJOSX_cjs.isVtxoSpent(vtxo)) {
13022
+ if (chunkXLHUGP3G_cjs.isVtxoSpent(vtxo)) {
13028
13023
  return false;
13029
13024
  }
13030
- if (!f.withRecoverable && chunkUUSKJOSX_cjs.canRecoverOnchain(vtxo, now)) {
13025
+ if (!f.withRecoverable && chunkXLHUGP3G_cjs.canRecoverOnchain(vtxo, now)) {
13031
13026
  return false;
13032
13027
  }
13033
13028
  return true;
13034
13029
  });
13035
13030
  }
13036
13031
  async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
13037
- const candidates = inputs.filter(chunkUUSKJOSX_cjs.isVirtualCoin).map(chunkUUSKJOSX_cjs.normalizeVtxo).filter((v) => !v.isSwept);
13032
+ const candidates = inputs.filter(chunkXLHUGP3G_cjs.isVirtualCoin).map(chunkXLHUGP3G_cjs.normalizeVtxo).filter((v) => !v.isSwept);
13038
13033
  if (candidates.length === 0) return inputs;
13039
- const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkUUSKJOSX_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
13034
+ const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkXLHUGP3G_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
13040
13035
  const suspects = candidates.filter(
13041
- (v) => chunkUUSKJOSX_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
13036
+ (v) => chunkXLHUGP3G_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
13042
13037
  );
13043
13038
  if (suspects.length === 0) return inputs;
13044
13039
  let sweptNow;
@@ -13052,12 +13047,12 @@ async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
13052
13047
  );
13053
13048
  } catch (e) {
13054
13049
  const message = "could not confirm the swept state of expired settlement inputs; retry the settlement";
13055
- throw chunkUUSKJOSX_cjs.isRetryableProviderError(e) ? new chunkUUSKJOSX_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
13050
+ throw chunkXLHUGP3G_cjs.isRetryableProviderError(e) ? new chunkXLHUGP3G_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
13056
13051
  }
13057
13052
  if (sweptNow.size === 0) return inputs;
13058
13053
  return inputs.map((input) => {
13059
- if (!chunkUUSKJOSX_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
13060
- return { ...chunkUUSKJOSX_cjs.normalizeVtxo(input), isSwept: true };
13054
+ if (!chunkXLHUGP3G_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
13055
+ return { ...chunkXLHUGP3G_cjs.normalizeVtxo(input), isSwept: true };
13061
13056
  });
13062
13057
  }
13063
13058
  var PENDING_RECOVERY_REASON = "is past its operator signer's rotation cutoff \u2014 the operator will not co-sign it until it recovers";
@@ -13346,7 +13341,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13346
13341
  async getArkadeReader() {
13347
13342
  const indexer = this.indexerProvider;
13348
13343
  return {
13349
- getVtxos: (opts) => chunkUUSKJOSX_cjs.getNormalizedVtxos(indexer, opts),
13344
+ getVtxos: (opts) => chunkXLHUGP3G_cjs.getNormalizedVtxos(indexer, opts),
13350
13345
  getVirtualTxs: (txids, opts) => indexer.getVirtualTxs(txids, opts)
13351
13346
  };
13352
13347
  }
@@ -13386,7 +13381,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13386
13381
  "Pass either `service` or `arkProvider`/`indexerProvider`/`onchainProvider`, not both"
13387
13382
  );
13388
13383
  }
13389
- const arkProvider = config.arkProvider || new chunkUUSKJOSX_cjs.RestArkProvider(config.service ? arkadeServiceUrl(config.service) : void 0);
13384
+ const arkProvider = config.arkProvider || new chunkXLHUGP3G_cjs.RestArkProvider(config.service ? arkadeServiceUrl(config.service) : void 0);
13390
13385
  let indexerProvider = config.indexerProvider;
13391
13386
  if (!indexerProvider && !config.service) {
13392
13387
  const derived = extractArkProviderUrl(arkProvider);
@@ -13395,11 +13390,11 @@ var ReadonlyWallet = class _ReadonlyWallet {
13395
13390
  "indexerProvider is required when arkProvider is provided without a discoverable serverUrl"
13396
13391
  );
13397
13392
  }
13398
- indexerProvider = new chunkIQWLFYT2_cjs.RestIndexerProvider(derived ?? chunkUUSKJOSX_cjs.DEFAULT_ARKADE_SERVER_URL);
13393
+ indexerProvider = new chunkHQNQ3CLQ_cjs.RestIndexerProvider(derived ?? chunkXLHUGP3G_cjs.DEFAULT_ARKADE_SERVER_URL);
13399
13394
  }
13400
13395
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
13401
13396
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
13402
- const delegatePubKeyPromise = config.delegateProvider?.getDelegateInfo().then((info2) => chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0);
13397
+ const delegatePubKeyPromise = config.delegateProvider?.getDelegateInfo().then((info2) => chunkGW42FS2X_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0);
13403
13398
  const {
13404
13399
  info,
13405
13400
  source: serverInfoSource,
@@ -13410,7 +13405,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13410
13405
  if (!resolvedService) throw new Error("indexerProvider is unresolved");
13411
13406
  indexerProvider = resolvedService.indexerProvider;
13412
13407
  }
13413
- const network = chunkUUSKJOSX_cjs.networkFromArkadeInfo(info);
13408
+ const network = chunkXLHUGP3G_cjs.networkFromArkadeInfo(info);
13414
13409
  if ("descriptor" in config.identity) {
13415
13410
  const descriptor = config.identity.descriptor;
13416
13411
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -13446,18 +13441,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
13446
13441
  }
13447
13442
  }
13448
13443
  const boardingTimelock = config.boardingTimelock ?? toTimelock(info.boardingExitDelay);
13449
- const serverPubKey = chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
13444
+ const serverPubKey = chunkGW42FS2X_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
13450
13445
  const delegatePubKey = await delegatePubKeyPromise;
13451
13446
  const offchainOptions = {
13452
13447
  pubKey,
13453
13448
  serverPubKey,
13454
13449
  csvTimelock: exitTimelock
13455
13450
  };
13456
- const offchainTapscript = !delegatePubKey ? new chunkGN2K4WBP_cjs.DefaultVtxo.Script(offchainOptions) : new chunkGN2K4WBP_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
13457
- const boardingTapscript = chunkGN2K4WBP_cjs.BoardingContractHandler.createScript({
13451
+ const offchainTapscript = !delegatePubKey ? new chunkGW42FS2X_cjs.DefaultVtxo.Script(offchainOptions) : new chunkGW42FS2X_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
13452
+ const boardingTapscript = chunkGW42FS2X_cjs.BoardingContractHandler.createScript({
13458
13453
  pubKey: base.hex.encode(pubKey),
13459
13454
  serverPubKey: base.hex.encode(serverPubKey),
13460
- csvTimelock: chunkUUSKJOSX_cjs.timelockToSequence(boardingTimelock).toString()
13455
+ csvTimelock: chunkXLHUGP3G_cjs.timelockToSequence(boardingTimelock).toString()
13461
13456
  });
13462
13457
  return {
13463
13458
  arkProvider,
@@ -13623,7 +13618,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13623
13618
  if (!filter?.withUnrolled) {
13624
13619
  logExcludedVtxos(
13625
13620
  "getSpendableVtxos",
13626
- snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkUUSKJOSX_cjs.isVtxoSpent(vtxo)),
13621
+ snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkXLHUGP3G_cjs.isVtxoSpent(vtxo)),
13627
13622
  [() => UNROLLED_REASON]
13628
13623
  );
13629
13624
  }
@@ -13766,7 +13761,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13766
13761
  this.getBoardingTxs()
13767
13762
  ]);
13768
13763
  const allVtxos = snapshot.flatMap((_) => _.vtxos);
13769
- const resolveTxCreatedAt = (txids) => chunkUUSKJOSX_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13764
+ const resolveTxCreatedAt = (txids) => chunkXLHUGP3G_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13770
13765
  return buildTransactionHistory(
13771
13766
  allVtxos,
13772
13767
  boardingTxs,
@@ -13834,6 +13829,17 @@ var ReadonlyWallet = class _ReadonlyWallet {
13834
13829
  const commitmentsToIgnore = /* @__PURE__ */ new Set();
13835
13830
  const tapscripts = await this.getBoardingTapscripts(this.watchedBoardingSigners());
13836
13831
  const outspendCache = /* @__PURE__ */ new Map();
13832
+ const outspendOf = async (txid, index) => {
13833
+ if (this.onchainProvider.getTxOutspend) {
13834
+ return this.onchainProvider.getTxOutspend(txid, index);
13835
+ }
13836
+ let statuses = outspendCache.get(txid);
13837
+ if (!statuses) {
13838
+ statuses = await this.onchainProvider.getTxOutspends(txid);
13839
+ outspendCache.set(txid, statuses);
13840
+ }
13841
+ return statuses[index];
13842
+ };
13837
13843
  for (const tapscript of tapscripts) {
13838
13844
  const boardingAddress = tapscript.onchainAddress(this.network);
13839
13845
  const scriptHex = base.hex.encode(tapscript.pkScript);
@@ -13848,12 +13854,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13848
13854
  for (let i = 0; i < tx.vout.length; i++) {
13849
13855
  const vout = tx.vout[i];
13850
13856
  if (vout.scriptpubkey_address === boardingAddress) {
13851
- let spentStatuses = outspendCache.get(tx.txid);
13852
- if (!spentStatuses) {
13853
- spentStatuses = await this.onchainProvider.getTxOutspends(tx.txid);
13854
- outspendCache.set(tx.txid, spentStatuses);
13855
- }
13856
- const spentStatus = spentStatuses[i];
13857
+ const spentStatus = await outspendOf(tx.txid, i);
13857
13858
  const commitmentTxid = spentStatus?.txid || commitmentByOutpoint.get(`${tx.txid}:${i}`);
13858
13859
  const spent = Boolean(spentStatus?.spent) || commitmentTxid !== void 0;
13859
13860
  if (spent && commitmentTxid) {
@@ -13920,9 +13921,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13920
13921
  async getBoardingTapscripts(allowedSigners) {
13921
13922
  const byScript = /* @__PURE__ */ new Map();
13922
13923
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
13923
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkGN2K4WBP_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13924
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkGW42FS2X_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13924
13925
  add(
13925
- new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
13926
+ new chunkGW42FS2X_cjs.DefaultVtxo.Script({
13926
13927
  pubKey: await this.identity.xOnlyPublicKey(),
13927
13928
  serverPubKey: this.boardingTapscript.options.serverPubKey,
13928
13929
  csvTimelock: boardingCsv
@@ -13937,7 +13938,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13937
13938
  for (const c of boardingContracts) {
13938
13939
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
13939
13940
  try {
13940
- add(chunkGN2K4WBP_cjs.BoardingContractHandler.createScript(c.params));
13941
+ add(chunkGW42FS2X_cjs.BoardingContractHandler.createScript(c.params));
13941
13942
  } catch (e) {
13942
13943
  console.warn("Skipping malformed boarding contract", c.script, e);
13943
13944
  }
@@ -13966,7 +13967,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13966
13967
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
13967
13968
  // not the wallet's current boarding timelock, which a signer
13968
13969
  // rotation may have changed.
13969
- csvTimelock: chunkUUSKJOSX_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
13970
+ csvTimelock: chunkXLHUGP3G_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
13970
13971
  coins: utxos
13971
13972
  };
13972
13973
  })
@@ -14122,7 +14123,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14122
14123
  /** Fetch Arkade transaction ids that are still pending final settlement. */
14123
14124
  async fetchPendingTxs() {
14124
14125
  const scripts = await this.getWalletScripts();
14125
- const vtxos = await chunkUUSKJOSX_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
14126
+ const vtxos = await chunkXLHUGP3G_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
14126
14127
  return vtxos.filter(
14127
14128
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
14128
14129
  ).map((_) => _.arkTxId);
@@ -14153,7 +14154,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14153
14154
  });
14154
14155
  for (const contract of contracts) {
14155
14156
  if (map.has(contract.script)) continue;
14156
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
14157
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
14157
14158
  if (handler) {
14158
14159
  const script = handler.createScript(contract.params);
14159
14160
  map.set(contract.script, script);
@@ -14265,16 +14266,17 @@ var ReadonlyWallet = class _ReadonlyWallet {
14265
14266
  }
14266
14267
  });
14267
14268
  const baselinePubkey = await this.identity.xOnlyPublicKey();
14268
- const delegatePubKey = this.offchainTapscript instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14269
+ const delegatePubKey = this.offchainTapscript instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14269
14270
  const baselineSigners = [
14270
14271
  this.offchainTapscript.options.serverPubKey,
14271
14272
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
14272
14273
  ];
14273
14274
  const seenBaselineScripts = /* @__PURE__ */ new Set();
14275
+ const baseline = [];
14274
14276
  for (const serverPubKey of baselineSigners) {
14275
14277
  for (const csvTimelock2 of this.walletContractTimelocks) {
14276
- const csvTimelockStr = chunkUUSKJOSX_cjs.timelockToSequence(csvTimelock2).toString();
14277
- const defaultScript = new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
14278
+ const csvTimelockStr = chunkXLHUGP3G_cjs.timelockToSequence(csvTimelock2).toString();
14279
+ const defaultScript = new chunkGW42FS2X_cjs.DefaultVtxo.Script({
14278
14280
  pubKey: baselinePubkey,
14279
14281
  serverPubKey,
14280
14282
  csvTimelock: csvTimelock2
@@ -14282,7 +14284,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14282
14284
  const defaultScriptHex = base.hex.encode(defaultScript.pkScript);
14283
14285
  if (!seenBaselineScripts.has(defaultScriptHex)) {
14284
14286
  seenBaselineScripts.add(defaultScriptHex);
14285
- await manager.createContract({
14287
+ baseline.push({
14286
14288
  type: "default",
14287
14289
  params: {
14288
14290
  pubKey: base.hex.encode(defaultScript.options.pubKey),
@@ -14295,7 +14297,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14295
14297
  });
14296
14298
  }
14297
14299
  if (delegatePubKey) {
14298
- const delegateScript = new chunkGN2K4WBP_cjs.DelegateVtxo.Script({
14300
+ const delegateScript = new chunkGW42FS2X_cjs.DelegateVtxo.Script({
14299
14301
  pubKey: baselinePubkey,
14300
14302
  serverPubKey,
14301
14303
  delegatePubKey,
@@ -14304,7 +14306,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14304
14306
  const delegateScriptHex = base.hex.encode(delegateScript.pkScript);
14305
14307
  if (seenBaselineScripts.has(delegateScriptHex)) continue;
14306
14308
  seenBaselineScripts.add(delegateScriptHex);
14307
- await manager.createContract({
14309
+ baseline.push({
14308
14310
  type: "delegate",
14309
14311
  params: {
14310
14312
  pubKey: base.hex.encode(delegateScript.options.pubKey),
@@ -14319,9 +14321,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
14319
14321
  }
14320
14322
  }
14321
14323
  }
14322
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkGN2K4WBP_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14324
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkGW42FS2X_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14323
14325
  for (const serverPubKey of baselineSigners) {
14324
- const baselineBoarding = new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
14326
+ const baselineBoarding = new chunkGW42FS2X_cjs.DefaultVtxo.Script({
14325
14327
  pubKey: baselinePubkey,
14326
14328
  serverPubKey,
14327
14329
  csvTimelock: boardingCsvTimelock
@@ -14329,18 +14331,19 @@ var ReadonlyWallet = class _ReadonlyWallet {
14329
14331
  const boardingScriptHex = base.hex.encode(baselineBoarding.pkScript);
14330
14332
  if (seenBaselineScripts.has(boardingScriptHex)) continue;
14331
14333
  seenBaselineScripts.add(boardingScriptHex);
14332
- await manager.createContract({
14334
+ baseline.push({
14333
14335
  type: "boarding",
14334
14336
  params: {
14335
14337
  pubKey: base.hex.encode(baselineBoarding.options.pubKey),
14336
14338
  serverPubKey: base.hex.encode(serverPubKey),
14337
- csvTimelock: chunkUUSKJOSX_cjs.timelockToSequence(boardingCsvTimelock).toString()
14339
+ csvTimelock: chunkXLHUGP3G_cjs.timelockToSequence(boardingCsvTimelock).toString()
14338
14340
  },
14339
14341
  script: boardingScriptHex,
14340
14342
  address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
14341
14343
  state: "active"
14342
14344
  });
14343
14345
  }
14346
+ await manager.createContracts(baseline);
14344
14347
  return manager;
14345
14348
  }
14346
14349
  /** Dispose wallet-owned managers and release background resources. */
@@ -14519,7 +14522,7 @@ var Wallet2 = class extends ReadonlyWallet {
14519
14522
  serverPubKey: this.offchainTapscript.options.serverPubKey,
14520
14523
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
14521
14524
  csvTimelocks: this.walletContractTimelocks,
14522
- delegatePubKey: this.offchainTapscript instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
14525
+ delegatePubKey: this.offchainTapscript instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
14523
14526
  };
14524
14527
  }
14525
14528
  _signerRouter;
@@ -14679,7 +14682,7 @@ var Wallet2 = class extends ReadonlyWallet {
14679
14682
  const [row] = await manager.getContracts({ script: base.hex.encode(display.pkScript) });
14680
14683
  const persisted = row?.metadata?.signingDescriptor;
14681
14684
  if (typeof persisted === "string") return persisted;
14682
- return chunkGN2K4WBP_cjs.identityDescriptor(this.identity);
14685
+ return chunkGW42FS2X_cjs.identityDescriptor(this.identity);
14683
14686
  }
14684
14687
  /**
14685
14688
  * Build, persist and shape one address of `type` owned by `descriptor`. The descriptor is the
@@ -14689,7 +14692,7 @@ var Wallet2 = class extends ReadonlyWallet {
14689
14692
  async mintAddress(manager, type, descriptor, tagSource, allocated) {
14690
14693
  if (type === "boarding") {
14691
14694
  const built2 = this.buildBoardingContract(
14692
- chunkGN2K4WBP_cjs.deriveDescriptorLeafPubKey(descriptor),
14695
+ chunkGW42FS2X_cjs.deriveDescriptorLeafPubKey(descriptor),
14693
14696
  descriptor,
14694
14697
  tagSource
14695
14698
  );
@@ -14726,11 +14729,11 @@ var Wallet2 = class extends ReadonlyWallet {
14726
14729
  * (offchain analogue: {@link buildReceiveContract}).
14727
14730
  */
14728
14731
  buildBoardingContract(pubKey, descriptor, tagSource) {
14729
- const tapscript = new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
14732
+ const tapscript = new chunkGW42FS2X_cjs.DefaultVtxo.Script({
14730
14733
  ...this._boardingTapscript.options,
14731
14734
  pubKey
14732
14735
  });
14733
- const csvTimelock2 = tapscript.options.csvTimelock ?? chunkGN2K4WBP_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14736
+ const csvTimelock2 = tapscript.options.csvTimelock ?? chunkGW42FS2X_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14734
14737
  return {
14735
14738
  tapscript,
14736
14739
  params: {
@@ -14738,13 +14741,13 @@ var Wallet2 = class extends ReadonlyWallet {
14738
14741
  params: {
14739
14742
  pubKey: base.hex.encode(pubKey),
14740
14743
  serverPubKey: base.hex.encode(tapscript.options.serverPubKey),
14741
- csvTimelock: chunkUUSKJOSX_cjs.timelockToSequence(csvTimelock2).toString()
14744
+ csvTimelock: chunkXLHUGP3G_cjs.timelockToSequence(csvTimelock2).toString()
14742
14745
  },
14743
14746
  script: base.hex.encode(tapscript.pkScript),
14744
14747
  address: tapscript.address(this.network.hrp, this.arkServerPublicKey).encode(),
14745
14748
  state: "active",
14746
14749
  metadata: {
14747
- ...tagSource && { source: chunkGN2K4WBP_cjs.WALLET_RECEIVE_SOURCE },
14750
+ ...tagSource && { source: chunkGW42FS2X_cjs.WALLET_RECEIVE_SOURCE },
14748
14751
  signingDescriptor: descriptor
14749
14752
  }
14750
14753
  }
@@ -14766,7 +14769,7 @@ var Wallet2 = class extends ReadonlyWallet {
14766
14769
  if (this._hdProvider) {
14767
14770
  return (await this.getContractManager()).getNextSigningDescriptor();
14768
14771
  }
14769
- return chunkGN2K4WBP_cjs.identityDescriptor(this.identity);
14772
+ return chunkGW42FS2X_cjs.identityDescriptor(this.identity);
14770
14773
  }
14771
14774
  /**
14772
14775
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -14842,7 +14845,7 @@ var Wallet2 = class extends ReadonlyWallet {
14842
14845
  * the stable public API.
14843
14846
  */
14844
14847
  async rotateServerSigner(newServerPubKey, checkpointTapscript) {
14845
- const xonly = chunkGN2K4WBP_cjs.toXOnly(newServerPubKey, "ark signer key");
14848
+ const xonly = chunkGW42FS2X_cjs.toXOnly(newServerPubKey, "ark signer key");
14846
14849
  const newServerUnrollScript = assertValidServerUnrollScript(
14847
14850
  checkpointTapscript,
14848
14851
  this.network,
@@ -14872,21 +14875,21 @@ var Wallet2 = class extends ReadonlyWallet {
14872
14875
  const [currentBoardingRow] = await manager.getContracts({
14873
14876
  script: currentBoardingScript
14874
14877
  });
14875
- const newOffchain = this.offchainTapscript instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script ? new chunkGN2K4WBP_cjs.DelegateVtxo.Script({
14878
+ const newOffchain = this.offchainTapscript instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script ? new chunkGW42FS2X_cjs.DelegateVtxo.Script({
14876
14879
  ...this.offchainTapscript.options,
14877
14880
  serverPubKey: xonly
14878
- }) : new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
14881
+ }) : new chunkGW42FS2X_cjs.DefaultVtxo.Script({
14879
14882
  ...this.offchainTapscript.options,
14880
14883
  serverPubKey: xonly
14881
14884
  });
14882
- const newBoarding = new chunkGN2K4WBP_cjs.DefaultVtxo.Script({
14885
+ const newBoarding = new chunkGW42FS2X_cjs.DefaultVtxo.Script({
14883
14886
  ...this._boardingTapscript.options,
14884
14887
  serverPubKey: xonly
14885
14888
  });
14886
- const offchainCsv = chunkUUSKJOSX_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14889
+ const offchainCsv = chunkXLHUGP3G_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14887
14890
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
14888
14891
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
14889
- if (newOffchain instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script) {
14892
+ if (newOffchain instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script) {
14890
14893
  await manager.createContract({
14891
14894
  type: "delegate",
14892
14895
  params: {
@@ -14914,13 +14917,13 @@ var Wallet2 = class extends ReadonlyWallet {
14914
14917
  metadata: currentOffchainRow?.metadata
14915
14918
  });
14916
14919
  }
14917
- const boardingCsv = newBoarding.options.csvTimelock ?? chunkGN2K4WBP_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14920
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkGW42FS2X_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14918
14921
  await manager.createContract({
14919
14922
  type: "boarding",
14920
14923
  params: {
14921
14924
  pubKey: base.hex.encode(newBoarding.options.pubKey),
14922
14925
  serverPubKey: base.hex.encode(xonly),
14923
- csvTimelock: chunkUUSKJOSX_cjs.timelockToSequence(boardingCsv).toString()
14926
+ csvTimelock: chunkXLHUGP3G_cjs.timelockToSequence(boardingCsv).toString()
14924
14927
  },
14925
14928
  script: base.hex.encode(newBoarding.pkScript),
14926
14929
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -14948,14 +14951,14 @@ var Wallet2 = class extends ReadonlyWallet {
14948
14951
  _restoreInFlight;
14949
14952
  _addPendingSpends(inputs) {
14950
14953
  for (const input of inputs) {
14951
- if (chunkUUSKJOSX_cjs.isVirtualCoin(input)) {
14954
+ if (chunkXLHUGP3G_cjs.isVirtualCoin(input)) {
14952
14955
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
14953
14956
  }
14954
14957
  }
14955
14958
  }
14956
14959
  _removePendingSpends(inputs) {
14957
14960
  for (const input of inputs) {
14958
- if (chunkUUSKJOSX_cjs.isVirtualCoin(input)) {
14961
+ if (chunkXLHUGP3G_cjs.isVirtualCoin(input)) {
14959
14962
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
14960
14963
  }
14961
14964
  }
@@ -15019,7 +15022,7 @@ var Wallet2 = class extends ReadonlyWallet {
15019
15022
  if (clashing.length > 0) throw new VtxoReservedError(clashing, "in-flight");
15020
15023
  }
15021
15024
  _assertNotHeld(inputs) {
15022
- const held = coinKeys(inputs.filter(chunkUUSKJOSX_cjs.isVirtualCoin)).filter(
15025
+ const held = coinKeys(inputs.filter(chunkXLHUGP3G_cjs.isVirtualCoin)).filter(
15023
15026
  (key) => this._heldOutpoints.has(key)
15024
15027
  );
15025
15028
  if (held.length > 0) throw new VtxoReservedError(held, "held");
@@ -15057,13 +15060,13 @@ var Wallet2 = class extends ReadonlyWallet {
15057
15060
  const manager = await this.getContractManager();
15058
15061
  const provider = this._hdProvider;
15059
15062
  const hd = provider !== void 0;
15060
- const staticDescriptor = hd ? void 0 : await chunkGN2K4WBP_cjs.identityDescriptor(this.identity);
15063
+ const staticDescriptor = hd ? void 0 : await chunkGW42FS2X_cjs.identityDescriptor(this.identity);
15061
15064
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
15062
- const delegatePubKey = this.offchainTapscript instanceof chunkGN2K4WBP_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
15065
+ const delegatePubKey = this.offchainTapscript instanceof chunkGW42FS2X_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
15063
15066
  const arkInfo = await this.arkProvider.getInfo();
15064
- const currentSignerPubKey = chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
15067
+ const currentSignerPubKey = chunkGW42FS2X_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
15065
15068
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
15066
- (s) => chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
15069
+ (s) => chunkGW42FS2X_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
15067
15070
  );
15068
15071
  const deps = {
15069
15072
  indexerProvider: this.indexerProvider,
@@ -15075,7 +15078,7 @@ var Wallet2 = class extends ReadonlyWallet {
15075
15078
  deprecatedSignerPubKeys,
15076
15079
  csvTimelocks: this.walletContractTimelocks,
15077
15080
  // Boarding-exit CSV, distinct from the unilateral-exit matrix.
15078
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkGN2K4WBP_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
15081
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkGW42FS2X_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
15079
15082
  delegatePubKey
15080
15083
  };
15081
15084
  const result = await manager.scanContracts({
@@ -15192,7 +15195,7 @@ var Wallet2 = class extends ReadonlyWallet {
15192
15195
  throw new Error("Invalid configured public key");
15193
15196
  }
15194
15197
  const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
15195
- const forfeitPubkey = chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
15198
+ const forfeitPubkey = chunkGW42FS2X_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
15196
15199
  const forfeitAddress = btcSigner.Address(setup.network).decode(setup.info.forfeitAddress);
15197
15200
  const forfeitOutputScript = btcSigner.OutScript.encode(forfeitAddress);
15198
15201
  const serverUnrollScript = assertValidServerUnrollScript(
@@ -15360,13 +15363,13 @@ var Wallet2 = class extends ReadonlyWallet {
15360
15363
  void this.logUngatedInputs("settle({ inputs })", params.inputs);
15361
15364
  }
15362
15365
  const offchainAddress = await this.getAddress();
15363
- const offchainPkScript = chunkUUSKJOSX_cjs.ArkAddress.decode(offchainAddress).pkScript;
15366
+ const offchainPkScript = chunkXLHUGP3G_cjs.ArkAddress.decode(offchainAddress).pkScript;
15364
15367
  const offchainOutputScript = base.hex.encode(offchainPkScript);
15365
15368
  if (!params) {
15366
15369
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
15367
15370
  const estimator = new Estimator(fees.intentFee);
15368
15371
  let amount = 0;
15369
- const exitScript = chunkUUSKJOSX_cjs.CSVMultisigTapscript.decode(
15372
+ const exitScript = chunkXLHUGP3G_cjs.CSVMultisigTapscript.decode(
15370
15373
  base.hex.decode(this.boardingTapscript.exitScript)
15371
15374
  );
15372
15375
  const boardingTimelock = exitScript.params.timelock;
@@ -15398,7 +15401,7 @@ var Wallet2 = class extends ReadonlyWallet {
15398
15401
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
15399
15402
  break;
15400
15403
  }
15401
- const inputFee = estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(vtxo));
15404
+ const inputFee = estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(vtxo));
15402
15405
  if (inputFee.satoshis >= vtxo.value) {
15403
15406
  continue;
15404
15407
  }
@@ -15450,7 +15453,7 @@ var Wallet2 = class extends ReadonlyWallet {
15450
15453
  let script;
15451
15454
  let arkAddress;
15452
15455
  try {
15453
- arkAddress = chunkUUSKJOSX_cjs.ArkAddress.decode(output.address);
15456
+ arkAddress = chunkXLHUGP3G_cjs.ArkAddress.decode(output.address);
15454
15457
  } catch {
15455
15458
  arkAddress = void 0;
15456
15459
  }
@@ -15522,11 +15525,11 @@ var Wallet2 = class extends ReadonlyWallet {
15522
15525
  ]);
15523
15526
  let intentTxId;
15524
15527
  try {
15525
- intentTxId = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(intent.proof)).id;
15528
+ intentTxId = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(intent.proof)).id;
15526
15529
  } catch {
15527
15530
  intentTxId = params.inputs.map((i) => `${i.txid}:${i.vout}`).sort().join("|");
15528
15531
  }
15529
- const settleInputVtxos = params.inputs.filter(chunkUUSKJOSX_cjs.isVirtualCoin);
15532
+ const settleInputVtxos = params.inputs.filter(chunkXLHUGP3G_cjs.isVirtualCoin);
15530
15533
  const contractManager = await this.getContractManager();
15531
15534
  await contractManager.assertAnnotatable(settleInputVtxos);
15532
15535
  await contractManager.assertSpendableNow?.(
@@ -15535,7 +15538,7 @@ var Wallet2 = class extends ReadonlyWallet {
15535
15538
  );
15536
15539
  if (picked) this._assertNotHeld(params.inputs);
15537
15540
  this._addPendingSpends(params.inputs);
15538
- const boardingKeys = onReserved ? coinKeys(params.inputs.filter((i) => !chunkUUSKJOSX_cjs.isVirtualCoin(i))) : [];
15541
+ const boardingKeys = onReserved ? coinKeys(params.inputs.filter((i) => !chunkXLHUGP3G_cjs.isVirtualCoin(i))) : [];
15539
15542
  for (const key of boardingKeys) this._pendingSpendOutpoints.add(key);
15540
15543
  const settlingKeys = params.inputs.map((i) => `${i.txid}:${i.vout}`);
15541
15544
  for (const key of settlingKeys) this._settlingOutpoints.add(key);
@@ -15646,7 +15649,7 @@ var Wallet2 = class extends ReadonlyWallet {
15646
15649
  async maybeRotateBoardingAfterBoard(inputs) {
15647
15650
  if (!this._descriptorProvider) return;
15648
15651
  const consumedBoarding = inputs.some(
15649
- (input) => typeof input !== "string" && !chunkUUSKJOSX_cjs.isVirtualCoin(input)
15652
+ (input) => typeof input !== "string" && !chunkXLHUGP3G_cjs.isVirtualCoin(input)
15650
15653
  );
15651
15654
  if (!consumedBoarding) return;
15652
15655
  try {
@@ -15657,7 +15660,7 @@ var Wallet2 = class extends ReadonlyWallet {
15657
15660
  }
15658
15661
  async handleSettlementFinalizationEvent(event, inputs, forfeitOutputScript, expectedRecipients, connectorsGraph, validatedCommitmentTxid) {
15659
15662
  const signedForfeits = [];
15660
- let settlementPsbt = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
15663
+ let settlementPsbt = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
15661
15664
  assertFinalCommitmentMatchesValidated(
15662
15665
  settlementPsbt,
15663
15666
  validatedCommitmentTxid,
@@ -15670,7 +15673,7 @@ var Wallet2 = class extends ReadonlyWallet {
15670
15673
  let connectorIndex = 0;
15671
15674
  const connectorsLeaves = connectorsGraph?.leaves() || [];
15672
15675
  for (const input of inputs) {
15673
- if (!chunkUUSKJOSX_cjs.isVirtualCoin(input)) {
15676
+ if (!chunkXLHUGP3G_cjs.isVirtualCoin(input)) {
15674
15677
  let matched = false;
15675
15678
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
15676
15679
  const settlementInput = settlementPsbt.getInput(i);
@@ -15708,7 +15711,7 @@ var Wallet2 = class extends ReadonlyWallet {
15708
15711
  }
15709
15712
  continue;
15710
15713
  }
15711
- if (!chunkUUSKJOSX_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
15714
+ if (!chunkXLHUGP3G_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
15712
15715
  continue;
15713
15716
  }
15714
15717
  if (connectorsLeaves.length === 0) {
@@ -15736,7 +15739,7 @@ var Wallet2 = class extends ReadonlyWallet {
15736
15739
  index: input.vout,
15737
15740
  witnessUtxo: {
15738
15741
  amount: BigInt(input.value),
15739
- script: chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).pkScript
15742
+ script: chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).pkScript
15740
15743
  },
15741
15744
  sighashType: btcSigner.SigHash.DEFAULT,
15742
15745
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -15755,7 +15758,7 @@ var Wallet2 = class extends ReadonlyWallet {
15755
15758
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
15756
15759
  {
15757
15760
  index: 0,
15758
- lookupScript: chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).pkScript
15761
+ lookupScript: chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).pkScript
15759
15762
  }
15760
15763
  ]);
15761
15764
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -15813,7 +15816,7 @@ var Wallet2 = class extends ReadonlyWallet {
15813
15816
  resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
15814
15817
  );
15815
15818
  await this.arkProvider.confirmRegistration(intentId);
15816
- const sweepTapscript = chunkUUSKJOSX_cjs.CSVMultisigTapscript.encode({
15819
+ const sweepTapscript = chunkXLHUGP3G_cjs.CSVMultisigTapscript.encode({
15817
15820
  timelock,
15818
15821
  pubkeys: [this.forfeitPubkey]
15819
15822
  }).script;
@@ -15828,14 +15831,14 @@ var Wallet2 = class extends ReadonlyWallet {
15828
15831
  throw new Error("Sweep tap tree root not set");
15829
15832
  }
15830
15833
  const xOnlyPublicKeys = event.cosignersPublicKeys.map(
15831
- (k) => base.hex.encode(chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15834
+ (k) => base.hex.encode(chunkGW42FS2X_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15832
15835
  );
15833
15836
  const signerPublicKey = await session.getPublicKey();
15834
- const xonlySignerPublicKey = chunkGN2K4WBP_cjs.toXOnly(signerPublicKey, "signer key");
15837
+ const xonlySignerPublicKey = chunkGW42FS2X_cjs.toXOnly(signerPublicKey, "signer key");
15835
15838
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
15836
15839
  return { skip: true };
15837
15840
  }
15838
- const commitmentTx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(
15841
+ const commitmentTx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(
15839
15842
  base.base64.decode(event.unsignedCommitmentTx)
15840
15843
  );
15841
15844
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
@@ -15917,9 +15920,9 @@ var Wallet2 = class extends ReadonlyWallet {
15917
15920
  ...existing ?? {},
15918
15921
  intentTxId,
15919
15922
  registerProof: intent.proof,
15920
- registerProofMessage: chunkUUSKJOSX_cjs.Intent.encodeMessage(intent.message),
15923
+ registerProofMessage: chunkXLHUGP3G_cjs.Intent.encodeMessage(intent.message),
15921
15924
  deleteProof: deleteIntent.proof,
15922
- deleteProofMessage: chunkUUSKJOSX_cjs.Intent.encodeMessage(deleteIntent.message),
15925
+ deleteProofMessage: chunkXLHUGP3G_cjs.Intent.encodeMessage(deleteIntent.message),
15923
15926
  intentVtxos: inputs.map((i) => ({
15924
15927
  txid: i.txid,
15925
15928
  vout: i.vout
@@ -15952,7 +15955,7 @@ var Wallet2 = class extends ReadonlyWallet {
15952
15955
  try {
15953
15956
  return await this.arkProvider.registerIntent(intent);
15954
15957
  } catch (error) {
15955
- if (error instanceof chunkUUSKJOSX_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
15958
+ if (error instanceof chunkXLHUGP3G_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
15956
15959
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
15957
15960
  await this.arkProvider.deleteIntent(deleteIntent);
15958
15961
  return this.arkProvider.registerIntent(intent);
@@ -15968,7 +15971,7 @@ var Wallet2 = class extends ReadonlyWallet {
15968
15971
  expire_at: 0,
15969
15972
  cosigners_public_keys: cosignerPubKeys
15970
15973
  };
15971
- const proof = chunkUUSKJOSX_cjs.Intent.create(message, coins, outputs);
15974
+ const proof = chunkXLHUGP3G_cjs.Intent.create(message, coins, outputs);
15972
15975
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15973
15976
  return {
15974
15977
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15980,7 +15983,7 @@ var Wallet2 = class extends ReadonlyWallet {
15980
15983
  type: "delete",
15981
15984
  expire_at: 0
15982
15985
  };
15983
- const proof = chunkUUSKJOSX_cjs.Intent.create(message, coins, []);
15986
+ const proof = chunkXLHUGP3G_cjs.Intent.create(message, coins, []);
15984
15987
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15985
15988
  return {
15986
15989
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -15992,7 +15995,7 @@ var Wallet2 = class extends ReadonlyWallet {
15992
15995
  type: "get-pending-tx",
15993
15996
  expire_at: 0
15994
15997
  };
15995
- const proof = chunkUUSKJOSX_cjs.Intent.create(message, coins, []);
15998
+ const proof = chunkXLHUGP3G_cjs.Intent.create(message, coins, []);
15996
15999
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
15997
16000
  return {
15998
16001
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -16013,7 +16016,7 @@ var Wallet2 = class extends ReadonlyWallet {
16013
16016
  if (!vtxos || vtxos.length === 0) {
16014
16017
  const scriptMap = await this.getScriptMap();
16015
16018
  const allExtended = [];
16016
- const fetchedVtxos = await chunkUUSKJOSX_cjs.getAllNormalizedVtxos(this.indexerProvider, [
16019
+ const fetchedVtxos = await chunkXLHUGP3G_cjs.getAllNormalizedVtxos(this.indexerProvider, [
16017
16020
  ...scriptMap.keys()
16018
16021
  ]);
16019
16022
  for (const vtxo of fetchedVtxos) {
@@ -16056,8 +16059,8 @@ var Wallet2 = class extends ReadonlyWallet {
16056
16059
  batchPending.push(pendingTx.arkTxid);
16057
16060
  try {
16058
16061
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((c) => {
16059
- const tx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(c));
16060
- chunkUUSKJOSX_cjs.assertAllowedSighashTypes(tx);
16062
+ const tx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(c));
16063
+ chunkXLHUGP3G_cjs.assertAllowedSighashTypes(tx);
16061
16064
  return tx;
16062
16065
  });
16063
16066
  assertCheckpointsMatchInputs(
@@ -16126,11 +16129,11 @@ var Wallet2 = class extends ReadonlyWallet {
16126
16129
  * and one per deprecated signer — else a pre-rotation tx would stay pending forever.
16127
16130
  */
16128
16131
  checkpointUnrollCandidates(info) {
16129
- const current = chunkUUSKJOSX_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
16132
+ const current = chunkXLHUGP3G_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
16130
16133
  const candidates = [this._serverUnrollScript, current];
16131
16134
  for (const deprecated of signerSetFromInfo(info).deprecated.keys()) {
16132
16135
  candidates.push(
16133
- chunkUUSKJOSX_cjs.CSVMultisigTapscript.encode({
16136
+ chunkXLHUGP3G_cjs.CSVMultisigTapscript.encode({
16134
16137
  ...current.params,
16135
16138
  pubkeys: [base.hex.decode(deprecated)]
16136
16139
  })
@@ -16225,7 +16228,7 @@ var Wallet2 = class extends ReadonlyWallet {
16225
16228
  if (vtxos.length === 0) {
16226
16229
  throw new Error("No VTXOs found for this arkadeCash");
16227
16230
  }
16228
- const myPkScript = chunkUUSKJOSX_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
16231
+ const myPkScript = chunkXLHUGP3G_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
16229
16232
  let { spendable, recoverable, unclaimed } = this.classifyCashVtxos(vtxos);
16230
16233
  let swept = 0;
16231
16234
  const drainable = vtxos.filter(
@@ -16352,7 +16355,7 @@ var Wallet2 = class extends ReadonlyWallet {
16352
16355
  params: {
16353
16356
  pubKey: base.hex.encode(cash.publicKey),
16354
16357
  serverPubKey: base.hex.encode(cash.serverPubKey),
16355
- csvTimelock: chunkUUSKJOSX_cjs.timelockToSequence(cash.csvTimelock).toString()
16358
+ csvTimelock: chunkXLHUGP3G_cjs.timelockToSequence(cash.csvTimelock).toString()
16356
16359
  },
16357
16360
  script: base.hex.encode(cashScript.pkScript),
16358
16361
  address: cashAddress.encode(),
@@ -16433,7 +16436,7 @@ var Wallet2 = class extends ReadonlyWallet {
16433
16436
  const recoverable = [];
16434
16437
  const unclaimed = [];
16435
16438
  for (const vtxo of vtxos) {
16436
- if (chunkUUSKJOSX_cjs.isVtxoSpent(vtxo)) {
16439
+ if (chunkXLHUGP3G_cjs.isVtxoSpent(vtxo)) {
16437
16440
  unclaimed.push(cashReport(vtxo, "already-spent"));
16438
16441
  } else if (vtxo.isUnrolled) {
16439
16442
  unclaimed.push(cashReport(vtxo, "exited"));
@@ -16455,7 +16458,7 @@ var Wallet2 = class extends ReadonlyWallet {
16455
16458
  const all = [];
16456
16459
  const seen = /* @__PURE__ */ new Set();
16457
16460
  for (let pageIndex = 0; ; pageIndex++) {
16458
- const { vtxos, page } = await chunkUUSKJOSX_cjs.getNormalizedVtxos(this.indexerProvider, {
16461
+ const { vtxos, page } = await chunkXLHUGP3G_cjs.getNormalizedVtxos(this.indexerProvider, {
16459
16462
  scripts,
16460
16463
  pageIndex,
16461
16464
  pageSize
@@ -16493,7 +16496,7 @@ var Wallet2 = class extends ReadonlyWallet {
16493
16496
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
16494
16497
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
16495
16498
  const message = { type: "get-pending-tx", expire_at: 0 };
16496
- const proof = chunkUUSKJOSX_cjs.Intent.create(message, batch, []);
16499
+ const proof = chunkXLHUGP3G_cjs.Intent.create(message, batch, []);
16497
16500
  const signedProof = await identity.sign(
16498
16501
  proof,
16499
16502
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -16514,8 +16517,8 @@ var Wallet2 = class extends ReadonlyWallet {
16514
16517
  for (const pendingTx of pendingTxs) {
16515
16518
  try {
16516
16519
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((checkpoint) => {
16517
- const tx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(checkpoint));
16518
- chunkUUSKJOSX_cjs.assertAllowedSighashTypes(tx);
16520
+ const tx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(checkpoint));
16521
+ chunkXLHUGP3G_cjs.assertAllowedSighashTypes(tx);
16519
16522
  return tx;
16520
16523
  });
16521
16524
  assertCheckpointsMatchInputs(
@@ -16555,7 +16558,7 @@ var Wallet2 = class extends ReadonlyWallet {
16555
16558
  }
16556
16559
  /** Sum the outputs of an ark tx PSBT that pay the given scriptPubKey. */
16557
16560
  arkTxAmountPaidTo(arkTxPsbt, pkScriptHex) {
16558
- const arkTx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(arkTxPsbt));
16561
+ const arkTx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(arkTxPsbt));
16559
16562
  let total = 0;
16560
16563
  for (let i = 0; i < arkTx.outputsLength; i++) {
16561
16564
  const output = arkTx.getOutput(i);
@@ -16614,7 +16617,7 @@ var Wallet2 = class extends ReadonlyWallet {
16614
16617
  throw new Error("send({ maxChangeFee }): expected a non-negative safe integer");
16615
16618
  }
16616
16619
  if (selectedVtxos) {
16617
- if (inputExpiryFloor) selectedVtxos = selectedVtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo);
16620
+ if (inputExpiryFloor) selectedVtxos = selectedVtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo);
16618
16621
  if (inputExpiryFloor && selectedVtxos.some((coin) => !meetsInputExpiryFloor(coin, inputExpiryFloor))) {
16619
16622
  throw new Error("send({ selectedVtxos }): input expiry floor not met");
16620
16623
  }
@@ -16749,7 +16752,7 @@ var Wallet2 = class extends ReadonlyWallet {
16749
16752
  script: recipient.script,
16750
16753
  amount: BigInt(recipient.amount),
16751
16754
  // Already checked against the recipient address in `validateRecipients`.
16752
- ...recipient.tapTree ? { tapTree: chunkUUSKJOSX_cjs.toBIP371TapTree(recipient.tapTree) } : {}
16755
+ ...recipient.tapTree ? { tapTree: chunkXLHUGP3G_cjs.toBIP371TapTree(recipient.tapTree) } : {}
16753
16756
  }));
16754
16757
  const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
16755
16758
  let changeAmount = totalBtcSelected - totalBtcOutput;
@@ -16941,10 +16944,10 @@ var Wallet2 = class extends ReadonlyWallet {
16941
16944
  const serverPubKey = this.arkServerPublicKey;
16942
16945
  const serverUnrollScript = this.serverUnrollScript;
16943
16946
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
16944
- const normalizedInputs = inputs.map(chunkUUSKJOSX_cjs.normalizeVtxo);
16945
- const at = now ?? await chunkUUSKJOSX_cjs.resolveTimeHeight(this.onchainProvider);
16947
+ const normalizedInputs = inputs.map(chunkXLHUGP3G_cjs.normalizeVtxo);
16948
+ const at = now ?? await chunkXLHUGP3G_cjs.resolveTimeHeight(this.onchainProvider);
16946
16949
  for (const input of normalizedInputs) {
16947
- if (!chunkUUSKJOSX_cjs.canSpendOffchain(input, at)) {
16950
+ if (!chunkXLHUGP3G_cjs.canSpendOffchain(input, at)) {
16948
16951
  throw new Error(
16949
16952
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
16950
16953
  );
@@ -17028,7 +17031,7 @@ var Wallet2 = class extends ReadonlyWallet {
17028
17031
  );
17029
17032
  const arkTxJobs = inputs.map((input, index) => ({
17030
17033
  index,
17031
- lookupScript: chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).pkScript
17034
+ lookupScript: chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).pkScript
17032
17035
  }));
17033
17036
  const identity = this.identity;
17034
17037
  const signer = {
@@ -17137,7 +17140,7 @@ var Wallet2 = class extends ReadonlyWallet {
17137
17140
  }
17138
17141
  const checkpointIdByOutpoint = /* @__PURE__ */ new Map();
17139
17142
  for (const encoded of signedCheckpointTxs) {
17140
- const checkpoint = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
17143
+ const checkpoint = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
17141
17144
  for (let i = 0; i < checkpoint.inputsLength; i++) {
17142
17145
  const input = checkpoint.getInput(i);
17143
17146
  if (!input.txid) continue;
@@ -17253,12 +17256,12 @@ var Wallet2 = class extends ReadonlyWallet {
17253
17256
  const spentVtxos = [];
17254
17257
  const inputArkTxIds = /* @__PURE__ */ new Set();
17255
17258
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
17256
- const vtxoInputs = inputs.filter(chunkUUSKJOSX_cjs.isVirtualCoin);
17259
+ const vtxoInputs = inputs.filter(chunkXLHUGP3G_cjs.isVirtualCoin);
17257
17260
  const cm = await this.getContractManager();
17258
17261
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
17259
17262
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
17260
17263
  for (const input of inputs) {
17261
- if (chunkUUSKJOSX_cjs.isVirtualCoin(input)) {
17264
+ if (chunkXLHUGP3G_cjs.isVirtualCoin(input)) {
17262
17265
  const outpoint = `${input.txid}:${input.vout}`;
17263
17266
  const vtxo = annotatedByKey.get(outpoint);
17264
17267
  if (!vtxo) {
@@ -17275,7 +17278,7 @@ var Wallet2 = class extends ReadonlyWallet {
17275
17278
  } else {
17276
17279
  let sourceAddress;
17277
17280
  try {
17278
- sourceAddress = chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
17281
+ sourceAddress = chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
17279
17282
  this.network
17280
17283
  );
17281
17284
  } catch {
@@ -17347,7 +17350,7 @@ function bySelectionOrder(a, b) {
17347
17350
  return b.value - a.value;
17348
17351
  }
17349
17352
  function selectVirtualCoins(coins, targetAmount) {
17350
- const sortedCoins = coins.map(chunkUUSKJOSX_cjs.normalizeVtxo).sort(bySelectionOrder);
17353
+ const sortedCoins = coins.map(chunkXLHUGP3G_cjs.normalizeVtxo).sort(bySelectionOrder);
17351
17354
  const selectedCoins = [];
17352
17355
  let selectedAmount = 0;
17353
17356
  for (const coin of sortedCoins) {
@@ -17464,7 +17467,7 @@ function assertTimeoutMap(name, timeouts) {
17464
17467
  if (value === void 0) {
17465
17468
  throw new Error(`${name}.${key} must be a non-negative safe integer`);
17466
17469
  }
17467
- chunkUUSKJOSX_cjs.assertTimerMs(`${name}.${key}`, value);
17470
+ chunkXLHUGP3G_cjs.assertTimerMs(`${name}.${key}`, value);
17468
17471
  }
17469
17472
  }
17470
17473
  var MessageBus = class {
@@ -17481,8 +17484,8 @@ var MessageBus = class {
17481
17484
  }) {
17482
17485
  this.walletRepository = walletRepository;
17483
17486
  this.contractRepository = contractRepository;
17484
- chunkUUSKJOSX_cjs.assertTimerMs("tickIntervalMs", tickIntervalMs);
17485
- chunkUUSKJOSX_cjs.assertTimerMs("messageTimeoutMs", messageTimeoutMs);
17487
+ chunkXLHUGP3G_cjs.assertTimerMs("tickIntervalMs", tickIntervalMs);
17488
+ chunkXLHUGP3G_cjs.assertTimerMs("messageTimeoutMs", messageTimeoutMs);
17486
17489
  assertTimeoutMap("messageTimeoutOverrides", messageTimeoutOverrides);
17487
17490
  this.intentRepository = intentRepository;
17488
17491
  this.onchainProvider = onchainProvider;
@@ -17738,14 +17741,14 @@ var MessageBus = class {
17738
17741
  this.initialized = true;
17739
17742
  }
17740
17743
  async buildServices(config) {
17741
- const arkProvider = new chunkUUSKJOSX_cjs.RestArkProvider(config.arkServer.url);
17744
+ const arkProvider = new chunkXLHUGP3G_cjs.RestArkProvider(config.arkServer.url);
17742
17745
  const storage = {
17743
17746
  walletRepository: this.walletRepository,
17744
17747
  contractRepository: this.contractRepository,
17745
17748
  ...this.intentRepository && { intentRepository: this.intentRepository }
17746
17749
  };
17747
17750
  const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : void 0;
17748
- const indexerProvider = new chunkIQWLFYT2_cjs.RestIndexerProvider(config.arkServer.url);
17751
+ const indexerProvider = new chunkHQNQ3CLQ_cjs.RestIndexerProvider(config.arkServer.url);
17749
17752
  const serialized = normalizeSerializedIdentity(config.wallet);
17750
17753
  if (isSigningSerialized(serialized)) {
17751
17754
  const identity2 = hydrateIdentity(serialized);
@@ -18087,7 +18090,7 @@ var offboardNetworkNames = [
18087
18090
  function offboardDestinationScript(destinationAddress) {
18088
18091
  for (const networkName of offboardNetworkNames) {
18089
18092
  try {
18090
- const network = chunkUUSKJOSX_cjs.networks[networkName];
18093
+ const network = chunkXLHUGP3G_cjs.networks[networkName];
18091
18094
  const addr = btcSigner.Address(network).decode(destinationAddress);
18092
18095
  return btcSigner.OutScript.encode(addr);
18093
18096
  } catch {
@@ -18127,7 +18130,7 @@ function filterOffboardInputs(vtxos, feeInfo, named) {
18127
18130
  const inputs = [];
18128
18131
  let subtotal = 0n;
18129
18132
  for (const vtxo of vtxos) {
18130
- const inputFee = estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(vtxo));
18133
+ const inputFee = estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(vtxo));
18131
18134
  if (inputFee.satoshis >= vtxo.value) {
18132
18135
  if (named) {
18133
18136
  throw new Error(
@@ -18224,7 +18227,7 @@ var Ramps = class {
18224
18227
  }
18225
18228
  amount = amount ?? totalAmount;
18226
18229
  const offchainAddress = await this.wallet.getAddress();
18227
- const offchainAddr = chunkUUSKJOSX_cjs.ArkAddress.decode(offchainAddress);
18230
+ const offchainAddr = chunkXLHUGP3G_cjs.ArkAddress.decode(offchainAddress);
18228
18231
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
18229
18232
  const outputFee = estimator.evalOffchainOutput({
18230
18233
  amount,
@@ -18374,7 +18377,7 @@ var Ramps = class {
18374
18377
  const ordered = [...candidates].sort(bySelectionOrder);
18375
18378
  let covered = 0n;
18376
18379
  for (let i = 0; i < ordered.length && i < MAX_VTXOS_PER_SETTLEMENT; i++) {
18377
- const fee = estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(ordered[i])).satoshis;
18380
+ const fee = estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(ordered[i])).satoshis;
18378
18381
  covered += BigInt(ordered[i].value) - BigInt(fee);
18379
18382
  if (covered < needed) continue;
18380
18383
  try {
@@ -18408,7 +18411,7 @@ var Ramps = class {
18408
18411
  async fundChange(left, estimator) {
18409
18412
  if (left <= 0n) return { change: 0n };
18410
18413
  const changeAddress = await this.wallet.getAddress();
18411
- const changeScript = base.hex.encode(chunkUUSKJOSX_cjs.ArkAddress.decode(changeAddress).pkScript);
18414
+ const changeScript = base.hex.encode(chunkXLHUGP3G_cjs.ArkAddress.decode(changeAddress).pkScript);
18412
18415
  const { change } = changeAfterOutputFee(
18413
18416
  left,
18414
18417
  (amount) => BigInt(estimator.evalOffchainOutput({ amount, script: changeScript }).satoshis)
@@ -19342,7 +19345,7 @@ var WalletMessageHandler = class {
19342
19345
  this.lazyBoardingInit = payload.lazyBoarding ?? false;
19343
19346
  this.boardingEpoch++;
19344
19347
  this.boardingLoaded = false;
19345
- this.indexerProvider = new chunkIQWLFYT2_cjs.RestIndexerProvider(arkServerUrl);
19348
+ this.indexerProvider = new chunkHQNQ3CLQ_cjs.RestIndexerProvider(arkServerUrl);
19346
19349
  await this.onWalletInitialized();
19347
19350
  }
19348
19351
  /** @see RequestInitWallet.payload.lazyBoarding */
@@ -19764,7 +19767,7 @@ var WalletMessageHandler = class {
19764
19767
  this.readonlyWallet.getBoardingTxs()
19765
19768
  ]);
19766
19769
  const indexerProvider = this.indexerProvider;
19767
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunkUUSKJOSX_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
19770
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunkXLHUGP3G_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
19768
19771
  return buildTransactionHistory(
19769
19772
  vtxos,
19770
19773
  boardingTxs,
@@ -19833,7 +19836,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
19833
19836
  // budget so the worker's snapshot fallback stays reachable before this
19834
19837
  // page deadline fires — lowering it below the budget would time the page
19835
19838
  // out while the worker is still seconds from answering from cache.
19836
- GET_ARKADE_INFO: chunkUUSKJOSX_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
19839
+ GET_ARKADE_INFO: chunkXLHUGP3G_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
19837
19840
  INDEXER_GET_VTXOS: 2e4,
19838
19841
  INDEXER_GET_VIRTUAL_TXS: 2e4,
19839
19842
  GET_VTXOS: 2e4,
@@ -19978,7 +19981,7 @@ var ServiceWorkerAssetManager = class extends ServiceWorkerReadonlyAssetManager
19978
19981
  }
19979
19982
  };
19980
19983
  var initializeMessageBus = (serviceWorker, config, timeoutMs = 2e3) => {
19981
- chunkUUSKJOSX_cjs.assertTimerMs("messageBusTimeoutMs", timeoutMs);
19984
+ chunkXLHUGP3G_cjs.assertTimerMs("messageBusTimeoutMs", timeoutMs);
19982
19985
  const initCmd = {
19983
19986
  tag: "INITIALIZE_MESSAGE_BUS",
19984
19987
  id: getRandomId(),
@@ -20066,7 +20069,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20066
20069
  }
20067
20070
  /** Shared tail of both `create()` factories: boot the bus, INIT_WALLET, cache for reinit. */
20068
20071
  static async bootstrap(wallet, options, serializedWallet, busConfig) {
20069
- const arkServer = options.arkServer ?? { url: chunkUUSKJOSX_cjs.DEFAULT_ARKADE_SERVER_URL };
20072
+ const arkServer = options.arkServer ?? { url: chunkXLHUGP3G_cjs.DEFAULT_ARKADE_SERVER_URL };
20070
20073
  const initWalletPayload = {
20071
20074
  lazyBoarding: options.lazyBoarding,
20072
20075
  arkServerUrl: arkServer.url,
@@ -20076,7 +20079,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20076
20079
  Object.entries(options.messageTimeouts ?? {}).filter(([, ms]) => ms !== void 0)
20077
20080
  );
20078
20081
  for (const [key, value] of Object.entries(overrides)) {
20079
- chunkUUSKJOSX_cjs.assertTimerMs(`messageTimeouts.${key}`, value);
20082
+ chunkXLHUGP3G_cjs.assertTimerMs(`messageTimeouts.${key}`, value);
20080
20083
  }
20081
20084
  const messageTimeouts = {
20082
20085
  ...DEFAULT_MESSAGE_TIMEOUTS,
@@ -20416,7 +20419,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20416
20419
  try {
20417
20420
  const response = await this.sendMessage(message);
20418
20421
  const { vtxos, page } = response.payload;
20419
- return { vtxos: vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo), page: page && { ...page } };
20422
+ return { vtxos: vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo), page: page && { ...page } };
20420
20423
  } catch (cause) {
20421
20424
  throw new Error(`Failed to get vtxos: ${cause}`, { cause });
20422
20425
  }
@@ -20520,7 +20523,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20520
20523
  };
20521
20524
  try {
20522
20525
  const response = await this.sendMessage(message);
20523
- return response.payload.vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo);
20526
+ return response.payload.vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo);
20524
20527
  } catch (error) {
20525
20528
  throw new Error(`Failed to get vtxos: ${error}`);
20526
20529
  }
@@ -20551,7 +20554,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20551
20554
  "Service worker does not support the requested contract scope or freshness check"
20552
20555
  );
20553
20556
  }
20554
- return payload.vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo);
20557
+ return payload.vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo);
20555
20558
  } catch (error) {
20556
20559
  throw new Error(`Failed to get spendable vtxos: ${error}`);
20557
20560
  }
@@ -20746,7 +20749,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20746
20749
  };
20747
20750
  try {
20748
20751
  const response = await sendContractMessage(message);
20749
- return response.payload.vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo);
20752
+ return response.payload.vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo);
20750
20753
  } catch (cause) {
20751
20754
  throw new Error(`Failed to annotate vtxos: ${cause}`, { cause });
20752
20755
  }
@@ -21386,7 +21389,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
21386
21389
  };
21387
21390
  try {
21388
21391
  const response = await wallet.sendMessage(message);
21389
- return response.payload.vtxos.map(chunkUUSKJOSX_cjs.normalizeVtxo);
21392
+ return response.payload.vtxos.map(chunkXLHUGP3G_cjs.normalizeVtxo);
21390
21393
  } catch (e) {
21391
21394
  throw new Error(`Failed to get expiring vtxos: ${e}`);
21392
21395
  }
@@ -21503,12 +21506,12 @@ var OnchainWallet = class _OnchainWallet {
21503
21506
  * @returns Configured onchain wallet
21504
21507
  * @throws Error if the configured identity cannot produce a valid x-only public key
21505
21508
  */
21506
- static async create(identity, networkName = chunkUUSKJOSX_cjs.DEFAULT_NETWORK_NAME, provider) {
21509
+ static async create(identity, networkName = chunkXLHUGP3G_cjs.DEFAULT_NETWORK_NAME, provider) {
21507
21510
  const pubkey = await identity.xOnlyPublicKey();
21508
21511
  if (!pubkey) {
21509
21512
  throw new Error("Invalid configured public key");
21510
21513
  }
21511
- const network = chunkUUSKJOSX_cjs.getNetwork(networkName);
21514
+ const network = chunkXLHUGP3G_cjs.getNetwork(networkName);
21512
21515
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
21513
21516
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
21514
21517
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -21608,7 +21611,7 @@ var OnchainWallet = class _OnchainWallet {
21608
21611
  feeRate,
21609
21612
  params.address
21610
21613
  );
21611
- let tx = new chunkUUSKJOSX_cjs.Transaction();
21614
+ let tx = new chunkXLHUGP3G_cjs.Transaction();
21612
21615
  for (const input of inputs) {
21613
21616
  tx.addInput({
21614
21617
  txid: input.txid,
@@ -21666,7 +21669,7 @@ var OnchainWallet = class _OnchainWallet {
21666
21669
  * @throws If the parent has no anchor, or funding cannot be selected/signed
21667
21670
  */
21668
21671
  async bumpAnchor(parentHex, feeRate) {
21669
- const parent = chunkUUSKJOSX_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
21672
+ const parent = chunkXLHUGP3G_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
21670
21673
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
21671
21674
  const child = await this.buildBumpPackage(parent, feeRate, coins);
21672
21675
  return [parent.hex, child.hex];
@@ -22128,6 +22131,14 @@ var ElectrumOnchainProvider = class {
22128
22131
  return base.hex.decode(tx.hex);
22129
22132
  }
22130
22133
  async getTxOutspends(txid) {
22134
+ return this.resolveOutspends(txid);
22135
+ }
22136
+ /** Reads `vout`'s script alone: another output of a tx someone else built (their change, a
22137
+ * service's fee address) can have a history Fulcrum answers empty and electrs refuses. */
22138
+ async getTxOutspend(txid, vout) {
22139
+ return (await this.resolveOutspends(txid, vout))[vout] ?? { spent: false, txid: "" };
22140
+ }
22141
+ async resolveOutspends(txid, only) {
22131
22142
  const [txResult] = await this.chain.fetchTransactions([txid]);
22132
22143
  const tx = btcSigner.Transaction.fromRaw(base.hex.decode(txResult.hex), {
22133
22144
  allowUnknownOutputs: true
@@ -22136,7 +22147,10 @@ var ElectrumOnchainProvider = class {
22136
22147
  const outputScriptHashes = [];
22137
22148
  for (let i = 0; i < outputCount; i++) {
22138
22149
  const output = tx.getOutput(i);
22139
- outputScriptHashes.push(output.script ? toScriptHash(output.script) : void 0);
22150
+ const wanted = only === void 0 || i === only;
22151
+ outputScriptHashes.push(
22152
+ wanted && output.script ? toScriptHash(output.script) : void 0
22153
+ );
22140
22154
  }
22141
22155
  const validScriptHashes = outputScriptHashes.filter((h) => h !== void 0);
22142
22156
  const results = Array.from(
@@ -22482,7 +22496,7 @@ var CachingArkProvider = class {
22482
22496
  constructor(inner, ttlMs = DEFAULT_TTL_MS) {
22483
22497
  this.inner = inner;
22484
22498
  this.ttlMs = ttlMs;
22485
- chunkUUSKJOSX_cjs.assertNonNegativeMs("ttlMs", ttlMs);
22499
+ chunkXLHUGP3G_cjs.assertNonNegativeMs("ttlMs", ttlMs);
22486
22500
  this.unsubscribe = inner.onServerInfoChanged?.((info) => {
22487
22501
  this.cached = info;
22488
22502
  this.expiresAt = Date.now() + this.ttlMs;
@@ -22574,7 +22588,7 @@ async function resolvePrevTxs(txids, source, onchain) {
22574
22588
  try {
22575
22589
  const { txs } = await source.getVirtualTxs(wanted);
22576
22590
  for (const psbt of txs) {
22577
- const tx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
22591
+ const tx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
22578
22592
  resolved.set(tx.id, tx.toBytes());
22579
22593
  }
22580
22594
  } catch (err) {
@@ -22607,7 +22621,7 @@ async function resolvePrevTxs(txids, source, onchain) {
22607
22621
  async function attachPrevArkTxs(tx, txids, source, onchain) {
22608
22622
  const pending = [];
22609
22623
  for (let i = 0; i < tx.inputsLength; i++) {
22610
- if (chunkUUSKJOSX_cjs.getArkPsbtFields(tx, i, chunkUUSKJOSX_cjs.PrevArkTxField).length === 0) pending.push(i);
22624
+ if (chunkXLHUGP3G_cjs.getArkPsbtFields(tx, i, chunkXLHUGP3G_cjs.PrevArkTxField).length === 0) pending.push(i);
22611
22625
  }
22612
22626
  if (pending.length === 0) return;
22613
22627
  const resolved = await resolvePrevTxs(
@@ -22616,13 +22630,13 @@ async function attachPrevArkTxs(tx, txids, source, onchain) {
22616
22630
  onchain
22617
22631
  );
22618
22632
  for (const i of pending) {
22619
- chunkUUSKJOSX_cjs.setArkPsbtField(tx, i, chunkUUSKJOSX_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
22633
+ chunkXLHUGP3G_cjs.setArkPsbtField(tx, i, chunkXLHUGP3G_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
22620
22634
  }
22621
22635
  }
22622
22636
  async function attachPrevoutTxs(tx, source) {
22623
22637
  const pending = [];
22624
22638
  for (let i = 0; i < tx.inputsLength; i++) {
22625
- if (chunkUUSKJOSX_cjs.getArkPsbtFields(tx, i, chunkUUSKJOSX_cjs.PrevoutTxField).length > 0) continue;
22639
+ if (chunkXLHUGP3G_cjs.getArkPsbtFields(tx, i, chunkXLHUGP3G_cjs.PrevoutTxField).length > 0) continue;
22626
22640
  const input = tx.getInput(i);
22627
22641
  if (!input?.txid) throw new PrevTxUnavailableError(`input ${i} has no outpoint`);
22628
22642
  pending.push({ index: i, txid: base.hex.encode(input.txid) });
@@ -22633,7 +22647,7 @@ async function attachPrevoutTxs(tx, source) {
22633
22647
  resolved.set(txid, await source.getRawTransaction(txid));
22634
22648
  }
22635
22649
  for (const { index, txid } of pending) {
22636
- chunkUUSKJOSX_cjs.setArkPsbtField(tx, index, chunkUUSKJOSX_cjs.PrevoutTxField, resolved.get(txid));
22650
+ chunkXLHUGP3G_cjs.setArkPsbtField(tx, index, chunkXLHUGP3G_cjs.PrevoutTxField, resolved.get(txid));
22637
22651
  }
22638
22652
  }
22639
22653
  async function withPrevTxs(coins, source, onchain) {
@@ -22659,7 +22673,7 @@ exports.BIP322 = void 0;
22659
22673
  async function sign2(message, identity, network) {
22660
22674
  const xOnlyPubKey = await identity.xOnlyPublicKey();
22661
22675
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
22662
- const toSpend = chunkUUSKJOSX_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
22676
+ const toSpend = chunkXLHUGP3G_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
22663
22677
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
22664
22678
  const signed = await identity.sign(toSign, [0]);
22665
22679
  signed.finalizeIdx(0);
@@ -22717,7 +22731,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
22717
22731
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
22718
22732
  return false;
22719
22733
  }
22720
- const toSpend = chunkUUSKJOSX_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
22734
+ const toSpend = chunkXLHUGP3G_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
22721
22735
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript);
22722
22736
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
22723
22737
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -22738,7 +22752,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
22738
22752
  }
22739
22753
  const sighashType = sigWithHash[sigWithHash.length - 1];
22740
22754
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
22741
- const toSpend = chunkUUSKJOSX_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
22755
+ const toSpend = chunkXLHUGP3G_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
22742
22756
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
22743
22757
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
22744
22758
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -22791,7 +22805,7 @@ function encodeCompactSize(n) {
22791
22805
  return buf;
22792
22806
  }
22793
22807
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
22794
- const tx = new chunkUUSKJOSX_cjs.Transaction({ version: 0 });
22808
+ const tx = new chunkXLHUGP3G_cjs.Transaction({ version: 0 });
22795
22809
  tx.addInput({
22796
22810
  txid: toSpend.id,
22797
22811
  index: 0,
@@ -22805,12 +22819,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
22805
22819
  });
22806
22820
  tx.addOutput({
22807
22821
  amount: 0n,
22808
- script: chunkUUSKJOSX_cjs.OP_RETURN_EMPTY_PKSCRIPT
22822
+ script: chunkXLHUGP3G_cjs.OP_RETURN_EMPTY_PKSCRIPT
22809
22823
  });
22810
22824
  return tx;
22811
22825
  }
22812
22826
  function craftBIP322ToSignSimple(toSpend, pkScript) {
22813
- const tx = new chunkUUSKJOSX_cjs.Transaction({ version: 0 });
22827
+ const tx = new chunkXLHUGP3G_cjs.Transaction({ version: 0 });
22814
22828
  tx.addInput({
22815
22829
  txid: toSpend.id,
22816
22830
  index: 0,
@@ -22822,12 +22836,12 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
22822
22836
  });
22823
22837
  tx.addOutput({
22824
22838
  amount: 0n,
22825
- script: chunkUUSKJOSX_cjs.OP_RETURN_EMPTY_PKSCRIPT
22839
+ script: chunkXLHUGP3G_cjs.OP_RETURN_EMPTY_PKSCRIPT
22826
22840
  });
22827
22841
  return tx;
22828
22842
  }
22829
22843
  function finalizeVirtualTx(type, psbtBase64) {
22830
- const tx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
22844
+ const tx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
22831
22845
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
22832
22846
  const input = tx.getInput(0);
22833
22847
  if (!input) {
@@ -22854,14 +22868,14 @@ var ExitPathError = class extends Error {
22854
22868
  reason;
22855
22869
  };
22856
22870
  function delayWeight(sequence) {
22857
- const t = chunkUUSKJOSX_cjs.sequenceToTimelock(sequence);
22871
+ const t = chunkXLHUGP3G_cjs.sequenceToTimelock(sequence);
22858
22872
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
22859
22873
  }
22860
22874
  async function resolveUnilateralPath(params) {
22861
22875
  const { vtxo, scriptHex, contractRepository } = params;
22862
22876
  const contract = contractRepository ? (await collectContracts(contractRepository, { script: scriptHex }))[0] : void 0;
22863
22877
  if (contract) {
22864
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
22878
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
22865
22879
  if (!handler) {
22866
22880
  throw new ExitPathError(
22867
22881
  "no-handler",
@@ -22883,12 +22897,12 @@ async function resolveUnilateralPath(params) {
22883
22897
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
22884
22898
  return { selection: paths[0], label: `${contract.type}:unilateral` };
22885
22899
  }
22886
- const decoded = chunkUUSKJOSX_cjs.VtxoScript.decode(vtxo.tapTree);
22900
+ const decoded = chunkXLHUGP3G_cjs.VtxoScript.decode(vtxo.tapTree);
22887
22901
  let best;
22888
22902
  for (const exit of decoded.exitPaths()) {
22889
22903
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
22890
22904
  if (!leaf) continue;
22891
- const sequence = chunkUUSKJOSX_cjs.timelockToSequence(exit.params.timelock);
22905
+ const sequence = chunkXLHUGP3G_cjs.timelockToSequence(exit.params.timelock);
22892
22906
  const weight = delayWeight(sequence);
22893
22907
  if (!best || weight < best.weight) {
22894
22908
  best = { selection: { leaf, sequence }, weight };
@@ -23095,7 +23109,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23095
23109
  const txWeightEstimator = TxWeightEstimator.create();
23096
23110
  const walletDescriptor = base.hex.encode(await wallet.identity.xOnlyPublicKey());
23097
23111
  for (const vtxo of vtxos) {
23098
- if (!chunkUUSKJOSX_cjs.canSweepOnchain(vtxo)) {
23112
+ if (!chunkXLHUGP3G_cjs.canSweepOnchain(vtxo)) {
23099
23113
  throw new Error(
23100
23114
  `Vtxo ${vtxo.txid}:${vtxo.vout} cannot be swept onchain: it is not fully unrolled (use unroll first), or its exit output was already spent`
23101
23115
  );
@@ -23106,14 +23120,14 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23106
23120
  }
23107
23121
  const resolved = await resolveUnilateralPath({
23108
23122
  vtxo,
23109
- scriptHex: base.hex.encode(chunkUUSKJOSX_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23123
+ scriptHex: base.hex.encode(chunkXLHUGP3G_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23110
23124
  contractRepository: wallet.contractRepository,
23111
23125
  walletDescriptor,
23112
23126
  currentTime: Date.now()
23113
23127
  });
23114
23128
  const spendingLeaf = resolved.selection.leaf;
23115
23129
  const sequence = resolved.selection.sequence;
23116
- const timelock = chunkUUSKJOSX_cjs.sequenceToTimelock(sequence);
23130
+ const timelock = chunkXLHUGP3G_cjs.sequenceToTimelock(sequence);
23117
23131
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
23118
23132
  if (!elapsed) {
23119
23133
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -23126,7 +23140,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23126
23140
  sequence,
23127
23141
  witnessUtxo: {
23128
23142
  amount: BigInt(vtxo.value),
23129
- script: chunkUUSKJOSX_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
23143
+ script: chunkXLHUGP3G_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
23130
23144
  },
23131
23145
  sighashType: btcSigner.SigHash.DEFAULT
23132
23146
  });
@@ -23136,7 +23150,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23136
23150
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
23137
23151
  );
23138
23152
  }
23139
- const tx = new chunkUUSKJOSX_cjs.Transaction({ version: 2 });
23153
+ const tx = new chunkXLHUGP3G_cjs.Transaction({ version: 2 });
23140
23154
  for (const input of inputs) {
23141
23155
  tx.addInput(input);
23142
23156
  }
@@ -23219,7 +23233,7 @@ async function buildSignedSweep(params) {
23219
23233
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
23220
23234
  );
23221
23235
  }
23222
- const tx = new chunkUUSKJOSX_cjs.Transaction({ version: 2 });
23236
+ const tx = new chunkXLHUGP3G_cjs.Transaction({ version: 2 });
23223
23237
  tx.addInput({
23224
23238
  txid: vtxo.txid,
23225
23239
  index: vtxo.vout,
@@ -23244,7 +23258,7 @@ async function buildSignedSweep(params) {
23244
23258
  finalScriptWitness: [
23245
23259
  tapScriptSig[0][1],
23246
23260
  ...path.extraWitness,
23247
- chunkUUSKJOSX_cjs.scriptFromTapLeafScript(path.leaf),
23261
+ chunkXLHUGP3G_cjs.scriptFromTapLeafScript(path.leaf),
23248
23262
  btcSigner.TaprootControlBlock.encode(controlBlock)
23249
23263
  ]
23250
23264
  });
@@ -23274,7 +23288,7 @@ async function resolveFeeRate(opts) {
23274
23288
  }
23275
23289
  async function selectExitVtxos(opts) {
23276
23290
  if (!opts.vtxos) return opts.wallet.getVtxos();
23277
- const res = await chunkUUSKJOSX_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
23291
+ const res = await chunkXLHUGP3G_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
23278
23292
  const tapTrees = /* @__PURE__ */ new Map();
23279
23293
  const out = [];
23280
23294
  for (const vtxo of res.vtxos) {
@@ -23289,7 +23303,7 @@ async function selectExitVtxos(opts) {
23289
23303
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
23290
23304
  );
23291
23305
  }
23292
- const handler = chunkGN2K4WBP_cjs.contractHandlers.get(contract.type);
23306
+ const handler = chunkGW42FS2X_cjs.contractHandlers.get(contract.type);
23293
23307
  if (!handler) {
23294
23308
  throw new Error(`no contract handler registered for type '${contract.type}'`);
23295
23309
  }
@@ -23319,7 +23333,7 @@ async function computeExitLayout(opts, feeRate) {
23319
23333
  if (pendingNodes.length > 0) {
23320
23334
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
23321
23335
  for (const psbt of txs) {
23322
- psbts.set(chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
23336
+ psbts.set(chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
23323
23337
  }
23324
23338
  }
23325
23339
  const childVsize = Number(
@@ -23347,7 +23361,7 @@ async function computeExitLayout(opts, feeRate) {
23347
23361
  try {
23348
23362
  const resolved = await resolveUnilateralPath({
23349
23363
  vtxo,
23350
- scriptHex: base.hex.encode(chunkUUSKJOSX_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23364
+ scriptHex: base.hex.encode(chunkXLHUGP3G_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23351
23365
  contractRepository: wallet.contractRepository,
23352
23366
  walletDescriptor,
23353
23367
  currentTime: Date.now()
@@ -23366,7 +23380,7 @@ async function computeExitLayout(opts, feeRate) {
23366
23380
  });
23367
23381
  continue;
23368
23382
  }
23369
- const t = chunkUUSKJOSX_cjs.sequenceToTimelock(resolved.selection.sequence);
23383
+ const t = chunkXLHUGP3G_cjs.sequenceToTimelock(resolved.selection.sequence);
23370
23384
  const delay = { type: t.type, value: Number(t.value) };
23371
23385
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
23372
23386
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -23473,7 +23487,7 @@ var Executor = class {
23473
23487
  constructor(pkg, provider, opts) {
23474
23488
  this.pkg = pkg;
23475
23489
  this.provider = provider;
23476
- chunkUUSKJOSX_cjs.assertTimerMs("pollIntervalMs", opts?.pollIntervalMs);
23490
+ chunkXLHUGP3G_cjs.assertTimerMs("pollIntervalMs", opts?.pollIntervalMs);
23477
23491
  this.pollIntervalMs = opts?.pollIntervalMs ?? 5e3;
23478
23492
  this.feeWallet = opts?.feeWallet;
23479
23493
  this.signal = opts?.signal;
@@ -23768,7 +23782,7 @@ async function prepare(opts) {
23768
23782
  txid: sweep.vtxo.txid,
23769
23783
  vout: sweep.vtxo.vout,
23770
23784
  value: sweep.vtxo.value,
23771
- pkScript: chunkUUSKJOSX_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
23785
+ pkScript: chunkXLHUGP3G_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
23772
23786
  },
23773
23787
  path: sweep.resolved.selection,
23774
23788
  outputAddress: opts.sweepAddress,
@@ -23857,7 +23871,7 @@ async function prepare(opts) {
23857
23871
  if (newFee <= splitterFee) break;
23858
23872
  splitterFee = newFee;
23859
23873
  }
23860
- const splitter = new chunkUUSKJOSX_cjs.Transaction({ version: 2 });
23874
+ const splitter = new chunkXLHUGP3G_cjs.Transaction({ version: 2 });
23861
23875
  for (const coin of selected.inputs) {
23862
23876
  splitter.addInput({
23863
23877
  txid: coin.txid,
@@ -23996,46 +24010,46 @@ var UnilateralExit = {
23996
24010
 
23997
24011
  // src/arkade/index.ts
23998
24012
  var arkade_exports = {};
23999
- chunkUUSKJOSX_cjs.__export(arkade_exports, {
24000
- ARKADE_OP: () => chunkGN2K4WBP_cjs.ARKADE_OP,
24001
- ARKADE_OPCODES: () => chunkGN2K4WBP_cjs.ARKADE_OPCODES,
24002
- ARKADE_OPCODE_NAMES: () => chunkGN2K4WBP_cjs.ARKADE_OPCODE_NAMES,
24003
- ARKADE_OPCODE_VALUES: () => chunkGN2K4WBP_cjs.ARKADE_OPCODE_VALUES,
24004
- ARKADE_OPS: () => chunkGN2K4WBP_cjs.ARKADE_OPS,
24013
+ chunkXLHUGP3G_cjs.__export(arkade_exports, {
24014
+ ARKADE_OP: () => chunkGW42FS2X_cjs.ARKADE_OP,
24015
+ ARKADE_OPCODES: () => chunkGW42FS2X_cjs.ARKADE_OPCODES,
24016
+ ARKADE_OPCODE_NAMES: () => chunkGW42FS2X_cjs.ARKADE_OPCODE_NAMES,
24017
+ ARKADE_OPCODE_VALUES: () => chunkGW42FS2X_cjs.ARKADE_OPCODE_VALUES,
24018
+ ARKADE_OPS: () => chunkGW42FS2X_cjs.ARKADE_OPS,
24005
24019
  Arkade: () => Arkade,
24006
24020
  ArkadeContract: () => ArkadeContract,
24007
- ArkadeProgramScript: () => chunkGN2K4WBP_cjs.ArkadeProgramScript,
24008
- ArkadeScript: () => chunkGN2K4WBP_cjs.ArkadeScript,
24021
+ ArkadeProgramScript: () => chunkGW42FS2X_cjs.ArkadeProgramScript,
24022
+ ArkadeScript: () => chunkGW42FS2X_cjs.ArkadeScript,
24009
24023
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
24010
- BigNum: () => chunkGN2K4WBP_cjs.bignum_exports,
24024
+ BigNum: () => chunkGW42FS2X_cjs.bignum_exports,
24011
24025
  OP: () => btcSigner.OP,
24012
- OPCODE_NAMES: () => chunkGN2K4WBP_cjs.OPCODE_NAMES,
24013
- OPCODE_VALUES: () => chunkGN2K4WBP_cjs.OPCODE_VALUES,
24014
- SUPPORTED_PROGRAM_VERSION: () => chunkGN2K4WBP_cjs.SUPPORTED_PROGRAM_VERSION,
24026
+ OPCODE_NAMES: () => chunkGW42FS2X_cjs.OPCODE_NAMES,
24027
+ OPCODE_VALUES: () => chunkGW42FS2X_cjs.OPCODE_VALUES,
24028
+ SUPPORTED_PROGRAM_VERSION: () => chunkGW42FS2X_cjs.SUPPORTED_PROGRAM_VERSION,
24015
24029
  Script: () => btcSigner.Script,
24016
- UnsupportedProgramVersionError: () => chunkGN2K4WBP_cjs.UnsupportedProgramVersionError,
24017
- arkadeScriptHash: () => chunkGN2K4WBP_cjs.arkadeScriptHash,
24018
- arkadeWitnessHash: () => chunkGN2K4WBP_cjs.arkadeWitnessHash,
24019
- asmToBytes: () => chunkGN2K4WBP_cjs.asmToBytes,
24020
- bytesToASM: () => chunkGN2K4WBP_cjs.bytesToASM,
24021
- computeArkadeScriptPublicKey: () => chunkGN2K4WBP_cjs.computeArkadeScriptPublicKey,
24030
+ UnsupportedProgramVersionError: () => chunkGW42FS2X_cjs.UnsupportedProgramVersionError,
24031
+ arkadeScriptHash: () => chunkGW42FS2X_cjs.arkadeScriptHash,
24032
+ arkadeWitnessHash: () => chunkGW42FS2X_cjs.arkadeWitnessHash,
24033
+ asmToBytes: () => chunkGW42FS2X_cjs.asmToBytes,
24034
+ bytesToASM: () => chunkGW42FS2X_cjs.bytesToASM,
24035
+ computeArkadeScriptPublicKey: () => chunkGW42FS2X_cjs.computeArkadeScriptPublicKey,
24022
24036
  createArkadeBatchHandler: () => createArkadeBatchHandler,
24023
- deserializeArkadeContractParams: () => chunkGN2K4WBP_cjs.deserializeArkadeContractParams,
24024
- fromASM: () => chunkGN2K4WBP_cjs.fromASM,
24025
- getOpcodeName: () => chunkGN2K4WBP_cjs.getOpcodeName,
24026
- getOpcodeValue: () => chunkGN2K4WBP_cjs.getOpcodeValue,
24037
+ deserializeArkadeContractParams: () => chunkGW42FS2X_cjs.deserializeArkadeContractParams,
24038
+ fromASM: () => chunkGW42FS2X_cjs.fromASM,
24039
+ getOpcodeName: () => chunkGW42FS2X_cjs.getOpcodeName,
24040
+ getOpcodeValue: () => chunkGW42FS2X_cjs.getOpcodeValue,
24027
24041
  isContractArtifact: () => isContractArtifact,
24028
- parseArtifact: () => chunkGN2K4WBP_cjs.parseArtifact,
24042
+ parseArtifact: () => chunkGW42FS2X_cjs.parseArtifact,
24029
24043
  programFromArtifact: () => programFromArtifact,
24030
24044
  resolveArkadeService: () => resolveArkadeService,
24031
- resolveAsm: () => chunkGN2K4WBP_cjs.resolveAsm,
24032
- serializeArkadeContractParams: () => chunkGN2K4WBP_cjs.serializeArkadeContractParams,
24033
- stringifyArtifact: () => chunkGN2K4WBP_cjs.stringifyArtifact,
24034
- toASM: () => chunkGN2K4WBP_cjs.toASM,
24035
- validateProgram: () => chunkGN2K4WBP_cjs.validateProgram,
24036
- witnessRefToBytes: () => chunkGN2K4WBP_cjs.witnessRefToBytes
24045
+ resolveAsm: () => chunkGW42FS2X_cjs.resolveAsm,
24046
+ serializeArkadeContractParams: () => chunkGW42FS2X_cjs.serializeArkadeContractParams,
24047
+ stringifyArtifact: () => chunkGW42FS2X_cjs.stringifyArtifact,
24048
+ toASM: () => chunkGW42FS2X_cjs.toASM,
24049
+ validateProgram: () => chunkGW42FS2X_cjs.validateProgram,
24050
+ witnessRefToBytes: () => chunkGW42FS2X_cjs.witnessRefToBytes
24037
24051
  });
24038
- var isVtxoCoin = (input) => chunkUUSKJOSX_cjs.isVirtualCoin(input);
24052
+ var isVtxoCoin = (input) => chunkXLHUGP3G_cjs.isVirtualCoin(input);
24039
24053
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
24040
24054
  let batchId;
24041
24055
  let sweepTapTreeRoot;
@@ -24056,23 +24070,23 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24056
24070
  );
24057
24071
  await arkProvider.confirmRegistration(intentId);
24058
24072
  batchId = event.id;
24059
- const sweepTapscript = chunkUUSKJOSX_cjs.CSVMultisigTapscript.encode({
24073
+ const sweepTapscript = chunkXLHUGP3G_cjs.CSVMultisigTapscript.encode({
24060
24074
  timelock,
24061
- pubkeys: [chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
24075
+ pubkeys: [chunkGW42FS2X_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
24062
24076
  }).script;
24063
24077
  sweepTapTreeRoot = payment_js.tapLeafHash(sweepTapscript);
24064
24078
  return { skip: false };
24065
24079
  },
24066
24080
  onTreeSigningStarted: async (event, vtxoTree) => {
24067
24081
  const signerPubKey = await session.getPublicKey();
24068
- const xonlySignerPubKey = chunkGN2K4WBP_cjs.toXOnly(signerPubKey, "signer key");
24082
+ const xonlySignerPubKey = chunkGW42FS2X_cjs.toXOnly(signerPubKey, "signer key");
24069
24083
  const xOnlyPubkeys = event.cosignersPublicKeys.map(
24070
- (k) => base.hex.encode(chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
24084
+ (k) => base.hex.encode(chunkGW42FS2X_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
24071
24085
  );
24072
24086
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
24073
24087
  return { skip: true };
24074
24088
  }
24075
- const commitmentTx = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
24089
+ const commitmentTx = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
24076
24090
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
24077
24091
  if (recipients && recipients.length > 0) {
24078
24092
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -24110,7 +24124,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24110
24124
  if (connectorTree) {
24111
24125
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
24112
24126
  }
24113
- let commitmentPsbt = chunkUUSKJOSX_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
24127
+ let commitmentPsbt = chunkXLHUGP3G_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
24114
24128
  assertFinalCommitmentMatchesValidated(
24115
24129
  commitmentPsbt,
24116
24130
  validatedCommitmentTxid,
@@ -24152,7 +24166,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24152
24166
  boardingIndices.push(boardingIdx);
24153
24167
  continue;
24154
24168
  }
24155
- if (!chunkUUSKJOSX_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
24169
+ if (!chunkXLHUGP3G_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
24156
24170
  continue;
24157
24171
  }
24158
24172
  if (connectorIndex >= connectorLeaves.length) {
@@ -24173,7 +24187,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24173
24187
  index: input.vout,
24174
24188
  witnessUtxo: {
24175
24189
  amount: BigInt(input.value),
24176
- script: chunkUUSKJOSX_cjs.VtxoScript.decode(input.tapTree).pkScript
24190
+ script: chunkXLHUGP3G_cjs.VtxoScript.decode(input.tapTree).pkScript
24177
24191
  },
24178
24192
  sighashType: btcSigner.SigHash.DEFAULT,
24179
24193
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -24284,7 +24298,7 @@ function inputDef(name, type) {
24284
24298
  return { name, type: argType(type) };
24285
24299
  }
24286
24300
  function argType(arkType) {
24287
- if (!Object.hasOwn(chunkGN2K4WBP_cjs.ARKADE_TYPE_ENCODINGS, arkType)) fail(`unknown type '${arkType}'`);
24301
+ if (!Object.hasOwn(chunkGW42FS2X_cjs.ARKADE_TYPE_ENCODINGS, arkType)) fail(`unknown type '${arkType}'`);
24288
24302
  return arkType;
24289
24303
  }
24290
24304
  function arrayParts(type) {
@@ -24325,7 +24339,7 @@ function flatten(param, structs, stack = []) {
24325
24339
  function opcodeToken(token) {
24326
24340
  const base = token.slice(3);
24327
24341
  const name = base === "0" || /^([1-9]|1[0-6])$/.test(base) ? token : base;
24328
- if (!Object.hasOwn(chunkGN2K4WBP_cjs.ARKADE_OPS, name)) {
24342
+ if (!Object.hasOwn(chunkGW42FS2X_cjs.ARKADE_OPS, name)) {
24329
24343
  fail(`opcode '${token}' is not in this SDK's table`);
24330
24344
  }
24331
24345
  return name;
@@ -24372,7 +24386,7 @@ function providedWitness(witness) {
24372
24386
  fail(`witness '${item.name}': injected must be boolean`);
24373
24387
  if (item.injected && item.type !== "signature")
24374
24388
  fail(`witness '${item.name}': only infrastructure signatures can be injected`);
24375
- if (item.encoding !== void 0 && item.encoding !== chunkGN2K4WBP_cjs.ARKADE_TYPE_ENCODINGS[type])
24389
+ if (item.encoding !== void 0 && item.encoding !== chunkGW42FS2X_cjs.ARKADE_TYPE_ENCODINGS[type])
24376
24390
  fail(
24377
24391
  `witness '${item.name}': encoding '${item.encoding}' does not match type '${item.type}'`
24378
24392
  );
@@ -24381,7 +24395,7 @@ function providedWitness(witness) {
24381
24395
  }
24382
24396
  function csvTimelock(leafName, operand) {
24383
24397
  if (typeof operand === "string") return { type: "sequence", value: operand };
24384
- const timelock = chunkUUSKJOSX_cjs.sequenceToCanonicalTimelock(operand);
24398
+ const timelock = chunkXLHUGP3G_cjs.sequenceToCanonicalTimelock(operand);
24385
24399
  if (!timelock) {
24386
24400
  fail(`leaf '${leafName}': CSV literal ${operand} is not a canonical BIP68 sequence`);
24387
24401
  }
@@ -24475,7 +24489,7 @@ function programFromArtifact(artifact) {
24475
24489
  if (!isNamed(field)) fail(`struct '${struct.name}': field needs a name and type`);
24476
24490
  claim(fields, field.name, "struct field");
24477
24491
  }
24478
- if (Object.hasOwn(chunkGN2K4WBP_cjs.ARKADE_TYPE_ENCODINGS, struct.name) || Object.hasOwn(NATIVE_STRUCTS, struct.name)) {
24492
+ if (Object.hasOwn(chunkGW42FS2X_cjs.ARKADE_TYPE_ENCODINGS, struct.name) || Object.hasOwn(NATIVE_STRUCTS, struct.name)) {
24479
24493
  fail(`struct name '${struct.name}' shadows a built-in type`);
24480
24494
  }
24481
24495
  claim(structNames, struct.name, "struct");
@@ -24558,7 +24572,7 @@ function programFromArtifact(artifact) {
24558
24572
  const paramNames = /* @__PURE__ */ new Set();
24559
24573
  for (const param of params) claim(paramNames, param.name, "program parameter");
24560
24574
  return {
24561
- version: chunkGN2K4WBP_cjs.SUPPORTED_PROGRAM_VERSION,
24575
+ version: chunkGW42FS2X_cjs.SUPPORTED_PROGRAM_VERSION,
24562
24576
  name: artifact.contractName,
24563
24577
  params,
24564
24578
  functions
@@ -24640,16 +24654,16 @@ var Arkade = class _Arkade {
24640
24654
  indexer = opts.indexer;
24641
24655
  info = await opts.arkade.getInfo();
24642
24656
  }
24643
- const serverKey = chunkGN2K4WBP_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
24644
- const checkpoint = chunkUUSKJOSX_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
24645
- const network = opts.network ?? (Object.hasOwn(chunkUUSKJOSX_cjs.networks, info.network) ? chunkUUSKJOSX_cjs.getNetwork(info.network) : chunkUUSKJOSX_cjs.DEFAULT_NETWORK);
24657
+ const serverKey = chunkGW42FS2X_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
24658
+ const checkpoint = chunkXLHUGP3G_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
24659
+ const network = opts.network ?? (Object.hasOwn(chunkXLHUGP3G_cjs.networks, info.network) ? chunkXLHUGP3G_cjs.getNetwork(info.network) : chunkXLHUGP3G_cjs.DEFAULT_NETWORK);
24646
24660
  let emulatorKey;
24647
24661
  if (emulator) {
24648
- emulatorKey = base.hex.decode(chunkUUSKJOSX_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
24662
+ emulatorKey = base.hex.decode(chunkXLHUGP3G_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
24649
24663
  }
24650
24664
  let userKey;
24651
24665
  if (opts.identity) {
24652
- userKey = chunkGN2K4WBP_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
24666
+ userKey = chunkGW42FS2X_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
24653
24667
  }
24654
24668
  let contractManager = opts.contractManager;
24655
24669
  let ownsContractManager = false;
@@ -24768,7 +24782,7 @@ var Arkade = class _Arkade {
24768
24782
  `compiler artifact: server exit delay ${delay}s must be a multiple of 512 seconds`
24769
24783
  );
24770
24784
  }
24771
- const sequence = BigInt(chunkUUSKJOSX_cjs.timelockToSequence(typed));
24785
+ const sequence = BigInt(chunkXLHUGP3G_cjs.timelockToSequence(typed));
24772
24786
  if (args.SERVER_EXIT_DELAY !== void 0 && args.SERVER_EXIT_DELAY !== sequence && args.SERVER_EXIT_DELAY !== Number(sequence)) {
24773
24787
  throw new Error(
24774
24788
  "compiler artifact: reserved SERVER_EXIT_DELAY must match the connected server"
@@ -24789,7 +24803,7 @@ var ArkadeContract = class _ArkadeContract {
24789
24803
  userKey: client.userKey,
24790
24804
  emulatorKey: client.emulatorKey
24791
24805
  };
24792
- this.vtxoScript = new chunkGN2K4WBP_cjs.ArkadeProgramScript(program, args, this.keys);
24806
+ this.vtxoScript = new chunkGW42FS2X_cjs.ArkadeProgramScript(program, args, this.keys);
24793
24807
  this.tapTree = this.vtxoScript.encode();
24794
24808
  this.compiled = this.vtxoScript.compiled;
24795
24809
  }
@@ -24814,7 +24828,7 @@ var ArkadeContract = class _ArkadeContract {
24814
24828
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
24815
24829
  );
24816
24830
  }
24817
- const typed = chunkGN2K4WBP_cjs.deserializeArkadeContractParams(contract.params);
24831
+ const typed = chunkGW42FS2X_cjs.deserializeArkadeContractParams(contract.params);
24818
24832
  return new _ArkadeContract(client, typed.program, typed.args, {
24819
24833
  serverKey: typed.serverKey,
24820
24834
  userKey: typed.userKey,
@@ -24850,7 +24864,7 @@ var ArkadeContract = class _ArkadeContract {
24850
24864
  toContractParams() {
24851
24865
  return {
24852
24866
  type: "arkade",
24853
- params: chunkGN2K4WBP_cjs.serializeArkadeContractParams({
24867
+ params: chunkGW42FS2X_cjs.serializeArkadeContractParams({
24854
24868
  program: this.program,
24855
24869
  args: this.args,
24856
24870
  serverKey: this.keys.serverKey,
@@ -24937,17 +24951,17 @@ var ArkadeContract = class _ArkadeContract {
24937
24951
  const [registered] = await manager.getContracts({ script: scriptHex });
24938
24952
  if (registered) {
24939
24953
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
24940
- return (withVtxos?.vtxos ?? []).filter((v) => !chunkUUSKJOSX_cjs.isVtxoSpent(v) && !v.isUnrolled);
24954
+ return (withVtxos?.vtxos ?? []).filter((v) => !chunkXLHUGP3G_cjs.isVtxoSpent(v) && !v.isUnrolled);
24941
24955
  }
24942
24956
  }
24943
24957
  if (!this.client.indexer) {
24944
24958
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
24945
24959
  }
24946
- const { vtxos } = await chunkUUSKJOSX_cjs.getNormalizedVtxos(this.client.indexer, {
24960
+ const { vtxos } = await chunkXLHUGP3G_cjs.getNormalizedVtxos(this.client.indexer, {
24947
24961
  scripts: [scriptHex],
24948
24962
  spendableOnly: true
24949
24963
  });
24950
- return vtxos.filter((v) => !chunkUUSKJOSX_cjs.isVtxoSpent(v) && !v.isUnrolled);
24964
+ return vtxos.filter((v) => !chunkXLHUGP3G_cjs.isVtxoSpent(v) && !v.isUnrolled);
24951
24965
  }
24952
24966
  /** Total spendable balance (requires an indexer). */
24953
24967
  async getBalance() {
@@ -25056,7 +25070,7 @@ var ArkadeTransactionBuilder = class {
25056
25070
  this.contract.client.checkpoint
25057
25071
  );
25058
25072
  if (coin.sourceTx) {
25059
- chunkUUSKJOSX_cjs.setArkPsbtField(arkTx, 0, chunkUUSKJOSX_cjs.PrevArkTxField, coin.sourceTx);
25073
+ chunkXLHUGP3G_cjs.setArkPsbtField(arkTx, 0, chunkXLHUGP3G_cjs.PrevArkTxField, coin.sourceTx);
25060
25074
  }
25061
25075
  if (this.fn.arkadeScript) {
25062
25076
  const indexer = this.contract.client.indexer;
@@ -25073,8 +25087,8 @@ var ArkadeTransactionBuilder = class {
25073
25087
  }
25074
25088
  const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
25075
25089
  if (condition.length > 0) {
25076
- chunkUUSKJOSX_cjs.setArkPsbtField(arkTx, 0, chunkUUSKJOSX_cjs.ConditionWitness, condition);
25077
- chunkUUSKJOSX_cjs.setArkPsbtField(checkpoints[0], 0, chunkUUSKJOSX_cjs.ConditionWitness, condition);
25090
+ chunkXLHUGP3G_cjs.setArkPsbtField(arkTx, 0, chunkXLHUGP3G_cjs.ConditionWitness, condition);
25091
+ chunkXLHUGP3G_cjs.setArkPsbtField(checkpoints[0], 0, chunkXLHUGP3G_cjs.ConditionWitness, condition);
25078
25092
  }
25079
25093
  const packets = [];
25080
25094
  if (this.assetSpecs.length > 0) {
@@ -25182,19 +25196,19 @@ var ArkadeTransactionBuilder = class {
25182
25196
  }
25183
25197
  buildAssetPacket() {
25184
25198
  const groups = this.assetSpecs.map((s) => {
25185
- const id = typeof s.assetId === "string" ? chunkIQWLFYT2_cjs.AssetId.fromString(s.assetId) : chunkIQWLFYT2_cjs.AssetId.fromBytes(s.assetId);
25186
- return chunkIQWLFYT2_cjs.AssetGroup.create(
25199
+ const id = typeof s.assetId === "string" ? chunkHQNQ3CLQ_cjs.AssetId.fromString(s.assetId) : chunkHQNQ3CLQ_cjs.AssetId.fromBytes(s.assetId);
25200
+ return chunkHQNQ3CLQ_cjs.AssetGroup.create(
25187
25201
  id,
25188
25202
  null,
25189
- s.inputs.map((i) => chunkIQWLFYT2_cjs.AssetInput.create(i.vin, i.amount)),
25190
- s.outputs.map((o) => chunkIQWLFYT2_cjs.AssetOutput.create(o.vout, o.amount)),
25191
- (s.metadata ?? []).map((m) => chunkIQWLFYT2_cjs.Metadata.create(m.key, m.value))
25203
+ s.inputs.map((i) => chunkHQNQ3CLQ_cjs.AssetInput.create(i.vin, i.amount)),
25204
+ s.outputs.map((o) => chunkHQNQ3CLQ_cjs.AssetOutput.create(o.vout, o.amount)),
25205
+ (s.metadata ?? []).map((m) => chunkHQNQ3CLQ_cjs.Metadata.create(m.key, m.value))
25192
25206
  );
25193
25207
  });
25194
- return chunkIQWLFYT2_cjs.Packet.create(groups);
25208
+ return chunkHQNQ3CLQ_cjs.Packet.create(groups);
25195
25209
  }
25196
25210
  witnessBytes(ref) {
25197
- return chunkGN2K4WBP_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
25211
+ return chunkGW42FS2X_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
25198
25212
  }
25199
25213
  };
25200
25214
  function bindInputs(fn, callArgs) {
@@ -25208,7 +25222,7 @@ function bindInputs(fn, callArgs) {
25208
25222
  inputs.forEach((def, i) => {
25209
25223
  if (Object.hasOwn(bound, def.name))
25210
25224
  throw new Error(`${fn.name}: duplicate input '${def.name}'`);
25211
- chunkGN2K4WBP_cjs.validateParamValue(def, callArgs[i]);
25225
+ chunkGW42FS2X_cjs.validateParamValue(def, callArgs[i]);
25212
25226
  bound[def.name] = callArgs[i];
25213
25227
  });
25214
25228
  return bound;
@@ -25619,17 +25633,17 @@ var walletFeeSource = (wallet) => async () => (await wallet.arkProvider.getInfo(
25619
25633
  function offchainInputFees(vtxos, fees) {
25620
25634
  const estimator = new Estimator(fees?.intentFee ?? {});
25621
25635
  return vtxos.reduce(
25622
- (total, vtxo) => total + estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
25636
+ (total, vtxo) => total + estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
25623
25637
  0
25624
25638
  );
25625
25639
  }
25626
25640
  async function changeOutputFee(wallet, inputs, needed, fees) {
25627
25641
  const estimator = new Estimator(fees?.intentFee ?? {});
25628
25642
  const net = inputs.reduce(
25629
- (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkUUSKJOSX_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
25643
+ (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkXLHUGP3G_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
25630
25644
  0n
25631
25645
  );
25632
- const script = base.hex.encode(chunkUUSKJOSX_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
25646
+ const script = base.hex.encode(chunkXLHUGP3G_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
25633
25647
  return changeAfterOutputFee(
25634
25648
  net - needed,
25635
25649
  (amount) => BigInt(estimator.evalOffchainOutput({ amount, script }).satoshis)
@@ -25932,5 +25946,5 @@ exports.waitForIncomingFunds = waitForIncomingFunds;
25932
25946
  exports.walletFeeSource = walletFeeSource;
25933
25947
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
25934
25948
  exports.withPrevTxs = withPrevTxs;
25935
- //# sourceMappingURL=chunk-AU77RYOC.cjs.map
25936
- //# sourceMappingURL=chunk-AU77RYOC.cjs.map
25949
+ //# sourceMappingURL=chunk-QKNSMVBW.cjs.map
25950
+ //# sourceMappingURL=chunk-QKNSMVBW.cjs.map