@arkade-os/sdk 0.5.5 → 0.5.7

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 (77) hide show
  1. package/dist/adapters/expo.cjs +6 -6
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/{asyncStorageTaskQueue-BbH-THYJ.d.cts → asyncStorageTaskQueue-B9byr6ij.d.cts} +1 -1
  6. package/dist/{asyncStorageTaskQueue-BlvkJyTa.d.ts → asyncStorageTaskQueue-XP4CCdRY.d.ts} +1 -1
  7. package/dist/{chunk-XWUCNMPN.cjs → chunk-3NALVGMJ.cjs} +16 -16
  8. package/dist/{chunk-XWUCNMPN.cjs.map → chunk-3NALVGMJ.cjs.map} +1 -1
  9. package/dist/{chunk-FVVXCDNE.js → chunk-4AJRIM44.js} +4 -4
  10. package/dist/{chunk-FVVXCDNE.js.map → chunk-4AJRIM44.js.map} +1 -1
  11. package/dist/{chunk-AMH7Q3DF.cjs → chunk-MQUATTIM.cjs} +8 -8
  12. package/dist/{chunk-AMH7Q3DF.cjs.map → chunk-MQUATTIM.cjs.map} +1 -1
  13. package/dist/{chunk-CE46RS6L.js → chunk-MWEDDWFU.js} +4 -4
  14. package/dist/{chunk-CE46RS6L.js.map → chunk-MWEDDWFU.js.map} +1 -1
  15. package/dist/{chunk-7GIKLFHC.js → chunk-MWMO2ZQP.js} +3 -3
  16. package/dist/{chunk-7GIKLFHC.js.map → chunk-MWMO2ZQP.js.map} +1 -1
  17. package/dist/{chunk-HQQ4NRXI.cjs → chunk-MXCB6EVM.cjs} +15 -15
  18. package/dist/{chunk-HQQ4NRXI.cjs.map → chunk-MXCB6EVM.cjs.map} +1 -1
  19. package/dist/{chunk-KCL5AVML.cjs → chunk-OMPDPBT5.cjs} +3 -3
  20. package/dist/chunk-OMPDPBT5.cjs.map +1 -0
  21. package/dist/{chunk-OO2KEK64.js → chunk-RLD7DRSZ.js} +381 -54
  22. package/dist/chunk-RLD7DRSZ.js.map +1 -0
  23. package/dist/{chunk-T254PXSN.cjs → chunk-URGVQ5TQ.cjs} +795 -462
  24. package/dist/chunk-URGVQ5TQ.cjs.map +1 -0
  25. package/dist/{chunk-BCA6D255.js → chunk-V2DDN4MV.js} +3 -3
  26. package/dist/{chunk-BCA6D255.js.map → chunk-V2DDN4MV.js.map} +1 -1
  27. package/dist/{chunk-5SYUEVJH.cjs → chunk-V5WRO3P6.cjs} +10 -10
  28. package/dist/{chunk-5SYUEVJH.cjs.map → chunk-V5WRO3P6.cjs.map} +1 -1
  29. package/dist/{chunk-4I53THL6.js → chunk-VMVFRTF4.js} +3 -3
  30. package/dist/chunk-VMVFRTF4.js.map +1 -0
  31. package/dist/contracts/handlers/index.cjs +9 -9
  32. package/dist/contracts/handlers/index.d.cts +2 -2
  33. package/dist/contracts/handlers/index.d.ts +2 -2
  34. package/dist/contracts/handlers/index.js +2 -2
  35. package/dist/{index-DCml4QJn.d.ts → index-18cDMayF.d.ts} +25 -25
  36. package/dist/{index-Bx-iArDs.d.ts → index-B_kcptF8.d.ts} +1 -1
  37. package/dist/{index-BWwVnJhU.d.cts → index-Ccfhdfvj.d.cts} +1 -1
  38. package/dist/{index-DkyzIzKL.d.cts → index-DDJFHfba.d.cts} +25 -25
  39. package/dist/index.cjs +335 -311
  40. package/dist/index.d.cts +89 -138
  41. package/dist/index.d.ts +89 -138
  42. package/dist/index.js +4 -4
  43. package/dist/{keyringDescriptorProvider-CS4w4PWd.d.ts → keyringDescriptorProvider-DL-jAiRO.d.ts} +158 -10
  44. package/dist/{keyringDescriptorProvider-CmHXrIXd.d.cts → keyringDescriptorProvider-Dtv0JWrT.d.cts} +158 -10
  45. package/dist/repositories/realm/index.cjs +37 -37
  46. package/dist/repositories/realm/index.cjs.map +1 -1
  47. package/dist/repositories/realm/index.d.cts +6 -6
  48. package/dist/repositories/realm/index.d.ts +6 -6
  49. package/dist/repositories/realm/index.js +6 -6
  50. package/dist/repositories/realm/index.js.map +1 -1
  51. package/dist/repositories/sqlite/index.cjs +35 -35
  52. package/dist/repositories/sqlite/index.cjs.map +1 -1
  53. package/dist/repositories/sqlite/index.d.cts +6 -6
  54. package/dist/repositories/sqlite/index.d.ts +6 -6
  55. package/dist/repositories/sqlite/index.js +5 -5
  56. package/dist/repositories/sqlite/index.js.map +1 -1
  57. package/dist/{taskRunner-DgMLSk_O.d.ts → taskRunner-DUafWu0o.d.ts} +1 -1
  58. package/dist/{taskRunner-buh6aFpG.d.cts → taskRunner-JYHaLPne.d.cts} +1 -1
  59. package/dist/wallet/expo/background.cjs +14 -14
  60. package/dist/wallet/expo/background.d.cts +3 -3
  61. package/dist/wallet/expo/background.d.ts +3 -3
  62. package/dist/wallet/expo/background.js +6 -6
  63. package/dist/wallet/expo/index.cjs +15 -15
  64. package/dist/wallet/expo/index.cjs.map +1 -1
  65. package/dist/wallet/expo/index.d.cts +6 -6
  66. package/dist/wallet/expo/index.d.ts +6 -6
  67. package/dist/wallet/expo/index.js +5 -5
  68. package/dist/wallet/expo/index.js.map +1 -1
  69. package/dist/worker/expo/index.cjs +9 -9
  70. package/dist/worker/expo/index.d.cts +4 -4
  71. package/dist/worker/expo/index.d.ts +4 -4
  72. package/dist/worker/expo/index.js +5 -5
  73. package/package.json +2 -2
  74. package/dist/chunk-4I53THL6.js.map +0 -1
  75. package/dist/chunk-KCL5AVML.cjs.map +0 -1
  76. package/dist/chunk-OO2KEK64.js.map +0 -1
  77. package/dist/chunk-T254PXSN.cjs.map +0 -1
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkX6ZI53DZ_cjs = require('./chunk-X6ZI53DZ.cjs');
4
- var chunkXWUCNMPN_cjs = require('./chunk-XWUCNMPN.cjs');
5
- var chunkAMH7Q3DF_cjs = require('./chunk-AMH7Q3DF.cjs');
4
+ var chunk3NALVGMJ_cjs = require('./chunk-3NALVGMJ.cjs');
5
+ var chunkMQUATTIM_cjs = require('./chunk-MQUATTIM.cjs');
6
6
  var chunkJFJNB7ZH_cjs = require('./chunk-JFJNB7ZH.cjs');
7
- var chunkKCL5AVML_cjs = require('./chunk-KCL5AVML.cjs');
7
+ var chunkOMPDPBT5_cjs = require('./chunk-OMPDPBT5.cjs');
8
8
  var chunkFLPWNMX3_cjs = require('./chunk-FLPWNMX3.cjs');
9
9
  var bip39 = require('@scure/bip39');
10
10
  var english_js = require('@scure/bip39/wordlists/english.js');
@@ -325,7 +325,7 @@ var TreeSignerSession = class _TreeSignerSession {
325
325
  noncesByPubkey.set(base.hex.encode(myPublicKey.subarray(1)), myNonce);
326
326
  const tx = this.graph.find(txid);
327
327
  if (!tx) throw new Error(`missing tx for txid ${txid}`);
328
- const cosigners = chunkKCL5AVML_cjs.getArkPsbtFields(tx.root, 0, chunkKCL5AVML_cjs.CosignerPublicKey).map(
328
+ const cosigners = chunkOMPDPBT5_cjs.getArkPsbtFields(tx.root, 0, chunkOMPDPBT5_cjs.CosignerPublicKey).map(
329
329
  (c) => base.hex.encode(c.key.subarray(1))
330
330
  // xonly pubkey
331
331
  );
@@ -377,7 +377,7 @@ var TreeSignerSession = class _TreeSignerSession {
377
377
  if (!aggNonce) throw new Error("missing aggregate nonce");
378
378
  const prevoutAmounts = [];
379
379
  const prevoutScripts = [];
380
- const cosigners = chunkKCL5AVML_cjs.getArkPsbtFields(g.root, 0, chunkKCL5AVML_cjs.CosignerPublicKey).map((c) => c.key);
380
+ const cosigners = chunkOMPDPBT5_cjs.getArkPsbtFields(g.root, 0, chunkOMPDPBT5_cjs.CosignerPublicKey).map((c) => c.key);
381
381
  const { finalKey } = aggregateKeys(cosigners, true, {
382
382
  taprootTweak: this.scriptRoot
383
383
  });
@@ -460,7 +460,7 @@ var SingleKey = class _SingleKey {
460
460
  async sign(tx, inputIndexes) {
461
461
  const txCpy = tx.clone();
462
462
  if (!inputIndexes) {
463
- chunkKCL5AVML_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
463
+ chunkOMPDPBT5_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
464
464
  try {
465
465
  if (!txCpy.sign(this.key, ALLOWED_SIGHASH)) {
466
466
  throw new Error("Failed to sign transaction");
@@ -560,7 +560,7 @@ var SeedIdentity = class _SeedIdentity {
560
560
  let network;
561
561
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
562
562
  descriptor = opts.descriptor;
563
- network = chunkAMH7Q3DF_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
563
+ network = chunkMQUATTIM_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
564
564
  } else {
565
565
  network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
566
566
  descriptor = descriptorsScure.scriptExpressions.trBIP32({
@@ -637,7 +637,7 @@ var SeedIdentity = class _SeedIdentity {
637
637
  }
638
638
  /** Returns true when `descriptor` is derived from this identity's seed. */
639
639
  ownsDescriptor(descriptor) {
640
- return chunkAMH7Q3DF_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
640
+ return chunkMQUATTIM_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
641
641
  }
642
642
  /**
643
643
  * Signs each request with the key derived from its descriptor.
@@ -676,7 +676,7 @@ var SeedIdentity = class _SeedIdentity {
676
676
  }
677
677
  // ── internal helpers ─────────────────────────────────────────────
678
678
  derivePrivateKeyForDescriptor(descriptor) {
679
- const network = chunkAMH7Q3DF_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
679
+ const network = chunkMQUATTIM_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
680
680
  const expansion = descriptorsScure.expand({ descriptor, network });
681
681
  if (expansion.isRanged) {
682
682
  throw new Error(
@@ -701,7 +701,7 @@ var SeedIdentity = class _SeedIdentity {
701
701
  signTxWithKey(tx, key, inputIndexes) {
702
702
  const txCpy = tx.clone();
703
703
  if (!inputIndexes) {
704
- chunkKCL5AVML_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
704
+ chunkOMPDPBT5_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
705
705
  try {
706
706
  if (!txCpy.sign(key, ALLOWED_SIGHASH2)) {
707
707
  throw new Error("Failed to sign transaction");
@@ -802,7 +802,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
802
802
  /** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
803
803
  descriptor;
804
804
  constructor(descriptor) {
805
- const network = chunkAMH7Q3DF_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
805
+ const network = chunkMQUATTIM_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
806
806
  let expansion;
807
807
  try {
808
808
  expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
@@ -837,7 +837,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
837
837
  }
838
838
  /** Returns true when `descriptor` derives from this identity's xpub. */
839
839
  ownsDescriptor(descriptor) {
840
- return chunkAMH7Q3DF_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
840
+ return chunkMQUATTIM_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
841
841
  }
842
842
  };
843
843
  function serializeSeedOwnedSigningIdentity(identity) {
@@ -980,10 +980,10 @@ var DescriptorIdentity = class {
980
980
  this.base = base;
981
981
  }
982
982
  async xOnlyPublicKey() {
983
- return chunkAMH7Q3DF_cjs.deriveDescriptorLeafPubKey(this.descriptor);
983
+ return chunkMQUATTIM_cjs.deriveDescriptorLeafPubKey(this.descriptor);
984
984
  }
985
985
  async compressedPublicKey() {
986
- return chunkAMH7Q3DF_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
986
+ return chunkMQUATTIM_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
987
987
  }
988
988
  async sign(tx, inputIndexes) {
989
989
  const [signed] = await this.signer.signWithDescriptor([
@@ -1043,8 +1043,8 @@ var StaticDescriptorProvider = class _StaticDescriptorProvider {
1043
1043
  }
1044
1044
  isOurs(descriptor) {
1045
1045
  try {
1046
- const normalized = chunkAMH7Q3DF_cjs.normalizeToDescriptor(descriptor);
1047
- const pubKey = chunkAMH7Q3DF_cjs.extractPubKey(normalized);
1046
+ const normalized = chunkMQUATTIM_cjs.normalizeToDescriptor(descriptor);
1047
+ const pubKey = chunkMQUATTIM_cjs.extractPubKey(normalized);
1048
1048
  return pubKey.toLowerCase() === this.pubKeyHex.toLowerCase();
1049
1049
  } catch {
1050
1050
  return false;
@@ -1386,7 +1386,7 @@ function unwrapKeyring(provider) {
1386
1386
  }
1387
1387
  function keyOf(descriptor) {
1388
1388
  try {
1389
- return chunkAMH7Q3DF_cjs.extractPubKey(chunkAMH7Q3DF_cjs.normalizeToDescriptor(descriptor)).toLowerCase();
1389
+ return chunkMQUATTIM_cjs.extractPubKey(chunkMQUATTIM_cjs.normalizeToDescriptor(descriptor)).toLowerCase();
1390
1390
  } catch {
1391
1391
  return void 0;
1392
1392
  }
@@ -1477,12 +1477,12 @@ async function resolveDescriptorSigner(descriptor, identity, provider) {
1477
1477
  signMessageWithDescriptor: (ownedDescriptor, message, signatureType) => identity.signDescriptorMessage(ownedDescriptor, message, signatureType)
1478
1478
  } : void 0;
1479
1479
  const owner = providerOwner ?? identityOwner;
1480
- if (owner && chunkAMH7Q3DF_cjs.parseHDDescriptor(descriptor)) {
1480
+ if (owner && chunkMQUATTIM_cjs.parseHDDescriptor(descriptor)) {
1481
1481
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
1482
1482
  }
1483
1483
  let key;
1484
1484
  try {
1485
- key = chunkAMH7Q3DF_cjs.deriveDescriptorLeafPubKey(descriptor);
1485
+ key = chunkMQUATTIM_cjs.deriveDescriptorLeafPubKey(descriptor);
1486
1486
  } catch {
1487
1487
  throw new ForeignDescriptorError(descriptor);
1488
1488
  }
@@ -1535,14 +1535,14 @@ function buildSaltedPreimageMessage(xonly, salt) {
1535
1535
  }
1536
1536
  var PREIMAGE_INDEX = 0;
1537
1537
  function isPerArtifactDescriptor(descriptor) {
1538
- return chunkAMH7Q3DF_cjs.parseHDDescriptor(descriptor) !== null;
1538
+ return chunkMQUATTIM_cjs.parseHDDescriptor(descriptor) !== null;
1539
1539
  }
1540
1540
  async function provisionDescriptor(wallet) {
1541
1541
  const allocated = isHDAllocationCapable(wallet) ? await wallet.getNextSigningDescriptor() : void 0;
1542
- return allocated ?? await chunkAMH7Q3DF_cjs.identityDescriptor(wallet.identity);
1542
+ return allocated ?? await chunkMQUATTIM_cjs.identityDescriptor(wallet.identity);
1543
1543
  }
1544
1544
  async function provisionRefundKey(wallet) {
1545
- const descriptorPromise = chunkAMH7Q3DF_cjs.identityDescriptor(wallet.identity);
1545
+ const descriptorPromise = chunkMQUATTIM_cjs.identityDescriptor(wallet.identity);
1546
1546
  const identityPubkeyPromise = wallet.identity.xOnlyPublicKey();
1547
1547
  void identityPubkeyPromise.catch(() => void 0);
1548
1548
  const descriptor = await descriptorPromise;
@@ -1605,7 +1605,7 @@ async function contractSigner(wallet, descriptor) {
1605
1605
  const signer = isHDWalletCapable(wallet) ? await wallet.signerForDescriptor(descriptor) : wallet.identity;
1606
1606
  let expected;
1607
1607
  try {
1608
- expected = chunkAMH7Q3DF_cjs.deriveDescriptorLeafPubKey(descriptor);
1608
+ expected = chunkMQUATTIM_cjs.deriveDescriptorLeafPubKey(descriptor);
1609
1609
  } catch (cause) {
1610
1610
  throw new ForeignDescriptorError(descriptor, { cause });
1611
1611
  }
@@ -1687,7 +1687,7 @@ function debugLog(debug, ...args) {
1687
1687
  }
1688
1688
  function normalizeOptions(pathOrOptions) {
1689
1689
  const o = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
1690
- chunkKCL5AVML_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
1690
+ chunkOMPDPBT5_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
1691
1691
  return {
1692
1692
  path: o.path,
1693
1693
  updateViaCache: o.updateViaCache ?? "none",
@@ -1810,14 +1810,14 @@ var RestDelegateProvider = class {
1810
1810
  */
1811
1811
  async delegate(intent, forfeitTxs, options) {
1812
1812
  const url = `${this.url}/v1/delegate`;
1813
- const response = await chunkKCL5AVML_cjs.baseFetch(url, {
1813
+ const response = await chunkOMPDPBT5_cjs.baseFetch(url, {
1814
1814
  method: "POST",
1815
1815
  headers: {
1816
1816
  "Content-Type": "application/json"
1817
1817
  },
1818
1818
  body: JSON.stringify({
1819
1819
  intent: {
1820
- message: chunkKCL5AVML_cjs.Proof.encodeMessage(intent.message),
1820
+ message: chunkOMPDPBT5_cjs.Proof.encodeMessage(intent.message),
1821
1821
  proof: intent.proof
1822
1822
  },
1823
1823
  forfeit_txs: forfeitTxs,
@@ -1836,7 +1836,7 @@ var RestDelegateProvider = class {
1836
1836
  */
1837
1837
  async getDelegateInfo() {
1838
1838
  const url = `${this.url}/v1/delegator/info`;
1839
- const response = await chunkKCL5AVML_cjs.rateGate.runHttp(url, () => chunkKCL5AVML_cjs.baseFetch(url));
1839
+ const response = await chunkOMPDPBT5_cjs.rateGate.runHttp(url, () => chunkOMPDPBT5_cjs.baseFetch(url));
1840
1840
  if (!response.ok) {
1841
1841
  const errorText2 = await response.text();
1842
1842
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1893,7 +1893,7 @@ async function collectPages(read) {
1893
1893
  }
1894
1894
 
1895
1895
  // src/repositories/intentRepository.ts
1896
- var ALL_INTENT_STATES = [
1896
+ var ALL_BATCH_REGISTRATION_STATES = [
1897
1897
  "waiting_to_submit",
1898
1898
  "waiting_for_batch",
1899
1899
  "batch_in_progress",
@@ -1909,7 +1909,7 @@ var BATCH_REGISTRATION_TERMINAL_STATES = /* @__PURE__ */ new Set([
1909
1909
  function isTerminalBatchRegistrationState(s) {
1910
1910
  return BATCH_REGISTRATION_TERMINAL_STATES.has(s);
1911
1911
  }
1912
- var collectIntents = (repository, filter) => collectPages((page) => repository.getBatchRegistrationsPage(filter, page));
1912
+ var collectBatchRegistrations = (repository, filter) => collectPages((page) => repository.getBatchRegistrationsPage(filter, page));
1913
1913
  function assertIntentIdUnique(intent, existing) {
1914
1914
  if (intent.registrationId === void 0) return;
1915
1915
  for (const e of existing) {
@@ -1941,7 +1941,7 @@ function intentMatchesFilter(i, f) {
1941
1941
  }
1942
1942
  var isTerminalIntentState = isTerminalBatchRegistrationState;
1943
1943
  var INTENT_TERMINAL_STATES = BATCH_REGISTRATION_TERMINAL_STATES;
1944
- var collectBatchRegistrations = collectIntents;
1944
+ var collectIntents = collectBatchRegistrations;
1945
1945
 
1946
1946
  // src/repositories/contractRepository.ts
1947
1947
  function contractFilterMatchesNothing(filter) {
@@ -1973,7 +1973,7 @@ var EsploraProvider = class {
1973
1973
  */
1974
1974
  addressWatches = /* @__PURE__ */ new Map();
1975
1975
  async getCoins(address) {
1976
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1976
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1977
1977
  if (!response.ok) {
1978
1978
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1979
1979
  }
@@ -1982,12 +1982,12 @@ var EsploraProvider = class {
1982
1982
  async getFeeRate() {
1983
1983
  let url = `${this.baseUrl}/fee-estimates`;
1984
1984
  let key = "1";
1985
- let response = await chunkKCL5AVML_cjs.baseFetch(url);
1985
+ let response = await chunkOMPDPBT5_cjs.baseFetch(url);
1986
1986
  if (response.status === 404) {
1987
1987
  await response.body?.cancel();
1988
1988
  url = `${this.baseUrl}/v1/fees/recommended`;
1989
1989
  key = "fastestFee";
1990
- response = await chunkKCL5AVML_cjs.baseFetch(url);
1990
+ response = await chunkOMPDPBT5_cjs.baseFetch(url);
1991
1991
  }
1992
1992
  if (response.status === 404) {
1993
1993
  await response.body?.cancel();
@@ -2024,7 +2024,7 @@ var EsploraProvider = class {
2024
2024
  }
2025
2025
  }
2026
2026
  async getTxOutspends(txid) {
2027
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
2027
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
2028
2028
  if (!response.ok) {
2029
2029
  const error = await response.text();
2030
2030
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -2032,7 +2032,7 @@ var EsploraProvider = class {
2032
2032
  return response.json();
2033
2033
  }
2034
2034
  async getTransactions(address) {
2035
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
2035
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
2036
2036
  if (!response.ok) {
2037
2037
  const error = await response.text();
2038
2038
  throw new Error(`Failed to get transactions: ${error}`);
@@ -2041,14 +2041,14 @@ var EsploraProvider = class {
2041
2041
  }
2042
2042
  /** Orders of magnitude smaller than `/address/{addr}/txs`: the polling fallback's probe. */
2043
2043
  async getAddressStats(address) {
2044
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
2044
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
2045
2045
  if (!response.ok) {
2046
2046
  throw new Error(`Failed to get address stats: ${response.statusText}`);
2047
2047
  }
2048
2048
  return response.json();
2049
2049
  }
2050
2050
  async getRawTransaction(txid) {
2051
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
2051
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
2052
2052
  if (!response.ok) {
2053
2053
  const error = await response.text();
2054
2054
  throw new Error(`Failed to get raw transaction ${txid}: ${error}`);
@@ -2056,7 +2056,7 @@ var EsploraProvider = class {
2056
2056
  return base.hex.decode((await response.text()).trim());
2057
2057
  }
2058
2058
  async getTxStatus(txid) {
2059
- const txresponse = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
2059
+ const txresponse = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
2060
2060
  if (!txresponse.ok) {
2061
2061
  throw new Error(txresponse.statusText);
2062
2062
  }
@@ -2064,7 +2064,7 @@ var EsploraProvider = class {
2064
2064
  if (!tx.status.confirmed) {
2065
2065
  return { confirmed: false };
2066
2066
  }
2067
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
2067
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
2068
2068
  if (!response.ok) {
2069
2069
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
2070
2070
  }
@@ -2145,14 +2145,22 @@ var EsploraProvider = class {
2145
2145
  let anchorHeight;
2146
2146
  const baseline = (async () => {
2147
2147
  const [history, tip] = await Promise.allSettled([getAllTxs(), this.getChainTip()]);
2148
+ let failure;
2148
2149
  if (history.status === "fulfilled") {
2149
- for (const tx of history.value) seen.add(txKey2(tx));
2150
- baselined = true;
2151
- return;
2150
+ try {
2151
+ const keys = history.value.map(txKey2);
2152
+ for (const key of keys) seen.add(key);
2153
+ baselined = true;
2154
+ return;
2155
+ } catch (error) {
2156
+ failure = error;
2157
+ }
2158
+ } else {
2159
+ failure = history.reason;
2152
2160
  }
2153
2161
  console.warn(
2154
2162
  "Could not baseline watched addresses; the first poll pass will establish it instead:",
2155
- history.reason
2163
+ failure
2156
2164
  );
2157
2165
  if (tip.status === "fulfilled") anchorHeight = tip.value.height;
2158
2166
  })();
@@ -2338,9 +2346,9 @@ var EsploraProvider = class {
2338
2346
  return { subscribers, teardown, started };
2339
2347
  }
2340
2348
  async getChainTip() {
2341
- let tipBlocks = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/blocks`);
2349
+ let tipBlocks = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/blocks`);
2342
2350
  if (tipBlocks.status === 404) {
2343
- tipBlocks = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2351
+ tipBlocks = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2344
2352
  }
2345
2353
  if (!tipBlocks.ok) {
2346
2354
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
@@ -2364,7 +2372,7 @@ var EsploraProvider = class {
2364
2372
  if (!Number.isInteger(height) || height < 0) {
2365
2373
  throw new Error(`Invalid block height for median-time-past: ${height}`);
2366
2374
  }
2367
- const hashResponse = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/block-height/${height}`);
2375
+ const hashResponse = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/block-height/${height}`);
2368
2376
  if (!hashResponse.ok) {
2369
2377
  throw new Error(
2370
2378
  `Failed to get block hash at height ${height}: ${hashResponse.statusText}`
@@ -2372,7 +2380,7 @@ var EsploraProvider = class {
2372
2380
  }
2373
2381
  const hash = (await hashResponse.text()).trim();
2374
2382
  if (!hash) throw new Error(`No block hash returned at height ${height}`);
2375
- const blockResponse = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/block/${hash}`);
2383
+ const blockResponse = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/block/${hash}`);
2376
2384
  if (!blockResponse.ok) {
2377
2385
  throw new Error(`Failed to get block ${hash}: ${blockResponse.statusText}`);
2378
2386
  }
@@ -2383,7 +2391,7 @@ var EsploraProvider = class {
2383
2391
  return block.mediantime;
2384
2392
  }
2385
2393
  async broadcastPackage(parent, child) {
2386
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2394
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2387
2395
  method: "POST",
2388
2396
  headers: {
2389
2397
  "Content-Type": "application/json"
@@ -2399,7 +2407,7 @@ var EsploraProvider = class {
2399
2407
  return result;
2400
2408
  }
2401
2409
  async broadcastTx(tx) {
2402
- const response = await chunkKCL5AVML_cjs.baseFetch(`${this.baseUrl}/tx`, {
2410
+ const response = await chunkOMPDPBT5_cjs.baseFetch(`${this.baseUrl}/tx`, {
2403
2411
  method: "POST",
2404
2412
  headers: {
2405
2413
  "Content-Type": "text/plain"
@@ -2571,7 +2579,7 @@ function findP2AOutput(tx) {
2571
2579
  var CHILD_DUST_AMOUNT = 546;
2572
2580
  function buildAnchorChild(params) {
2573
2581
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
2574
- const child = new chunkKCL5AVML_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2582
+ const child = new chunkOMPDPBT5_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2575
2583
  const anchor = findP2AOutput(parent);
2576
2584
  child.addInput(anchor);
2577
2585
  const estimator = TxWeightEstimator.create().addP2AInput();
@@ -2620,7 +2628,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
2620
2628
  );
2621
2629
  }
2622
2630
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
2623
- const tx = new chunkKCL5AVML_cjs.Transaction({
2631
+ const tx = new chunkOMPDPBT5_cjs.Transaction({
2624
2632
  version: 3,
2625
2633
  lockTime: txLocktime
2626
2634
  });
@@ -2647,7 +2655,7 @@ function validateConnectorsTxGraph(settlementTxB64, connectorsGraph) {
2647
2655
  connectorsGraph.validate();
2648
2656
  if (connectorsGraph.root.inputsLength !== 1) throw ErrNumberOfInputs;
2649
2657
  const rootInput = connectorsGraph.root.getInput(0);
2650
- const settlementTx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(settlementTxB64));
2658
+ const settlementTx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(settlementTxB64));
2651
2659
  if (settlementTx.outputsLength <= BATCH_OUTPUT_CONNECTORS_INDEX)
2652
2660
  throw ErrInvalidSettlementTxOutputs;
2653
2661
  const expectedRootTxid = settlementTx.id;
@@ -2696,7 +2704,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
2696
2704
  if (previousScriptKey.length !== 32) {
2697
2705
  throw new Error(`parent output ${childIndex} has invalid script`);
2698
2706
  }
2699
- const cosigners = chunkKCL5AVML_cjs.getArkPsbtFields(child.root, 0, chunkKCL5AVML_cjs.CosignerPublicKey);
2707
+ const cosigners = chunkOMPDPBT5_cjs.getArkPsbtFields(child.root, 0, chunkOMPDPBT5_cjs.CosignerPublicKey);
2700
2708
  if (cosigners.length === 0) {
2701
2709
  throw ErrMissingCosignersPublicKeys;
2702
2710
  }
@@ -2754,7 +2762,7 @@ var EmulatorPacket = class _EmulatorPacket {
2754
2762
  return new _EmulatorPacket(entries);
2755
2763
  }
2756
2764
  static fromBytes(data) {
2757
- const reader = new chunkXWUCNMPN_cjs.BufferReader(data);
2765
+ const reader = new chunk3NALVGMJ_cjs.BufferReader(data);
2758
2766
  const entryCount = reader.readCompactSize();
2759
2767
  const entries = [];
2760
2768
  for (let i = 0; i < entryCount; i++) {
@@ -2772,7 +2780,7 @@ var EmulatorPacket = class _EmulatorPacket {
2772
2780
  return _EmulatorPacket.PACKET_TYPE;
2773
2781
  }
2774
2782
  serialize() {
2775
- const writer = new chunkXWUCNMPN_cjs.BufferWriter();
2783
+ const writer = new chunk3NALVGMJ_cjs.BufferWriter();
2776
2784
  writer.writeCompactSize(this.entries.length);
2777
2785
  for (const entry of this.entries) {
2778
2786
  writer.writeUint16LE(entry.vin);
@@ -2859,7 +2867,7 @@ var Extension = class _Extension {
2859
2867
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
2860
2868
  );
2861
2869
  }
2862
- const reader = new chunkXWUCNMPN_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2870
+ const reader = new chunk3NALVGMJ_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2863
2871
  const packets = [];
2864
2872
  while (reader.remaining() > 0) {
2865
2873
  const packetType = reader.readByte();
@@ -2932,7 +2940,7 @@ var Extension = class _Extension {
2932
2940
  * getAssetPacket returns the embedded Packet, or null if not present.
2933
2941
  */
2934
2942
  getAssetPacket() {
2935
- return this.packets.find((p) => p instanceof chunkXWUCNMPN_cjs.Packet) ?? null;
2943
+ return this.packets.find((p) => p instanceof chunk3NALVGMJ_cjs.Packet) ?? null;
2936
2944
  }
2937
2945
  /**
2938
2946
  * getEmulatorPacket returns the embedded EmulatorPacket, or null if not present.
@@ -2956,8 +2964,8 @@ var Extension = class _Extension {
2956
2964
  };
2957
2965
  function parsePacket(packetType, data) {
2958
2966
  switch (packetType) {
2959
- case chunkXWUCNMPN_cjs.Packet.PACKET_TYPE:
2960
- return chunkXWUCNMPN_cjs.Packet.fromBytes(data);
2967
+ case chunk3NALVGMJ_cjs.Packet.PACKET_TYPE:
2968
+ return chunk3NALVGMJ_cjs.Packet.fromBytes(data);
2961
2969
  case EmulatorPacket.PACKET_TYPE:
2962
2970
  return EmulatorPacket.fromBytes(data);
2963
2971
  default:
@@ -3004,22 +3012,22 @@ function buildOpReturnScript(data) {
3004
3012
  }
3005
3013
  return script;
3006
3014
  }
3007
- var ErrOffchainOutputNotFound = (address) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
3008
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3015
+ var ErrOffchainOutputNotFound = (address) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
3016
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3009
3017
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
3010
3018
  );
3011
- var ErrAssetGroupNotFound = (assetId) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
3012
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3019
+ var ErrAssetGroupNotFound = (assetId) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
3020
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3013
3021
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
3014
3022
  );
3015
- var ErrOnchainOutputNotFound = (address) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
3016
- var ErrUnvalidatedOffchainOutput = (address) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3023
+ var ErrOnchainOutputNotFound = (address) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
3024
+ var ErrUnvalidatedOffchainOutput = (address) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3017
3025
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
3018
3026
  );
3019
- var ErrIntentOutputNotFound = (index, kind) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3027
+ var ErrIntentOutputNotFound = (index, kind) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3020
3028
  `${kind} output ${index} of the proof is not present in what the server built`
3021
3029
  );
3022
- var ErrUnvalidatedIntentOutput = (index) => new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3030
+ var ErrUnvalidatedIntentOutput = (index) => new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3023
3031
  `offchain output ${index} of the proof cannot be validated: virtual output tree signing did not run`
3024
3032
  );
3025
3033
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
@@ -3028,7 +3036,7 @@ var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain ou
3028
3036
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
3029
3037
  if (!validatedCommitmentTxid) return;
3030
3038
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
3031
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3039
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3032
3040
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
3033
3041
  );
3034
3042
  }
@@ -3059,7 +3067,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
3059
3067
  }
3060
3068
  }
3061
3069
  function declaredIntentOutputs(signedProof, onchainOutputIndexes) {
3062
- const proof = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
3070
+ const proof = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
3063
3071
  const onchain = new Set(onchainOutputIndexes);
3064
3072
  const declared = [];
3065
3073
  for (let i = 0; i < proof.outputsLength; i++) {
@@ -3351,7 +3359,7 @@ function assetMintResolver() {
3351
3359
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
3352
3360
  const minted = tx.assets.filter((a) => {
3353
3361
  try {
3354
- return base.hex.encode(chunkXWUCNMPN_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3362
+ return base.hex.encode(chunk3NALVGMJ_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3355
3363
  } catch {
3356
3364
  return false;
3357
3365
  }
@@ -3428,7 +3436,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3428
3436
  const existing = inputsByAssetId.get(asset.assetId);
3429
3437
  inputsByAssetId.set(asset.assetId, [
3430
3438
  ...existing ?? [],
3431
- chunkXWUCNMPN_cjs.AssetInput.create(inputIndex, asset.amount)
3439
+ chunk3NALVGMJ_cjs.AssetInput.create(inputIndex, asset.amount)
3432
3440
  ]);
3433
3441
  }
3434
3442
  }
@@ -3440,7 +3448,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3440
3448
  const existing = outputsByAssetId.get(asset.assetId);
3441
3449
  outputsByAssetId.set(asset.assetId, [
3442
3450
  ...existing ?? [],
3443
- chunkXWUCNMPN_cjs.AssetOutput.create(outputIndex, asset.amount)
3451
+ chunk3NALVGMJ_cjs.AssetOutput.create(outputIndex, asset.amount)
3444
3452
  ]);
3445
3453
  }
3446
3454
  }
@@ -3451,7 +3459,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3451
3459
  const existing = outputsByAssetId.get(asset.assetId);
3452
3460
  outputsByAssetId.set(asset.assetId, [
3453
3461
  ...existing ?? [],
3454
- chunkXWUCNMPN_cjs.AssetOutput.create(outputIndex, asset.amount)
3462
+ chunk3NALVGMJ_cjs.AssetOutput.create(outputIndex, asset.amount)
3455
3463
  ]);
3456
3464
  }
3457
3465
  }
@@ -3460,11 +3468,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3460
3468
  for (const assetIdStr of allAssetIds) {
3461
3469
  const inputs = inputsByAssetId.get(assetIdStr);
3462
3470
  const outputs = outputsByAssetId.get(assetIdStr);
3463
- const assetId = chunkXWUCNMPN_cjs.AssetId.fromString(assetIdStr);
3464
- const group = chunkXWUCNMPN_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3471
+ const assetId = chunk3NALVGMJ_cjs.AssetId.fromString(assetIdStr);
3472
+ const group = chunk3NALVGMJ_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3465
3473
  groups.push(group);
3466
3474
  }
3467
- return chunkXWUCNMPN_cjs.Packet.create(groups);
3475
+ return chunk3NALVGMJ_cjs.Packet.create(groups);
3468
3476
  }
3469
3477
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
3470
3478
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -3595,14 +3603,14 @@ var toTimelock = (value) => ({
3595
3603
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
3596
3604
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
3597
3605
  if (policy.requireSeconds && timelock.type === "blocks") {
3598
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3606
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3599
3607
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
3600
3608
  );
3601
3609
  }
3602
3610
  const seconds = toSeconds(timelock);
3603
3611
  if (seconds < policy.minSeconds) {
3604
3612
  const remedy = overrideOption ? `; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it` : "";
3605
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3613
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3606
3614
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor${remedy}`
3607
3615
  );
3608
3616
  }
@@ -3623,7 +3631,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
3623
3631
  }
3624
3632
  function assertValidBatchExpiry(batchExpiry, policy) {
3625
3633
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
3626
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3634
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3627
3635
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
3628
3636
  );
3629
3637
  }
@@ -3634,19 +3642,19 @@ function assertValidServerUnrollScript(checkpointTapscript, network, advertisedF
3634
3642
  try {
3635
3643
  script = chunkFLPWNMX3_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3636
3644
  } catch (e) {
3637
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3645
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3638
3646
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
3639
3647
  );
3640
3648
  }
3641
3649
  if (advertisedForfeitPubkey !== void 0) {
3642
3650
  const { pubkeys } = script.params;
3643
3651
  if (pubkeys.length !== 1) {
3644
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3652
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3645
3653
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
3646
3654
  );
3647
3655
  }
3648
3656
  if (!utils_js.equalBytes(pubkeys[0], advertisedForfeitPubkey)) {
3649
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3657
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3650
3658
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(advertisedForfeitPubkey)}`
3651
3659
  );
3652
3660
  }
@@ -3701,7 +3709,7 @@ function buildVirtualTx(inputs, outputs) {
3701
3709
  }
3702
3710
  }
3703
3711
  }
3704
- const tx = new chunkKCL5AVML_cjs.Transaction({
3712
+ const tx = new chunkOMPDPBT5_cjs.Transaction({
3705
3713
  version: 3,
3706
3714
  lockTime: Number(lockTime)
3707
3715
  });
@@ -3716,7 +3724,7 @@ function buildVirtualTx(inputs, outputs) {
3716
3724
  },
3717
3725
  tapLeafScript: [input.tapLeafScript]
3718
3726
  });
3719
- chunkKCL5AVML_cjs.setArkPsbtField(tx, i, chunkKCL5AVML_cjs.VtxoTaprootTree, input.tapTree);
3727
+ chunkOMPDPBT5_cjs.setArkPsbtField(tx, i, chunkOMPDPBT5_cjs.VtxoTaprootTree, input.tapTree);
3720
3728
  }
3721
3729
  for (const output of outputs) {
3722
3730
  tx.addOutput(output);
@@ -3862,7 +3870,7 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
3862
3870
  const sighashType = signature.length === 65 ? signature[64] : btcSigner.SigHash.DEFAULT;
3863
3871
  const sig = signature.subarray(0, 64);
3864
3872
  if (!allowedSighashTypes.includes(sighashType)) {
3865
- const sighashName = chunkKCL5AVML_cjs.formatSighash(sighashType);
3873
+ const sighashName = chunkOMPDPBT5_cjs.formatSighash(sighashType);
3866
3874
  throw new Error(
3867
3875
  `Unallowed sighash type ${sighashName} for input ${inputIndex}, pubkey ${pubKeyHex}.`
3868
3876
  );
@@ -3944,16 +3952,16 @@ function isValidArkAddress(address) {
3944
3952
  }
3945
3953
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3946
3954
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3947
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3955
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3948
3956
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3949
3957
  );
3950
3958
  }
3951
3959
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3952
3960
  return serverCheckpointTxs.map((encoded, index) => {
3953
- const server = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3961
+ const server = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3954
3962
  const local = byTxid.get(server.id);
3955
3963
  if (!local) {
3956
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3964
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3957
3965
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3958
3966
  );
3959
3967
  }
@@ -3963,14 +3971,14 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3963
3971
  }
3964
3972
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3965
3973
  if (response.arkTxid !== signedArkTx.id) {
3966
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3974
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3967
3975
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3968
3976
  );
3969
3977
  }
3970
3978
  if (response.finalArkTx === void 0) return;
3971
- const finalTxid = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3979
+ const finalTxid = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3972
3980
  if (finalTxid !== signedArkTx.id) {
3973
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
3981
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3974
3982
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3975
3983
  );
3976
3984
  }
@@ -3989,13 +3997,13 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3989
3997
  (key) => base.hex.encode(chunkJFJNB7ZH_cjs.toXOnly(key, "leaf key"))
3990
3998
  );
3991
3999
  } catch (error) {
3992
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4000
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3993
4001
  `${context}: input ${inputIndex} spend leaf cannot be decoded (${error instanceof Error ? error.message : String(error)})`
3994
4002
  );
3995
4003
  }
3996
4004
  const signer = leafPubkeys.find((key) => serverPubkeys.has(key));
3997
4005
  if (!signer) {
3998
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4006
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
3999
4007
  `${context}: input ${inputIndex} spend leaf names no signer key the server advertises`
4000
4008
  );
4001
4009
  }
@@ -4009,7 +4017,7 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
4009
4017
  payment_js.tapLeafHash(script)
4010
4018
  );
4011
4019
  } catch (error) {
4012
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4020
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4013
4021
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
4014
4022
  );
4015
4023
  }
@@ -4018,20 +4026,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
4018
4026
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
4019
4027
  for (const [index, checkpoint] of checkpoints.entries()) {
4020
4028
  if (checkpoint.inputsLength !== 1) {
4021
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4029
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4022
4030
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
4023
4031
  );
4024
4032
  }
4025
4033
  const spent = checkpoint.getInput(0);
4026
4034
  if (!spent.txid || spent.index === void 0) {
4027
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4035
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4028
4036
  `${context}: checkpoint ${index} has no input outpoint`
4029
4037
  );
4030
4038
  }
4031
4039
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
4032
4040
  const input = byOutpoint.get(outpoint);
4033
4041
  if (!input) {
4034
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4042
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4035
4043
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
4036
4044
  );
4037
4045
  }
@@ -4039,7 +4047,7 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
4039
4047
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
4040
4048
  );
4041
4049
  if (!rebuilt) {
4042
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4050
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4043
4051
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
4044
4052
  );
4045
4053
  }
@@ -4068,9 +4076,9 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
4068
4076
  if (!oneShot) {
4069
4077
  matched.forEach(({ server }, index) => {
4070
4078
  try {
4071
- chunkKCL5AVML_cjs.assertAllowedSighashTypes(server);
4079
+ chunkOMPDPBT5_cjs.assertAllowedSighashTypes(server);
4072
4080
  } catch (error) {
4073
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4081
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4074
4082
  `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
4075
4083
  );
4076
4084
  }
@@ -4079,11 +4087,11 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
4079
4087
  const verify = options?.verifyServerSignatures;
4080
4088
  if (verify) {
4081
4089
  if (response.finalArkTx === void 0) {
4082
- throw new chunkKCL5AVML_cjs.ServerResponseMismatchError(
4090
+ throw new chunkOMPDPBT5_cjs.ServerResponseMismatchError(
4083
4091
  "submitTx: server returned no final ark tx to verify its signatures against"
4084
4092
  );
4085
4093
  }
4086
- const finalArkTx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
4094
+ const finalArkTx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
4087
4095
  const serverPubkeys = new Set(
4088
4096
  [verify.serverPubkey, ...verify.deprecatedServerPubkeys ?? []].map(
4089
4097
  (key) => base.hex.encode(chunkJFJNB7ZH_cjs.toXOnly(key, "server key"))
@@ -4134,19 +4142,19 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
4134
4142
  return result;
4135
4143
  }
4136
4144
  function carryConditionWitness(ours, server) {
4137
- if (chunkKCL5AVML_cjs.getArkPsbtFields(server, 0, chunkKCL5AVML_cjs.ConditionWitness).length > 0) return;
4138
- const [witness] = chunkKCL5AVML_cjs.getArkPsbtFields(ours, 0, chunkKCL5AVML_cjs.ConditionWitness);
4139
- if (witness) chunkKCL5AVML_cjs.setArkPsbtField(server, 0, chunkKCL5AVML_cjs.ConditionWitness, witness);
4145
+ if (chunkOMPDPBT5_cjs.getArkPsbtFields(server, 0, chunkOMPDPBT5_cjs.ConditionWitness).length > 0) return;
4146
+ const [witness] = chunkOMPDPBT5_cjs.getArkPsbtFields(ours, 0, chunkOMPDPBT5_cjs.ConditionWitness);
4147
+ if (witness) chunkOMPDPBT5_cjs.setArkPsbtField(server, 0, chunkOMPDPBT5_cjs.ConditionWitness, witness);
4140
4148
  }
4141
4149
  function withArkInputWitness(checkpoint, signedArkTx) {
4142
- if (chunkKCL5AVML_cjs.getArkPsbtFields(checkpoint, 0, chunkKCL5AVML_cjs.ConditionWitness).length > 0) return checkpoint;
4150
+ if (chunkOMPDPBT5_cjs.getArkPsbtFields(checkpoint, 0, chunkOMPDPBT5_cjs.ConditionWitness).length > 0) return checkpoint;
4143
4151
  for (let i = 0; i < signedArkTx.inputsLength; i++) {
4144
4152
  const { txid } = signedArkTx.getInput(i);
4145
4153
  if (!txid || base.hex.encode(txid) !== checkpoint.id) continue;
4146
- const [witness] = chunkKCL5AVML_cjs.getArkPsbtFields(signedArkTx, i, chunkKCL5AVML_cjs.ConditionWitness);
4154
+ const [witness] = chunkOMPDPBT5_cjs.getArkPsbtFields(signedArkTx, i, chunkOMPDPBT5_cjs.ConditionWitness);
4147
4155
  if (!witness) return checkpoint;
4148
4156
  const carried = checkpoint.clone();
4149
- chunkKCL5AVML_cjs.setArkPsbtField(carried, 0, chunkKCL5AVML_cjs.ConditionWitness, witness);
4157
+ chunkOMPDPBT5_cjs.setArkPsbtField(carried, 0, chunkOMPDPBT5_cjs.ConditionWitness, witness);
4150
4158
  return carried;
4151
4159
  }
4152
4160
  return checkpoint;
@@ -4187,7 +4195,7 @@ async function submitViaEmulator(emulator, offchainTx, signer, opts) {
4187
4195
  base.base64.encode(arkTx.toPSBT()),
4188
4196
  checkpoints.map((c) => base.base64.encode(c.toPSBT()))
4189
4197
  );
4190
- const txid = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(res.signedArkTx)).id;
4198
+ const txid = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(res.signedArkTx)).id;
4191
4199
  assertSubmittedArkTxid({ arkTxid: txid }, arkTx, "emulator submitTx");
4192
4200
  return { txid, signedArkTx: res.signedArkTx, signedCheckpointTxs: res.signedCheckpointTxs };
4193
4201
  }
@@ -4195,12 +4203,12 @@ function claimWithPreimageIdentity(identity, preimage) {
4195
4203
  return {
4196
4204
  ...identity,
4197
4205
  sign: async (tx, inputIndexes) => {
4198
- const signed = chunkKCL5AVML_cjs.Transaction.fromPSBT(
4206
+ const signed = chunkOMPDPBT5_cjs.Transaction.fromPSBT(
4199
4207
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
4200
4208
  );
4201
4209
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
4202
4210
  for (const index of indexes) {
4203
- chunkKCL5AVML_cjs.setArkPsbtField(signed, index, chunkKCL5AVML_cjs.ConditionWitness, [preimage]);
4211
+ chunkOMPDPBT5_cjs.setArkPsbtField(signed, index, chunkOMPDPBT5_cjs.ConditionWitness, [preimage]);
4204
4212
  }
4205
4213
  return signed;
4206
4214
  }
@@ -4209,7 +4217,7 @@ function claimWithPreimageIdentity(identity, preimage) {
4209
4217
 
4210
4218
  // src/contracts/scope.ts
4211
4219
  function scopeOf(contract) {
4212
- return contract.scope ?? chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type)?.defaultScope ?? "offchain";
4220
+ return contract.scope ?? chunkMQUATTIM_cjs.contractHandlers.get(contract.type)?.defaultScope ?? "offchain";
4213
4221
  }
4214
4222
  function isOnchainScoped(contract) {
4215
4223
  return scopeOf(contract) !== "offchain";
@@ -4286,9 +4294,9 @@ async function collectScriptVtxos(repository, script, options) {
4286
4294
  return [...byOutpoint.values()].map((row) => row.vtxo);
4287
4295
  }
4288
4296
  function unspentScriptVtxos(rows, copies) {
4289
- const spent = copies.filter((copy) => chunkKCL5AVML_cjs.isVtxoSpent(copy.vtxo));
4297
+ const spent = copies.filter((copy) => chunkOMPDPBT5_cjs.isVtxoSpent(copy.vtxo));
4290
4298
  return rows.filter(
4291
- (row) => !chunkKCL5AVML_cjs.isVtxoSpent(row.vtxo) && !spent.some(
4299
+ (row) => !chunkOMPDPBT5_cjs.isVtxoSpent(row.vtxo) && !spent.some(
4292
4300
  (copy) => copy.address !== row.address && copy.vtxo.txid === row.vtxo.txid && copy.vtxo.vout === row.vtxo.vout && shouldReplaceScriptVtxo(row, copy)
4293
4301
  )
4294
4302
  );
@@ -4345,7 +4353,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
4345
4353
  };
4346
4354
  }
4347
4355
  function deriveContractTapscripts(contract) {
4348
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
4356
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
4349
4357
  if (!handler) {
4350
4358
  throw new Error(`No handler for contract type '${contract.type}'`);
4351
4359
  }
@@ -4548,8 +4556,8 @@ function checkSaveVtxosForScript(backend, key, vtxos) {
4548
4556
  }
4549
4557
  async function getVtxosForContract(repo, contract, options) {
4550
4558
  const vtxos = repo.getVtxosForScriptPage ? await collectScriptVtxos(repo, contract.script, options) : filterVtxosForScript(await collectVtxos(repo, contract.address), contract.script);
4551
- const normalized = vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo);
4552
- return options?.unspentOnly ? normalized.filter((vtxo) => !chunkKCL5AVML_cjs.isVtxoSpent(vtxo)) : normalized;
4559
+ const normalized = vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo);
4560
+ return options?.unspentOnly ? normalized.filter((vtxo) => !chunkOMPDPBT5_cjs.isVtxoSpent(vtxo)) : normalized;
4553
4561
  }
4554
4562
  async function hasVtxosForContract(repo, contract) {
4555
4563
  if (repo.getVtxosForScriptPage) {
@@ -4631,7 +4639,7 @@ async function saveVtxosForContract(repo, contract, vtxos) {
4631
4639
  // src/contracts/onchainCoins.ts
4632
4640
  var MIGRATED_KEY = "legacyUtxosMigrated";
4633
4641
  function createScript(contract) {
4634
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
4642
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
4635
4643
  if (!handler) throw new Error(`No handler for contract type '${contract.type}'`);
4636
4644
  return handler.createScript(contract.params);
4637
4645
  }
@@ -4690,7 +4698,7 @@ async function migrateLegacyUtxos(deps) {
4690
4698
  let migrated = 0;
4691
4699
  for (const contract of await collectContracts(contractRepository)) {
4692
4700
  if (!isOnchainScoped(contract)) continue;
4693
- if (!chunkAMH7Q3DF_cjs.contractHandlers.has(contract.type)) {
4701
+ if (!chunkMQUATTIM_cjs.contractHandlers.has(contract.type)) {
4694
4702
  console.warn("Skipping legacy utxos of a contract with no handler", contract.type);
4695
4703
  continue;
4696
4704
  }
@@ -4716,7 +4724,7 @@ var DEFAULT_COSIGN_MARGIN_BLOCKS = 6;
4716
4724
  var MAX_COSIGN_INPUTS = 64;
4717
4725
  var ONCHAIN_RENEW_WINDOW_BLOCKS = 144;
4718
4726
  function exitCsvOf(contract) {
4719
- const sequence = chunkAMH7Q3DF_cjs.exitSequence(contract);
4727
+ const sequence = chunkMQUATTIM_cjs.exitSequence(contract);
4720
4728
  return sequence === void 0 ? void 0 : chunkFLPWNMX3_cjs.sequenceToTimelock(sequence);
4721
4729
  }
4722
4730
  var ONCHAIN_COSIGN_PREFLIGHT_PREFIX = "Onchain cosign preflight failed: ";
@@ -4734,7 +4742,7 @@ function prepareOwnedInput(tx, { index, coin, path, tapTree }) {
4734
4742
  tx.updateInput(index, { tapLeafScript: void 0, tapScriptSig: void 0 }, true);
4735
4743
  }
4736
4744
  const kept = unknown?.filter(
4737
- (u) => chunkKCL5AVML_cjs.VtxoTaprootTree.decode(u) === null && chunkKCL5AVML_cjs.ConditionWitness.decode(u) === null
4745
+ (u) => chunkOMPDPBT5_cjs.VtxoTaprootTree.decode(u) === null && chunkOMPDPBT5_cjs.ConditionWitness.decode(u) === null
4738
4746
  );
4739
4747
  if (kept && kept.length !== unknown.length) {
4740
4748
  tx.updateInput(index, { unknown: void 0 }, true);
@@ -4745,9 +4753,9 @@ function prepareOwnedInput(tx, { index, coin, path, tapTree }) {
4745
4753
  tapLeafScript: [path.leaf],
4746
4754
  sighashType: btcSigner.SigHash.DEFAULT
4747
4755
  });
4748
- chunkKCL5AVML_cjs.setArkPsbtField(tx, index, chunkKCL5AVML_cjs.VtxoTaprootTree, tapTree);
4756
+ chunkOMPDPBT5_cjs.setArkPsbtField(tx, index, chunkOMPDPBT5_cjs.VtxoTaprootTree, tapTree);
4749
4757
  if (path.extraWitness?.length) {
4750
- chunkKCL5AVML_cjs.setArkPsbtField(tx, index, chunkKCL5AVML_cjs.ConditionWitness, path.extraWitness);
4758
+ chunkOMPDPBT5_cjs.setArkPsbtField(tx, index, chunkOMPDPBT5_cjs.ConditionWitness, path.extraWitness);
4751
4759
  }
4752
4760
  }
4753
4761
  function emulatorInputIndexes(tx) {
@@ -4794,7 +4802,7 @@ function isBoardingContract(contract, boardingCsv) {
4794
4802
  if (!isOnchainScoped(contract)) return false;
4795
4803
  if (contract.type === "boarding") return true;
4796
4804
  if (contract.type !== "default" || scopeOf(contract) !== "both") return false;
4797
- return chunkAMH7Q3DF_cjs.exitSequence(contract) === chunkFLPWNMX3_cjs.timelockToSequence(boardingCsv);
4805
+ return chunkMQUATTIM_cjs.exitSequence(contract) === chunkFLPWNMX3_cjs.timelockToSequence(boardingCsv);
4798
4806
  }
4799
4807
  function needsOnchainSweep(coin, contract, boardingCsv, tip, marginBlocks = DEFAULT_COSIGN_MARGIN_BLOCKS) {
4800
4808
  if (!isBoardingContract(contract, boardingCsv) || !isExplorerCoin(coin)) return false;
@@ -4806,7 +4814,7 @@ function needsOnchainSweep(coin, contract, boardingCsv, tip, marginBlocks = DEFA
4806
4814
  return left.remaining > margin && left.remaining <= margin + window2;
4807
4815
  }
4808
4816
  function finalizeOwnedInput(tx, index) {
4809
- const condition = chunkKCL5AVML_cjs.getArkPsbtFields(tx, index, chunkKCL5AVML_cjs.ConditionWitness)[0];
4817
+ const condition = chunkOMPDPBT5_cjs.getArkPsbtFields(tx, index, chunkOMPDPBT5_cjs.ConditionWitness)[0];
4810
4818
  if (!condition) {
4811
4819
  tx.finalizeIdx(index);
4812
4820
  return;
@@ -4829,27 +4837,27 @@ var DEFINITE_COSIGN_REJECTIONS = /* @__PURE__ */ new Set([
4829
4837
  "TX_TOO_LARGE"
4830
4838
  ]);
4831
4839
  function isCosignRejectedAfterSigning(e) {
4832
- return e instanceof chunkKCL5AVML_cjs.OnchainCosignRejectedError && !isCosignFallback(e);
4840
+ return e instanceof chunkOMPDPBT5_cjs.OnchainCosignRejectedError && !isCosignFallback(e);
4833
4841
  }
4834
4842
  function isCosignFallback(e) {
4835
- if (e instanceof chunkKCL5AVML_cjs.OnchainCosignRejectedError) {
4843
+ if (e instanceof chunkOMPDPBT5_cjs.OnchainCosignRejectedError) {
4836
4844
  return !!e.arkErrorName && DEFINITE_COSIGN_REJECTIONS.has(e.arkErrorName);
4837
4845
  }
4838
- return e instanceof chunkKCL5AVML_cjs.OnchainCosignUnsupportedError || e instanceof OnchainCosignPreflightError;
4846
+ return e instanceof chunkOMPDPBT5_cjs.OnchainCosignUnsupportedError || e instanceof OnchainCosignPreflightError;
4839
4847
  }
4840
4848
  function rehydrateCosignError(e) {
4841
- if (!(e instanceof Error) || e instanceof chunkKCL5AVML_cjs.OnchainCosignRejectedError || e instanceof chunkKCL5AVML_cjs.OnchainCosignAmbiguousError || e instanceof chunkKCL5AVML_cjs.OnchainCosignUnsupportedError || e instanceof OnchainCosignPreflightError) {
4849
+ if (!(e instanceof Error) || e instanceof chunkOMPDPBT5_cjs.OnchainCosignRejectedError || e instanceof chunkOMPDPBT5_cjs.OnchainCosignAmbiguousError || e instanceof chunkOMPDPBT5_cjs.OnchainCosignUnsupportedError || e instanceof OnchainCosignPreflightError) {
4842
4850
  return e;
4843
4851
  }
4844
4852
  const { message } = e;
4845
- if (message.startsWith(chunkKCL5AVML_cjs.ONCHAIN_COSIGN_REJECTED_PREFIX)) {
4846
- const rest = message.slice(chunkKCL5AVML_cjs.ONCHAIN_COSIGN_REJECTED_PREFIX.length);
4853
+ if (message.startsWith(chunkOMPDPBT5_cjs.ONCHAIN_COSIGN_REJECTED_PREFIX)) {
4854
+ const rest = message.slice(chunkOMPDPBT5_cjs.ONCHAIN_COSIGN_REJECTED_PREFIX.length);
4847
4855
  const named = rest.match(/^\[([A-Z0-9_]+)\] ([\s\S]*)$/);
4848
- return named ? new chunkKCL5AVML_cjs.OnchainCosignRejectedError(named[2], named[1]) : new chunkKCL5AVML_cjs.OnchainCosignRejectedError(rest);
4856
+ return named ? new chunkOMPDPBT5_cjs.OnchainCosignRejectedError(named[2], named[1]) : new chunkOMPDPBT5_cjs.OnchainCosignRejectedError(rest);
4849
4857
  }
4850
- if (message.startsWith(chunkKCL5AVML_cjs.ONCHAIN_COSIGN_AMBIGUOUS_PREFIX)) {
4851
- return new chunkKCL5AVML_cjs.OnchainCosignAmbiguousError(
4852
- message.slice(chunkKCL5AVML_cjs.ONCHAIN_COSIGN_AMBIGUOUS_PREFIX.length)
4858
+ if (message.startsWith(chunkOMPDPBT5_cjs.ONCHAIN_COSIGN_AMBIGUOUS_PREFIX)) {
4859
+ return new chunkOMPDPBT5_cjs.OnchainCosignAmbiguousError(
4860
+ message.slice(chunkOMPDPBT5_cjs.ONCHAIN_COSIGN_AMBIGUOUS_PREFIX.length)
4853
4861
  );
4854
4862
  }
4855
4863
  if (message.startsWith(ONCHAIN_COSIGN_PREFLIGHT_PREFIX)) {
@@ -4857,8 +4865,8 @@ function rehydrateCosignError(e) {
4857
4865
  message.slice(ONCHAIN_COSIGN_PREFLIGHT_PREFIX.length)
4858
4866
  );
4859
4867
  }
4860
- if (message.startsWith(chunkKCL5AVML_cjs.ONCHAIN_COSIGN_UNSUPPORTED_PREFIX))
4861
- return new chunkKCL5AVML_cjs.OnchainCosignUnsupportedError();
4868
+ if (message.startsWith(chunkOMPDPBT5_cjs.ONCHAIN_COSIGN_UNSUPPORTED_PREFIX))
4869
+ return new chunkOMPDPBT5_cjs.OnchainCosignUnsupportedError();
4862
4870
  return e;
4863
4871
  }
4864
4872
  function estimateOnchainCosignFee(nIn, nOut, feeRate) {
@@ -4874,13 +4882,13 @@ async function submitOnchainSpend(tx, arkInputs, deps) {
4874
4882
  throw new Error("emulator inputs present but no emulator provider configured");
4875
4883
  }
4876
4884
  const { signedTx } = await deps.emulator.submitOnchainTx(base.base64.encode(tx.toPSBT()));
4877
- tx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(signedTx));
4885
+ tx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(signedTx));
4878
4886
  }
4879
4887
  if (arkInputs.size > 0) {
4880
4888
  if (!deps.arkProvider) {
4881
4889
  throw new Error("arkd-cosigned inputs present but no arkProvider configured");
4882
4890
  }
4883
- if (!deps.arkProvider.cosignOnchainTx) throw new chunkKCL5AVML_cjs.OnchainCosignUnsupportedError();
4891
+ if (!deps.arkProvider.cosignOnchainTx) throw new chunkOMPDPBT5_cjs.OnchainCosignUnsupportedError();
4884
4892
  return deps.arkProvider.cosignOnchainTx(base.base64.encode(tx.toPSBT()));
4885
4893
  }
4886
4894
  for (let i = 0; i < tx.inputsLength; i++) {
@@ -5031,7 +5039,7 @@ function parseProgram(text, env) {
5031
5039
 
5032
5040
  // src/contracts/spendability.ts
5033
5041
  function isContractGenericallySpendable(contract) {
5034
- return chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
5042
+ return chunkMQUATTIM_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
5035
5043
  }
5036
5044
  function gatedContracts(contracts) {
5037
5045
  const gated = /* @__PURE__ */ new Map();
@@ -5053,7 +5061,7 @@ function gateExclusion(gated) {
5053
5061
  return (vtxo) => {
5054
5062
  const type = gatedTypeOf(vtxo, gated);
5055
5063
  if (type === void 0) return void 0;
5056
- if (!chunkAMH7Q3DF_cjs.contractHandlers.has(type)) {
5064
+ if (!chunkMQUATTIM_cjs.contractHandlers.has(type)) {
5057
5065
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
5058
5066
  }
5059
5067
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -5089,7 +5097,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
5089
5097
  continue;
5090
5098
  }
5091
5099
  for (const v of vtxos) {
5092
- if (!chunkKCL5AVML_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
5100
+ if (!chunkOMPDPBT5_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
5093
5101
  out.add(`${v.txid}:${v.vout}`);
5094
5102
  }
5095
5103
  }
@@ -5131,14 +5139,14 @@ function byValueDescending(vtxos) {
5131
5139
  return [...vtxos].sort((a, b) => b.value - a.value);
5132
5140
  }
5133
5141
  async function fetchTimeHeight(wallet) {
5134
- return chunkKCL5AVML_cjs.resolveTimeHeight(wallet.onchainProvider);
5142
+ return chunkOMPDPBT5_cjs.resolveTimeHeight(wallet.onchainProvider);
5135
5143
  }
5136
5144
  function heldVtxosOf(wallet) {
5137
5145
  const held = wallet.getHeldVtxos;
5138
5146
  return typeof held === "function" ? held.call(wallet) : Promise.resolve([]);
5139
5147
  }
5140
5148
  function canMigrateBySend(vtxo, now) {
5141
- if (!chunkKCL5AVML_cjs.canSpendOffchain(vtxo, now)) return false;
5149
+ if (!chunkOMPDPBT5_cjs.canSpendOffchain(vtxo, now)) return false;
5142
5150
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
5143
5151
  }
5144
5152
  function byExpiryAscending(vtxos, now) {
@@ -5146,7 +5154,7 @@ function byExpiryAscending(vtxos, now) {
5146
5154
  if (vtxo.isSwept) return -Infinity;
5147
5155
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
5148
5156
  if (vtxo.expiresAtHeight !== void 0) {
5149
- return chunkKCL5AVML_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
5157
+ return chunkOMPDPBT5_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
5150
5158
  }
5151
5159
  return Infinity;
5152
5160
  };
@@ -5173,7 +5181,7 @@ function priceSettlementInputs(vtxos, estimator) {
5173
5181
  const payable = [];
5174
5182
  const net = /* @__PURE__ */ new Map();
5175
5183
  for (const vtxo of vtxos) {
5176
- const inputFee = estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(vtxo));
5184
+ const inputFee = estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(vtxo));
5177
5185
  if (inputFee.satoshis >= vtxo.value) {
5178
5186
  continue;
5179
5187
  }
@@ -5253,10 +5261,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
5253
5261
  };
5254
5262
  function getRecoverableVtxos(vtxos, dustAmount, now) {
5255
5263
  return vtxos.filter((vtxo) => {
5256
- if (chunkKCL5AVML_cjs.canRecoverOnchain(vtxo, now)) {
5264
+ if (chunkOMPDPBT5_cjs.canRecoverOnchain(vtxo, now)) {
5257
5265
  return true;
5258
5266
  }
5259
- if (chunkKCL5AVML_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
5267
+ if (chunkOMPDPBT5_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
5260
5268
  return true;
5261
5269
  }
5262
5270
  return false;
@@ -5288,7 +5296,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
5288
5296
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
5289
5297
  if (vtxo.isUnrolled) return false;
5290
5298
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
5291
- const expiresAt = chunkKCL5AVML_cjs.normalizeVtxo(vtxo).expiresAt;
5299
+ const expiresAt = chunkOMPDPBT5_cjs.normalizeVtxo(vtxo).expiresAt;
5292
5300
  if (expiresAt === void 0) return false;
5293
5301
  const now = Date.now();
5294
5302
  const batchExpiry = expiresAt.getTime();
@@ -5299,7 +5307,7 @@ function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
5299
5307
  return vtxos.filter(
5300
5308
  // The leading exclusion covers the `isSubdust` arm too, which is a value
5301
5309
  // property and would otherwise re-admit an exited coin on its own.
5302
- (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkKCL5AVML_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
5310
+ (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkOMPDPBT5_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
5303
5311
  );
5304
5312
  }
5305
5313
  function isMigrationCapable(wallet) {
@@ -5359,7 +5367,7 @@ var VtxoManager = class _VtxoManager {
5359
5367
  constructor(wallet, settlementConfig) {
5360
5368
  this.wallet = wallet;
5361
5369
  if (settlementConfig !== false) {
5362
- chunkKCL5AVML_cjs.assertTimerMs("pollIntervalMs", settlementConfig?.pollIntervalMs);
5370
+ chunkOMPDPBT5_cjs.assertTimerMs("pollIntervalMs", settlementConfig?.pollIntervalMs);
5363
5371
  }
5364
5372
  this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
5365
5373
  this.contractEventsSubscriptionReady = this.initializeSubscription();
@@ -5671,7 +5679,7 @@ var VtxoManager = class _VtxoManager {
5671
5679
  * {@link recoverImportedContracts}).
5672
5680
  */
5673
5681
  async recoverOneImportedContract(wallet, contract, vtxos, info, dustAmount) {
5674
- const recoverable = vtxos.filter((vtxo) => vtxo.isSwept && !chunkKCL5AVML_cjs.isVtxoSpent(vtxo));
5682
+ const recoverable = vtxos.filter((vtxo) => vtxo.isSwept && !chunkOMPDPBT5_cjs.isVtxoSpent(vtxo));
5675
5683
  const estimator = new Estimator(info?.fees.intentFee ?? {});
5676
5684
  const { payable, net } = priceSettlementInputs(recoverable, estimator);
5677
5685
  const vtxoMaxAmount = info?.vtxoMaxAmount ?? -1n;
@@ -5685,15 +5693,27 @@ var VtxoManager = class _VtxoManager {
5685
5693
  const arkAddress = await wallet.getAddress();
5686
5694
  const totalAmount = deductOffchainOutputFee(subtotal, estimator, arkAddress);
5687
5695
  if (totalAmount < dustAmount) return;
5688
- await wallet.settle({
5696
+ const settledTxid = await wallet.settle({
5689
5697
  inputs: batch,
5690
5698
  outputs: [{ address: arkAddress, amount: totalAmount }]
5691
5699
  });
5700
+ try {
5701
+ await wallet.correlateArkadeCashRecovery?.(
5702
+ contract.script,
5703
+ settledTxid,
5704
+ Number(totalAmount)
5705
+ );
5706
+ } catch (error) {
5707
+ console.error(
5708
+ `Failed to record arkcash recovery ${settledTxid} for ${contract.script}:`,
5709
+ error
5710
+ );
5711
+ }
5692
5712
  }
5693
5713
  if (vtxos.length === 0) return;
5694
5714
  const spent = new Set(batch.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
5695
5715
  const stillSpendable = vtxos.some(
5696
- (vtxo) => !chunkKCL5AVML_cjs.isVtxoSpent(vtxo) && !spent.has(`${vtxo.txid}:${vtxo.vout}`)
5716
+ (vtxo) => !chunkOMPDPBT5_cjs.isVtxoSpent(vtxo) && !spent.has(`${vtxo.txid}:${vtxo.vout}`)
5697
5717
  );
5698
5718
  if (!stillSpendable) {
5699
5719
  await wallet.removeRecoveryContract(contract.script);
@@ -5935,7 +5955,7 @@ var VtxoManager = class _VtxoManager {
5935
5955
  return txid;
5936
5956
  } catch (e) {
5937
5957
  if (!isCosignFallback(e)) throw e;
5938
- if (e instanceof chunkKCL5AVML_cjs.OnchainCosignRejectedError) {
5958
+ if (e instanceof chunkOMPDPBT5_cjs.OnchainCosignRejectedError) {
5939
5959
  console.warn("Onchain cosign sweep rejected, falling back to CSV exit:", e.message);
5940
5960
  }
5941
5961
  return void 0;
@@ -6012,7 +6032,7 @@ var VtxoManager = class _VtxoManager {
6012
6032
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
6013
6033
  );
6014
6034
  }
6015
- const tx = new chunkKCL5AVML_cjs.Transaction();
6035
+ const tx = new chunkOMPDPBT5_cjs.Transaction();
6016
6036
  for (const { utxo, script, leaf } of inputs) {
6017
6037
  tx.addInput({
6018
6038
  txid: utxo.txid,
@@ -6250,8 +6270,8 @@ var VtxoManager = class _VtxoManager {
6250
6270
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
6251
6271
  if (cls.status === "CURRENT") continue;
6252
6272
  const live = vtxos.filter((v) => !v.isUnrolled);
6253
- const recoverable = live.filter((v) => v.isSwept && !chunkKCL5AVML_cjs.isVtxoSpent(v));
6254
- const spendable = live.filter((v) => !chunkKCL5AVML_cjs.isVtxoSpent(v) && !v.isSwept);
6273
+ const recoverable = live.filter((v) => v.isSwept && !chunkOMPDPBT5_cjs.isVtxoSpent(v));
6274
+ const spendable = live.filter((v) => !chunkOMPDPBT5_cjs.isVtxoSpent(v) && !v.isSwept);
6255
6275
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
6256
6276
  let recoverableCount = 0;
6257
6277
  let recoverableValue = 0;
@@ -6607,8 +6627,8 @@ var VtxoManager = class _VtxoManager {
6607
6627
  }
6608
6628
  /** The outpoint a `VTXO_ALREADY_SPENT` error carries in `metadata.vtxo_outpoint`, if any. */
6609
6629
  extractSpentOutpoint(error) {
6610
- const ark = chunkKCL5AVML_cjs.maybeArkError(error);
6611
- if (!chunkKCL5AVML_cjs.isArkError(ark, chunkKCL5AVML_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
6630
+ const ark = chunkOMPDPBT5_cjs.maybeArkError(error);
6631
+ if (!chunkOMPDPBT5_cjs.isArkError(ark, chunkOMPDPBT5_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
6612
6632
  const raw = ark.metadata?.vtxo_outpoint;
6613
6633
  if (typeof raw !== "string") return void 0;
6614
6634
  const [txid, voutStr] = raw.split(":");
@@ -6789,7 +6809,7 @@ var VtxoManager = class _VtxoManager {
6789
6809
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
6790
6810
  break;
6791
6811
  }
6792
- const inputFee = estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(v));
6812
+ const inputFee = estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(v));
6793
6813
  if (inputFee.satoshis >= v.value) {
6794
6814
  continue;
6795
6815
  }
@@ -7098,7 +7118,7 @@ var ArkadeCash = class _ArkadeCash {
7098
7118
  return SingleKey.fromPrivateKey(this._privateKey);
7099
7119
  }
7100
7120
  get vtxoScript() {
7101
- return new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
7121
+ return new chunkMQUATTIM_cjs.DefaultVtxo.Script({
7102
7122
  pubKey: this._publicKey,
7103
7123
  serverPubKey: this._serverPubKey,
7104
7124
  csvTimelock: this.csvTimelock
@@ -7108,16 +7128,100 @@ var ArkadeCash = class _ArkadeCash {
7108
7128
  return this.vtxoScript.address(addressHrp, this._serverPubKey);
7109
7129
  }
7110
7130
  };
7131
+ var ArkadeCashTracker = class {
7132
+ records = /* @__PURE__ */ new Map();
7133
+ get(id) {
7134
+ return this.records.get(id);
7135
+ }
7136
+ list() {
7137
+ return [...this.records.values()].sort((a, b) => b.createdAt - a.createdAt);
7138
+ }
7139
+ };
7140
+ function createArkadeCashTracker() {
7141
+ return new ArkadeCashTracker();
7142
+ }
7143
+ var unionByTxid = (a, b) => [
7144
+ ...new Map([...a, ...b].map((entry) => [entry.txid, entry])).values()
7145
+ ];
7146
+ function mergeArkadeCashRecord(prev, next) {
7147
+ if (!prev) return next;
7148
+ const lead = prev.action === "claimed" && next.action === "issued" ? prev : next;
7149
+ return {
7150
+ id: next.id,
7151
+ action: lead.action,
7152
+ outcome: lead.outcome,
7153
+ createdAt: Math.min(prev.createdAt, next.createdAt),
7154
+ issues: unionByTxid(prev.issues, next.issues),
7155
+ claims: unionByTxid(prev.claims, next.claims)
7156
+ };
7157
+ }
7158
+ function isArkadeCashRecord(value) {
7159
+ if (!value || typeof value !== "object") return false;
7160
+ const v = value;
7161
+ return typeof v.id === "string" && (v.action === "issued" || v.action === "claimed") && typeof v.createdAt === "number" && typeof v.outcome === "string" && Array.isArray(v.issues) && Array.isArray(v.claims);
7162
+ }
7163
+ function addArkadeCashRecord(records, record) {
7164
+ records.records.set(record.id, mergeArkadeCashRecord(records.get(record.id), record));
7165
+ }
7166
+ function arkadeCashId(cash) {
7167
+ return base.hex.encode(cash.vtxoScript.pkScript);
7168
+ }
7169
+ function arkadeCashResolver(records) {
7170
+ let index;
7171
+ const build = () => {
7172
+ const next = /* @__PURE__ */ new Map();
7173
+ for (const record of records.list()) {
7174
+ for (const { txid } of [...record.issues, ...record.claims]) {
7175
+ const touching = next.get(txid) ?? [];
7176
+ if (touching[touching.length - 1] !== record) touching.push(record);
7177
+ next.set(txid, touching);
7178
+ }
7179
+ }
7180
+ return next;
7181
+ };
7182
+ return {
7183
+ id: "arkade-cash",
7184
+ async prepare() {
7185
+ index = build();
7186
+ },
7187
+ resolve(tx) {
7188
+ if (tx.key.boardingTxid) return [];
7189
+ index ??= build();
7190
+ const txid = tx.key.arkTxid || tx.key.commitmentTxid;
7191
+ const isBatchRow = !tx.key.arkTxid;
7192
+ const direction = tx.type === "SENT" /* TxSent */ ? "issued" : "claimed";
7193
+ return (index.get(txid) ?? []).flatMap((record) => {
7194
+ const entries = direction === "issued" ? record.issues : record.claims;
7195
+ const match = entries.find(
7196
+ (entry) => entry.txid === txid && (!isBatchRow || entry.amount === tx.amount)
7197
+ );
7198
+ if (!match) return [];
7199
+ return [
7200
+ {
7201
+ groupId: `arkade-cash:${record.id}:${direction}`,
7202
+ label: direction === "issued" ? "Cash issued" : "Cash claimed",
7203
+ kind: "arkade-cash",
7204
+ outcome: record.outcome,
7205
+ metadata: { cashId: record.id, direction },
7206
+ amount: match.amount
7207
+ }
7208
+ ];
7209
+ });
7210
+ }
7211
+ };
7212
+ }
7213
+ async function arkadeCashActivity(records, txs) {
7214
+ const activities = await buildActivities(txs, [arkadeCashResolver(records)]);
7215
+ return activities.filter((activity) => activity.intent?.kind === "arkade-cash");
7216
+ }
7111
7217
 
7112
7218
  // src/wallet/intentReconciliation.ts
7113
- var NON_TERMINAL_INTENT_STATES = ALL_INTENT_STATES.filter(
7114
- (s) => !isTerminalIntentState(s)
7115
- );
7219
+ var NON_TERMINAL_INTENT_STATES = ALL_BATCH_REGISTRATION_STATES.filter((s) => !isTerminalBatchRegistrationState(s));
7116
7220
  function isConsumed(vtxo) {
7117
- return vtxo !== void 0 && chunkKCL5AVML_cjs.isVtxoSpent(vtxo);
7221
+ return vtxo !== void 0 && chunkOMPDPBT5_cjs.isVtxoSpent(vtxo);
7118
7222
  }
7119
7223
  async function classifyIntent(intent, vtxosByOutpoint, now) {
7120
- if (isTerminalIntentState(intent.state)) return void 0;
7224
+ if (isTerminalBatchRegistrationState(intent.state)) return void 0;
7121
7225
  const inputs = intent.proofInputs;
7122
7226
  const consumed = inputs.map((o) => vtxosByOutpoint.get(outpointKey(o)));
7123
7227
  if (inputs.length > 0 && consumed.every(isConsumed)) {
@@ -7140,7 +7244,7 @@ async function reconcileIntents(deps) {
7140
7244
  const now = deps.now ?? Date.now;
7141
7245
  let intents;
7142
7246
  try {
7143
- intents = await collectIntents(deps.intentRepository, {
7247
+ intents = await collectBatchRegistrations(deps.intentRepository, {
7144
7248
  states: [...NON_TERMINAL_INTENT_STATES]
7145
7249
  });
7146
7250
  } catch (e) {
@@ -7152,7 +7256,7 @@ async function reconcileIntents(deps) {
7152
7256
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
7153
7257
  if (outpoints.length > 0) {
7154
7258
  try {
7155
- const { vtxos } = await chunkKCL5AVML_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
7259
+ const { vtxos } = await chunkOMPDPBT5_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
7156
7260
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
7157
7261
  } catch (e) {
7158
7262
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -7165,7 +7269,7 @@ async function reconcileIntents(deps) {
7165
7269
  if (isInFlight(intent, deps)) continue;
7166
7270
  const next = await classifyIntent(intent, vtxosByOutpoint, nowMs) ?? await releaseFromServer(intent, deps, nowMs);
7167
7271
  if (!next) continue;
7168
- const [fresh] = await collectIntents(deps.intentRepository, {
7272
+ const [fresh] = await collectBatchRegistrations(deps.intentRepository, {
7169
7273
  proofTxIds: [intent.proofTxId]
7170
7274
  });
7171
7275
  if (!fresh || fresh.state !== intent.state) continue;
@@ -7178,7 +7282,7 @@ async function reconcileIntents(deps) {
7178
7282
  async function releaseIntents(deps) {
7179
7283
  let intents;
7180
7284
  try {
7181
- intents = await collectIntents(deps.intentRepository, {
7285
+ intents = await collectBatchRegistrations(deps.intentRepository, {
7182
7286
  states: [...NON_TERMINAL_INTENT_STATES]
7183
7287
  });
7184
7288
  } catch (e) {
@@ -7212,7 +7316,7 @@ async function releaseFromServer(intent, deps, now) {
7212
7316
  });
7213
7317
  }
7214
7318
  function isNoMatchingIntentsError(e) {
7215
- return chunkKCL5AVML_cjs.isArkError(e, chunkKCL5AVML_cjs.ArkErrorName.INVALID_INTENT_PROOF) && e.message.includes("no matching intents found");
7319
+ return chunkOMPDPBT5_cjs.isArkError(e, chunkOMPDPBT5_cjs.ArkErrorName.INVALID_INTENT_PROOF) && e.message.includes("no matching intents found");
7216
7320
  }
7217
7321
  function terminal(intent, state, now, patch) {
7218
7322
  return { ...intent, ...patch, state, updatedAt: now };
@@ -7234,7 +7338,7 @@ function dedupeOutpoints(outpoints) {
7234
7338
 
7235
7339
  // src/wallet/intentStateReducer.ts
7236
7340
  function reduceIntentState(current, event) {
7237
- if (isTerminalIntentState(current)) return current;
7341
+ if (isTerminalBatchRegistrationState(current)) return current;
7238
7342
  switch (event.type) {
7239
7343
  case "batch_started" /* BatchStarted */:
7240
7344
  return "batch_in_progress";
@@ -7267,7 +7371,7 @@ async function persistTransition(deps, event) {
7267
7371
  const repo = deps.intentRepository;
7268
7372
  if (!repo) return;
7269
7373
  try {
7270
- const cur = (await collectIntents(repo, { proofTxIds: [deps.intentTxId] }))[0];
7374
+ const cur = (await collectBatchRegistrations(repo, { proofTxIds: [deps.intentTxId] }))[0];
7271
7375
  if (!cur) return;
7272
7376
  const next = applySettlementEventToIntent(cur, event);
7273
7377
  if (next) await repo.saveBatchRegistration(next);
@@ -7439,7 +7543,7 @@ async function captureExitBranch(params) {
7439
7543
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
7440
7544
  if (nonCommitment.length > 0) {
7441
7545
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
7442
- psbtByTxid.set(chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
7546
+ psbtByTxid.set(chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
7443
7547
  }
7444
7548
  }
7445
7549
  }
@@ -7482,10 +7586,10 @@ var IndexerExitDataSource = class {
7482
7586
  while (hasMore) {
7483
7587
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
7484
7588
  { txid: vtxo.txid, vout: vtxo.vout },
7485
- { pageIndex, pageSize: chunkKCL5AVML_cjs.DEFAULT_PAGE_SIZE }
7589
+ { pageIndex, pageSize: chunkOMPDPBT5_cjs.DEFAULT_PAGE_SIZE }
7486
7590
  );
7487
7591
  chain.push(...page);
7488
- hasMore = meta ? page.length === chunkKCL5AVML_cjs.DEFAULT_PAGE_SIZE : false;
7592
+ hasMore = meta ? page.length === chunkOMPDPBT5_cjs.DEFAULT_PAGE_SIZE : false;
7489
7593
  pageIndex++;
7490
7594
  }
7491
7595
  return chain;
@@ -7497,12 +7601,12 @@ var IndexerExitDataSource = class {
7497
7601
  while (hasMore) {
7498
7602
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
7499
7603
  pageIndex,
7500
- pageSize: chunkKCL5AVML_cjs.DEFAULT_PAGE_SIZE
7604
+ pageSize: chunkOMPDPBT5_cjs.DEFAULT_PAGE_SIZE
7501
7605
  });
7502
7606
  for (const psbt of txs) {
7503
- out.set(chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
7607
+ out.set(chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
7504
7608
  }
7505
- hasMore = page ? txs.length === chunkKCL5AVML_cjs.DEFAULT_PAGE_SIZE : false;
7609
+ hasMore = page ? txs.length === chunkOMPDPBT5_cjs.DEFAULT_PAGE_SIZE : false;
7506
7610
  pageIndex++;
7507
7611
  }
7508
7612
  return out;
@@ -7523,7 +7627,7 @@ function chainedTxTypeToChainTxType(t) {
7523
7627
  }
7524
7628
  }
7525
7629
  function psbtInputTxids(psbtBase64) {
7526
- return txInputTxids(chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
7630
+ return txInputTxids(chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
7527
7631
  }
7528
7632
  function txInputTxids(tx) {
7529
7633
  const ids = [];
@@ -7830,10 +7934,10 @@ async function resolveArkInfo(arkProvider, walletRepository, opts) {
7830
7934
  try {
7831
7935
  info = await arkProvider.getInfo();
7832
7936
  } catch (err) {
7833
- if (opts?.requireLive || !chunkKCL5AVML_cjs.isRetryableProviderError(err)) throw err;
7937
+ if (opts?.requireLive || !chunkOMPDPBT5_cjs.isRetryableProviderError(err)) throw err;
7834
7938
  const snapshot = await loadArkInfoSnapshot(walletRepository);
7835
7939
  if (!snapshot) {
7836
- throw new chunkKCL5AVML_cjs.ProviderUnavailableError(
7940
+ throw new chunkOMPDPBT5_cjs.ProviderUnavailableError(
7837
7941
  "Operator info is unavailable and no cached snapshot exists",
7838
7942
  { cause: err }
7839
7943
  );
@@ -8025,7 +8129,7 @@ function buildGraph(rootTxid, chunksByTxid) {
8025
8129
  return new TxTree(rootTx, children);
8026
8130
  }
8027
8131
  function decodeNode(chunk) {
8028
- const tx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(chunk.tx));
8132
+ const tx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(chunk.tx));
8029
8133
  return { tx, children: chunk.children };
8030
8134
  }
8031
8135
  exports.Batch = void 0;
@@ -8249,7 +8353,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos, localCreatedAt) {
8249
8353
  return [...txids];
8250
8354
  }
8251
8355
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt, gatedScripts = /* @__PURE__ */ new Map()) {
8252
- const normalized = vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
8356
+ const normalized = vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
8253
8357
  const localCreatedAt = localCreatedAtByTxid(normalized);
8254
8358
  const gatedVtxos = normalized.filter((vtxo) => isGatedVtxo(vtxo, gatedScripts));
8255
8359
  const ownVtxos = normalized.filter((vtxo) => !isGatedVtxo(vtxo, gatedScripts));
@@ -8436,7 +8540,7 @@ var AssetManager = class extends ReadonlyAssetManager {
8436
8540
  withRecoverable: false,
8437
8541
  genericallySpendableOnly: true
8438
8542
  });
8439
- const controlAssetRef = params.controlAssetId ? chunkXWUCNMPN_cjs.AssetRef.fromId(chunkXWUCNMPN_cjs.AssetId.fromString(params.controlAssetId)) : null;
8543
+ const controlAssetRef = params.controlAssetId ? chunk3NALVGMJ_cjs.AssetRef.fromId(chunk3NALVGMJ_cjs.AssetId.fromString(params.controlAssetId)) : null;
8440
8544
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
8441
8545
  let totalBtcSelected = 0n;
8442
8546
  const assetChanges = /* @__PURE__ */ new Map();
@@ -8449,8 +8553,8 @@ var AssetManager = class extends ReadonlyAssetManager {
8449
8553
  }
8450
8554
  }
8451
8555
  const groups = [];
8452
- const issuedAssetOutput = chunkXWUCNMPN_cjs.AssetOutput.create(0, params.amount);
8453
- const issuedAssetGroup = chunkXWUCNMPN_cjs.AssetGroup.create(
8556
+ const issuedAssetOutput = chunk3NALVGMJ_cjs.AssetOutput.create(0, params.amount);
8557
+ const issuedAssetGroup = chunk3NALVGMJ_cjs.AssetGroup.create(
8454
8558
  null,
8455
8559
  controlAssetRef,
8456
8560
  [],
@@ -8463,11 +8567,11 @@ var AssetManager = class extends ReadonlyAssetManager {
8463
8567
  for (const [assetId, amount] of assetChanges) {
8464
8568
  const changeInputs = inputsForAsset(assetInputs, assetId);
8465
8569
  groups.push(
8466
- chunkXWUCNMPN_cjs.AssetGroup.create(
8467
- chunkXWUCNMPN_cjs.AssetId.fromString(assetId),
8570
+ chunk3NALVGMJ_cjs.AssetGroup.create(
8571
+ chunk3NALVGMJ_cjs.AssetId.fromString(assetId),
8468
8572
  null,
8469
8573
  changeInputs,
8470
- [chunkXWUCNMPN_cjs.AssetOutput.create(0, amount)],
8574
+ [chunk3NALVGMJ_cjs.AssetOutput.create(0, amount)],
8471
8575
  []
8472
8576
  )
8473
8577
  );
@@ -8482,7 +8586,7 @@ var AssetManager = class extends ReadonlyAssetManager {
8482
8586
  );
8483
8587
  return {
8484
8588
  arkTxId: arkTxid,
8485
- assetId: chunkXWUCNMPN_cjs.AssetId.create(arkTxid, 0).toString()
8589
+ assetId: chunk3NALVGMJ_cjs.AssetId.create(arkTxid, 0).toString()
8486
8590
  };
8487
8591
  }
8488
8592
  /**
@@ -8556,23 +8660,23 @@ var AssetManager = class extends ReadonlyAssetManager {
8556
8660
  const assetInputs = selectedCoinsToAssetInputs(selectedCoins);
8557
8661
  const reissueInputs = inputsForAsset(assetInputs, params.assetId);
8558
8662
  const totalAssetAmount = assetToReissueAmount + params.amount;
8559
- const reissueAssetIdObj = chunkXWUCNMPN_cjs.AssetId.fromString(params.assetId);
8560
- const reissueAssetGroup = chunkXWUCNMPN_cjs.AssetGroup.create(
8663
+ const reissueAssetIdObj = chunk3NALVGMJ_cjs.AssetId.fromString(params.assetId);
8664
+ const reissueAssetGroup = chunk3NALVGMJ_cjs.AssetGroup.create(
8561
8665
  reissueAssetIdObj,
8562
8666
  null,
8563
8667
  reissueInputs,
8564
- [chunkXWUCNMPN_cjs.AssetOutput.create(0, totalAssetAmount)],
8668
+ [chunk3NALVGMJ_cjs.AssetOutput.create(0, totalAssetAmount)],
8565
8669
  []
8566
8670
  );
8567
8671
  const groups = [reissueAssetGroup];
8568
8672
  for (const [assetId, amount] of assetChanges) {
8569
8673
  const changeInputs = inputsForAsset(assetInputs, assetId);
8570
8674
  groups.push(
8571
- chunkXWUCNMPN_cjs.AssetGroup.create(
8572
- chunkXWUCNMPN_cjs.AssetId.fromString(assetId),
8675
+ chunk3NALVGMJ_cjs.AssetGroup.create(
8676
+ chunk3NALVGMJ_cjs.AssetId.fromString(assetId),
8573
8677
  null,
8574
8678
  changeInputs,
8575
- [chunkXWUCNMPN_cjs.AssetOutput.create(0, amount)],
8679
+ [chunk3NALVGMJ_cjs.AssetOutput.create(0, amount)],
8576
8680
  []
8577
8681
  )
8578
8682
  );
@@ -8643,11 +8747,11 @@ var AssetManager = class extends ReadonlyAssetManager {
8643
8747
  for (const [assetId, amount] of assetChanges) {
8644
8748
  const changeInputs = inputsForAsset(assetInputs, assetId);
8645
8749
  groups.push(
8646
- chunkXWUCNMPN_cjs.AssetGroup.create(
8647
- chunkXWUCNMPN_cjs.AssetId.fromString(assetId),
8750
+ chunk3NALVGMJ_cjs.AssetGroup.create(
8751
+ chunk3NALVGMJ_cjs.AssetId.fromString(assetId),
8648
8752
  null,
8649
8753
  changeInputs,
8650
- amount > 0n ? [chunkXWUCNMPN_cjs.AssetOutput.create(0, amount)] : [],
8754
+ amount > 0n ? [chunk3NALVGMJ_cjs.AssetOutput.create(0, amount)] : [],
8651
8755
  []
8652
8756
  )
8653
8757
  );
@@ -8660,7 +8764,7 @@ function inputsForAsset(assetInputs, assetId) {
8660
8764
  for (const [inputIndex, assets] of assetInputs) {
8661
8765
  for (const asset of assets) {
8662
8766
  if (asset.assetId !== assetId) continue;
8663
- inputs.push(chunkXWUCNMPN_cjs.AssetInput.create(inputIndex, asset.amount));
8767
+ inputs.push(chunk3NALVGMJ_cjs.AssetInput.create(inputIndex, asset.amount));
8664
8768
  }
8665
8769
  }
8666
8770
  return inputs;
@@ -8669,7 +8773,7 @@ async function submitToSelf(submit, wallet, inputs, amount, groups) {
8669
8773
  const outputAddress = chunkFLPWNMX3_cjs.ArkAddress.decode(await wallet.getAddress());
8670
8774
  const outputs = [
8671
8775
  { script: outputAddress.pkScript, amount: BigInt(amount) },
8672
- Extension.create([chunkXWUCNMPN_cjs.Packet.create(groups)]).txOut()
8776
+ Extension.create([chunk3NALVGMJ_cjs.Packet.create(groups)]).txOut()
8673
8777
  ];
8674
8778
  const { arkTxid } = await submit(inputs, outputs);
8675
8779
  return arkTxid;
@@ -8693,7 +8797,7 @@ function castMetadata(metadata) {
8693
8797
  } else {
8694
8798
  throw new Error("Invalid metadata value type");
8695
8799
  }
8696
- md.push(chunkXWUCNMPN_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
8800
+ md.push(chunk3NALVGMJ_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
8697
8801
  }
8698
8802
  return md;
8699
8803
  }
@@ -8719,7 +8823,7 @@ var DelegateManagerImpl = class {
8719
8823
  this.arkInfoProvider.getInfo(),
8720
8824
  this.delegateProvider.getDelegateInfo()
8721
8825
  ]);
8722
- const eligible = vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo).filter(
8826
+ const eligible = vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo).filter(
8723
8827
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
8724
8828
  );
8725
8829
  if (eligible.length === 0) {
@@ -8751,7 +8855,7 @@ var DelegateManagerImpl = class {
8751
8855
  const groupByExpiry = /* @__PURE__ */ new Map();
8752
8856
  let recoverableVtxos = [];
8753
8857
  for (const vtxo of eligible) {
8754
- if (chunkKCL5AVML_cjs.canRecoverOnchain(vtxo, now)) {
8858
+ if (chunkOMPDPBT5_cjs.canRecoverOnchain(vtxo, now)) {
8755
8859
  recoverableVtxos.push(vtxo);
8756
8860
  continue;
8757
8861
  }
@@ -8803,7 +8907,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8803
8907
  }
8804
8908
  if (!delegateAt) {
8805
8909
  const now = { timestamp: /* @__PURE__ */ new Date() };
8806
- const expiryTimestamp = vtxos.filter((coin) => !chunkKCL5AVML_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
8910
+ const expiryTimestamp = vtxos.filter((coin) => !chunkOMPDPBT5_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
8807
8911
  (min, coin) => Math.min(min, coin.expiresAt.getTime()),
8808
8912
  Number.MAX_SAFE_INTEGER
8809
8913
  );
@@ -8823,7 +8927,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8823
8927
  let amount = 0n;
8824
8928
  for (const coin of vtxos) {
8825
8929
  const inputFee = estimator.evalOffchainInput({
8826
- ...chunkKCL5AVML_cjs.toOffchainInputFeeParams(coin),
8930
+ ...chunkOMPDPBT5_cjs.toOffchainInputFeeParams(coin),
8827
8931
  type: "vtxo"
8828
8932
  });
8829
8933
  if (inputFee.satoshis >= coin.value) {
@@ -8873,7 +8977,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8873
8977
  btcSigner.Address(chunkFLPWNMX3_cjs.getNetwork(network)).decode(forfeitAddress)
8874
8978
  );
8875
8979
  const forfeits = await Promise.all(
8876
- vtxos.filter((v) => chunkKCL5AVML_cjs.requiresForfeit(v)).map(async (coin) => {
8980
+ vtxos.filter((v) => chunkOMPDPBT5_cjs.requiresForfeit(v)).map(async (coin) => {
8877
8981
  const forfeit = await makeDelegateForfeitTx(
8878
8982
  coin,
8879
8983
  dust,
@@ -8956,7 +9060,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
8956
9060
  expire_at: 0,
8957
9061
  cosigners_public_keys: cosignerPubKeys
8958
9062
  };
8959
- const proof = chunkKCL5AVML_cjs.Proof.create(message, coins, outputs);
9063
+ const proof = chunkOMPDPBT5_cjs.Proof.create(message, coins, outputs);
8960
9064
  const signedProof = await identity.sign(proof);
8961
9065
  return {
8962
9066
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -9019,7 +9123,8 @@ var InMemoryBatchRegistrationRepository = class {
9019
9123
  async getLockedVtxoOutpoints() {
9020
9124
  const out = [];
9021
9125
  for (const i of this.byId.values())
9022
- if (!isTerminalIntentState(i.state)) for (const o of i.proofInputs) out.push({ ...o });
9126
+ if (!isTerminalBatchRegistrationState(i.state))
9127
+ for (const o of i.proofInputs) out.push({ ...o });
9023
9128
  return out;
9024
9129
  }
9025
9130
  /** @deprecated Use {@link saveBatchRegistration}. */
@@ -9512,7 +9617,8 @@ var IndexedDBBatchRegistrationRepository = class {
9512
9617
  const all = await promisifyRequest(store.getAll());
9513
9618
  const out = [];
9514
9619
  for (const i of all)
9515
- if (!isTerminalIntentState(i.state)) for (const o of i.intentVtxos) out.push(o);
9620
+ if (!isTerminalBatchRegistrationState(i.state))
9621
+ for (const o of i.intentVtxos) out.push(o);
9516
9622
  return out;
9517
9623
  }
9518
9624
  /** @deprecated Use {@link saveBatchRegistration}. */
@@ -9696,7 +9802,7 @@ function decodeArkContract(encoded) {
9696
9802
  }
9697
9803
  function contractFromArkContract(encoded, options = {}) {
9698
9804
  const parsed = decodeArkContract(encoded);
9699
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(parsed.type);
9805
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(parsed.type);
9700
9806
  if (!handler) {
9701
9807
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
9702
9808
  }
@@ -9712,7 +9818,7 @@ function contractFromArkContract(encoded, options = {}) {
9712
9818
  }
9713
9819
  function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkFLPWNMX3_cjs.DEFAULT_NETWORK.hrp, options = {}) {
9714
9820
  const parsed = decodeArkContract(encoded);
9715
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.getOrThrow(parsed.type);
9821
+ const handler = chunkMQUATTIM_cjs.contractHandlers.getOrThrow(parsed.type);
9716
9822
  const params = parsed.data;
9717
9823
  const vtxoScript = handler.createScript(params);
9718
9824
  return {
@@ -9769,10 +9875,10 @@ var ContractWatcher = class {
9769
9875
  eventSourceReported = false;
9770
9876
  /** @see ContractWatcherConfig */
9771
9877
  constructor(config) {
9772
- chunkKCL5AVML_cjs.assertTimerMs("failsafePollIntervalMs", config.failsafePollIntervalMs);
9773
- chunkKCL5AVML_cjs.assertTimerMs("reconnectDelayMs", config.reconnectDelayMs);
9774
- chunkKCL5AVML_cjs.assertTimerMs("maxReconnectDelayMs", config.maxReconnectDelayMs);
9775
- chunkKCL5AVML_cjs.assertTimerMs("subscriptionRequestTimeoutMs", config.subscriptionRequestTimeoutMs);
9878
+ chunkOMPDPBT5_cjs.assertTimerMs("failsafePollIntervalMs", config.failsafePollIntervalMs);
9879
+ chunkOMPDPBT5_cjs.assertTimerMs("reconnectDelayMs", config.reconnectDelayMs);
9880
+ chunkOMPDPBT5_cjs.assertTimerMs("maxReconnectDelayMs", config.maxReconnectDelayMs);
9881
+ chunkOMPDPBT5_cjs.assertTimerMs("subscriptionRequestTimeoutMs", config.subscriptionRequestTimeoutMs);
9776
9882
  if (config.subscriptionRequestTimeoutMs === 0) {
9777
9883
  throw new Error("subscriptionRequestTimeoutMs must be greater than 0");
9778
9884
  }
@@ -9995,9 +10101,9 @@ var ContractWatcher = class {
9995
10101
  this.reconnectAttempts = 0;
9996
10102
  this.listenLoop().catch((e) => {
9997
10103
  if (!this.isWatching || signal?.aborted) return;
9998
- if (chunkKCL5AVML_cjs.isEventSourceError(e)) {
10104
+ if (chunkOMPDPBT5_cjs.isEventSourceError(e)) {
9999
10105
  console.debug("ContractWatcher subscription disconnected; reconnecting");
10000
- } else if (!chunkKCL5AVML_cjs.isEventSourceUnavailableError(e)) {
10106
+ } else if (!chunkOMPDPBT5_cjs.isEventSourceUnavailableError(e)) {
10001
10107
  console.error(e);
10002
10108
  }
10003
10109
  this.connectionState = "disconnected";
@@ -10007,7 +10113,7 @@ var ContractWatcher = class {
10007
10113
  });
10008
10114
  } catch (error) {
10009
10115
  if (!this.isWatching || signal?.aborted) return;
10010
- if (!chunkKCL5AVML_cjs.isEventSourceUnavailableError(error)) {
10116
+ if (!chunkOMPDPBT5_cjs.isEventSourceUnavailableError(error)) {
10011
10117
  console.error("ContractWatcher connection failed:", error);
10012
10118
  }
10013
10119
  this.connectionState = "disconnected";
@@ -10023,7 +10129,7 @@ var ContractWatcher = class {
10023
10129
  * few seconds.
10024
10130
  */
10025
10131
  reportEventSourceUnavailable(error) {
10026
- if (!chunkKCL5AVML_cjs.isEventSourceUnavailableError(error)) return false;
10132
+ if (!chunkOMPDPBT5_cjs.isEventSourceUnavailableError(error)) return false;
10027
10133
  if (!this.eventSourceReported) {
10028
10134
  this.eventSourceReported = true;
10029
10135
  console.warn(
@@ -10088,7 +10194,7 @@ var ContractWatcher = class {
10088
10194
  const now = Date.now();
10089
10195
  let current;
10090
10196
  try {
10091
- current = await chunkKCL5AVML_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
10197
+ current = await chunkOMPDPBT5_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
10092
10198
  spendableOnly: true
10093
10199
  });
10094
10200
  } catch (error) {
@@ -10370,14 +10476,14 @@ var ContractWatcher = class {
10370
10476
  const timestamp = Date.now();
10371
10477
  if (update.newVtxos?.length) {
10372
10478
  this.processSubscriptionVtxos(
10373
- update.newVtxos.map(chunkKCL5AVML_cjs.normalizeVtxo),
10479
+ update.newVtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo),
10374
10480
  "vtxo_received",
10375
10481
  timestamp
10376
10482
  );
10377
10483
  }
10378
10484
  if (update.spentVtxos?.length) {
10379
10485
  this.processSubscriptionVtxos(
10380
- update.spentVtxos.map(chunkKCL5AVML_cjs.normalizeVtxo),
10486
+ update.spentVtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo),
10381
10487
  "vtxo_spent",
10382
10488
  timestamp
10383
10489
  );
@@ -10402,8 +10508,8 @@ var ContractWatcher = class {
10402
10508
  continue;
10403
10509
  }
10404
10510
  if (target === byWatchedScript && eventType === "vtxo_received") {
10405
- const n = chunkKCL5AVML_cjs.normalizeVtxo(vtxo);
10406
- if (chunkKCL5AVML_cjs.isVtxoSpent(n) || n.isSwept || chunkKCL5AVML_cjs.isPastExpiry(n, now)) continue;
10511
+ const n = chunkOMPDPBT5_cjs.normalizeVtxo(vtxo);
10512
+ if (chunkOMPDPBT5_cjs.isVtxoSpent(n) || n.isSwept || chunkOMPDPBT5_cjs.isPastExpiry(n, now)) continue;
10407
10513
  }
10408
10514
  let bucket = target.get(vtxo.script);
10409
10515
  if (!bucket) {
@@ -10591,7 +10697,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
10591
10697
  if (!contract) continue;
10592
10698
  try {
10593
10699
  const key = contractKey(contract);
10594
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
10700
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
10595
10701
  const hit = memo?.get(script);
10596
10702
  let tapscripts;
10597
10703
  if (hit && hit.key === key && hit.handler === handler) {
@@ -10623,7 +10729,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
10623
10729
  }
10624
10730
  function annotateAgainst(vtxos, byScript, tapscripts = /* @__PURE__ */ new Map()) {
10625
10731
  return vtxos.map(
10626
- (vtxo) => extendVirtualCoinForContract(chunkKCL5AVML_cjs.normalizeVtxo(vtxo), byScript, tapscripts)
10732
+ (vtxo) => extendVirtualCoinForContract(chunkOMPDPBT5_cjs.normalizeVtxo(vtxo), byScript, tapscripts)
10627
10733
  );
10628
10734
  }
10629
10735
  var SCAN_MAX_INDEX = 1e4;
@@ -10672,8 +10778,8 @@ var ContractManager = class _ContractManager {
10672
10778
  /** Serializes onchain read-modify-writes so a pending spender is never overwritten. */
10673
10779
  onchainChain = Promise.resolve();
10674
10780
  constructor(config) {
10675
- chunkKCL5AVML_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", config.vtxoSyncMaxAgeMs);
10676
- chunkKCL5AVML_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", config.vtxoSyncOverlapMs);
10781
+ chunkOMPDPBT5_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", config.vtxoSyncMaxAgeMs);
10782
+ chunkOMPDPBT5_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", config.vtxoSyncOverlapMs);
10677
10783
  this.config = { ...config };
10678
10784
  if (config.onchainProvider && config.network) {
10679
10785
  this.onchainWatcher = new OnchainContractWatcher({
@@ -10718,12 +10824,12 @@ var ContractManager = class _ContractManager {
10718
10824
  }
10719
10825
  /** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
10720
10826
  setVtxoSyncMaxAge(maxAgeMs) {
10721
- chunkKCL5AVML_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", maxAgeMs);
10827
+ chunkOMPDPBT5_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", maxAgeMs);
10722
10828
  this.config.vtxoSyncMaxAgeMs = maxAgeMs;
10723
10829
  }
10724
10830
  /** @see ContractManagerConfig.vtxoSyncOverlapMs — for factory-built managers. */
10725
10831
  setVtxoSyncOverlap(overlapMs) {
10726
- chunkKCL5AVML_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", overlapMs);
10832
+ chunkOMPDPBT5_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", overlapMs);
10727
10833
  this.config.vtxoSyncOverlapMs = overlapMs;
10728
10834
  }
10729
10835
  markSyncOnline() {
@@ -10787,7 +10893,7 @@ var ContractManager = class _ContractManager {
10787
10893
  if (this.unsupportedContracts.get(contract.script) === key) return true;
10788
10894
  if (this.tapscriptMemo.get(contract.script)?.key === key) return false;
10789
10895
  try {
10790
- chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type)?.createScript(contract.params);
10896
+ chunkMQUATTIM_cjs.contractHandlers.get(contract.type)?.createScript(contract.params);
10791
10897
  return false;
10792
10898
  } catch (err) {
10793
10899
  if (!(err instanceof chunkJFJNB7ZH_cjs.UnsupportedProgramVersionError)) return false;
@@ -10803,7 +10909,7 @@ var ContractManager = class _ContractManager {
10803
10909
  this.markSyncOnline();
10804
10910
  return void 0;
10805
10911
  } catch (err) {
10806
- if (!chunkKCL5AVML_cjs.isRetryableProviderError(err)) throw err;
10912
+ if (!chunkOMPDPBT5_cjs.isRetryableProviderError(err)) throw err;
10807
10913
  this.markSyncDegraded(err);
10808
10914
  return err;
10809
10915
  }
@@ -10826,7 +10932,7 @@ var ContractManager = class _ContractManager {
10826
10932
  try {
10827
10933
  await this.scheduleLookAheadDrain();
10828
10934
  } catch (err) {
10829
- if (!chunkKCL5AVML_cjs.isRetryableProviderError(err)) throw err;
10935
+ if (!chunkOMPDPBT5_cjs.isRetryableProviderError(err)) throw err;
10830
10936
  this.lookAheadRefillOwed = true;
10831
10937
  this.markSyncDegraded(err);
10832
10938
  }
@@ -10889,7 +10995,7 @@ var ContractManager = class _ContractManager {
10889
10995
  /** No throw: construction returned long ago, so the state is the channel. */
10890
10996
  reportBackgroundFailure(stage, err) {
10891
10997
  this.markSyncDegraded(err);
10892
- if (!chunkKCL5AVML_cjs.isRetryableProviderError(err)) {
10998
+ if (!chunkOMPDPBT5_cjs.isRetryableProviderError(err)) {
10893
10999
  console.error(`[contracts] background ${stage} failed`, err);
10894
11000
  }
10895
11001
  }
@@ -10991,7 +11097,7 @@ var ContractManager = class _ContractManager {
10991
11097
  const from = Math.max(0, watermark - lookAhead.size);
10992
11098
  const to = watermark + lookAhead.size;
10993
11099
  const deps = lookAhead.candidateDeps();
10994
- const handlers = chunkAMH7Q3DF_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkAMH7Q3DF_cjs.contractHandlers.get(t)).filter(hasCandidates);
11100
+ const handlers = chunkMQUATTIM_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkMQUATTIM_cjs.contractHandlers.get(t)).filter(hasCandidates);
10995
11101
  const band = /* @__PURE__ */ new Map();
10996
11102
  for (let index = from; index <= to; index++) {
10997
11103
  const descriptor = lookAhead.materialize(index);
@@ -11002,7 +11108,7 @@ var ContractManager = class _ContractManager {
11002
11108
  index,
11003
11109
  params: {
11004
11110
  ...candidate,
11005
- ...chunkAMH7Q3DF_cjs.speculativeReceiveMetadata(descriptor)
11111
+ ...chunkMQUATTIM_cjs.speculativeReceiveMetadata(descriptor)
11006
11112
  }
11007
11113
  });
11008
11114
  }
@@ -11061,7 +11167,7 @@ var ContractManager = class _ContractManager {
11061
11167
  });
11062
11168
  for (const entry of pending) entry.catchUpPending = false;
11063
11169
  } catch (err) {
11064
- if (!chunkKCL5AVML_cjs.isRetryableProviderError(err)) throw err;
11170
+ if (!chunkOMPDPBT5_cjs.isRetryableProviderError(err)) throw err;
11065
11171
  this.markSyncDegraded(err);
11066
11172
  }
11067
11173
  }
@@ -11152,7 +11258,7 @@ var ContractManager = class _ContractManager {
11152
11258
  return result;
11153
11259
  }
11154
11260
  async upsertContractRow(params) {
11155
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(params.type);
11261
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(params.type);
11156
11262
  if (!handler) {
11157
11263
  throw new Error(`No handler registered for contract type '${params.type}'`);
11158
11264
  }
@@ -11254,7 +11360,7 @@ var ContractManager = class _ContractManager {
11254
11360
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
11255
11361
  );
11256
11362
  }
11257
- const registered = chunkAMH7Q3DF_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkAMH7Q3DF_cjs.contractHandlers.get(t)).filter(isDiscoverable);
11363
+ const registered = chunkMQUATTIM_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkMQUATTIM_cjs.contractHandlers.get(t)).filter(isDiscoverable);
11258
11364
  const discoverables = [
11259
11365
  ...registered.filter((h) => h.type === "boarding"),
11260
11366
  ...registered.filter((h) => h.type !== "boarding")
@@ -11385,7 +11491,7 @@ var ContractManager = class _ContractManager {
11385
11491
  return contracts.filter((contract) => this.isUnsupported(contract));
11386
11492
  }
11387
11493
  async getContractsWithVtxos(filter, pageSize, options) {
11388
- chunkKCL5AVML_cjs.assertNonNegativeMs("maxSyncAgeMs", options?.maxSyncAgeMs);
11494
+ chunkOMPDPBT5_cjs.assertNonNegativeMs("maxSyncAgeMs", options?.maxSyncAgeMs);
11389
11495
  const contracts = await this.getContracts(filter);
11390
11496
  if (this.syncedWithin(
11391
11497
  contracts,
@@ -11493,7 +11599,7 @@ var ContractManager = class _ContractManager {
11493
11599
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
11494
11600
  const asking = vtxos.filter((vtxo) => {
11495
11601
  const contract = byScript.get(vtxo.script);
11496
- return contract !== void 0 && chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
11602
+ return contract !== void 0 && chunkMQUATTIM_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
11497
11603
  });
11498
11604
  if (asking.length === 0) return refused;
11499
11605
  const [tip, walletDescriptorValue] = await Promise.all([
@@ -11502,7 +11608,7 @@ var ContractManager = class _ContractManager {
11502
11608
  ]);
11503
11609
  for (const vtxo of asking) {
11504
11610
  const contract = byScript.get(vtxo.script);
11505
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
11611
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
11506
11612
  if (!handler?.assertSpendableNow) continue;
11507
11613
  const context = {
11508
11614
  collaborative: true,
@@ -11512,7 +11618,7 @@ var ContractManager = class _ContractManager {
11512
11618
  walletDescriptor: walletDescriptorValue,
11513
11619
  // `isVirtualCoin` only checks `script`, which every input has; `isCsvSpendable`
11514
11620
  // reads `vtxo.status.block_time` unguarded, so require `status` too.
11515
- vtxo: chunkKCL5AVML_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
11621
+ vtxo: chunkOMPDPBT5_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
11516
11622
  };
11517
11623
  try {
11518
11624
  await handler.assertSpendableNow(
@@ -11626,7 +11732,7 @@ var ContractManager = class _ContractManager {
11626
11732
  const { contractScript, collaborative = true, walletDescriptor, vtxo } = options;
11627
11733
  const [contract] = await this.getContracts({ script: contractScript });
11628
11734
  if (!contract) return [];
11629
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
11735
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
11630
11736
  if (!handler) return [];
11631
11737
  const script = handler.createScript(contract.params);
11632
11738
  const tip = await this.currentChainTip();
@@ -11648,7 +11754,7 @@ var ContractManager = class _ContractManager {
11648
11754
  const { contractScript, collaborative = true, walletDescriptor } = options;
11649
11755
  const [contract] = await this.getContracts({ script: contractScript });
11650
11756
  if (!contract) return [];
11651
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
11757
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
11652
11758
  if (!handler) return [];
11653
11759
  const script = handler.createScript(contract.params);
11654
11760
  const context = {
@@ -11694,7 +11800,7 @@ var ContractManager = class _ContractManager {
11694
11800
  }
11695
11801
  async refreshOutpoints(outpoints) {
11696
11802
  if (outpoints.length === 0) return;
11697
- const { vtxos } = await chunkKCL5AVML_cjs.getNormalizedVtxos(this.config.indexerProvider, {
11803
+ const { vtxos } = await chunkOMPDPBT5_cjs.getNormalizedVtxos(this.config.indexerProvider, {
11698
11804
  outpoints
11699
11805
  });
11700
11806
  if (vtxos.length === 0) return;
@@ -11819,7 +11925,7 @@ var ContractManager = class _ContractManager {
11819
11925
  ...Object.values(pending).map((p) => p.script)
11820
11926
  ]);
11821
11927
  const targets = contracts.filter(
11822
- (c) => chunkAMH7Q3DF_cjs.contractHandlers.has(c.type) && (c.state === "active" && isOnchainScoped(c) || owners.has(c.script))
11928
+ (c) => chunkMQUATTIM_cjs.contractHandlers.has(c.type) && (c.state === "active" && isOnchainScoped(c) || owners.has(c.script))
11823
11929
  );
11824
11930
  const wanted = scripts && new Set(scripts);
11825
11931
  const settled = [];
@@ -11854,7 +11960,7 @@ var ContractManager = class _ContractManager {
11854
11960
  ).catch((e) => console.warn("[contracts] onchain watch failed", e));
11855
11961
  }
11856
11962
  async syncOnchainContract(contract, onchainProvider, network, pending, tipHeight, prefetched) {
11857
- chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type).createScript(contract.params);
11963
+ chunkMQUATTIM_cjs.contractHandlers.get(contract.type).createScript(contract.params);
11858
11964
  const coins = prefetched ?? await onchainProvider.getCoins(onchainAddressOf(contract, network));
11859
11965
  const stored = new Map(
11860
11966
  (await getVtxosForContract(this.config.walletRepository, contract)).map((v) => [
@@ -11952,8 +12058,8 @@ var ContractManager = class _ContractManager {
11952
12058
  const found = /* @__PURE__ */ new Map();
11953
12059
  if (!indexerProvider.getUtxos || rows.length === 0) return found;
11954
12060
  try {
11955
- for (let i = 0; i < rows.length; i += chunkKCL5AVML_cjs.OUTPOINT_QUERY_CHUNK_SIZE) {
11956
- const outpoints = rows.slice(i, i + chunkKCL5AVML_cjs.OUTPOINT_QUERY_CHUNK_SIZE).map(({ txid, vout }) => ({ txid, vout }));
12061
+ for (let i = 0; i < rows.length; i += chunkOMPDPBT5_cjs.OUTPOINT_QUERY_CHUNK_SIZE) {
12062
+ const outpoints = rows.slice(i, i + chunkOMPDPBT5_cjs.OUTPOINT_QUERY_CHUNK_SIZE).map(({ txid, vout }) => ({ txid, vout }));
11957
12063
  let pageIndex;
11958
12064
  let pages = 0;
11959
12065
  do {
@@ -11963,7 +12069,7 @@ var ContractManager = class _ContractManager {
11963
12069
  const { utxos, page } = await indexerProvider.getUtxos({
11964
12070
  outpoints,
11965
12071
  pageIndex,
11966
- pageSize: chunkKCL5AVML_cjs.OUTPOINT_QUERY_CHUNK_SIZE
12072
+ pageSize: chunkOMPDPBT5_cjs.OUTPOINT_QUERY_CHUNK_SIZE
11967
12073
  });
11968
12074
  for (const utxo of utxos) found.set(vtxoOutpoint(utxo), utxo);
11969
12075
  const more = page && page.current < page.total && page.next > page.current;
@@ -11971,7 +12077,7 @@ var ContractManager = class _ContractManager {
11971
12077
  } while (pageIndex !== void 0);
11972
12078
  }
11973
12079
  } catch (e) {
11974
- if (e instanceof chunkXWUCNMPN_cjs.IndexerUtxosUnsupportedError) return found;
12080
+ if (e instanceof chunk3NALVGMJ_cjs.IndexerUtxosUnsupportedError) return found;
11975
12081
  console.warn("[contracts] arkd spend lookup failed; using the explorer", e);
11976
12082
  return void 0;
11977
12083
  }
@@ -12024,7 +12130,7 @@ var ContractManager = class _ContractManager {
12024
12130
  break;
12025
12131
  }
12026
12132
  } catch (err) {
12027
- if (!chunkKCL5AVML_cjs.isRetryableProviderError(err)) throw err;
12133
+ if (!chunkOMPDPBT5_cjs.isRetryableProviderError(err)) throw err;
12028
12134
  this.markSyncDegraded(err);
12029
12135
  synced = false;
12030
12136
  }
@@ -12112,7 +12218,7 @@ var ContractManager = class _ContractManager {
12112
12218
  */
12113
12219
  async reconcilePendingFrontier(contracts) {
12114
12220
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
12115
- const vtxos = await chunkKCL5AVML_cjs.getAllNormalizedVtxos(
12221
+ const vtxos = await chunkOMPDPBT5_cjs.getAllNormalizedVtxos(
12116
12222
  this.config.indexerProvider,
12117
12223
  contracts.map((c) => c.script),
12118
12224
  { pendingOnly: true }
@@ -12187,7 +12293,7 @@ var ContractManager = class _ContractManager {
12187
12293
  }
12188
12294
  return result;
12189
12295
  }
12190
- async fetchContractVtxosBulk(contracts, pageSize = chunkKCL5AVML_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
12296
+ async fetchContractVtxosBulk(contracts, pageSize = chunkOMPDPBT5_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
12191
12297
  if (contracts.length === 0) {
12192
12298
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
12193
12299
  }
@@ -12203,7 +12309,7 @@ var ContractManager = class _ContractManager {
12203
12309
  before: syncWindow.before
12204
12310
  }
12205
12311
  } : {};
12206
- const vtxos = await chunkKCL5AVML_cjs.getAllNormalizedVtxos(
12312
+ const vtxos = await chunkOMPDPBT5_cjs.getAllNormalizedVtxos(
12207
12313
  this.config.indexerProvider,
12208
12314
  contracts.map((c) => c.script),
12209
12315
  { ...windowOpts, pageSize }
@@ -12310,7 +12416,7 @@ function parseLegacyExpiry(batchExpiry) {
12310
12416
  if (typeof batchExpiry !== "number" || !Number.isFinite(batchExpiry) || batchExpiry <= 0) {
12311
12417
  return {};
12312
12418
  }
12313
- if (batchExpiry >= chunkKCL5AVML_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
12419
+ if (batchExpiry >= chunkOMPDPBT5_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
12314
12420
  return { expiresAtHeight: batchExpiry / 1e3 };
12315
12421
  }
12316
12422
  function legacyVtxoFacts(status) {
@@ -12548,7 +12654,7 @@ function backfillContractWatchState(store) {
12548
12654
  };
12549
12655
  readPage();
12550
12656
  }
12551
- var unspentFlag = (vtxo) => chunkKCL5AVML_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
12657
+ var unspentFlag = (vtxo) => chunkOMPDPBT5_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
12552
12658
  function backfillVtxoIndexFields(transaction) {
12553
12659
  const store = transaction.objectStore(STORE_VTXOS);
12554
12660
  const pageSize = 1e3;
@@ -12579,7 +12685,7 @@ var DEFAULT_DB_NAME = "arkade-service-worker";
12579
12685
  var DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS = 1e4;
12580
12686
  function normalizeOptions2(pathOrOptions) {
12581
12687
  const o = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
12582
- chunkKCL5AVML_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
12688
+ chunkOMPDPBT5_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
12583
12689
  return {
12584
12690
  path: o.path,
12585
12691
  activationTimeoutMs: o.activationTimeoutMs ?? DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS
@@ -12807,7 +12913,7 @@ var deserializeTapLeaf = (t) => {
12807
12913
  var deserializeVtxo = ({
12808
12914
  intentTapLeafScript,
12809
12915
  ...o
12810
- }) => chunkKCL5AVML_cjs.normalizeVtxo({
12916
+ }) => chunkOMPDPBT5_cjs.normalizeVtxo({
12811
12917
  ...o,
12812
12918
  createdAt: new Date(o.createdAt),
12813
12919
  tapTree: base.hex.decode(o.tapTree),
@@ -13207,7 +13313,7 @@ var RestEmulatorProvider = class {
13207
13313
  serverUrl;
13208
13314
  async getInfo() {
13209
13315
  const url = `${this.serverUrl}/v1/info`;
13210
- const response = await chunkKCL5AVML_cjs.baseFetch(url);
13316
+ const response = await chunkOMPDPBT5_cjs.baseFetch(url);
13211
13317
  if (!response.ok) {
13212
13318
  const errorText2 = await response.text();
13213
13319
  throw new Error(`Failed to get emulator info: ${errorText2}`);
@@ -13331,7 +13437,7 @@ function arkadeServiceUrl(service) {
13331
13437
  }
13332
13438
  async function resolveArkadeService(service, opts = {}) {
13333
13439
  const operatorUrl = arkadeServiceUrl(service);
13334
- const arkProvider = opts.arkProvider ?? new chunkKCL5AVML_cjs.RestOperatorProvider(operatorUrl);
13440
+ const arkProvider = opts.arkProvider ?? new chunkOMPDPBT5_cjs.RestOperatorProvider(operatorUrl);
13335
13441
  const info = opts.info ?? await arkProvider.getInfo();
13336
13442
  if ("network" in service && service.network !== info.network) {
13337
13443
  throw new Error(
@@ -13350,7 +13456,7 @@ async function resolveArkadeService(service, opts = {}) {
13350
13456
  }
13351
13457
  return {
13352
13458
  arkProvider,
13353
- indexerProvider: new chunkXWUCNMPN_cjs.RestIndexerProvider(operatorUrl),
13459
+ indexerProvider: new chunk3NALVGMJ_cjs.RestIndexerProvider(operatorUrl),
13354
13460
  onchainProvider: new EsploraProvider(esploraUrl),
13355
13461
  emulator,
13356
13462
  info
@@ -13434,7 +13540,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
13434
13540
  */
13435
13541
  materializeDescriptorAt(index) {
13436
13542
  const descriptor = this.identity.descriptor;
13437
- const network = chunkAMH7Q3DF_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
13543
+ const network = chunkMQUATTIM_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
13438
13544
  const expansion = descriptorsScure.expand({ descriptor, network, index });
13439
13545
  const keyInfo = expansion.expansionMap?.["@0"];
13440
13546
  if (!keyInfo?.keyExpression) {
@@ -13502,7 +13608,7 @@ function signingDescriptorIndex(descriptor) {
13502
13608
  }
13503
13609
  function newestWalletReceiveContract(contracts, serverPubKeyHex) {
13504
13610
  return contracts.filter(
13505
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkAMH7Q3DF_cjs.WALLET_RECEIVE_SOURCE
13611
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkMQUATTIM_cjs.WALLET_RECEIVE_SOURCE
13506
13612
  ).sort((a, b) => {
13507
13613
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
13508
13614
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -13553,7 +13659,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
13553
13659
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
13554
13660
  if (!provider) return void 0;
13555
13661
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
13556
- const expectedContractType = setup.offchainTapscript instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script ? "delegate" : "default";
13662
+ const expectedContractType = setup.offchainTapscript instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script ? "delegate" : "default";
13557
13663
  const factoryOpts = {
13558
13664
  walletRepository: setup.walletRepository,
13559
13665
  contractRepository: setup.contractRepository,
@@ -13713,7 +13819,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
13713
13819
  };
13714
13820
  function deriveLeafPubkey(descriptor) {
13715
13821
  try {
13716
- return chunkAMH7Q3DF_cjs.deriveDescriptorLeafPubKey(descriptor);
13822
+ return chunkMQUATTIM_cjs.deriveDescriptorLeafPubKey(descriptor);
13717
13823
  } catch (e) {
13718
13824
  throw new NonRangeableDescriptorError(
13719
13825
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -13733,11 +13839,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
13733
13839
  // Read at sign time to route rotated-pubkey inputs through `signWithDescriptor`; without
13734
13840
  // it spends are rejected with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
13735
13841
  metadata: {
13736
- ...tagSource && { source: chunkAMH7Q3DF_cjs.WALLET_RECEIVE_SOURCE },
13842
+ ...tagSource && { source: chunkMQUATTIM_cjs.WALLET_RECEIVE_SOURCE },
13737
13843
  signingDescriptor: descriptor
13738
13844
  }
13739
13845
  };
13740
- const params = tapscript instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script ? {
13846
+ const params = tapscript instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script ? {
13741
13847
  ...base$1,
13742
13848
  type: "delegate",
13743
13849
  params: {
@@ -13758,10 +13864,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
13758
13864
  return { tapscript, params };
13759
13865
  }
13760
13866
  function rebuildTapscript(current, pubKey) {
13761
- if (current instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script) {
13762
- return new chunkAMH7Q3DF_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
13867
+ if (current instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script) {
13868
+ return new chunkMQUATTIM_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
13763
13869
  }
13764
- return new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
13870
+ return new chunkMQUATTIM_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
13765
13871
  }
13766
13872
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
13767
13873
  const candidates = await collectContracts(contractRepository, {
@@ -13814,7 +13920,7 @@ async function resolvePrevTxs(txids, source, onchain) {
13814
13920
  try {
13815
13921
  const { txs } = await source.getVirtualTxs(wanted);
13816
13922
  for (const psbt of txs) {
13817
- const tx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
13923
+ const tx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
13818
13924
  resolved.set(tx.id, tx.toBytes());
13819
13925
  }
13820
13926
  } catch (err) {
@@ -13847,7 +13953,7 @@ async function resolvePrevTxs(txids, source, onchain) {
13847
13953
  async function attachPrevArkTxs(tx, txids, source, onchain) {
13848
13954
  const pending = [];
13849
13955
  for (let i = 0; i < tx.inputsLength; i++) {
13850
- if (chunkKCL5AVML_cjs.getArkPsbtFields(tx, i, chunkKCL5AVML_cjs.PrevArkTxField).length === 0) pending.push(i);
13956
+ if (chunkOMPDPBT5_cjs.getArkPsbtFields(tx, i, chunkOMPDPBT5_cjs.PrevArkTxField).length === 0) pending.push(i);
13851
13957
  }
13852
13958
  if (pending.length === 0) return;
13853
13959
  const resolved = await resolvePrevTxs(
@@ -13856,13 +13962,13 @@ async function attachPrevArkTxs(tx, txids, source, onchain) {
13856
13962
  onchain
13857
13963
  );
13858
13964
  for (const i of pending) {
13859
- chunkKCL5AVML_cjs.setArkPsbtField(tx, i, chunkKCL5AVML_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
13965
+ chunkOMPDPBT5_cjs.setArkPsbtField(tx, i, chunkOMPDPBT5_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
13860
13966
  }
13861
13967
  }
13862
13968
  async function attachPrevoutTxs(tx, source) {
13863
13969
  const pending = [];
13864
13970
  for (let i = 0; i < tx.inputsLength; i++) {
13865
- if (chunkKCL5AVML_cjs.getArkPsbtFields(tx, i, chunkKCL5AVML_cjs.PrevoutTxField).length > 0) continue;
13971
+ if (chunkOMPDPBT5_cjs.getArkPsbtFields(tx, i, chunkOMPDPBT5_cjs.PrevoutTxField).length > 0) continue;
13866
13972
  const input = tx.getInput(i);
13867
13973
  if (!input?.txid) throw new PrevTxUnavailableError(`input ${i} has no outpoint`);
13868
13974
  pending.push({ index: i, txid: base.hex.encode(input.txid) });
@@ -13877,7 +13983,7 @@ async function attachPrevoutTxs(tx, source) {
13877
13983
  resolved.set(txids[i], result.value);
13878
13984
  }
13879
13985
  for (const { index, txid } of pending) {
13880
- chunkKCL5AVML_cjs.setArkPsbtField(tx, index, chunkKCL5AVML_cjs.PrevoutTxField, resolved.get(txid));
13986
+ chunkOMPDPBT5_cjs.setArkPsbtField(tx, index, chunkOMPDPBT5_cjs.PrevoutTxField, resolved.get(txid));
13881
13987
  }
13882
13988
  }
13883
13989
  async function withPrevTxs(coins, source, onchain) {
@@ -13918,7 +14024,7 @@ function computeOffchainBalance(vtxos, caps) {
13918
14024
  }
13919
14025
  };
13920
14026
  for (const vtxo of vtxos) {
13921
- if (chunkKCL5AVML_cjs.isVtxoSpent(vtxo)) continue;
14027
+ if (chunkOMPDPBT5_cjs.isVtxoSpent(vtxo)) continue;
13922
14028
  addAssets(owned, vtxo);
13923
14029
  if (vtxo.isUnrolled) {
13924
14030
  unrolled += vtxo.value;
@@ -13928,11 +14034,11 @@ function computeOffchainBalance(vtxos, caps) {
13928
14034
  deprecatedSignerLocked += vtxo.value;
13929
14035
  continue;
13930
14036
  }
13931
- if (chunkKCL5AVML_cjs.canRecoverOnchain(vtxo, now)) {
14037
+ if (chunkOMPDPBT5_cjs.canRecoverOnchain(vtxo, now)) {
13932
14038
  recoverable += vtxo.value;
13933
14039
  continue;
13934
14040
  }
13935
- if (!chunkKCL5AVML_cjs.canSpendOffchain(vtxo, now)) continue;
14041
+ if (!chunkOMPDPBT5_cjs.canSpendOffchain(vtxo, now)) continue;
13936
14042
  if (vtxo.isPreconfirmed) {
13937
14043
  preconfirmed += vtxo.value;
13938
14044
  } else {
@@ -14207,7 +14313,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
14207
14313
  if (!newest?.params.pubKey) return baseline;
14208
14314
  try {
14209
14315
  const pubKey = base.hex.decode(newest.params.pubKey);
14210
- return new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
14316
+ return new chunkMQUATTIM_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
14211
14317
  } catch (e) {
14212
14318
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
14213
14319
  return baseline;
@@ -14239,21 +14345,21 @@ function filterFlatVtxos(vtxos, filter, pendingSpendOutpoints) {
14239
14345
  if (vtxo.isUnrolled) {
14240
14346
  return !!f.withUnrolled;
14241
14347
  }
14242
- if (chunkKCL5AVML_cjs.isVtxoSpent(vtxo)) {
14348
+ if (chunkOMPDPBT5_cjs.isVtxoSpent(vtxo)) {
14243
14349
  return false;
14244
14350
  }
14245
- if (!f.withRecoverable && chunkKCL5AVML_cjs.canRecoverOnchain(vtxo, now)) {
14351
+ if (!f.withRecoverable && chunkOMPDPBT5_cjs.canRecoverOnchain(vtxo, now)) {
14246
14352
  return false;
14247
14353
  }
14248
14354
  return true;
14249
14355
  });
14250
14356
  }
14251
14357
  async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
14252
- const candidates = inputs.filter(chunkKCL5AVML_cjs.isVirtualCoin).map(chunkKCL5AVML_cjs.normalizeVtxo).filter((v) => !v.isSwept);
14358
+ const candidates = inputs.filter(chunkOMPDPBT5_cjs.isVirtualCoin).map(chunkOMPDPBT5_cjs.normalizeVtxo).filter((v) => !v.isSwept);
14253
14359
  if (candidates.length === 0) return inputs;
14254
- const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkKCL5AVML_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
14360
+ const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkOMPDPBT5_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
14255
14361
  const suspects = candidates.filter(
14256
- (v) => chunkKCL5AVML_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
14362
+ (v) => chunkOMPDPBT5_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
14257
14363
  );
14258
14364
  if (suspects.length === 0) return inputs;
14259
14365
  let sweptNow;
@@ -14267,12 +14373,12 @@ async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
14267
14373
  );
14268
14374
  } catch (e) {
14269
14375
  const message = "could not confirm the swept state of expired settlement inputs; retry the settlement";
14270
- throw chunkKCL5AVML_cjs.isRetryableProviderError(e) ? new chunkKCL5AVML_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
14376
+ throw chunkOMPDPBT5_cjs.isRetryableProviderError(e) ? new chunkOMPDPBT5_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
14271
14377
  }
14272
14378
  if (sweptNow.size === 0) return inputs;
14273
14379
  return inputs.map((input) => {
14274
- if (!chunkKCL5AVML_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
14275
- return { ...chunkKCL5AVML_cjs.normalizeVtxo(input), isSwept: true };
14380
+ if (!chunkOMPDPBT5_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
14381
+ return { ...chunkOMPDPBT5_cjs.normalizeVtxo(input), isSwept: true };
14276
14382
  });
14277
14383
  }
14278
14384
  var PENDING_RECOVERY_REASON = "is past its operator signer's rotation cutoff \u2014 the operator will not co-sign it until it recovers";
@@ -14542,7 +14648,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14542
14648
  * before binding the answer into a covenant to fail closed instead of getting the snapshot.
14543
14649
  *
14544
14650
  * @returns The operator's info
14545
- * @see ArkadeInfo
14651
+ * @see OperatorInfo
14546
14652
  */
14547
14653
  async getOperatorInfo(opts) {
14548
14654
  const { info, source, lastOnlineAt } = await resolveArkInfo(
@@ -14571,7 +14677,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14571
14677
  async getArkadeReader() {
14572
14678
  const indexer = this.indexerProvider;
14573
14679
  return {
14574
- getVtxos: (opts) => chunkKCL5AVML_cjs.getNormalizedVtxos(indexer, opts),
14680
+ getVtxos: (opts) => chunkOMPDPBT5_cjs.getNormalizedVtxos(indexer, opts),
14575
14681
  getVirtualTxs: (txids, opts) => indexer.getVirtualTxs(txids, opts)
14576
14682
  };
14577
14683
  }
@@ -14621,7 +14727,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14621
14727
  "Pass either `service` or `operatorProvider`/`indexerProvider`/`onchainProvider`, not both"
14622
14728
  );
14623
14729
  }
14624
- const arkProvider = callerProvider || new chunkKCL5AVML_cjs.RestOperatorProvider(config.service ? arkadeServiceUrl(config.service) : void 0);
14730
+ const arkProvider = callerProvider || new chunkOMPDPBT5_cjs.RestOperatorProvider(config.service ? arkadeServiceUrl(config.service) : void 0);
14625
14731
  let indexerProvider = config.indexerProvider;
14626
14732
  if (!indexerProvider && !config.service) {
14627
14733
  const derived = extractOperatorProviderUrl(arkProvider);
@@ -14630,7 +14736,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14630
14736
  "indexerProvider is required when operatorProvider is provided without a discoverable serverUrl"
14631
14737
  );
14632
14738
  }
14633
- indexerProvider = new chunkXWUCNMPN_cjs.RestIndexerProvider(derived ?? chunkFLPWNMX3_cjs.DEFAULT_ARKADE_SERVER_URL);
14739
+ indexerProvider = new chunk3NALVGMJ_cjs.RestIndexerProvider(derived ?? chunkFLPWNMX3_cjs.DEFAULT_ARKADE_SERVER_URL);
14634
14740
  }
14635
14741
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
14636
14742
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -14645,7 +14751,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14645
14751
  if (!resolvedService) throw new Error("indexerProvider is unresolved");
14646
14752
  indexerProvider = resolvedService.indexerProvider;
14647
14753
  }
14648
- const network = chunkFLPWNMX3_cjs.networkFromArkadeInfo(info);
14754
+ const network = chunkFLPWNMX3_cjs.networkFromOperatorInfo(info);
14649
14755
  if ("descriptor" in config.identity) {
14650
14756
  const descriptor = config.identity.descriptor;
14651
14757
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -14688,8 +14794,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
14688
14794
  serverPubKey,
14689
14795
  csvTimelock: exitTimelock
14690
14796
  };
14691
- const offchainTapscript = !delegatePubKey ? new chunkAMH7Q3DF_cjs.DefaultVtxo.Script(offchainOptions) : new chunkAMH7Q3DF_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
14692
- const boardingTapscript = chunkAMH7Q3DF_cjs.BoardingContractHandler.createScript({
14797
+ const offchainTapscript = !delegatePubKey ? new chunkMQUATTIM_cjs.DefaultVtxo.Script(offchainOptions) : new chunkMQUATTIM_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
14798
+ const boardingTapscript = chunkMQUATTIM_cjs.BoardingContractHandler.createScript({
14693
14799
  pubKey: base.hex.encode(pubKey),
14694
14800
  serverPubKey: base.hex.encode(serverPubKey),
14695
14801
  csvTimelock: chunkFLPWNMX3_cjs.timelockToSequence(boardingTimelock).toString()
@@ -14858,7 +14964,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14858
14964
  if (!filter?.withUnrolled) {
14859
14965
  logExcludedVtxos(
14860
14966
  "getSpendableVtxos",
14861
- snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkKCL5AVML_cjs.isVtxoSpent(vtxo)),
14967
+ snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkOMPDPBT5_cjs.isVtxoSpent(vtxo)),
14862
14968
  [() => UNROLLED_REASON]
14863
14969
  );
14864
14970
  }
@@ -14998,12 +15104,13 @@ var ReadonlyWallet = class _ReadonlyWallet {
14998
15104
  * Return wallet transaction history derived from Arkade state and boarding transactions.
14999
15105
  */
15000
15106
  async getTransactionHistory() {
15001
- const [snapshot, { boardingTxs, commitmentsToIgnore }] = await Promise.all([
15107
+ const [fullSnapshot, { boardingTxs, commitmentsToIgnore }] = await Promise.all([
15002
15108
  this.contractSnapshot(),
15003
15109
  this.getBoardingTxs()
15004
15110
  ]);
15111
+ const snapshot = fullSnapshot.filter(({ contract }) => !isRecoveryOnlyContract(contract));
15005
15112
  const allVtxos = snapshot.flatMap((_) => _.vtxos);
15006
- const resolveTxCreatedAt = (txids) => chunkKCL5AVML_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
15113
+ const resolveTxCreatedAt = (txids) => chunkOMPDPBT5_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
15007
15114
  return buildTransactionHistory(
15008
15115
  allVtxos,
15009
15116
  boardingTxs,
@@ -15203,11 +15310,11 @@ var ReadonlyWallet = class _ReadonlyWallet {
15203
15310
  const currentServerPubKey = this.boardingTapscript.options.serverPubKey;
15204
15311
  const currentServerSigner = toXOnlySignerHex(base.hex.encode(currentServerPubKey));
15205
15312
  const signers = /* @__PURE__ */ new Set([currentServerSigner, ...allowedSigners ?? []]);
15206
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkAMH7Q3DF_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
15313
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkMQUATTIM_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
15207
15314
  const baselinePubkey = await this.identity.xOnlyPublicKey();
15208
15315
  for (const signer of signers) {
15209
15316
  add(
15210
- new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
15317
+ new chunkMQUATTIM_cjs.DefaultVtxo.Script({
15211
15318
  pubKey: baselinePubkey,
15212
15319
  serverPubKey: base.hex.decode(signer),
15213
15320
  csvTimelock: boardingCsv
@@ -15228,7 +15335,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15228
15335
  continue;
15229
15336
  }
15230
15337
  add(
15231
- c.type === "default" ? chunkAMH7Q3DF_cjs.DefaultContractHandler.createScript(c.params) : chunkAMH7Q3DF_cjs.BoardingContractHandler.createScript(c.params)
15338
+ c.type === "default" ? chunkMQUATTIM_cjs.DefaultContractHandler.createScript(c.params) : chunkMQUATTIM_cjs.BoardingContractHandler.createScript(c.params)
15232
15339
  );
15233
15340
  } catch (e) {
15234
15341
  console.warn("Skipping malformed boarding contract", c.script, e);
@@ -15277,7 +15384,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15277
15384
  tapscripts.map(async (tapscript, i) => {
15278
15385
  const contract = contracts.get(scripts[i]);
15279
15386
  const spent = new Set(
15280
- contract ? (await getVtxosForContract(this.walletRepository, contract)).filter(chunkKCL5AVML_cjs.isVtxoSpent).map(vtxoOutpoint) : []
15387
+ contract ? (await getVtxosForContract(this.walletRepository, contract)).filter(chunkOMPDPBT5_cjs.isVtxoSpent).map(vtxoOutpoint) : []
15281
15388
  );
15282
15389
  const utxos = fetched[i].filter((c) => !spent.has(vtxoOutpoint(c))).map((utxo) => extendCoinWithTapscript(tapscript, utxo));
15283
15390
  return {
@@ -15306,10 +15413,10 @@ var ReadonlyWallet = class _ReadonlyWallet {
15306
15413
  timer = setTimeout(
15307
15414
  () => reject(
15308
15415
  new Error(
15309
- `Boarding address lookup timed out after ${chunkKCL5AVML_cjs.READ_TIMEOUT_MS}ms`
15416
+ `Boarding address lookup timed out after ${chunkOMPDPBT5_cjs.READ_TIMEOUT_MS}ms`
15310
15417
  )
15311
15418
  ),
15312
- chunkKCL5AVML_cjs.READ_TIMEOUT_MS
15419
+ chunkOMPDPBT5_cjs.READ_TIMEOUT_MS
15313
15420
  );
15314
15421
  })
15315
15422
  ]);
@@ -15495,7 +15602,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15495
15602
  /** Fetch Arkade transaction ids that are still pending final settlement. */
15496
15603
  async fetchPendingTxs() {
15497
15604
  const scripts = await this.getWalletScripts();
15498
- const vtxos = await chunkKCL5AVML_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
15605
+ const vtxos = await chunkOMPDPBT5_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
15499
15606
  return vtxos.filter(
15500
15607
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
15501
15608
  ).map((_) => _.arkTxId);
@@ -15526,7 +15633,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15526
15633
  });
15527
15634
  for (const contract of contracts) {
15528
15635
  if (map.has(contract.script)) continue;
15529
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
15636
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
15530
15637
  if (handler) {
15531
15638
  const script = handler.createScript(contract.params);
15532
15639
  map.set(contract.script, script);
@@ -15645,7 +15752,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15645
15752
  });
15646
15753
  try {
15647
15754
  const baselinePubkey = await baselinePubkeyPromise;
15648
- const delegatePubKey = this.offchainTapscript instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
15755
+ const delegatePubKey = this.offchainTapscript instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
15649
15756
  const baselineSigners = [
15650
15757
  this.offchainTapscript.options.serverPubKey,
15651
15758
  ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
@@ -15655,7 +15762,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15655
15762
  for (const serverPubKey of baselineSigners) {
15656
15763
  for (const csvTimelock of this.walletContractTimelocks) {
15657
15764
  const csvTimelockStr = chunkFLPWNMX3_cjs.timelockToSequence(csvTimelock).toString();
15658
- const defaultScript = new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
15765
+ const defaultScript = new chunkMQUATTIM_cjs.DefaultVtxo.Script({
15659
15766
  pubKey: baselinePubkey,
15660
15767
  serverPubKey,
15661
15768
  csvTimelock
@@ -15676,7 +15783,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
15676
15783
  });
15677
15784
  }
15678
15785
  if (delegatePubKey) {
15679
- const delegateScript = new chunkAMH7Q3DF_cjs.DelegateVtxo.Script({
15786
+ const delegateScript = new chunkMQUATTIM_cjs.DelegateVtxo.Script({
15680
15787
  pubKey: baselinePubkey,
15681
15788
  serverPubKey,
15682
15789
  delegatePubKey,
@@ -15700,9 +15807,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
15700
15807
  }
15701
15808
  }
15702
15809
  }
15703
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkAMH7Q3DF_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
15810
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkMQUATTIM_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
15704
15811
  for (const serverPubKey of baselineSigners) {
15705
- const baselineBoarding = new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
15812
+ const baselineBoarding = new chunkMQUATTIM_cjs.DefaultVtxo.Script({
15706
15813
  pubKey: baselinePubkey,
15707
15814
  serverPubKey,
15708
15815
  csvTimelock: boardingCsvTimelock
@@ -15919,7 +16026,7 @@ var Wallet2 = class extends ReadonlyWallet {
15919
16026
  serverPubKey: this.offchainTapscript.options.serverPubKey,
15920
16027
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
15921
16028
  csvTimelocks: this.walletContractTimelocks,
15922
- delegatePubKey: this.offchainTapscript instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
16029
+ delegatePubKey: this.offchainTapscript instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
15923
16030
  };
15924
16031
  }
15925
16032
  _signerRouter;
@@ -15957,7 +16064,7 @@ var Wallet2 = class extends ReadonlyWallet {
15957
16064
  }
15958
16065
  /**
15959
16066
  * @internal Sole write path for `serverUnrollScript`; called by
15960
- * {@link Wallet._doRotateServerSigner} with the rotating `ArkadeInfo`'s checkpoint script.
16067
+ * {@link Wallet._doRotateServerSigner} with the rotating `OperatorInfo`'s checkpoint script.
15961
16068
  */
15962
16069
  setServerUnrollScriptForRotation(script) {
15963
16070
  this._serverUnrollScript = script;
@@ -16081,7 +16188,7 @@ var Wallet2 = class extends ReadonlyWallet {
16081
16188
  const [row] = await manager.getContracts({ script: base.hex.encode(display.pkScript) });
16082
16189
  const persisted = row?.metadata?.signingDescriptor;
16083
16190
  if (typeof persisted === "string") return persisted;
16084
- return chunkAMH7Q3DF_cjs.identityDescriptor(this.identity);
16191
+ return chunkMQUATTIM_cjs.identityDescriptor(this.identity);
16085
16192
  }
16086
16193
  /**
16087
16194
  * Build, persist and shape one address of `type` owned by `descriptor`. The descriptor is the
@@ -16091,7 +16198,7 @@ var Wallet2 = class extends ReadonlyWallet {
16091
16198
  async mintAddress(manager, type, descriptor, tagSource, allocated) {
16092
16199
  if (type === "boarding") {
16093
16200
  const built2 = this.buildBoardingContract(
16094
- chunkAMH7Q3DF_cjs.deriveDescriptorLeafPubKey(descriptor),
16201
+ chunkMQUATTIM_cjs.deriveDescriptorLeafPubKey(descriptor),
16095
16202
  descriptor,
16096
16203
  tagSource
16097
16204
  );
@@ -16128,11 +16235,11 @@ var Wallet2 = class extends ReadonlyWallet {
16128
16235
  * (offchain analogue: {@link buildReceiveContract}).
16129
16236
  */
16130
16237
  buildBoardingContract(pubKey, descriptor, tagSource) {
16131
- const tapscript = new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
16238
+ const tapscript = new chunkMQUATTIM_cjs.DefaultVtxo.Script({
16132
16239
  ...this._boardingTapscript.options,
16133
16240
  pubKey
16134
16241
  });
16135
- const csvTimelock = tapscript.options.csvTimelock ?? chunkAMH7Q3DF_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
16242
+ const csvTimelock = tapscript.options.csvTimelock ?? chunkMQUATTIM_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
16136
16243
  return {
16137
16244
  tapscript,
16138
16245
  params: {
@@ -16146,7 +16253,7 @@ var Wallet2 = class extends ReadonlyWallet {
16146
16253
  address: tapscript.address(this.network.hrp, this.arkServerPublicKey).encode(),
16147
16254
  state: "active",
16148
16255
  metadata: {
16149
- ...tagSource && { source: chunkAMH7Q3DF_cjs.WALLET_RECEIVE_SOURCE },
16256
+ ...tagSource && { source: chunkMQUATTIM_cjs.WALLET_RECEIVE_SOURCE },
16150
16257
  signingDescriptor: descriptor
16151
16258
  }
16152
16259
  }
@@ -16168,7 +16275,7 @@ var Wallet2 = class extends ReadonlyWallet {
16168
16275
  if (this._hdProvider) {
16169
16276
  return (await this.getContractManager()).getNextSigningDescriptor();
16170
16277
  }
16171
- return chunkAMH7Q3DF_cjs.identityDescriptor(this.identity);
16278
+ return chunkMQUATTIM_cjs.identityDescriptor(this.identity);
16172
16279
  }
16173
16280
  /**
16174
16281
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -16274,21 +16381,21 @@ var Wallet2 = class extends ReadonlyWallet {
16274
16381
  ]);
16275
16382
  const [currentOffchainRow] = offchainRows2;
16276
16383
  const [currentBoardingRow] = boardingRows;
16277
- const newOffchain = this.offchainTapscript instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script ? new chunkAMH7Q3DF_cjs.DelegateVtxo.Script({
16384
+ const newOffchain = this.offchainTapscript instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script ? new chunkMQUATTIM_cjs.DelegateVtxo.Script({
16278
16385
  ...this.offchainTapscript.options,
16279
16386
  serverPubKey: xonly
16280
- }) : new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
16387
+ }) : new chunkMQUATTIM_cjs.DefaultVtxo.Script({
16281
16388
  ...this.offchainTapscript.options,
16282
16389
  serverPubKey: xonly
16283
16390
  });
16284
- const newBoarding = new chunkAMH7Q3DF_cjs.DefaultVtxo.Script({
16391
+ const newBoarding = new chunkMQUATTIM_cjs.DefaultVtxo.Script({
16285
16392
  ...this._boardingTapscript.options,
16286
16393
  serverPubKey: xonly
16287
16394
  });
16288
16395
  const offchainCsv = chunkFLPWNMX3_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
16289
16396
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
16290
16397
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
16291
- if (newOffchain instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script) {
16398
+ if (newOffchain instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script) {
16292
16399
  await manager.createContract({
16293
16400
  type: "delegate",
16294
16401
  params: {
@@ -16316,7 +16423,7 @@ var Wallet2 = class extends ReadonlyWallet {
16316
16423
  metadata: currentOffchainRow?.metadata
16317
16424
  });
16318
16425
  }
16319
- const boardingCsv = newBoarding.options.csvTimelock ?? chunkAMH7Q3DF_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
16426
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkMQUATTIM_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
16320
16427
  await manager.createContract({
16321
16428
  type: "boarding",
16322
16429
  params: {
@@ -16350,14 +16457,14 @@ var Wallet2 = class extends ReadonlyWallet {
16350
16457
  _restoreInFlight;
16351
16458
  _addPendingSpends(inputs) {
16352
16459
  for (const input of inputs) {
16353
- if (chunkKCL5AVML_cjs.isVirtualCoin(input)) {
16460
+ if (chunkOMPDPBT5_cjs.isVirtualCoin(input)) {
16354
16461
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
16355
16462
  }
16356
16463
  }
16357
16464
  }
16358
16465
  _removePendingSpends(inputs) {
16359
16466
  for (const input of inputs) {
16360
- if (chunkKCL5AVML_cjs.isVirtualCoin(input)) {
16467
+ if (chunkOMPDPBT5_cjs.isVirtualCoin(input)) {
16361
16468
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
16362
16469
  }
16363
16470
  }
@@ -16421,7 +16528,7 @@ var Wallet2 = class extends ReadonlyWallet {
16421
16528
  if (clashing.length > 0) throw new VtxoReservedError(clashing, "in-flight");
16422
16529
  }
16423
16530
  _assertNotHeld(inputs) {
16424
- const held = coinKeys(inputs.filter(chunkKCL5AVML_cjs.isVirtualCoin)).filter(
16531
+ const held = coinKeys(inputs.filter(chunkOMPDPBT5_cjs.isVirtualCoin)).filter(
16425
16532
  (key) => this._heldOutpoints.has(key)
16426
16533
  );
16427
16534
  if (held.length > 0) throw new VtxoReservedError(held, "held");
@@ -16460,11 +16567,11 @@ var Wallet2 = class extends ReadonlyWallet {
16460
16567
  const hd = provider !== void 0;
16461
16568
  const [manager, staticDescriptor, arkInfo] = await Promise.all([
16462
16569
  this.getContractManager(),
16463
- hd ? void 0 : chunkAMH7Q3DF_cjs.identityDescriptor(this.identity),
16570
+ hd ? void 0 : chunkMQUATTIM_cjs.identityDescriptor(this.identity),
16464
16571
  this.arkProvider.getInfo()
16465
16572
  ]);
16466
16573
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
16467
- const delegatePubKey = this.offchainTapscript instanceof chunkAMH7Q3DF_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
16574
+ const delegatePubKey = this.offchainTapscript instanceof chunkMQUATTIM_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
16468
16575
  const currentSignerPubKey = chunkJFJNB7ZH_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
16469
16576
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
16470
16577
  (s) => chunkJFJNB7ZH_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
@@ -16479,7 +16586,7 @@ var Wallet2 = class extends ReadonlyWallet {
16479
16586
  deprecatedSignerPubKeys,
16480
16587
  csvTimelocks: this.walletContractTimelocks,
16481
16588
  // Boarding-exit CSV, distinct from the unilateral-exit matrix.
16482
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkAMH7Q3DF_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
16589
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkMQUATTIM_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
16483
16590
  delegatePubKey
16484
16591
  };
16485
16592
  const result = await manager.scanContracts({
@@ -16812,7 +16919,7 @@ var Wallet2 = class extends ReadonlyWallet {
16812
16919
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
16813
16920
  break;
16814
16921
  }
16815
- const inputFee = estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(vtxo));
16922
+ const inputFee = estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(vtxo));
16816
16923
  if (inputFee.satoshis >= vtxo.value) {
16817
16924
  continue;
16818
16925
  }
@@ -16936,11 +17043,11 @@ var Wallet2 = class extends ReadonlyWallet {
16936
17043
  ]);
16937
17044
  let intentTxId;
16938
17045
  try {
16939
- intentTxId = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(intent.proof)).id;
17046
+ intentTxId = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(intent.proof)).id;
16940
17047
  } catch {
16941
17048
  intentTxId = params.inputs.map((i) => `${i.txid}:${i.vout}`).sort().join("|");
16942
17049
  }
16943
- const settleInputVtxos = params.inputs.filter(chunkKCL5AVML_cjs.isVirtualCoin);
17050
+ const settleInputVtxos = params.inputs.filter(chunkOMPDPBT5_cjs.isVirtualCoin);
16944
17051
  const contractManager = await this.getContractManager();
16945
17052
  await contractManager.assertAnnotatable(settleInputVtxos);
16946
17053
  await contractManager.assertSpendableNow?.(
@@ -16949,7 +17056,7 @@ var Wallet2 = class extends ReadonlyWallet {
16949
17056
  );
16950
17057
  if (picked) this._assertNotHeld(params.inputs);
16951
17058
  this._addPendingSpends(params.inputs);
16952
- const boardingKeys = onReserved ? coinKeys(params.inputs.filter((i) => !chunkKCL5AVML_cjs.isVirtualCoin(i))) : [];
17059
+ const boardingKeys = onReserved ? coinKeys(params.inputs.filter((i) => !chunkOMPDPBT5_cjs.isVirtualCoin(i))) : [];
16953
17060
  for (const key of boardingKeys) this._pendingSpendOutpoints.add(key);
16954
17061
  const settlingKeys = params.inputs.map((i) => `${i.txid}:${i.vout}`);
16955
17062
  for (const key of settlingKeys) this._settlingOutpoints.add(key);
@@ -17059,7 +17166,7 @@ var Wallet2 = class extends ReadonlyWallet {
17059
17166
  async maybeRotateBoardingAfterBoard(inputs) {
17060
17167
  if (!this._descriptorProvider) return;
17061
17168
  const consumedBoarding = inputs.some(
17062
- (input) => typeof input !== "string" && !chunkKCL5AVML_cjs.isVirtualCoin(input)
17169
+ (input) => typeof input !== "string" && !chunkOMPDPBT5_cjs.isVirtualCoin(input)
17063
17170
  );
17064
17171
  if (!consumedBoarding) return;
17065
17172
  try {
@@ -17070,7 +17177,7 @@ var Wallet2 = class extends ReadonlyWallet {
17070
17177
  }
17071
17178
  async handleSettlementFinalizationEvent(event, inputs, forfeitOutputScript, expectedRecipients, connectorsGraph, validatedCommitmentTxid) {
17072
17179
  const signedForfeits = [];
17073
- let settlementPsbt = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
17180
+ let settlementPsbt = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
17074
17181
  assertFinalCommitmentMatchesValidated(
17075
17182
  settlementPsbt,
17076
17183
  validatedCommitmentTxid,
@@ -17083,7 +17190,7 @@ var Wallet2 = class extends ReadonlyWallet {
17083
17190
  let connectorIndex = 0;
17084
17191
  const connectorsLeaves = connectorsGraph?.leaves() || [];
17085
17192
  for (const input of inputs) {
17086
- if (!chunkKCL5AVML_cjs.isVirtualCoin(input)) {
17193
+ if (!chunkOMPDPBT5_cjs.isVirtualCoin(input)) {
17087
17194
  let matched = false;
17088
17195
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
17089
17196
  const settlementInput = settlementPsbt.getInput(i);
@@ -17121,7 +17228,7 @@ var Wallet2 = class extends ReadonlyWallet {
17121
17228
  }
17122
17229
  continue;
17123
17230
  }
17124
- if (!chunkKCL5AVML_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
17231
+ if (!chunkOMPDPBT5_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
17125
17232
  continue;
17126
17233
  }
17127
17234
  if (connectorsLeaves.length === 0) {
@@ -17248,7 +17355,7 @@ var Wallet2 = class extends ReadonlyWallet {
17248
17355
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
17249
17356
  return { skip: true };
17250
17357
  }
17251
- const commitmentTx = chunkKCL5AVML_cjs.Transaction.fromPSBT(
17358
+ const commitmentTx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(
17252
17359
  base.base64.decode(event.unsignedCommitmentTx)
17253
17360
  );
17254
17361
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
@@ -17322,7 +17429,7 @@ var Wallet2 = class extends ReadonlyWallet {
17322
17429
  if (!repo) return;
17323
17430
  try {
17324
17431
  const now = Date.now();
17325
- const existing = (await collectIntents(repo, { proofTxIds: [intentTxId] }))[0];
17432
+ const existing = (await collectBatchRegistrations(repo, { proofTxIds: [intentTxId] }))[0];
17326
17433
  if (existing && isTerminalBatchRegistrationState(existing.state)) {
17327
17434
  return;
17328
17435
  }
@@ -17330,9 +17437,9 @@ var Wallet2 = class extends ReadonlyWallet {
17330
17437
  ...existing ?? {},
17331
17438
  proofTxId: intentTxId,
17332
17439
  registerProof: intent.proof,
17333
- registerProofMessage: chunkKCL5AVML_cjs.Proof.encodeMessage(intent.message),
17440
+ registerProofMessage: chunkOMPDPBT5_cjs.Proof.encodeMessage(intent.message),
17334
17441
  deleteProof: deleteIntent.proof,
17335
- deleteProofMessage: chunkKCL5AVML_cjs.Proof.encodeMessage(deleteIntent.message),
17442
+ deleteProofMessage: chunkOMPDPBT5_cjs.Proof.encodeMessage(deleteIntent.message),
17336
17443
  proofInputs: inputs.map((i) => ({
17337
17444
  txid: i.txid,
17338
17445
  vout: i.vout
@@ -17363,7 +17470,7 @@ var Wallet2 = class extends ReadonlyWallet {
17363
17470
  }
17364
17471
  /** @see IWallet.cosignOnchainTx */
17365
17472
  async cosignOnchainTx(psbt) {
17366
- const tx = typeof psbt === "string" ? chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbt)) : psbt;
17473
+ const tx = typeof psbt === "string" ? chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbt)) : psbt;
17367
17474
  return this._withTxLock(async () => {
17368
17475
  await (await this.getContractManager()).syncOnchain();
17369
17476
  return this._cosignOnchainTxImpl(tx);
@@ -17428,7 +17535,7 @@ var Wallet2 = class extends ReadonlyWallet {
17428
17535
  if (reasons.length > 0) throw new OnchainCosignPreflightError(reasons.join("; "));
17429
17536
  }
17430
17537
  const feeRate = await this.onchainProvider.getFeeRate() ?? 1;
17431
- const tx = new chunkKCL5AVML_cjs.Transaction({ version: 2 });
17538
+ const tx = new chunkOMPDPBT5_cjs.Transaction({ version: 2 });
17432
17539
  if (sweepTo) {
17433
17540
  const swept = candidates.slice(0, MAX_COSIGN_INPUTS);
17434
17541
  for (const { coin } of swept) {
@@ -17489,7 +17596,7 @@ var Wallet2 = class extends ReadonlyWallet {
17489
17596
  continue;
17490
17597
  }
17491
17598
  const { coin, contract, script } = mine;
17492
- const path = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type).selectPath(script, contract, {
17599
+ const path = chunkMQUATTIM_cjs.contractHandlers.get(contract.type).selectPath(script, contract, {
17493
17600
  collaborative: true,
17494
17601
  currentTime: Date.now(),
17495
17602
  blockHeight: tip.height,
@@ -17539,7 +17646,7 @@ var Wallet2 = class extends ReadonlyWallet {
17539
17646
  onchainProvider: this.onchainProvider
17540
17647
  });
17541
17648
  } catch (e) {
17542
- if (e instanceof chunkKCL5AVML_cjs.OnchainCosignAmbiguousError || isCosignRejectedAfterSigning(e)) {
17649
+ if (e instanceof chunkOMPDPBT5_cjs.OnchainCosignAmbiguousError || isCosignRejectedAfterSigning(e)) {
17543
17650
  await markPending(signed.id);
17544
17651
  }
17545
17652
  throw e;
@@ -17559,7 +17666,7 @@ var Wallet2 = class extends ReadonlyWallet {
17559
17666
  this.lockedOutpoints(),
17560
17667
  this.onchainCoins(manager)
17561
17668
  ]);
17562
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkAMH7Q3DF_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
17669
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkMQUATTIM_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
17563
17670
  return coins.filter(
17564
17671
  ({ coin, contract }) => !locked.has(vtxoOutpoint(coin)) && needsOnchainSweep(coin, contract, boardingCsv, tip, this._cosignMarginBlocks)
17565
17672
  ).slice(0, MAX_COSIGN_INPUTS).map(({ coin }) => ({ txid: coin.txid, vout: coin.vout }));
@@ -17571,8 +17678,8 @@ var Wallet2 = class extends ReadonlyWallet {
17571
17678
  unspentOnly: true
17572
17679
  });
17573
17680
  return snapshot.flatMap(({ contract, vtxos }) => {
17574
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
17575
- const coins = vtxos.filter((v) => v.isUnrolled && !chunkKCL5AVML_cjs.isVtxoSpent(v));
17681
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
17682
+ const coins = vtxos.filter((v) => v.isUnrolled && !chunkOMPDPBT5_cjs.isVtxoSpent(v));
17576
17683
  if (!handler || coins.length === 0) return [];
17577
17684
  const script = handler.createScript(contract.params);
17578
17685
  return coins.map((coin) => ({ coin, contract, script }));
@@ -17582,7 +17689,7 @@ var Wallet2 = class extends ReadonlyWallet {
17582
17689
  try {
17583
17690
  return await this.arkProvider.registerIntent(intent);
17584
17691
  } catch (error) {
17585
- if (error instanceof chunkKCL5AVML_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
17692
+ if (error instanceof chunkOMPDPBT5_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
17586
17693
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
17587
17694
  await this.arkProvider.deleteIntent(deleteIntent);
17588
17695
  return this.arkProvider.registerIntent(intent);
@@ -17598,7 +17705,7 @@ var Wallet2 = class extends ReadonlyWallet {
17598
17705
  expire_at: 0,
17599
17706
  cosigners_public_keys: cosignerPubKeys
17600
17707
  };
17601
- const proof = chunkKCL5AVML_cjs.Proof.create(message, coins, outputs);
17708
+ const proof = chunkOMPDPBT5_cjs.Proof.create(message, coins, outputs);
17602
17709
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
17603
17710
  return {
17604
17711
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -17610,7 +17717,7 @@ var Wallet2 = class extends ReadonlyWallet {
17610
17717
  type: "delete",
17611
17718
  expire_at: 0
17612
17719
  };
17613
- const proof = chunkKCL5AVML_cjs.Proof.create(message, coins, []);
17720
+ const proof = chunkOMPDPBT5_cjs.Proof.create(message, coins, []);
17614
17721
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
17615
17722
  return {
17616
17723
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -17622,7 +17729,7 @@ var Wallet2 = class extends ReadonlyWallet {
17622
17729
  type: "get-pending-tx",
17623
17730
  expire_at: 0
17624
17731
  };
17625
- const proof = chunkKCL5AVML_cjs.Proof.create(message, coins, []);
17732
+ const proof = chunkOMPDPBT5_cjs.Proof.create(message, coins, []);
17626
17733
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
17627
17734
  return {
17628
17735
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -17643,7 +17750,7 @@ var Wallet2 = class extends ReadonlyWallet {
17643
17750
  if (!vtxos || vtxos.length === 0) {
17644
17751
  const scriptMap = await this.getScriptMap();
17645
17752
  const allExtended = [];
17646
- const fetchedVtxos = await chunkKCL5AVML_cjs.getAllNormalizedVtxos(this.indexerProvider, [
17753
+ const fetchedVtxos = await chunkOMPDPBT5_cjs.getAllNormalizedVtxos(this.indexerProvider, [
17647
17754
  ...scriptMap.keys()
17648
17755
  ]);
17649
17756
  for (const vtxo of fetchedVtxos) {
@@ -17686,8 +17793,8 @@ var Wallet2 = class extends ReadonlyWallet {
17686
17793
  batchPending.push(pendingTx.arkTxid);
17687
17794
  try {
17688
17795
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((c) => {
17689
- const tx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(c));
17690
- chunkKCL5AVML_cjs.assertAllowedSighashTypes(tx);
17796
+ const tx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(c));
17797
+ chunkOMPDPBT5_cjs.assertAllowedSighashTypes(tx);
17691
17798
  return tx;
17692
17799
  });
17693
17800
  assertCheckpointsMatchInputs(
@@ -17858,11 +17965,17 @@ var Wallet2 = class extends ReadonlyWallet {
17858
17965
  const myPkScript = chunkFLPWNMX3_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
17859
17966
  let { spendable, recoverable, unclaimed } = this.classifyCashVtxos(vtxos);
17860
17967
  let swept = 0;
17968
+ const claims = [];
17861
17969
  const drainable = vtxos.filter(
17862
17970
  (vtxo) => !isSubdust(vtxo, this.dustAmount) && !vtxo.isUnrolled
17863
17971
  );
17864
17972
  if (drainable.length > 0) {
17865
- let drained = { count: 0, swept: 0, claimed: /* @__PURE__ */ new Set() };
17973
+ let drained = {
17974
+ count: 0,
17975
+ swept: 0,
17976
+ claimed: /* @__PURE__ */ new Set(),
17977
+ claims: []
17978
+ };
17866
17979
  try {
17867
17980
  drained = await this.finalizePendingCashTxs(
17868
17981
  cash,
@@ -17873,6 +17986,7 @@ var Wallet2 = class extends ReadonlyWallet {
17873
17986
  } catch (error) {
17874
17987
  console.error("Failed to drain pending arkadeCash txs:", error);
17875
17988
  }
17989
+ claims.push(...drained.claims);
17876
17990
  if (drained.count > 0) {
17877
17991
  vtxos = await this.fetchAllVtxos(scripts);
17878
17992
  ({ spendable, recoverable, unclaimed } = this.classifyCashVtxos(vtxos));
@@ -17890,7 +18004,7 @@ var Wallet2 = class extends ReadonlyWallet {
17890
18004
  );
17891
18005
  for (const vtxo of spendable) {
17892
18006
  try {
17893
- await signAndSubmitOffchainTx({
18007
+ const registeredTxid = await signAndSubmitOffchainTx({
17894
18008
  identity: cash.identity,
17895
18009
  provider: this.arkProvider,
17896
18010
  inputs: [
@@ -17906,6 +18020,7 @@ var Wallet2 = class extends ReadonlyWallet {
17906
18020
  serverUnrollScript,
17907
18021
  oneShot: this.oneShotSubmit
17908
18022
  });
18023
+ claims.push({ txid: registeredTxid, amount: vtxo.value });
17909
18024
  swept += vtxo.value;
17910
18025
  } catch (error) {
17911
18026
  console.error(
@@ -17936,6 +18051,7 @@ var Wallet2 = class extends ReadonlyWallet {
17936
18051
  }
17937
18052
  }
17938
18053
  return {
18054
+ claims,
17939
18055
  swept,
17940
18056
  recovering: {
17941
18057
  amount: recovering.reduce((total, vtxo) => total + vtxo.value, 0),
@@ -18053,6 +18169,36 @@ var Wallet2 = class extends ReadonlyWallet {
18053
18169
  }
18054
18170
  await manager.deleteContract(script);
18055
18171
  }
18172
+ /**
18173
+ * Correlate an imported voucher's settlement with the voucher record. This
18174
+ * is deliberately kept on wallet state rather than being inferred from the
18175
+ * generic recovery row, which has no safe public correlation key. The
18176
+ * imported contract carries no cash id, so its script is the join key:
18177
+ * the script is the voucher id.
18178
+ */
18179
+ async correlateArkadeCashRecovery(cashId, txid, amount, outcome = "recovered") {
18180
+ await updateWalletState(this.walletRepository, (state) => {
18181
+ const raw = state.settings?.arkadeCashRecovery;
18182
+ const entries = Array.isArray(raw) ? raw : [];
18183
+ const index = entries.findIndex(
18184
+ (entry) => isArkadeCashRecord(entry) && entry.id === cashId
18185
+ );
18186
+ const previous = index >= 0 ? entries[index] : void 0;
18187
+ if (previous?.claims.some((claim) => claim.txid === txid)) return state;
18188
+ const next = mergeArkadeCashRecord(previous, {
18189
+ id: cashId,
18190
+ action: "claimed",
18191
+ outcome,
18192
+ createdAt: Math.floor(Date.now() / 1e3),
18193
+ issues: [],
18194
+ claims: [{ txid, amount }]
18195
+ });
18196
+ const updated = [...entries];
18197
+ if (index >= 0) updated[index] = next;
18198
+ else updated.push(next);
18199
+ return { ...state, settings: { ...state.settings, arkadeCashRecovery: updated } };
18200
+ });
18201
+ }
18056
18202
  /**
18057
18203
  * Split the VTXOs at an arkadeCash address into three buckets: the ones the
18058
18204
  * thin sweep can move (`spendable`), the operator-swept ones that must go
@@ -18064,7 +18210,7 @@ var Wallet2 = class extends ReadonlyWallet {
18064
18210
  const recoverable = [];
18065
18211
  const unclaimed = [];
18066
18212
  for (const vtxo of vtxos) {
18067
- if (chunkKCL5AVML_cjs.isVtxoSpent(vtxo)) {
18213
+ if (chunkOMPDPBT5_cjs.isVtxoSpent(vtxo)) {
18068
18214
  unclaimed.push(cashReport(vtxo, "already-spent"));
18069
18215
  } else if (vtxo.isUnrolled) {
18070
18216
  unclaimed.push(cashReport(vtxo, "exited"));
@@ -18086,7 +18232,7 @@ var Wallet2 = class extends ReadonlyWallet {
18086
18232
  const all = [];
18087
18233
  const seen = /* @__PURE__ */ new Set();
18088
18234
  for (let pageIndex = 0; ; pageIndex++) {
18089
- const { vtxos, page } = await chunkKCL5AVML_cjs.getNormalizedVtxos(this.indexerProvider, {
18235
+ const { vtxos, page } = await chunkOMPDPBT5_cjs.getNormalizedVtxos(this.indexerProvider, {
18090
18236
  scripts,
18091
18237
  pageIndex,
18092
18238
  pageSize
@@ -18110,7 +18256,12 @@ var Wallet2 = class extends ReadonlyWallet {
18110
18256
  * @returns Txs finalized, sats paid to this wallet, and the outpoints consumed to pay it.
18111
18257
  */
18112
18258
  async finalizePendingCashTxs(cash, vtxos, cashScript, myPkScript) {
18113
- const result = { count: 0, swept: 0, claimed: /* @__PURE__ */ new Set() };
18259
+ const result = {
18260
+ count: 0,
18261
+ swept: 0,
18262
+ claimed: /* @__PURE__ */ new Set(),
18263
+ claims: []
18264
+ };
18114
18265
  const inputs = vtxos.map((vtxo) => ({
18115
18266
  ...vtxo,
18116
18267
  forfeitTapLeafScript: cashScript.forfeit(),
@@ -18124,7 +18275,7 @@ var Wallet2 = class extends ReadonlyWallet {
18124
18275
  for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_PROOF) {
18125
18276
  const batch = inputs.slice(i, i + MAX_INPUTS_PER_PROOF);
18126
18277
  const message = { type: "get-pending-tx", expire_at: 0 };
18127
- const proof = chunkKCL5AVML_cjs.Proof.create(message, batch, []);
18278
+ const proof = chunkOMPDPBT5_cjs.Proof.create(message, batch, []);
18128
18279
  const signedProof = await identity.sign(
18129
18280
  proof,
18130
18281
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -18145,8 +18296,8 @@ var Wallet2 = class extends ReadonlyWallet {
18145
18296
  for (const pendingTx of pendingTxs) {
18146
18297
  try {
18147
18298
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((checkpoint) => {
18148
- const tx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(checkpoint));
18149
- chunkKCL5AVML_cjs.assertAllowedSighashTypes(tx);
18299
+ const tx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(checkpoint));
18300
+ chunkOMPDPBT5_cjs.assertAllowedSighashTypes(tx);
18150
18301
  return tx;
18151
18302
  });
18152
18303
  assertCheckpointsMatchInputs(
@@ -18167,6 +18318,7 @@ var Wallet2 = class extends ReadonlyWallet {
18167
18318
  result.count++;
18168
18319
  const paidToMe = this.arkTxAmountPaidTo(pendingTx.finalArkTx, myPkScriptHex);
18169
18320
  if (paidToMe === 0) continue;
18321
+ result.claims.push({ txid: pendingTx.arkTxid, amount: paidToMe });
18170
18322
  result.swept += paidToMe;
18171
18323
  for (const checkpoint of checkpointTxs) {
18172
18324
  for (let i = 0; i < checkpoint.inputsLength; i++) {
@@ -18186,7 +18338,7 @@ var Wallet2 = class extends ReadonlyWallet {
18186
18338
  }
18187
18339
  /** Sum the outputs of an ark tx PSBT that pay the given scriptPubKey. */
18188
18340
  arkTxAmountPaidTo(arkTxPsbt, pkScriptHex) {
18189
- const arkTx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(arkTxPsbt));
18341
+ const arkTx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(arkTxPsbt));
18190
18342
  let total = 0;
18191
18343
  for (let i = 0; i < arkTx.outputsLength; i++) {
18192
18344
  const output = arkTx.getOutput(i);
@@ -18245,7 +18397,7 @@ var Wallet2 = class extends ReadonlyWallet {
18245
18397
  throw new Error("send({ maxChangeFee }): expected a non-negative safe integer");
18246
18398
  }
18247
18399
  if (selectedVtxos) {
18248
- if (inputExpiryFloor) selectedVtxos = selectedVtxos.map(chunkKCL5AVML_cjs.normalizeVtxo);
18400
+ if (inputExpiryFloor) selectedVtxos = selectedVtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo);
18249
18401
  if (inputExpiryFloor && selectedVtxos.some((coin) => !meetsInputExpiryFloor(coin, inputExpiryFloor))) {
18250
18402
  throw new Error("send({ selectedVtxos }): input expiry floor not met");
18251
18403
  }
@@ -18572,10 +18724,10 @@ var Wallet2 = class extends ReadonlyWallet {
18572
18724
  const serverPubKey = this.arkServerPublicKey;
18573
18725
  const serverUnrollScript = this.serverUnrollScript;
18574
18726
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
18575
- const normalizedInputs = inputs.map(chunkKCL5AVML_cjs.normalizeVtxo);
18576
- const at = now ?? await chunkKCL5AVML_cjs.resolveTimeHeight(this.onchainProvider);
18727
+ const normalizedInputs = inputs.map(chunkOMPDPBT5_cjs.normalizeVtxo);
18728
+ const at = now ?? await chunkOMPDPBT5_cjs.resolveTimeHeight(this.onchainProvider);
18577
18729
  for (const input of normalizedInputs) {
18578
- if (!chunkKCL5AVML_cjs.canSpendOffchain(input, at)) {
18730
+ if (!chunkOMPDPBT5_cjs.canSpendOffchain(input, at)) {
18579
18731
  throw new Error(
18580
18732
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
18581
18733
  );
@@ -18769,7 +18921,7 @@ var Wallet2 = class extends ReadonlyWallet {
18769
18921
  }
18770
18922
  const checkpointIdByOutpoint = /* @__PURE__ */ new Map();
18771
18923
  for (const encoded of signedCheckpointTxs) {
18772
- const checkpoint = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
18924
+ const checkpoint = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
18773
18925
  for (let i = 0; i < checkpoint.inputsLength; i++) {
18774
18926
  const input = checkpoint.getInput(i);
18775
18927
  if (!input.txid) continue;
@@ -18886,12 +19038,12 @@ var Wallet2 = class extends ReadonlyWallet {
18886
19038
  const inputArkTxIds = /* @__PURE__ */ new Set();
18887
19039
  const boardingScripts = /* @__PURE__ */ new Set();
18888
19040
  const boardingOutpoints = [];
18889
- const vtxoInputs = inputs.filter(chunkKCL5AVML_cjs.isVirtualCoin);
19041
+ const vtxoInputs = inputs.filter(chunkOMPDPBT5_cjs.isVirtualCoin);
18890
19042
  const cm = await this.getContractManager();
18891
19043
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
18892
19044
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
18893
19045
  for (const input of inputs) {
18894
- if (chunkKCL5AVML_cjs.isVirtualCoin(input)) {
19046
+ if (chunkOMPDPBT5_cjs.isVirtualCoin(input)) {
18895
19047
  const outpoint = `${input.txid}:${input.vout}`;
18896
19048
  const vtxo = annotatedByKey.get(outpoint);
18897
19049
  if (!vtxo) {
@@ -18974,7 +19126,7 @@ function bySelectionOrder(a, b) {
18974
19126
  return b.value - a.value;
18975
19127
  }
18976
19128
  function selectVirtualCoins(coins, targetAmount) {
18977
- const sortedCoins = coins.map(chunkKCL5AVML_cjs.normalizeVtxo).sort(bySelectionOrder);
19129
+ const sortedCoins = coins.map(chunkOMPDPBT5_cjs.normalizeVtxo).sort(bySelectionOrder);
18978
19130
  const selectedCoins = [];
18979
19131
  let selectedAmount = 0;
18980
19132
  for (const coin of sortedCoins) {
@@ -19026,13 +19178,20 @@ async function waitForIncomingFunds(wallet, options) {
19026
19178
  let settled = false;
19027
19179
  let timeoutId;
19028
19180
  let onAbort;
19181
+ const stopSafely = (stop) => {
19182
+ try {
19183
+ stop();
19184
+ } catch (e) {
19185
+ console.warn("waitForIncomingFunds teardown failed", e);
19186
+ }
19187
+ };
19029
19188
  return new Promise((resolve, reject) => {
19030
19189
  const settle = (deliver) => {
19031
19190
  if (settled) return;
19032
19191
  settled = true;
19033
19192
  if (timeoutId !== void 0) clearTimeout(timeoutId);
19034
19193
  if (onAbort) signal?.removeEventListener("abort", onAbort);
19035
- stopFunc?.();
19194
+ if (stopFunc) stopSafely(stopFunc);
19036
19195
  deliver();
19037
19196
  };
19038
19197
  const cancel = (reason) => settle(() => reject(reason));
@@ -19046,16 +19205,20 @@ async function waitForIncomingFunds(wallet, options) {
19046
19205
  timeoutMs
19047
19206
  );
19048
19207
  }
19049
- wallet.notifyIncomingFunds((funds) => {
19050
- const hasFunds = funds.type === "utxo" ? funds.coins.length > 0 : funds.newVtxos.length > 0;
19051
- if (settled || !hasFunds) return;
19052
- settle(() => resolve(funds));
19053
- }).then((stop) => {
19054
- stopFunc = stop;
19055
- if (settled) stop();
19056
- }).catch((error) => {
19208
+ try {
19209
+ wallet.notifyIncomingFunds((funds) => {
19210
+ const hasFunds = funds.type === "utxo" ? funds.coins.length > 0 : funds.newVtxos.length > 0;
19211
+ if (settled || !hasFunds) return;
19212
+ settle(() => resolve(funds));
19213
+ }).then((stop) => {
19214
+ stopFunc = stop;
19215
+ if (settled) stopSafely(stop);
19216
+ }).catch((error) => {
19217
+ cancel(error);
19218
+ });
19219
+ } catch (error) {
19057
19220
  cancel(error);
19058
- });
19221
+ }
19059
19222
  });
19060
19223
  }
19061
19224
 
@@ -19091,7 +19254,7 @@ function assertTimeoutMap(name, timeouts) {
19091
19254
  if (value === void 0) {
19092
19255
  throw new Error(`${name}.${key} must be a non-negative safe integer`);
19093
19256
  }
19094
- chunkKCL5AVML_cjs.assertTimerMs(`${name}.${key}`, value);
19257
+ chunkOMPDPBT5_cjs.assertTimerMs(`${name}.${key}`, value);
19095
19258
  }
19096
19259
  }
19097
19260
  var MessageBus = class {
@@ -19108,8 +19271,8 @@ var MessageBus = class {
19108
19271
  }) {
19109
19272
  this.walletRepository = walletRepository;
19110
19273
  this.contractRepository = contractRepository;
19111
- chunkKCL5AVML_cjs.assertTimerMs("tickIntervalMs", tickIntervalMs);
19112
- chunkKCL5AVML_cjs.assertTimerMs("messageTimeoutMs", messageTimeoutMs);
19274
+ chunkOMPDPBT5_cjs.assertTimerMs("tickIntervalMs", tickIntervalMs);
19275
+ chunkOMPDPBT5_cjs.assertTimerMs("messageTimeoutMs", messageTimeoutMs);
19113
19276
  assertTimeoutMap("messageTimeoutOverrides", messageTimeoutOverrides);
19114
19277
  this.intentRepository = intentRepository;
19115
19278
  this.onchainProvider = onchainProvider;
@@ -19365,14 +19528,14 @@ var MessageBus = class {
19365
19528
  this.initialized = true;
19366
19529
  }
19367
19530
  async buildServices(config) {
19368
- const arkProvider = new chunkKCL5AVML_cjs.RestOperatorProvider(config.arkServer.url);
19531
+ const arkProvider = new chunkOMPDPBT5_cjs.RestOperatorProvider(config.arkServer.url);
19369
19532
  const storage = {
19370
19533
  walletRepository: this.walletRepository,
19371
19534
  contractRepository: this.contractRepository,
19372
19535
  ...this.intentRepository && { intentRepository: this.intentRepository }
19373
19536
  };
19374
19537
  const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : void 0;
19375
- const indexerProvider = new chunkXWUCNMPN_cjs.RestIndexerProvider(config.arkServer.url);
19538
+ const indexerProvider = new chunk3NALVGMJ_cjs.RestIndexerProvider(config.arkServer.url);
19376
19539
  const serialized = normalizeSerializedIdentity(config.wallet);
19377
19540
  if (isSigningSerialized(serialized)) {
19378
19541
  const identity2 = hydrateIdentity(serialized);
@@ -19755,7 +19918,7 @@ function filterOffboardInputs(vtxos, feeInfo, named) {
19755
19918
  const inputs = [];
19756
19919
  let subtotal = 0n;
19757
19920
  for (const vtxo of vtxos) {
19758
- const inputFee = estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(vtxo));
19921
+ const inputFee = estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(vtxo));
19759
19922
  if (inputFee.satoshis >= vtxo.value) {
19760
19923
  if (named) {
19761
19924
  throw new Error(
@@ -20020,7 +20183,7 @@ var Ramps = class {
20020
20183
  const ordered = [...candidates].sort(bySelectionOrder);
20021
20184
  let covered = 0n;
20022
20185
  for (let i = 0; i < ordered.length && i < MAX_VTXOS_PER_SETTLEMENT; i++) {
20023
- const fee = estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(ordered[i])).satoshis;
20186
+ const fee = estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(ordered[i])).satoshis;
20024
20187
  covered += BigInt(ordered[i].value) - BigInt(fee);
20025
20188
  if (covered < needed) continue;
20026
20189
  try {
@@ -20067,6 +20230,51 @@ var Ramps = class {
20067
20230
  return { change, changeAddress };
20068
20231
  }
20069
20232
  };
20233
+ function groupByTxid(coins) {
20234
+ const totals = /* @__PURE__ */ new Map();
20235
+ for (const { txid, value } of coins) totals.set(txid, (totals.get(txid) ?? 0) + value);
20236
+ return [...totals].map(([txid, amount]) => ({ txid, amount }));
20237
+ }
20238
+ async function readArkadeCash(token, indexer, info, onchain) {
20239
+ const cash = ArkadeCash.fromString(token);
20240
+ const signer = classifyAgainstSignerSet(base.hex.encode(cash.serverPubKey), signerSetFromInfo(info));
20241
+ if (signer.status === "UNKNOWN_SIGNER") {
20242
+ throw new Error("ArkadeCash belongs to another operator");
20243
+ }
20244
+ const coins = await chunkOMPDPBT5_cjs.getAllNormalizedVtxos(indexer, [arkadeCashId(cash)]);
20245
+ return classifyArkadeCash(
20246
+ coins,
20247
+ info.dust,
20248
+ await chunkOMPDPBT5_cjs.resolveTimeHeight(onchain),
20249
+ signer.status === "EXPIRED"
20250
+ );
20251
+ }
20252
+ function classifyArkadeCash(coins, dust, now, awaitingSweep = false) {
20253
+ const eligible = coins.filter(
20254
+ (coin) => coin.value >= Number(dust) && !(coin.assets && coin.assets.length > 0)
20255
+ );
20256
+ const hasSpent = eligible.some(chunkOMPDPBT5_cjs.isVtxoSpent);
20257
+ const hasLive = eligible.some((coin) => !chunkOMPDPBT5_cjs.isVtxoSpent(coin) && !coin.isUnrolled);
20258
+ const hasExit = eligible.some((coin) => !chunkOMPDPBT5_cjs.isVtxoSpent(coin) && coin.isUnrolled);
20259
+ const recoverable = eligible.some((coin) => !chunkOMPDPBT5_cjs.isVtxoSpent(coin) && coin.isSwept);
20260
+ const elapsedBatch = eligible.some(
20261
+ (coin) => !chunkOMPDPBT5_cjs.isVtxoSpent(coin) && !coin.isSwept && chunkOMPDPBT5_cjs.isPastExpiry(coin, now)
20262
+ );
20263
+ return {
20264
+ status: eligible.length === 0 ? "unissued" : hasExit && !hasLive ? "exited" : hasSpent && !hasLive ? "claimed" : recoverable ? "recovering" : elapsedBatch || awaitingSweep ? "expired" : "available",
20265
+ amount: eligible.reduce((sum, coin) => sum + (chunkOMPDPBT5_cjs.isVtxoSpent(coin) ? 0 : coin.value), 0),
20266
+ issues: groupByTxid(eligible),
20267
+ claims: groupByTxid(
20268
+ // `||`: the indexer reports an unset id as an empty string, not as absent.
20269
+ eligible.flatMap((coin) => {
20270
+ const txid = coin.arkTxId || coin.settledBy;
20271
+ return txid ? [{ txid, value: coin.value }] : [];
20272
+ })
20273
+ )
20274
+ };
20275
+ }
20276
+
20277
+ // src/wallet/serviceWorker/wallet-message-handler.ts
20070
20278
  var WalletNotInitializedError = class extends Error {
20071
20279
  constructor() {
20072
20280
  super("Wallet handler not initialized");
@@ -20101,6 +20309,25 @@ function deserializeAggregateError(payload) {
20101
20309
  });
20102
20310
  return new AggregateError(errs, payload.message);
20103
20311
  }
20312
+ function isSerializedArkadeCashCreateError(value) {
20313
+ if (!value || typeof value !== "object") return false;
20314
+ const v = value;
20315
+ return v.name === "ArkadeCashCreateError" && typeof v.message === "string" && typeof v.cash === "string" && !!v.cause && typeof v.cause.name === "string" && typeof v.cause.message === "string";
20316
+ }
20317
+ function serializeArkadeCashCreateError(error) {
20318
+ const cause = error.cause;
20319
+ return {
20320
+ name: "ArkadeCashCreateError",
20321
+ message: error.message,
20322
+ cash: error.cash,
20323
+ cause: cause instanceof Error ? { name: cause.name, message: cause.message } : { name: "Error", message: String(cause) }
20324
+ };
20325
+ }
20326
+ function deserializeArkadeCashCreateError(payload) {
20327
+ const cause = new Error(payload.cause.message);
20328
+ cause.name = payload.cause.name;
20329
+ return new ArkadeCashCreateError(payload.cash, cause);
20330
+ }
20104
20331
  var ReadonlyWalletError = class extends Error {
20105
20332
  constructor() {
20106
20333
  super("Read-only wallet: operation requires signing");
@@ -20114,6 +20341,7 @@ var DelegateNotConfiguredError = class extends Error {
20114
20341
  }
20115
20342
  };
20116
20343
  var DEFAULT_MESSAGE_TAG = "WALLET_UPDATER";
20344
+ var isLongRunningCashAction = (request) => request.action === "create" || request.action === "claim";
20117
20345
  function unsupportedByManager(method) {
20118
20346
  return new Error(`Contract manager does not support ${method}`);
20119
20347
  }
@@ -20349,7 +20577,10 @@ var WalletMessageHandler = class {
20349
20577
  message.type === "MIGRATE_DEPRECATED_SIGNER_VTXOS" || // HD restore walks the index range with one indexer round-trip per
20350
20578
  // step until it hits gapLimit consecutive unused indices. The bus
20351
20579
  // deadline must not race the scan; liveness stays covered by PING.
20352
- message.type === "RESTORE_WALLET" || message.type === "COSIGN_ONCHAIN_TX" || message.type === "SEND_ONCHAIN";
20580
+ message.type === "RESTORE_WALLET" || // `create` and `claim` run sends and sweeps. A bus deadline would
20581
+ // answer with a timeout error and drop the token or txids that the
20582
+ // finished handler could still deliver.
20583
+ message.type === "ARKADE_CASH" && isLongRunningCashAction(message.payload) || message.type === "COSIGN_ONCHAIN_TX" || message.type === "SEND_ONCHAIN";
20353
20584
  }
20354
20585
  async handleMessage(message) {
20355
20586
  const id = message.id;
@@ -20392,6 +20623,82 @@ var WalletMessageHandler = class {
20392
20623
  payload: { address }
20393
20624
  });
20394
20625
  }
20626
+ case "ARKADE_CASH": {
20627
+ const request = message.payload;
20628
+ switch (request.action) {
20629
+ case "get": {
20630
+ const cash = ArkadeCash.fromString(request.token);
20631
+ const report = await readArkadeCash(
20632
+ request.token,
20633
+ this.readonlyWallet.indexerProvider,
20634
+ await this.readonlyWallet.getArkadeInfo(),
20635
+ this.readonlyWallet.onchainProvider
20636
+ );
20637
+ return this.tagged({
20638
+ id,
20639
+ type: "ARKADE_CASH",
20640
+ payload: { action: "get", cashId: arkadeCashId(cash), ...report }
20641
+ });
20642
+ }
20643
+ case "create": {
20644
+ try {
20645
+ const token = await this.requireWallet().createCash(request.amount);
20646
+ return this.tagged({
20647
+ id,
20648
+ type: "ARKADE_CASH",
20649
+ payload: { action: "create", token }
20650
+ });
20651
+ } catch (error) {
20652
+ if (!(error instanceof ArkadeCashCreateError)) throw error;
20653
+ return this.tagged({
20654
+ id,
20655
+ error: serializeArkadeCashCreateError(
20656
+ error
20657
+ )
20658
+ });
20659
+ }
20660
+ }
20661
+ case "activities": {
20662
+ const records = createArkadeCashTracker();
20663
+ request.records.forEach(
20664
+ (record) => addArkadeCashRecord(records, record)
20665
+ );
20666
+ const state = await this.walletRepository?.getWalletState();
20667
+ const recovered = state?.settings?.arkadeCashRecovery;
20668
+ if (Array.isArray(recovered)) {
20669
+ recovered.filter(isArkadeCashRecord).forEach((record) => addArkadeCashRecord(records, record));
20670
+ }
20671
+ return this.tagged({
20672
+ id,
20673
+ type: "ARKADE_CASH",
20674
+ payload: {
20675
+ action: "activities",
20676
+ activities: await arkadeCashActivity(
20677
+ records,
20678
+ await this.buildTransactionHistoryFromCache() ?? []
20679
+ )
20680
+ }
20681
+ });
20682
+ }
20683
+ case "claim": {
20684
+ const result = await this.requireWallet().claimCash(request.token);
20685
+ return this.tagged({
20686
+ id,
20687
+ type: "ARKADE_CASH",
20688
+ payload: { action: "claim", ...result }
20689
+ });
20690
+ }
20691
+ case "reveal": {
20692
+ const record = ArkadeCash.fromString(request.token);
20693
+ return this.tagged({
20694
+ id,
20695
+ type: "ARKADE_CASH",
20696
+ payload: { action: "reveal", cashId: arkadeCashId(record) }
20697
+ });
20698
+ }
20699
+ }
20700
+ return this.tagged({ id, error: new Error("Unknown Arkade Cash action") });
20701
+ }
20395
20702
  case "GET_OPERATOR_INFO":
20396
20703
  case "GET_ARKADE_INFO": {
20397
20704
  const { payload } = message;
@@ -21016,7 +21323,7 @@ var WalletMessageHandler = class {
21016
21323
  this.lazyBoardingInit = payload.lazyBoarding ?? false;
21017
21324
  this.boardingEpoch++;
21018
21325
  this.boardingLoaded = false;
21019
- this.indexerProvider = new chunkXWUCNMPN_cjs.RestIndexerProvider(arkServerUrl);
21326
+ this.indexerProvider = new chunk3NALVGMJ_cjs.RestIndexerProvider(arkServerUrl);
21020
21327
  await this.onWalletInitialized();
21021
21328
  }
21022
21329
  /** @see RequestInitWallet.payload.lazyBoarding */
@@ -21362,9 +21669,8 @@ var WalletMessageHandler = class {
21362
21669
  * arkcash) are excluded by default, mirroring {@link ReadonlyWallet.getVtxos}:
21363
21670
  * they are settled in their own isolated intent and must stay out of the
21364
21671
  * wallet's balance / VTXO / coin-selection / pending-tx views that read this.
21365
- * The transaction-history caller opts back in via `includeRecoveryOnly` to
21366
- * match the non-worker `getTransactionHistory`, which reads contracts
21367
- * directly and does include them.
21672
+ * Transaction history excludes them too, as does the non-worker
21673
+ * `getTransactionHistory`.
21368
21674
  */
21369
21675
  async getVtxosFromRepo(options) {
21370
21676
  return (await this.repoSnapshot(options)).vtxos;
@@ -21382,8 +21688,7 @@ var WalletMessageHandler = class {
21382
21688
  * what it knows is closed — so the coins of a just-registered escrowed
21383
21689
  * contract would count as available until the next poll.
21384
21690
  *
21385
- * Recovery-only contracts are skipped unless `includeRecoveryOnly` (see
21386
- * {@link getVtxosFromRepo}).
21691
+ * Recovery-only contracts are skipped (see {@link getVtxosFromRepo}).
21387
21692
  */
21388
21693
  async repoSnapshot(options = {}) {
21389
21694
  const repository = this.walletRepository;
@@ -21407,9 +21712,7 @@ var WalletMessageHandler = class {
21407
21712
  void addressPromise.catch(() => void 0);
21408
21713
  const manager = await wallet.getContractManager();
21409
21714
  const contracts = await manager.getContracts();
21410
- const eligible = contracts.filter(
21411
- (contract) => options.includeRecoveryOnly || !isRecoveryOnlyContract(contract)
21412
- );
21715
+ const eligible = contracts.filter((contract) => !isRecoveryOnlyContract(contract));
21413
21716
  const listsPromise = Promise.all(
21414
21717
  eligible.map((contract) => getVtxosForContract(repository, contract, options))
21415
21718
  );
@@ -21460,11 +21763,11 @@ var WalletMessageHandler = class {
21460
21763
  async buildTransactionHistoryFromCache() {
21461
21764
  if (!this.readonlyWallet) return null;
21462
21765
  const [{ snapshot, vtxos }, { boardingTxs, commitmentsToIgnore }] = await Promise.all([
21463
- this.repoSnapshot({ includeRecoveryOnly: true }),
21766
+ this.repoSnapshot(),
21464
21767
  this.readonlyWallet.getBoardingTxs()
21465
21768
  ]);
21466
21769
  const indexerProvider = this.indexerProvider;
21467
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunkKCL5AVML_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
21770
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunkOMPDPBT5_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
21468
21771
  return buildTransactionHistory(
21469
21772
  vtxos,
21470
21773
  boardingTxs,
@@ -21533,9 +21836,9 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
21533
21836
  // budget so the worker's snapshot fallback stays reachable before this
21534
21837
  // page deadline fires — lowering it below the budget would time the page
21535
21838
  // out while the worker is still seconds from answering from cache.
21536
- GET_OPERATOR_INFO: chunkKCL5AVML_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
21839
+ GET_OPERATOR_INFO: chunkOMPDPBT5_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
21537
21840
  /** @deprecated Use `GET_OPERATOR_INFO`. */
21538
- GET_ARKADE_INFO: chunkKCL5AVML_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
21841
+ GET_ARKADE_INFO: chunkOMPDPBT5_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
21539
21842
  INDEXER_GET_VTXOS: 2e4,
21540
21843
  INDEXER_GET_VIRTUAL_TXS: 2e4,
21541
21844
  GET_VTXOS: 2e4,
@@ -21575,6 +21878,8 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
21575
21878
  RECOVER_VTXOS: 5e4,
21576
21879
  RENEW_VTXOS: 5e4,
21577
21880
  SWEEP_EXPIRED_BOARDING_UTXOS: 5e4,
21881
+ // Only `get`/`activities`/`reveal`: `create` and `claim` stream with no deadline.
21882
+ ARKADE_CASH: 5e4,
21578
21883
  COSIGN_ONCHAIN_TX: 5e4,
21579
21884
  SEND_ONCHAIN: 5e4,
21580
21885
  // Streaming/long-running like RENEW_VTXOS (rotation + settle); the value is
@@ -21633,10 +21938,10 @@ function getRequestDedupKey(request) {
21633
21938
  }
21634
21939
  function cosignWorkerError(e) {
21635
21940
  if (e instanceof Error && e.message === "Unknown message") {
21636
- return new chunkKCL5AVML_cjs.OnchainCosignUnsupportedError();
21941
+ return new chunkOMPDPBT5_cjs.OnchainCosignUnsupportedError();
21637
21942
  }
21638
21943
  if (e instanceof ServiceWorkerTimeoutError) {
21639
- return new chunkKCL5AVML_cjs.OnchainCosignAmbiguousError(e.message, { cause: e });
21944
+ return new chunkOMPDPBT5_cjs.OnchainCosignAmbiguousError(e.message, { cause: e });
21640
21945
  }
21641
21946
  return rehydrateCosignError(e);
21642
21947
  }
@@ -21691,7 +21996,7 @@ var ServiceWorkerAssetManager = class extends ServiceWorkerReadonlyAssetManager
21691
21996
  }
21692
21997
  };
21693
21998
  var initializeMessageBus = (serviceWorker, config, timeoutMs = 2e3) => {
21694
- chunkKCL5AVML_cjs.assertTimerMs("messageBusTimeoutMs", timeoutMs);
21999
+ chunkOMPDPBT5_cjs.assertTimerMs("messageBusTimeoutMs", timeoutMs);
21695
22000
  const initCmd = {
21696
22001
  tag: "INITIALIZE_MESSAGE_BUS",
21697
22002
  id: getRandomId(),
@@ -21734,6 +22039,28 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
21734
22039
  }
21735
22040
  serviceWorker;
21736
22041
  messageTag;
22042
+ arkadeCash = (request) => this.cashRequest(request);
22043
+ async cashRequest(request) {
22044
+ const message = {
22045
+ id: getRandomId(),
22046
+ tag: this.messageTag,
22047
+ type: "ARKADE_CASH",
22048
+ payload: request
22049
+ };
22050
+ try {
22051
+ const response = isLongRunningCashAction(request) ? await this.sendMessageWithRetry(message, {
22052
+ onEvent: () => {
22053
+ },
22054
+ isComplete: (resp) => resp.type === "ARKADE_CASH"
22055
+ }) : await this.sendMessage(message);
22056
+ return response.payload;
22057
+ } catch (error) {
22058
+ if (isSerializedArkadeCashCreateError(error)) {
22059
+ throw deserializeArkadeCashCreateError(error);
22060
+ }
22061
+ throw error;
22062
+ }
22063
+ }
21737
22064
  walletRepository;
21738
22065
  contractRepository;
21739
22066
  identity;
@@ -21789,7 +22116,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
21789
22116
  Object.entries(options.messageTimeouts ?? {}).filter(([, ms]) => ms !== void 0)
21790
22117
  );
21791
22118
  for (const [key, value] of Object.entries(overrides)) {
21792
- chunkKCL5AVML_cjs.assertTimerMs(`messageTimeouts.${key}`, value);
22119
+ chunkOMPDPBT5_cjs.assertTimerMs(`messageTimeouts.${key}`, value);
21793
22120
  }
21794
22121
  const messageTimeouts = {
21795
22122
  ...DEFAULT_MESSAGE_TIMEOUTS,
@@ -22134,7 +22461,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
22134
22461
  try {
22135
22462
  const response = await this.sendMessage(message);
22136
22463
  const { vtxos, page } = response.payload;
22137
- return { vtxos: vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo), page: page && { ...page } };
22464
+ return { vtxos: vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo), page: page && { ...page } };
22138
22465
  } catch (cause) {
22139
22466
  throw new Error(`Failed to get vtxos: ${cause}`, { cause });
22140
22467
  }
@@ -22243,7 +22570,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
22243
22570
  };
22244
22571
  try {
22245
22572
  const response = await this.sendMessage(message);
22246
- return response.payload.vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo);
22573
+ return response.payload.vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo);
22247
22574
  } catch (error) {
22248
22575
  throw new Error(`Failed to get vtxos: ${error}`);
22249
22576
  }
@@ -22274,7 +22601,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
22274
22601
  "Service worker does not support the requested contract scope or freshness check"
22275
22602
  );
22276
22603
  }
22277
- return payload.vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo);
22604
+ return payload.vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo);
22278
22605
  } catch (error) {
22279
22606
  throw new Error(`Failed to get spendable vtxos: ${error}`);
22280
22607
  }
@@ -22469,7 +22796,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
22469
22796
  };
22470
22797
  try {
22471
22798
  const response = await sendContractMessage(message);
22472
- return response.payload.vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo);
22799
+ return response.payload.vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo);
22473
22800
  } catch (cause) {
22474
22801
  throw new Error(`Failed to annotate vtxos: ${cause}`, { cause });
22475
22802
  }
@@ -23141,7 +23468,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
23141
23468
  };
23142
23469
  try {
23143
23470
  const response = await wallet.sendMessage(message);
23144
- return response.payload.vtxos.map(chunkKCL5AVML_cjs.normalizeVtxo);
23471
+ return response.payload.vtxos.map(chunkOMPDPBT5_cjs.normalizeVtxo);
23145
23472
  } catch (e) {
23146
23473
  throw new Error(`Failed to get expiring vtxos: ${e}`);
23147
23474
  }
@@ -23363,7 +23690,7 @@ var OnchainWallet = class _OnchainWallet {
23363
23690
  feeRate,
23364
23691
  params.address
23365
23692
  );
23366
- let tx = new chunkKCL5AVML_cjs.Transaction();
23693
+ let tx = new chunkOMPDPBT5_cjs.Transaction();
23367
23694
  for (const input of inputs) {
23368
23695
  tx.addInput({
23369
23696
  txid: input.txid,
@@ -23421,7 +23748,7 @@ var OnchainWallet = class _OnchainWallet {
23421
23748
  * @throws If the parent has no anchor, or funding cannot be selected/signed
23422
23749
  */
23423
23750
  async bumpAnchor(parentHex, feeRate) {
23424
- const parent = chunkKCL5AVML_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
23751
+ const parent = chunkOMPDPBT5_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
23425
23752
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
23426
23753
  const child = await this.buildBumpPackage(parent, feeRate, coins);
23427
23754
  return [parent.hex, child.hex];
@@ -24273,7 +24600,7 @@ var CachingOperatorProvider = class {
24273
24600
  constructor(inner, ttlMs = DEFAULT_TTL_MS) {
24274
24601
  this.inner = inner;
24275
24602
  this.ttlMs = ttlMs;
24276
- chunkKCL5AVML_cjs.assertNonNegativeMs("ttlMs", ttlMs);
24603
+ chunkOMPDPBT5_cjs.assertNonNegativeMs("ttlMs", ttlMs);
24277
24604
  this.unsubscribe = inner.onServerInfoChanged?.((info) => {
24278
24605
  this.cached = info;
24279
24606
  this.expiresAt = Date.now() + this.ttlMs;
@@ -24360,7 +24687,7 @@ exports.BIP322 = void 0;
24360
24687
  async function sign2(message, identity, network) {
24361
24688
  const xOnlyPubKey = await identity.xOnlyPublicKey();
24362
24689
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
24363
- const toSpend = chunkKCL5AVML_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
24690
+ const toSpend = chunkOMPDPBT5_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
24364
24691
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
24365
24692
  const signed = await identity.sign(toSign, [0]);
24366
24693
  signed.finalizeIdx(0);
@@ -24418,7 +24745,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
24418
24745
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
24419
24746
  return false;
24420
24747
  }
24421
- const toSpend = chunkKCL5AVML_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
24748
+ const toSpend = chunkOMPDPBT5_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
24422
24749
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript);
24423
24750
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
24424
24751
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -24439,7 +24766,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
24439
24766
  }
24440
24767
  const sighashType = sigWithHash[sigWithHash.length - 1];
24441
24768
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
24442
- const toSpend = chunkKCL5AVML_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
24769
+ const toSpend = chunkOMPDPBT5_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
24443
24770
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
24444
24771
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
24445
24772
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -24492,7 +24819,7 @@ function encodeCompactSize(n) {
24492
24819
  return buf;
24493
24820
  }
24494
24821
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
24495
- const tx = new chunkKCL5AVML_cjs.Transaction({ version: 0 });
24822
+ const tx = new chunkOMPDPBT5_cjs.Transaction({ version: 0 });
24496
24823
  tx.addInput({
24497
24824
  txid: toSpend.id,
24498
24825
  index: 0,
@@ -24506,12 +24833,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
24506
24833
  });
24507
24834
  tx.addOutput({
24508
24835
  amount: 0n,
24509
- script: chunkKCL5AVML_cjs.OP_RETURN_EMPTY_PKSCRIPT
24836
+ script: chunkOMPDPBT5_cjs.OP_RETURN_EMPTY_PKSCRIPT
24510
24837
  });
24511
24838
  return tx;
24512
24839
  }
24513
24840
  function craftBIP322ToSignSimple(toSpend, pkScript) {
24514
- const tx = new chunkKCL5AVML_cjs.Transaction({ version: 0 });
24841
+ const tx = new chunkOMPDPBT5_cjs.Transaction({ version: 0 });
24515
24842
  tx.addInput({
24516
24843
  txid: toSpend.id,
24517
24844
  index: 0,
@@ -24523,12 +24850,12 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
24523
24850
  });
24524
24851
  tx.addOutput({
24525
24852
  amount: 0n,
24526
- script: chunkKCL5AVML_cjs.OP_RETURN_EMPTY_PKSCRIPT
24853
+ script: chunkOMPDPBT5_cjs.OP_RETURN_EMPTY_PKSCRIPT
24527
24854
  });
24528
24855
  return tx;
24529
24856
  }
24530
24857
  function finalizeVirtualTx(type, psbtBase64) {
24531
- const tx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
24858
+ const tx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
24532
24859
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
24533
24860
  const input = tx.getInput(0);
24534
24861
  if (!input) {
@@ -24562,7 +24889,7 @@ async function resolveUnilateralPath(params) {
24562
24889
  const { vtxo, scriptHex, contractRepository } = params;
24563
24890
  const contract = contractRepository ? (await collectContracts(contractRepository, { script: scriptHex }))[0] : void 0;
24564
24891
  if (contract) {
24565
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
24892
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
24566
24893
  if (!handler) {
24567
24894
  throw new ExitPathError(
24568
24895
  "no-handler",
@@ -24798,7 +25125,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
24798
25125
  let totalAmount = 0n;
24799
25126
  const txWeightEstimator = TxWeightEstimator.create();
24800
25127
  for (const vtxo of vtxos) {
24801
- if (!chunkKCL5AVML_cjs.canSweepOnchain(vtxo)) {
25128
+ if (!chunkOMPDPBT5_cjs.canSweepOnchain(vtxo)) {
24802
25129
  throw new Error(
24803
25130
  `Vtxo ${vtxo.txid}:${vtxo.vout} cannot be swept onchain: it is not fully unrolled (use unroll first), or its exit output was already spent`
24804
25131
  );
@@ -24850,7 +25177,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
24850
25177
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
24851
25178
  );
24852
25179
  }
24853
- const tx = new chunkKCL5AVML_cjs.Transaction({ version: 2 });
25180
+ const tx = new chunkOMPDPBT5_cjs.Transaction({ version: 2 });
24854
25181
  for (const input of inputs) {
24855
25182
  tx.addInput(input);
24856
25183
  }
@@ -24933,7 +25260,7 @@ async function buildSignedSweep(params) {
24933
25260
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
24934
25261
  );
24935
25262
  }
24936
- const tx = new chunkKCL5AVML_cjs.Transaction({ version: 2 });
25263
+ const tx = new chunkOMPDPBT5_cjs.Transaction({ version: 2 });
24937
25264
  tx.addInput({
24938
25265
  txid: vtxo.txid,
24939
25266
  index: vtxo.vout,
@@ -24988,7 +25315,7 @@ async function resolveFeeRate(opts) {
24988
25315
  }
24989
25316
  async function selectExitVtxos(opts) {
24990
25317
  if (!opts.vtxos) return opts.wallet.getVtxos();
24991
- const res = await chunkKCL5AVML_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
25318
+ const res = await chunkOMPDPBT5_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
24992
25319
  const scripts = [
24993
25320
  ...new Set(res.vtxos.filter((vtxo) => !vtxo.isSpent).map((vtxo) => vtxo.script))
24994
25321
  ];
@@ -25006,7 +25333,7 @@ async function selectExitVtxos(opts) {
25006
25333
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
25007
25334
  );
25008
25335
  }
25009
- const handler = chunkAMH7Q3DF_cjs.contractHandlers.get(contract.type);
25336
+ const handler = chunkMQUATTIM_cjs.contractHandlers.get(contract.type);
25010
25337
  if (!handler) {
25011
25338
  throw new Error(`no contract handler registered for type '${contract.type}'`);
25012
25339
  }
@@ -25040,7 +25367,7 @@ async function computeExitLayout(opts, feeRate) {
25040
25367
  if (pendingNodes.length > 0) {
25041
25368
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
25042
25369
  for (const psbt of txs) {
25043
- psbts.set(chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
25370
+ psbts.set(chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
25044
25371
  }
25045
25372
  }
25046
25373
  const childVsize = Number(
@@ -25205,7 +25532,7 @@ var Executor = class {
25205
25532
  constructor(pkg, provider, opts) {
25206
25533
  this.pkg = pkg;
25207
25534
  this.provider = provider;
25208
- chunkKCL5AVML_cjs.assertTimerMs("pollIntervalMs", opts?.pollIntervalMs);
25535
+ chunkOMPDPBT5_cjs.assertTimerMs("pollIntervalMs", opts?.pollIntervalMs);
25209
25536
  this.pollIntervalMs = opts?.pollIntervalMs ?? 5e3;
25210
25537
  this.feeWallet = opts?.feeWallet;
25211
25538
  this.signal = opts?.signal;
@@ -25589,7 +25916,7 @@ async function prepare(opts) {
25589
25916
  if (newFee <= splitterFee) break;
25590
25917
  splitterFee = newFee;
25591
25918
  }
25592
- const splitter = new chunkKCL5AVML_cjs.Transaction({ version: 2 });
25919
+ const splitter = new chunkOMPDPBT5_cjs.Transaction({ version: 2 });
25593
25920
  for (const coin of selected.inputs) {
25594
25921
  splitter.addInput({
25595
25922
  txid: coin.txid,
@@ -25768,7 +26095,7 @@ chunkFLPWNMX3_cjs.__export(arkade_exports, {
25768
26095
  validateProgram: () => chunkJFJNB7ZH_cjs.validateProgram,
25769
26096
  witnessRefToBytes: () => chunkJFJNB7ZH_cjs.witnessRefToBytes
25770
26097
  });
25771
- var isVtxoCoin = (input) => chunkKCL5AVML_cjs.isVirtualCoin(input);
26098
+ var isVtxoCoin = (input) => chunkOMPDPBT5_cjs.isVirtualCoin(input);
25772
26099
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
25773
26100
  if (!signer && inputs.some((input) => !isVtxoCoin(input))) {
25774
26101
  throw new Error("createArkadeBatchHandler: boarding inputs need a signer");
@@ -25811,7 +26138,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
25811
26138
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
25812
26139
  return { skip: true };
25813
26140
  }
25814
- const commitmentTx = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
26141
+ const commitmentTx = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
25815
26142
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
25816
26143
  if (recipients && recipients.length > 0) {
25817
26144
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -25849,7 +26176,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
25849
26176
  if (connectorTree) {
25850
26177
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
25851
26178
  }
25852
- let commitmentPsbt = chunkKCL5AVML_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
26179
+ let commitmentPsbt = chunkOMPDPBT5_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
25853
26180
  assertFinalCommitmentMatchesValidated(
25854
26181
  commitmentPsbt,
25855
26182
  validatedCommitmentTxid,
@@ -25891,7 +26218,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
25891
26218
  boardingIndices.push(boardingIdx);
25892
26219
  continue;
25893
26220
  }
25894
- if (!chunkKCL5AVML_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
26221
+ if (!chunkOMPDPBT5_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
25895
26222
  continue;
25896
26223
  }
25897
26224
  if (connectorIndex >= connectorLeaves.length) {
@@ -25929,7 +26256,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
25929
26256
  forfeitOutputScript
25930
26257
  );
25931
26258
  if (input.extraWitness?.length) {
25932
- chunkKCL5AVML_cjs.setArkPsbtField(forfeitTx, 0, chunkKCL5AVML_cjs.ConditionWitness, input.extraWitness);
26259
+ chunkOMPDPBT5_cjs.setArkPsbtField(forfeitTx, 0, chunkOMPDPBT5_cjs.ConditionWitness, input.extraWitness);
25933
26260
  }
25934
26261
  if (signer) forfeitTx = await signer.sign(forfeitTx, [0]);
25935
26262
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -26024,7 +26351,7 @@ async function renewProgramContractOutputs(client, targets, opts = {}) {
26024
26351
  });
26025
26352
  const { fees } = await arkProvider.getInfo();
26026
26353
  const fee = new Estimator(fees?.intentFee ?? {}).evaluate(
26027
- legs.map(({ coin }) => chunkKCL5AVML_cjs.toOffchainInputFeeParams(chunkKCL5AVML_cjs.normalizeVtxo(coin))),
26354
+ legs.map(({ coin }) => chunkOMPDPBT5_cjs.toOffchainInputFeeParams(chunkOMPDPBT5_cjs.normalizeVtxo(coin))),
26028
26355
  [],
26029
26356
  legs.map(({ contract, coin }) => ({
26030
26357
  amount: BigInt(coin.value),
@@ -26087,7 +26414,7 @@ async function renewProgramContractOutputs(client, targets, opts = {}) {
26087
26414
  const [signedProof, deleteProof] = await Promise.all(
26088
26415
  [message, deleteMessage].map(
26089
26416
  (m) => emulator.submitIntent({
26090
- proof: base.base64.encode(chunkKCL5AVML_cjs.Proof.create(m, coins, outputs).toPSBT()),
26417
+ proof: base.base64.encode(chunkOMPDPBT5_cjs.Proof.create(m, coins, outputs).toPSBT()),
26091
26418
  message: m
26092
26419
  })
26093
26420
  )
@@ -26564,17 +26891,17 @@ var ArkadeContract = class _ArkadeContract {
26564
26891
  const [registered] = await manager.getContracts({ script: scriptHex });
26565
26892
  if (registered) {
26566
26893
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
26567
- return (withVtxos?.vtxos ?? []).filter((v) => !chunkKCL5AVML_cjs.isVtxoSpent(v) && !v.isUnrolled);
26894
+ return (withVtxos?.vtxos ?? []).filter((v) => !chunkOMPDPBT5_cjs.isVtxoSpent(v) && !v.isUnrolled);
26568
26895
  }
26569
26896
  }
26570
26897
  if (!this.client.indexer) {
26571
26898
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
26572
26899
  }
26573
- const { vtxos } = await chunkKCL5AVML_cjs.getNormalizedVtxos(this.client.indexer, {
26900
+ const { vtxos } = await chunkOMPDPBT5_cjs.getNormalizedVtxos(this.client.indexer, {
26574
26901
  scripts: [scriptHex],
26575
26902
  spendableOnly: true
26576
26903
  });
26577
- return vtxos.filter((v) => !chunkKCL5AVML_cjs.isVtxoSpent(v) && !v.isUnrolled);
26904
+ return vtxos.filter((v) => !chunkOMPDPBT5_cjs.isVtxoSpent(v) && !v.isUnrolled);
26578
26905
  }
26579
26906
  /** Total spendable balance (requires an indexer). */
26580
26907
  async getBalance() {
@@ -26740,7 +27067,7 @@ var ArkadeTransactionBuilder = class {
26740
27067
  this.client.checkpoint
26741
27068
  );
26742
27069
  inputs.forEach(({ coin }, i) => {
26743
- if (coin.sourceTx) chunkKCL5AVML_cjs.setArkPsbtField(arkTx, i, chunkKCL5AVML_cjs.PrevArkTxField, coin.sourceTx);
27070
+ if (coin.sourceTx) chunkOMPDPBT5_cjs.setArkPsbtField(arkTx, i, chunkOMPDPBT5_cjs.PrevArkTxField, coin.sourceTx);
26744
27071
  });
26745
27072
  if (inputs.some(({ unlocker }) => unlocker.fn.arkadeScript)) {
26746
27073
  const indexer = this.client.indexer;
@@ -26760,8 +27087,8 @@ var ArkadeTransactionBuilder = class {
26760
27087
  (w) => witnessBytes(unlocker, w)
26761
27088
  );
26762
27089
  if (condition.length === 0) return;
26763
- chunkKCL5AVML_cjs.setArkPsbtField(arkTx, i, chunkKCL5AVML_cjs.ConditionWitness, condition);
26764
- chunkKCL5AVML_cjs.setArkPsbtField(checkpoints[i], 0, chunkKCL5AVML_cjs.ConditionWitness, condition);
27090
+ chunkOMPDPBT5_cjs.setArkPsbtField(arkTx, i, chunkOMPDPBT5_cjs.ConditionWitness, condition);
27091
+ chunkOMPDPBT5_cjs.setArkPsbtField(checkpoints[i], 0, chunkOMPDPBT5_cjs.ConditionWitness, condition);
26765
27092
  });
26766
27093
  const packets = [];
26767
27094
  if (this.assetSpecs.length > 0) {
@@ -26824,7 +27151,7 @@ var ArkadeTransactionBuilder = class {
26824
27151
  );
26825
27152
  }
26826
27153
  const { sequence, lockTime } = this.leafTimelocks(fn);
26827
- const tx = new chunkKCL5AVML_cjs.Transaction({ version: 2, lockTime });
27154
+ const tx = new chunkOMPDPBT5_cjs.Transaction({ version: 2, lockTime });
26828
27155
  tx.addInput({ txid: base.hex.decode(coin.txid), index: coin.vout, sequence });
26829
27156
  for (const o of outputs) tx.addOutput(o);
26830
27157
  const condition = (fn.def.tapscript.witness ?? []).map((w) => witnessBytes(unlocker, w));
@@ -26988,20 +27315,20 @@ var ArkadeTransactionBuilder = class {
26988
27315
  * A caller's packet counts for every input, unread; arkd checks what it actually routes.
26989
27316
  */
26990
27317
  routesAssetsFrom(vin) {
26991
- return this.extraPackets.some((p) => p.type() === chunkXWUCNMPN_cjs.Packet.PACKET_TYPE) || this.assetSpecs.some((spec) => spec.inputs.some((i) => i.vin === vin));
27318
+ return this.extraPackets.some((p) => p.type() === chunk3NALVGMJ_cjs.Packet.PACKET_TYPE) || this.assetSpecs.some((spec) => spec.inputs.some((i) => i.vin === vin));
26992
27319
  }
26993
27320
  buildAssetPacket() {
26994
27321
  const groups = this.assetSpecs.map((s) => {
26995
- const id = typeof s.assetId === "string" ? chunkXWUCNMPN_cjs.AssetId.fromString(s.assetId) : chunkXWUCNMPN_cjs.AssetId.fromBytes(s.assetId);
26996
- return chunkXWUCNMPN_cjs.AssetGroup.create(
27322
+ const id = typeof s.assetId === "string" ? chunk3NALVGMJ_cjs.AssetId.fromString(s.assetId) : chunk3NALVGMJ_cjs.AssetId.fromBytes(s.assetId);
27323
+ return chunk3NALVGMJ_cjs.AssetGroup.create(
26997
27324
  id,
26998
27325
  null,
26999
- s.inputs.map((i) => chunkXWUCNMPN_cjs.AssetInput.create(i.vin, i.amount)),
27000
- s.outputs.map((o) => chunkXWUCNMPN_cjs.AssetOutput.create(o.vout, o.amount)),
27001
- (s.metadata ?? []).map((m) => chunkXWUCNMPN_cjs.Metadata.create(m.key, m.value))
27326
+ s.inputs.map((i) => chunk3NALVGMJ_cjs.AssetInput.create(i.vin, i.amount)),
27327
+ s.outputs.map((o) => chunk3NALVGMJ_cjs.AssetOutput.create(o.vout, o.amount)),
27328
+ (s.metadata ?? []).map((m) => chunk3NALVGMJ_cjs.Metadata.create(m.key, m.value))
27002
27329
  );
27003
27330
  });
27004
- return chunkXWUCNMPN_cjs.Packet.create(groups);
27331
+ return chunk3NALVGMJ_cjs.Packet.create(groups);
27005
27332
  }
27006
27333
  };
27007
27334
  function unspendable(coin, now) {
@@ -27474,14 +27801,14 @@ var walletFeeSource = (wallet) => async () => (await wallet.arkProvider.getInfo(
27474
27801
  function offchainInputFees(vtxos, fees) {
27475
27802
  const estimator = new Estimator(fees?.intentFee ?? {});
27476
27803
  return vtxos.reduce(
27477
- (total, vtxo) => total + estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
27804
+ (total, vtxo) => total + estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
27478
27805
  0
27479
27806
  );
27480
27807
  }
27481
27808
  async function changeOutputFee(wallet, inputs, needed, fees) {
27482
27809
  const estimator = new Estimator(fees?.intentFee ?? {});
27483
27810
  const net = inputs.reduce(
27484
- (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkKCL5AVML_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
27811
+ (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkOMPDPBT5_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
27485
27812
  0n
27486
27813
  );
27487
27814
  const script = base.hex.encode(chunkFLPWNMX3_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
@@ -27654,11 +27981,14 @@ exports.WalletCannotSignError = WalletCannotSignError;
27654
27981
  exports.WalletMessageHandler = WalletMessageHandler;
27655
27982
  exports.WalletNotInitializedError = WalletNotInitializedError;
27656
27983
  exports.WsElectrumChainSource = WsElectrumChainSource;
27984
+ exports.addArkadeCashRecord = addArkadeCashRecord;
27657
27985
  exports.adoptContractDescriptor = adoptContractDescriptor;
27658
27986
  exports.applyWalletStateUpdate = applyWalletStateUpdate;
27659
27987
  exports.arkAssetRail = arkAssetRail;
27660
27988
  exports.arkRail = arkRail;
27661
27989
  exports.arkTarget = arkTarget;
27990
+ exports.arkadeCashId = arkadeCashId;
27991
+ exports.arkadeCashResolver = arkadeCashResolver;
27662
27992
  exports.arkade_exports = arkade_exports;
27663
27993
  exports.assertFinalCommitmentMatchesValidated = assertFinalCommitmentMatchesValidated;
27664
27994
  exports.assertHistoryPageFilter = assertHistoryPageFilter;
@@ -27705,6 +28035,7 @@ exports.contractFromArkContract = contractFromArkContract;
27705
28035
  exports.contractFromArkContractWithAddress = contractFromArkContractWithAddress;
27706
28036
  exports.contractPreimage = contractPreimage;
27707
28037
  exports.contractSigner = contractSigner;
28038
+ exports.createArkadeCashTracker = createArkadeCashTracker;
27708
28039
  exports.createAssetPacket = createAssetPacket;
27709
28040
  exports.createDefaultActivityRegistry = createDefaultActivityRegistry;
27710
28041
  exports.createDefaultPaymentRouter = createDefaultPaymentRouter;
@@ -27761,6 +28092,7 @@ exports.legacyVtxoFacts = legacyVtxoFacts;
27761
28092
  exports.logExcludedVtxos = logExcludedVtxos;
27762
28093
  exports.makeHandle = makeHandle;
27763
28094
  exports.matchServerCheckpoints = matchServerCheckpoints;
28095
+ exports.mergeArkadeCashRecord = mergeArkadeCashRecord;
27764
28096
  exports.mergeChainedTxType = mergeChainedTxType;
27765
28097
  exports.mnemonicFromPrf = mnemonicFromPrf;
27766
28098
  exports.notifyExitObserved = notifyExitObserved;
@@ -27773,6 +28105,7 @@ exports.prfSupport = prfSupport;
27773
28105
  exports.promisifyRequest = promisifyRequest;
27774
28106
  exports.provisionClaimSecret = provisionClaimSecret;
27775
28107
  exports.provisionRefundKey = provisionRefundKey;
28108
+ exports.readArkadeCash = readArkadeCash;
27776
28109
  exports.registerWalletRestoreHook = registerWalletRestoreHook;
27777
28110
  exports.resolveAssetAmount = resolveAssetAmount;
27778
28111
  exports.resolveBatchExpiryPolicy = resolveBatchExpiryPolicy;
@@ -27806,5 +28139,5 @@ exports.waitForIncomingFunds = waitForIncomingFunds;
27806
28139
  exports.walletFeeSource = walletFeeSource;
27807
28140
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
27808
28141
  exports.withPrevTxs = withPrevTxs;
27809
- //# sourceMappingURL=chunk-T254PXSN.cjs.map
27810
- //# sourceMappingURL=chunk-T254PXSN.cjs.map
28142
+ //# sourceMappingURL=chunk-URGVQ5TQ.cjs.map
28143
+ //# sourceMappingURL=chunk-URGVQ5TQ.cjs.map