@arkade-os/sdk 0.5.0-rc.12 → 0.5.0-rc.13

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 (76) 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-ZJ0uB_km.d.cts → asyncStorageTaskQueue-0EeSeCAt.d.cts} +1 -1
  7. package/dist/{asyncStorageTaskQueue-DDVTySuO.d.ts → asyncStorageTaskQueue-DV94jhwq.d.ts} +1 -1
  8. package/dist/{chunk-KBXBS4WO.js → chunk-3JLYJ5KZ.js} +3 -3
  9. package/dist/{chunk-KBXBS4WO.js.map → chunk-3JLYJ5KZ.js.map} +1 -1
  10. package/dist/{chunk-C7ARQI5U.js → chunk-4EU2Q6YT.js} +4 -4
  11. package/dist/{chunk-C7ARQI5U.js.map → chunk-4EU2Q6YT.js.map} +1 -1
  12. package/dist/{chunk-6ZBLIJ3N.cjs → chunk-7BACS4XK.cjs} +10 -10
  13. package/dist/{chunk-6ZBLIJ3N.cjs.map → chunk-7BACS4XK.cjs.map} +1 -1
  14. package/dist/{chunk-VKM6VUOZ.cjs → chunk-7NK6XFC3.cjs} +3 -3
  15. package/dist/{chunk-VKM6VUOZ.cjs.map → chunk-7NK6XFC3.cjs.map} +1 -1
  16. package/dist/{chunk-XDT24LBQ.cjs → chunk-BFQX2KS3.cjs} +18 -18
  17. package/dist/{chunk-XDT24LBQ.cjs.map → chunk-BFQX2KS3.cjs.map} +1 -1
  18. package/dist/{chunk-QD3N3ZS7.js → chunk-D7JLTHSZ.js} +4 -4
  19. package/dist/{chunk-QD3N3ZS7.js.map → chunk-D7JLTHSZ.js.map} +1 -1
  20. package/dist/{chunk-2G3XR3E7.js → chunk-EJYWGTZ7.js} +3 -3
  21. package/dist/{chunk-2G3XR3E7.js.map → chunk-EJYWGTZ7.js.map} +1 -1
  22. package/dist/{chunk-73NPW5LY.cjs → chunk-FDQQOF3F.cjs} +47 -47
  23. package/dist/{chunk-73NPW5LY.cjs.map → chunk-FDQQOF3F.cjs.map} +1 -1
  24. package/dist/{chunk-HQTM6HLJ.cjs → chunk-I4YBVHAK.cjs} +457 -456
  25. package/dist/chunk-I4YBVHAK.cjs.map +1 -0
  26. package/dist/{chunk-F5P5V3XR.js → chunk-IV2252XM.js} +11 -10
  27. package/dist/chunk-IV2252XM.js.map +1 -0
  28. package/dist/{chunk-6UKMLPWP.js → chunk-JOUPIZ32.js} +3 -3
  29. package/dist/{chunk-6UKMLPWP.js.map → chunk-JOUPIZ32.js.map} +1 -1
  30. package/dist/{chunk-LG4B4CFA.cjs → chunk-RDQSVIXD.cjs} +15 -15
  31. package/dist/{chunk-LG4B4CFA.cjs.map → chunk-RDQSVIXD.cjs.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--_TwHqAa.d.cts → delegate-BgpUJW5B.d.cts} +1 -1
  37. package/dist/{delegate-DbYSf9lY.d.ts → delegate-BuagcGnG.d.ts} +1 -1
  38. package/dist/{index-D-zl1tea.d.cts → index-CKmB14Yu.d.cts} +7 -2
  39. package/dist/{index-D-zl1tea.d.ts → index-CKmB14Yu.d.ts} +7 -2
  40. package/dist/{index--rMssbOo.d.cts → index-D0BuYwhF.d.cts} +2 -2
  41. package/dist/{index-BwYXDgZM.d.ts → index-DbzyrqK7.d.ts} +2 -2
  42. package/dist/index.cjs +305 -305
  43. package/dist/index.d.cts +12 -12
  44. package/dist/index.d.ts +12 -12
  45. package/dist/index.js +4 -4
  46. package/dist/repositories/realm/index.cjs +36 -36
  47. package/dist/repositories/realm/index.cjs.map +1 -1
  48. package/dist/repositories/realm/index.d.cts +4 -4
  49. package/dist/repositories/realm/index.d.ts +4 -4
  50. package/dist/repositories/realm/index.js +7 -7
  51. package/dist/repositories/realm/index.js.map +1 -1
  52. package/dist/repositories/sqlite/index.cjs +34 -34
  53. package/dist/repositories/sqlite/index.cjs.map +1 -1
  54. package/dist/repositories/sqlite/index.d.cts +4 -4
  55. package/dist/repositories/sqlite/index.d.ts +4 -4
  56. package/dist/repositories/sqlite/index.js +7 -7
  57. package/dist/repositories/sqlite/index.js.map +1 -1
  58. package/dist/{taskRunner-ChQpqvfy.d.ts → taskRunner-BX-pB0sv.d.ts} +1 -1
  59. package/dist/{taskRunner-DjzP-n_3.d.cts → taskRunner-DJrFFyus.d.cts} +1 -1
  60. package/dist/wallet/expo/background.cjs +14 -14
  61. package/dist/wallet/expo/background.d.cts +3 -3
  62. package/dist/wallet/expo/background.d.ts +3 -3
  63. package/dist/wallet/expo/background.js +6 -6
  64. package/dist/wallet/expo/index.cjs +14 -14
  65. package/dist/wallet/expo/index.d.cts +4 -4
  66. package/dist/wallet/expo/index.d.ts +4 -4
  67. package/dist/wallet/expo/index.js +5 -5
  68. package/dist/{wallet-DfYA1QzQ.d.cts → wallet-BsL2G3Qb.d.cts} +2 -2
  69. package/dist/{wallet-BwCcOWEI.d.ts → wallet-DXNiCmq8.d.ts} +2 -2
  70. package/dist/worker/expo/index.cjs +9 -9
  71. package/dist/worker/expo/index.d.cts +4 -4
  72. package/dist/worker/expo/index.d.ts +4 -4
  73. package/dist/worker/expo/index.js +5 -5
  74. package/package.json +1 -1
  75. package/dist/chunk-F5P5V3XR.js.map +0 -1
  76. package/dist/chunk-HQTM6HLJ.cjs.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkXDT24LBQ_cjs = require('./chunk-XDT24LBQ.cjs');
4
- var chunk73NPW5LY_cjs = require('./chunk-73NPW5LY.cjs');
5
- var chunkVKM6VUOZ_cjs = require('./chunk-VKM6VUOZ.cjs');
3
+ var chunkBFQX2KS3_cjs = require('./chunk-BFQX2KS3.cjs');
4
+ var chunkFDQQOF3F_cjs = require('./chunk-FDQQOF3F.cjs');
5
+ var chunk7NK6XFC3_cjs = require('./chunk-7NK6XFC3.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 = chunkVKM6VUOZ_cjs.getArkPsbtFields(tx.root, 0, chunkVKM6VUOZ_cjs.CosignerPublicKey).map(
190
+ const cosigners = chunk7NK6XFC3_cjs.getArkPsbtFields(tx.root, 0, chunk7NK6XFC3_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 = chunkVKM6VUOZ_cjs.getArkPsbtFields(g.root, 0, chunkVKM6VUOZ_cjs.CosignerPublicKey).map((c) => c.key);
242
+ const cosigners = chunk7NK6XFC3_cjs.getArkPsbtFields(g.root, 0, chunk7NK6XFC3_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
- chunkVKM6VUOZ_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
325
+ chunk7NK6XFC3_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 = chunk73NPW5LY_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
425
+ network = chunkFDQQOF3F_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 chunk73NPW5LY_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
502
+ return chunkFDQQOF3F_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 = chunk73NPW5LY_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
541
+ const network = chunkFDQQOF3F_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
- chunkVKM6VUOZ_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
566
+ chunk7NK6XFC3_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 = chunk73NPW5LY_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
618
+ const network = chunkFDQQOF3F_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 chunk73NPW5LY_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
653
+ return chunkFDQQOF3F_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 chunk73NPW5LY_cjs.deriveDescriptorLeafPubKey(this.descriptor);
796
+ return chunkFDQQOF3F_cjs.deriveDescriptorLeafPubKey(this.descriptor);
797
797
  }
798
798
  async compressedPublicKey() {
799
- return chunk73NPW5LY_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
799
+ return chunkFDQQOF3F_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
800
800
  }
801
801
  async sign(tx, inputIndexes) {
802
802
  const [signed] = await this.signer.signWithDescriptor([
@@ -869,12 +869,12 @@ async function resolveDescriptorSigner(descriptor, identity, provider) {
869
869
  signMessageWithDescriptor: (ownedDescriptor, message, signatureType) => identity.signDescriptorMessage(ownedDescriptor, message, signatureType)
870
870
  } : void 0;
871
871
  const owner = providerOwner ?? identityOwner;
872
- if (owner && chunk73NPW5LY_cjs.parseHDDescriptor(descriptor)) {
872
+ if (owner && chunkFDQQOF3F_cjs.parseHDDescriptor(descriptor)) {
873
873
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
874
874
  }
875
875
  let key;
876
876
  try {
877
- key = chunk73NPW5LY_cjs.deriveDescriptorLeafPubKey(descriptor);
877
+ key = chunkFDQQOF3F_cjs.deriveDescriptorLeafPubKey(descriptor);
878
878
  } catch {
879
879
  throw new ForeignDescriptorError(descriptor);
880
880
  }
@@ -927,14 +927,14 @@ function buildSaltedPreimageMessage(xonly, salt) {
927
927
  }
928
928
  var PREIMAGE_INDEX = 0;
929
929
  function isPerArtifactDescriptor(descriptor) {
930
- return chunk73NPW5LY_cjs.parseHDDescriptor(descriptor) !== null;
930
+ return chunkFDQQOF3F_cjs.parseHDDescriptor(descriptor) !== null;
931
931
  }
932
932
  async function provisionDescriptor(wallet) {
933
933
  const allocated = isHDAllocationCapable(wallet) ? await wallet.getNextSigningDescriptor() : void 0;
934
- return allocated ?? await chunk73NPW5LY_cjs.identityDescriptor(wallet.identity);
934
+ return allocated ?? await chunkFDQQOF3F_cjs.identityDescriptor(wallet.identity);
935
935
  }
936
936
  async function provisionRefundKey(wallet) {
937
- const descriptor = await chunk73NPW5LY_cjs.identityDescriptor(wallet.identity);
937
+ const descriptor = await chunkFDQQOF3F_cjs.identityDescriptor(wallet.identity);
938
938
  const signer = await contractSigner(wallet, descriptor);
939
939
  const pubkey = await signer.xOnlyPublicKey();
940
940
  const identityPubkey = await wallet.identity.xOnlyPublicKey();
@@ -944,7 +944,7 @@ async function provisionRefundKey(wallet) {
944
944
  );
945
945
  }
946
946
  const address = await wallet.getAddress();
947
- const { pkScript } = chunkVKM6VUOZ_cjs.ArkAddress.decode(address);
947
+ const { pkScript } = chunk7NK6XFC3_cjs.ArkAddress.decode(address);
948
948
  return { descriptor, pubkey, pkScript, address };
949
949
  }
950
950
  async function provisionClaimSecret(wallet, opts = {}) {
@@ -990,7 +990,7 @@ async function contractSigner(wallet, descriptor) {
990
990
  const signer = isHDWalletCapable(wallet) ? await wallet.signerForDescriptor(descriptor) : wallet.identity;
991
991
  let expected;
992
992
  try {
993
- expected = chunk73NPW5LY_cjs.deriveDescriptorLeafPubKey(descriptor);
993
+ expected = chunkFDQQOF3F_cjs.deriveDescriptorLeafPubKey(descriptor);
994
994
  } catch (cause) {
995
995
  throw new ForeignDescriptorError(descriptor, { cause });
996
996
  }
@@ -1194,14 +1194,14 @@ var RestDelegateProvider = class {
1194
1194
  */
1195
1195
  async delegate(intent, forfeitTxs, options) {
1196
1196
  const url = `${this.url}/v1/delegate`;
1197
- const response = await chunkVKM6VUOZ_cjs.baseFetch(url, {
1197
+ const response = await chunk7NK6XFC3_cjs.baseFetch(url, {
1198
1198
  method: "POST",
1199
1199
  headers: {
1200
1200
  "Content-Type": "application/json"
1201
1201
  },
1202
1202
  body: JSON.stringify({
1203
1203
  intent: {
1204
- message: chunkVKM6VUOZ_cjs.Intent.encodeMessage(intent.message),
1204
+ message: chunk7NK6XFC3_cjs.Intent.encodeMessage(intent.message),
1205
1205
  proof: intent.proof
1206
1206
  },
1207
1207
  forfeit_txs: forfeitTxs,
@@ -1220,7 +1220,7 @@ var RestDelegateProvider = class {
1220
1220
  */
1221
1221
  async getDelegateInfo() {
1222
1222
  const url = `${this.url}/v1/delegator/info`;
1223
- const response = await chunkVKM6VUOZ_cjs.rateGate.runHttp(url, () => chunkVKM6VUOZ_cjs.baseFetch(url));
1223
+ const response = await chunk7NK6XFC3_cjs.rateGate.runHttp(url, () => chunk7NK6XFC3_cjs.baseFetch(url));
1224
1224
  if (!response.ok) {
1225
1225
  const errorText2 = await response.text();
1226
1226
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1276,7 +1276,7 @@ async function collectPages(read) {
1276
1276
  return items;
1277
1277
  }
1278
1278
  function scriptFromArkAddress(address) {
1279
- return base.hex.encode(chunkVKM6VUOZ_cjs.ArkAddress.decode(address).pkScript);
1279
+ return base.hex.encode(chunk7NK6XFC3_cjs.ArkAddress.decode(address).pkScript);
1280
1280
  }
1281
1281
 
1282
1282
  // src/repositories/walletRepository.ts
@@ -1335,9 +1335,9 @@ async function collectScriptVtxos(repository, script, options) {
1335
1335
  return [...byOutpoint.values()].map((row) => row.vtxo);
1336
1336
  }
1337
1337
  function unspentScriptVtxos(rows, copies) {
1338
- const spent = copies.filter((copy) => chunkVKM6VUOZ_cjs.isVtxoSpent(copy.vtxo));
1338
+ const spent = copies.filter((copy) => chunk7NK6XFC3_cjs.isVtxoSpent(copy.vtxo));
1339
1339
  return rows.filter(
1340
- (row) => !chunkVKM6VUOZ_cjs.isVtxoSpent(row.vtxo) && !spent.some(
1340
+ (row) => !chunk7NK6XFC3_cjs.isVtxoSpent(row.vtxo) && !spent.some(
1341
1341
  (copy) => copy.address !== row.address && copy.vtxo.txid === row.vtxo.txid && copy.vtxo.vout === row.vtxo.vout && shouldReplaceScriptVtxo(row, copy)
1342
1342
  )
1343
1343
  );
@@ -1420,7 +1420,7 @@ var ESPLORA_URL = {
1420
1420
  regtest: "http://localhost:3000/api"
1421
1421
  };
1422
1422
  var EsploraProvider = class {
1423
- constructor(baseUrl = ESPLORA_URL[chunkVKM6VUOZ_cjs.DEFAULT_NETWORK_NAME], opts) {
1423
+ constructor(baseUrl = ESPLORA_URL[chunk7NK6XFC3_cjs.DEFAULT_NETWORK_NAME], opts) {
1424
1424
  this.baseUrl = baseUrl;
1425
1425
  this.pollingInterval = opts?.pollingInterval ?? 15e3;
1426
1426
  this.forcePolling = opts?.forcePolling ?? false;
@@ -1435,14 +1435,14 @@ var EsploraProvider = class {
1435
1435
  */
1436
1436
  addressWatches = /* @__PURE__ */ new Map();
1437
1437
  async getCoins(address) {
1438
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1438
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1439
1439
  if (!response.ok) {
1440
1440
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1441
1441
  }
1442
1442
  return response.json();
1443
1443
  }
1444
1444
  async getFeeRate() {
1445
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1445
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
1446
1446
  if (response.status === 404) {
1447
1447
  return void 0;
1448
1448
  }
@@ -1463,7 +1463,7 @@ var EsploraProvider = class {
1463
1463
  }
1464
1464
  }
1465
1465
  async getTxOutspends(txid) {
1466
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1466
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1467
1467
  if (!response.ok) {
1468
1468
  const error = await response.text();
1469
1469
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -1471,7 +1471,7 @@ var EsploraProvider = class {
1471
1471
  return response.json();
1472
1472
  }
1473
1473
  async getTransactions(address) {
1474
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1474
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1475
1475
  if (!response.ok) {
1476
1476
  const error = await response.text();
1477
1477
  throw new Error(`Failed to get transactions: ${error}`);
@@ -1480,14 +1480,14 @@ var EsploraProvider = class {
1480
1480
  }
1481
1481
  /** Orders of magnitude smaller than `/address/{addr}/txs`: the polling fallback's probe. */
1482
1482
  async getAddressStats(address) {
1483
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1483
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1484
1484
  if (!response.ok) {
1485
1485
  throw new Error(`Failed to get address stats: ${response.statusText}`);
1486
1486
  }
1487
1487
  return response.json();
1488
1488
  }
1489
1489
  async getRawTransaction(txid) {
1490
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1490
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1491
1491
  if (!response.ok) {
1492
1492
  const error = await response.text();
1493
1493
  throw new Error(`Failed to get raw transaction ${txid}: ${error}`);
@@ -1495,7 +1495,7 @@ var EsploraProvider = class {
1495
1495
  return base.hex.decode((await response.text()).trim());
1496
1496
  }
1497
1497
  async getTxStatus(txid) {
1498
- const txresponse = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1498
+ const txresponse = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1499
1499
  if (!txresponse.ok) {
1500
1500
  throw new Error(txresponse.statusText);
1501
1501
  }
@@ -1503,7 +1503,7 @@ var EsploraProvider = class {
1503
1503
  if (!tx.status.confirmed) {
1504
1504
  return { confirmed: false };
1505
1505
  }
1506
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1506
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1507
1507
  if (!response.ok) {
1508
1508
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
1509
1509
  }
@@ -1777,9 +1777,9 @@ var EsploraProvider = class {
1777
1777
  return { subscribers, teardown, started };
1778
1778
  }
1779
1779
  async getChainTip() {
1780
- let tipBlocks = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/blocks`);
1780
+ let tipBlocks = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/blocks`);
1781
1781
  if (tipBlocks.status === 404) {
1782
- tipBlocks = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
1782
+ tipBlocks = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
1783
1783
  }
1784
1784
  if (!tipBlocks.ok) {
1785
1785
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
@@ -1800,7 +1800,7 @@ var EsploraProvider = class {
1800
1800
  };
1801
1801
  }
1802
1802
  async broadcastPackage(parent, child) {
1803
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
1803
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
1804
1804
  method: "POST",
1805
1805
  headers: {
1806
1806
  "Content-Type": "application/json"
@@ -1816,7 +1816,7 @@ var EsploraProvider = class {
1816
1816
  return result;
1817
1817
  }
1818
1818
  async broadcastTx(tx) {
1819
- const response = await chunkVKM6VUOZ_cjs.baseFetch(`${this.baseUrl}/tx`, {
1819
+ const response = await chunk7NK6XFC3_cjs.baseFetch(`${this.baseUrl}/tx`, {
1820
1820
  method: "POST",
1821
1821
  headers: {
1822
1822
  "Content-Type": "text/plain"
@@ -1993,7 +1993,7 @@ function findP2AOutput(tx) {
1993
1993
  var CHILD_DUST_AMOUNT = 546;
1994
1994
  function buildAnchorChild(params) {
1995
1995
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
1996
- const child = new chunkVKM6VUOZ_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
1996
+ const child = new chunk7NK6XFC3_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
1997
1997
  child.addInput(findP2AOutput(parent));
1998
1998
  const estimator = TxWeightEstimator.create().addP2AInput();
1999
1999
  for (const _ of fundingCoins) {
@@ -2041,7 +2041,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
2041
2041
  );
2042
2042
  }
2043
2043
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
2044
- const tx = new chunkVKM6VUOZ_cjs.Transaction({
2044
+ const tx = new chunk7NK6XFC3_cjs.Transaction({
2045
2045
  version: 3,
2046
2046
  lockTime: txLocktime
2047
2047
  });
@@ -2117,7 +2117,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
2117
2117
  if (previousScriptKey.length !== 32) {
2118
2118
  throw new Error(`parent output ${childIndex} has invalid script`);
2119
2119
  }
2120
- const cosigners = chunkVKM6VUOZ_cjs.getArkPsbtFields(child.root, 0, chunkVKM6VUOZ_cjs.CosignerPublicKey);
2120
+ const cosigners = chunk7NK6XFC3_cjs.getArkPsbtFields(child.root, 0, chunk7NK6XFC3_cjs.CosignerPublicKey);
2121
2121
  if (cosigners.length === 0) {
2122
2122
  throw ErrMissingCosignersPublicKeys;
2123
2123
  }
@@ -2175,7 +2175,7 @@ var EmulatorPacket = class _EmulatorPacket {
2175
2175
  return new _EmulatorPacket(entries);
2176
2176
  }
2177
2177
  static fromBytes(data) {
2178
- const reader = new chunkXDT24LBQ_cjs.BufferReader(data);
2178
+ const reader = new chunkBFQX2KS3_cjs.BufferReader(data);
2179
2179
  const entryCount = reader.readCompactSize();
2180
2180
  const entries = [];
2181
2181
  for (let i = 0; i < entryCount; i++) {
@@ -2193,7 +2193,7 @@ var EmulatorPacket = class _EmulatorPacket {
2193
2193
  return _EmulatorPacket.PACKET_TYPE;
2194
2194
  }
2195
2195
  serialize() {
2196
- const writer = new chunkXDT24LBQ_cjs.BufferWriter();
2196
+ const writer = new chunkBFQX2KS3_cjs.BufferWriter();
2197
2197
  writer.writeCompactSize(this.entries.length);
2198
2198
  for (const entry of this.entries) {
2199
2199
  writer.writeUint16LE(entry.vin);
@@ -2280,7 +2280,7 @@ var Extension = class _Extension {
2280
2280
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
2281
2281
  );
2282
2282
  }
2283
- const reader = new chunkXDT24LBQ_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2283
+ const reader = new chunkBFQX2KS3_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2284
2284
  const packets = [];
2285
2285
  while (reader.remaining() > 0) {
2286
2286
  const packetType = reader.readByte();
@@ -2353,7 +2353,7 @@ var Extension = class _Extension {
2353
2353
  * getAssetPacket returns the embedded Packet, or null if not present.
2354
2354
  */
2355
2355
  getAssetPacket() {
2356
- return this.packets.find((p) => p instanceof chunkXDT24LBQ_cjs.Packet) ?? null;
2356
+ return this.packets.find((p) => p instanceof chunkBFQX2KS3_cjs.Packet) ?? null;
2357
2357
  }
2358
2358
  /**
2359
2359
  * getEmulatorPacket returns the embedded EmulatorPacket, or null if not present.
@@ -2377,8 +2377,8 @@ var Extension = class _Extension {
2377
2377
  };
2378
2378
  function parsePacket(packetType, data) {
2379
2379
  switch (packetType) {
2380
- case chunkXDT24LBQ_cjs.Packet.PACKET_TYPE:
2381
- return chunkXDT24LBQ_cjs.Packet.fromBytes(data);
2380
+ case chunkBFQX2KS3_cjs.Packet.PACKET_TYPE:
2381
+ return chunkBFQX2KS3_cjs.Packet.fromBytes(data);
2382
2382
  case EmulatorPacket.PACKET_TYPE:
2383
2383
  return EmulatorPacket.fromBytes(data);
2384
2384
  default:
@@ -2425,22 +2425,22 @@ function buildOpReturnScript(data) {
2425
2425
  }
2426
2426
  return script;
2427
2427
  }
2428
- var ErrOffchainOutputNotFound = (address) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2429
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2428
+ var ErrOffchainOutputNotFound = (address) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2429
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2430
2430
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
2431
2431
  );
2432
- var ErrAssetGroupNotFound = (assetId) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2433
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2432
+ var ErrAssetGroupNotFound = (assetId) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2433
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2434
2434
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
2435
2435
  );
2436
- var ErrOnchainOutputNotFound = (address) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2437
- var ErrUnvalidatedOffchainOutput = (address) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2436
+ var ErrOnchainOutputNotFound = (address) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2437
+ var ErrUnvalidatedOffchainOutput = (address) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2438
2438
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2439
2439
  );
2440
- var ErrIntentOutputNotFound = (index, kind) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2440
+ var ErrIntentOutputNotFound = (index, kind) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2441
2441
  `${kind} output ${index} of the intent proof is not present in what the server built`
2442
2442
  );
2443
- var ErrUnvalidatedIntentOutput = (index) => new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2443
+ var ErrUnvalidatedIntentOutput = (index) => new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2444
2444
  `offchain output ${index} of the intent proof cannot be validated: virtual output tree signing did not run`
2445
2445
  );
2446
2446
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
@@ -2449,7 +2449,7 @@ var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain ou
2449
2449
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
2450
2450
  if (!validatedCommitmentTxid) return;
2451
2451
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
2452
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2452
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2453
2453
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
2454
2454
  );
2455
2455
  }
@@ -2459,7 +2459,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
2459
2459
  for (const recipient of recipients) {
2460
2460
  let arkAddress;
2461
2461
  try {
2462
- arkAddress = chunkVKM6VUOZ_cjs.ArkAddress.decode(recipient.address);
2462
+ arkAddress = chunk7NK6XFC3_cjs.ArkAddress.decode(recipient.address);
2463
2463
  } catch {
2464
2464
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2465
2465
  continue;
@@ -2471,7 +2471,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2471
2471
  const usedOnchainOutputs = /* @__PURE__ */ new Set();
2472
2472
  for (const recipient of recipients) {
2473
2473
  try {
2474
- chunkVKM6VUOZ_cjs.ArkAddress.decode(recipient.address);
2474
+ chunk7NK6XFC3_cjs.ArkAddress.decode(recipient.address);
2475
2475
  } catch {
2476
2476
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2477
2477
  continue;
@@ -2480,7 +2480,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2480
2480
  }
2481
2481
  }
2482
2482
  function declaredIntentOutputs(signedProof, onchainOutputIndexes) {
2483
- const proof = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2483
+ const proof = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2484
2484
  const onchain = new Set(onchainOutputIndexes);
2485
2485
  const declared = [];
2486
2486
  for (let i = 0; i < proof.outputsLength; i++) {
@@ -2772,7 +2772,7 @@ function assetMintResolver() {
2772
2772
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
2773
2773
  const minted = tx.assets.filter((a) => {
2774
2774
  try {
2775
- return base.hex.encode(chunkXDT24LBQ_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2775
+ return base.hex.encode(chunkBFQX2KS3_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
2776
2776
  } catch {
2777
2777
  return false;
2778
2778
  }
@@ -2797,7 +2797,8 @@ function createDefaultActivityRegistry() {
2797
2797
  }
2798
2798
 
2799
2799
  // src/wallet/restoreHooks.ts
2800
- var restoreHooks = /* @__PURE__ */ new WeakMap();
2800
+ var REGISTRY = /* @__PURE__ */ Symbol.for("@arkade-os/sdk/walletRestoreHooks");
2801
+ var restoreHooks = globalThis[REGISTRY] ??= /* @__PURE__ */ new WeakMap();
2801
2802
  function registerWalletRestoreHook(wallet, hook) {
2802
2803
  const hooks = restoreHooks.get(wallet) ?? [];
2803
2804
  const entry = { ...hook };
@@ -2848,7 +2849,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2848
2849
  const existing = inputsByAssetId.get(asset.assetId);
2849
2850
  inputsByAssetId.set(asset.assetId, [
2850
2851
  ...existing ?? [],
2851
- chunkXDT24LBQ_cjs.AssetInput.create(inputIndex, asset.amount)
2852
+ chunkBFQX2KS3_cjs.AssetInput.create(inputIndex, asset.amount)
2852
2853
  ]);
2853
2854
  }
2854
2855
  }
@@ -2860,7 +2861,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2860
2861
  const existing = outputsByAssetId.get(asset.assetId);
2861
2862
  outputsByAssetId.set(asset.assetId, [
2862
2863
  ...existing ?? [],
2863
- chunkXDT24LBQ_cjs.AssetOutput.create(outputIndex, asset.amount)
2864
+ chunkBFQX2KS3_cjs.AssetOutput.create(outputIndex, asset.amount)
2864
2865
  ]);
2865
2866
  }
2866
2867
  }
@@ -2871,7 +2872,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2871
2872
  const existing = outputsByAssetId.get(asset.assetId);
2872
2873
  outputsByAssetId.set(asset.assetId, [
2873
2874
  ...existing ?? [],
2874
- chunkXDT24LBQ_cjs.AssetOutput.create(outputIndex, asset.amount)
2875
+ chunkBFQX2KS3_cjs.AssetOutput.create(outputIndex, asset.amount)
2875
2876
  ]);
2876
2877
  }
2877
2878
  }
@@ -2880,11 +2881,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
2880
2881
  for (const assetIdStr of allAssetIds) {
2881
2882
  const inputs = inputsByAssetId.get(assetIdStr);
2882
2883
  const outputs = outputsByAssetId.get(assetIdStr);
2883
- const assetId = chunkXDT24LBQ_cjs.AssetId.fromString(assetIdStr);
2884
- const group = chunkXDT24LBQ_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
2884
+ const assetId = chunkBFQX2KS3_cjs.AssetId.fromString(assetIdStr);
2885
+ const group = chunkBFQX2KS3_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
2885
2886
  groups.push(group);
2886
2887
  }
2887
- return chunkXDT24LBQ_cjs.Packet.create(groups);
2888
+ return chunkBFQX2KS3_cjs.Packet.create(groups);
2888
2889
  }
2889
2890
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
2890
2891
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -2921,7 +2922,7 @@ function selectedCoinsToAssetInputs(selectedCoins) {
2921
2922
  }
2922
2923
  function toXOnlySignerHex(pubkeyHex) {
2923
2924
  const bytes = base.hex.decode(pubkeyHex);
2924
- if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunk73NPW5LY_cjs.toXOnly(bytes, "signer key"));
2925
+ if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkFDQQOF3F_cjs.toXOnly(bytes, "signer key"));
2925
2926
  throw new Error(`invalid signer pubkey length: expected 32 or 33 bytes, got ${bytes.length}`);
2926
2927
  }
2927
2928
  function signerSetFromInfo(info) {
@@ -2968,13 +2969,13 @@ var toTimelock = (value) => ({
2968
2969
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
2969
2970
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
2970
2971
  if (policy.requireSeconds && timelock.type === "blocks") {
2971
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2972
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2972
2973
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
2973
2974
  );
2974
2975
  }
2975
2976
  const seconds = toSeconds(timelock);
2976
2977
  if (seconds < policy.minSeconds) {
2977
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2978
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2978
2979
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it`
2979
2980
  );
2980
2981
  }
@@ -2995,7 +2996,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
2995
2996
  }
2996
2997
  function assertValidBatchExpiry(batchExpiry, policy) {
2997
2998
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
2998
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
2999
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
2999
3000
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
3000
3001
  );
3001
3002
  }
@@ -3025,21 +3026,21 @@ function resolveCheckpointExitDelayPolicy(network, overrides) {
3025
3026
  function assertValidServerUnrollScript(checkpointTapscript, policy) {
3026
3027
  let script;
3027
3028
  try {
3028
- script = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3029
+ script = chunk7NK6XFC3_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3029
3030
  } catch (e) {
3030
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3031
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3031
3032
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
3032
3033
  );
3033
3034
  }
3034
3035
  if (policy.advertisedForfeitPubkey !== void 0) {
3035
3036
  const { pubkeys } = script.params;
3036
3037
  if (pubkeys.length !== 1) {
3037
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3038
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3038
3039
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
3039
3040
  );
3040
3041
  }
3041
3042
  if (!utils_js.equalBytes(pubkeys[0], policy.advertisedForfeitPubkey)) {
3042
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3043
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3043
3044
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(policy.advertisedForfeitPubkey)}`
3044
3045
  );
3045
3046
  }
@@ -3083,8 +3084,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
3083
3084
  function buildVirtualTx(inputs, outputs) {
3084
3085
  let lockTime = 0n;
3085
3086
  for (const input of inputs) {
3086
- const tapscript = chunkVKM6VUOZ_cjs.decodeTapscript(chunkVKM6VUOZ_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3087
- if (chunkVKM6VUOZ_cjs.CLTVMultisigTapscript.is(tapscript)) {
3087
+ const tapscript = chunk7NK6XFC3_cjs.decodeTapscript(chunk7NK6XFC3_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3088
+ if (chunk7NK6XFC3_cjs.CLTVMultisigTapscript.is(tapscript)) {
3088
3089
  if (lockTime !== 0n) {
3089
3090
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
3090
3091
  throw new Error("cannot mix seconds and blocks locktime");
@@ -3095,7 +3096,7 @@ function buildVirtualTx(inputs, outputs) {
3095
3096
  }
3096
3097
  }
3097
3098
  }
3098
- const tx = new chunkVKM6VUOZ_cjs.Transaction({
3099
+ const tx = new chunk7NK6XFC3_cjs.Transaction({
3099
3100
  version: 3,
3100
3101
  lockTime: Number(lockTime)
3101
3102
  });
@@ -3105,12 +3106,12 @@ function buildVirtualTx(inputs, outputs) {
3105
3106
  index: input.vout,
3106
3107
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
3107
3108
  witnessUtxo: {
3108
- script: chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).pkScript,
3109
+ script: chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).pkScript,
3109
3110
  amount: BigInt(input.value)
3110
3111
  },
3111
3112
  tapLeafScript: [input.tapLeafScript]
3112
3113
  });
3113
- chunkVKM6VUOZ_cjs.setArkPsbtField(tx, i, chunkVKM6VUOZ_cjs.VtxoTaprootTree, input.tapTree);
3114
+ chunk7NK6XFC3_cjs.setArkPsbtField(tx, i, chunk7NK6XFC3_cjs.VtxoTaprootTree, input.tapTree);
3114
3115
  }
3115
3116
  for (const output of outputs) {
3116
3117
  tx.addOutput(output);
@@ -3119,8 +3120,8 @@ function buildVirtualTx(inputs, outputs) {
3119
3120
  return tx;
3120
3121
  }
3121
3122
  function buildCheckpointTx(vtxo, serverUnrollScript) {
3122
- const collaborativeClosure = chunkVKM6VUOZ_cjs.decodeTapscript(chunkVKM6VUOZ_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3123
- const checkpointVtxoScript = new chunkVKM6VUOZ_cjs.VtxoScript([
3123
+ const collaborativeClosure = chunk7NK6XFC3_cjs.decodeTapscript(chunk7NK6XFC3_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3124
+ const checkpointVtxoScript = new chunk7NK6XFC3_cjs.VtxoScript([
3124
3125
  serverUnrollScript.script,
3125
3126
  collaborativeClosure.script
3126
3127
  ]);
@@ -3196,7 +3197,7 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
3196
3197
  const sighashType = signature.length === 65 ? signature[64] : btcSigner.SigHash.DEFAULT;
3197
3198
  const sig = signature.subarray(0, 64);
3198
3199
  if (!allowedSighashTypes.includes(sighashType)) {
3199
- const sighashName = chunkVKM6VUOZ_cjs.formatSighash(sighashType);
3200
+ const sighashName = chunk7NK6XFC3_cjs.formatSighash(sighashType);
3200
3201
  throw new Error(
3201
3202
  `Unallowed sighash type ${sighashName} for input ${inputIndex}, pubkey ${pubKeyHex}.`
3202
3203
  );
@@ -3270,7 +3271,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
3270
3271
  }
3271
3272
  function isValidArkAddress(address) {
3272
3273
  try {
3273
- chunkVKM6VUOZ_cjs.ArkAddress.decode(address);
3274
+ chunk7NK6XFC3_cjs.ArkAddress.decode(address);
3274
3275
  return true;
3275
3276
  } catch (e) {
3276
3277
  return false;
@@ -3278,16 +3279,16 @@ function isValidArkAddress(address) {
3278
3279
  }
3279
3280
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3280
3281
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3281
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3282
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3282
3283
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3283
3284
  );
3284
3285
  }
3285
3286
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3286
3287
  return serverCheckpointTxs.map((encoded, index) => {
3287
- const server = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3288
+ const server = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3288
3289
  const local = byTxid.get(server.id);
3289
3290
  if (!local) {
3290
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3291
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3291
3292
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3292
3293
  );
3293
3294
  }
@@ -3297,14 +3298,14 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3297
3298
  }
3298
3299
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3299
3300
  if (response.arkTxid !== signedArkTx.id) {
3300
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3301
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3301
3302
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3302
3303
  );
3303
3304
  }
3304
3305
  if (response.finalArkTx === void 0) return;
3305
- const finalTxid = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3306
+ const finalTxid = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3306
3307
  if (finalTxid !== signedArkTx.id) {
3307
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3308
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3308
3309
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3309
3310
  );
3310
3311
  }
@@ -3316,20 +3317,20 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3316
3317
  `${context}: input ${inputIndex} carries no spend leaf to verify the server signature against`
3317
3318
  );
3318
3319
  }
3319
- const script = chunkVKM6VUOZ_cjs.scriptFromTapLeafScript(leaf);
3320
+ const script = chunk7NK6XFC3_cjs.scriptFromTapLeafScript(leaf);
3320
3321
  let leafPubkeys;
3321
3322
  try {
3322
- leafPubkeys = chunkVKM6VUOZ_cjs.decodeTapscript(script).params.pubkeys.map(
3323
- (key) => base.hex.encode(chunk73NPW5LY_cjs.toXOnly(key, "leaf key"))
3323
+ leafPubkeys = chunk7NK6XFC3_cjs.decodeTapscript(script).params.pubkeys.map(
3324
+ (key) => base.hex.encode(chunkFDQQOF3F_cjs.toXOnly(key, "leaf key"))
3324
3325
  );
3325
3326
  } catch (error) {
3326
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3327
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3327
3328
  `${context}: input ${inputIndex} spend leaf cannot be decoded (${error instanceof Error ? error.message : String(error)})`
3328
3329
  );
3329
3330
  }
3330
3331
  const signer = leafPubkeys.find((key) => serverPubkeys.has(key));
3331
3332
  if (!signer) {
3332
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3333
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3333
3334
  `${context}: input ${inputIndex} spend leaf names no signer key the server advertises`
3334
3335
  );
3335
3336
  }
@@ -3343,7 +3344,7 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3343
3344
  payment_js.tapLeafHash(script)
3344
3345
  );
3345
3346
  } catch (error) {
3346
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3347
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3347
3348
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
3348
3349
  );
3349
3350
  }
@@ -3352,20 +3353,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3352
3353
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
3353
3354
  for (const [index, checkpoint] of checkpoints.entries()) {
3354
3355
  if (checkpoint.inputsLength !== 1) {
3355
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3356
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3356
3357
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
3357
3358
  );
3358
3359
  }
3359
3360
  const spent = checkpoint.getInput(0);
3360
3361
  if (!spent.txid || spent.index === void 0) {
3361
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3362
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3362
3363
  `${context}: checkpoint ${index} has no input outpoint`
3363
3364
  );
3364
3365
  }
3365
3366
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
3366
3367
  const input = byOutpoint.get(outpoint);
3367
3368
  if (!input) {
3368
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3369
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3369
3370
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
3370
3371
  );
3371
3372
  }
@@ -3373,7 +3374,7 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3373
3374
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
3374
3375
  );
3375
3376
  if (!rebuilt) {
3376
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3377
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3377
3378
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
3378
3379
  );
3379
3380
  }
@@ -3399,9 +3400,9 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3399
3400
  const matched = matchServerCheckpoints(signedCheckpointTxs, offchainTx.checkpoints, "submitTx");
3400
3401
  matched.forEach(({ server }, index) => {
3401
3402
  try {
3402
- chunkVKM6VUOZ_cjs.assertAllowedSighashTypes(server);
3403
+ chunk7NK6XFC3_cjs.assertAllowedSighashTypes(server);
3403
3404
  } catch (error) {
3404
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3405
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3405
3406
  `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
3406
3407
  );
3407
3408
  }
@@ -3409,14 +3410,14 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3409
3410
  const verify = options?.verifyServerSignatures;
3410
3411
  if (verify) {
3411
3412
  if (response.finalArkTx === void 0) {
3412
- throw new chunkVKM6VUOZ_cjs.ServerResponseMismatchError(
3413
+ throw new chunk7NK6XFC3_cjs.ServerResponseMismatchError(
3413
3414
  "submitTx: server returned no final ark tx to verify its signatures against"
3414
3415
  );
3415
3416
  }
3416
- const finalArkTx = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3417
+ const finalArkTx = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3417
3418
  const serverPubkeys = new Set(
3418
3419
  [verify.serverPubkey, ...verify.deprecatedServerPubkeys ?? []].map(
3419
- (key) => base.hex.encode(chunk73NPW5LY_cjs.toXOnly(key, "server key"))
3420
+ (key) => base.hex.encode(chunkFDQQOF3F_cjs.toXOnly(key, "server key"))
3420
3421
  )
3421
3422
  );
3422
3423
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
@@ -3468,12 +3469,12 @@ function claimWithPreimageIdentity(identity, preimage) {
3468
3469
  return {
3469
3470
  ...identity,
3470
3471
  sign: async (tx, inputIndexes) => {
3471
- const signed = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(
3472
+ const signed = chunk7NK6XFC3_cjs.Transaction.fromPSBT(
3472
3473
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
3473
3474
  );
3474
3475
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
3475
3476
  for (const index of indexes) {
3476
- chunkVKM6VUOZ_cjs.setArkPsbtField(signed, index, chunkVKM6VUOZ_cjs.ConditionWitness, [preimage]);
3477
+ chunk7NK6XFC3_cjs.setArkPsbtField(signed, index, chunk7NK6XFC3_cjs.ConditionWitness, [preimage]);
3477
3478
  }
3478
3479
  return signed;
3479
3480
  }
@@ -3653,7 +3654,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
3653
3654
  };
3654
3655
  }
3655
3656
  function deriveContractTapscripts(contract) {
3656
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
3657
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
3657
3658
  if (!handler) {
3658
3659
  throw new Error(`No handler for contract type '${contract.type}'`);
3659
3660
  }
@@ -3744,7 +3745,7 @@ function assertRecipientArkadeAddress(encoded, address, context) {
3744
3745
  function assertTapTreeDerivesAddress(encoded, tapTree, address) {
3745
3746
  let derived;
3746
3747
  try {
3747
- derived = chunkVKM6VUOZ_cjs.VtxoScript.decode(tapTree).pkScript;
3748
+ derived = chunk7NK6XFC3_cjs.VtxoScript.decode(tapTree).pkScript;
3748
3749
  } catch (e) {
3749
3750
  throw new Error(
3750
3751
  `Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
@@ -3761,7 +3762,7 @@ function validateRecipients(recipients, dustAmount, context) {
3761
3762
  for (const recipient of recipients) {
3762
3763
  let address;
3763
3764
  try {
3764
- address = chunkVKM6VUOZ_cjs.ArkAddress.decode(recipient.address);
3765
+ address = chunk7NK6XFC3_cjs.ArkAddress.decode(recipient.address);
3765
3766
  } catch (e) {
3766
3767
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
3767
3768
  }
@@ -3786,7 +3787,7 @@ function validateRecipients(recipients, dustAmount, context) {
3786
3787
 
3787
3788
  // src/contracts/spendability.ts
3788
3789
  function isContractGenericallySpendable(contract) {
3789
- return chunk73NPW5LY_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
3790
+ return chunkFDQQOF3F_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
3790
3791
  }
3791
3792
  function gatedContracts(contracts) {
3792
3793
  const gated = /* @__PURE__ */ new Map();
@@ -3808,7 +3809,7 @@ function gateExclusion(gated) {
3808
3809
  return (vtxo) => {
3809
3810
  const type = gatedTypeOf(vtxo, gated);
3810
3811
  if (type === void 0) return void 0;
3811
- if (!chunk73NPW5LY_cjs.contractHandlers.has(type)) {
3812
+ if (!chunkFDQQOF3F_cjs.contractHandlers.has(type)) {
3812
3813
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
3813
3814
  }
3814
3815
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -3844,7 +3845,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
3844
3845
  continue;
3845
3846
  }
3846
3847
  for (const v of vtxos) {
3847
- if (!chunkVKM6VUOZ_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
3848
+ if (!chunk7NK6XFC3_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
3848
3849
  out.add(`${v.txid}:${v.vout}`);
3849
3850
  }
3850
3851
  }
@@ -3879,10 +3880,10 @@ function byValueDescending(vtxos) {
3879
3880
  return [...vtxos].sort((a, b) => b.value - a.value);
3880
3881
  }
3881
3882
  async function fetchTimeHeight(wallet) {
3882
- return chunkVKM6VUOZ_cjs.resolveTimeHeight(wallet.onchainProvider);
3883
+ return chunk7NK6XFC3_cjs.resolveTimeHeight(wallet.onchainProvider);
3883
3884
  }
3884
3885
  function canMigrateBySend(vtxo, now) {
3885
- if (!chunkVKM6VUOZ_cjs.canSpendOffchain(vtxo, now)) return false;
3886
+ if (!chunk7NK6XFC3_cjs.canSpendOffchain(vtxo, now)) return false;
3886
3887
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
3887
3888
  }
3888
3889
  function byExpiryAscending(vtxos, now) {
@@ -3890,7 +3891,7 @@ function byExpiryAscending(vtxos, now) {
3890
3891
  if (vtxo.isSwept) return -Infinity;
3891
3892
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
3892
3893
  if (vtxo.expiresAtHeight !== void 0) {
3893
- return chunkVKM6VUOZ_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
3894
+ return chunk7NK6XFC3_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
3894
3895
  }
3895
3896
  return Infinity;
3896
3897
  };
@@ -3917,7 +3918,7 @@ function priceSettlementInputs(vtxos, estimator) {
3917
3918
  const payable = [];
3918
3919
  const net = /* @__PURE__ */ new Map();
3919
3920
  for (const vtxo of vtxos) {
3920
- const inputFee = estimator.evalOffchainInput(chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(vtxo));
3921
+ const inputFee = estimator.evalOffchainInput(chunk7NK6XFC3_cjs.toOffchainInputFeeParams(vtxo));
3921
3922
  if (inputFee.satoshis >= vtxo.value) {
3922
3923
  continue;
3923
3924
  }
@@ -3943,7 +3944,7 @@ function deductOffchainOutputFee(subtotal, estimator, arkAddress) {
3943
3944
  }
3944
3945
  const outputFee = estimator.evalOffchainOutput({
3945
3946
  amount: subtotal,
3946
- script: base.hex.encode(chunkVKM6VUOZ_cjs.ArkAddress.decode(arkAddress).pkScript)
3947
+ script: base.hex.encode(chunk7NK6XFC3_cjs.ArkAddress.decode(arkAddress).pkScript)
3947
3948
  });
3948
3949
  return subtotal - BigInt(outputFee.satoshis);
3949
3950
  }
@@ -3957,10 +3958,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
3957
3958
  };
3958
3959
  function getRecoverableVtxos(vtxos, dustAmount, now) {
3959
3960
  return vtxos.filter((vtxo) => {
3960
- if (chunkVKM6VUOZ_cjs.canRecoverOnchain(vtxo, now)) {
3961
+ if (chunk7NK6XFC3_cjs.canRecoverOnchain(vtxo, now)) {
3961
3962
  return true;
3962
3963
  }
3963
- if (chunkVKM6VUOZ_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
3964
+ if (chunk7NK6XFC3_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
3964
3965
  return true;
3965
3966
  }
3966
3967
  return false;
@@ -3992,7 +3993,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
3992
3993
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
3993
3994
  if (vtxo.isUnrolled) return false;
3994
3995
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
3995
- const expiresAt = chunkVKM6VUOZ_cjs.normalizeVtxo(vtxo).expiresAt;
3996
+ const expiresAt = chunk7NK6XFC3_cjs.normalizeVtxo(vtxo).expiresAt;
3996
3997
  if (expiresAt === void 0) return false;
3997
3998
  const now = Date.now();
3998
3999
  const batchExpiry = expiresAt.getTime();
@@ -4003,7 +4004,7 @@ function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
4003
4004
  return vtxos.filter(
4004
4005
  // The leading exclusion covers the `isSubdust` arm too, which is a value
4005
4006
  // property and would otherwise re-admit an exited coin on its own.
4006
- (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkVKM6VUOZ_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4007
+ (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunk7NK6XFC3_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4007
4008
  );
4008
4009
  }
4009
4010
  function isMigrationCapable(wallet) {
@@ -4536,11 +4537,11 @@ var VtxoManager = class _VtxoManager {
4536
4537
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
4537
4538
  );
4538
4539
  }
4539
- const tx = new chunkVKM6VUOZ_cjs.Transaction();
4540
+ const tx = new chunk7NK6XFC3_cjs.Transaction();
4540
4541
  for (const utxo of expiredUtxos) {
4541
- const utxoScript = chunkVKM6VUOZ_cjs.VtxoScript.decode(utxo.tapTree);
4542
+ const utxoScript = chunk7NK6XFC3_cjs.VtxoScript.decode(utxo.tapTree);
4542
4543
  const utxoExitLeaf = utxoScript.leaves.find(
4543
- (leaf) => chunkVKM6VUOZ_cjs.CSVMultisigTapscript.isScriptValid(chunkVKM6VUOZ_cjs.scriptFromTapLeafScript(leaf)) === true
4544
+ (leaf) => chunk7NK6XFC3_cjs.CSVMultisigTapscript.isScriptValid(chunk7NK6XFC3_cjs.scriptFromTapLeafScript(leaf)) === true
4544
4545
  );
4545
4546
  if (!utxoExitLeaf) {
4546
4547
  throw new Error(
@@ -4555,7 +4556,7 @@ var VtxoManager = class _VtxoManager {
4555
4556
  amount: BigInt(utxo.value)
4556
4557
  },
4557
4558
  tapLeafScript: [utxoExitLeaf],
4558
- sequence: chunkVKM6VUOZ_cjs.getSequence(utxoExitLeaf)
4559
+ sequence: chunk7NK6XFC3_cjs.getSequence(utxoExitLeaf)
4559
4560
  });
4560
4561
  }
4561
4562
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -4781,8 +4782,8 @@ var VtxoManager = class _VtxoManager {
4781
4782
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
4782
4783
  if (cls.status === "CURRENT") continue;
4783
4784
  const live = vtxos.filter((v) => !v.isUnrolled);
4784
- const recoverable = live.filter((v) => v.isSwept && !chunkVKM6VUOZ_cjs.isVtxoSpent(v));
4785
- const spendable = live.filter((v) => !chunkVKM6VUOZ_cjs.isVtxoSpent(v) && !v.isSwept);
4785
+ const recoverable = live.filter((v) => v.isSwept && !chunk7NK6XFC3_cjs.isVtxoSpent(v));
4786
+ const spendable = live.filter((v) => !chunk7NK6XFC3_cjs.isVtxoSpent(v) && !v.isSwept);
4786
4787
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
4787
4788
  let recoverableCount = 0;
4788
4789
  let recoverableValue = 0;
@@ -5017,7 +5018,7 @@ var VtxoManager = class _VtxoManager {
5017
5018
  }
5018
5019
  getBoardingTimelock() {
5019
5020
  const wallet = this.getSweepWallet();
5020
- const exitScript = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.decode(
5021
+ const exitScript = chunk7NK6XFC3_cjs.CSVMultisigTapscript.decode(
5021
5022
  base.hex.decode(wallet.boardingTapscript.exitScript)
5022
5023
  );
5023
5024
  return exitScript.params.timelock;
@@ -5125,8 +5126,8 @@ var VtxoManager = class _VtxoManager {
5125
5126
  }
5126
5127
  /** The outpoint a `VTXO_ALREADY_SPENT` error carries in `metadata.vtxo_outpoint`, if any. */
5127
5128
  extractSpentOutpoint(error) {
5128
- const ark = chunkVKM6VUOZ_cjs.maybeArkError(error);
5129
- if (!chunkVKM6VUOZ_cjs.isArkError(ark, chunkVKM6VUOZ_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5129
+ const ark = chunk7NK6XFC3_cjs.maybeArkError(error);
5130
+ if (!chunk7NK6XFC3_cjs.isArkError(ark, chunk7NK6XFC3_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5130
5131
  const raw = ark.metadata?.vtxo_outpoint;
5131
5132
  if (typeof raw !== "string") return void 0;
5132
5133
  const [txid, voutStr] = raw.split(":");
@@ -5299,7 +5300,7 @@ var VtxoManager = class _VtxoManager {
5299
5300
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
5300
5301
  break;
5301
5302
  }
5302
- const inputFee = estimator.evalOffchainInput(chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(v));
5303
+ const inputFee = estimator.evalOffchainInput(chunk7NK6XFC3_cjs.toOffchainInputFeeParams(v));
5303
5304
  if (inputFee.satoshis >= v.value) {
5304
5305
  continue;
5305
5306
  }
@@ -5319,7 +5320,7 @@ var VtxoManager = class _VtxoManager {
5319
5320
  const arkAddress = await this.wallet.getAddress();
5320
5321
  const outputFee = estimator.evalOffchainOutput({
5321
5322
  amount: totalAmount,
5322
- script: base.hex.encode(chunkVKM6VUOZ_cjs.ArkAddress.decode(arkAddress).pkScript)
5323
+ script: base.hex.encode(chunk7NK6XFC3_cjs.ArkAddress.decode(arkAddress).pkScript)
5323
5324
  });
5324
5325
  totalAmount -= BigInt(outputFee.satoshis);
5325
5326
  if (totalAmount < dustAmount) return;
@@ -5399,7 +5400,7 @@ var ArkNote = class _ArkNote {
5399
5400
  this.value = value;
5400
5401
  this.HRP = HRP;
5401
5402
  const preimageHash = utils_js.sha256(this.preimage);
5402
- this.vtxoScript = new chunkVKM6VUOZ_cjs.VtxoScript([noteTapscript(preimageHash)]);
5403
+ this.vtxoScript = new chunk7NK6XFC3_cjs.VtxoScript([noteTapscript(preimageHash)]);
5403
5404
  const leaf = this.vtxoScript.leaves[0];
5404
5405
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
5405
5406
  this.tapTree = this.vtxoScript.encode();
@@ -5565,7 +5566,7 @@ var ArkadeCash = class _ArkadeCash {
5565
5566
  const privateKey = data.slice(1, 33);
5566
5567
  const serverPubKey = data.slice(33, 65);
5567
5568
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
5568
- const csvTimelock2 = chunkVKM6VUOZ_cjs.sequenceToTimelock(sequence);
5569
+ const csvTimelock2 = chunk7NK6XFC3_cjs.sequenceToTimelock(sequence);
5569
5570
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock2, decoded.prefix);
5570
5571
  }
5571
5572
  toString() {
@@ -5573,7 +5574,7 @@ var ArkadeCash = class _ArkadeCash {
5573
5574
  data[0] = _ArkadeCash.Version;
5574
5575
  data.set(this._privateKey, 1);
5575
5576
  data.set(this._serverPubKey, 33);
5576
- const sequence = chunkVKM6VUOZ_cjs.timelockToSequence(this.csvTimelock);
5577
+ const sequence = chunk7NK6XFC3_cjs.timelockToSequence(this.csvTimelock);
5577
5578
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
5578
5579
  const words = base.bech32m.toWords(data);
5579
5580
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -5582,7 +5583,7 @@ var ArkadeCash = class _ArkadeCash {
5582
5583
  return SingleKey.fromPrivateKey(this._privateKey);
5583
5584
  }
5584
5585
  get vtxoScript() {
5585
- return new chunk73NPW5LY_cjs.DefaultVtxo.Script({
5586
+ return new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
5586
5587
  pubKey: this._publicKey,
5587
5588
  serverPubKey: this._serverPubKey,
5588
5589
  csvTimelock: this.csvTimelock
@@ -5792,7 +5793,7 @@ async function captureExitBranch(params) {
5792
5793
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
5793
5794
  if (nonCommitment.length > 0) {
5794
5795
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
5795
- psbtByTxid.set(chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5796
+ psbtByTxid.set(chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5796
5797
  }
5797
5798
  }
5798
5799
  }
@@ -5835,10 +5836,10 @@ var IndexerExitDataSource = class {
5835
5836
  while (hasMore) {
5836
5837
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
5837
5838
  { txid: vtxo.txid, vout: vtxo.vout },
5838
- { pageIndex, pageSize: chunkVKM6VUOZ_cjs.DEFAULT_PAGE_SIZE }
5839
+ { pageIndex, pageSize: chunk7NK6XFC3_cjs.DEFAULT_PAGE_SIZE }
5839
5840
  );
5840
5841
  chain.push(...page);
5841
- hasMore = meta ? page.length === chunkVKM6VUOZ_cjs.DEFAULT_PAGE_SIZE : false;
5842
+ hasMore = meta ? page.length === chunk7NK6XFC3_cjs.DEFAULT_PAGE_SIZE : false;
5842
5843
  pageIndex++;
5843
5844
  }
5844
5845
  return chain;
@@ -5850,12 +5851,12 @@ var IndexerExitDataSource = class {
5850
5851
  while (hasMore) {
5851
5852
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
5852
5853
  pageIndex,
5853
- pageSize: chunkVKM6VUOZ_cjs.DEFAULT_PAGE_SIZE
5854
+ pageSize: chunk7NK6XFC3_cjs.DEFAULT_PAGE_SIZE
5854
5855
  });
5855
5856
  for (const psbt of txs) {
5856
- out.set(chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5857
+ out.set(chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
5857
5858
  }
5858
- hasMore = page ? txs.length === chunkVKM6VUOZ_cjs.DEFAULT_PAGE_SIZE : false;
5859
+ hasMore = page ? txs.length === chunk7NK6XFC3_cjs.DEFAULT_PAGE_SIZE : false;
5859
5860
  pageIndex++;
5860
5861
  }
5861
5862
  return out;
@@ -5876,7 +5877,7 @@ function chainedTxTypeToChainTxType(t) {
5876
5877
  }
5877
5878
  }
5878
5879
  function psbtInputTxids(psbtBase64) {
5879
- return txInputTxids(chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
5880
+ return txInputTxids(chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
5880
5881
  }
5881
5882
  function txInputTxids(tx) {
5882
5883
  const ids = [];
@@ -6237,10 +6238,10 @@ async function resolveArkInfo(arkProvider, walletRepository, opts) {
6237
6238
  try {
6238
6239
  info = await arkProvider.getInfo();
6239
6240
  } catch (err) {
6240
- if (opts?.requireLive || !chunkVKM6VUOZ_cjs.isRetryableProviderError(err)) throw err;
6241
+ if (opts?.requireLive || !chunk7NK6XFC3_cjs.isRetryableProviderError(err)) throw err;
6241
6242
  const snapshot = await loadArkInfoSnapshot(walletRepository);
6242
6243
  if (!snapshot) {
6243
- throw new chunkVKM6VUOZ_cjs.ProviderUnavailableError(
6244
+ throw new chunk7NK6XFC3_cjs.ProviderUnavailableError(
6244
6245
  "Arkade server info is unavailable and no cached snapshot exists",
6245
6246
  { cause: err }
6246
6247
  );
@@ -6635,7 +6636,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos, localCreatedAt) {
6635
6636
  return [...txids];
6636
6637
  }
6637
6638
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt, gatedScripts = /* @__PURE__ */ new Map()) {
6638
- const normalized = vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
6639
+ const normalized = vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
6639
6640
  const localCreatedAt = localCreatedAtByTxid(normalized);
6640
6641
  const gatedVtxos = normalized.filter((vtxo) => isGatedVtxo(vtxo, gatedScripts));
6641
6642
  const ownVtxos = normalized.filter((vtxo) => !isGatedVtxo(vtxo, gatedScripts));
@@ -6810,7 +6811,7 @@ var AssetManager = class extends ReadonlyAssetManager {
6810
6811
  withRecoverable: false,
6811
6812
  genericallySpendableOnly: true
6812
6813
  });
6813
- const controlAssetRef = params.controlAssetId ? chunkXDT24LBQ_cjs.AssetRef.fromId(chunkXDT24LBQ_cjs.AssetId.fromString(params.controlAssetId)) : null;
6814
+ const controlAssetRef = params.controlAssetId ? chunkBFQX2KS3_cjs.AssetRef.fromId(chunkBFQX2KS3_cjs.AssetId.fromString(params.controlAssetId)) : null;
6814
6815
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
6815
6816
  let totalBtcSelected = 0n;
6816
6817
  const assetChanges = /* @__PURE__ */ new Map();
@@ -6823,8 +6824,8 @@ var AssetManager = class extends ReadonlyAssetManager {
6823
6824
  }
6824
6825
  }
6825
6826
  const groups = [];
6826
- const issuedAssetOutput = chunkXDT24LBQ_cjs.AssetOutput.create(0, params.amount);
6827
- const issuedAssetGroup = chunkXDT24LBQ_cjs.AssetGroup.create(
6827
+ const issuedAssetOutput = chunkBFQX2KS3_cjs.AssetOutput.create(0, params.amount);
6828
+ const issuedAssetGroup = chunkBFQX2KS3_cjs.AssetGroup.create(
6828
6829
  null,
6829
6830
  controlAssetRef,
6830
6831
  [],
@@ -6837,11 +6838,11 @@ var AssetManager = class extends ReadonlyAssetManager {
6837
6838
  for (const [assetId, amount] of assetChanges) {
6838
6839
  const changeInputs = inputsForAsset(assetInputs, assetId);
6839
6840
  groups.push(
6840
- chunkXDT24LBQ_cjs.AssetGroup.create(
6841
- chunkXDT24LBQ_cjs.AssetId.fromString(assetId),
6841
+ chunkBFQX2KS3_cjs.AssetGroup.create(
6842
+ chunkBFQX2KS3_cjs.AssetId.fromString(assetId),
6842
6843
  null,
6843
6844
  changeInputs,
6844
- [chunkXDT24LBQ_cjs.AssetOutput.create(0, amount)],
6845
+ [chunkBFQX2KS3_cjs.AssetOutput.create(0, amount)],
6845
6846
  []
6846
6847
  )
6847
6848
  );
@@ -6855,7 +6856,7 @@ var AssetManager = class extends ReadonlyAssetManager {
6855
6856
  );
6856
6857
  return {
6857
6858
  arkTxId: arkTxid,
6858
- assetId: chunkXDT24LBQ_cjs.AssetId.create(arkTxid, 0).toString()
6859
+ assetId: chunkBFQX2KS3_cjs.AssetId.create(arkTxid, 0).toString()
6859
6860
  };
6860
6861
  }
6861
6862
  /**
@@ -6926,23 +6927,23 @@ var AssetManager = class extends ReadonlyAssetManager {
6926
6927
  const assetInputs = selectedCoinsToAssetInputs(selectedCoins);
6927
6928
  const reissueInputs = inputsForAsset(assetInputs, params.assetId);
6928
6929
  const totalAssetAmount = assetToReissueAmount + params.amount;
6929
- const reissueAssetIdObj = chunkXDT24LBQ_cjs.AssetId.fromString(params.assetId);
6930
- const reissueAssetGroup = chunkXDT24LBQ_cjs.AssetGroup.create(
6930
+ const reissueAssetIdObj = chunkBFQX2KS3_cjs.AssetId.fromString(params.assetId);
6931
+ const reissueAssetGroup = chunkBFQX2KS3_cjs.AssetGroup.create(
6931
6932
  reissueAssetIdObj,
6932
6933
  null,
6933
6934
  reissueInputs,
6934
- [chunkXDT24LBQ_cjs.AssetOutput.create(0, totalAssetAmount)],
6935
+ [chunkBFQX2KS3_cjs.AssetOutput.create(0, totalAssetAmount)],
6935
6936
  []
6936
6937
  );
6937
6938
  const groups = [reissueAssetGroup];
6938
6939
  for (const [assetId, amount] of assetChanges) {
6939
6940
  const changeInputs = inputsForAsset(assetInputs, assetId);
6940
6941
  groups.push(
6941
- chunkXDT24LBQ_cjs.AssetGroup.create(
6942
- chunkXDT24LBQ_cjs.AssetId.fromString(assetId),
6942
+ chunkBFQX2KS3_cjs.AssetGroup.create(
6943
+ chunkBFQX2KS3_cjs.AssetId.fromString(assetId),
6943
6944
  null,
6944
6945
  changeInputs,
6945
- [chunkXDT24LBQ_cjs.AssetOutput.create(0, amount)],
6946
+ [chunkBFQX2KS3_cjs.AssetOutput.create(0, amount)],
6946
6947
  []
6947
6948
  )
6948
6949
  );
@@ -7010,11 +7011,11 @@ var AssetManager = class extends ReadonlyAssetManager {
7010
7011
  for (const [assetId, amount] of assetChanges) {
7011
7012
  const changeInputs = inputsForAsset(assetInputs, assetId);
7012
7013
  groups.push(
7013
- chunkXDT24LBQ_cjs.AssetGroup.create(
7014
- chunkXDT24LBQ_cjs.AssetId.fromString(assetId),
7014
+ chunkBFQX2KS3_cjs.AssetGroup.create(
7015
+ chunkBFQX2KS3_cjs.AssetId.fromString(assetId),
7015
7016
  null,
7016
7017
  changeInputs,
7017
- amount > 0n ? [chunkXDT24LBQ_cjs.AssetOutput.create(0, amount)] : [],
7018
+ amount > 0n ? [chunkBFQX2KS3_cjs.AssetOutput.create(0, amount)] : [],
7018
7019
  []
7019
7020
  )
7020
7021
  );
@@ -7027,16 +7028,16 @@ function inputsForAsset(assetInputs, assetId) {
7027
7028
  for (const [inputIndex, assets] of assetInputs) {
7028
7029
  for (const asset of assets) {
7029
7030
  if (asset.assetId !== assetId) continue;
7030
- inputs.push(chunkXDT24LBQ_cjs.AssetInput.create(inputIndex, asset.amount));
7031
+ inputs.push(chunkBFQX2KS3_cjs.AssetInput.create(inputIndex, asset.amount));
7031
7032
  }
7032
7033
  }
7033
7034
  return inputs;
7034
7035
  }
7035
7036
  async function submitToSelf(wallet, inputs, amount, groups) {
7036
- const outputAddress = chunkVKM6VUOZ_cjs.ArkAddress.decode(await wallet.getAddress());
7037
+ const outputAddress = chunk7NK6XFC3_cjs.ArkAddress.decode(await wallet.getAddress());
7037
7038
  const outputs = [
7038
7039
  { script: outputAddress.pkScript, amount: BigInt(amount) },
7039
- Extension.create([chunkXDT24LBQ_cjs.Packet.create(groups)]).txOut()
7040
+ Extension.create([chunkBFQX2KS3_cjs.Packet.create(groups)]).txOut()
7040
7041
  ];
7041
7042
  const { arkTxid } = await wallet.buildAndSubmitOffchainTx(inputs, outputs);
7042
7043
  return arkTxid;
@@ -7060,7 +7061,7 @@ function castMetadata(metadata) {
7060
7061
  } else {
7061
7062
  throw new Error("Invalid metadata value type");
7062
7063
  }
7063
- md.push(chunkXDT24LBQ_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7064
+ md.push(chunkBFQX2KS3_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7064
7065
  }
7065
7066
  return md;
7066
7067
  }
@@ -7081,10 +7082,10 @@ var DelegateManagerImpl = class {
7081
7082
  if (vtxos.length === 0) {
7082
7083
  return { delegated: [], failed: [] };
7083
7084
  }
7084
- const destinationScript = chunkVKM6VUOZ_cjs.ArkAddress.decode(destination).pkScript;
7085
+ const destinationScript = chunk7NK6XFC3_cjs.ArkAddress.decode(destination).pkScript;
7085
7086
  const arkInfo = await this.arkInfoProvider.getInfo();
7086
7087
  const delegateInfo = await this.delegateProvider.getDelegateInfo();
7087
- const eligible = vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo).filter(
7088
+ const eligible = vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo).filter(
7088
7089
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
7089
7090
  );
7090
7091
  if (eligible.length === 0) {
@@ -7116,7 +7117,7 @@ var DelegateManagerImpl = class {
7116
7117
  const groupByExpiry = /* @__PURE__ */ new Map();
7117
7118
  let recoverableVtxos = [];
7118
7119
  for (const vtxo of eligible) {
7119
- if (chunkVKM6VUOZ_cjs.canRecoverOnchain(vtxo, now)) {
7120
+ if (chunk7NK6XFC3_cjs.canRecoverOnchain(vtxo, now)) {
7120
7121
  recoverableVtxos.push(vtxo);
7121
7122
  continue;
7122
7123
  }
@@ -7168,7 +7169,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7168
7169
  }
7169
7170
  if (!delegateAt) {
7170
7171
  const now = { timestamp: /* @__PURE__ */ new Date() };
7171
- const expiryTimestamp = vtxos.filter((coin) => !chunkVKM6VUOZ_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
7172
+ const expiryTimestamp = vtxos.filter((coin) => !chunk7NK6XFC3_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
7172
7173
  (min, coin) => Math.min(min, coin.expiresAt.getTime()),
7173
7174
  Number.MAX_SAFE_INTEGER
7174
7175
  );
@@ -7195,7 +7196,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7195
7196
  let amount = 0n;
7196
7197
  for (const coin of vtxos) {
7197
7198
  const inputFee = estimator.evalOffchainInput({
7198
- ...chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(coin),
7199
+ ...chunk7NK6XFC3_cjs.toOffchainInputFeeParams(coin),
7199
7200
  type: "vtxo"
7200
7201
  });
7201
7202
  if (inputFee.satoshis >= coin.value) {
@@ -7209,7 +7210,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7209
7210
  const delegateFee = BigInt(Number(fee));
7210
7211
  if (delegateFee > 0n) {
7211
7212
  outputs.push({
7212
- script: chunkVKM6VUOZ_cjs.ArkAddress.decode(delegateAddress).pkScript,
7213
+ script: chunk7NK6XFC3_cjs.ArkAddress.decode(delegateAddress).pkScript,
7213
7214
  amount: delegateFee
7214
7215
  });
7215
7216
  }
@@ -7242,10 +7243,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7242
7243
  destinationScript
7243
7244
  );
7244
7245
  const forfeitOutputScript = btcSigner.OutScript.encode(
7245
- btcSigner.Address(chunkVKM6VUOZ_cjs.getNetwork(network)).decode(forfeitAddress)
7246
+ btcSigner.Address(chunk7NK6XFC3_cjs.getNetwork(network)).decode(forfeitAddress)
7246
7247
  );
7247
7248
  const forfeits = await Promise.all(
7248
- vtxos.filter((v) => chunkVKM6VUOZ_cjs.requiresForfeit(v)).map(async (coin) => {
7249
+ vtxos.filter((v) => chunk7NK6XFC3_cjs.requiresForfeit(v)).map(async (coin) => {
7249
7250
  const forfeit = await makeDelegateForfeitTx(
7250
7251
  coin,
7251
7252
  dust,
@@ -7270,7 +7271,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
7270
7271
  index: input.vout,
7271
7272
  witnessUtxo: {
7272
7273
  amount: BigInt(input.value),
7273
- script: chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).pkScript
7274
+ script: chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).pkScript
7274
7275
  },
7275
7276
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
7276
7277
  tapLeafScript: [delegateTapLeaf]
@@ -7328,7 +7329,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
7328
7329
  expire_at: 0,
7329
7330
  cosigners_public_keys: cosignerPubKeys
7330
7331
  };
7331
- const proof = chunkVKM6VUOZ_cjs.Intent.create(message, coins, outputs);
7332
+ const proof = chunk7NK6XFC3_cjs.Intent.create(message, coins, outputs);
7332
7333
  const signedProof = await identity.sign(proof);
7333
7334
  return {
7334
7335
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -7354,10 +7355,10 @@ function getDayTimestamp(timestamp) {
7354
7355
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
7355
7356
  if (!vtxo.tapTree) return void 0;
7356
7357
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
7357
- const vtxoScript = chunkVKM6VUOZ_cjs.VtxoScript.decode(vtxo.tapTree);
7358
+ const vtxoScript = chunk7NK6XFC3_cjs.VtxoScript.decode(vtxo.tapTree);
7358
7359
  return vtxoScript.leaves.find((tapLeaf) => {
7359
- const arkTapscript = chunkVKM6VUOZ_cjs.decodeTapscript(chunkVKM6VUOZ_cjs.scriptFromTapLeafScript(tapLeaf));
7360
- if (!chunkVKM6VUOZ_cjs.MultisigTapscript.is(arkTapscript)) return false;
7360
+ const arkTapscript = chunk7NK6XFC3_cjs.decodeTapscript(chunk7NK6XFC3_cjs.scriptFromTapLeafScript(tapLeaf));
7361
+ if (!chunk7NK6XFC3_cjs.MultisigTapscript.is(arkTapscript)) return false;
7361
7362
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
7362
7363
  });
7363
7364
  }
@@ -7645,7 +7646,7 @@ function parseLegacyExpiry(batchExpiry) {
7645
7646
  if (typeof batchExpiry !== "number" || !Number.isFinite(batchExpiry) || batchExpiry <= 0) {
7646
7647
  return {};
7647
7648
  }
7648
- if (batchExpiry >= chunkVKM6VUOZ_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
7649
+ if (batchExpiry >= chunk7NK6XFC3_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
7649
7650
  return { expiresAtHeight: batchExpiry / 1e3 };
7650
7651
  }
7651
7652
  function legacyVtxoFacts(status) {
@@ -7846,7 +7847,7 @@ function initDatabase(db, oldVersion, transaction) {
7846
7847
  }
7847
7848
  }
7848
7849
  }
7849
- var unspentFlag = (vtxo) => chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
7850
+ var unspentFlag = (vtxo) => chunk7NK6XFC3_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
7850
7851
  function initDatabaseWithIntents(db, oldVersion, transaction) {
7851
7852
  initDatabase(db, oldVersion, transaction);
7852
7853
  if (!db.objectStoreNames.contains(STORE_INTENTS)) {
@@ -8221,8 +8222,8 @@ function checkSaveVtxosForScript(backend, key, vtxos) {
8221
8222
  }
8222
8223
  async function getVtxosForContract(repo, contract, options) {
8223
8224
  const vtxos = repo.getVtxosForScriptPage ? await collectScriptVtxos(repo, contract.script, options) : filterVtxosForScript(await collectVtxos(repo, contract.address), contract.script);
8224
- const normalized = vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo);
8225
- return options?.unspentOnly ? normalized.filter((vtxo) => !chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo)) : normalized;
8225
+ const normalized = vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo);
8226
+ return options?.unspentOnly ? normalized.filter((vtxo) => !chunk7NK6XFC3_cjs.isVtxoSpent(vtxo)) : normalized;
8226
8227
  }
8227
8228
  async function hasVtxosForContract(repo, contract) {
8228
8229
  if (repo.getVtxosForScriptPage) {
@@ -8303,7 +8304,7 @@ async function saveVtxosForContract(repo, contract, vtxos) {
8303
8304
 
8304
8305
  // src/repositories/inMemory/walletRepository.ts
8305
8306
  var InMemoryWalletRepository = class {
8306
- version = 1;
8307
+ version = 2;
8307
8308
  vtxosByAddress = /* @__PURE__ */ new Map();
8308
8309
  utxosByAddress = /* @__PURE__ */ new Map();
8309
8310
  txsByAddress = /* @__PURE__ */ new Map();
@@ -8451,7 +8452,7 @@ function decodeArkContract(encoded) {
8451
8452
  }
8452
8453
  function contractFromArkContract(encoded, options = {}) {
8453
8454
  const parsed = decodeArkContract(encoded);
8454
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(parsed.type);
8455
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(parsed.type);
8455
8456
  if (!handler) {
8456
8457
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
8457
8458
  }
@@ -8465,9 +8466,9 @@ function contractFromArkContract(encoded, options = {}) {
8465
8466
  metadata: options.metadata
8466
8467
  };
8467
8468
  }
8468
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkVKM6VUOZ_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8469
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunk7NK6XFC3_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8469
8470
  const parsed = decodeArkContract(encoded);
8470
- const handler = chunk73NPW5LY_cjs.contractHandlers.getOrThrow(parsed.type);
8471
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.getOrThrow(parsed.type);
8471
8472
  const params = parsed.data;
8472
8473
  const vtxoScript = handler.createScript(params);
8473
8474
  return {
@@ -8716,9 +8717,9 @@ var ContractWatcher = class {
8716
8717
  this.connectionState = "connected";
8717
8718
  this.reconnectAttempts = 0;
8718
8719
  this.listenLoop().catch((e) => {
8719
- if (chunkVKM6VUOZ_cjs.isEventSourceError(e)) {
8720
+ if (chunk7NK6XFC3_cjs.isEventSourceError(e)) {
8720
8721
  console.debug("ContractWatcher subscription disconnected; reconnecting");
8721
- } else if (!chunkVKM6VUOZ_cjs.isEventSourceUnavailableError(e)) {
8722
+ } else if (!chunk7NK6XFC3_cjs.isEventSourceUnavailableError(e)) {
8722
8723
  console.error(e);
8723
8724
  }
8724
8725
  this.connectionState = "disconnected";
@@ -8730,7 +8731,7 @@ var ContractWatcher = class {
8730
8731
  this.scheduleReconnect();
8731
8732
  });
8732
8733
  } catch (error) {
8733
- if (!chunkVKM6VUOZ_cjs.isEventSourceUnavailableError(error)) {
8734
+ if (!chunk7NK6XFC3_cjs.isEventSourceUnavailableError(error)) {
8734
8735
  console.error("ContractWatcher connection failed:", error);
8735
8736
  }
8736
8737
  this.connectionState = "disconnected";
@@ -8749,7 +8750,7 @@ var ContractWatcher = class {
8749
8750
  * few seconds. Failsafe polling keeps the watcher correct, just slower.
8750
8751
  */
8751
8752
  reportEventSourceUnavailable(error) {
8752
- if (!chunkVKM6VUOZ_cjs.isEventSourceUnavailableError(error)) return false;
8753
+ if (!chunk7NK6XFC3_cjs.isEventSourceUnavailableError(error)) return false;
8753
8754
  if (!this.eventSourceReported) {
8754
8755
  this.eventSourceReported = true;
8755
8756
  console.warn(
@@ -8812,7 +8813,7 @@ var ContractWatcher = class {
8812
8813
  const now = Date.now();
8813
8814
  let current;
8814
8815
  try {
8815
- current = await chunkVKM6VUOZ_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
8816
+ current = await chunk7NK6XFC3_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
8816
8817
  spendableOnly: true
8817
8818
  });
8818
8819
  } catch (error) {
@@ -9001,14 +9002,14 @@ var ContractWatcher = class {
9001
9002
  const timestamp = Date.now();
9002
9003
  if (update.newVtxos?.length) {
9003
9004
  this.processSubscriptionVtxos(
9004
- update.newVtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo),
9005
+ update.newVtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo),
9005
9006
  "vtxo_received",
9006
9007
  timestamp
9007
9008
  );
9008
9009
  }
9009
9010
  if (update.spentVtxos?.length) {
9010
9011
  this.processSubscriptionVtxos(
9011
- update.spentVtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo),
9012
+ update.spentVtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo),
9012
9013
  "vtxo_spent",
9013
9014
  timestamp
9014
9015
  );
@@ -9033,8 +9034,8 @@ var ContractWatcher = class {
9033
9034
  continue;
9034
9035
  }
9035
9036
  if (target === byWatchedScript && eventType === "vtxo_received") {
9036
- const n = chunkVKM6VUOZ_cjs.normalizeVtxo(vtxo);
9037
- if (chunkVKM6VUOZ_cjs.isVtxoSpent(n) || n.isSwept || chunkVKM6VUOZ_cjs.isPastExpiry(n, now)) continue;
9037
+ const n = chunk7NK6XFC3_cjs.normalizeVtxo(vtxo);
9038
+ if (chunk7NK6XFC3_cjs.isVtxoSpent(n) || n.isSwept || chunk7NK6XFC3_cjs.isPastExpiry(n, now)) continue;
9038
9039
  }
9039
9040
  let bucket = target.get(vtxo.script);
9040
9041
  if (!bucket) {
@@ -9130,7 +9131,7 @@ var NON_TERMINAL_INTENT_STATES = ALL_INTENT_STATES.filter(
9130
9131
  (s) => !isTerminalIntentState(s)
9131
9132
  );
9132
9133
  function isConsumed(vtxo) {
9133
- return vtxo !== void 0 && chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo);
9134
+ return vtxo !== void 0 && chunk7NK6XFC3_cjs.isVtxoSpent(vtxo);
9134
9135
  }
9135
9136
  async function classifyIntent(intent, vtxosByOutpoint, now) {
9136
9137
  if (isTerminalIntentState(intent.state)) return void 0;
@@ -9173,7 +9174,7 @@ async function reconcileIntents(deps) {
9173
9174
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
9174
9175
  if (outpoints.length > 0) {
9175
9176
  try {
9176
- const { vtxos } = await chunkVKM6VUOZ_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9177
+ const { vtxos } = await chunk7NK6XFC3_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
9177
9178
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
9178
9179
  } catch (e) {
9179
9180
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -9230,7 +9231,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9230
9231
  if (!contract) continue;
9231
9232
  try {
9232
9233
  const key = `${contract.type}\0${script}\0${JSON.stringify(contract.params)}`;
9233
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
9234
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
9234
9235
  const hit = memo?.get(script);
9235
9236
  let tapscripts;
9236
9237
  if (hit && hit.key === key && hit.handler === handler) {
@@ -9363,7 +9364,7 @@ var ContractManager = class _ContractManager {
9363
9364
  this.markSyncOnline();
9364
9365
  return void 0;
9365
9366
  } catch (err) {
9366
- if (!chunkVKM6VUOZ_cjs.isRetryableProviderError(err)) throw err;
9367
+ if (!chunk7NK6XFC3_cjs.isRetryableProviderError(err)) throw err;
9367
9368
  this.markSyncDegraded(err);
9368
9369
  return err;
9369
9370
  }
@@ -9383,7 +9384,7 @@ var ContractManager = class _ContractManager {
9383
9384
  try {
9384
9385
  await this.scheduleLookAheadDrain();
9385
9386
  } catch (err) {
9386
- if (!chunkVKM6VUOZ_cjs.isRetryableProviderError(err)) throw err;
9387
+ if (!chunk7NK6XFC3_cjs.isRetryableProviderError(err)) throw err;
9387
9388
  this.lookAheadRefillOwed = true;
9388
9389
  this.markSyncDegraded(err);
9389
9390
  }
@@ -9492,7 +9493,7 @@ var ContractManager = class _ContractManager {
9492
9493
  const from = Math.max(0, watermark - lookAhead.size);
9493
9494
  const to = watermark + lookAhead.size;
9494
9495
  const deps = lookAhead.candidateDeps();
9495
- const handlers = chunk73NPW5LY_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk73NPW5LY_cjs.contractHandlers.get(t)).filter(hasCandidates);
9496
+ const handlers = chunkFDQQOF3F_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkFDQQOF3F_cjs.contractHandlers.get(t)).filter(hasCandidates);
9496
9497
  const band = /* @__PURE__ */ new Map();
9497
9498
  for (let index = from; index <= to; index++) {
9498
9499
  const descriptor = lookAhead.materialize(index);
@@ -9503,7 +9504,7 @@ var ContractManager = class _ContractManager {
9503
9504
  index,
9504
9505
  params: {
9505
9506
  ...candidate,
9506
- ...chunk73NPW5LY_cjs.speculativeReceiveMetadata(descriptor)
9507
+ ...chunkFDQQOF3F_cjs.speculativeReceiveMetadata(descriptor)
9507
9508
  }
9508
9509
  });
9509
9510
  }
@@ -9562,7 +9563,7 @@ var ContractManager = class _ContractManager {
9562
9563
  });
9563
9564
  for (const entry of pending) entry.catchUpPending = false;
9564
9565
  } catch (err) {
9565
- if (!chunkVKM6VUOZ_cjs.isRetryableProviderError(err)) throw err;
9566
+ if (!chunk7NK6XFC3_cjs.isRetryableProviderError(err)) throw err;
9566
9567
  this.markSyncDegraded(err);
9567
9568
  }
9568
9569
  }
@@ -9653,7 +9654,7 @@ var ContractManager = class _ContractManager {
9653
9654
  return result;
9654
9655
  }
9655
9656
  async upsertContractRow(params) {
9656
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(params.type);
9657
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(params.type);
9657
9658
  if (!handler) {
9658
9659
  throw new Error(`No handler registered for contract type '${params.type}'`);
9659
9660
  }
@@ -9721,7 +9722,7 @@ var ContractManager = class _ContractManager {
9721
9722
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
9722
9723
  );
9723
9724
  }
9724
- const registered = chunk73NPW5LY_cjs.contractHandlers.getRegisteredTypes().map((t) => chunk73NPW5LY_cjs.contractHandlers.get(t)).filter(isDiscoverable);
9725
+ const registered = chunkFDQQOF3F_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkFDQQOF3F_cjs.contractHandlers.get(t)).filter(isDiscoverable);
9725
9726
  const discoverables = [
9726
9727
  ...registered.filter((h) => h.type === "boarding"),
9727
9728
  ...registered.filter((h) => h.type !== "boarding")
@@ -9888,7 +9889,7 @@ var ContractManager = class _ContractManager {
9888
9889
  }
9889
9890
  const tapscriptCache = tapscripts ?? /* @__PURE__ */ new Map();
9890
9891
  return vtxos.map(
9891
- (vtxo) => extendVirtualCoinForContract(chunkVKM6VUOZ_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
9892
+ (vtxo) => extendVirtualCoinForContract(chunk7NK6XFC3_cjs.normalizeVtxo(vtxo), byScript, tapscriptCache)
9892
9893
  );
9893
9894
  }
9894
9895
  /** @inheritdoc */
@@ -9933,14 +9934,14 @@ var ContractManager = class _ContractManager {
9933
9934
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
9934
9935
  const asking = vtxos.filter((vtxo) => {
9935
9936
  const contract = byScript.get(vtxo.script);
9936
- return contract !== void 0 && chunk73NPW5LY_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
9937
+ return contract !== void 0 && chunkFDQQOF3F_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
9937
9938
  });
9938
9939
  if (asking.length === 0) return refused;
9939
9940
  const tip = await this.currentChainTip();
9940
9941
  const walletDescriptorValue = await walletDescriptor?.();
9941
9942
  for (const vtxo of asking) {
9942
9943
  const contract = byScript.get(vtxo.script);
9943
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
9944
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
9944
9945
  if (!handler?.assertSpendableNow) continue;
9945
9946
  const context = {
9946
9947
  collaborative: true,
@@ -9950,7 +9951,7 @@ var ContractManager = class _ContractManager {
9950
9951
  walletDescriptor: walletDescriptorValue,
9951
9952
  // `isVirtualCoin` only checks `script`, which every input has; `isCsvSpendable`
9952
9953
  // reads `vtxo.status.block_time` unguarded, so require `status` too.
9953
- vtxo: chunkVKM6VUOZ_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
9954
+ vtxo: chunk7NK6XFC3_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
9954
9955
  };
9955
9956
  try {
9956
9957
  await handler.assertSpendableNow(
@@ -10059,7 +10060,7 @@ var ContractManager = class _ContractManager {
10059
10060
  const { contractScript, collaborative = true, walletDescriptor, vtxo } = options;
10060
10061
  const [contract] = await this.getContracts({ script: contractScript });
10061
10062
  if (!contract) return [];
10062
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
10063
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
10063
10064
  if (!handler) return [];
10064
10065
  const script = handler.createScript(contract.params);
10065
10066
  const tip = await this.currentChainTip();
@@ -10081,7 +10082,7 @@ var ContractManager = class _ContractManager {
10081
10082
  const { contractScript, collaborative = true, walletDescriptor } = options;
10082
10083
  const [contract] = await this.getContracts({ script: contractScript });
10083
10084
  if (!contract) return [];
10084
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
10085
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
10085
10086
  if (!handler) return [];
10086
10087
  const script = handler.createScript(contract.params);
10087
10088
  const context = {
@@ -10127,7 +10128,7 @@ var ContractManager = class _ContractManager {
10127
10128
  }
10128
10129
  async refreshOutpoints(outpoints) {
10129
10130
  if (outpoints.length === 0) return;
10130
- const { vtxos } = await chunkVKM6VUOZ_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10131
+ const { vtxos } = await chunk7NK6XFC3_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10131
10132
  outpoints
10132
10133
  });
10133
10134
  if (vtxos.length === 0) return;
@@ -10219,7 +10220,7 @@ var ContractManager = class _ContractManager {
10219
10220
  break;
10220
10221
  }
10221
10222
  } catch (err) {
10222
- if (!chunkVKM6VUOZ_cjs.isRetryableProviderError(err)) throw err;
10223
+ if (!chunk7NK6XFC3_cjs.isRetryableProviderError(err)) throw err;
10223
10224
  this.markSyncDegraded(err);
10224
10225
  }
10225
10226
  this.emitEvent(event);
@@ -10294,7 +10295,7 @@ var ContractManager = class _ContractManager {
10294
10295
  */
10295
10296
  async reconcilePendingFrontier(contracts) {
10296
10297
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
10297
- const vtxos = await chunkVKM6VUOZ_cjs.getAllNormalizedVtxos(
10298
+ const vtxos = await chunk7NK6XFC3_cjs.getAllNormalizedVtxos(
10298
10299
  this.config.indexerProvider,
10299
10300
  contracts.map((c) => c.script),
10300
10301
  { pendingOnly: true }
@@ -10368,7 +10369,7 @@ var ContractManager = class _ContractManager {
10368
10369
  }
10369
10370
  return result;
10370
10371
  }
10371
- async fetchContractVtxosBulk(contracts, pageSize = chunkVKM6VUOZ_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10372
+ async fetchContractVtxosBulk(contracts, pageSize = chunk7NK6XFC3_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
10372
10373
  if (contracts.length === 0) {
10373
10374
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
10374
10375
  }
@@ -10384,7 +10385,7 @@ var ContractManager = class _ContractManager {
10384
10385
  before: syncWindow.before
10385
10386
  }
10386
10387
  } : {};
10387
- const vtxos = await chunkVKM6VUOZ_cjs.getAllNormalizedVtxos(
10388
+ const vtxos = await chunk7NK6XFC3_cjs.getAllNormalizedVtxos(
10388
10389
  this.config.indexerProvider,
10389
10390
  contracts.map((c) => c.script),
10390
10391
  { ...windowOpts, pageSize }
@@ -10442,7 +10443,7 @@ var ContractManager = class _ContractManager {
10442
10443
 
10443
10444
  // src/repositories/inMemory/contractRepository.ts
10444
10445
  var InMemoryContractRepository = class {
10445
- version = 2;
10446
+ version = 3;
10446
10447
  contractsByScript = /* @__PURE__ */ new Map();
10447
10448
  async clear() {
10448
10449
  this.contractsByScript.clear();
@@ -10468,7 +10469,7 @@ var InMemoryContractRepository = class {
10468
10469
 
10469
10470
  // src/repositories/indexedDB/contractRepository.ts
10470
10471
  var IndexedDBContractRepository = class {
10471
- version = 2;
10472
+ version = 3;
10472
10473
  connection;
10473
10474
  constructor(dbName = DEFAULT_DB_NAME) {
10474
10475
  this.connection = createManagedConnection(dbName, DB_VERSION, initDatabase);
@@ -10619,7 +10620,7 @@ var deserializeTapLeaf = (t) => {
10619
10620
  const s = base.hex.decode(t.s);
10620
10621
  return [cb, s];
10621
10622
  };
10622
- var deserializeVtxo = (o) => chunkVKM6VUOZ_cjs.normalizeVtxo({
10623
+ var deserializeVtxo = (o) => chunk7NK6XFC3_cjs.normalizeVtxo({
10623
10624
  ...o,
10624
10625
  createdAt: new Date(o.createdAt),
10625
10626
  tapTree: base.hex.decode(o.tapTree),
@@ -10638,7 +10639,7 @@ var deserializeUtxo = (o) => ({
10638
10639
 
10639
10640
  // src/repositories/indexedDB/walletRepository.ts
10640
10641
  var IndexedDBWalletRepository = class {
10641
- version = 1;
10642
+ version = 2;
10642
10643
  connection;
10643
10644
  constructor(dbName = DEFAULT_DB_NAME) {
10644
10645
  this.connection = createManagedConnection(dbName, DB_VERSION, initDatabase);
@@ -11038,7 +11039,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11038
11039
  */
11039
11040
  materializeDescriptorAt(index) {
11040
11041
  const descriptor = this.identity.descriptor;
11041
- const network = chunk73NPW5LY_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11042
+ const network = chunkFDQQOF3F_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
11042
11043
  const expansion = descriptorsScure.expand({ descriptor, network, index });
11043
11044
  const keyInfo = expansion.expansionMap?.["@0"];
11044
11045
  if (!keyInfo?.keyExpression) {
@@ -11106,7 +11107,7 @@ function signingDescriptorIndex(descriptor) {
11106
11107
  }
11107
11108
  function newestWalletReceiveContract(contracts, serverPubKeyHex) {
11108
11109
  return contracts.filter(
11109
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunk73NPW5LY_cjs.WALLET_RECEIVE_SOURCE
11110
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkFDQQOF3F_cjs.WALLET_RECEIVE_SOURCE
11110
11111
  ).sort((a, b) => {
11111
11112
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
11112
11113
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -11157,7 +11158,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
11157
11158
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
11158
11159
  if (!provider) return void 0;
11159
11160
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
11160
- const expectedContractType = setup.offchainTapscript instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script ? "delegate" : "default";
11161
+ const expectedContractType = setup.offchainTapscript instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script ? "delegate" : "default";
11161
11162
  const factoryOpts = {
11162
11163
  walletRepository: setup.walletRepository,
11163
11164
  contractRepository: setup.contractRepository,
@@ -11314,7 +11315,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
11314
11315
  };
11315
11316
  function deriveLeafPubkey(descriptor) {
11316
11317
  try {
11317
- return chunk73NPW5LY_cjs.deriveDescriptorLeafPubKey(descriptor);
11318
+ return chunkFDQQOF3F_cjs.deriveDescriptorLeafPubKey(descriptor);
11318
11319
  } catch (e) {
11319
11320
  throw new NonRangeableDescriptorError(
11320
11321
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -11326,7 +11327,7 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11326
11327
  const pubKey = deriveLeafPubkey(descriptor);
11327
11328
  const tapscript = rebuildTapscript(current, pubKey);
11328
11329
  const serverPubKey = tapscript.options.serverPubKey;
11329
- const csvTimelock2 = chunkVKM6VUOZ_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
11330
+ const csvTimelock2 = chunk7NK6XFC3_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
11330
11331
  const base$1 = {
11331
11332
  script: base.hex.encode(tapscript.pkScript),
11332
11333
  address: tapscript.address(hrp, serverPubKey).encode(),
@@ -11334,11 +11335,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11334
11335
  // Read at sign time to route rotated-pubkey inputs through `signWithDescriptor`; without
11335
11336
  // it spends are rejected with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
11336
11337
  metadata: {
11337
- ...tagSource && { source: chunk73NPW5LY_cjs.WALLET_RECEIVE_SOURCE },
11338
+ ...tagSource && { source: chunkFDQQOF3F_cjs.WALLET_RECEIVE_SOURCE },
11338
11339
  signingDescriptor: descriptor
11339
11340
  }
11340
11341
  };
11341
- const params = tapscript instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script ? {
11342
+ const params = tapscript instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script ? {
11342
11343
  ...base$1,
11343
11344
  type: "delegate",
11344
11345
  params: {
@@ -11359,10 +11360,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
11359
11360
  return { tapscript, params };
11360
11361
  }
11361
11362
  function rebuildTapscript(current, pubKey) {
11362
- if (current instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script) {
11363
- return new chunk73NPW5LY_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
11363
+ if (current instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script) {
11364
+ return new chunkFDQQOF3F_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
11364
11365
  }
11365
- return new chunk73NPW5LY_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
11366
+ return new chunkFDQQOF3F_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
11366
11367
  }
11367
11368
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
11368
11369
  const candidates = await collectContracts(contractRepository, {
@@ -11420,7 +11421,7 @@ function computeOffchainBalance(vtxos, caps) {
11420
11421
  }
11421
11422
  };
11422
11423
  for (const vtxo of vtxos) {
11423
- if (chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo)) continue;
11424
+ if (chunk7NK6XFC3_cjs.isVtxoSpent(vtxo)) continue;
11424
11425
  addAssets(owned, vtxo);
11425
11426
  if (vtxo.isUnrolled) {
11426
11427
  unrolled += vtxo.value;
@@ -11430,11 +11431,11 @@ function computeOffchainBalance(vtxos, caps) {
11430
11431
  pendingRecovery += vtxo.value;
11431
11432
  continue;
11432
11433
  }
11433
- if (chunkVKM6VUOZ_cjs.canRecoverOnchain(vtxo, now)) {
11434
+ if (chunk7NK6XFC3_cjs.canRecoverOnchain(vtxo, now)) {
11434
11435
  recoverable += vtxo.value;
11435
11436
  continue;
11436
11437
  }
11437
- if (!chunkVKM6VUOZ_cjs.canSpendOffchain(vtxo, now)) continue;
11438
+ if (!chunk7NK6XFC3_cjs.canSpendOffchain(vtxo, now)) continue;
11438
11439
  if (vtxo.isPreconfirmed) {
11439
11440
  preconfirmed += vtxo.value;
11440
11441
  } else {
@@ -11645,7 +11646,7 @@ function intentProofJobs(coins) {
11645
11646
  if (coins.length === 0) return [];
11646
11647
  const coinJobs = coins.map((coin, i) => ({
11647
11648
  index: i + 1,
11648
- lookupScript: chunkVKM6VUOZ_cjs.VtxoScript.decode(coin.tapTree).pkScript
11649
+ lookupScript: chunk7NK6XFC3_cjs.VtxoScript.decode(coin.tapTree).pkScript
11649
11650
  }));
11650
11651
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
11651
11652
  }
@@ -11671,7 +11672,7 @@ function dedupeTimelocks(timelocks) {
11671
11672
  const seen = /* @__PURE__ */ new Set();
11672
11673
  const deduped = [];
11673
11674
  for (const timelock of timelocks) {
11674
- const sequence = chunkVKM6VUOZ_cjs.timelockToSequence(timelock).toString();
11675
+ const sequence = chunk7NK6XFC3_cjs.timelockToSequence(timelock).toString();
11675
11676
  if (seen.has(sequence)) continue;
11676
11677
  seen.add(sequence);
11677
11678
  deduped.push(timelock);
@@ -11687,7 +11688,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
11687
11688
  if (!newest?.params.pubKey) return baseline;
11688
11689
  try {
11689
11690
  const pubKey = base.hex.decode(newest.params.pubKey);
11690
- return new chunk73NPW5LY_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
11691
+ return new chunkFDQQOF3F_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
11691
11692
  } catch (e) {
11692
11693
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
11693
11694
  return baseline;
@@ -11706,21 +11707,21 @@ function filterSnapshotVtxos(snapshot, filter, pendingSpendOutpoints) {
11706
11707
  if (vtxo.isUnrolled) {
11707
11708
  return !!f.withUnrolled;
11708
11709
  }
11709
- if (chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo)) {
11710
+ if (chunk7NK6XFC3_cjs.isVtxoSpent(vtxo)) {
11710
11711
  return false;
11711
11712
  }
11712
- if (!f.withRecoverable && chunkVKM6VUOZ_cjs.canRecoverOnchain(vtxo, now)) {
11713
+ if (!f.withRecoverable && chunk7NK6XFC3_cjs.canRecoverOnchain(vtxo, now)) {
11713
11714
  return false;
11714
11715
  }
11715
11716
  return true;
11716
11717
  });
11717
11718
  }
11718
11719
  async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
11719
- const candidates = inputs.filter(chunkVKM6VUOZ_cjs.isVirtualCoin).map(chunkVKM6VUOZ_cjs.normalizeVtxo).filter((v) => !v.isSwept);
11720
+ const candidates = inputs.filter(chunk7NK6XFC3_cjs.isVirtualCoin).map(chunk7NK6XFC3_cjs.normalizeVtxo).filter((v) => !v.isSwept);
11720
11721
  if (candidates.length === 0) return inputs;
11721
- const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkVKM6VUOZ_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
11722
+ const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunk7NK6XFC3_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
11722
11723
  const suspects = candidates.filter(
11723
- (v) => chunkVKM6VUOZ_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
11724
+ (v) => chunk7NK6XFC3_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
11724
11725
  );
11725
11726
  if (suspects.length === 0) return inputs;
11726
11727
  let sweptNow;
@@ -11734,12 +11735,12 @@ async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
11734
11735
  );
11735
11736
  } catch (e) {
11736
11737
  const message = "could not confirm the swept state of expired settlement inputs; retry the settlement";
11737
- throw chunkVKM6VUOZ_cjs.isRetryableProviderError(e) ? new chunkVKM6VUOZ_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
11738
+ throw chunk7NK6XFC3_cjs.isRetryableProviderError(e) ? new chunk7NK6XFC3_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
11738
11739
  }
11739
11740
  if (sweptNow.size === 0) return inputs;
11740
11741
  return inputs.map((input) => {
11741
- if (!chunkVKM6VUOZ_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
11742
- return { ...chunkVKM6VUOZ_cjs.normalizeVtxo(input), isSwept: true };
11742
+ if (!chunk7NK6XFC3_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
11743
+ return { ...chunk7NK6XFC3_cjs.normalizeVtxo(input), isSwept: true };
11743
11744
  });
11744
11745
  }
11745
11746
  var PENDING_RECOVERY_REASON = "is past its operator signer's rotation cutoff \u2014 the operator will not co-sign it until it recovers";
@@ -12002,7 +12003,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12002
12003
  async getArkadeReader() {
12003
12004
  const indexer = this.indexerProvider;
12004
12005
  return {
12005
- getVtxos: (opts) => chunkVKM6VUOZ_cjs.getNormalizedVtxos(indexer, opts),
12006
+ getVtxos: (opts) => chunk7NK6XFC3_cjs.getNormalizedVtxos(indexer, opts),
12006
12007
  getVirtualTxs: (txids, opts) => indexer.getVirtualTxs(txids, opts)
12007
12008
  };
12008
12009
  }
@@ -12037,7 +12038,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12037
12038
  }
12038
12039
  /** Shared setup for ReadonlyWallet.create() and Wallet.create(). */
12039
12040
  static async setupWalletConfig(config, pubKey) {
12040
- const arkProvider = config.arkProvider || new chunkVKM6VUOZ_cjs.RestArkProvider();
12041
+ const arkProvider = config.arkProvider || new chunk7NK6XFC3_cjs.RestArkProvider();
12041
12042
  let indexerProvider = config.indexerProvider;
12042
12043
  if (!indexerProvider) {
12043
12044
  const derived = extractArkProviderUrl(arkProvider);
@@ -12046,7 +12047,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12046
12047
  "indexerProvider is required when arkProvider is provided without a discoverable serverUrl"
12047
12048
  );
12048
12049
  }
12049
- indexerProvider = new chunkXDT24LBQ_cjs.RestIndexerProvider(derived ?? chunkVKM6VUOZ_cjs.DEFAULT_ARKADE_SERVER_URL);
12050
+ indexerProvider = new chunkBFQX2KS3_cjs.RestIndexerProvider(derived ?? chunk7NK6XFC3_cjs.DEFAULT_ARKADE_SERVER_URL);
12050
12051
  }
12051
12052
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
12052
12053
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -12055,7 +12056,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12055
12056
  source: serverInfoSource,
12056
12057
  lastOnlineAt: serverInfoLastOnlineAt
12057
12058
  } = await resolveArkInfo(arkProvider, walletRepository);
12058
- const network = chunkVKM6VUOZ_cjs.networkFromArkadeInfo(info);
12059
+ const network = chunk7NK6XFC3_cjs.networkFromArkadeInfo(info);
12059
12060
  if ("descriptor" in config.identity) {
12060
12061
  const descriptor = config.identity.descriptor;
12061
12062
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -12091,18 +12092,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
12091
12092
  }
12092
12093
  }
12093
12094
  const boardingTimelock = config.boardingTimelock ?? toTimelock(info.boardingExitDelay);
12094
- const serverPubKey = chunk73NPW5LY_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
12095
- const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunk73NPW5LY_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12095
+ const serverPubKey = chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
12096
+ const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12096
12097
  const offchainOptions = {
12097
12098
  pubKey,
12098
12099
  serverPubKey,
12099
12100
  csvTimelock: exitTimelock
12100
12101
  };
12101
- const offchainTapscript = !delegatePubKey ? new chunk73NPW5LY_cjs.DefaultVtxo.Script(offchainOptions) : new chunk73NPW5LY_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
12102
- const boardingTapscript = chunk73NPW5LY_cjs.BoardingContractHandler.createScript({
12102
+ const offchainTapscript = !delegatePubKey ? new chunkFDQQOF3F_cjs.DefaultVtxo.Script(offchainOptions) : new chunkFDQQOF3F_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
12103
+ const boardingTapscript = chunkFDQQOF3F_cjs.BoardingContractHandler.createScript({
12103
12104
  pubKey: base.hex.encode(pubKey),
12104
12105
  serverPubKey: base.hex.encode(serverPubKey),
12105
- csvTimelock: chunkVKM6VUOZ_cjs.timelockToSequence(boardingTimelock).toString()
12106
+ csvTimelock: chunk7NK6XFC3_cjs.timelockToSequence(boardingTimelock).toString()
12106
12107
  });
12107
12108
  return {
12108
12109
  arkProvider,
@@ -12240,7 +12241,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12240
12241
  if (!filter?.withUnrolled) {
12241
12242
  logExcludedVtxos(
12242
12243
  "getSpendableVtxos",
12243
- snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo)),
12244
+ snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunk7NK6XFC3_cjs.isVtxoSpent(vtxo)),
12244
12245
  [() => UNROLLED_REASON]
12245
12246
  );
12246
12247
  }
@@ -12378,7 +12379,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12378
12379
  this.getBoardingTxs()
12379
12380
  ]);
12380
12381
  const allVtxos = snapshot.flatMap((_) => _.vtxos);
12381
- const resolveTxCreatedAt = (txids) => chunkVKM6VUOZ_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
12382
+ const resolveTxCreatedAt = (txids) => chunk7NK6XFC3_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
12382
12383
  return buildTransactionHistory(
12383
12384
  allVtxos,
12384
12385
  boardingTxs,
@@ -12513,9 +12514,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
12513
12514
  async getBoardingTapscripts(allowedSigners) {
12514
12515
  const byScript = /* @__PURE__ */ new Map();
12515
12516
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
12516
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunk73NPW5LY_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
12517
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkFDQQOF3F_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
12517
12518
  add(
12518
- new chunk73NPW5LY_cjs.DefaultVtxo.Script({
12519
+ new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
12519
12520
  pubKey: await this.identity.xOnlyPublicKey(),
12520
12521
  serverPubKey: this.boardingTapscript.options.serverPubKey,
12521
12522
  csvTimelock: boardingCsv
@@ -12530,7 +12531,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12530
12531
  for (const c of boardingContracts) {
12531
12532
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
12532
12533
  try {
12533
- add(chunk73NPW5LY_cjs.BoardingContractHandler.createScript(c.params));
12534
+ add(chunkFDQQOF3F_cjs.BoardingContractHandler.createScript(c.params));
12534
12535
  } catch (e) {
12535
12536
  console.warn("Skipping malformed boarding contract", c.script, e);
12536
12537
  }
@@ -12559,7 +12560,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12559
12560
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
12560
12561
  // not the wallet's current boarding timelock, which a signer
12561
12562
  // rotation may have changed.
12562
- csvTimelock: chunkVKM6VUOZ_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
12563
+ csvTimelock: chunk7NK6XFC3_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
12563
12564
  coins: utxos
12564
12565
  };
12565
12566
  })
@@ -12684,7 +12685,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12684
12685
  /** Fetch Arkade transaction ids that are still pending final settlement. */
12685
12686
  async fetchPendingTxs() {
12686
12687
  const scripts = await this.getWalletScripts();
12687
- const vtxos = await chunkVKM6VUOZ_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
12688
+ const vtxos = await chunk7NK6XFC3_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
12688
12689
  return vtxos.filter(
12689
12690
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
12690
12691
  ).map((_) => _.arkTxId);
@@ -12715,7 +12716,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12715
12716
  });
12716
12717
  for (const contract of contracts) {
12717
12718
  if (map.has(contract.script)) continue;
12718
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
12719
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
12719
12720
  if (handler) {
12720
12721
  const script = handler.createScript(contract.params);
12721
12722
  map.set(contract.script, script);
@@ -12820,7 +12821,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12820
12821
  }
12821
12822
  });
12822
12823
  const baselinePubkey = await this.identity.xOnlyPublicKey();
12823
- const delegatePubKey = this.offchainTapscript instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
12824
+ const delegatePubKey = this.offchainTapscript instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
12824
12825
  const baselineSigners = [
12825
12826
  this.offchainTapscript.options.serverPubKey,
12826
12827
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
@@ -12828,8 +12829,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
12828
12829
  const seenBaselineScripts = /* @__PURE__ */ new Set();
12829
12830
  for (const serverPubKey of baselineSigners) {
12830
12831
  for (const csvTimelock2 of this.walletContractTimelocks) {
12831
- const csvTimelockStr = chunkVKM6VUOZ_cjs.timelockToSequence(csvTimelock2).toString();
12832
- const defaultScript = new chunk73NPW5LY_cjs.DefaultVtxo.Script({
12832
+ const csvTimelockStr = chunk7NK6XFC3_cjs.timelockToSequence(csvTimelock2).toString();
12833
+ const defaultScript = new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
12833
12834
  pubKey: baselinePubkey,
12834
12835
  serverPubKey,
12835
12836
  csvTimelock: csvTimelock2
@@ -12850,7 +12851,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12850
12851
  });
12851
12852
  }
12852
12853
  if (delegatePubKey) {
12853
- const delegateScript = new chunk73NPW5LY_cjs.DelegateVtxo.Script({
12854
+ const delegateScript = new chunkFDQQOF3F_cjs.DelegateVtxo.Script({
12854
12855
  pubKey: baselinePubkey,
12855
12856
  serverPubKey,
12856
12857
  delegatePubKey,
@@ -12874,9 +12875,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
12874
12875
  }
12875
12876
  }
12876
12877
  }
12877
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunk73NPW5LY_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
12878
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkFDQQOF3F_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
12878
12879
  for (const serverPubKey of baselineSigners) {
12879
- const baselineBoarding = new chunk73NPW5LY_cjs.DefaultVtxo.Script({
12880
+ const baselineBoarding = new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
12880
12881
  pubKey: baselinePubkey,
12881
12882
  serverPubKey,
12882
12883
  csvTimelock: boardingCsvTimelock
@@ -12889,7 +12890,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12889
12890
  params: {
12890
12891
  pubKey: base.hex.encode(baselineBoarding.options.pubKey),
12891
12892
  serverPubKey: base.hex.encode(serverPubKey),
12892
- csvTimelock: chunkVKM6VUOZ_cjs.timelockToSequence(boardingCsvTimelock).toString()
12893
+ csvTimelock: chunk7NK6XFC3_cjs.timelockToSequence(boardingCsvTimelock).toString()
12893
12894
  },
12894
12895
  script: boardingScriptHex,
12895
12896
  address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
@@ -13037,7 +13038,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13037
13038
  serverPubKey: this.offchainTapscript.options.serverPubKey,
13038
13039
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
13039
13040
  csvTimelocks: this.walletContractTimelocks,
13040
- delegatePubKey: this.offchainTapscript instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
13041
+ delegatePubKey: this.offchainTapscript instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
13041
13042
  };
13042
13043
  }
13043
13044
  _signerRouter;
@@ -13197,7 +13198,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13197
13198
  const [row] = await manager.getContracts({ script: base.hex.encode(display.pkScript) });
13198
13199
  const persisted = row?.metadata?.signingDescriptor;
13199
13200
  if (typeof persisted === "string") return persisted;
13200
- return chunk73NPW5LY_cjs.identityDescriptor(this.identity);
13201
+ return chunkFDQQOF3F_cjs.identityDescriptor(this.identity);
13201
13202
  }
13202
13203
  /**
13203
13204
  * Build, persist and shape one address of `type` owned by `descriptor`. The descriptor is the
@@ -13207,7 +13208,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13207
13208
  async mintAddress(manager, type, descriptor, tagSource, allocated) {
13208
13209
  if (type === "boarding") {
13209
13210
  const built2 = this.buildBoardingContract(
13210
- chunk73NPW5LY_cjs.deriveDescriptorLeafPubKey(descriptor),
13211
+ chunkFDQQOF3F_cjs.deriveDescriptorLeafPubKey(descriptor),
13211
13212
  descriptor,
13212
13213
  tagSource
13213
13214
  );
@@ -13244,11 +13245,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13244
13245
  * (offchain analogue: {@link buildReceiveContract}).
13245
13246
  */
13246
13247
  buildBoardingContract(pubKey, descriptor, tagSource) {
13247
- const tapscript = new chunk73NPW5LY_cjs.DefaultVtxo.Script({
13248
+ const tapscript = new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
13248
13249
  ...this._boardingTapscript.options,
13249
13250
  pubKey
13250
13251
  });
13251
- const csvTimelock2 = tapscript.options.csvTimelock ?? chunk73NPW5LY_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13252
+ const csvTimelock2 = tapscript.options.csvTimelock ?? chunkFDQQOF3F_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13252
13253
  return {
13253
13254
  tapscript,
13254
13255
  params: {
@@ -13256,13 +13257,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13256
13257
  params: {
13257
13258
  pubKey: base.hex.encode(pubKey),
13258
13259
  serverPubKey: base.hex.encode(tapscript.options.serverPubKey),
13259
- csvTimelock: chunkVKM6VUOZ_cjs.timelockToSequence(csvTimelock2).toString()
13260
+ csvTimelock: chunk7NK6XFC3_cjs.timelockToSequence(csvTimelock2).toString()
13260
13261
  },
13261
13262
  script: base.hex.encode(tapscript.pkScript),
13262
13263
  address: tapscript.address(this.network.hrp, this.arkServerPublicKey).encode(),
13263
13264
  state: "active",
13264
13265
  metadata: {
13265
- ...tagSource && { source: chunk73NPW5LY_cjs.WALLET_RECEIVE_SOURCE },
13266
+ ...tagSource && { source: chunkFDQQOF3F_cjs.WALLET_RECEIVE_SOURCE },
13266
13267
  signingDescriptor: descriptor
13267
13268
  }
13268
13269
  }
@@ -13286,7 +13287,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13286
13287
  if (this._descriptorProvider instanceof HDDescriptorProvider) {
13287
13288
  return (await this.getContractManager()).getNextSigningDescriptor();
13288
13289
  }
13289
- return chunk73NPW5LY_cjs.identityDescriptor(this.identity);
13290
+ return chunkFDQQOF3F_cjs.identityDescriptor(this.identity);
13290
13291
  }
13291
13292
  /**
13292
13293
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -13361,7 +13362,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13361
13362
  * the stable public API.
13362
13363
  */
13363
13364
  async rotateServerSigner(newServerPubKey, checkpointTapscript) {
13364
- const xonly = chunk73NPW5LY_cjs.toXOnly(newServerPubKey, "ark signer key");
13365
+ const xonly = chunkFDQQOF3F_cjs.toXOnly(newServerPubKey, "ark signer key");
13365
13366
  const newServerUnrollScript = assertValidServerUnrollScript(
13366
13367
  checkpointTapscript,
13367
13368
  resolveCheckpointExitDelayPolicy(this.network, this.checkpointExitDelayPolicy)
@@ -13390,21 +13391,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13390
13391
  const [currentBoardingRow] = await manager.getContracts({
13391
13392
  script: currentBoardingScript
13392
13393
  });
13393
- const newOffchain = this.offchainTapscript instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script ? new chunk73NPW5LY_cjs.DelegateVtxo.Script({
13394
+ const newOffchain = this.offchainTapscript instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script ? new chunkFDQQOF3F_cjs.DelegateVtxo.Script({
13394
13395
  ...this.offchainTapscript.options,
13395
13396
  serverPubKey: xonly
13396
- }) : new chunk73NPW5LY_cjs.DefaultVtxo.Script({
13397
+ }) : new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
13397
13398
  ...this.offchainTapscript.options,
13398
13399
  serverPubKey: xonly
13399
13400
  });
13400
- const newBoarding = new chunk73NPW5LY_cjs.DefaultVtxo.Script({
13401
+ const newBoarding = new chunkFDQQOF3F_cjs.DefaultVtxo.Script({
13401
13402
  ...this._boardingTapscript.options,
13402
13403
  serverPubKey: xonly
13403
13404
  });
13404
- const offchainCsv = chunkVKM6VUOZ_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
13405
+ const offchainCsv = chunk7NK6XFC3_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
13405
13406
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
13406
13407
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
13407
- if (newOffchain instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script) {
13408
+ if (newOffchain instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script) {
13408
13409
  await manager.createContract({
13409
13410
  type: "delegate",
13410
13411
  params: {
@@ -13432,13 +13433,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13432
13433
  metadata: currentOffchainRow?.metadata
13433
13434
  });
13434
13435
  }
13435
- const boardingCsv = newBoarding.options.csvTimelock ?? chunk73NPW5LY_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13436
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkFDQQOF3F_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13436
13437
  await manager.createContract({
13437
13438
  type: "boarding",
13438
13439
  params: {
13439
13440
  pubKey: base.hex.encode(newBoarding.options.pubKey),
13440
13441
  serverPubKey: base.hex.encode(xonly),
13441
- csvTimelock: chunkVKM6VUOZ_cjs.timelockToSequence(boardingCsv).toString()
13442
+ csvTimelock: chunk7NK6XFC3_cjs.timelockToSequence(boardingCsv).toString()
13442
13443
  },
13443
13444
  script: base.hex.encode(newBoarding.pkScript),
13444
13445
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -13464,14 +13465,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13464
13465
  _restoreInFlight;
13465
13466
  _addPendingSpends(inputs) {
13466
13467
  for (const input of inputs) {
13467
- if (chunkVKM6VUOZ_cjs.isVirtualCoin(input)) {
13468
+ if (chunk7NK6XFC3_cjs.isVirtualCoin(input)) {
13468
13469
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
13469
13470
  }
13470
13471
  }
13471
13472
  }
13472
13473
  _removePendingSpends(inputs) {
13473
13474
  for (const input of inputs) {
13474
- if (chunkVKM6VUOZ_cjs.isVirtualCoin(input)) {
13475
+ if (chunk7NK6XFC3_cjs.isVirtualCoin(input)) {
13475
13476
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
13476
13477
  }
13477
13478
  }
@@ -13522,13 +13523,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13522
13523
  const manager = await this.getContractManager();
13523
13524
  const provider = this._descriptorProvider;
13524
13525
  const hd = provider instanceof HDDescriptorProvider;
13525
- const staticDescriptor = hd ? void 0 : await chunk73NPW5LY_cjs.identityDescriptor(this.identity);
13526
+ const staticDescriptor = hd ? void 0 : await chunkFDQQOF3F_cjs.identityDescriptor(this.identity);
13526
13527
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
13527
- const delegatePubKey = this.offchainTapscript instanceof chunk73NPW5LY_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13528
+ const delegatePubKey = this.offchainTapscript instanceof chunkFDQQOF3F_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
13528
13529
  const arkInfo = await this.arkProvider.getInfo();
13529
- const currentSignerPubKey = chunk73NPW5LY_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
13530
+ const currentSignerPubKey = chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
13530
13531
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
13531
- (s) => chunk73NPW5LY_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
13532
+ (s) => chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
13532
13533
  );
13533
13534
  const deps = {
13534
13535
  indexerProvider: this.indexerProvider,
@@ -13540,7 +13541,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13540
13541
  deprecatedSignerPubKeys,
13541
13542
  csvTimelocks: this.walletContractTimelocks,
13542
13543
  // Boarding-exit CSV, distinct from the unilateral-exit matrix.
13543
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunk73NPW5LY_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
13544
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkFDQQOF3F_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
13544
13545
  delegatePubKey
13545
13546
  };
13546
13547
  const result = await manager.scanContracts({
@@ -13663,7 +13664,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13663
13664
  throw new Error("Invalid configured public key");
13664
13665
  }
13665
13666
  const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
13666
- const forfeitPubkey = chunk73NPW5LY_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
13667
+ const forfeitPubkey = chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
13667
13668
  const forfeitAddress = btcSigner.Address(setup.network).decode(setup.info.forfeitAddress);
13668
13669
  const forfeitOutputScript = btcSigner.OutScript.encode(forfeitAddress);
13669
13670
  const checkpointExitDelayOverrides = {
@@ -13807,13 +13808,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13807
13808
  void this.logUngatedInputs("settle({ inputs })", params.inputs);
13808
13809
  }
13809
13810
  const offchainAddress = await this.getAddress();
13810
- const offchainPkScript = chunkVKM6VUOZ_cjs.ArkAddress.decode(offchainAddress).pkScript;
13811
+ const offchainPkScript = chunk7NK6XFC3_cjs.ArkAddress.decode(offchainAddress).pkScript;
13811
13812
  const offchainOutputScript = base.hex.encode(offchainPkScript);
13812
13813
  if (!params) {
13813
13814
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
13814
13815
  const estimator = new Estimator(fees.intentFee);
13815
13816
  let amount = 0;
13816
- const exitScript = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.decode(
13817
+ const exitScript = chunk7NK6XFC3_cjs.CSVMultisigTapscript.decode(
13817
13818
  base.hex.decode(this.boardingTapscript.exitScript)
13818
13819
  );
13819
13820
  const boardingTimelock = exitScript.params.timelock;
@@ -13845,7 +13846,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13845
13846
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
13846
13847
  break;
13847
13848
  }
13848
- const inputFee = estimator.evalOffchainInput(chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(vtxo));
13849
+ const inputFee = estimator.evalOffchainInput(chunk7NK6XFC3_cjs.toOffchainInputFeeParams(vtxo));
13849
13850
  if (inputFee.satoshis >= vtxo.value) {
13850
13851
  continue;
13851
13852
  }
@@ -13896,7 +13897,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13896
13897
  let script;
13897
13898
  let arkAddress;
13898
13899
  try {
13899
- arkAddress = chunkVKM6VUOZ_cjs.ArkAddress.decode(output.address);
13900
+ arkAddress = chunk7NK6XFC3_cjs.ArkAddress.decode(output.address);
13900
13901
  } catch {
13901
13902
  arkAddress = void 0;
13902
13903
  }
@@ -13986,7 +13987,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13986
13987
  const abortController = new AbortController();
13987
13988
  let stream;
13988
13989
  let committedTxid;
13989
- const settleInputVtxos = params.inputs.filter(chunkVKM6VUOZ_cjs.isVirtualCoin);
13990
+ const settleInputVtxos = params.inputs.filter(chunk7NK6XFC3_cjs.isVirtualCoin);
13990
13991
  const contractManager = await this.getContractManager();
13991
13992
  await contractManager.assertAnnotatable(settleInputVtxos);
13992
13993
  await contractManager.assertSpendableNow?.(
@@ -14078,7 +14079,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14078
14079
  async maybeRotateBoardingAfterBoard(inputs) {
14079
14080
  if (!this._descriptorProvider) return;
14080
14081
  const consumedBoarding = inputs.some(
14081
- (input) => typeof input !== "string" && !chunkVKM6VUOZ_cjs.isVirtualCoin(input)
14082
+ (input) => typeof input !== "string" && !chunk7NK6XFC3_cjs.isVirtualCoin(input)
14082
14083
  );
14083
14084
  if (!consumedBoarding) return;
14084
14085
  try {
@@ -14102,7 +14103,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14102
14103
  let connectorIndex = 0;
14103
14104
  const connectorsLeaves = connectorsGraph?.leaves() || [];
14104
14105
  for (const input of inputs) {
14105
- if (!chunkVKM6VUOZ_cjs.isVirtualCoin(input)) {
14106
+ if (!chunk7NK6XFC3_cjs.isVirtualCoin(input)) {
14106
14107
  let matched = false;
14107
14108
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
14108
14109
  const settlementInput = settlementPsbt.getInput(i);
@@ -14140,7 +14141,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14140
14141
  }
14141
14142
  continue;
14142
14143
  }
14143
- if (!chunkVKM6VUOZ_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
14144
+ if (!chunk7NK6XFC3_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
14144
14145
  continue;
14145
14146
  }
14146
14147
  if (connectorsLeaves.length === 0) {
@@ -14168,7 +14169,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14168
14169
  index: input.vout,
14169
14170
  witnessUtxo: {
14170
14171
  amount: BigInt(input.value),
14171
- script: chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).pkScript
14172
+ script: chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).pkScript
14172
14173
  },
14173
14174
  sighashType: btcSigner.SigHash.DEFAULT,
14174
14175
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -14187,7 +14188,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14187
14188
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
14188
14189
  {
14189
14190
  index: 0,
14190
- lookupScript: chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).pkScript
14191
+ lookupScript: chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).pkScript
14191
14192
  }
14192
14193
  ]);
14193
14194
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -14245,7 +14246,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14245
14246
  resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
14246
14247
  );
14247
14248
  await this.arkProvider.confirmRegistration(intentId);
14248
- const sweepTapscript = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.encode({
14249
+ const sweepTapscript = chunk7NK6XFC3_cjs.CSVMultisigTapscript.encode({
14249
14250
  timelock,
14250
14251
  pubkeys: [this.forfeitPubkey]
14251
14252
  }).script;
@@ -14260,10 +14261,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14260
14261
  throw new Error("Sweep tap tree root not set");
14261
14262
  }
14262
14263
  const xOnlyPublicKeys = event.cosignersPublicKeys.map(
14263
- (k) => base.hex.encode(chunk73NPW5LY_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
14264
+ (k) => base.hex.encode(chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
14264
14265
  );
14265
14266
  const signerPublicKey = await session.getPublicKey();
14266
- const xonlySignerPublicKey = chunk73NPW5LY_cjs.toXOnly(signerPublicKey, "signer key");
14267
+ const xonlySignerPublicKey = chunkFDQQOF3F_cjs.toXOnly(signerPublicKey, "signer key");
14267
14268
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
14268
14269
  return { skip: true };
14269
14270
  }
@@ -14349,9 +14350,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14349
14350
  ...existing ?? {},
14350
14351
  intentTxId,
14351
14352
  registerProof: intent.proof,
14352
- registerProofMessage: chunkVKM6VUOZ_cjs.Intent.encodeMessage(intent.message),
14353
+ registerProofMessage: chunk7NK6XFC3_cjs.Intent.encodeMessage(intent.message),
14353
14354
  deleteProof: deleteIntent.proof,
14354
- deleteProofMessage: chunkVKM6VUOZ_cjs.Intent.encodeMessage(deleteIntent.message),
14355
+ deleteProofMessage: chunk7NK6XFC3_cjs.Intent.encodeMessage(deleteIntent.message),
14355
14356
  intentVtxos: inputs.map((i) => ({
14356
14357
  txid: i.txid,
14357
14358
  vout: i.vout
@@ -14384,7 +14385,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14384
14385
  try {
14385
14386
  return await this.arkProvider.registerIntent(intent);
14386
14387
  } catch (error) {
14387
- if (error instanceof chunkVKM6VUOZ_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
14388
+ if (error instanceof chunk7NK6XFC3_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
14388
14389
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
14389
14390
  await this.arkProvider.deleteIntent(deleteIntent);
14390
14391
  return this.arkProvider.registerIntent(intent);
@@ -14400,7 +14401,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14400
14401
  expire_at: 0,
14401
14402
  cosigners_public_keys: cosignerPubKeys
14402
14403
  };
14403
- const proof = chunkVKM6VUOZ_cjs.Intent.create(message, coins, outputs);
14404
+ const proof = chunk7NK6XFC3_cjs.Intent.create(message, coins, outputs);
14404
14405
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
14405
14406
  return {
14406
14407
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -14412,7 +14413,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14412
14413
  type: "delete",
14413
14414
  expire_at: 0
14414
14415
  };
14415
- const proof = chunkVKM6VUOZ_cjs.Intent.create(message, coins, []);
14416
+ const proof = chunk7NK6XFC3_cjs.Intent.create(message, coins, []);
14416
14417
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
14417
14418
  return {
14418
14419
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -14424,7 +14425,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14424
14425
  type: "get-pending-tx",
14425
14426
  expire_at: 0
14426
14427
  };
14427
- const proof = chunkVKM6VUOZ_cjs.Intent.create(message, coins, []);
14428
+ const proof = chunk7NK6XFC3_cjs.Intent.create(message, coins, []);
14428
14429
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
14429
14430
  return {
14430
14431
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -14445,7 +14446,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14445
14446
  if (!vtxos || vtxos.length === 0) {
14446
14447
  const scriptMap = await this.getScriptMap();
14447
14448
  const allExtended = [];
14448
- const fetchedVtxos = await chunkVKM6VUOZ_cjs.getAllNormalizedVtxos(this.indexerProvider, [
14449
+ const fetchedVtxos = await chunk7NK6XFC3_cjs.getAllNormalizedVtxos(this.indexerProvider, [
14449
14450
  ...scriptMap.keys()
14450
14451
  ]);
14451
14452
  for (const vtxo of fetchedVtxos) {
@@ -14489,7 +14490,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14489
14490
  try {
14490
14491
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((c) => {
14491
14492
  const tx = btcSigner.Transaction.fromPSBT(base.base64.decode(c));
14492
- chunkVKM6VUOZ_cjs.assertAllowedSighashTypes(tx);
14493
+ chunk7NK6XFC3_cjs.assertAllowedSighashTypes(tx);
14493
14494
  return tx;
14494
14495
  });
14495
14496
  assertCheckpointsMatchInputs(
@@ -14558,11 +14559,11 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14558
14559
  * and one per deprecated signer — else a pre-rotation tx would stay pending forever.
14559
14560
  */
14560
14561
  checkpointUnrollCandidates(info) {
14561
- const current = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
14562
+ const current = chunk7NK6XFC3_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
14562
14563
  const candidates = [this._serverUnrollScript, current];
14563
14564
  for (const deprecated of signerSetFromInfo(info).deprecated.keys()) {
14564
14565
  candidates.push(
14565
- chunkVKM6VUOZ_cjs.CSVMultisigTapscript.encode({
14566
+ chunk7NK6XFC3_cjs.CSVMultisigTapscript.encode({
14566
14567
  ...current.params,
14567
14568
  pubkeys: [base.hex.decode(deprecated)]
14568
14569
  })
@@ -14638,7 +14639,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14638
14639
  if (vtxos.length === 0) {
14639
14640
  throw new Error("No VTXOs found for this arkadeCash");
14640
14641
  }
14641
- const myPkScript = chunkVKM6VUOZ_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
14642
+ const myPkScript = chunk7NK6XFC3_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
14642
14643
  let { spendable, unclaimed } = this.classifyCashVtxos(vtxos);
14643
14644
  let swept = 0;
14644
14645
  const drainable = vtxos.filter(
@@ -14714,7 +14715,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14714
14715
  const spendable = [];
14715
14716
  const unclaimed = [];
14716
14717
  for (const vtxo of vtxos) {
14717
- if (chunkVKM6VUOZ_cjs.isVtxoSpent(vtxo)) {
14718
+ if (chunk7NK6XFC3_cjs.isVtxoSpent(vtxo)) {
14718
14719
  unclaimed.push(cashReport(vtxo, "already-spent"));
14719
14720
  } else if (vtxo.isUnrolled) {
14720
14721
  unclaimed.push(cashReport(vtxo, "exited"));
@@ -14736,7 +14737,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14736
14737
  const all = [];
14737
14738
  const seen = /* @__PURE__ */ new Set();
14738
14739
  for (let pageIndex = 0; ; pageIndex++) {
14739
- const { vtxos, page } = await chunkVKM6VUOZ_cjs.getNormalizedVtxos(this.indexerProvider, {
14740
+ const { vtxos, page } = await chunk7NK6XFC3_cjs.getNormalizedVtxos(this.indexerProvider, {
14740
14741
  scripts,
14741
14742
  pageIndex,
14742
14743
  pageSize
@@ -14774,7 +14775,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14774
14775
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
14775
14776
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
14776
14777
  const message = { type: "get-pending-tx", expire_at: 0 };
14777
- const proof = chunkVKM6VUOZ_cjs.Intent.create(message, batch, []);
14778
+ const proof = chunk7NK6XFC3_cjs.Intent.create(message, batch, []);
14778
14779
  const signedProof = await identity.sign(
14779
14780
  proof,
14780
14781
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -14796,7 +14797,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14796
14797
  try {
14797
14798
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((checkpoint) => {
14798
14799
  const tx = btcSigner.Transaction.fromPSBT(base.base64.decode(checkpoint));
14799
- chunkVKM6VUOZ_cjs.assertAllowedSighashTypes(tx);
14800
+ chunk7NK6XFC3_cjs.assertAllowedSighashTypes(tx);
14800
14801
  return tx;
14801
14802
  });
14802
14803
  assertCheckpointsMatchInputs(
@@ -15007,7 +15008,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15007
15008
  script: recipient.script,
15008
15009
  amount: BigInt(recipient.amount),
15009
15010
  // Already checked against the recipient address in `validateRecipients`.
15010
- ...recipient.tapTree ? { tapTree: chunkVKM6VUOZ_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
15011
+ ...recipient.tapTree ? { tapTree: chunk7NK6XFC3_cjs.TapTreeCoder.decode(recipient.tapTree) } : {}
15011
15012
  }));
15012
15013
  const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
15013
15014
  let changeAmount = totalBtcSelected - totalBtcOutput;
@@ -15178,10 +15179,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15178
15179
  const serverPubKey = this.arkServerPublicKey;
15179
15180
  const serverUnrollScript = this.serverUnrollScript;
15180
15181
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
15181
- const normalizedInputs = inputs.map(chunkVKM6VUOZ_cjs.normalizeVtxo);
15182
- const at = now ?? await chunkVKM6VUOZ_cjs.resolveTimeHeight(this.onchainProvider);
15182
+ const normalizedInputs = inputs.map(chunk7NK6XFC3_cjs.normalizeVtxo);
15183
+ const at = now ?? await chunk7NK6XFC3_cjs.resolveTimeHeight(this.onchainProvider);
15183
15184
  for (const input of normalizedInputs) {
15184
- if (!chunkVKM6VUOZ_cjs.canSpendOffchain(input, at)) {
15185
+ if (!chunk7NK6XFC3_cjs.canSpendOffchain(input, at)) {
15185
15186
  throw new Error(
15186
15187
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
15187
15188
  );
@@ -15251,7 +15252,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15251
15252
  );
15252
15253
  const arkTxJobs = inputs.map((input, index) => ({
15253
15254
  index,
15254
- lookupScript: chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).pkScript
15255
+ lookupScript: chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).pkScript
15255
15256
  }));
15256
15257
  const identity = this.identity;
15257
15258
  const signer = {
@@ -15446,12 +15447,12 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15446
15447
  const spentVtxos = [];
15447
15448
  const inputArkTxIds = /* @__PURE__ */ new Set();
15448
15449
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
15449
- const vtxoInputs = inputs.filter(chunkVKM6VUOZ_cjs.isVirtualCoin);
15450
+ const vtxoInputs = inputs.filter(chunk7NK6XFC3_cjs.isVirtualCoin);
15450
15451
  const cm = await this.getContractManager();
15451
15452
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
15452
15453
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
15453
15454
  for (const input of inputs) {
15454
- if (chunkVKM6VUOZ_cjs.isVirtualCoin(input)) {
15455
+ if (chunk7NK6XFC3_cjs.isVirtualCoin(input)) {
15455
15456
  const outpoint = `${input.txid}:${input.vout}`;
15456
15457
  const vtxo = annotatedByKey.get(outpoint);
15457
15458
  if (!vtxo) {
@@ -15468,7 +15469,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15468
15469
  } else {
15469
15470
  let sourceAddress;
15470
15471
  try {
15471
- sourceAddress = chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
15472
+ sourceAddress = chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
15472
15473
  this.network
15473
15474
  );
15474
15475
  } catch {
@@ -15526,7 +15527,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15526
15527
  }
15527
15528
  };
15528
15529
  function selectVirtualCoins(coins, targetAmount) {
15529
- const sortedCoins = coins.map(chunkVKM6VUOZ_cjs.normalizeVtxo).sort((a, b) => {
15530
+ const sortedCoins = coins.map(chunk7NK6XFC3_cjs.normalizeVtxo).sort((a, b) => {
15530
15531
  const expiryA = a.expiresAt?.getTime() || Number.MAX_SAFE_INTEGER;
15531
15532
  const expiryB = b.expiresAt?.getTime() || Number.MAX_SAFE_INTEGER;
15532
15533
  if (expiryA !== expiryB) {
@@ -15897,14 +15898,14 @@ var MessageBus = class {
15897
15898
  this.initialized = true;
15898
15899
  }
15899
15900
  async buildServices(config) {
15900
- const arkProvider = new chunkVKM6VUOZ_cjs.RestArkProvider(config.arkServer.url);
15901
+ const arkProvider = new chunk7NK6XFC3_cjs.RestArkProvider(config.arkServer.url);
15901
15902
  const storage = {
15902
15903
  walletRepository: this.walletRepository,
15903
15904
  contractRepository: this.contractRepository,
15904
15905
  ...this.intentRepository && { intentRepository: this.intentRepository }
15905
15906
  };
15906
15907
  const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : void 0;
15907
- const indexerProvider = new chunkXDT24LBQ_cjs.RestIndexerProvider(config.arkServer.url);
15908
+ const indexerProvider = new chunkBFQX2KS3_cjs.RestIndexerProvider(config.arkServer.url);
15908
15909
  const serialized = normalizeSerializedIdentity(config.wallet);
15909
15910
  if (isSigningSerialized(serialized)) {
15910
15911
  const identity2 = hydrateIdentity(serialized);
@@ -16242,7 +16243,7 @@ var offboardNetworkNames = [
16242
16243
  function offboardDestinationScript(destinationAddress) {
16243
16244
  for (const networkName of offboardNetworkNames) {
16244
16245
  try {
16245
- const network = chunkVKM6VUOZ_cjs.networks[networkName];
16246
+ const network = chunk7NK6XFC3_cjs.networks[networkName];
16246
16247
  const addr = btcSigner.Address(network).decode(destinationAddress);
16247
16248
  return btcSigner.OutScript.encode(addr);
16248
16249
  } catch {
@@ -16278,7 +16279,7 @@ function filterOffboardInputs(vtxos, feeInfo, named) {
16278
16279
  const inputs = [];
16279
16280
  let subtotal = 0n;
16280
16281
  for (const vtxo of vtxos) {
16281
- const inputFee = estimator.evalOffchainInput(chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(vtxo));
16282
+ const inputFee = estimator.evalOffchainInput(chunk7NK6XFC3_cjs.toOffchainInputFeeParams(vtxo));
16282
16283
  if (inputFee.satoshis >= vtxo.value) {
16283
16284
  if (named) {
16284
16285
  throw new Error(
@@ -16375,7 +16376,7 @@ var Ramps = class {
16375
16376
  }
16376
16377
  amount = amount ?? totalAmount;
16377
16378
  const offchainAddress = await this.wallet.getAddress();
16378
- const offchainAddr = chunkVKM6VUOZ_cjs.ArkAddress.decode(offchainAddress);
16379
+ const offchainAddr = chunk7NK6XFC3_cjs.ArkAddress.decode(offchainAddress);
16379
16380
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
16380
16381
  const outputFee = estimator.evalOffchainOutput({
16381
16382
  amount,
@@ -16499,7 +16500,7 @@ var Ramps = class {
16499
16500
  async fundChange(left, estimator) {
16500
16501
  if (left <= 0n) return { change: 0n };
16501
16502
  const changeAddress = await this.wallet.getAddress();
16502
- const changeScript = base.hex.encode(chunkVKM6VUOZ_cjs.ArkAddress.decode(changeAddress).pkScript);
16503
+ const changeScript = base.hex.encode(chunk7NK6XFC3_cjs.ArkAddress.decode(changeAddress).pkScript);
16503
16504
  const { change } = changeAfterOutputFee(
16504
16505
  left,
16505
16506
  (amount) => BigInt(estimator.evalOffchainOutput({ amount, script: changeScript }).satoshis)
@@ -17365,7 +17366,7 @@ var WalletMessageHandler = class {
17365
17366
  // Wallet methods
17366
17367
  async handleInitWallet({ payload }) {
17367
17368
  const { arkServerUrl } = payload;
17368
- this.indexerProvider = new chunkXDT24LBQ_cjs.RestIndexerProvider(arkServerUrl);
17369
+ this.indexerProvider = new chunkBFQX2KS3_cjs.RestIndexerProvider(arkServerUrl);
17369
17370
  await this.onWalletInitialized();
17370
17371
  }
17371
17372
  /**
@@ -17617,7 +17618,7 @@ var WalletMessageHandler = class {
17617
17618
  if (v.isUnrolled) {
17618
17619
  return withUnrolled;
17619
17620
  }
17620
- if (chunkVKM6VUOZ_cjs.isVtxoSpent(v)) {
17621
+ if (chunk7NK6XFC3_cjs.isVtxoSpent(v)) {
17621
17622
  return false;
17622
17623
  }
17623
17624
  if (includeRecoverable) {
@@ -17626,7 +17627,7 @@ var WalletMessageHandler = class {
17626
17627
  if (dustAmount != null && isSubdust(v, dustAmount)) {
17627
17628
  return false;
17628
17629
  }
17629
- return chunkVKM6VUOZ_cjs.canSpendOffchain(v, { timestamp: /* @__PURE__ */ new Date() });
17630
+ return chunk7NK6XFC3_cjs.canSpendOffchain(v, { timestamp: /* @__PURE__ */ new Date() });
17630
17631
  });
17631
17632
  }
17632
17633
  /** Tear down handler subscriptions, then delegate the full wipe to the wallet. */
@@ -17734,7 +17735,7 @@ var WalletMessageHandler = class {
17734
17735
  this.readonlyWallet.getBoardingTxs()
17735
17736
  ]);
17736
17737
  const indexerProvider = this.indexerProvider;
17737
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunkVKM6VUOZ_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
17738
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunk7NK6XFC3_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
17738
17739
  return buildTransactionHistory(
17739
17740
  vtxos,
17740
17741
  boardingTxs,
@@ -17803,7 +17804,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
17803
17804
  // budget so the worker's snapshot fallback stays reachable before this
17804
17805
  // page deadline fires — lowering it below the budget would time the page
17805
17806
  // out while the worker is still seconds from answering from cache.
17806
- GET_ARKADE_INFO: chunkVKM6VUOZ_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
17807
+ GET_ARKADE_INFO: chunk7NK6XFC3_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
17807
17808
  INDEXER_GET_VTXOS: 2e4,
17808
17809
  INDEXER_GET_VIRTUAL_TXS: 2e4,
17809
17810
  GET_VTXOS: 2e4,
@@ -18028,7 +18029,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18028
18029
  }
18029
18030
  /** Shared tail of both `create()` factories: boot the bus, INIT_WALLET, cache for reinit. */
18030
18031
  static async bootstrap(wallet, options, serializedWallet, busConfig) {
18031
- const arkServer = options.arkServer ?? { url: chunkVKM6VUOZ_cjs.DEFAULT_ARKADE_SERVER_URL };
18032
+ const arkServer = options.arkServer ?? { url: chunk7NK6XFC3_cjs.DEFAULT_ARKADE_SERVER_URL };
18032
18033
  const initWalletPayload = {
18033
18034
  arkServerUrl: arkServer.url,
18034
18035
  arkServerPublicKey: arkServer.publicKey
@@ -18361,7 +18362,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18361
18362
  try {
18362
18363
  const response = await this.sendMessage(message);
18363
18364
  const { vtxos, page } = response.payload;
18364
- return { vtxos: vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo), page: page && { ...page } };
18365
+ return { vtxos: vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo), page: page && { ...page } };
18365
18366
  } catch (error) {
18366
18367
  throw new Error(`Failed to get vtxos: ${error}`, { cause: error });
18367
18368
  }
@@ -18465,7 +18466,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18465
18466
  };
18466
18467
  try {
18467
18468
  const response = await this.sendMessage(message);
18468
- return response.payload.vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo);
18469
+ return response.payload.vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo);
18469
18470
  } catch (error) {
18470
18471
  throw new Error(`Failed to get vtxos: ${error}`);
18471
18472
  }
@@ -18496,7 +18497,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18496
18497
  "Service worker does not support the requested contract scope or freshness check"
18497
18498
  );
18498
18499
  }
18499
- return payload.vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo);
18500
+ return payload.vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo);
18500
18501
  } catch (error) {
18501
18502
  throw new Error(`Failed to get spendable vtxos: ${error}`);
18502
18503
  }
@@ -18672,7 +18673,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18672
18673
  };
18673
18674
  try {
18674
18675
  const response = await sendContractMessage(message);
18675
- return response.payload.vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo);
18676
+ return response.payload.vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo);
18676
18677
  } catch (e) {
18677
18678
  throw new Error("Failed to annotate vtxos");
18678
18679
  }
@@ -19255,7 +19256,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19255
19256
  };
19256
19257
  try {
19257
19258
  const response = await wallet.sendMessage(message);
19258
- return response.payload.vtxos.map(chunkVKM6VUOZ_cjs.normalizeVtxo);
19259
+ return response.payload.vtxos.map(chunk7NK6XFC3_cjs.normalizeVtxo);
19259
19260
  } catch (e) {
19260
19261
  throw new Error(`Failed to get expiring vtxos: ${e}`);
19261
19262
  }
@@ -19367,12 +19368,12 @@ var OnchainWallet = class _OnchainWallet {
19367
19368
  * @returns Configured onchain wallet
19368
19369
  * @throws Error if the configured identity cannot produce a valid x-only public key
19369
19370
  */
19370
- static async create(identity, networkName = chunkVKM6VUOZ_cjs.DEFAULT_NETWORK_NAME, provider) {
19371
+ static async create(identity, networkName = chunk7NK6XFC3_cjs.DEFAULT_NETWORK_NAME, provider) {
19371
19372
  const pubkey = await identity.xOnlyPublicKey();
19372
19373
  if (!pubkey) {
19373
19374
  throw new Error("Invalid configured public key");
19374
19375
  }
19375
- const network = chunkVKM6VUOZ_cjs.getNetwork(networkName);
19376
+ const network = chunk7NK6XFC3_cjs.getNetwork(networkName);
19376
19377
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
19377
19378
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
19378
19379
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -19472,7 +19473,7 @@ var OnchainWallet = class _OnchainWallet {
19472
19473
  feeRate,
19473
19474
  params.address
19474
19475
  );
19475
- let tx = new chunkVKM6VUOZ_cjs.Transaction();
19476
+ let tx = new chunk7NK6XFC3_cjs.Transaction();
19476
19477
  for (const input of inputs) {
19477
19478
  tx.addInput({
19478
19479
  txid: input.txid,
@@ -19530,7 +19531,7 @@ var OnchainWallet = class _OnchainWallet {
19530
19531
  * @throws If the parent has no anchor, or funding cannot be selected/signed
19531
19532
  */
19532
19533
  async bumpAnchor(parentHex, feeRate) {
19533
- const parent = chunkVKM6VUOZ_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
19534
+ const parent = chunk7NK6XFC3_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
19534
19535
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
19535
19536
  const child = await this.buildBumpPackage(parent, feeRate, coins);
19536
19537
  return [parent.hex, child.hex];
@@ -20437,7 +20438,7 @@ async function resolvePrevTxs(txids, source, onchain) {
20437
20438
  try {
20438
20439
  const { txs } = await source.getVirtualTxs(wanted);
20439
20440
  for (const psbt of txs) {
20440
- const tx = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
20441
+ const tx = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
20441
20442
  resolved.set(tx.id, tx.toBytes());
20442
20443
  }
20443
20444
  } catch (err) {
@@ -20470,7 +20471,7 @@ async function resolvePrevTxs(txids, source, onchain) {
20470
20471
  async function attachPrevArkTxs(tx, txids, source, onchain) {
20471
20472
  const pending = [];
20472
20473
  for (let i = 0; i < tx.inputsLength; i++) {
20473
- if (chunkVKM6VUOZ_cjs.getArkPsbtFields(tx, i, chunkVKM6VUOZ_cjs.PrevArkTxField).length === 0) pending.push(i);
20474
+ if (chunk7NK6XFC3_cjs.getArkPsbtFields(tx, i, chunk7NK6XFC3_cjs.PrevArkTxField).length === 0) pending.push(i);
20474
20475
  }
20475
20476
  if (pending.length === 0) return;
20476
20477
  const resolved = await resolvePrevTxs(
@@ -20479,13 +20480,13 @@ async function attachPrevArkTxs(tx, txids, source, onchain) {
20479
20480
  onchain
20480
20481
  );
20481
20482
  for (const i of pending) {
20482
- chunkVKM6VUOZ_cjs.setArkPsbtField(tx, i, chunkVKM6VUOZ_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
20483
+ chunk7NK6XFC3_cjs.setArkPsbtField(tx, i, chunk7NK6XFC3_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
20483
20484
  }
20484
20485
  }
20485
20486
  async function attachPrevoutTxs(tx, source) {
20486
20487
  const pending = [];
20487
20488
  for (let i = 0; i < tx.inputsLength; i++) {
20488
- if (chunkVKM6VUOZ_cjs.getArkPsbtFields(tx, i, chunkVKM6VUOZ_cjs.PrevoutTxField).length > 0) continue;
20489
+ if (chunk7NK6XFC3_cjs.getArkPsbtFields(tx, i, chunk7NK6XFC3_cjs.PrevoutTxField).length > 0) continue;
20489
20490
  const input = tx.getInput(i);
20490
20491
  if (!input?.txid) throw new PrevTxUnavailableError(`input ${i} has no outpoint`);
20491
20492
  pending.push({ index: i, txid: base.hex.encode(input.txid) });
@@ -20496,7 +20497,7 @@ async function attachPrevoutTxs(tx, source) {
20496
20497
  resolved.set(txid, await source.getRawTransaction(txid));
20497
20498
  }
20498
20499
  for (const { index, txid } of pending) {
20499
- chunkVKM6VUOZ_cjs.setArkPsbtField(tx, index, chunkVKM6VUOZ_cjs.PrevoutTxField, resolved.get(txid));
20500
+ chunk7NK6XFC3_cjs.setArkPsbtField(tx, index, chunk7NK6XFC3_cjs.PrevoutTxField, resolved.get(txid));
20500
20501
  }
20501
20502
  }
20502
20503
  async function withPrevTxs(coins, source, onchain) {
@@ -20522,7 +20523,7 @@ exports.BIP322 = void 0;
20522
20523
  async function sign2(message, identity, network) {
20523
20524
  const xOnlyPubKey = await identity.xOnlyPublicKey();
20524
20525
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
20525
- const toSpend = chunkVKM6VUOZ_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
20526
+ const toSpend = chunk7NK6XFC3_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
20526
20527
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
20527
20528
  const signed = await identity.sign(toSign, [0]);
20528
20529
  signed.finalizeIdx(0);
@@ -20580,7 +20581,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
20580
20581
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
20581
20582
  return false;
20582
20583
  }
20583
- const toSpend = chunkVKM6VUOZ_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20584
+ const toSpend = chunk7NK6XFC3_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20584
20585
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
20585
20586
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
20586
20587
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -20601,7 +20602,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
20601
20602
  }
20602
20603
  const sighashType = sigWithHash[sigWithHash.length - 1];
20603
20604
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
20604
- const toSpend = chunkVKM6VUOZ_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20605
+ const toSpend = chunk7NK6XFC3_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
20605
20606
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
20606
20607
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
20607
20608
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -20654,7 +20655,7 @@ function encodeCompactSize(n) {
20654
20655
  return buf;
20655
20656
  }
20656
20657
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
20657
- const tx = new chunkVKM6VUOZ_cjs.Transaction({ version: 0 });
20658
+ const tx = new chunk7NK6XFC3_cjs.Transaction({ version: 0 });
20658
20659
  tx.addInput({
20659
20660
  txid: toSpend.id,
20660
20661
  index: 0,
@@ -20668,12 +20669,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
20668
20669
  });
20669
20670
  tx.addOutput({
20670
20671
  amount: 0n,
20671
- script: chunkVKM6VUOZ_cjs.OP_RETURN_EMPTY_PKSCRIPT
20672
+ script: chunk7NK6XFC3_cjs.OP_RETURN_EMPTY_PKSCRIPT
20672
20673
  });
20673
20674
  return tx;
20674
20675
  }
20675
20676
  function craftBIP322ToSignSimple(toSpend, pkScript) {
20676
- const tx = new chunkVKM6VUOZ_cjs.Transaction({ version: 0 });
20677
+ const tx = new chunk7NK6XFC3_cjs.Transaction({ version: 0 });
20677
20678
  tx.addInput({
20678
20679
  txid: toSpend.id,
20679
20680
  index: 0,
@@ -20685,7 +20686,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
20685
20686
  });
20686
20687
  tx.addOutput({
20687
20688
  amount: 0n,
20688
- script: chunkVKM6VUOZ_cjs.OP_RETURN_EMPTY_PKSCRIPT
20689
+ script: chunk7NK6XFC3_cjs.OP_RETURN_EMPTY_PKSCRIPT
20689
20690
  });
20690
20691
  return tx;
20691
20692
  }
@@ -20698,7 +20699,7 @@ var RestEmulatorProvider = class {
20698
20699
  serverUrl;
20699
20700
  async getInfo() {
20700
20701
  const url = `${this.serverUrl}/v1/info`;
20701
- const response = await chunkVKM6VUOZ_cjs.baseFetch(url);
20702
+ const response = await chunk7NK6XFC3_cjs.baseFetch(url);
20702
20703
  if (!response.ok) {
20703
20704
  const errorText2 = await response.text();
20704
20705
  throw new Error(`Failed to get emulator info: ${errorText2}`);
@@ -20816,7 +20817,7 @@ var RestEmulatorProvider = class {
20816
20817
  }
20817
20818
  };
20818
20819
  function finalizeVirtualTx(type, psbtBase64) {
20819
- const tx = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
20820
+ const tx = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
20820
20821
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
20821
20822
  const input = tx.getInput(0);
20822
20823
  if (!input) {
@@ -20843,14 +20844,14 @@ var ExitPathError = class extends Error {
20843
20844
  reason;
20844
20845
  };
20845
20846
  function delayWeight(sequence) {
20846
- const t = chunkVKM6VUOZ_cjs.sequenceToTimelock(sequence);
20847
+ const t = chunk7NK6XFC3_cjs.sequenceToTimelock(sequence);
20847
20848
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
20848
20849
  }
20849
20850
  async function resolveUnilateralPath(params) {
20850
20851
  const { vtxo, scriptHex, contractRepository } = params;
20851
20852
  const contract = contractRepository ? (await collectContracts(contractRepository, { script: scriptHex }))[0] : void 0;
20852
20853
  if (contract) {
20853
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
20854
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
20854
20855
  if (!handler) {
20855
20856
  throw new ExitPathError(
20856
20857
  "no-handler",
@@ -20872,12 +20873,12 @@ async function resolveUnilateralPath(params) {
20872
20873
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
20873
20874
  return { selection: paths[0], label: `${contract.type}:unilateral` };
20874
20875
  }
20875
- const decoded = chunkVKM6VUOZ_cjs.VtxoScript.decode(vtxo.tapTree);
20876
+ const decoded = chunk7NK6XFC3_cjs.VtxoScript.decode(vtxo.tapTree);
20876
20877
  let best;
20877
20878
  for (const exit of decoded.exitPaths()) {
20878
20879
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
20879
20880
  if (!leaf) continue;
20880
- const sequence = chunkVKM6VUOZ_cjs.timelockToSequence(exit.params.timelock);
20881
+ const sequence = chunk7NK6XFC3_cjs.timelockToSequence(exit.params.timelock);
20881
20882
  const weight = delayWeight(sequence);
20882
20883
  if (!best || weight < best.weight) {
20883
20884
  best = { selection: { leaf, sequence }, weight };
@@ -21084,7 +21085,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21084
21085
  const txWeightEstimator = TxWeightEstimator.create();
21085
21086
  const walletDescriptor = base.hex.encode(await wallet.identity.xOnlyPublicKey());
21086
21087
  for (const vtxo of vtxos) {
21087
- if (!chunkVKM6VUOZ_cjs.canSweepOnchain(vtxo)) {
21088
+ if (!chunk7NK6XFC3_cjs.canSweepOnchain(vtxo)) {
21088
21089
  throw new Error(
21089
21090
  `Vtxo ${vtxo.txid}:${vtxo.vout} cannot be swept onchain: it is not fully unrolled (use unroll first), or its exit output was already spent`
21090
21091
  );
@@ -21095,14 +21096,14 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21095
21096
  }
21096
21097
  const resolved = await resolveUnilateralPath({
21097
21098
  vtxo,
21098
- scriptHex: base.hex.encode(chunkVKM6VUOZ_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21099
+ scriptHex: base.hex.encode(chunk7NK6XFC3_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21099
21100
  contractRepository: wallet.contractRepository,
21100
21101
  walletDescriptor,
21101
21102
  currentTime: Date.now()
21102
21103
  });
21103
21104
  const spendingLeaf = resolved.selection.leaf;
21104
21105
  const sequence = resolved.selection.sequence;
21105
- const timelock = chunkVKM6VUOZ_cjs.sequenceToTimelock(sequence);
21106
+ const timelock = chunk7NK6XFC3_cjs.sequenceToTimelock(sequence);
21106
21107
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
21107
21108
  if (!elapsed) {
21108
21109
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -21115,7 +21116,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21115
21116
  sequence,
21116
21117
  witnessUtxo: {
21117
21118
  amount: BigInt(vtxo.value),
21118
- script: chunkVKM6VUOZ_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
21119
+ script: chunk7NK6XFC3_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
21119
21120
  },
21120
21121
  sighashType: btcSigner.SigHash.DEFAULT
21121
21122
  });
@@ -21125,7 +21126,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
21125
21126
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
21126
21127
  );
21127
21128
  }
21128
- const tx = new chunkVKM6VUOZ_cjs.Transaction({ version: 2 });
21129
+ const tx = new chunk7NK6XFC3_cjs.Transaction({ version: 2 });
21129
21130
  for (const input of inputs) {
21130
21131
  tx.addInput(input);
21131
21132
  }
@@ -21208,7 +21209,7 @@ async function buildSignedSweep(params) {
21208
21209
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
21209
21210
  );
21210
21211
  }
21211
- const tx = new chunkVKM6VUOZ_cjs.Transaction({ version: 2 });
21212
+ const tx = new chunk7NK6XFC3_cjs.Transaction({ version: 2 });
21212
21213
  tx.addInput({
21213
21214
  txid: vtxo.txid,
21214
21215
  index: vtxo.vout,
@@ -21233,7 +21234,7 @@ async function buildSignedSweep(params) {
21233
21234
  finalScriptWitness: [
21234
21235
  tapScriptSig[0][1],
21235
21236
  ...path.extraWitness,
21236
- chunkVKM6VUOZ_cjs.scriptFromTapLeafScript(path.leaf),
21237
+ chunk7NK6XFC3_cjs.scriptFromTapLeafScript(path.leaf),
21237
21238
  btcSigner.TaprootControlBlock.encode(controlBlock)
21238
21239
  ]
21239
21240
  });
@@ -21263,7 +21264,7 @@ async function resolveFeeRate(opts) {
21263
21264
  }
21264
21265
  async function selectExitVtxos(opts) {
21265
21266
  if (!opts.vtxos) return opts.wallet.getVtxos();
21266
- const res = await chunkVKM6VUOZ_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
21267
+ const res = await chunk7NK6XFC3_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
21267
21268
  const tapTrees = /* @__PURE__ */ new Map();
21268
21269
  const out = [];
21269
21270
  for (const vtxo of res.vtxos) {
@@ -21278,7 +21279,7 @@ async function selectExitVtxos(opts) {
21278
21279
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
21279
21280
  );
21280
21281
  }
21281
- const handler = chunk73NPW5LY_cjs.contractHandlers.get(contract.type);
21282
+ const handler = chunkFDQQOF3F_cjs.contractHandlers.get(contract.type);
21282
21283
  if (!handler) {
21283
21284
  throw new Error(`no contract handler registered for type '${contract.type}'`);
21284
21285
  }
@@ -21308,7 +21309,7 @@ async function computeExitLayout(opts, feeRate) {
21308
21309
  if (pendingNodes.length > 0) {
21309
21310
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
21310
21311
  for (const psbt of txs) {
21311
- psbts.set(chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
21312
+ psbts.set(chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
21312
21313
  }
21313
21314
  }
21314
21315
  const childVsize = Number(
@@ -21336,7 +21337,7 @@ async function computeExitLayout(opts, feeRate) {
21336
21337
  try {
21337
21338
  const resolved = await resolveUnilateralPath({
21338
21339
  vtxo,
21339
- scriptHex: base.hex.encode(chunkVKM6VUOZ_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21340
+ scriptHex: base.hex.encode(chunk7NK6XFC3_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
21340
21341
  contractRepository: wallet.contractRepository,
21341
21342
  walletDescriptor,
21342
21343
  currentTime: Date.now()
@@ -21355,7 +21356,7 @@ async function computeExitLayout(opts, feeRate) {
21355
21356
  });
21356
21357
  continue;
21357
21358
  }
21358
- const t = chunkVKM6VUOZ_cjs.sequenceToTimelock(resolved.selection.sequence);
21359
+ const t = chunk7NK6XFC3_cjs.sequenceToTimelock(resolved.selection.sequence);
21359
21360
  const delay = { type: t.type, value: Number(t.value) };
21360
21361
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
21361
21362
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -21756,7 +21757,7 @@ async function prepare(opts) {
21756
21757
  txid: sweep.vtxo.txid,
21757
21758
  vout: sweep.vtxo.vout,
21758
21759
  value: sweep.vtxo.value,
21759
- pkScript: chunkVKM6VUOZ_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
21760
+ pkScript: chunk7NK6XFC3_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
21760
21761
  },
21761
21762
  path: sweep.resolved.selection,
21762
21763
  outputAddress: opts.sweepAddress,
@@ -21845,7 +21846,7 @@ async function prepare(opts) {
21845
21846
  if (newFee <= splitterFee) break;
21846
21847
  splitterFee = newFee;
21847
21848
  }
21848
- const splitter = new chunkVKM6VUOZ_cjs.Transaction({ version: 2 });
21849
+ const splitter = new chunk7NK6XFC3_cjs.Transaction({ version: 2 });
21849
21850
  for (const coin of selected.inputs) {
21850
21851
  splitter.addInput({
21851
21852
  txid: coin.txid,
@@ -21984,44 +21985,44 @@ var UnilateralExit = {
21984
21985
 
21985
21986
  // src/arkade/index.ts
21986
21987
  var arkade_exports = {};
21987
- chunkVKM6VUOZ_cjs.__export(arkade_exports, {
21988
- ARKADE_OP: () => chunk73NPW5LY_cjs.ARKADE_OP,
21989
- ARKADE_OPCODES: () => chunk73NPW5LY_cjs.ARKADE_OPCODES,
21990
- ARKADE_OPCODE_NAMES: () => chunk73NPW5LY_cjs.ARKADE_OPCODE_NAMES,
21991
- ARKADE_OPCODE_VALUES: () => chunk73NPW5LY_cjs.ARKADE_OPCODE_VALUES,
21992
- ARKADE_OPS: () => chunk73NPW5LY_cjs.ARKADE_OPS,
21988
+ chunk7NK6XFC3_cjs.__export(arkade_exports, {
21989
+ ARKADE_OP: () => chunkFDQQOF3F_cjs.ARKADE_OP,
21990
+ ARKADE_OPCODES: () => chunkFDQQOF3F_cjs.ARKADE_OPCODES,
21991
+ ARKADE_OPCODE_NAMES: () => chunkFDQQOF3F_cjs.ARKADE_OPCODE_NAMES,
21992
+ ARKADE_OPCODE_VALUES: () => chunkFDQQOF3F_cjs.ARKADE_OPCODE_VALUES,
21993
+ ARKADE_OPS: () => chunkFDQQOF3F_cjs.ARKADE_OPS,
21993
21994
  Arkade: () => Arkade,
21994
21995
  ArkadeContract: () => ArkadeContract,
21995
- ArkadeProgramScript: () => chunk73NPW5LY_cjs.ArkadeProgramScript,
21996
- ArkadeScript: () => chunk73NPW5LY_cjs.ArkadeScript,
21996
+ ArkadeProgramScript: () => chunkFDQQOF3F_cjs.ArkadeProgramScript,
21997
+ ArkadeScript: () => chunkFDQQOF3F_cjs.ArkadeScript,
21997
21998
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
21998
- BigNum: () => chunk73NPW5LY_cjs.bignum_exports,
21999
+ BigNum: () => chunkFDQQOF3F_cjs.bignum_exports,
21999
22000
  OP: () => btcSigner.OP,
22000
- OPCODE_NAMES: () => chunk73NPW5LY_cjs.OPCODE_NAMES,
22001
- OPCODE_VALUES: () => chunk73NPW5LY_cjs.OPCODE_VALUES,
22002
- SUPPORTED_PROGRAM_VERSION: () => chunk73NPW5LY_cjs.SUPPORTED_PROGRAM_VERSION,
22001
+ OPCODE_NAMES: () => chunkFDQQOF3F_cjs.OPCODE_NAMES,
22002
+ OPCODE_VALUES: () => chunkFDQQOF3F_cjs.OPCODE_VALUES,
22003
+ SUPPORTED_PROGRAM_VERSION: () => chunkFDQQOF3F_cjs.SUPPORTED_PROGRAM_VERSION,
22003
22004
  Script: () => btcSigner.Script,
22004
- arkadeScriptHash: () => chunk73NPW5LY_cjs.arkadeScriptHash,
22005
- arkadeWitnessHash: () => chunk73NPW5LY_cjs.arkadeWitnessHash,
22006
- asmToBytes: () => chunk73NPW5LY_cjs.asmToBytes,
22007
- bytesToASM: () => chunk73NPW5LY_cjs.bytesToASM,
22008
- computeArkadeScriptPublicKey: () => chunk73NPW5LY_cjs.computeArkadeScriptPublicKey,
22005
+ arkadeScriptHash: () => chunkFDQQOF3F_cjs.arkadeScriptHash,
22006
+ arkadeWitnessHash: () => chunkFDQQOF3F_cjs.arkadeWitnessHash,
22007
+ asmToBytes: () => chunkFDQQOF3F_cjs.asmToBytes,
22008
+ bytesToASM: () => chunkFDQQOF3F_cjs.bytesToASM,
22009
+ computeArkadeScriptPublicKey: () => chunkFDQQOF3F_cjs.computeArkadeScriptPublicKey,
22009
22010
  createArkadeBatchHandler: () => createArkadeBatchHandler,
22010
- deserializeArkadeContractParams: () => chunk73NPW5LY_cjs.deserializeArkadeContractParams,
22011
- fromASM: () => chunk73NPW5LY_cjs.fromASM,
22012
- getOpcodeName: () => chunk73NPW5LY_cjs.getOpcodeName,
22013
- getOpcodeValue: () => chunk73NPW5LY_cjs.getOpcodeValue,
22011
+ deserializeArkadeContractParams: () => chunkFDQQOF3F_cjs.deserializeArkadeContractParams,
22012
+ fromASM: () => chunkFDQQOF3F_cjs.fromASM,
22013
+ getOpcodeName: () => chunkFDQQOF3F_cjs.getOpcodeName,
22014
+ getOpcodeValue: () => chunkFDQQOF3F_cjs.getOpcodeValue,
22014
22015
  isContractArtifact: () => isContractArtifact,
22015
- parseArtifact: () => chunk73NPW5LY_cjs.parseArtifact,
22016
+ parseArtifact: () => chunkFDQQOF3F_cjs.parseArtifact,
22016
22017
  programFromArtifact: () => programFromArtifact,
22017
- resolveAsm: () => chunk73NPW5LY_cjs.resolveAsm,
22018
- serializeArkadeContractParams: () => chunk73NPW5LY_cjs.serializeArkadeContractParams,
22019
- stringifyArtifact: () => chunk73NPW5LY_cjs.stringifyArtifact,
22020
- toASM: () => chunk73NPW5LY_cjs.toASM,
22021
- validateProgram: () => chunk73NPW5LY_cjs.validateProgram,
22022
- witnessRefToBytes: () => chunk73NPW5LY_cjs.witnessRefToBytes
22018
+ resolveAsm: () => chunkFDQQOF3F_cjs.resolveAsm,
22019
+ serializeArkadeContractParams: () => chunkFDQQOF3F_cjs.serializeArkadeContractParams,
22020
+ stringifyArtifact: () => chunkFDQQOF3F_cjs.stringifyArtifact,
22021
+ toASM: () => chunkFDQQOF3F_cjs.toASM,
22022
+ validateProgram: () => chunkFDQQOF3F_cjs.validateProgram,
22023
+ witnessRefToBytes: () => chunkFDQQOF3F_cjs.witnessRefToBytes
22023
22024
  });
22024
- var isVtxoCoin = (input) => chunkVKM6VUOZ_cjs.isVirtualCoin(input);
22025
+ var isVtxoCoin = (input) => chunk7NK6XFC3_cjs.isVirtualCoin(input);
22025
22026
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
22026
22027
  let batchId;
22027
22028
  let sweepTapTreeRoot;
@@ -22042,23 +22043,23 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22042
22043
  );
22043
22044
  await arkProvider.confirmRegistration(intentId);
22044
22045
  batchId = event.id;
22045
- const sweepTapscript = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.encode({
22046
+ const sweepTapscript = chunk7NK6XFC3_cjs.CSVMultisigTapscript.encode({
22046
22047
  timelock,
22047
- pubkeys: [chunk73NPW5LY_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
22048
+ pubkeys: [chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
22048
22049
  }).script;
22049
22050
  sweepTapTreeRoot = payment_js.tapLeafHash(sweepTapscript);
22050
22051
  return { skip: false };
22051
22052
  },
22052
22053
  onTreeSigningStarted: async (event, vtxoTree) => {
22053
22054
  const signerPubKey = await session.getPublicKey();
22054
- const xonlySignerPubKey = chunk73NPW5LY_cjs.toXOnly(signerPubKey, "signer key");
22055
+ const xonlySignerPubKey = chunkFDQQOF3F_cjs.toXOnly(signerPubKey, "signer key");
22055
22056
  const xOnlyPubkeys = event.cosignersPublicKeys.map(
22056
- (k) => base.hex.encode(chunk73NPW5LY_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
22057
+ (k) => base.hex.encode(chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
22057
22058
  );
22058
22059
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
22059
22060
  return { skip: true };
22060
22061
  }
22061
- const commitmentTx = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
22062
+ const commitmentTx = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
22062
22063
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
22063
22064
  if (recipients && recipients.length > 0) {
22064
22065
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -22096,7 +22097,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22096
22097
  if (connectorTree) {
22097
22098
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
22098
22099
  }
22099
- let commitmentPsbt = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
22100
+ let commitmentPsbt = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
22100
22101
  assertFinalCommitmentMatchesValidated(
22101
22102
  commitmentPsbt,
22102
22103
  validatedCommitmentTxid,
@@ -22138,7 +22139,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22138
22139
  boardingIndices.push(boardingIdx);
22139
22140
  continue;
22140
22141
  }
22141
- if (!chunkVKM6VUOZ_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
22142
+ if (!chunk7NK6XFC3_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
22142
22143
  continue;
22143
22144
  }
22144
22145
  if (connectorIndex >= connectorLeaves.length) {
@@ -22159,7 +22160,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22159
22160
  index: input.vout,
22160
22161
  witnessUtxo: {
22161
22162
  amount: BigInt(input.value),
22162
- script: chunkVKM6VUOZ_cjs.VtxoScript.decode(input.tapTree).pkScript
22163
+ script: chunk7NK6XFC3_cjs.VtxoScript.decode(input.tapTree).pkScript
22163
22164
  },
22164
22165
  sighashType: btcSigner.SigHash.DEFAULT,
22165
22166
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -22304,7 +22305,7 @@ function flatten(param, structs, stack = []) {
22304
22305
  function opcodeToken(token) {
22305
22306
  const base = token.slice(3);
22306
22307
  const name = base === "0" || /^([1-9]|1[0-6])$/.test(base) ? token : base;
22307
- if (!Object.hasOwn(chunk73NPW5LY_cjs.ARKADE_OPS, name)) {
22308
+ if (!Object.hasOwn(chunkFDQQOF3F_cjs.ARKADE_OPS, name)) {
22308
22309
  fail(`opcode '${token}' is not in this SDK's table`);
22309
22310
  }
22310
22311
  return name;
@@ -22351,8 +22352,8 @@ function providedWitness(witness) {
22351
22352
  }
22352
22353
  function csvTimelock(leafName, operand) {
22353
22354
  if (typeof operand === "string") return { type: "blocks", value: operand };
22354
- const timelock = operand >= 0n && operand < 0x80000000n ? chunkVKM6VUOZ_cjs.sequenceToTimelock(Number(operand)) : void 0;
22355
- if (!timelock || BigInt(chunkVKM6VUOZ_cjs.timelockToSequence(timelock)) !== operand) {
22355
+ const timelock = operand >= 0n && operand < 0x80000000n ? chunk7NK6XFC3_cjs.sequenceToTimelock(Number(operand)) : void 0;
22356
+ if (!timelock || BigInt(chunk7NK6XFC3_cjs.timelockToSequence(timelock)) !== operand) {
22356
22357
  fail(`leaf '${leafName}': CSV literal ${operand} is not a canonical BIP68 sequence`);
22357
22358
  }
22358
22359
  return timelock;
@@ -22470,7 +22471,7 @@ function programFromArtifact(artifact) {
22470
22471
  const paramNames = /* @__PURE__ */ new Set();
22471
22472
  for (const param of params) claim(paramNames, param.name, "program parameter");
22472
22473
  return {
22473
- version: chunk73NPW5LY_cjs.SUPPORTED_PROGRAM_VERSION,
22474
+ version: chunkFDQQOF3F_cjs.SUPPORTED_PROGRAM_VERSION,
22474
22475
  name: artifact.contractName,
22475
22476
  params,
22476
22477
  functions
@@ -22511,16 +22512,16 @@ var Arkade = class _Arkade {
22511
22512
  /** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
22512
22513
  static async connect(opts) {
22513
22514
  const info = await opts.arkade.getInfo();
22514
- const serverKey = chunk73NPW5LY_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
22515
- const checkpoint = chunkVKM6VUOZ_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
22516
- const network = opts.network ?? (Object.hasOwn(chunkVKM6VUOZ_cjs.networks, info.network) ? chunkVKM6VUOZ_cjs.getNetwork(info.network) : chunkVKM6VUOZ_cjs.DEFAULT_NETWORK);
22515
+ const serverKey = chunkFDQQOF3F_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
22516
+ const checkpoint = chunk7NK6XFC3_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
22517
+ const network = opts.network ?? (Object.hasOwn(chunk7NK6XFC3_cjs.networks, info.network) ? chunk7NK6XFC3_cjs.getNetwork(info.network) : chunk7NK6XFC3_cjs.DEFAULT_NETWORK);
22517
22518
  let emulatorKey;
22518
22519
  if (opts.emulator) {
22519
- emulatorKey = base.hex.decode(chunkVKM6VUOZ_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
22520
+ emulatorKey = base.hex.decode(chunk7NK6XFC3_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
22520
22521
  }
22521
22522
  let userKey;
22522
22523
  if (opts.identity) {
22523
- userKey = chunk73NPW5LY_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
22524
+ userKey = chunkFDQQOF3F_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
22524
22525
  }
22525
22526
  return new _Arkade({
22526
22527
  arkProvider: opts.arkade,
@@ -22543,7 +22544,7 @@ var Arkade = class _Arkade {
22543
22544
  * explicit args win.
22544
22545
  */
22545
22546
  contract(program, args = {}) {
22546
- const declared = (program.params ?? []).map(chunk73NPW5LY_cjs.inputName);
22547
+ const declared = (program.params ?? []).map(chunkFDQQOF3F_cjs.inputName);
22547
22548
  if (declared.includes("server") && args.server === void 0) {
22548
22549
  args = { ...args, server: this.serverKey };
22549
22550
  }
@@ -22563,7 +22564,7 @@ var ArkadeContract = class _ArkadeContract {
22563
22564
  userKey: client.userKey,
22564
22565
  emulatorKey: client.emulatorKey
22565
22566
  };
22566
- this.vtxoScript = new chunk73NPW5LY_cjs.ArkadeProgramScript(program, args, this.keys);
22567
+ this.vtxoScript = new chunkFDQQOF3F_cjs.ArkadeProgramScript(program, args, this.keys);
22567
22568
  this.tapTree = this.vtxoScript.encode();
22568
22569
  this.compiled = this.vtxoScript.compiled;
22569
22570
  }
@@ -22588,7 +22589,7 @@ var ArkadeContract = class _ArkadeContract {
22588
22589
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
22589
22590
  );
22590
22591
  }
22591
- const typed = chunk73NPW5LY_cjs.deserializeArkadeContractParams(contract.params);
22592
+ const typed = chunkFDQQOF3F_cjs.deserializeArkadeContractParams(contract.params);
22592
22593
  return new _ArkadeContract(client, typed.program, typed.args, {
22593
22594
  serverKey: typed.serverKey,
22594
22595
  userKey: typed.userKey,
@@ -22624,7 +22625,7 @@ var ArkadeContract = class _ArkadeContract {
22624
22625
  toContractParams() {
22625
22626
  return {
22626
22627
  type: "arkade",
22627
- params: chunk73NPW5LY_cjs.serializeArkadeContractParams({
22628
+ params: chunkFDQQOF3F_cjs.serializeArkadeContractParams({
22628
22629
  program: this.program,
22629
22630
  args: this.args,
22630
22631
  serverKey: this.keys.serverKey,
@@ -22664,17 +22665,17 @@ var ArkadeContract = class _ArkadeContract {
22664
22665
  const [registered] = await manager.getContracts({ script: scriptHex });
22665
22666
  if (registered) {
22666
22667
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
22667
- return (withVtxos?.vtxos ?? []).filter((v) => !chunkVKM6VUOZ_cjs.isVtxoSpent(v) && !v.isUnrolled);
22668
+ return (withVtxos?.vtxos ?? []).filter((v) => !chunk7NK6XFC3_cjs.isVtxoSpent(v) && !v.isUnrolled);
22668
22669
  }
22669
22670
  }
22670
22671
  if (!this.client.indexer) {
22671
22672
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
22672
22673
  }
22673
- const { vtxos } = await chunkVKM6VUOZ_cjs.getNormalizedVtxos(this.client.indexer, {
22674
+ const { vtxos } = await chunk7NK6XFC3_cjs.getNormalizedVtxos(this.client.indexer, {
22674
22675
  scripts: [scriptHex],
22675
22676
  spendableOnly: true
22676
22677
  });
22677
- return vtxos.filter((v) => !chunkVKM6VUOZ_cjs.isVtxoSpent(v) && !v.isUnrolled);
22678
+ return vtxos.filter((v) => !chunk7NK6XFC3_cjs.isVtxoSpent(v) && !v.isUnrolled);
22678
22679
  }
22679
22680
  /** Total spendable balance (requires an indexer). */
22680
22681
  async getBalance() {
@@ -22772,7 +22773,7 @@ var ArkadeTransactionBuilder = class {
22772
22773
  this.contract.client.checkpoint
22773
22774
  );
22774
22775
  if (coin.sourceTx) {
22775
- chunkVKM6VUOZ_cjs.setArkPsbtField(arkTx, 0, chunkVKM6VUOZ_cjs.PrevArkTxField, coin.sourceTx);
22776
+ chunk7NK6XFC3_cjs.setArkPsbtField(arkTx, 0, chunk7NK6XFC3_cjs.PrevArkTxField, coin.sourceTx);
22776
22777
  }
22777
22778
  if (this.fn.arkadeScript) {
22778
22779
  const indexer = this.contract.client.indexer;
@@ -22789,8 +22790,8 @@ var ArkadeTransactionBuilder = class {
22789
22790
  }
22790
22791
  const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
22791
22792
  if (condition.length > 0) {
22792
- chunkVKM6VUOZ_cjs.setArkPsbtField(arkTx, 0, chunkVKM6VUOZ_cjs.ConditionWitness, condition);
22793
- chunkVKM6VUOZ_cjs.setArkPsbtField(checkpoints[0], 0, chunkVKM6VUOZ_cjs.ConditionWitness, condition);
22793
+ chunk7NK6XFC3_cjs.setArkPsbtField(arkTx, 0, chunk7NK6XFC3_cjs.ConditionWitness, condition);
22794
+ chunk7NK6XFC3_cjs.setArkPsbtField(checkpoints[0], 0, chunk7NK6XFC3_cjs.ConditionWitness, condition);
22794
22795
  }
22795
22796
  const packets = [];
22796
22797
  if (this.assetSpecs.length > 0) {
@@ -22829,7 +22830,7 @@ var ArkadeTransactionBuilder = class {
22829
22830
  base.base64.encode(signedArk2.toPSBT()),
22830
22831
  signedCps.map((c) => base.base64.encode(c.toPSBT()))
22831
22832
  );
22832
- const txid = chunkVKM6VUOZ_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
22833
+ const txid = chunk7NK6XFC3_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
22833
22834
  return {
22834
22835
  txid,
22835
22836
  signedArkTx: res2.signedArkTx,
@@ -22894,23 +22895,23 @@ var ArkadeTransactionBuilder = class {
22894
22895
  }
22895
22896
  buildAssetPacket() {
22896
22897
  const groups = this.assetSpecs.map((s) => {
22897
- const id = typeof s.assetId === "string" ? chunkXDT24LBQ_cjs.AssetId.fromString(s.assetId) : chunkXDT24LBQ_cjs.AssetId.fromBytes(s.assetId);
22898
- return chunkXDT24LBQ_cjs.AssetGroup.create(
22898
+ const id = typeof s.assetId === "string" ? chunkBFQX2KS3_cjs.AssetId.fromString(s.assetId) : chunkBFQX2KS3_cjs.AssetId.fromBytes(s.assetId);
22899
+ return chunkBFQX2KS3_cjs.AssetGroup.create(
22899
22900
  id,
22900
22901
  null,
22901
- s.inputs.map((i) => chunkXDT24LBQ_cjs.AssetInput.create(i.vin, i.amount)),
22902
- s.outputs.map((o) => chunkXDT24LBQ_cjs.AssetOutput.create(o.vout, o.amount)),
22903
- (s.metadata ?? []).map((m) => chunkXDT24LBQ_cjs.Metadata.create(m.key, m.value))
22902
+ s.inputs.map((i) => chunkBFQX2KS3_cjs.AssetInput.create(i.vin, i.amount)),
22903
+ s.outputs.map((o) => chunkBFQX2KS3_cjs.AssetOutput.create(o.vout, o.amount)),
22904
+ (s.metadata ?? []).map((m) => chunkBFQX2KS3_cjs.Metadata.create(m.key, m.value))
22904
22905
  );
22905
22906
  });
22906
- return chunkXDT24LBQ_cjs.Packet.create(groups);
22907
+ return chunkBFQX2KS3_cjs.Packet.create(groups);
22907
22908
  }
22908
22909
  witnessBytes(ref) {
22909
- return chunk73NPW5LY_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
22910
+ return chunkFDQQOF3F_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
22910
22911
  }
22911
22912
  };
22912
22913
  function bindInputs(fn, callArgs) {
22913
- const names = (fn.def.inputs ?? []).map(chunk73NPW5LY_cjs.inputName);
22914
+ const names = (fn.def.inputs ?? []).map(chunkFDQQOF3F_cjs.inputName);
22914
22915
  if (callArgs.length !== names.length) {
22915
22916
  throw new Error(`${fn.name}: expected ${names.length} argument(s), got ${callArgs.length}`);
22916
22917
  }
@@ -23324,17 +23325,17 @@ var walletFeeSource = (wallet) => async () => (await wallet.arkProvider.getInfo(
23324
23325
  function offchainInputFees(vtxos, fees) {
23325
23326
  const estimator = new Estimator(fees?.intentFee ?? {});
23326
23327
  return vtxos.reduce(
23327
- (total, vtxo) => total + estimator.evalOffchainInput(chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
23328
+ (total, vtxo) => total + estimator.evalOffchainInput(chunk7NK6XFC3_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
23328
23329
  0
23329
23330
  );
23330
23331
  }
23331
23332
  async function changeOutputFee(wallet, inputs, needed, fees) {
23332
23333
  const estimator = new Estimator(fees?.intentFee ?? {});
23333
23334
  const net = inputs.reduce(
23334
- (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkVKM6VUOZ_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
23335
+ (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunk7NK6XFC3_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
23335
23336
  0n
23336
23337
  );
23337
- const script = base.hex.encode(chunkVKM6VUOZ_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
23338
+ const script = base.hex.encode(chunk7NK6XFC3_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
23338
23339
  return changeAfterOutputFee(
23339
23340
  net - needed,
23340
23341
  (amount) => BigInt(estimator.evalOffchainOutput({ amount, script }).satoshis)
@@ -23634,5 +23635,5 @@ exports.waitForIncomingFunds = waitForIncomingFunds;
23634
23635
  exports.walletFeeSource = walletFeeSource;
23635
23636
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
23636
23637
  exports.withPrevTxs = withPrevTxs;
23637
- //# sourceMappingURL=chunk-HQTM6HLJ.cjs.map
23638
- //# sourceMappingURL=chunk-HQTM6HLJ.cjs.map
23638
+ //# sourceMappingURL=chunk-I4YBVHAK.cjs.map
23639
+ //# sourceMappingURL=chunk-I4YBVHAK.cjs.map