@arkade-os/sdk 0.5.2 → 0.5.4

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 (88) hide show
  1. package/README.md +36 -34
  2. package/dist/adapters/expo.cjs +9 -5
  3. package/dist/adapters/expo.d.cts +11 -7
  4. package/dist/adapters/expo.d.ts +11 -7
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/{asyncStorageTaskQueue-DIn7bTqN.d.ts → asyncStorageTaskQueue-DHMIxY04.d.ts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-BtEc3Qca.d.cts → asyncStorageTaskQueue-DTBa8EH7.d.cts} +2 -2
  8. package/dist/{chunk-LWRMSC4M.js → chunk-6CUP6ZIF.js} +4 -4
  9. package/dist/{chunk-LWRMSC4M.js.map → chunk-6CUP6ZIF.js.map} +1 -1
  10. package/dist/{chunk-HKG26NUT.js → chunk-AG4TFD6F.js} +140 -59
  11. package/dist/chunk-AG4TFD6F.js.map +1 -0
  12. package/dist/{chunk-PVFQFQBY.cjs → chunk-B6VNKGIH.cjs} +10 -10
  13. package/dist/chunk-B6VNKGIH.cjs.map +1 -0
  14. package/dist/{chunk-U5XG7SWA.js → chunk-BTRCN4JJ.js} +22 -19
  15. package/dist/chunk-BTRCN4JJ.js.map +1 -0
  16. package/dist/{chunk-TAIWH3HG.cjs → chunk-DNITZVNG.cjs} +28 -47
  17. package/dist/chunk-DNITZVNG.cjs.map +1 -0
  18. package/dist/{chunk-OM6FJ76H.cjs → chunk-E6OOJEHL.cjs} +49 -49
  19. package/dist/{chunk-OM6FJ76H.cjs.map → chunk-E6OOJEHL.cjs.map} +1 -1
  20. package/dist/{chunk-2OCYL6BJ.cjs → chunk-F3FAE7VJ.cjs} +850 -652
  21. package/dist/chunk-F3FAE7VJ.cjs.map +1 -0
  22. package/dist/{chunk-GGKR4O5X.cjs → chunk-GHUUT54D.cjs} +143 -58
  23. package/dist/chunk-GHUUT54D.cjs.map +1 -0
  24. package/dist/{chunk-MOBDJ7U2.js → chunk-MWVAWFX6.js} +4 -4
  25. package/dist/chunk-MWVAWFX6.js.map +1 -0
  26. package/dist/{chunk-2QRUQXLS.js → chunk-TUOLZBNC.js} +19 -39
  27. package/dist/chunk-TUOLZBNC.js.map +1 -0
  28. package/dist/{chunk-64R7CRKN.cjs → chunk-WXNSISXK.cjs} +37 -34
  29. package/dist/chunk-WXNSISXK.cjs.map +1 -0
  30. package/dist/{chunk-AJWXVQYG.js → chunk-ZJHLLDBP.js} +372 -177
  31. package/dist/chunk-ZJHLLDBP.js.map +1 -0
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +3 -3
  34. package/dist/contracts/handlers/index.d.ts +3 -3
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-CaL8EN4Q.d.cts → delegate-f4_t864Z.d.cts} +1 -1
  37. package/dist/{delegate-Jd4zs88Q.d.ts → delegate-xrSBNybC.d.ts} +1 -1
  38. package/dist/{index-D-xqVzf8.d.ts → index-BJDz15ms.d.ts} +5 -5
  39. package/dist/{index-BwdGzNSn.d.cts → index-BjiVGtp8.d.cts} +5 -5
  40. package/dist/{index-DdKxfC29.d.cts → index-DRwe0UDN.d.cts} +194 -114
  41. package/dist/{index-DdKxfC29.d.ts → index-DRwe0UDN.d.ts} +194 -114
  42. package/dist/index.cjs +333 -313
  43. package/dist/index.d.cts +80 -45
  44. package/dist/index.d.ts +80 -45
  45. package/dist/index.js +4 -4
  46. package/dist/repositories/realm/index.cjs +65 -36
  47. package/dist/repositories/realm/index.cjs.map +1 -1
  48. package/dist/repositories/realm/index.d.cts +7 -3
  49. package/dist/repositories/realm/index.d.ts +7 -3
  50. package/dist/repositories/realm/index.js +35 -6
  51. package/dist/repositories/realm/index.js.map +1 -1
  52. package/dist/repositories/sqlite/index.cjs +176 -110
  53. package/dist/repositories/sqlite/index.cjs.map +1 -1
  54. package/dist/repositories/sqlite/index.d.cts +23 -13
  55. package/dist/repositories/sqlite/index.d.ts +23 -13
  56. package/dist/repositories/sqlite/index.js +148 -83
  57. package/dist/repositories/sqlite/index.js.map +1 -1
  58. package/dist/{taskRunner-ZyGGjtIq.d.ts → taskRunner-BPPU-YHG.d.cts} +4 -4
  59. package/dist/{taskRunner-67YSEpsz.d.cts → taskRunner-CDlNeth0.d.ts} +4 -4
  60. package/dist/wallet/expo/background.cjs +14 -14
  61. package/dist/wallet/expo/background.cjs.map +1 -1
  62. package/dist/wallet/expo/background.d.cts +3 -3
  63. package/dist/wallet/expo/background.d.ts +3 -3
  64. package/dist/wallet/expo/background.js +7 -7
  65. package/dist/wallet/expo/background.js.map +1 -1
  66. package/dist/wallet/expo/index.cjs +18 -15
  67. package/dist/wallet/expo/index.cjs.map +1 -1
  68. package/dist/wallet/expo/index.d.cts +7 -6
  69. package/dist/wallet/expo/index.d.ts +7 -6
  70. package/dist/wallet/expo/index.js +9 -6
  71. package/dist/wallet/expo/index.js.map +1 -1
  72. package/dist/{wallet-bFS7VybL.d.ts → wallet-Oc3Wd5gv.d.ts} +27 -19
  73. package/dist/{wallet-B8LW7cV1.d.cts → wallet-jVBDQl6R.d.cts} +27 -19
  74. package/dist/worker/expo/index.cjs +9 -9
  75. package/dist/worker/expo/index.d.cts +4 -4
  76. package/dist/worker/expo/index.d.ts +4 -4
  77. package/dist/worker/expo/index.js +5 -5
  78. package/package.json +1 -1
  79. package/dist/chunk-2OCYL6BJ.cjs.map +0 -1
  80. package/dist/chunk-2QRUQXLS.js.map +0 -1
  81. package/dist/chunk-64R7CRKN.cjs.map +0 -1
  82. package/dist/chunk-AJWXVQYG.js.map +0 -1
  83. package/dist/chunk-GGKR4O5X.cjs.map +0 -1
  84. package/dist/chunk-HKG26NUT.js.map +0 -1
  85. package/dist/chunk-MOBDJ7U2.js.map +0 -1
  86. package/dist/chunk-PVFQFQBY.cjs.map +0 -1
  87. package/dist/chunk-TAIWH3HG.cjs.map +0 -1
  88. package/dist/chunk-U5XG7SWA.js.map +0 -1
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var chunk64R7CRKN_cjs = require('./chunk-64R7CRKN.cjs');
4
- var chunkOM6FJ76H_cjs = require('./chunk-OM6FJ76H.cjs');
5
- var chunkGGKR4O5X_cjs = require('./chunk-GGKR4O5X.cjs');
6
- var utils_js = require('@scure/btc-signer/utils.js');
7
- var btcSigner = require('@scure/btc-signer');
8
- var base = require('@scure/base');
3
+ var chunkWXNSISXK_cjs = require('./chunk-WXNSISXK.cjs');
4
+ var chunkE6OOJEHL_cjs = require('./chunk-E6OOJEHL.cjs');
5
+ var chunkGHUUT54D_cjs = require('./chunk-GHUUT54D.cjs');
9
6
  var musig2 = require('@scure/btc-signer/musig2.js');
7
+ var base = require('@scure/base');
10
8
  var utils_js$1 = require('@noble/curves/utils.js');
11
9
  var secp256k1 = require('@noble/secp256k1');
12
10
  var secp256k1_js = require('@noble/curves/secp256k1.js');
13
11
  var script_js = require('@scure/btc-signer/script.js');
14
12
  var transaction_js = require('@scure/btc-signer/transaction.js');
13
+ var utils_js = require('@scure/btc-signer/utils.js');
14
+ var btcSigner = require('@scure/btc-signer');
15
15
  var bip39 = require('@scure/bip39');
16
16
  var english_js = require('@scure/bip39/wordlists/english.js');
17
17
  var descriptorsScure = require('@bitcoinerlab/descriptors-scure');
@@ -145,6 +145,7 @@ var TreeSignerSession = class _TreeSignerSession {
145
145
  graph = null;
146
146
  scriptRoot = null;
147
147
  rootSharedOutputAmount = null;
148
+ /** Use a fresh key/session per signing attempt; never reuse sessions or their nonces. */
148
149
  static random() {
149
150
  const secretKey = utils_js.randomPrivateKeyBytes();
150
151
  return new _TreeSignerSession(secretKey);
@@ -187,7 +188,7 @@ var TreeSignerSession = class _TreeSignerSession {
187
188
  noncesByPubkey.set(base.hex.encode(myPublicKey.subarray(1)), myNonce);
188
189
  const tx = this.graph.find(txid);
189
190
  if (!tx) throw new Error(`missing tx for txid ${txid}`);
190
- const cosigners = chunkGGKR4O5X_cjs.getArkPsbtFields(tx.root, 0, chunkGGKR4O5X_cjs.CosignerPublicKey).map(
191
+ const cosigners = chunkGHUUT54D_cjs.getArkPsbtFields(tx.root, 0, chunkGHUUT54D_cjs.CosignerPublicKey).map(
191
192
  (c) => base.hex.encode(c.key.subarray(1))
192
193
  // xonly pubkey
193
194
  );
@@ -239,7 +240,7 @@ var TreeSignerSession = class _TreeSignerSession {
239
240
  if (!aggNonce) throw new Error("missing aggregate nonce");
240
241
  const prevoutAmounts = [];
241
242
  const prevoutScripts = [];
242
- const cosigners = chunkGGKR4O5X_cjs.getArkPsbtFields(g.root, 0, chunkGGKR4O5X_cjs.CosignerPublicKey).map((c) => c.key);
243
+ const cosigners = chunkGHUUT54D_cjs.getArkPsbtFields(g.root, 0, chunkGHUUT54D_cjs.CosignerPublicKey).map((c) => c.key);
243
244
  const { finalKey } = aggregateKeys(cosigners, true, {
244
245
  taprootTweak: this.scriptRoot
245
246
  });
@@ -322,7 +323,7 @@ var SingleKey = class _SingleKey {
322
323
  async sign(tx, inputIndexes) {
323
324
  const txCpy = tx.clone();
324
325
  if (!inputIndexes) {
325
- chunkGGKR4O5X_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
326
+ chunkGHUUT54D_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH);
326
327
  try {
327
328
  if (!txCpy.sign(this.key, ALLOWED_SIGHASH)) {
328
329
  throw new Error("Failed to sign transaction");
@@ -422,7 +423,7 @@ var SeedIdentity = class _SeedIdentity {
422
423
  let network;
423
424
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
424
425
  descriptor = opts.descriptor;
425
- network = chunkOM6FJ76H_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
426
+ network = chunkE6OOJEHL_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
426
427
  } else {
427
428
  network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
428
429
  descriptor = descriptorsScure.scriptExpressions.trBIP32({
@@ -499,7 +500,7 @@ var SeedIdentity = class _SeedIdentity {
499
500
  }
500
501
  /** Returns true when `descriptor` is derived from this identity's seed. */
501
502
  ownsDescriptor(descriptor) {
502
- return chunkOM6FJ76H_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
503
+ return chunkE6OOJEHL_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
503
504
  }
504
505
  /**
505
506
  * Signs each request with the key derived from its descriptor.
@@ -538,7 +539,7 @@ var SeedIdentity = class _SeedIdentity {
538
539
  }
539
540
  // ── internal helpers ─────────────────────────────────────────────
540
541
  derivePrivateKeyForDescriptor(descriptor) {
541
- const network = chunkOM6FJ76H_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
542
+ const network = chunkE6OOJEHL_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
542
543
  const expansion = descriptorsScure.expand({ descriptor, network });
543
544
  if (expansion.isRanged) {
544
545
  throw new Error(
@@ -563,7 +564,7 @@ var SeedIdentity = class _SeedIdentity {
563
564
  signTxWithKey(tx, key, inputIndexes) {
564
565
  const txCpy = tx.clone();
565
566
  if (!inputIndexes) {
566
- chunkGGKR4O5X_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
567
+ chunkGHUUT54D_cjs.assertAllowedSighashTypes(txCpy, ALLOWED_SIGHASH2);
567
568
  try {
568
569
  if (!txCpy.sign(key, ALLOWED_SIGHASH2)) {
569
570
  throw new Error("Failed to sign transaction");
@@ -615,7 +616,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
615
616
  /** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
616
617
  descriptor;
617
618
  constructor(descriptor) {
618
- const network = chunkOM6FJ76H_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
619
+ const network = chunkE6OOJEHL_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
619
620
  let expansion;
620
621
  try {
621
622
  expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
@@ -650,7 +651,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
650
651
  }
651
652
  /** Returns true when `descriptor` derives from this identity's xpub. */
652
653
  ownsDescriptor(descriptor) {
653
- return chunkOM6FJ76H_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
654
+ return chunkE6OOJEHL_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
654
655
  }
655
656
  };
656
657
  function serializeSeedOwnedSigningIdentity(identity) {
@@ -793,10 +794,10 @@ var DescriptorIdentity = class {
793
794
  this.base = base;
794
795
  }
795
796
  async xOnlyPublicKey() {
796
- return chunkOM6FJ76H_cjs.deriveDescriptorLeafPubKey(this.descriptor);
797
+ return chunkE6OOJEHL_cjs.deriveDescriptorLeafPubKey(this.descriptor);
797
798
  }
798
799
  async compressedPublicKey() {
799
- return chunkOM6FJ76H_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
800
+ return chunkE6OOJEHL_cjs.deriveDescriptorLeafCompressedPubKey(this.descriptor);
800
801
  }
801
802
  async sign(tx, inputIndexes) {
802
803
  const [signed] = await this.signer.signWithDescriptor([
@@ -856,8 +857,8 @@ var StaticDescriptorProvider = class _StaticDescriptorProvider {
856
857
  }
857
858
  isOurs(descriptor) {
858
859
  try {
859
- const normalized = chunkOM6FJ76H_cjs.normalizeToDescriptor(descriptor);
860
- const pubKey = chunkOM6FJ76H_cjs.extractPubKey(normalized);
860
+ const normalized = chunkE6OOJEHL_cjs.normalizeToDescriptor(descriptor);
861
+ const pubKey = chunkE6OOJEHL_cjs.extractPubKey(normalized);
861
862
  return pubKey.toLowerCase() === this.pubKeyHex.toLowerCase();
862
863
  } catch {
863
864
  return false;
@@ -913,9 +914,14 @@ var OVERLAP_MS = 24 * 60 * 60 * 1e3;
913
914
  var walletStateLocks = /* @__PURE__ */ new WeakMap();
914
915
  var WALLET_STATE_LOCK_NAME = "arkade-wallet-state";
915
916
  async function updateWalletState(repo, updater) {
917
+ const atomic = repo.atomicWalletState;
916
918
  const prev = walletStateLocks.get(repo) ?? Promise.resolve();
917
919
  const op = prev.then(
918
920
  () => withWebLock(WALLET_STATE_LOCK_NAME, async () => {
921
+ if (atomic !== void 0) {
922
+ await atomic.update(updater);
923
+ return;
924
+ }
919
925
  const state = await repo.getWalletState() ?? {};
920
926
  await repo.saveWalletState(updater(state));
921
927
  })
@@ -1194,7 +1200,7 @@ function unwrapKeyring(provider) {
1194
1200
  }
1195
1201
  function keyOf(descriptor) {
1196
1202
  try {
1197
- return chunkOM6FJ76H_cjs.extractPubKey(chunkOM6FJ76H_cjs.normalizeToDescriptor(descriptor)).toLowerCase();
1203
+ return chunkE6OOJEHL_cjs.extractPubKey(chunkE6OOJEHL_cjs.normalizeToDescriptor(descriptor)).toLowerCase();
1198
1204
  } catch {
1199
1205
  return void 0;
1200
1206
  }
@@ -1285,12 +1291,12 @@ async function resolveDescriptorSigner(descriptor, identity, provider) {
1285
1291
  signMessageWithDescriptor: (ownedDescriptor, message, signatureType) => identity.signDescriptorMessage(ownedDescriptor, message, signatureType)
1286
1292
  } : void 0;
1287
1293
  const owner = providerOwner ?? identityOwner;
1288
- if (owner && chunkOM6FJ76H_cjs.parseHDDescriptor(descriptor)) {
1294
+ if (owner && chunkE6OOJEHL_cjs.parseHDDescriptor(descriptor)) {
1289
1295
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
1290
1296
  }
1291
1297
  let key;
1292
1298
  try {
1293
- key = chunkOM6FJ76H_cjs.deriveDescriptorLeafPubKey(descriptor);
1299
+ key = chunkE6OOJEHL_cjs.deriveDescriptorLeafPubKey(descriptor);
1294
1300
  } catch {
1295
1301
  throw new ForeignDescriptorError(descriptor);
1296
1302
  }
@@ -1343,14 +1349,14 @@ function buildSaltedPreimageMessage(xonly, salt) {
1343
1349
  }
1344
1350
  var PREIMAGE_INDEX = 0;
1345
1351
  function isPerArtifactDescriptor(descriptor) {
1346
- return chunkOM6FJ76H_cjs.parseHDDescriptor(descriptor) !== null;
1352
+ return chunkE6OOJEHL_cjs.parseHDDescriptor(descriptor) !== null;
1347
1353
  }
1348
1354
  async function provisionDescriptor(wallet) {
1349
1355
  const allocated = isHDAllocationCapable(wallet) ? await wallet.getNextSigningDescriptor() : void 0;
1350
- return allocated ?? await chunkOM6FJ76H_cjs.identityDescriptor(wallet.identity);
1356
+ return allocated ?? await chunkE6OOJEHL_cjs.identityDescriptor(wallet.identity);
1351
1357
  }
1352
1358
  async function provisionRefundKey(wallet) {
1353
- const descriptorPromise = chunkOM6FJ76H_cjs.identityDescriptor(wallet.identity);
1359
+ const descriptorPromise = chunkE6OOJEHL_cjs.identityDescriptor(wallet.identity);
1354
1360
  const identityPubkeyPromise = wallet.identity.xOnlyPublicKey();
1355
1361
  void identityPubkeyPromise.catch(() => void 0);
1356
1362
  const descriptor = await descriptorPromise;
@@ -1365,7 +1371,7 @@ async function provisionRefundKey(wallet) {
1365
1371
  );
1366
1372
  }
1367
1373
  const address = await wallet.getAddress();
1368
- const { pkScript } = chunkGGKR4O5X_cjs.ArkAddress.decode(address);
1374
+ const { pkScript } = chunkGHUUT54D_cjs.ArkAddress.decode(address);
1369
1375
  return { descriptor, pubkey, pkScript, address };
1370
1376
  }
1371
1377
  async function provisionClaimSecret(wallet, opts = {}) {
@@ -1413,7 +1419,7 @@ async function contractSigner(wallet, descriptor) {
1413
1419
  const signer = isHDWalletCapable(wallet) ? await wallet.signerForDescriptor(descriptor) : wallet.identity;
1414
1420
  let expected;
1415
1421
  try {
1416
- expected = chunkOM6FJ76H_cjs.deriveDescriptorLeafPubKey(descriptor);
1422
+ expected = chunkE6OOJEHL_cjs.deriveDescriptorLeafPubKey(descriptor);
1417
1423
  } catch (cause) {
1418
1424
  throw new ForeignDescriptorError(descriptor, { cause });
1419
1425
  }
@@ -1495,7 +1501,7 @@ function debugLog(debug, ...args) {
1495
1501
  }
1496
1502
  function normalizeOptions(pathOrOptions) {
1497
1503
  const o = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
1498
- chunkGGKR4O5X_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
1504
+ chunkGHUUT54D_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
1499
1505
  return {
1500
1506
  path: o.path,
1501
1507
  updateViaCache: o.updateViaCache ?? "none",
@@ -1618,14 +1624,14 @@ var RestDelegateProvider = class {
1618
1624
  */
1619
1625
  async delegate(intent, forfeitTxs, options) {
1620
1626
  const url = `${this.url}/v1/delegate`;
1621
- const response = await chunkGGKR4O5X_cjs.baseFetch(url, {
1627
+ const response = await chunkGHUUT54D_cjs.baseFetch(url, {
1622
1628
  method: "POST",
1623
1629
  headers: {
1624
1630
  "Content-Type": "application/json"
1625
1631
  },
1626
1632
  body: JSON.stringify({
1627
1633
  intent: {
1628
- message: chunkGGKR4O5X_cjs.Intent.encodeMessage(intent.message),
1634
+ message: chunkGHUUT54D_cjs.Proof.encodeMessage(intent.message),
1629
1635
  proof: intent.proof
1630
1636
  },
1631
1637
  forfeit_txs: forfeitTxs,
@@ -1644,7 +1650,7 @@ var RestDelegateProvider = class {
1644
1650
  */
1645
1651
  async getDelegateInfo() {
1646
1652
  const url = `${this.url}/v1/delegator/info`;
1647
- const response = await chunkGGKR4O5X_cjs.rateGate.runHttp(url, () => chunkGGKR4O5X_cjs.baseFetch(url));
1653
+ const response = await chunkGHUUT54D_cjs.rateGate.runHttp(url, () => chunkGHUUT54D_cjs.baseFetch(url));
1648
1654
  if (!response.ok) {
1649
1655
  const errorText2 = await response.text();
1650
1656
  throw new Error(`Failed to get delegate info: ${errorText2}`);
@@ -1700,7 +1706,7 @@ async function collectPages(read) {
1700
1706
  return items;
1701
1707
  }
1702
1708
  function scriptFromArkAddress(address) {
1703
- return base.hex.encode(chunkGGKR4O5X_cjs.ArkAddress.decode(address).pkScript);
1709
+ return base.hex.encode(chunkGHUUT54D_cjs.ArkAddress.decode(address).pkScript);
1704
1710
  }
1705
1711
 
1706
1712
  // src/repositories/walletRepository.ts
@@ -1722,6 +1728,15 @@ function assertHistoryPageFilter(filter) {
1722
1728
  throw new RangeError("history since must be non-negative Unix milliseconds");
1723
1729
  }
1724
1730
  }
1731
+ function applyWalletStateUpdate(state, updater) {
1732
+ const updated = updater(state);
1733
+ if (updated && typeof updated.then === "function") {
1734
+ if (updated instanceof Promise) void updated.catch(() => {
1735
+ });
1736
+ throw new TypeError("wallet-state updater must be synchronous");
1737
+ }
1738
+ return updated;
1739
+ }
1725
1740
  function compareScriptVtxoCursors(a, b) {
1726
1741
  return a.address < b.address ? -1 : a.address > b.address ? 1 : compareOutpoints(a, b);
1727
1742
  }
@@ -1762,9 +1777,9 @@ async function collectScriptVtxos(repository, script, options) {
1762
1777
  return [...byOutpoint.values()].map((row) => row.vtxo);
1763
1778
  }
1764
1779
  function unspentScriptVtxos(rows, copies) {
1765
- const spent = copies.filter((copy) => chunkGGKR4O5X_cjs.isVtxoSpent(copy.vtxo));
1780
+ const spent = copies.filter((copy) => chunkGHUUT54D_cjs.isVtxoSpent(copy.vtxo));
1766
1781
  return rows.filter(
1767
- (row) => !chunkGGKR4O5X_cjs.isVtxoSpent(row.vtxo) && !spent.some(
1782
+ (row) => !chunkGHUUT54D_cjs.isVtxoSpent(row.vtxo) && !spent.some(
1768
1783
  (copy) => copy.address !== row.address && copy.vtxo.txid === row.vtxo.txid && copy.vtxo.vout === row.vtxo.vout && shouldReplaceScriptVtxo(row, copy)
1769
1784
  )
1770
1785
  );
@@ -1847,7 +1862,7 @@ var ESPLORA_URL = {
1847
1862
  regtest: "http://localhost:3000/api"
1848
1863
  };
1849
1864
  var EsploraProvider = class {
1850
- constructor(baseUrl = ESPLORA_URL[chunkGGKR4O5X_cjs.DEFAULT_NETWORK_NAME], opts) {
1865
+ constructor(baseUrl = ESPLORA_URL[chunkGHUUT54D_cjs.DEFAULT_NETWORK_NAME], opts) {
1851
1866
  this.baseUrl = baseUrl;
1852
1867
  this.pollingInterval = opts?.pollingInterval ?? 15e3;
1853
1868
  this.forcePolling = opts?.forcePolling ?? false;
@@ -1862,7 +1877,7 @@ var EsploraProvider = class {
1862
1877
  */
1863
1878
  addressWatches = /* @__PURE__ */ new Map();
1864
1879
  async getCoins(address) {
1865
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1880
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
1866
1881
  if (!response.ok) {
1867
1882
  throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
1868
1883
  }
@@ -1871,12 +1886,12 @@ var EsploraProvider = class {
1871
1886
  async getFeeRate() {
1872
1887
  let url = `${this.baseUrl}/fee-estimates`;
1873
1888
  let key = "1";
1874
- let response = await chunkGGKR4O5X_cjs.baseFetch(url);
1889
+ let response = await chunkGHUUT54D_cjs.baseFetch(url);
1875
1890
  if (response.status === 404) {
1876
1891
  await response.body?.cancel();
1877
1892
  url = `${this.baseUrl}/v1/fees/recommended`;
1878
1893
  key = "fastestFee";
1879
- response = await chunkGGKR4O5X_cjs.baseFetch(url);
1894
+ response = await chunkGHUUT54D_cjs.baseFetch(url);
1880
1895
  }
1881
1896
  if (response.status === 404) {
1882
1897
  await response.body?.cancel();
@@ -1913,7 +1928,7 @@ var EsploraProvider = class {
1913
1928
  }
1914
1929
  }
1915
1930
  async getTxOutspends(txid) {
1916
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1931
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
1917
1932
  if (!response.ok) {
1918
1933
  const error = await response.text();
1919
1934
  throw new Error(`Failed to get transaction outspends: ${error}`);
@@ -1921,7 +1936,7 @@ var EsploraProvider = class {
1921
1936
  return response.json();
1922
1937
  }
1923
1938
  async getTransactions(address) {
1924
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1939
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
1925
1940
  if (!response.ok) {
1926
1941
  const error = await response.text();
1927
1942
  throw new Error(`Failed to get transactions: ${error}`);
@@ -1930,14 +1945,14 @@ var EsploraProvider = class {
1930
1945
  }
1931
1946
  /** Orders of magnitude smaller than `/address/{addr}/txs`: the polling fallback's probe. */
1932
1947
  async getAddressStats(address) {
1933
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1948
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/address/${address}`);
1934
1949
  if (!response.ok) {
1935
1950
  throw new Error(`Failed to get address stats: ${response.statusText}`);
1936
1951
  }
1937
1952
  return response.json();
1938
1953
  }
1939
1954
  async getRawTransaction(txid) {
1940
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1955
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/hex`);
1941
1956
  if (!response.ok) {
1942
1957
  const error = await response.text();
1943
1958
  throw new Error(`Failed to get raw transaction ${txid}: ${error}`);
@@ -1945,7 +1960,7 @@ var EsploraProvider = class {
1945
1960
  return base.hex.decode((await response.text()).trim());
1946
1961
  }
1947
1962
  async getTxStatus(txid) {
1948
- const txresponse = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1963
+ const txresponse = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
1949
1964
  if (!txresponse.ok) {
1950
1965
  throw new Error(txresponse.statusText);
1951
1966
  }
@@ -1953,7 +1968,7 @@ var EsploraProvider = class {
1953
1968
  if (!tx.status.confirmed) {
1954
1969
  return { confirmed: false };
1955
1970
  }
1956
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1971
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
1957
1972
  if (!response.ok) {
1958
1973
  throw new Error(`Failed to get transaction status: ${response.statusText}`);
1959
1974
  }
@@ -2227,9 +2242,9 @@ var EsploraProvider = class {
2227
2242
  return { subscribers, teardown, started };
2228
2243
  }
2229
2244
  async getChainTip() {
2230
- let tipBlocks = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/blocks`);
2245
+ let tipBlocks = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/blocks`);
2231
2246
  if (tipBlocks.status === 404) {
2232
- tipBlocks = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2247
+ tipBlocks = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/v1/blocks`);
2233
2248
  }
2234
2249
  if (!tipBlocks.ok) {
2235
2250
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
@@ -2250,7 +2265,7 @@ var EsploraProvider = class {
2250
2265
  };
2251
2266
  }
2252
2267
  async broadcastPackage(parent, child) {
2253
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2268
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
2254
2269
  method: "POST",
2255
2270
  headers: {
2256
2271
  "Content-Type": "application/json"
@@ -2266,7 +2281,7 @@ var EsploraProvider = class {
2266
2281
  return result;
2267
2282
  }
2268
2283
  async broadcastTx(tx) {
2269
- const response = await chunkGGKR4O5X_cjs.baseFetch(`${this.baseUrl}/tx`, {
2284
+ const response = await chunkGHUUT54D_cjs.baseFetch(`${this.baseUrl}/tx`, {
2270
2285
  method: "POST",
2271
2286
  headers: {
2272
2287
  "Content-Type": "text/plain"
@@ -2438,7 +2453,7 @@ function findP2AOutput(tx) {
2438
2453
  var CHILD_DUST_AMOUNT = 546;
2439
2454
  function buildAnchorChild(params) {
2440
2455
  const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
2441
- const child = new chunkGGKR4O5X_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2456
+ const child = new chunkGHUUT54D_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
2442
2457
  const anchor = findP2AOutput(parent);
2443
2458
  child.addInput(anchor);
2444
2459
  const estimator = TxWeightEstimator.create().addP2AInput();
@@ -2487,7 +2502,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
2487
2502
  );
2488
2503
  }
2489
2504
  function buildForfeitTxWithOutput(inputs, output, txLocktime) {
2490
- const tx = new chunkGGKR4O5X_cjs.Transaction({
2505
+ const tx = new chunkGHUUT54D_cjs.Transaction({
2491
2506
  version: 3,
2492
2507
  lockTime: txLocktime
2493
2508
  });
@@ -2514,7 +2529,7 @@ function validateConnectorsTxGraph(settlementTxB64, connectorsGraph) {
2514
2529
  connectorsGraph.validate();
2515
2530
  if (connectorsGraph.root.inputsLength !== 1) throw ErrNumberOfInputs;
2516
2531
  const rootInput = connectorsGraph.root.getInput(0);
2517
- const settlementTx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(settlementTxB64));
2532
+ const settlementTx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(settlementTxB64));
2518
2533
  if (settlementTx.outputsLength <= BATCH_OUTPUT_CONNECTORS_INDEX)
2519
2534
  throw ErrInvalidSettlementTxOutputs;
2520
2535
  const expectedRootTxid = settlementTx.id;
@@ -2563,7 +2578,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
2563
2578
  if (previousScriptKey.length !== 32) {
2564
2579
  throw new Error(`parent output ${childIndex} has invalid script`);
2565
2580
  }
2566
- const cosigners = chunkGGKR4O5X_cjs.getArkPsbtFields(child.root, 0, chunkGGKR4O5X_cjs.CosignerPublicKey);
2581
+ const cosigners = chunkGHUUT54D_cjs.getArkPsbtFields(child.root, 0, chunkGHUUT54D_cjs.CosignerPublicKey);
2567
2582
  if (cosigners.length === 0) {
2568
2583
  throw ErrMissingCosignersPublicKeys;
2569
2584
  }
@@ -2621,7 +2636,7 @@ var EmulatorPacket = class _EmulatorPacket {
2621
2636
  return new _EmulatorPacket(entries);
2622
2637
  }
2623
2638
  static fromBytes(data) {
2624
- const reader = new chunk64R7CRKN_cjs.BufferReader(data);
2639
+ const reader = new chunkWXNSISXK_cjs.BufferReader(data);
2625
2640
  const entryCount = reader.readCompactSize();
2626
2641
  const entries = [];
2627
2642
  for (let i = 0; i < entryCount; i++) {
@@ -2639,7 +2654,7 @@ var EmulatorPacket = class _EmulatorPacket {
2639
2654
  return _EmulatorPacket.PACKET_TYPE;
2640
2655
  }
2641
2656
  serialize() {
2642
- const writer = new chunk64R7CRKN_cjs.BufferWriter();
2657
+ const writer = new chunkWXNSISXK_cjs.BufferWriter();
2643
2658
  writer.writeCompactSize(this.entries.length);
2644
2659
  for (const entry of this.entries) {
2645
2660
  writer.writeUint16LE(entry.vin);
@@ -2726,7 +2741,7 @@ var Extension = class _Extension {
2726
2741
  `expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
2727
2742
  );
2728
2743
  }
2729
- const reader = new chunk64R7CRKN_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2744
+ const reader = new chunkWXNSISXK_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
2730
2745
  const packets = [];
2731
2746
  while (reader.remaining() > 0) {
2732
2747
  const packetType = reader.readByte();
@@ -2799,7 +2814,7 @@ var Extension = class _Extension {
2799
2814
  * getAssetPacket returns the embedded Packet, or null if not present.
2800
2815
  */
2801
2816
  getAssetPacket() {
2802
- return this.packets.find((p) => p instanceof chunk64R7CRKN_cjs.Packet) ?? null;
2817
+ return this.packets.find((p) => p instanceof chunkWXNSISXK_cjs.Packet) ?? null;
2803
2818
  }
2804
2819
  /**
2805
2820
  * getEmulatorPacket returns the embedded EmulatorPacket, or null if not present.
@@ -2823,8 +2838,8 @@ var Extension = class _Extension {
2823
2838
  };
2824
2839
  function parsePacket(packetType, data) {
2825
2840
  switch (packetType) {
2826
- case chunk64R7CRKN_cjs.Packet.PACKET_TYPE:
2827
- return chunk64R7CRKN_cjs.Packet.fromBytes(data);
2841
+ case chunkWXNSISXK_cjs.Packet.PACKET_TYPE:
2842
+ return chunkWXNSISXK_cjs.Packet.fromBytes(data);
2828
2843
  case EmulatorPacket.PACKET_TYPE:
2829
2844
  return EmulatorPacket.fromBytes(data);
2830
2845
  default:
@@ -2871,23 +2886,23 @@ function buildOpReturnScript(data) {
2871
2886
  }
2872
2887
  return script;
2873
2888
  }
2874
- var ErrOffchainOutputNotFound = (address) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2875
- var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
2889
+ var ErrOffchainOutputNotFound = (address) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(`offchain send output not found: ${address}`);
2890
+ var ErrInvalidAssetOutputAmount = (got, want, assetId) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(
2876
2891
  `invalid asset output amount for ${assetId}: got ${got}, want ${want}`
2877
2892
  );
2878
- var ErrAssetGroupNotFound = (assetId) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2879
- var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
2893
+ var ErrAssetGroupNotFound = (assetId) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(`asset group not found in batch leaf: ${assetId}`);
2894
+ var ErrAssetOutputNotFound = (assetId, outputIndex) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(
2880
2895
  `asset output not found in asset group ${assetId} at index ${outputIndex}`
2881
2896
  );
2882
- var ErrOnchainOutputNotFound = (address) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2883
- var ErrUnvalidatedOffchainOutput = (address) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
2897
+ var ErrOnchainOutputNotFound = (address) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(`onchain output not found: ${address}`);
2898
+ var ErrUnvalidatedOffchainOutput = (address) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(
2884
2899
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2885
2900
  );
2886
- var ErrIntentOutputNotFound = (index, kind) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
2887
- `${kind} output ${index} of the intent proof is not present in what the server built`
2901
+ var ErrIntentOutputNotFound = (index, kind) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(
2902
+ `${kind} output ${index} of the proof is not present in what the server built`
2888
2903
  );
2889
- var ErrUnvalidatedIntentOutput = (index) => new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
2890
- `offchain output ${index} of the intent proof cannot be validated: virtual output tree signing did not run`
2904
+ var ErrUnvalidatedIntentOutput = (index) => new chunkGHUUT54D_cjs.ServerResponseMismatchError(
2905
+ `offchain output ${index} of the proof cannot be validated: virtual output tree signing did not run`
2891
2906
  );
2892
2907
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
2893
2908
  var ErrInvalidOnchainOutputAssets = (address) => new Error(`onchain output ${address} cannot have assets`);
@@ -2895,7 +2910,7 @@ var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain ou
2895
2910
  function assertFinalCommitmentMatchesValidated(finalCommitmentTx, validatedCommitmentTxid, context) {
2896
2911
  if (!validatedCommitmentTxid) return;
2897
2912
  if (finalCommitmentTx.id === validatedCommitmentTxid) return;
2898
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
2913
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
2899
2914
  `${context}: finalization commitment tx ${finalCommitmentTx.id} differs from the validated commitment tx ${validatedCommitmentTxid}`
2900
2915
  );
2901
2916
  }
@@ -2905,7 +2920,7 @@ function validateBatchRecipients(commitmentTx, vtxoTreeLeaves, recipients, netwo
2905
2920
  for (const recipient of recipients) {
2906
2921
  let arkAddress;
2907
2922
  try {
2908
- arkAddress = chunkGGKR4O5X_cjs.ArkAddress.decode(recipient.address);
2923
+ arkAddress = chunkGHUUT54D_cjs.ArkAddress.decode(recipient.address);
2909
2924
  } catch {
2910
2925
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2911
2926
  continue;
@@ -2917,7 +2932,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2917
2932
  const usedOnchainOutputs = /* @__PURE__ */ new Set();
2918
2933
  for (const recipient of recipients) {
2919
2934
  try {
2920
- chunkGGKR4O5X_cjs.ArkAddress.decode(recipient.address);
2935
+ chunkGHUUT54D_cjs.ArkAddress.decode(recipient.address);
2921
2936
  } catch {
2922
2937
  validateOnchainRecipient(commitmentTx, recipient, network, usedOnchainOutputs);
2923
2938
  continue;
@@ -2926,7 +2941,7 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2926
2941
  }
2927
2942
  }
2928
2943
  function declaredIntentOutputs(signedProof, onchainOutputIndexes) {
2929
- const proof = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2944
+ const proof = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(signedProof));
2930
2945
  const onchain = new Set(onchainOutputIndexes);
2931
2946
  const declared = [];
2932
2947
  for (let i = 0; i < proof.outputsLength; i++) {
@@ -3218,7 +3233,7 @@ function assetMintResolver() {
3218
3233
  if (!tx.assets?.length || !tx.key.arkTxid) return void 0;
3219
3234
  const minted = tx.assets.filter((a) => {
3220
3235
  try {
3221
- return base.hex.encode(chunk64R7CRKN_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3236
+ return base.hex.encode(chunkWXNSISXK_cjs.AssetId.fromString(a.assetId).txid) === tx.key.arkTxid;
3222
3237
  } catch {
3223
3238
  return false;
3224
3239
  }
@@ -3295,7 +3310,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3295
3310
  const existing = inputsByAssetId.get(asset.assetId);
3296
3311
  inputsByAssetId.set(asset.assetId, [
3297
3312
  ...existing ?? [],
3298
- chunk64R7CRKN_cjs.AssetInput.create(inputIndex, asset.amount)
3313
+ chunkWXNSISXK_cjs.AssetInput.create(inputIndex, asset.amount)
3299
3314
  ]);
3300
3315
  }
3301
3316
  }
@@ -3307,7 +3322,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3307
3322
  const existing = outputsByAssetId.get(asset.assetId);
3308
3323
  outputsByAssetId.set(asset.assetId, [
3309
3324
  ...existing ?? [],
3310
- chunk64R7CRKN_cjs.AssetOutput.create(outputIndex, asset.amount)
3325
+ chunkWXNSISXK_cjs.AssetOutput.create(outputIndex, asset.amount)
3311
3326
  ]);
3312
3327
  }
3313
3328
  }
@@ -3318,7 +3333,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3318
3333
  const existing = outputsByAssetId.get(asset.assetId);
3319
3334
  outputsByAssetId.set(asset.assetId, [
3320
3335
  ...existing ?? [],
3321
- chunk64R7CRKN_cjs.AssetOutput.create(outputIndex, asset.amount)
3336
+ chunkWXNSISXK_cjs.AssetOutput.create(outputIndex, asset.amount)
3322
3337
  ]);
3323
3338
  }
3324
3339
  }
@@ -3327,11 +3342,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
3327
3342
  for (const assetIdStr of allAssetIds) {
3328
3343
  const inputs = inputsByAssetId.get(assetIdStr);
3329
3344
  const outputs = outputsByAssetId.get(assetIdStr);
3330
- const assetId = chunk64R7CRKN_cjs.AssetId.fromString(assetIdStr);
3331
- const group = chunk64R7CRKN_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3345
+ const assetId = chunkWXNSISXK_cjs.AssetId.fromString(assetIdStr);
3346
+ const group = chunkWXNSISXK_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
3332
3347
  groups.push(group);
3333
3348
  }
3334
- return chunk64R7CRKN_cjs.Packet.create(groups);
3349
+ return chunkWXNSISXK_cjs.Packet.create(groups);
3335
3350
  }
3336
3351
  function selectCoinsWithAsset(coins, assetId, requiredAmount) {
3337
3352
  const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
@@ -3415,7 +3430,7 @@ function meetsInputExpiryFloor(coin, floor) {
3415
3430
  }
3416
3431
  function toXOnlySignerHex(pubkeyHex) {
3417
3432
  const bytes = base.hex.decode(pubkeyHex);
3418
- if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkOM6FJ76H_cjs.toXOnly(bytes, "signer key"));
3433
+ if (bytes.length === 32 || bytes.length === 33) return base.hex.encode(chunkE6OOJEHL_cjs.toXOnly(bytes, "signer key"));
3419
3434
  throw new Error(`invalid signer pubkey length: expected 32 or 33 bytes, got ${bytes.length}`);
3420
3435
  }
3421
3436
  function signerSetFromInfo(info) {
@@ -3462,14 +3477,14 @@ var toTimelock = (value) => ({
3462
3477
  var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
3463
3478
  function assertTimelockInPolicy(timelock, policy, label, overrideOption) {
3464
3479
  if (policy.requireSeconds && timelock.type === "blocks") {
3465
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3480
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3466
3481
  `${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
3467
3482
  );
3468
3483
  }
3469
3484
  const seconds = toSeconds(timelock);
3470
3485
  if (seconds < policy.minSeconds) {
3471
3486
  const remedy = overrideOption ? `; pass ${overrideOption}: ${seconds}n to Wallet.create to lower it` : "";
3472
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3487
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3473
3488
  `${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor${remedy}`
3474
3489
  );
3475
3490
  }
@@ -3490,7 +3505,7 @@ function resolveBatchExpiryPolicy(network, overrides) {
3490
3505
  }
3491
3506
  function assertValidBatchExpiry(batchExpiry, policy) {
3492
3507
  if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
3493
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3508
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3494
3509
  `batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
3495
3510
  );
3496
3511
  }
@@ -3499,21 +3514,21 @@ function assertValidBatchExpiry(batchExpiry, policy) {
3499
3514
  function assertValidServerUnrollScript(checkpointTapscript, network, advertisedForfeitPubkey) {
3500
3515
  let script;
3501
3516
  try {
3502
- script = chunkGGKR4O5X_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3517
+ script = chunkGHUUT54D_cjs.CSVMultisigTapscript.decode(base.hex.decode(checkpointTapscript));
3503
3518
  } catch (e) {
3504
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3519
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3505
3520
  `checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
3506
3521
  );
3507
3522
  }
3508
3523
  if (advertisedForfeitPubkey !== void 0) {
3509
3524
  const { pubkeys } = script.params;
3510
3525
  if (pubkeys.length !== 1) {
3511
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3526
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3512
3527
  `checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(base.hex.encode).join(", ")}]`
3513
3528
  );
3514
3529
  }
3515
3530
  if (!utils_js.equalBytes(pubkeys[0], advertisedForfeitPubkey)) {
3516
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3531
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3517
3532
  `checkpoint exit delay rejected: checkpointTapscript pubkey ${base.hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${base.hex.encode(advertisedForfeitPubkey)}`
3518
3533
  );
3519
3534
  }
@@ -3556,8 +3571,8 @@ function buildOffchainTx(inputs, outputs, serverUnrollScript) {
3556
3571
  function buildVirtualTx(inputs, outputs) {
3557
3572
  let lockTime = 0n;
3558
3573
  for (const input of inputs) {
3559
- const tapscript = chunkGGKR4O5X_cjs.decodeTapscript(chunkGGKR4O5X_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3560
- if (chunkGGKR4O5X_cjs.CLTVMultisigTapscript.is(tapscript)) {
3574
+ const tapscript = chunkGHUUT54D_cjs.decodeTapscript(chunkGHUUT54D_cjs.scriptFromTapLeafScript(input.tapLeafScript));
3575
+ if (chunkGHUUT54D_cjs.CLTVMultisigTapscript.is(tapscript)) {
3561
3576
  if (lockTime !== 0n) {
3562
3577
  if (isSeconds(lockTime) !== isSeconds(tapscript.params.absoluteTimelock)) {
3563
3578
  throw new Error("cannot mix seconds and blocks locktime");
@@ -3568,7 +3583,7 @@ function buildVirtualTx(inputs, outputs) {
3568
3583
  }
3569
3584
  }
3570
3585
  }
3571
- const tx = new chunkGGKR4O5X_cjs.Transaction({
3586
+ const tx = new chunkGHUUT54D_cjs.Transaction({
3572
3587
  version: 3,
3573
3588
  lockTime: Number(lockTime)
3574
3589
  });
@@ -3578,12 +3593,12 @@ function buildVirtualTx(inputs, outputs) {
3578
3593
  index: input.vout,
3579
3594
  sequence: lockTime ? btcSigner.DEFAULT_SEQUENCE - 1 : void 0,
3580
3595
  witnessUtxo: {
3581
- script: chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).pkScript,
3596
+ script: chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).pkScript,
3582
3597
  amount: BigInt(input.value)
3583
3598
  },
3584
3599
  tapLeafScript: [input.tapLeafScript]
3585
3600
  });
3586
- chunkGGKR4O5X_cjs.setArkPsbtField(tx, i, chunkGGKR4O5X_cjs.VtxoTaprootTree, input.tapTree);
3601
+ chunkGHUUT54D_cjs.setArkPsbtField(tx, i, chunkGHUUT54D_cjs.VtxoTaprootTree, input.tapTree);
3587
3602
  }
3588
3603
  for (const output of outputs) {
3589
3604
  tx.addOutput(output);
@@ -3594,8 +3609,8 @@ function buildVirtualTx(inputs, outputs) {
3594
3609
  return tx;
3595
3610
  }
3596
3611
  function buildCheckpointTx(vtxo, serverUnrollScript) {
3597
- const collaborativeClosure = chunkGGKR4O5X_cjs.decodeTapscript(chunkGGKR4O5X_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3598
- const checkpointVtxoScript = new chunkGGKR4O5X_cjs.VtxoScript([
3612
+ const collaborativeClosure = chunkGHUUT54D_cjs.decodeTapscript(chunkGHUUT54D_cjs.scriptFromTapLeafScript(vtxo.tapLeafScript));
3613
+ const checkpointVtxoScript = new chunkGHUUT54D_cjs.VtxoScript([
3599
3614
  serverUnrollScript.script,
3600
3615
  collaborativeClosure.script
3601
3616
  ]);
@@ -3671,7 +3686,7 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
3671
3686
  const sighashType = signature.length === 65 ? signature[64] : btcSigner.SigHash.DEFAULT;
3672
3687
  const sig = signature.subarray(0, 64);
3673
3688
  if (!allowedSighashTypes.includes(sighashType)) {
3674
- const sighashName = chunkGGKR4O5X_cjs.formatSighash(sighashType);
3689
+ const sighashName = chunkGHUUT54D_cjs.formatSighash(sighashType);
3675
3690
  throw new Error(
3676
3691
  `Unallowed sighash type ${sighashName} for input ${inputIndex}, pubkey ${pubKeyHex}.`
3677
3692
  );
@@ -3745,7 +3760,7 @@ function combineTapscriptSigs(signedTx, originalTx) {
3745
3760
  }
3746
3761
  function isValidArkAddress(address) {
3747
3762
  try {
3748
- chunkGGKR4O5X_cjs.ArkAddress.decode(address);
3763
+ chunkGHUUT54D_cjs.ArkAddress.decode(address);
3749
3764
  return true;
3750
3765
  } catch (e) {
3751
3766
  return false;
@@ -3753,16 +3768,16 @@ function isValidArkAddress(address) {
3753
3768
  }
3754
3769
  function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, context) {
3755
3770
  if (serverCheckpointTxs.length !== expectedCheckpoints.length) {
3756
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3771
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3757
3772
  `${context} returned ${serverCheckpointTxs.length} checkpoints, expected ${expectedCheckpoints.length}`
3758
3773
  );
3759
3774
  }
3760
3775
  const byTxid = new Map(expectedCheckpoints.map((c) => [c.id, c]));
3761
3776
  return serverCheckpointTxs.map((encoded, index) => {
3762
- const server = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3777
+ const server = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
3763
3778
  const local = byTxid.get(server.id);
3764
3779
  if (!local) {
3765
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3780
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3766
3781
  `${context} checkpoint ${index} txid ${server.id} does not match any submitted checkpoint`
3767
3782
  );
3768
3783
  }
@@ -3772,14 +3787,14 @@ function matchServerCheckpoints(serverCheckpointTxs, expectedCheckpoints, contex
3772
3787
  }
3773
3788
  function assertSubmittedArkTxid(response, signedArkTx, context) {
3774
3789
  if (response.arkTxid !== signedArkTx.id) {
3775
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3790
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3776
3791
  `${context} returned ark txid ${response.arkTxid}, expected ${signedArkTx.id}`
3777
3792
  );
3778
3793
  }
3779
3794
  if (response.finalArkTx === void 0) return;
3780
- const finalTxid = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3795
+ const finalTxid = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx)).id;
3781
3796
  if (finalTxid !== signedArkTx.id) {
3782
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3797
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3783
3798
  `${context} returned final ark tx ${finalTxid}, expected ${signedArkTx.id}`
3784
3799
  );
3785
3800
  }
@@ -3791,20 +3806,20 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3791
3806
  `${context}: input ${inputIndex} carries no spend leaf to verify the server signature against`
3792
3807
  );
3793
3808
  }
3794
- const script = chunkGGKR4O5X_cjs.scriptFromTapLeafScript(leaf);
3809
+ const script = chunkGHUUT54D_cjs.scriptFromTapLeafScript(leaf);
3795
3810
  let leafPubkeys;
3796
3811
  try {
3797
- leafPubkeys = chunkGGKR4O5X_cjs.decodeTapscript(script).params.pubkeys.map(
3798
- (key) => base.hex.encode(chunkOM6FJ76H_cjs.toXOnly(key, "leaf key"))
3812
+ leafPubkeys = chunkGHUUT54D_cjs.decodeTapscript(script).params.pubkeys.map(
3813
+ (key) => base.hex.encode(chunkE6OOJEHL_cjs.toXOnly(key, "leaf key"))
3799
3814
  );
3800
3815
  } catch (error) {
3801
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3816
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3802
3817
  `${context}: input ${inputIndex} spend leaf cannot be decoded (${error instanceof Error ? error.message : String(error)})`
3803
3818
  );
3804
3819
  }
3805
3820
  const signer = leafPubkeys.find((key) => serverPubkeys.has(key));
3806
3821
  if (!signer) {
3807
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3822
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3808
3823
  `${context}: input ${inputIndex} spend leaf names no signer key the server advertises`
3809
3824
  );
3810
3825
  }
@@ -3818,7 +3833,7 @@ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, co
3818
3833
  payment_js.tapLeafHash(script)
3819
3834
  );
3820
3835
  } catch (error) {
3821
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3836
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3822
3837
  `${context}: input ${inputIndex} is not signed by the server on the leaf being spent (${error instanceof Error ? error.message : String(error)})`
3823
3838
  );
3824
3839
  }
@@ -3827,20 +3842,20 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3827
3842
  const byOutpoint = new Map(inputs.map((input) => [`${input.txid}:${input.vout}`, input]));
3828
3843
  for (const [index, checkpoint] of checkpoints.entries()) {
3829
3844
  if (checkpoint.inputsLength !== 1) {
3830
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3845
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3831
3846
  `${context}: checkpoint ${index} spends ${checkpoint.inputsLength} inputs, expected 1`
3832
3847
  );
3833
3848
  }
3834
3849
  const spent = checkpoint.getInput(0);
3835
3850
  if (!spent.txid || spent.index === void 0) {
3836
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3851
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3837
3852
  `${context}: checkpoint ${index} has no input outpoint`
3838
3853
  );
3839
3854
  }
3840
3855
  const outpoint = `${base.hex.encode(spent.txid)}:${spent.index}`;
3841
3856
  const input = byOutpoint.get(outpoint);
3842
3857
  if (!input) {
3843
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3858
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3844
3859
  `${context}: checkpoint ${index} spends ${outpoint}, which is not one of the requested virtual outputs`
3845
3860
  );
3846
3861
  }
@@ -3848,50 +3863,54 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
3848
3863
  (unroll) => buildCheckpointTx(input, unroll).tx.id === checkpoint.id
3849
3864
  );
3850
3865
  if (!rebuilt) {
3851
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3866
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3852
3867
  `${context}: checkpoint ${index} txid ${checkpoint.id} differs from the checkpoint built locally for ${outpoint}`
3853
3868
  );
3854
3869
  }
3855
3870
  }
3856
3871
  }
3857
3872
  async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3858
- const { arkTx: signedArkTx, userSignedCheckpoints } = await signer.signArkTx(
3873
+ const oneShot = options?.oneShot !== false;
3874
+ const { arkTx: signedArkTx, userSignedCheckpoints: batchSigned } = await signer.signArkTx(
3859
3875
  offchainTx.arkTx,
3860
3876
  offchainTx.checkpoints
3861
3877
  );
3862
- if (userSignedCheckpoints && userSignedCheckpoints.length !== offchainTx.checkpoints.length) {
3878
+ if (batchSigned && batchSigned.length !== offchainTx.checkpoints.length) {
3863
3879
  throw new Error(
3864
- `signer returned ${userSignedCheckpoints.length} signed checkpoints, expected ${offchainTx.checkpoints.length}`
3880
+ `signer returned ${batchSigned.length} signed checkpoints, expected ${offchainTx.checkpoints.length}`
3865
3881
  );
3866
3882
  }
3883
+ const userSignedCheckpoints = (batchSigned ?? (oneShot ? await Promise.all(offchainTx.checkpoints.map((c) => signer.signCheckpoint(c.clone()))) : void 0))?.map((c) => withArkInputWitness(c, signedArkTx));
3867
3884
  await hooks?.beforeSubmit?.();
3868
3885
  const response = await provider.submitTx(
3869
3886
  base.base64.encode(signedArkTx.toPSBT()),
3870
- offchainTx.checkpoints.map((c) => base.base64.encode(c.toPSBT()))
3887
+ (oneShot ? userSignedCheckpoints : offchainTx.checkpoints.map((c) => withArkInputWitness(c, signedArkTx))).map((c) => base.base64.encode(c.toPSBT()))
3871
3888
  );
3872
3889
  assertSubmittedArkTxid(response, signedArkTx, "submitTx");
3873
3890
  const { arkTxid, signedCheckpointTxs } = response;
3874
3891
  const matched = matchServerCheckpoints(signedCheckpointTxs, offchainTx.checkpoints, "submitTx");
3875
- matched.forEach(({ server }, index) => {
3876
- try {
3877
- chunkGGKR4O5X_cjs.assertAllowedSighashTypes(server);
3878
- } catch (error) {
3879
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3880
- `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
3881
- );
3882
- }
3883
- });
3892
+ if (!oneShot) {
3893
+ matched.forEach(({ server }, index) => {
3894
+ try {
3895
+ chunkGHUUT54D_cjs.assertAllowedSighashTypes(server);
3896
+ } catch (error) {
3897
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3898
+ `submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
3899
+ );
3900
+ }
3901
+ });
3902
+ }
3884
3903
  const verify = options?.verifyServerSignatures;
3885
3904
  if (verify) {
3886
3905
  if (response.finalArkTx === void 0) {
3887
- throw new chunkGGKR4O5X_cjs.ServerResponseMismatchError(
3906
+ throw new chunkGHUUT54D_cjs.ServerResponseMismatchError(
3888
3907
  "submitTx: server returned no final ark tx to verify its signatures against"
3889
3908
  );
3890
3909
  }
3891
- const finalArkTx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3910
+ const finalArkTx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(response.finalArkTx));
3892
3911
  const serverPubkeys = new Set(
3893
3912
  [verify.serverPubkey, ...verify.deprecatedServerPubkeys ?? []].map(
3894
- (key) => base.hex.encode(chunkOM6FJ76H_cjs.toXOnly(key, "server key"))
3913
+ (key) => base.hex.encode(chunkE6OOJEHL_cjs.toXOnly(key, "server key"))
3895
3914
  )
3896
3915
  );
3897
3916
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
@@ -3907,26 +3926,62 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3907
3926
  ({ server, local }, index) => assertServerSignedLeaf(server, local, 0, serverPubkeys, `submitTx checkpoint ${index}`)
3908
3927
  );
3909
3928
  }
3929
+ const result = { arkTxid, finalArkTx: response.finalArkTx, signedCheckpointTxs };
3910
3930
  let finalCheckpoints;
3911
3931
  if (userSignedCheckpoints) {
3912
3932
  const userByTxid = new Map(
3913
3933
  userSignedCheckpoints.map((c, i) => [offchainTx.checkpoints[i].id, c])
3914
3934
  );
3935
+ if (oneShot && matched.every(
3936
+ ({ server, local }) => carriesTapscriptSigs(server, userByTxid.get(local.id))
3937
+ )) {
3938
+ await hooks?.afterFinalize?.();
3939
+ return result;
3940
+ }
3915
3941
  finalCheckpoints = matched.map(({ server, local }) => {
3916
- combineTapscriptSigs(userByTxid.get(local.id), server);
3942
+ const userSigned = userByTxid.get(local.id);
3943
+ combineTapscriptSigs(userSigned, server);
3944
+ carryConditionWitness(userSigned, server);
3917
3945
  return base.base64.encode(server.toPSBT());
3918
3946
  });
3919
3947
  } else {
3920
3948
  finalCheckpoints = await Promise.all(
3921
- matched.map(async ({ server }) => {
3949
+ matched.map(async ({ server, local }) => {
3922
3950
  const signed = await signer.signCheckpoint(server);
3951
+ carryConditionWitness(local, signed);
3923
3952
  return base.base64.encode(signed.toPSBT());
3924
3953
  })
3925
3954
  );
3926
3955
  }
3927
3956
  await provider.finalizeTx(arkTxid, finalCheckpoints);
3928
3957
  await hooks?.afterFinalize?.();
3929
- return { arkTxid, signedCheckpointTxs };
3958
+ return result;
3959
+ }
3960
+ function carryConditionWitness(ours, server) {
3961
+ if (chunkGHUUT54D_cjs.getArkPsbtFields(server, 0, chunkGHUUT54D_cjs.ConditionWitness).length > 0) return;
3962
+ const [witness] = chunkGHUUT54D_cjs.getArkPsbtFields(ours, 0, chunkGHUUT54D_cjs.ConditionWitness);
3963
+ if (witness) chunkGHUUT54D_cjs.setArkPsbtField(server, 0, chunkGHUUT54D_cjs.ConditionWitness, witness);
3964
+ }
3965
+ function withArkInputWitness(checkpoint, signedArkTx) {
3966
+ if (chunkGHUUT54D_cjs.getArkPsbtFields(checkpoint, 0, chunkGHUUT54D_cjs.ConditionWitness).length > 0) return checkpoint;
3967
+ for (let i = 0; i < signedArkTx.inputsLength; i++) {
3968
+ const { txid } = signedArkTx.getInput(i);
3969
+ if (!txid || base.hex.encode(txid) !== checkpoint.id) continue;
3970
+ const [witness] = chunkGHUUT54D_cjs.getArkPsbtFields(signedArkTx, i, chunkGHUUT54D_cjs.ConditionWitness);
3971
+ if (!witness) return checkpoint;
3972
+ const carried = checkpoint.clone();
3973
+ chunkGHUUT54D_cjs.setArkPsbtField(carried, 0, chunkGHUUT54D_cjs.ConditionWitness, witness);
3974
+ return carried;
3975
+ }
3976
+ return checkpoint;
3977
+ }
3978
+ function carriesTapscriptSigs(server, userSigned) {
3979
+ const entries = (tx) => (tx.getInput(0).tapScriptSig ?? []).map(
3980
+ ([{ pubKey, leafHash }, sig]) => base.hex.encode(pubKey) + base.hex.encode(leafHash) + base.hex.encode(sig)
3981
+ );
3982
+ const have = new Set(entries(server));
3983
+ const want = entries(userSigned);
3984
+ return want.length > 0 && want.every((entry) => have.has(entry));
3930
3985
  }
3931
3986
  async function signAndSubmitOffchainTx(params) {
3932
3987
  const offchainTx = buildOffchainTx(params.inputs, params.outputs, params.serverUnrollScript);
@@ -3935,7 +3990,8 @@ async function signAndSubmitOffchainTx(params) {
3935
3990
  signCheckpoint: (checkpoint) => params.identity.sign(checkpoint)
3936
3991
  };
3937
3992
  const { arkTxid } = await submitOffchainTx(params.provider, offchainTx, signer, void 0, {
3938
- verifyServerSignatures: params.verifyServerSignatures
3993
+ verifyServerSignatures: params.verifyServerSignatures,
3994
+ oneShot: params.oneShot
3939
3995
  });
3940
3996
  return arkTxid;
3941
3997
  }
@@ -3955,7 +4011,7 @@ async function submitViaEmulator(emulator, offchainTx, signer, opts) {
3955
4011
  base.base64.encode(arkTx.toPSBT()),
3956
4012
  checkpoints.map((c) => base.base64.encode(c.toPSBT()))
3957
4013
  );
3958
- const txid = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(res.signedArkTx)).id;
4014
+ const txid = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(res.signedArkTx)).id;
3959
4015
  assertSubmittedArkTxid({ arkTxid: txid }, arkTx, "emulator submitTx");
3960
4016
  return { txid, signedArkTx: res.signedArkTx, signedCheckpointTxs: res.signedCheckpointTxs };
3961
4017
  }
@@ -3963,12 +4019,12 @@ function claimWithPreimageIdentity(identity, preimage) {
3963
4019
  return {
3964
4020
  ...identity,
3965
4021
  sign: async (tx, inputIndexes) => {
3966
- const signed = chunkGGKR4O5X_cjs.Transaction.fromPSBT(
4022
+ const signed = chunkGHUUT54D_cjs.Transaction.fromPSBT(
3967
4023
  (await identity.sign(tx.clone(), inputIndexes)).toPSBT()
3968
4024
  );
3969
4025
  const indexes = inputIndexes ?? Array.from({ length: signed.inputsLength }, (_, i) => i);
3970
4026
  for (const index of indexes) {
3971
- chunkGGKR4O5X_cjs.setArkPsbtField(signed, index, chunkGGKR4O5X_cjs.ConditionWitness, [preimage]);
4027
+ chunkGHUUT54D_cjs.setArkPsbtField(signed, index, chunkGHUUT54D_cjs.ConditionWitness, [preimage]);
3972
4028
  }
3973
4029
  return signed;
3974
4030
  }
@@ -4151,7 +4207,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
4151
4207
  };
4152
4208
  }
4153
4209
  function deriveContractTapscripts(contract) {
4154
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
4210
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
4155
4211
  if (!handler) {
4156
4212
  throw new Error(`No handler for contract type '${contract.type}'`);
4157
4213
  }
@@ -4254,7 +4310,7 @@ function assertRecipientArkadeAddress(encoded, address, context) {
4254
4310
  function assertTapTreeDerivesAddress(encoded, tapTree, address) {
4255
4311
  let derived;
4256
4312
  try {
4257
- derived = chunkGGKR4O5X_cjs.VtxoScript.decode(tapTree).pkScript;
4313
+ derived = chunkGHUUT54D_cjs.VtxoScript.decode(tapTree).pkScript;
4258
4314
  } catch (e) {
4259
4315
  throw new Error(
4260
4316
  `Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
@@ -4271,7 +4327,7 @@ function validateRecipients(recipients, dustAmount, context) {
4271
4327
  for (const recipient of recipients) {
4272
4328
  let address;
4273
4329
  try {
4274
- address = chunkGGKR4O5X_cjs.ArkAddress.decode(recipient.address);
4330
+ address = chunkGHUUT54D_cjs.ArkAddress.decode(recipient.address);
4275
4331
  } catch (e) {
4276
4332
  throw new Error(`Invalid Arkade address: ${recipient.address}`);
4277
4333
  }
@@ -4296,7 +4352,7 @@ function validateRecipients(recipients, dustAmount, context) {
4296
4352
 
4297
4353
  // src/contracts/spendability.ts
4298
4354
  function isContractGenericallySpendable(contract) {
4299
- return chunkOM6FJ76H_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
4355
+ return chunkE6OOJEHL_cjs.contractHandlers.get(contract.type)?.isGenericallySpendable?.(contract) === true;
4300
4356
  }
4301
4357
  function gatedContracts(contracts) {
4302
4358
  const gated = /* @__PURE__ */ new Map();
@@ -4318,7 +4374,7 @@ function gateExclusion(gated) {
4318
4374
  return (vtxo) => {
4319
4375
  const type = gatedTypeOf(vtxo, gated);
4320
4376
  if (type === void 0) return void 0;
4321
- if (!chunkOM6FJ76H_cjs.contractHandlers.has(type)) {
4377
+ if (!chunkE6OOJEHL_cjs.contractHandlers.has(type)) {
4322
4378
  return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
4323
4379
  }
4324
4380
  return `at ${vtxo.script} (contract type '${type}') is not generically spendable`;
@@ -4354,7 +4410,7 @@ function selectPendingRecoveryOutpoints(contractsWithVtxos, signerSet, nowSecond
4354
4410
  continue;
4355
4411
  }
4356
4412
  for (const v of vtxos) {
4357
- if (!chunkGGKR4O5X_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
4413
+ if (!chunkGHUUT54D_cjs.isVtxoSpent(v) && !v.isSwept && !v.isUnrolled) {
4358
4414
  out.add(`${v.txid}:${v.vout}`);
4359
4415
  }
4360
4416
  }
@@ -4385,19 +4441,19 @@ async function runWithCrossInstanceLock(name, fn) {
4385
4441
  });
4386
4442
  }
4387
4443
  var MAX_VTXOS_PER_SETTLEMENT = 50;
4388
- var MAX_INPUTS_PER_INTENT = 20;
4444
+ var MAX_INPUTS_PER_PROOF = 20;
4389
4445
  function byValueDescending(vtxos) {
4390
4446
  return [...vtxos].sort((a, b) => b.value - a.value);
4391
4447
  }
4392
4448
  async function fetchTimeHeight(wallet) {
4393
- return chunkGGKR4O5X_cjs.resolveTimeHeight(wallet.onchainProvider);
4449
+ return chunkGHUUT54D_cjs.resolveTimeHeight(wallet.onchainProvider);
4394
4450
  }
4395
4451
  function heldVtxosOf(wallet) {
4396
4452
  const held = wallet.getHeldVtxos;
4397
4453
  return typeof held === "function" ? held.call(wallet) : Promise.resolve([]);
4398
4454
  }
4399
4455
  function canMigrateBySend(vtxo, now) {
4400
- if (!chunkGGKR4O5X_cjs.canSpendOffchain(vtxo, now)) return false;
4456
+ if (!chunkGHUUT54D_cjs.canSpendOffchain(vtxo, now)) return false;
4401
4457
  return vtxo.expiresAt !== void 0 || vtxo.expiresAtHeight !== void 0;
4402
4458
  }
4403
4459
  function byExpiryAscending(vtxos, now) {
@@ -4405,7 +4461,7 @@ function byExpiryAscending(vtxos, now) {
4405
4461
  if (vtxo.isSwept) return -Infinity;
4406
4462
  if (vtxo.expiresAt !== void 0) return vtxo.expiresAt.getTime();
4407
4463
  if (vtxo.expiresAtHeight !== void 0) {
4408
- return chunkGGKR4O5X_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4464
+ return chunkGHUUT54D_cjs.isPastExpiry(vtxo, now) ? -Infinity : Infinity;
4409
4465
  }
4410
4466
  return Infinity;
4411
4467
  };
@@ -4432,7 +4488,7 @@ function priceSettlementInputs(vtxos, estimator) {
4432
4488
  const payable = [];
4433
4489
  const net = /* @__PURE__ */ new Map();
4434
4490
  for (const vtxo of vtxos) {
4435
- const inputFee = estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(vtxo));
4491
+ const inputFee = estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(vtxo));
4436
4492
  if (inputFee.satoshis >= vtxo.value) {
4437
4493
  continue;
4438
4494
  }
@@ -4461,7 +4517,7 @@ function offchainOutputFee(amount, estimator, arkAddress) {
4461
4517
  }
4462
4518
  const outputFee = estimator.evalOffchainOutput({
4463
4519
  amount,
4464
- script: base.hex.encode(chunkGGKR4O5X_cjs.ArkAddress.decode(arkAddress).pkScript)
4520
+ script: base.hex.encode(chunkGHUUT54D_cjs.ArkAddress.decode(arkAddress).pkScript)
4465
4521
  });
4466
4522
  return BigInt(outputFee.satoshis);
4467
4523
  }
@@ -4512,10 +4568,10 @@ var DEFAULT_SETTLEMENT_CONFIG = {
4512
4568
  };
4513
4569
  function getRecoverableVtxos(vtxos, dustAmount, now) {
4514
4570
  return vtxos.filter((vtxo) => {
4515
- if (chunkGGKR4O5X_cjs.canRecoverOnchain(vtxo, now)) {
4571
+ if (chunkGHUUT54D_cjs.canRecoverOnchain(vtxo, now)) {
4516
4572
  return true;
4517
4573
  }
4518
- if (chunkGGKR4O5X_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4574
+ if (chunkGHUUT54D_cjs.canSpendOffchain(vtxo, now) && vtxo.isPreconfirmed && isSubdust(vtxo, dustAmount)) {
4519
4575
  return true;
4520
4576
  }
4521
4577
  return false;
@@ -4547,7 +4603,7 @@ function getRecoverableWithSubdust(vtxos, dustAmount, now) {
4547
4603
  function isVtxoExpiringSoon(vtxo, thresholdMs) {
4548
4604
  if (vtxo.isUnrolled) return false;
4549
4605
  const realThresholdMs = thresholdMs <= 100 ? DEFAULT_THRESHOLD_MS : thresholdMs;
4550
- const expiresAt = chunkGGKR4O5X_cjs.normalizeVtxo(vtxo).expiresAt;
4606
+ const expiresAt = chunkGHUUT54D_cjs.normalizeVtxo(vtxo).expiresAt;
4551
4607
  if (expiresAt === void 0) return false;
4552
4608
  const now = Date.now();
4553
4609
  const batchExpiry = expiresAt.getTime();
@@ -4558,7 +4614,7 @@ function getExpiringAndRecoverableVtxos(vtxos, thresholdMs, dustAmount, now) {
4558
4614
  return vtxos.filter(
4559
4615
  // The leading exclusion covers the `isSubdust` arm too, which is a value
4560
4616
  // property and would otherwise re-admit an exited coin on its own.
4561
- (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkGGKR4O5X_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4617
+ (vtxo) => !vtxo.isUnrolled && (isVtxoExpiringSoon(vtxo, thresholdMs) || chunkGHUUT54D_cjs.canRecoverOnchain(vtxo, now) || isSubdust(vtxo, dustAmount))
4562
4618
  );
4563
4619
  }
4564
4620
  function isMigrationCapable(wallet) {
@@ -4618,7 +4674,7 @@ var VtxoManager = class _VtxoManager {
4618
4674
  constructor(wallet, settlementConfig) {
4619
4675
  this.wallet = wallet;
4620
4676
  if (settlementConfig !== false) {
4621
- chunkGGKR4O5X_cjs.assertTimerMs("pollIntervalMs", settlementConfig?.pollIntervalMs);
4677
+ chunkGHUUT54D_cjs.assertTimerMs("pollIntervalMs", settlementConfig?.pollIntervalMs);
4622
4678
  }
4623
4679
  this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
4624
4680
  this.contractEventsSubscriptionReady = this.initializeSubscription();
@@ -4930,7 +4986,7 @@ var VtxoManager = class _VtxoManager {
4930
4986
  * {@link recoverImportedContracts}).
4931
4987
  */
4932
4988
  async recoverOneImportedContract(wallet, contract, vtxos, info, dustAmount) {
4933
- const recoverable = vtxos.filter((vtxo) => vtxo.isSwept && !chunkGGKR4O5X_cjs.isVtxoSpent(vtxo));
4989
+ const recoverable = vtxos.filter((vtxo) => vtxo.isSwept && !chunkGHUUT54D_cjs.isVtxoSpent(vtxo));
4934
4990
  const estimator = new Estimator(info?.fees.intentFee ?? {});
4935
4991
  const { payable, net } = priceSettlementInputs(recoverable, estimator);
4936
4992
  const vtxoMaxAmount = info?.vtxoMaxAmount ?? -1n;
@@ -4952,7 +5008,7 @@ var VtxoManager = class _VtxoManager {
4952
5008
  if (vtxos.length === 0) return;
4953
5009
  const spent = new Set(batch.map((vtxo) => `${vtxo.txid}:${vtxo.vout}`));
4954
5010
  const stillSpendable = vtxos.some(
4955
- (vtxo) => !chunkGGKR4O5X_cjs.isVtxoSpent(vtxo) && !spent.has(`${vtxo.txid}:${vtxo.vout}`)
5011
+ (vtxo) => !chunkGHUUT54D_cjs.isVtxoSpent(vtxo) && !spent.has(`${vtxo.txid}:${vtxo.vout}`)
4956
5012
  );
4957
5013
  if (!stillSpendable) {
4958
5014
  await wallet.removeRecoveryContract(contract.script);
@@ -4969,7 +5025,7 @@ var VtxoManager = class _VtxoManager {
4969
5025
  * ```typescript
4970
5026
  * const wallet = await Wallet.create({
4971
5027
  * identity,
4972
- * arkProvider: new RestArkProvider(),
5028
+ * operatorProvider: new RestOperatorProvider(),
4973
5029
  * settlementConfig: {
4974
5030
  * vtxoThreshold: 86_400 // 24 hours
4975
5031
  * },
@@ -5197,7 +5253,7 @@ var VtxoManager = class _VtxoManager {
5197
5253
  * ```typescript
5198
5254
  * const wallet = await Wallet.create({
5199
5255
  * identity,
5200
- * arkProvider: new RestArkProvider(),
5256
+ * operatorProvider: new RestOperatorProvider(),
5201
5257
  * settlementConfig: {
5202
5258
  * boardingUtxoSweep: true,
5203
5259
  * },
@@ -5245,11 +5301,11 @@ var VtxoManager = class _VtxoManager {
5245
5301
  `Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
5246
5302
  );
5247
5303
  }
5248
- const tx = new chunkGGKR4O5X_cjs.Transaction();
5304
+ const tx = new chunkGHUUT54D_cjs.Transaction();
5249
5305
  for (const utxo of expiredUtxos) {
5250
- const utxoScript = chunkGGKR4O5X_cjs.VtxoScript.decode(utxo.tapTree);
5306
+ const utxoScript = chunkGHUUT54D_cjs.VtxoScript.decode(utxo.tapTree);
5251
5307
  const utxoExitLeaf = utxoScript.leaves.find(
5252
- (leaf) => chunkGGKR4O5X_cjs.CSVMultisigTapscript.isScriptValid(chunkGGKR4O5X_cjs.scriptFromTapLeafScript(leaf)) === true
5308
+ (leaf) => chunkGHUUT54D_cjs.CSVMultisigTapscript.isScriptValid(chunkGHUUT54D_cjs.scriptFromTapLeafScript(leaf)) === true
5253
5309
  );
5254
5310
  if (!utxoExitLeaf) {
5255
5311
  throw new Error(
@@ -5264,7 +5320,7 @@ var VtxoManager = class _VtxoManager {
5264
5320
  amount: BigInt(utxo.value)
5265
5321
  },
5266
5322
  tapLeafScript: [utxoExitLeaf],
5267
- sequence: chunkGGKR4O5X_cjs.getSequence(utxoExitLeaf)
5323
+ sequence: chunkGHUUT54D_cjs.getSequence(utxoExitLeaf)
5268
5324
  });
5269
5325
  }
5270
5326
  tx.addOutputAddress(boardingAddress, outputAmount, this.getNetwork());
@@ -5491,8 +5547,8 @@ var VtxoManager = class _VtxoManager {
5491
5547
  const cls = classifyAgainstSignerSet(serverPubKey, signerSet, nowSeconds);
5492
5548
  if (cls.status === "CURRENT") continue;
5493
5549
  const live = vtxos.filter((v) => !v.isUnrolled);
5494
- const recoverable = live.filter((v) => v.isSwept && !chunkGGKR4O5X_cjs.isVtxoSpent(v));
5495
- const spendable = live.filter((v) => !chunkGGKR4O5X_cjs.isVtxoSpent(v) && !v.isSwept);
5550
+ const recoverable = live.filter((v) => v.isSwept && !chunkGHUUT54D_cjs.isVtxoSpent(v));
5551
+ const spendable = live.filter((v) => !chunkGHUUT54D_cjs.isVtxoSpent(v) && !v.isSwept);
5496
5552
  const value = spendable.reduce((sum, v) => sum + v.value, 0);
5497
5553
  let recoverableCount = 0;
5498
5554
  let recoverableValue = 0;
@@ -5732,7 +5788,7 @@ var VtxoManager = class _VtxoManager {
5732
5788
  }
5733
5789
  getBoardingTimelock() {
5734
5790
  const wallet = this.getSweepWallet();
5735
- const exitScript = chunkGGKR4O5X_cjs.CSVMultisigTapscript.decode(
5791
+ const exitScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.decode(
5736
5792
  base.hex.decode(wallet.boardingTapscript.exitScript)
5737
5793
  );
5738
5794
  return exitScript.params.timelock;
@@ -5740,11 +5796,11 @@ var VtxoManager = class _VtxoManager {
5740
5796
  getOnchainProvider() {
5741
5797
  return this.getSweepWallet().onchainProvider;
5742
5798
  }
5743
- getArkProvider() {
5799
+ getOperatorProvider() {
5744
5800
  return this.getSweepWallet().arkProvider;
5745
5801
  }
5746
5802
  /**
5747
- * Unlike {@link getArkProvider}, doesn't require boarding-sweep capability. Undefined when no
5803
+ * Unlike {@link getOperatorProvider}, doesn't require boarding-sweep capability. Undefined when no
5748
5804
  * provider is wired, which callers treat as "no limit".
5749
5805
  */
5750
5806
  getInfoProvider() {
@@ -5840,8 +5896,8 @@ var VtxoManager = class _VtxoManager {
5840
5896
  }
5841
5897
  /** The outpoint a `VTXO_ALREADY_SPENT` error carries in `metadata.vtxo_outpoint`, if any. */
5842
5898
  extractSpentOutpoint(error) {
5843
- const ark = chunkGGKR4O5X_cjs.maybeArkError(error);
5844
- if (!chunkGGKR4O5X_cjs.isArkError(ark, chunkGGKR4O5X_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5899
+ const ark = chunkGHUUT54D_cjs.maybeArkError(error);
5900
+ if (!chunkGHUUT54D_cjs.isArkError(ark, chunkGHUUT54D_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
5845
5901
  const raw = ark.metadata?.vtxo_outpoint;
5846
5902
  if (typeof raw !== "string") return void 0;
5847
5903
  const [txid, voutStr] = raw.split(":");
@@ -5995,7 +6051,7 @@ var VtxoManager = class _VtxoManager {
5995
6051
  return;
5996
6052
  }
5997
6053
  const dustAmount = getDustAmount(this.wallet);
5998
- const info = await this.getArkProvider().getInfo();
6054
+ const info = await this.getOperatorProvider().getInfo();
5999
6055
  const { fees, vtxoMaxAmount } = info;
6000
6056
  const estimator = new Estimator(fees.intentFee);
6001
6057
  let totalAmount = 0n;
@@ -6015,7 +6071,7 @@ var VtxoManager = class _VtxoManager {
6015
6071
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
6016
6072
  break;
6017
6073
  }
6018
- const inputFee = estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(v));
6074
+ const inputFee = estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(v));
6019
6075
  if (inputFee.satoshis >= v.value) {
6020
6076
  continue;
6021
6077
  }
@@ -6035,7 +6091,7 @@ var VtxoManager = class _VtxoManager {
6035
6091
  const arkAddress = await this.wallet.getAddress();
6036
6092
  const outputFee = estimator.evalOffchainOutput({
6037
6093
  amount: totalAmount,
6038
- script: base.hex.encode(chunkGGKR4O5X_cjs.ArkAddress.decode(arkAddress).pkScript)
6094
+ script: base.hex.encode(chunkGHUUT54D_cjs.ArkAddress.decode(arkAddress).pkScript)
6039
6095
  });
6040
6096
  totalAmount -= BigInt(outputFee.satoshis);
6041
6097
  if (totalAmount < dustAmount) return;
@@ -6119,7 +6175,7 @@ var ArkNote = class _ArkNote {
6119
6175
  this.value = value;
6120
6176
  this.HRP = HRP;
6121
6177
  const preimageHash = utils_js.sha256(this.preimage);
6122
- this.vtxoScript = new chunkGGKR4O5X_cjs.VtxoScript([noteTapscript(preimageHash)]);
6178
+ this.vtxoScript = new chunkGHUUT54D_cjs.VtxoScript([noteTapscript(preimageHash)]);
6123
6179
  const leaf = this.vtxoScript.leaves[0];
6124
6180
  this.txid = base.hex.encode(new Uint8Array(preimageHash).reverse());
6125
6181
  this.tapTree = this.vtxoScript.encode();
@@ -6292,7 +6348,7 @@ var ArkadeCash = class _ArkadeCash {
6292
6348
  const privateKey = data.slice(1, 33);
6293
6349
  const serverPubKey = data.slice(33, 65);
6294
6350
  const sequence = new DataView(data.buffer, data.byteOffset + 65, 4).getUint32(0, false);
6295
- const csvTimelock2 = chunkGGKR4O5X_cjs.sequenceToTimelock(sequence);
6351
+ const csvTimelock2 = chunkGHUUT54D_cjs.sequenceToTimelock(sequence);
6296
6352
  return new _ArkadeCash(privateKey, serverPubKey, csvTimelock2, decoded.prefix);
6297
6353
  }
6298
6354
  toString() {
@@ -6300,7 +6356,7 @@ var ArkadeCash = class _ArkadeCash {
6300
6356
  data[0] = _ArkadeCash.Version;
6301
6357
  data.set(this._privateKey, 1);
6302
6358
  data.set(this._serverPubKey, 33);
6303
- const sequence = chunkGGKR4O5X_cjs.timelockToSequence(this.csvTimelock);
6359
+ const sequence = chunkGHUUT54D_cjs.timelockToSequence(this.csvTimelock);
6304
6360
  new DataView(data.buffer, data.byteOffset + 65, 4).setUint32(0, sequence, false);
6305
6361
  const words = base.bech32m.toWords(data);
6306
6362
  return base.bech32m.encode(this.hrp, words, 1023);
@@ -6309,7 +6365,7 @@ var ArkadeCash = class _ArkadeCash {
6309
6365
  return SingleKey.fromPrivateKey(this._privateKey);
6310
6366
  }
6311
6367
  get vtxoScript() {
6312
- return new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
6368
+ return new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
6313
6369
  pubKey: this._publicKey,
6314
6370
  serverPubKey: this._serverPubKey,
6315
6371
  csvTimelock: this.csvTimelock
@@ -6325,7 +6381,7 @@ var NON_TERMINAL_INTENT_STATES = ALL_INTENT_STATES.filter(
6325
6381
  (s) => !isTerminalIntentState(s)
6326
6382
  );
6327
6383
  function isConsumed(vtxo) {
6328
- return vtxo !== void 0 && chunkGGKR4O5X_cjs.isVtxoSpent(vtxo);
6384
+ return vtxo !== void 0 && chunkGHUUT54D_cjs.isVtxoSpent(vtxo);
6329
6385
  }
6330
6386
  async function classifyIntent(intent, vtxosByOutpoint, now) {
6331
6387
  if (isTerminalIntentState(intent.state)) return void 0;
@@ -6363,7 +6419,7 @@ async function reconcileIntents(deps) {
6363
6419
  let vtxosByOutpoint = /* @__PURE__ */ new Map();
6364
6420
  if (outpoints.length > 0) {
6365
6421
  try {
6366
- const { vtxos } = await chunkGGKR4O5X_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
6422
+ const { vtxos } = await chunkGHUUT54D_cjs.getNormalizedVtxos(deps.indexerProvider, { outpoints });
6367
6423
  vtxosByOutpoint = new Map(vtxos.map((v) => [outpointKey(v), v]));
6368
6424
  } catch (e) {
6369
6425
  console.error("reconcileIntents: failed to fetch input VTXO state", e);
@@ -6423,7 +6479,7 @@ async function releaseFromServer(intent, deps, now) {
6423
6479
  });
6424
6480
  }
6425
6481
  function isNoMatchingIntentsError(e) {
6426
- return chunkGGKR4O5X_cjs.isArkError(e, chunkGGKR4O5X_cjs.ArkErrorName.INVALID_INTENT_PROOF) && e.message.includes("no matching intents found");
6482
+ return chunkGHUUT54D_cjs.isArkError(e, chunkGHUUT54D_cjs.ArkErrorName.INVALID_INTENT_PROOF) && e.message.includes("no matching intents found");
6427
6483
  }
6428
6484
  function terminal(intent, state, now, patch) {
6429
6485
  return { ...intent, ...patch, state, updatedAt: now };
@@ -6650,7 +6706,7 @@ async function captureExitBranch(params) {
6650
6706
  const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
6651
6707
  if (nonCommitment.length > 0) {
6652
6708
  for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
6653
- psbtByTxid.set(chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6709
+ psbtByTxid.set(chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6654
6710
  }
6655
6711
  }
6656
6712
  }
@@ -6693,10 +6749,10 @@ var IndexerExitDataSource = class {
6693
6749
  while (hasMore) {
6694
6750
  const { chain: page, page: meta } = await this.indexer.getVtxoChain(
6695
6751
  { txid: vtxo.txid, vout: vtxo.vout },
6696
- { pageIndex, pageSize: chunkGGKR4O5X_cjs.DEFAULT_PAGE_SIZE }
6752
+ { pageIndex, pageSize: chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE }
6697
6753
  );
6698
6754
  chain.push(...page);
6699
- hasMore = meta ? page.length === chunkGGKR4O5X_cjs.DEFAULT_PAGE_SIZE : false;
6755
+ hasMore = meta ? page.length === chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE : false;
6700
6756
  pageIndex++;
6701
6757
  }
6702
6758
  return chain;
@@ -6708,12 +6764,12 @@ var IndexerExitDataSource = class {
6708
6764
  while (hasMore) {
6709
6765
  const { txs, page } = await this.indexer.getVirtualTxs(txids, {
6710
6766
  pageIndex,
6711
- pageSize: chunkGGKR4O5X_cjs.DEFAULT_PAGE_SIZE
6767
+ pageSize: chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE
6712
6768
  });
6713
6769
  for (const psbt of txs) {
6714
- out.set(chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6770
+ out.set(chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
6715
6771
  }
6716
- hasMore = page ? txs.length === chunkGGKR4O5X_cjs.DEFAULT_PAGE_SIZE : false;
6772
+ hasMore = page ? txs.length === chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE : false;
6717
6773
  pageIndex++;
6718
6774
  }
6719
6775
  return out;
@@ -6734,7 +6790,7 @@ function chainedTxTypeToChainTxType(t) {
6734
6790
  }
6735
6791
  }
6736
6792
  function psbtInputTxids(psbtBase64) {
6737
- return txInputTxids(chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
6793
+ return txInputTxids(chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64)));
6738
6794
  }
6739
6795
  function txInputTxids(tx) {
6740
6796
  const ids = [];
@@ -7039,10 +7095,10 @@ async function resolveArkInfo(arkProvider, walletRepository, opts) {
7039
7095
  try {
7040
7096
  info = await arkProvider.getInfo();
7041
7097
  } catch (err) {
7042
- if (opts?.requireLive || !chunkGGKR4O5X_cjs.isRetryableProviderError(err)) throw err;
7098
+ if (opts?.requireLive || !chunkGHUUT54D_cjs.isRetryableProviderError(err)) throw err;
7043
7099
  const snapshot = await loadArkInfoSnapshot(walletRepository);
7044
7100
  if (!snapshot) {
7045
- throw new chunkGGKR4O5X_cjs.ProviderUnavailableError(
7101
+ throw new chunkGHUUT54D_cjs.ProviderUnavailableError(
7046
7102
  "Arkade server info is unavailable and no cached snapshot exists",
7047
7103
  { cause: err }
7048
7104
  );
@@ -7234,7 +7290,7 @@ function buildGraph(rootTxid, chunksByTxid) {
7234
7290
  return new TxTree(rootTx, children);
7235
7291
  }
7236
7292
  function decodeNode(chunk) {
7237
- const tx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(chunk.tx));
7293
+ const tx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(chunk.tx));
7238
7294
  return { tx, children: chunk.children };
7239
7295
  }
7240
7296
  exports.Batch = void 0;
@@ -7388,6 +7444,16 @@ function gatedTouchpoints(gated) {
7388
7444
  }
7389
7445
  return { paidIn, paidOut };
7390
7446
  }
7447
+ function groupBy(items, key) {
7448
+ const groups = /* @__PURE__ */ new Map();
7449
+ for (const item of items) {
7450
+ const k = key(item);
7451
+ const group = groups.get(k);
7452
+ if (group) group.push(item);
7453
+ else groups.set(k, [item]);
7454
+ }
7455
+ return groups;
7456
+ }
7391
7457
  var txKey = {
7392
7458
  commitmentTxid: "",
7393
7459
  boardingTxid: "",
@@ -7437,7 +7503,7 @@ function collectArkTxidsNeedingCreatedAt(vtxos, localCreatedAt) {
7437
7503
  return [...txids];
7438
7504
  }
7439
7505
  async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt, gatedScripts = /* @__PURE__ */ new Map()) {
7440
- const normalized = vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7506
+ const normalized = vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
7441
7507
  const localCreatedAt = localCreatedAtByTxid(normalized);
7442
7508
  const gatedVtxos = normalized.filter((vtxo) => isGatedVtxo(vtxo, gatedScripts));
7443
7509
  const ownVtxos = normalized.filter((vtxo) => !isGatedVtxo(vtxo, gatedScripts));
@@ -7445,6 +7511,15 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
7445
7511
  const txidsNeedingCreatedAt = resolveTxCreatedAt ? collectArkTxidsNeedingCreatedAt(ownVtxos, localCreatedAt) : [];
7446
7512
  const resolvedCreatedAt = resolveTxCreatedAt && txidsNeedingCreatedAt.length > 0 ? await resolveTxCreatedAt(txidsNeedingCreatedAt) : /* @__PURE__ */ new Map();
7447
7513
  const unmatchedSettledBoardingTxs = allBoardingTxs.filter(isSettledBoardingReceive).sort((a, b) => a.createdAt - b.createdAt);
7514
+ const bySettledBy = groupBy(ownVtxos, (v) => v.settledBy);
7515
+ const byArkTxId = groupBy(ownVtxos, (v) => v.arkTxId);
7516
+ const byTxid = groupBy(ownVtxos, (v) => v.txid);
7517
+ const leavesBySoleCommitment = groupBy(
7518
+ ownVtxos,
7519
+ (v) => v.status.isLeaf && v.commitmentTxIds.length > 0 && v.commitmentTxIds.every((c) => c === v.commitmentTxIds[0]) ? v.commitmentTxIds[0] : void 0
7520
+ );
7521
+ const handledArkTxids = /* @__PURE__ */ new Set();
7522
+ const handledCommitments = /* @__PURE__ */ new Set();
7448
7523
  const sent = [];
7449
7524
  let received = [];
7450
7525
  for (const vtxo of ownVtxos) {
@@ -7457,7 +7532,7 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
7457
7532
  unmatchedSettledBoardingTxs,
7458
7533
  (tx) => tx.createdAt <= vtxoCreatedAt && (tx.key.commitmentTxid === commitmentTxid || tx.key.commitmentTxid === vtxo.settledBy)
7459
7534
  );
7460
- } else if (ownVtxos.filter((v) => v.settledBy === vtxo.commitmentTxIds[0]).length === 0) {
7535
+ } else if (!bySettledBy.has(vtxo.commitmentTxIds[0])) {
7461
7536
  const duplicateBoardingReceive = consumeBoardingReceive(
7462
7537
  unmatchedSettledBoardingTxs,
7463
7538
  (tx) => tx.amount === vtxo.value && tx.createdAt <= vtxoCreatedAt
@@ -7478,7 +7553,7 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
7478
7553
  });
7479
7554
  }
7480
7555
  }
7481
- } else if (ownVtxos.filter((v) => v.arkTxId === vtxo.txid).length === 0) {
7556
+ } else if (!byArkTxId.has(vtxo.txid)) {
7482
7557
  const assets = subtractAssets([], [vtxo]);
7483
7558
  received.push({
7484
7559
  key: { ...txKey, arkTxid: vtxo.txid },
@@ -7494,9 +7569,10 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
7494
7569
  });
7495
7570
  }
7496
7571
  if (vtxo.isSpent) {
7497
- if (vtxo.arkTxId && !sent.some((s) => s.key.arkTxid === vtxo.arkTxId)) {
7498
- const changes = ownVtxos.filter((_) => _.txid === vtxo.arkTxId);
7499
- const allSpent = ownVtxos.filter((v) => v.arkTxId === vtxo.arkTxId);
7572
+ if (vtxo.arkTxId && !handledArkTxids.has(vtxo.arkTxId)) {
7573
+ handledArkTxids.add(vtxo.arkTxId);
7574
+ const changes = byTxid.get(vtxo.arkTxId) ?? [];
7575
+ const allSpent = byArkTxId.get(vtxo.arkTxId);
7500
7576
  const spentAmount = allSpent.reduce((acc, v) => acc + v.value, 0);
7501
7577
  let txAmount = 0;
7502
7578
  let txTime = 0;
@@ -7524,11 +7600,10 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
7524
7600
  });
7525
7601
  }
7526
7602
  }
7527
- if (vtxo.settledBy && !commitmentsToIgnore.has(vtxo.settledBy) && !sent.some((s) => s.key.commitmentTxid === vtxo.settledBy)) {
7528
- const changes = ownVtxos.filter(
7529
- (v) => v.status.isLeaf && v.commitmentTxIds.length > 0 && v.commitmentTxIds.every((_) => vtxo.settledBy === _)
7530
- );
7531
- const forfeitVtxos = ownVtxos.filter((v) => v.settledBy === vtxo.settledBy);
7603
+ if (vtxo.settledBy && !commitmentsToIgnore.has(vtxo.settledBy) && !handledCommitments.has(vtxo.settledBy)) {
7604
+ handledCommitments.add(vtxo.settledBy);
7605
+ const changes = leavesBySoleCommitment.get(vtxo.settledBy) ?? [];
7606
+ const forfeitVtxos = bySettledBy.get(vtxo.settledBy);
7532
7607
  const forfeitAmount = forfeitVtxos.reduce((acc, v) => acc + v.value, 0);
7533
7608
  if (changes.length > 0) {
7534
7609
  const settledAmount = changes.reduce((acc, v) => acc + v.value, 0);
@@ -7615,7 +7690,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7615
7690
  withRecoverable: false,
7616
7691
  genericallySpendableOnly: true
7617
7692
  });
7618
- const controlAssetRef = params.controlAssetId ? chunk64R7CRKN_cjs.AssetRef.fromId(chunk64R7CRKN_cjs.AssetId.fromString(params.controlAssetId)) : null;
7693
+ const controlAssetRef = params.controlAssetId ? chunkWXNSISXK_cjs.AssetRef.fromId(chunkWXNSISXK_cjs.AssetId.fromString(params.controlAssetId)) : null;
7619
7694
  const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
7620
7695
  let totalBtcSelected = 0n;
7621
7696
  const assetChanges = /* @__PURE__ */ new Map();
@@ -7628,8 +7703,8 @@ var AssetManager = class extends ReadonlyAssetManager {
7628
7703
  }
7629
7704
  }
7630
7705
  const groups = [];
7631
- const issuedAssetOutput = chunk64R7CRKN_cjs.AssetOutput.create(0, params.amount);
7632
- const issuedAssetGroup = chunk64R7CRKN_cjs.AssetGroup.create(
7706
+ const issuedAssetOutput = chunkWXNSISXK_cjs.AssetOutput.create(0, params.amount);
7707
+ const issuedAssetGroup = chunkWXNSISXK_cjs.AssetGroup.create(
7633
7708
  null,
7634
7709
  controlAssetRef,
7635
7710
  [],
@@ -7642,11 +7717,11 @@ var AssetManager = class extends ReadonlyAssetManager {
7642
7717
  for (const [assetId, amount] of assetChanges) {
7643
7718
  const changeInputs = inputsForAsset(assetInputs, assetId);
7644
7719
  groups.push(
7645
- chunk64R7CRKN_cjs.AssetGroup.create(
7646
- chunk64R7CRKN_cjs.AssetId.fromString(assetId),
7720
+ chunkWXNSISXK_cjs.AssetGroup.create(
7721
+ chunkWXNSISXK_cjs.AssetId.fromString(assetId),
7647
7722
  null,
7648
7723
  changeInputs,
7649
- [chunk64R7CRKN_cjs.AssetOutput.create(0, amount)],
7724
+ [chunkWXNSISXK_cjs.AssetOutput.create(0, amount)],
7650
7725
  []
7651
7726
  )
7652
7727
  );
@@ -7661,7 +7736,7 @@ var AssetManager = class extends ReadonlyAssetManager {
7661
7736
  );
7662
7737
  return {
7663
7738
  arkTxId: arkTxid,
7664
- assetId: chunk64R7CRKN_cjs.AssetId.create(arkTxid, 0).toString()
7739
+ assetId: chunkWXNSISXK_cjs.AssetId.create(arkTxid, 0).toString()
7665
7740
  };
7666
7741
  }
7667
7742
  /**
@@ -7735,23 +7810,23 @@ var AssetManager = class extends ReadonlyAssetManager {
7735
7810
  const assetInputs = selectedCoinsToAssetInputs(selectedCoins);
7736
7811
  const reissueInputs = inputsForAsset(assetInputs, params.assetId);
7737
7812
  const totalAssetAmount = assetToReissueAmount + params.amount;
7738
- const reissueAssetIdObj = chunk64R7CRKN_cjs.AssetId.fromString(params.assetId);
7739
- const reissueAssetGroup = chunk64R7CRKN_cjs.AssetGroup.create(
7813
+ const reissueAssetIdObj = chunkWXNSISXK_cjs.AssetId.fromString(params.assetId);
7814
+ const reissueAssetGroup = chunkWXNSISXK_cjs.AssetGroup.create(
7740
7815
  reissueAssetIdObj,
7741
7816
  null,
7742
7817
  reissueInputs,
7743
- [chunk64R7CRKN_cjs.AssetOutput.create(0, totalAssetAmount)],
7818
+ [chunkWXNSISXK_cjs.AssetOutput.create(0, totalAssetAmount)],
7744
7819
  []
7745
7820
  );
7746
7821
  const groups = [reissueAssetGroup];
7747
7822
  for (const [assetId, amount] of assetChanges) {
7748
7823
  const changeInputs = inputsForAsset(assetInputs, assetId);
7749
7824
  groups.push(
7750
- chunk64R7CRKN_cjs.AssetGroup.create(
7751
- chunk64R7CRKN_cjs.AssetId.fromString(assetId),
7825
+ chunkWXNSISXK_cjs.AssetGroup.create(
7826
+ chunkWXNSISXK_cjs.AssetId.fromString(assetId),
7752
7827
  null,
7753
7828
  changeInputs,
7754
- [chunk64R7CRKN_cjs.AssetOutput.create(0, amount)],
7829
+ [chunkWXNSISXK_cjs.AssetOutput.create(0, amount)],
7755
7830
  []
7756
7831
  )
7757
7832
  );
@@ -7822,11 +7897,11 @@ var AssetManager = class extends ReadonlyAssetManager {
7822
7897
  for (const [assetId, amount] of assetChanges) {
7823
7898
  const changeInputs = inputsForAsset(assetInputs, assetId);
7824
7899
  groups.push(
7825
- chunk64R7CRKN_cjs.AssetGroup.create(
7826
- chunk64R7CRKN_cjs.AssetId.fromString(assetId),
7900
+ chunkWXNSISXK_cjs.AssetGroup.create(
7901
+ chunkWXNSISXK_cjs.AssetId.fromString(assetId),
7827
7902
  null,
7828
7903
  changeInputs,
7829
- amount > 0n ? [chunk64R7CRKN_cjs.AssetOutput.create(0, amount)] : [],
7904
+ amount > 0n ? [chunkWXNSISXK_cjs.AssetOutput.create(0, amount)] : [],
7830
7905
  []
7831
7906
  )
7832
7907
  );
@@ -7839,16 +7914,16 @@ function inputsForAsset(assetInputs, assetId) {
7839
7914
  for (const [inputIndex, assets] of assetInputs) {
7840
7915
  for (const asset of assets) {
7841
7916
  if (asset.assetId !== assetId) continue;
7842
- inputs.push(chunk64R7CRKN_cjs.AssetInput.create(inputIndex, asset.amount));
7917
+ inputs.push(chunkWXNSISXK_cjs.AssetInput.create(inputIndex, asset.amount));
7843
7918
  }
7844
7919
  }
7845
7920
  return inputs;
7846
7921
  }
7847
7922
  async function submitToSelf(submit, wallet, inputs, amount, groups) {
7848
- const outputAddress = chunkGGKR4O5X_cjs.ArkAddress.decode(await wallet.getAddress());
7923
+ const outputAddress = chunkGHUUT54D_cjs.ArkAddress.decode(await wallet.getAddress());
7849
7924
  const outputs = [
7850
7925
  { script: outputAddress.pkScript, amount: BigInt(amount) },
7851
- Extension.create([chunk64R7CRKN_cjs.Packet.create(groups)]).txOut()
7926
+ Extension.create([chunkWXNSISXK_cjs.Packet.create(groups)]).txOut()
7852
7927
  ];
7853
7928
  const { arkTxid } = await submit(inputs, outputs);
7854
7929
  return arkTxid;
@@ -7872,7 +7947,7 @@ function castMetadata(metadata) {
7872
7947
  } else {
7873
7948
  throw new Error("Invalid metadata value type");
7874
7949
  }
7875
- md.push(chunk64R7CRKN_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7950
+ md.push(chunkWXNSISXK_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
7876
7951
  }
7877
7952
  return md;
7878
7953
  }
@@ -7893,12 +7968,12 @@ var DelegateManagerImpl = class {
7893
7968
  if (vtxos.length === 0) {
7894
7969
  return { delegated: [], failed: [] };
7895
7970
  }
7896
- const destinationScript = chunkGGKR4O5X_cjs.ArkAddress.decode(destination).pkScript;
7971
+ const destinationScript = chunkGHUUT54D_cjs.ArkAddress.decode(destination).pkScript;
7897
7972
  const [arkInfo, delegateInfo] = await Promise.all([
7898
7973
  this.arkInfoProvider.getInfo(),
7899
7974
  this.delegateProvider.getDelegateInfo()
7900
7975
  ]);
7901
- const eligible = vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo).filter(
7976
+ const eligible = vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo).filter(
7902
7977
  (v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
7903
7978
  );
7904
7979
  if (eligible.length === 0) {
@@ -7930,7 +8005,7 @@ var DelegateManagerImpl = class {
7930
8005
  const groupByExpiry = /* @__PURE__ */ new Map();
7931
8006
  let recoverableVtxos = [];
7932
8007
  for (const vtxo of eligible) {
7933
- if (chunkGGKR4O5X_cjs.canRecoverOnchain(vtxo, now)) {
8008
+ if (chunkGHUUT54D_cjs.canRecoverOnchain(vtxo, now)) {
7934
8009
  recoverableVtxos.push(vtxo);
7935
8010
  continue;
7936
8011
  }
@@ -7982,7 +8057,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7982
8057
  }
7983
8058
  if (!delegateAt) {
7984
8059
  const now = { timestamp: /* @__PURE__ */ new Date() };
7985
- const expiryTimestamp = vtxos.filter((coin) => !chunkGGKR4O5X_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
8060
+ const expiryTimestamp = vtxos.filter((coin) => !chunkGHUUT54D_cjs.canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
7986
8061
  (min, coin) => Math.min(min, coin.expiresAt.getTime()),
7987
8062
  Number.MAX_SAFE_INTEGER
7988
8063
  );
@@ -8002,7 +8077,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8002
8077
  let amount = 0n;
8003
8078
  for (const coin of vtxos) {
8004
8079
  const inputFee = estimator.evalOffchainInput({
8005
- ...chunkGGKR4O5X_cjs.toOffchainInputFeeParams(coin),
8080
+ ...chunkGHUUT54D_cjs.toOffchainInputFeeParams(coin),
8006
8081
  type: "vtxo"
8007
8082
  });
8008
8083
  if (inputFee.satoshis >= coin.value) {
@@ -8016,7 +8091,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8016
8091
  const delegateFee = BigInt(Number(fee));
8017
8092
  if (delegateFee > 0n) {
8018
8093
  outputs.push({
8019
- script: chunkGGKR4O5X_cjs.ArkAddress.decode(delegateAddress).pkScript,
8094
+ script: chunkGHUUT54D_cjs.ArkAddress.decode(delegateAddress).pkScript,
8020
8095
  amount: delegateFee
8021
8096
  });
8022
8097
  }
@@ -8049,10 +8124,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
8049
8124
  destinationScript
8050
8125
  );
8051
8126
  const forfeitOutputScript = btcSigner.OutScript.encode(
8052
- btcSigner.Address(chunkGGKR4O5X_cjs.getNetwork(network)).decode(forfeitAddress)
8127
+ btcSigner.Address(chunkGHUUT54D_cjs.getNetwork(network)).decode(forfeitAddress)
8053
8128
  );
8054
8129
  const forfeits = await Promise.all(
8055
- vtxos.filter((v) => chunkGGKR4O5X_cjs.requiresForfeit(v)).map(async (coin) => {
8130
+ vtxos.filter((v) => chunkGHUUT54D_cjs.requiresForfeit(v)).map(async (coin) => {
8056
8131
  const forfeit = await makeDelegateForfeitTx(
8057
8132
  coin,
8058
8133
  dust,
@@ -8077,7 +8152,7 @@ async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, for
8077
8152
  index: input.vout,
8078
8153
  witnessUtxo: {
8079
8154
  amount: BigInt(input.value),
8080
- script: chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).pkScript
8155
+ script: chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).pkScript
8081
8156
  },
8082
8157
  sighashType: btcSigner.SigHash.ALL_ANYONECANPAY,
8083
8158
  tapLeafScript: [delegateTapLeaf]
@@ -8135,7 +8210,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
8135
8210
  expire_at: 0,
8136
8211
  cosigners_public_keys: cosignerPubKeys
8137
8212
  };
8138
- const proof = chunkGGKR4O5X_cjs.Intent.create(message, coins, outputs);
8213
+ const proof = chunkGHUUT54D_cjs.Proof.create(message, coins, outputs);
8139
8214
  const signedProof = await identity.sign(proof);
8140
8215
  return {
8141
8216
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -8153,10 +8228,10 @@ function getDayTimestamp(timestamp) {
8153
8228
  function findDelegateTapLeaf(vtxo, delegatePubkey) {
8154
8229
  if (!vtxo.tapTree) return void 0;
8155
8230
  const pk = delegatePubkey.length === 66 ? delegatePubkey.slice(2) : delegatePubkey;
8156
- const vtxoScript = chunkGGKR4O5X_cjs.VtxoScript.decode(vtxo.tapTree);
8231
+ const vtxoScript = chunkGHUUT54D_cjs.VtxoScript.decode(vtxo.tapTree);
8157
8232
  return vtxoScript.leaves.find((tapLeaf) => {
8158
- const arkTapscript = chunkGGKR4O5X_cjs.decodeTapscript(chunkGGKR4O5X_cjs.scriptFromTapLeafScript(tapLeaf));
8159
- if (!chunkGGKR4O5X_cjs.MultisigTapscript.is(arkTapscript)) return false;
8233
+ const arkTapscript = chunkGHUUT54D_cjs.decodeTapscript(chunkGHUUT54D_cjs.scriptFromTapLeafScript(tapLeaf));
8234
+ if (!chunkGHUUT54D_cjs.MultisigTapscript.is(arkTapscript)) return false;
8160
8235
  return arkTapscript.params.pubkeys.map(base.hex.encode).includes(pk);
8161
8236
  });
8162
8237
  }
@@ -8720,8 +8795,8 @@ function checkSaveVtxosForScript(backend, key, vtxos) {
8720
8795
  }
8721
8796
  async function getVtxosForContract(repo, contract, options) {
8722
8797
  const vtxos = repo.getVtxosForScriptPage ? await collectScriptVtxos(repo, contract.script, options) : filterVtxosForScript(await collectVtxos(repo, contract.address), contract.script);
8723
- const normalized = vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo);
8724
- return options?.unspentOnly ? normalized.filter((vtxo) => !chunkGGKR4O5X_cjs.isVtxoSpent(vtxo)) : normalized;
8798
+ const normalized = vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo);
8799
+ return options?.unspentOnly ? normalized.filter((vtxo) => !chunkGHUUT54D_cjs.isVtxoSpent(vtxo)) : normalized;
8725
8800
  }
8726
8801
  async function hasVtxosForContract(repo, contract) {
8727
8802
  if (repo.getVtxosForScriptPage) {
@@ -8807,6 +8882,21 @@ var InMemoryWalletRepository = class {
8807
8882
  utxosByAddress = /* @__PURE__ */ new Map();
8808
8883
  txsByAddress = /* @__PURE__ */ new Map();
8809
8884
  walletState = null;
8885
+ atomicWalletState;
8886
+ constructor() {
8887
+ const clone2 = typeof globalThis.structuredClone === "function" ? globalThis.structuredClone.bind(globalThis) : void 0;
8888
+ if (clone2) {
8889
+ this.atomicWalletState = {
8890
+ version: 1,
8891
+ update: async (updater) => {
8892
+ this.walletState = applyWalletStateUpdate(
8893
+ clone2(this.walletState ?? {}),
8894
+ updater
8895
+ );
8896
+ }
8897
+ };
8898
+ }
8899
+ }
8810
8900
  async getVtxosPage(address, page) {
8811
8901
  return pageOutpoints(this.vtxosByAddress.get(address) ?? [], page);
8812
8902
  }
@@ -8952,7 +9042,7 @@ function decodeArkContract(encoded) {
8952
9042
  }
8953
9043
  function contractFromArkContract(encoded, options = {}) {
8954
9044
  const parsed = decodeArkContract(encoded);
8955
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(parsed.type);
9045
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(parsed.type);
8956
9046
  if (!handler) {
8957
9047
  throw new Error(`No handler registered for contract type '${parsed.type}'`);
8958
9048
  }
@@ -8966,9 +9056,9 @@ function contractFromArkContract(encoded, options = {}) {
8966
9056
  metadata: options.metadata
8967
9057
  };
8968
9058
  }
8969
- function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkGGKR4O5X_cjs.DEFAULT_NETWORK.hrp, options = {}) {
9059
+ function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkGHUUT54D_cjs.DEFAULT_NETWORK.hrp, options = {}) {
8970
9060
  const parsed = decodeArkContract(encoded);
8971
- const handler = chunkOM6FJ76H_cjs.contractHandlers.getOrThrow(parsed.type);
9061
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.getOrThrow(parsed.type);
8972
9062
  const params = parsed.data;
8973
9063
  const vtxoScript = handler.createScript(params);
8974
9064
  return {
@@ -9025,10 +9115,10 @@ var ContractWatcher = class {
9025
9115
  eventSourceReported = false;
9026
9116
  /** @see ContractWatcherConfig */
9027
9117
  constructor(config) {
9028
- chunkGGKR4O5X_cjs.assertTimerMs("failsafePollIntervalMs", config.failsafePollIntervalMs);
9029
- chunkGGKR4O5X_cjs.assertTimerMs("reconnectDelayMs", config.reconnectDelayMs);
9030
- chunkGGKR4O5X_cjs.assertTimerMs("maxReconnectDelayMs", config.maxReconnectDelayMs);
9031
- chunkGGKR4O5X_cjs.assertTimerMs("subscriptionRequestTimeoutMs", config.subscriptionRequestTimeoutMs);
9118
+ chunkGHUUT54D_cjs.assertTimerMs("failsafePollIntervalMs", config.failsafePollIntervalMs);
9119
+ chunkGHUUT54D_cjs.assertTimerMs("reconnectDelayMs", config.reconnectDelayMs);
9120
+ chunkGHUUT54D_cjs.assertTimerMs("maxReconnectDelayMs", config.maxReconnectDelayMs);
9121
+ chunkGHUUT54D_cjs.assertTimerMs("subscriptionRequestTimeoutMs", config.subscriptionRequestTimeoutMs);
9032
9122
  if (config.subscriptionRequestTimeoutMs === 0) {
9033
9123
  throw new Error("subscriptionRequestTimeoutMs must be greater than 0");
9034
9124
  }
@@ -9251,9 +9341,9 @@ var ContractWatcher = class {
9251
9341
  this.reconnectAttempts = 0;
9252
9342
  this.listenLoop().catch((e) => {
9253
9343
  if (!this.isWatching || signal?.aborted) return;
9254
- if (chunkGGKR4O5X_cjs.isEventSourceError(e)) {
9344
+ if (chunkGHUUT54D_cjs.isEventSourceError(e)) {
9255
9345
  console.debug("ContractWatcher subscription disconnected; reconnecting");
9256
- } else if (!chunkGGKR4O5X_cjs.isEventSourceUnavailableError(e)) {
9346
+ } else if (!chunkGHUUT54D_cjs.isEventSourceUnavailableError(e)) {
9257
9347
  console.error(e);
9258
9348
  }
9259
9349
  this.connectionState = "disconnected";
@@ -9263,7 +9353,7 @@ var ContractWatcher = class {
9263
9353
  });
9264
9354
  } catch (error) {
9265
9355
  if (!this.isWatching || signal?.aborted) return;
9266
- if (!chunkGGKR4O5X_cjs.isEventSourceUnavailableError(error)) {
9356
+ if (!chunkGHUUT54D_cjs.isEventSourceUnavailableError(error)) {
9267
9357
  console.error("ContractWatcher connection failed:", error);
9268
9358
  }
9269
9359
  this.connectionState = "disconnected";
@@ -9279,7 +9369,7 @@ var ContractWatcher = class {
9279
9369
  * few seconds.
9280
9370
  */
9281
9371
  reportEventSourceUnavailable(error) {
9282
- if (!chunkGGKR4O5X_cjs.isEventSourceUnavailableError(error)) return false;
9372
+ if (!chunkGHUUT54D_cjs.isEventSourceUnavailableError(error)) return false;
9283
9373
  if (!this.eventSourceReported) {
9284
9374
  this.eventSourceReported = true;
9285
9375
  console.warn(
@@ -9344,7 +9434,7 @@ var ContractWatcher = class {
9344
9434
  const now = Date.now();
9345
9435
  let current;
9346
9436
  try {
9347
- current = await chunkGGKR4O5X_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9437
+ current = await chunkGHUUT54D_cjs.getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
9348
9438
  spendableOnly: true
9349
9439
  });
9350
9440
  } catch (error) {
@@ -9626,14 +9716,14 @@ var ContractWatcher = class {
9626
9716
  const timestamp = Date.now();
9627
9717
  if (update.newVtxos?.length) {
9628
9718
  this.processSubscriptionVtxos(
9629
- update.newVtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo),
9719
+ update.newVtxos.map(chunkGHUUT54D_cjs.normalizeVtxo),
9630
9720
  "vtxo_received",
9631
9721
  timestamp
9632
9722
  );
9633
9723
  }
9634
9724
  if (update.spentVtxos?.length) {
9635
9725
  this.processSubscriptionVtxos(
9636
- update.spentVtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo),
9726
+ update.spentVtxos.map(chunkGHUUT54D_cjs.normalizeVtxo),
9637
9727
  "vtxo_spent",
9638
9728
  timestamp
9639
9729
  );
@@ -9658,8 +9748,8 @@ var ContractWatcher = class {
9658
9748
  continue;
9659
9749
  }
9660
9750
  if (target === byWatchedScript && eventType === "vtxo_received") {
9661
- const n = chunkGGKR4O5X_cjs.normalizeVtxo(vtxo);
9662
- if (chunkGGKR4O5X_cjs.isVtxoSpent(n) || n.isSwept || chunkGGKR4O5X_cjs.isPastExpiry(n, now)) continue;
9751
+ const n = chunkGHUUT54D_cjs.normalizeVtxo(vtxo);
9752
+ if (chunkGHUUT54D_cjs.isVtxoSpent(n) || n.isSwept || chunkGHUUT54D_cjs.isPastExpiry(n, now)) continue;
9663
9753
  }
9664
9754
  let bucket = target.get(vtxo.script);
9665
9755
  if (!bucket) {
@@ -9800,7 +9890,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9800
9890
  if (!contract) continue;
9801
9891
  try {
9802
9892
  const key = contractKey(contract);
9803
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
9893
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
9804
9894
  const hit = memo?.get(script);
9805
9895
  let tapscripts;
9806
9896
  if (hit && hit.key === key && hit.handler === handler) {
@@ -9821,7 +9911,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9821
9911
  scripts.add(script);
9822
9912
  } catch (err) {
9823
9913
  const reason = `'${contract.type}' at ${script}: ${err instanceof Error ? err.message : String(err)}`;
9824
- if (err instanceof chunkOM6FJ76H_cjs.UnsupportedProgramVersionError) {
9914
+ if (err instanceof chunkE6OOJEHL_cjs.UnsupportedProgramVersionError) {
9825
9915
  unsupported.set(script, { key: contractKey(contract), reason });
9826
9916
  } else {
9827
9917
  failures.set(script, reason);
@@ -9832,7 +9922,7 @@ function annotatableIn(scriptToContract, vtxos, memo) {
9832
9922
  }
9833
9923
  function annotateAgainst(vtxos, byScript, tapscripts = /* @__PURE__ */ new Map()) {
9834
9924
  return vtxos.map(
9835
- (vtxo) => extendVirtualCoinForContract(chunkGGKR4O5X_cjs.normalizeVtxo(vtxo), byScript, tapscripts)
9925
+ (vtxo) => extendVirtualCoinForContract(chunkGHUUT54D_cjs.normalizeVtxo(vtxo), byScript, tapscripts)
9836
9926
  );
9837
9927
  }
9838
9928
  var SCAN_MAX_INDEX = 1e4;
@@ -9876,8 +9966,8 @@ var ContractManager = class _ContractManager {
9876
9966
  * `dispose()`, so it re-checks this at every await rather than run on a torn-down watcher. */
9877
9967
  disposed = false;
9878
9968
  constructor(config) {
9879
- chunkGGKR4O5X_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", config.vtxoSyncMaxAgeMs);
9880
- chunkGGKR4O5X_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", config.vtxoSyncOverlapMs);
9969
+ chunkGHUUT54D_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", config.vtxoSyncMaxAgeMs);
9970
+ chunkGHUUT54D_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", config.vtxoSyncOverlapMs);
9881
9971
  this.config = { ...config };
9882
9972
  this.watcher = new ContractWatcher({
9883
9973
  indexerProvider: config.indexerProvider,
@@ -9913,12 +10003,12 @@ var ContractManager = class _ContractManager {
9913
10003
  }
9914
10004
  /** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
9915
10005
  setVtxoSyncMaxAge(maxAgeMs) {
9916
- chunkGGKR4O5X_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", maxAgeMs);
10006
+ chunkGHUUT54D_cjs.assertNonNegativeMs("vtxoSyncMaxAgeMs", maxAgeMs);
9917
10007
  this.config.vtxoSyncMaxAgeMs = maxAgeMs;
9918
10008
  }
9919
10009
  /** @see ContractManagerConfig.vtxoSyncOverlapMs — for factory-built managers. */
9920
10010
  setVtxoSyncOverlap(overlapMs) {
9921
- chunkGGKR4O5X_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", overlapMs);
10011
+ chunkGHUUT54D_cjs.assertNonNegativeMs("vtxoSyncOverlapMs", overlapMs);
9922
10012
  this.config.vtxoSyncOverlapMs = overlapMs;
9923
10013
  }
9924
10014
  markSyncOnline() {
@@ -9982,10 +10072,10 @@ var ContractManager = class _ContractManager {
9982
10072
  if (this.unsupportedContracts.get(contract.script) === key) return true;
9983
10073
  if (this.tapscriptMemo.get(contract.script)?.key === key) return false;
9984
10074
  try {
9985
- chunkOM6FJ76H_cjs.contractHandlers.get(contract.type)?.createScript(contract.params);
10075
+ chunkE6OOJEHL_cjs.contractHandlers.get(contract.type)?.createScript(contract.params);
9986
10076
  return false;
9987
10077
  } catch (err) {
9988
- if (!(err instanceof chunkOM6FJ76H_cjs.UnsupportedProgramVersionError)) return false;
10078
+ if (!(err instanceof chunkE6OOJEHL_cjs.UnsupportedProgramVersionError)) return false;
9989
10079
  this.unsupportedContracts.set(contract.script, key);
9990
10080
  return true;
9991
10081
  }
@@ -9998,7 +10088,7 @@ var ContractManager = class _ContractManager {
9998
10088
  this.markSyncOnline();
9999
10089
  return void 0;
10000
10090
  } catch (err) {
10001
- if (!chunkGGKR4O5X_cjs.isRetryableProviderError(err)) throw err;
10091
+ if (!chunkGHUUT54D_cjs.isRetryableProviderError(err)) throw err;
10002
10092
  this.markSyncDegraded(err);
10003
10093
  return err;
10004
10094
  }
@@ -10021,7 +10111,7 @@ var ContractManager = class _ContractManager {
10021
10111
  try {
10022
10112
  await this.scheduleLookAheadDrain();
10023
10113
  } catch (err) {
10024
- if (!chunkGGKR4O5X_cjs.isRetryableProviderError(err)) throw err;
10114
+ if (!chunkGHUUT54D_cjs.isRetryableProviderError(err)) throw err;
10025
10115
  this.lookAheadRefillOwed = true;
10026
10116
  this.markSyncDegraded(err);
10027
10117
  }
@@ -10084,7 +10174,7 @@ var ContractManager = class _ContractManager {
10084
10174
  /** No throw: construction returned long ago, so the state is the channel. */
10085
10175
  reportBackgroundFailure(stage, err) {
10086
10176
  this.markSyncDegraded(err);
10087
- if (!chunkGGKR4O5X_cjs.isRetryableProviderError(err)) {
10177
+ if (!chunkGHUUT54D_cjs.isRetryableProviderError(err)) {
10088
10178
  console.error(`[contracts] background ${stage} failed`, err);
10089
10179
  }
10090
10180
  }
@@ -10186,7 +10276,7 @@ var ContractManager = class _ContractManager {
10186
10276
  const from = Math.max(0, watermark - lookAhead.size);
10187
10277
  const to = watermark + lookAhead.size;
10188
10278
  const deps = lookAhead.candidateDeps();
10189
- const handlers = chunkOM6FJ76H_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkOM6FJ76H_cjs.contractHandlers.get(t)).filter(hasCandidates);
10279
+ const handlers = chunkE6OOJEHL_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkE6OOJEHL_cjs.contractHandlers.get(t)).filter(hasCandidates);
10190
10280
  const band = /* @__PURE__ */ new Map();
10191
10281
  for (let index = from; index <= to; index++) {
10192
10282
  const descriptor = lookAhead.materialize(index);
@@ -10197,7 +10287,7 @@ var ContractManager = class _ContractManager {
10197
10287
  index,
10198
10288
  params: {
10199
10289
  ...candidate,
10200
- ...chunkOM6FJ76H_cjs.speculativeReceiveMetadata(descriptor)
10290
+ ...chunkE6OOJEHL_cjs.speculativeReceiveMetadata(descriptor)
10201
10291
  }
10202
10292
  });
10203
10293
  }
@@ -10256,7 +10346,7 @@ var ContractManager = class _ContractManager {
10256
10346
  });
10257
10347
  for (const entry of pending) entry.catchUpPending = false;
10258
10348
  } catch (err) {
10259
- if (!chunkGGKR4O5X_cjs.isRetryableProviderError(err)) throw err;
10349
+ if (!chunkGHUUT54D_cjs.isRetryableProviderError(err)) throw err;
10260
10350
  this.markSyncDegraded(err);
10261
10351
  }
10262
10352
  }
@@ -10347,7 +10437,7 @@ var ContractManager = class _ContractManager {
10347
10437
  return result;
10348
10438
  }
10349
10439
  async upsertContractRow(params) {
10350
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(params.type);
10440
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(params.type);
10351
10441
  if (!handler) {
10352
10442
  throw new Error(`No handler registered for contract type '${params.type}'`);
10353
10443
  }
@@ -10446,7 +10536,7 @@ var ContractManager = class _ContractManager {
10446
10536
  `scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
10447
10537
  );
10448
10538
  }
10449
- const registered = chunkOM6FJ76H_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkOM6FJ76H_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10539
+ const registered = chunkE6OOJEHL_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkE6OOJEHL_cjs.contractHandlers.get(t)).filter(isDiscoverable);
10450
10540
  const discoverables = [
10451
10541
  ...registered.filter((h) => h.type === "boarding"),
10452
10542
  ...registered.filter((h) => h.type !== "boarding")
@@ -10577,7 +10667,7 @@ var ContractManager = class _ContractManager {
10577
10667
  return contracts.filter((contract) => this.isUnsupported(contract));
10578
10668
  }
10579
10669
  async getContractsWithVtxos(filter, pageSize, options) {
10580
- chunkGGKR4O5X_cjs.assertNonNegativeMs("maxSyncAgeMs", options?.maxSyncAgeMs);
10670
+ chunkGHUUT54D_cjs.assertNonNegativeMs("maxSyncAgeMs", options?.maxSyncAgeMs);
10581
10671
  const contracts = await this.getContracts(filter);
10582
10672
  if (this.syncedWithin(
10583
10673
  contracts,
@@ -10685,7 +10775,7 @@ var ContractManager = class _ContractManager {
10685
10775
  const byScript = new Map(contracts.map((contract) => [contract.script, contract]));
10686
10776
  const asking = vtxos.filter((vtxo) => {
10687
10777
  const contract = byScript.get(vtxo.script);
10688
- return contract !== void 0 && chunkOM6FJ76H_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10778
+ return contract !== void 0 && chunkE6OOJEHL_cjs.contractHandlers.get(contract.type)?.assertSpendableNow !== void 0;
10689
10779
  });
10690
10780
  if (asking.length === 0) return refused;
10691
10781
  const [tip, walletDescriptorValue] = await Promise.all([
@@ -10694,7 +10784,7 @@ var ContractManager = class _ContractManager {
10694
10784
  ]);
10695
10785
  for (const vtxo of asking) {
10696
10786
  const contract = byScript.get(vtxo.script);
10697
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
10787
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
10698
10788
  if (!handler?.assertSpendableNow) continue;
10699
10789
  const context = {
10700
10790
  collaborative: true,
@@ -10704,7 +10794,7 @@ var ContractManager = class _ContractManager {
10704
10794
  walletDescriptor: walletDescriptorValue,
10705
10795
  // `isVirtualCoin` only checks `script`, which every input has; `isCsvSpendable`
10706
10796
  // reads `vtxo.status.block_time` unguarded, so require `status` too.
10707
- vtxo: chunkGGKR4O5X_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10797
+ vtxo: chunkGHUUT54D_cjs.isVirtualCoin(vtxo) && "status" in vtxo ? vtxo : void 0
10708
10798
  };
10709
10799
  try {
10710
10800
  await handler.assertSpendableNow(
@@ -10817,7 +10907,7 @@ var ContractManager = class _ContractManager {
10817
10907
  const { contractScript, collaborative = true, walletDescriptor, vtxo } = options;
10818
10908
  const [contract] = await this.getContracts({ script: contractScript });
10819
10909
  if (!contract) return [];
10820
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
10910
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
10821
10911
  if (!handler) return [];
10822
10912
  const script = handler.createScript(contract.params);
10823
10913
  const tip = await this.currentChainTip();
@@ -10839,7 +10929,7 @@ var ContractManager = class _ContractManager {
10839
10929
  const { contractScript, collaborative = true, walletDescriptor } = options;
10840
10930
  const [contract] = await this.getContracts({ script: contractScript });
10841
10931
  if (!contract) return [];
10842
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
10932
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
10843
10933
  if (!handler) return [];
10844
10934
  const script = handler.createScript(contract.params);
10845
10935
  const context = {
@@ -10885,7 +10975,7 @@ var ContractManager = class _ContractManager {
10885
10975
  }
10886
10976
  async refreshOutpoints(outpoints) {
10887
10977
  if (outpoints.length === 0) return;
10888
- const { vtxos } = await chunkGGKR4O5X_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10978
+ const { vtxos } = await chunkGHUUT54D_cjs.getNormalizedVtxos(this.config.indexerProvider, {
10889
10979
  outpoints
10890
10980
  });
10891
10981
  if (vtxos.length === 0) return;
@@ -10987,7 +11077,7 @@ var ContractManager = class _ContractManager {
10987
11077
  break;
10988
11078
  }
10989
11079
  } catch (err) {
10990
- if (!chunkGGKR4O5X_cjs.isRetryableProviderError(err)) throw err;
11080
+ if (!chunkGHUUT54D_cjs.isRetryableProviderError(err)) throw err;
10991
11081
  this.markSyncDegraded(err);
10992
11082
  synced = false;
10993
11083
  }
@@ -11075,7 +11165,7 @@ var ContractManager = class _ContractManager {
11075
11165
  */
11076
11166
  async reconcilePendingFrontier(contracts) {
11077
11167
  const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
11078
- const vtxos = await chunkGGKR4O5X_cjs.getAllNormalizedVtxos(
11168
+ const vtxos = await chunkGHUUT54D_cjs.getAllNormalizedVtxos(
11079
11169
  this.config.indexerProvider,
11080
11170
  contracts.map((c) => c.script),
11081
11171
  { pendingOnly: true }
@@ -11150,7 +11240,7 @@ var ContractManager = class _ContractManager {
11150
11240
  }
11151
11241
  return result;
11152
11242
  }
11153
- async fetchContractVtxosBulk(contracts, pageSize = chunkGGKR4O5X_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
11243
+ async fetchContractVtxosBulk(contracts, pageSize = chunkGHUUT54D_cjs.DEFAULT_PAGE_SIZE, syncWindow) {
11154
11244
  if (contracts.length === 0) {
11155
11245
  return { vtxosByScript: /* @__PURE__ */ new Map(), promoted: /* @__PURE__ */ new Map() };
11156
11246
  }
@@ -11166,7 +11256,7 @@ var ContractManager = class _ContractManager {
11166
11256
  before: syncWindow.before
11167
11257
  }
11168
11258
  } : {};
11169
- const vtxos = await chunkGGKR4O5X_cjs.getAllNormalizedVtxos(
11259
+ const vtxos = await chunkGHUUT54D_cjs.getAllNormalizedVtxos(
11170
11260
  this.config.indexerProvider,
11171
11261
  contracts.map((c) => c.script),
11172
11262
  { ...windowOpts, pageSize }
@@ -11269,7 +11359,7 @@ function parseLegacyExpiry(batchExpiry) {
11269
11359
  if (typeof batchExpiry !== "number" || !Number.isFinite(batchExpiry) || batchExpiry <= 0) {
11270
11360
  return {};
11271
11361
  }
11272
- if (batchExpiry >= chunkGGKR4O5X_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
11362
+ if (batchExpiry >= chunkGHUUT54D_cjs.EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
11273
11363
  return { expiresAtHeight: batchExpiry / 1e3 };
11274
11364
  }
11275
11365
  function legacyVtxoFacts(status) {
@@ -11507,7 +11597,7 @@ function backfillContractWatchState(store) {
11507
11597
  };
11508
11598
  readPage();
11509
11599
  }
11510
- var unspentFlag = (vtxo) => chunkGGKR4O5X_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
11600
+ var unspentFlag = (vtxo) => chunkGHUUT54D_cjs.isVtxoSpent(vtxo) ? {} : { unspent: 1 };
11511
11601
  function backfillVtxoIndexFields(transaction) {
11512
11602
  const store = transaction.objectStore(STORE_VTXOS);
11513
11603
  const pageSize = 1e3;
@@ -11538,7 +11628,7 @@ var DEFAULT_DB_NAME = "arkade-service-worker";
11538
11628
  var DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS = 1e4;
11539
11629
  function normalizeOptions2(pathOrOptions) {
11540
11630
  const o = typeof pathOrOptions === "string" ? { path: pathOrOptions } : pathOrOptions;
11541
- chunkGGKR4O5X_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
11631
+ chunkGHUUT54D_cjs.assertTimerMs("activationTimeoutMs", o.activationTimeoutMs);
11542
11632
  return {
11543
11633
  path: o.path,
11544
11634
  activationTimeoutMs: o.activationTimeoutMs ?? DEFAULT_SERVICE_WORKER_ACTIVATION_TIMEOUT_MS
@@ -11759,7 +11849,7 @@ var deserializeTapLeaf = (t) => {
11759
11849
  const s = base.hex.decode(t.s);
11760
11850
  return [cb, s];
11761
11851
  };
11762
- var deserializeVtxo = (o) => chunkGGKR4O5X_cjs.normalizeVtxo({
11852
+ var deserializeVtxo = (o) => chunkGHUUT54D_cjs.normalizeVtxo({
11763
11853
  ...o,
11764
11854
  createdAt: new Date(o.createdAt),
11765
11855
  tapTree: base.hex.decode(o.tapTree),
@@ -11780,8 +11870,12 @@ var deserializeUtxo = (o) => ({
11780
11870
  var IndexedDBWalletRepository = class {
11781
11871
  version = 2;
11782
11872
  connection;
11783
- constructor(dbName = DEFAULT_DB_NAME) {
11873
+ /** persistentWalletState asserts persistence beyond this process; it cannot detect browser eviction. */
11874
+ constructor(dbName = DEFAULT_DB_NAME, options) {
11784
11875
  this.connection = createManagedConnection(dbName, DB_VERSION, initDatabase);
11876
+ if (options?.persistentWalletState === true) {
11877
+ this.atomicWalletState = { ...this.atomicWalletState, persistent: true };
11878
+ }
11785
11879
  }
11786
11880
  async clear() {
11787
11881
  try {
@@ -12050,6 +12144,47 @@ var IndexedDBWalletRepository = class {
12050
12144
  throw error;
12051
12145
  }
12052
12146
  }
12147
+ atomicWalletState = {
12148
+ version: 1,
12149
+ update: async (updater) => {
12150
+ const db = await this.getDB();
12151
+ const transaction = db.transaction([STORE_WALLET_STATE], "readwrite");
12152
+ const completion = awaitTransaction(transaction);
12153
+ let failed = false;
12154
+ let failure;
12155
+ try {
12156
+ const store = transaction.objectStore(STORE_WALLET_STATE);
12157
+ const request = store.get("state");
12158
+ request.onerror = () => {
12159
+ failed = true;
12160
+ failure = request.error;
12161
+ };
12162
+ request.onsuccess = () => {
12163
+ try {
12164
+ const state = applyWalletStateUpdate(request.result?.data ?? {}, updater);
12165
+ const write = store.put({ key: "state", data: state });
12166
+ write.onerror = () => {
12167
+ failed = true;
12168
+ failure = write.error;
12169
+ };
12170
+ } catch (error) {
12171
+ failed = true;
12172
+ failure = error;
12173
+ transaction.abort();
12174
+ }
12175
+ };
12176
+ } catch (error) {
12177
+ failed = true;
12178
+ failure = error;
12179
+ transaction.abort();
12180
+ }
12181
+ try {
12182
+ await completion;
12183
+ } catch (error) {
12184
+ throw failed ? failure : error;
12185
+ }
12186
+ }
12187
+ };
12053
12188
  async getWalletState() {
12054
12189
  try {
12055
12190
  const db = await this.getDB();
@@ -12060,7 +12195,7 @@ var IndexedDBWalletRepository = class {
12060
12195
  return result?.data ?? null;
12061
12196
  } catch (error) {
12062
12197
  console.error("Failed to get wallet state:", error);
12063
- return null;
12198
+ throw error;
12064
12199
  }
12065
12200
  }
12066
12201
  async saveWalletState(state) {
@@ -12114,7 +12249,7 @@ var RestEmulatorProvider = class {
12114
12249
  serverUrl;
12115
12250
  async getInfo() {
12116
12251
  const url = `${this.serverUrl}/v1/info`;
12117
- const response = await chunkGGKR4O5X_cjs.baseFetch(url);
12252
+ const response = await chunkGHUUT54D_cjs.baseFetch(url);
12118
12253
  if (!response.ok) {
12119
12254
  const errorText2 = await response.text();
12120
12255
  throw new Error(`Failed to get emulator info: ${errorText2}`);
@@ -12234,11 +12369,11 @@ var RestEmulatorProvider = class {
12234
12369
 
12235
12370
  // src/arkade/service.ts
12236
12371
  function arkadeServiceUrl(service) {
12237
- return "operatorUrl" in service ? service.operatorUrl : chunkGGKR4O5X_cjs.DEFAULT_ARKADE_SERVER_URL;
12372
+ return "operatorUrl" in service ? service.operatorUrl : chunkGHUUT54D_cjs.DEFAULT_ARKADE_SERVER_URL;
12238
12373
  }
12239
12374
  async function resolveArkadeService(service, opts = {}) {
12240
12375
  const operatorUrl = arkadeServiceUrl(service);
12241
- const arkProvider = opts.arkProvider ?? new chunkGGKR4O5X_cjs.RestArkProvider(operatorUrl);
12376
+ const arkProvider = opts.arkProvider ?? new chunkGHUUT54D_cjs.RestOperatorProvider(operatorUrl);
12242
12377
  const info = opts.info ?? await arkProvider.getInfo();
12243
12378
  if ("network" in service && service.network !== info.network) {
12244
12379
  throw new Error(
@@ -12251,13 +12386,13 @@ async function resolveArkadeService(service, opts = {}) {
12251
12386
  }
12252
12387
  let emulator;
12253
12388
  if ("network" in service) {
12254
- emulator = new RestEmulatorProvider(chunkGGKR4O5X_cjs.DEFAULT_ARKADE_EMULATOR_URL);
12389
+ emulator = new RestEmulatorProvider(chunkGHUUT54D_cjs.DEFAULT_ARKADE_EMULATOR_URL);
12255
12390
  } else if (service.emulatorUrl) {
12256
12391
  emulator = new RestEmulatorProvider(service.emulatorUrl);
12257
12392
  }
12258
12393
  return {
12259
12394
  arkProvider,
12260
- indexerProvider: new chunk64R7CRKN_cjs.RestIndexerProvider(operatorUrl),
12395
+ indexerProvider: new chunkWXNSISXK_cjs.RestIndexerProvider(operatorUrl),
12261
12396
  onchainProvider: new EsploraProvider(esploraUrl),
12262
12397
  emulator,
12263
12398
  info
@@ -12341,7 +12476,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
12341
12476
  */
12342
12477
  materializeDescriptorAt(index) {
12343
12478
  const descriptor = this.identity.descriptor;
12344
- const network = chunkOM6FJ76H_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
12479
+ const network = chunkE6OOJEHL_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
12345
12480
  const expansion = descriptorsScure.expand({ descriptor, network, index });
12346
12481
  const keyInfo = expansion.expansionMap?.["@0"];
12347
12482
  if (!keyInfo?.keyExpression) {
@@ -12409,7 +12544,7 @@ function signingDescriptorIndex(descriptor) {
12409
12544
  }
12410
12545
  function newestWalletReceiveContract(contracts, serverPubKeyHex) {
12411
12546
  return contracts.filter(
12412
- (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkOM6FJ76H_cjs.WALLET_RECEIVE_SOURCE
12547
+ (c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkE6OOJEHL_cjs.WALLET_RECEIVE_SOURCE
12413
12548
  ).sort((a, b) => {
12414
12549
  if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
12415
12550
  return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
@@ -12460,7 +12595,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
12460
12595
  const provider = await resolveDescriptorProvider(config, setup.walletRepository);
12461
12596
  if (!provider) return void 0;
12462
12597
  const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
12463
- const expectedContractType = setup.offchainTapscript instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script ? "delegate" : "default";
12598
+ const expectedContractType = setup.offchainTapscript instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script ? "delegate" : "default";
12464
12599
  const factoryOpts = {
12465
12600
  walletRepository: setup.walletRepository,
12466
12601
  contractRepository: setup.contractRepository,
@@ -12620,7 +12755,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
12620
12755
  };
12621
12756
  function deriveLeafPubkey(descriptor) {
12622
12757
  try {
12623
- return chunkOM6FJ76H_cjs.deriveDescriptorLeafPubKey(descriptor);
12758
+ return chunkE6OOJEHL_cjs.deriveDescriptorLeafPubKey(descriptor);
12624
12759
  } catch (e) {
12625
12760
  throw new NonRangeableDescriptorError(
12626
12761
  "Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
@@ -12632,7 +12767,7 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12632
12767
  const pubKey = deriveLeafPubkey(descriptor);
12633
12768
  const tapscript = rebuildTapscript(current, pubKey);
12634
12769
  const serverPubKey = tapscript.options.serverPubKey;
12635
- const csvTimelock2 = chunkGGKR4O5X_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12770
+ const csvTimelock2 = chunkGHUUT54D_cjs.timelockToSequence(tapscript.options.csvTimelock).toString();
12636
12771
  const base$1 = {
12637
12772
  script: base.hex.encode(tapscript.pkScript),
12638
12773
  address: tapscript.address(hrp, serverPubKey).encode(),
@@ -12640,11 +12775,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12640
12775
  // Read at sign time to route rotated-pubkey inputs through `signWithDescriptor`; without
12641
12776
  // it spends are rejected with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
12642
12777
  metadata: {
12643
- ...tagSource && { source: chunkOM6FJ76H_cjs.WALLET_RECEIVE_SOURCE },
12778
+ ...tagSource && { source: chunkE6OOJEHL_cjs.WALLET_RECEIVE_SOURCE },
12644
12779
  signingDescriptor: descriptor
12645
12780
  }
12646
12781
  };
12647
- const params = tapscript instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script ? {
12782
+ const params = tapscript instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script ? {
12648
12783
  ...base$1,
12649
12784
  type: "delegate",
12650
12785
  params: {
@@ -12665,10 +12800,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
12665
12800
  return { tapscript, params };
12666
12801
  }
12667
12802
  function rebuildTapscript(current, pubKey) {
12668
- if (current instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script) {
12669
- return new chunkOM6FJ76H_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12803
+ if (current instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script) {
12804
+ return new chunkE6OOJEHL_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
12670
12805
  }
12671
- return new chunkOM6FJ76H_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12806
+ return new chunkE6OOJEHL_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
12672
12807
  }
12673
12808
  async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
12674
12809
  const candidates = await collectContracts(contractRepository, {
@@ -12727,7 +12862,7 @@ function computeOffchainBalance(vtxos, caps) {
12727
12862
  }
12728
12863
  };
12729
12864
  for (const vtxo of vtxos) {
12730
- if (chunkGGKR4O5X_cjs.isVtxoSpent(vtxo)) continue;
12865
+ if (chunkGHUUT54D_cjs.isVtxoSpent(vtxo)) continue;
12731
12866
  addAssets(owned, vtxo);
12732
12867
  if (vtxo.isUnrolled) {
12733
12868
  unrolled += vtxo.value;
@@ -12737,11 +12872,11 @@ function computeOffchainBalance(vtxos, caps) {
12737
12872
  deprecatedSignerLocked += vtxo.value;
12738
12873
  continue;
12739
12874
  }
12740
- if (chunkGGKR4O5X_cjs.canRecoverOnchain(vtxo, now)) {
12875
+ if (chunkGHUUT54D_cjs.canRecoverOnchain(vtxo, now)) {
12741
12876
  recoverable += vtxo.value;
12742
12877
  continue;
12743
12878
  }
12744
- if (!chunkGGKR4O5X_cjs.canSpendOffchain(vtxo, now)) continue;
12879
+ if (!chunkGHUUT54D_cjs.canSpendOffchain(vtxo, now)) continue;
12745
12880
  if (vtxo.isPreconfirmed) {
12746
12881
  preconfirmed += vtxo.value;
12747
12882
  } else {
@@ -12960,7 +13095,7 @@ function intentProofJobs(coins) {
12960
13095
  if (coins.length === 0) return [];
12961
13096
  const coinJobs = coins.map((coin, i) => ({
12962
13097
  index: i + 1,
12963
- lookupScript: chunkGGKR4O5X_cjs.VtxoScript.decode(coin.tapTree).pkScript
13098
+ lookupScript: chunkGHUUT54D_cjs.VtxoScript.decode(coin.tapTree).pkScript
12964
13099
  }));
12965
13100
  return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
12966
13101
  }
@@ -12975,7 +13110,7 @@ function asSendParams(args) {
12975
13110
  }
12976
13111
  return { recipients: args };
12977
13112
  }
12978
- function extractArkProviderUrl(provider) {
13113
+ function extractOperatorProviderUrl(provider) {
12979
13114
  const serverUrl = provider.serverUrl;
12980
13115
  return typeof serverUrl === "string" && serverUrl.length > 0 ? serverUrl : void 0;
12981
13116
  }
@@ -13000,7 +13135,7 @@ function dedupeTimelocks(timelocks) {
13000
13135
  const seen = /* @__PURE__ */ new Set();
13001
13136
  const deduped = [];
13002
13137
  for (const timelock of timelocks) {
13003
- const sequence = chunkGGKR4O5X_cjs.timelockToSequence(timelock).toString();
13138
+ const sequence = chunkGHUUT54D_cjs.timelockToSequence(timelock).toString();
13004
13139
  if (seen.has(sequence)) continue;
13005
13140
  seen.add(sequence);
13006
13141
  deduped.push(timelock);
@@ -13016,7 +13151,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
13016
13151
  if (!newest?.params.pubKey) return baseline;
13017
13152
  try {
13018
13153
  const pubKey = base.hex.decode(newest.params.pubKey);
13019
- return new chunkOM6FJ76H_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
13154
+ return new chunkE6OOJEHL_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
13020
13155
  } catch (e) {
13021
13156
  console.warn("Skipping malformed boarding contract at boot", newest.script, e);
13022
13157
  return baseline;
@@ -13048,21 +13183,21 @@ function filterFlatVtxos(vtxos, filter, pendingSpendOutpoints) {
13048
13183
  if (vtxo.isUnrolled) {
13049
13184
  return !!f.withUnrolled;
13050
13185
  }
13051
- if (chunkGGKR4O5X_cjs.isVtxoSpent(vtxo)) {
13186
+ if (chunkGHUUT54D_cjs.isVtxoSpent(vtxo)) {
13052
13187
  return false;
13053
13188
  }
13054
- if (!f.withRecoverable && chunkGGKR4O5X_cjs.canRecoverOnchain(vtxo, now)) {
13189
+ if (!f.withRecoverable && chunkGHUUT54D_cjs.canRecoverOnchain(vtxo, now)) {
13055
13190
  return false;
13056
13191
  }
13057
13192
  return true;
13058
13193
  });
13059
13194
  }
13060
13195
  async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
13061
- const candidates = inputs.filter(chunkGGKR4O5X_cjs.isVirtualCoin).map(chunkGGKR4O5X_cjs.normalizeVtxo).filter((v) => !v.isSwept);
13196
+ const candidates = inputs.filter(chunkGHUUT54D_cjs.isVirtualCoin).map(chunkGHUUT54D_cjs.normalizeVtxo).filter((v) => !v.isSwept);
13062
13197
  if (candidates.length === 0) return inputs;
13063
- const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkGGKR4O5X_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
13198
+ const now = candidates.some((v) => v.expiresAtHeight !== void 0) ? await chunkGHUUT54D_cjs.resolveTimeHeight(wallet.onchainProvider) : { timestamp: /* @__PURE__ */ new Date() };
13064
13199
  const suspects = candidates.filter(
13065
- (v) => chunkGGKR4O5X_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
13200
+ (v) => chunkGHUUT54D_cjs.isPastExpiry(v, now) || v.expiresAtHeight !== void 0 && now.height === void 0
13066
13201
  );
13067
13202
  if (suspects.length === 0) return inputs;
13068
13203
  let sweptNow;
@@ -13076,12 +13211,12 @@ async function refreshSweptStateOfExpiredInputs(wallet, inputs) {
13076
13211
  );
13077
13212
  } catch (e) {
13078
13213
  const message = "could not confirm the swept state of expired settlement inputs; retry the settlement";
13079
- throw chunkGGKR4O5X_cjs.isRetryableProviderError(e) ? new chunkGGKR4O5X_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
13214
+ throw chunkGHUUT54D_cjs.isRetryableProviderError(e) ? new chunkGHUUT54D_cjs.ProviderUnavailableError(message, { cause: e }) : new Error(message, { cause: e });
13080
13215
  }
13081
13216
  if (sweptNow.size === 0) return inputs;
13082
13217
  return inputs.map((input) => {
13083
- if (!chunkGGKR4O5X_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
13084
- return { ...chunkGGKR4O5X_cjs.normalizeVtxo(input), isSwept: true };
13218
+ if (!chunkGHUUT54D_cjs.isVirtualCoin(input) || !sweptNow.has(`${input.txid}:${input.vout}`)) return input;
13219
+ return { ...chunkGHUUT54D_cjs.normalizeVtxo(input), isSwept: true };
13085
13220
  });
13086
13221
  }
13087
13222
  var PENDING_RECOVERY_REASON = "is past its operator signer's rotation cutoff \u2014 the operator will not co-sign it until it recovers";
@@ -13370,7 +13505,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13370
13505
  async getArkadeReader() {
13371
13506
  const indexer = this.indexerProvider;
13372
13507
  return {
13373
- getVtxos: (opts) => chunkGGKR4O5X_cjs.getNormalizedVtxos(indexer, opts),
13508
+ getVtxos: (opts) => chunkGHUUT54D_cjs.getNormalizedVtxos(indexer, opts),
13374
13509
  getVirtualTxs: (txids, opts) => indexer.getVirtualTxs(txids, opts)
13375
13510
  };
13376
13511
  }
@@ -13405,25 +13540,29 @@ var ReadonlyWallet = class _ReadonlyWallet {
13405
13540
  }
13406
13541
  /** Shared setup for ReadonlyWallet.create() and Wallet.create(). */
13407
13542
  static async setupWalletConfig(config, pubKey) {
13408
- if (config.service && (config.arkProvider || config.indexerProvider || config.onchainProvider)) {
13543
+ if (config.operatorProvider && config.arkProvider) {
13544
+ throw new Error("Pass either `operatorProvider` or `arkProvider`, not both");
13545
+ }
13546
+ const callerProvider = config.operatorProvider ?? config.arkProvider;
13547
+ if (config.service && (callerProvider || config.indexerProvider || config.onchainProvider)) {
13409
13548
  throw new Error(
13410
- "Pass either `service` or `arkProvider`/`indexerProvider`/`onchainProvider`, not both"
13549
+ "Pass either `service` or `operatorProvider`/`indexerProvider`/`onchainProvider`, not both"
13411
13550
  );
13412
13551
  }
13413
- const arkProvider = config.arkProvider || new chunkGGKR4O5X_cjs.RestArkProvider(config.service ? arkadeServiceUrl(config.service) : void 0);
13552
+ const arkProvider = callerProvider || new chunkGHUUT54D_cjs.RestOperatorProvider(config.service ? arkadeServiceUrl(config.service) : void 0);
13414
13553
  let indexerProvider = config.indexerProvider;
13415
13554
  if (!indexerProvider && !config.service) {
13416
- const derived = extractArkProviderUrl(arkProvider);
13417
- if (!derived && config.arkProvider) {
13555
+ const derived = extractOperatorProviderUrl(arkProvider);
13556
+ if (!derived && callerProvider) {
13418
13557
  throw new Error(
13419
- "indexerProvider is required when arkProvider is provided without a discoverable serverUrl"
13558
+ "indexerProvider is required when operatorProvider is provided without a discoverable serverUrl"
13420
13559
  );
13421
13560
  }
13422
- indexerProvider = new chunk64R7CRKN_cjs.RestIndexerProvider(derived ?? chunkGGKR4O5X_cjs.DEFAULT_ARKADE_SERVER_URL);
13561
+ indexerProvider = new chunkWXNSISXK_cjs.RestIndexerProvider(derived ?? chunkGHUUT54D_cjs.DEFAULT_ARKADE_SERVER_URL);
13423
13562
  }
13424
13563
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
13425
13564
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
13426
- const delegatePubKeyPromise = config.delegateProvider?.getDelegateInfo().then((info2) => chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0);
13565
+ const delegatePubKeyPromise = config.delegateProvider?.getDelegateInfo().then((info2) => chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(info2.pubkey), "delegate key")).catch(() => void 0);
13427
13566
  const {
13428
13567
  info,
13429
13568
  source: serverInfoSource,
@@ -13434,7 +13573,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13434
13573
  if (!resolvedService) throw new Error("indexerProvider is unresolved");
13435
13574
  indexerProvider = resolvedService.indexerProvider;
13436
13575
  }
13437
- const network = chunkGGKR4O5X_cjs.networkFromArkadeInfo(info);
13576
+ const network = chunkGHUUT54D_cjs.networkFromArkadeInfo(info);
13438
13577
  if ("descriptor" in config.identity) {
13439
13578
  const descriptor = config.identity.descriptor;
13440
13579
  const identityIsMainnet = !descriptor.includes("tpub");
@@ -13470,18 +13609,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
13470
13609
  }
13471
13610
  }
13472
13611
  const boardingTimelock = config.boardingTimelock ?? toTimelock(info.boardingExitDelay);
13473
- const serverPubKey = chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
13612
+ const serverPubKey = chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
13474
13613
  const delegatePubKey = await delegatePubKeyPromise;
13475
13614
  const offchainOptions = {
13476
13615
  pubKey,
13477
13616
  serverPubKey,
13478
13617
  csvTimelock: exitTimelock
13479
13618
  };
13480
- const offchainTapscript = !delegatePubKey ? new chunkOM6FJ76H_cjs.DefaultVtxo.Script(offchainOptions) : new chunkOM6FJ76H_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
13481
- const boardingTapscript = chunkOM6FJ76H_cjs.BoardingContractHandler.createScript({
13619
+ const offchainTapscript = !delegatePubKey ? new chunkE6OOJEHL_cjs.DefaultVtxo.Script(offchainOptions) : new chunkE6OOJEHL_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
13620
+ const boardingTapscript = chunkE6OOJEHL_cjs.BoardingContractHandler.createScript({
13482
13621
  pubKey: base.hex.encode(pubKey),
13483
13622
  serverPubKey: base.hex.encode(serverPubKey),
13484
- csvTimelock: chunkGGKR4O5X_cjs.timelockToSequence(boardingTimelock).toString()
13623
+ csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(boardingTimelock).toString()
13485
13624
  });
13486
13625
  return {
13487
13626
  arkProvider,
@@ -13647,7 +13786,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13647
13786
  if (!filter?.withUnrolled) {
13648
13787
  logExcludedVtxos(
13649
13788
  "getSpendableVtxos",
13650
- snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkGGKR4O5X_cjs.isVtxoSpent(vtxo)),
13789
+ snapshot.flatMap((contract) => contract.vtxos).filter((vtxo) => vtxo.isUnrolled && !chunkGHUUT54D_cjs.isVtxoSpent(vtxo)),
13651
13790
  [() => UNROLLED_REASON]
13652
13791
  );
13653
13792
  }
@@ -13790,7 +13929,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13790
13929
  this.getBoardingTxs()
13791
13930
  ]);
13792
13931
  const allVtxos = snapshot.flatMap((_) => _.vtxos);
13793
- const resolveTxCreatedAt = (txids) => chunkGGKR4O5X_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13932
+ const resolveTxCreatedAt = (txids) => chunkGHUUT54D_cjs.fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
13794
13933
  return buildTransactionHistory(
13795
13934
  allVtxos,
13796
13935
  boardingTxs,
@@ -13984,9 +14123,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
13984
14123
  async getBoardingTapscripts(allowedSigners) {
13985
14124
  const byScript = /* @__PURE__ */ new Map();
13986
14125
  const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
13987
- const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkOM6FJ76H_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14126
+ const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkE6OOJEHL_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
13988
14127
  add(
13989
- new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
14128
+ new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
13990
14129
  pubKey: await this.identity.xOnlyPublicKey(),
13991
14130
  serverPubKey: this.boardingTapscript.options.serverPubKey,
13992
14131
  csvTimelock: boardingCsv
@@ -14001,7 +14140,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14001
14140
  for (const c of boardingContracts) {
14002
14141
  if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
14003
14142
  try {
14004
- add(chunkOM6FJ76H_cjs.BoardingContractHandler.createScript(c.params));
14143
+ add(chunkE6OOJEHL_cjs.BoardingContractHandler.createScript(c.params));
14005
14144
  } catch (e) {
14006
14145
  console.warn("Skipping malformed boarding contract", c.script, e);
14007
14146
  }
@@ -14030,7 +14169,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14030
14169
  // Per-row CSV delay decoded from THIS tapscript's exit leaf —
14031
14170
  // not the wallet's current boarding timelock, which a signer
14032
14171
  // rotation may have changed.
14033
- csvTimelock: chunkGGKR4O5X_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
14172
+ csvTimelock: chunkGHUUT54D_cjs.CSVMultisigTapscript.decode(base.hex.decode(tapscript.exitScript)).params.timelock,
14034
14173
  coins: utxos
14035
14174
  };
14036
14175
  })
@@ -14195,7 +14334,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14195
14334
  /** Fetch Arkade transaction ids that are still pending final settlement. */
14196
14335
  async fetchPendingTxs() {
14197
14336
  const scripts = await this.getWalletScripts();
14198
- const vtxos = await chunkGGKR4O5X_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
14337
+ const vtxos = await chunkGHUUT54D_cjs.getAllNormalizedVtxos(this.indexerProvider, scripts);
14199
14338
  return vtxos.filter(
14200
14339
  (vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
14201
14340
  ).map((_) => _.arkTxId);
@@ -14226,7 +14365,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14226
14365
  });
14227
14366
  for (const contract of contracts) {
14228
14367
  if (map.has(contract.script)) continue;
14229
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
14368
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
14230
14369
  if (handler) {
14231
14370
  const script = handler.createScript(contract.params);
14232
14371
  map.set(contract.script, script);
@@ -14341,85 +14480,90 @@ var ReadonlyWallet = class _ReadonlyWallet {
14341
14480
  return { height, time };
14342
14481
  }
14343
14482
  });
14344
- const baselinePubkey = await baselinePubkeyPromise;
14345
- const delegatePubKey = this.offchainTapscript instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14346
- const baselineSigners = [
14347
- this.offchainTapscript.options.serverPubKey,
14348
- ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
14349
- ];
14350
- const seenBaselineScripts = /* @__PURE__ */ new Set();
14351
- const baseline = [];
14352
- for (const serverPubKey of baselineSigners) {
14353
- for (const csvTimelock2 of this.walletContractTimelocks) {
14354
- const csvTimelockStr = chunkGGKR4O5X_cjs.timelockToSequence(csvTimelock2).toString();
14355
- const defaultScript = new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
14356
- pubKey: baselinePubkey,
14357
- serverPubKey,
14358
- csvTimelock: csvTimelock2
14359
- });
14360
- const defaultScriptHex = base.hex.encode(defaultScript.pkScript);
14361
- if (!seenBaselineScripts.has(defaultScriptHex)) {
14362
- seenBaselineScripts.add(defaultScriptHex);
14363
- baseline.push({
14364
- type: "default",
14365
- params: {
14366
- pubKey: base.hex.encode(defaultScript.options.pubKey),
14367
- serverPubKey: base.hex.encode(serverPubKey),
14368
- csvTimelock: csvTimelockStr
14369
- },
14370
- script: defaultScriptHex,
14371
- address: defaultScript.address(this.network.hrp, serverPubKey).encode(),
14372
- state: "active"
14373
- });
14374
- }
14375
- if (delegatePubKey) {
14376
- const delegateScript = new chunkOM6FJ76H_cjs.DelegateVtxo.Script({
14483
+ try {
14484
+ const baselinePubkey = await baselinePubkeyPromise;
14485
+ const delegatePubKey = this.offchainTapscript instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
14486
+ const baselineSigners = [
14487
+ this.offchainTapscript.options.serverPubKey,
14488
+ ...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
14489
+ ];
14490
+ const seenBaselineScripts = /* @__PURE__ */ new Set();
14491
+ const baseline = [];
14492
+ for (const serverPubKey of baselineSigners) {
14493
+ for (const csvTimelock2 of this.walletContractTimelocks) {
14494
+ const csvTimelockStr = chunkGHUUT54D_cjs.timelockToSequence(csvTimelock2).toString();
14495
+ const defaultScript = new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
14377
14496
  pubKey: baselinePubkey,
14378
14497
  serverPubKey,
14379
- delegatePubKey,
14380
14498
  csvTimelock: csvTimelock2
14381
14499
  });
14382
- const delegateScriptHex = base.hex.encode(delegateScript.pkScript);
14383
- if (seenBaselineScripts.has(delegateScriptHex)) continue;
14384
- seenBaselineScripts.add(delegateScriptHex);
14385
- baseline.push({
14386
- type: "delegate",
14387
- params: {
14388
- pubKey: base.hex.encode(delegateScript.options.pubKey),
14389
- serverPubKey: base.hex.encode(serverPubKey),
14390
- delegatePubKey: base.hex.encode(delegateScript.options.delegatePubKey),
14391
- csvTimelock: csvTimelockStr
14392
- },
14393
- script: delegateScriptHex,
14394
- address: delegateScript.address(this.network.hrp, serverPubKey).encode(),
14395
- state: "active"
14396
- });
14500
+ const defaultScriptHex = base.hex.encode(defaultScript.pkScript);
14501
+ if (!seenBaselineScripts.has(defaultScriptHex)) {
14502
+ seenBaselineScripts.add(defaultScriptHex);
14503
+ baseline.push({
14504
+ type: "default",
14505
+ params: {
14506
+ pubKey: base.hex.encode(defaultScript.options.pubKey),
14507
+ serverPubKey: base.hex.encode(serverPubKey),
14508
+ csvTimelock: csvTimelockStr
14509
+ },
14510
+ script: defaultScriptHex,
14511
+ address: defaultScript.address(this.network.hrp, serverPubKey).encode(),
14512
+ state: "active"
14513
+ });
14514
+ }
14515
+ if (delegatePubKey) {
14516
+ const delegateScript = new chunkE6OOJEHL_cjs.DelegateVtxo.Script({
14517
+ pubKey: baselinePubkey,
14518
+ serverPubKey,
14519
+ delegatePubKey,
14520
+ csvTimelock: csvTimelock2
14521
+ });
14522
+ const delegateScriptHex = base.hex.encode(delegateScript.pkScript);
14523
+ if (seenBaselineScripts.has(delegateScriptHex)) continue;
14524
+ seenBaselineScripts.add(delegateScriptHex);
14525
+ baseline.push({
14526
+ type: "delegate",
14527
+ params: {
14528
+ pubKey: base.hex.encode(delegateScript.options.pubKey),
14529
+ serverPubKey: base.hex.encode(serverPubKey),
14530
+ delegatePubKey: base.hex.encode(delegateScript.options.delegatePubKey),
14531
+ csvTimelock: csvTimelockStr
14532
+ },
14533
+ script: delegateScriptHex,
14534
+ address: delegateScript.address(this.network.hrp, serverPubKey).encode(),
14535
+ state: "active"
14536
+ });
14537
+ }
14397
14538
  }
14398
14539
  }
14540
+ const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkE6OOJEHL_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14541
+ for (const serverPubKey of baselineSigners) {
14542
+ const baselineBoarding = new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
14543
+ pubKey: baselinePubkey,
14544
+ serverPubKey,
14545
+ csvTimelock: boardingCsvTimelock
14546
+ });
14547
+ const boardingScriptHex = base.hex.encode(baselineBoarding.pkScript);
14548
+ if (seenBaselineScripts.has(boardingScriptHex)) continue;
14549
+ seenBaselineScripts.add(boardingScriptHex);
14550
+ baseline.push({
14551
+ type: "boarding",
14552
+ params: {
14553
+ pubKey: base.hex.encode(baselineBoarding.options.pubKey),
14554
+ serverPubKey: base.hex.encode(serverPubKey),
14555
+ csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(boardingCsvTimelock).toString()
14556
+ },
14557
+ script: boardingScriptHex,
14558
+ address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
14559
+ state: "active"
14560
+ });
14561
+ }
14562
+ await manager.createContracts(baseline);
14563
+ } catch (error) {
14564
+ await manager.dispose().catch(() => void 0);
14565
+ throw error;
14399
14566
  }
14400
- const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkOM6FJ76H_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14401
- for (const serverPubKey of baselineSigners) {
14402
- const baselineBoarding = new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
14403
- pubKey: baselinePubkey,
14404
- serverPubKey,
14405
- csvTimelock: boardingCsvTimelock
14406
- });
14407
- const boardingScriptHex = base.hex.encode(baselineBoarding.pkScript);
14408
- if (seenBaselineScripts.has(boardingScriptHex)) continue;
14409
- seenBaselineScripts.add(boardingScriptHex);
14410
- baseline.push({
14411
- type: "boarding",
14412
- params: {
14413
- pubKey: base.hex.encode(baselineBoarding.options.pubKey),
14414
- serverPubKey: base.hex.encode(serverPubKey),
14415
- csvTimelock: chunkGGKR4O5X_cjs.timelockToSequence(boardingCsvTimelock).toString()
14416
- },
14417
- script: boardingScriptHex,
14418
- address: baselineBoarding.address(this.network.hrp, serverPubKey).encode(),
14419
- state: "active"
14420
- });
14421
- }
14422
- await manager.createContracts(baseline);
14423
14567
  return manager;
14424
14568
  }
14425
14569
  /** Dispose wallet-owned managers and release background resources. */
@@ -14435,7 +14579,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
14435
14579
  }
14436
14580
  };
14437
14581
  var Wallet2 = class extends ReadonlyWallet {
14438
- constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, keyring, lookAheadWindow, batchExpiryPolicy) {
14582
+ constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, keyring, lookAheadWindow, batchExpiryPolicy, oneShotSubmit = true) {
14439
14583
  super(
14440
14584
  identity,
14441
14585
  network,
@@ -14455,6 +14599,7 @@ var Wallet2 = class extends ReadonlyWallet {
14455
14599
  this.forfeitOutputScript = forfeitOutputScript;
14456
14600
  this.forfeitPubkey = forfeitPubkey;
14457
14601
  this.batchExpiryPolicy = batchExpiryPolicy;
14602
+ this.oneShotSubmit = oneShotSubmit;
14458
14603
  this.identity = identity;
14459
14604
  this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
14460
14605
  this._delegateManager = delegateProvider ? new DelegateManagerImpl(delegateProvider, arkProvider, identity) : void 0;
@@ -14476,6 +14621,7 @@ var Wallet2 = class extends ReadonlyWallet {
14476
14621
  forfeitOutputScript;
14477
14622
  forfeitPubkey;
14478
14623
  batchExpiryPolicy;
14624
+ oneShotSubmit;
14479
14625
  static MIN_FEE_RATE = 1;
14480
14626
  // sats/vbyte
14481
14627
  identity;
@@ -14598,7 +14744,7 @@ var Wallet2 = class extends ReadonlyWallet {
14598
14744
  serverPubKey: this.offchainTapscript.options.serverPubKey,
14599
14745
  deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
14600
14746
  csvTimelocks: this.walletContractTimelocks,
14601
- delegatePubKey: this.offchainTapscript instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
14747
+ delegatePubKey: this.offchainTapscript instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
14602
14748
  };
14603
14749
  }
14604
14750
  _signerRouter;
@@ -14758,7 +14904,7 @@ var Wallet2 = class extends ReadonlyWallet {
14758
14904
  const [row] = await manager.getContracts({ script: base.hex.encode(display.pkScript) });
14759
14905
  const persisted = row?.metadata?.signingDescriptor;
14760
14906
  if (typeof persisted === "string") return persisted;
14761
- return chunkOM6FJ76H_cjs.identityDescriptor(this.identity);
14907
+ return chunkE6OOJEHL_cjs.identityDescriptor(this.identity);
14762
14908
  }
14763
14909
  /**
14764
14910
  * Build, persist and shape one address of `type` owned by `descriptor`. The descriptor is the
@@ -14768,7 +14914,7 @@ var Wallet2 = class extends ReadonlyWallet {
14768
14914
  async mintAddress(manager, type, descriptor, tagSource, allocated) {
14769
14915
  if (type === "boarding") {
14770
14916
  const built2 = this.buildBoardingContract(
14771
- chunkOM6FJ76H_cjs.deriveDescriptorLeafPubKey(descriptor),
14917
+ chunkE6OOJEHL_cjs.deriveDescriptorLeafPubKey(descriptor),
14772
14918
  descriptor,
14773
14919
  tagSource
14774
14920
  );
@@ -14805,11 +14951,11 @@ var Wallet2 = class extends ReadonlyWallet {
14805
14951
  * (offchain analogue: {@link buildReceiveContract}).
14806
14952
  */
14807
14953
  buildBoardingContract(pubKey, descriptor, tagSource) {
14808
- const tapscript = new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
14954
+ const tapscript = new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
14809
14955
  ...this._boardingTapscript.options,
14810
14956
  pubKey
14811
14957
  });
14812
- const csvTimelock2 = tapscript.options.csvTimelock ?? chunkOM6FJ76H_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14958
+ const csvTimelock2 = tapscript.options.csvTimelock ?? chunkE6OOJEHL_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14813
14959
  return {
14814
14960
  tapscript,
14815
14961
  params: {
@@ -14817,13 +14963,13 @@ var Wallet2 = class extends ReadonlyWallet {
14817
14963
  params: {
14818
14964
  pubKey: base.hex.encode(pubKey),
14819
14965
  serverPubKey: base.hex.encode(tapscript.options.serverPubKey),
14820
- csvTimelock: chunkGGKR4O5X_cjs.timelockToSequence(csvTimelock2).toString()
14966
+ csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(csvTimelock2).toString()
14821
14967
  },
14822
14968
  script: base.hex.encode(tapscript.pkScript),
14823
14969
  address: tapscript.address(this.network.hrp, this.arkServerPublicKey).encode(),
14824
14970
  state: "active",
14825
14971
  metadata: {
14826
- ...tagSource && { source: chunkOM6FJ76H_cjs.WALLET_RECEIVE_SOURCE },
14972
+ ...tagSource && { source: chunkE6OOJEHL_cjs.WALLET_RECEIVE_SOURCE },
14827
14973
  signingDescriptor: descriptor
14828
14974
  }
14829
14975
  }
@@ -14845,7 +14991,7 @@ var Wallet2 = class extends ReadonlyWallet {
14845
14991
  if (this._hdProvider) {
14846
14992
  return (await this.getContractManager()).getNextSigningDescriptor();
14847
14993
  }
14848
- return chunkOM6FJ76H_cjs.identityDescriptor(this.identity);
14994
+ return chunkE6OOJEHL_cjs.identityDescriptor(this.identity);
14849
14995
  }
14850
14996
  /**
14851
14997
  * @see HDAllocationCapable.advanceSigningDescriptorWatermark
@@ -14921,7 +15067,7 @@ var Wallet2 = class extends ReadonlyWallet {
14921
15067
  * the stable public API.
14922
15068
  */
14923
15069
  async rotateServerSigner(newServerPubKey, checkpointTapscript) {
14924
- const xonly = chunkOM6FJ76H_cjs.toXOnly(newServerPubKey, "ark signer key");
15070
+ const xonly = chunkE6OOJEHL_cjs.toXOnly(newServerPubKey, "ark signer key");
14925
15071
  const newServerUnrollScript = assertValidServerUnrollScript(
14926
15072
  checkpointTapscript,
14927
15073
  this.network,
@@ -14951,21 +15097,21 @@ var Wallet2 = class extends ReadonlyWallet {
14951
15097
  ]);
14952
15098
  const [currentOffchainRow] = offchainRows;
14953
15099
  const [currentBoardingRow] = boardingRows;
14954
- const newOffchain = this.offchainTapscript instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script ? new chunkOM6FJ76H_cjs.DelegateVtxo.Script({
15100
+ const newOffchain = this.offchainTapscript instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script ? new chunkE6OOJEHL_cjs.DelegateVtxo.Script({
14955
15101
  ...this.offchainTapscript.options,
14956
15102
  serverPubKey: xonly
14957
- }) : new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
15103
+ }) : new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
14958
15104
  ...this.offchainTapscript.options,
14959
15105
  serverPubKey: xonly
14960
15106
  });
14961
- const newBoarding = new chunkOM6FJ76H_cjs.DefaultVtxo.Script({
15107
+ const newBoarding = new chunkE6OOJEHL_cjs.DefaultVtxo.Script({
14962
15108
  ...this._boardingTapscript.options,
14963
15109
  serverPubKey: xonly
14964
15110
  });
14965
- const offchainCsv = chunkGGKR4O5X_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
15111
+ const offchainCsv = chunkGHUUT54D_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
14966
15112
  const newOffchainScript = base.hex.encode(newOffchain.pkScript);
14967
15113
  const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
14968
- if (newOffchain instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script) {
15114
+ if (newOffchain instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script) {
14969
15115
  await manager.createContract({
14970
15116
  type: "delegate",
14971
15117
  params: {
@@ -14993,13 +15139,13 @@ var Wallet2 = class extends ReadonlyWallet {
14993
15139
  metadata: currentOffchainRow?.metadata
14994
15140
  });
14995
15141
  }
14996
- const boardingCsv = newBoarding.options.csvTimelock ?? chunkOM6FJ76H_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
15142
+ const boardingCsv = newBoarding.options.csvTimelock ?? chunkE6OOJEHL_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
14997
15143
  await manager.createContract({
14998
15144
  type: "boarding",
14999
15145
  params: {
15000
15146
  pubKey: base.hex.encode(newBoarding.options.pubKey),
15001
15147
  serverPubKey: base.hex.encode(xonly),
15002
- csvTimelock: chunkGGKR4O5X_cjs.timelockToSequence(boardingCsv).toString()
15148
+ csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(boardingCsv).toString()
15003
15149
  },
15004
15150
  script: base.hex.encode(newBoarding.pkScript),
15005
15151
  address: newBoarding.address(this.network.hrp, xonly).encode(),
@@ -15027,14 +15173,14 @@ var Wallet2 = class extends ReadonlyWallet {
15027
15173
  _restoreInFlight;
15028
15174
  _addPendingSpends(inputs) {
15029
15175
  for (const input of inputs) {
15030
- if (chunkGGKR4O5X_cjs.isVirtualCoin(input)) {
15176
+ if (chunkGHUUT54D_cjs.isVirtualCoin(input)) {
15031
15177
  this._pendingSpendOutpoints.add(`${input.txid}:${input.vout}`);
15032
15178
  }
15033
15179
  }
15034
15180
  }
15035
15181
  _removePendingSpends(inputs) {
15036
15182
  for (const input of inputs) {
15037
- if (chunkGGKR4O5X_cjs.isVirtualCoin(input)) {
15183
+ if (chunkGHUUT54D_cjs.isVirtualCoin(input)) {
15038
15184
  this._pendingSpendOutpoints.delete(`${input.txid}:${input.vout}`);
15039
15185
  }
15040
15186
  }
@@ -15098,7 +15244,7 @@ var Wallet2 = class extends ReadonlyWallet {
15098
15244
  if (clashing.length > 0) throw new VtxoReservedError(clashing, "in-flight");
15099
15245
  }
15100
15246
  _assertNotHeld(inputs) {
15101
- const held = coinKeys(inputs.filter(chunkGGKR4O5X_cjs.isVirtualCoin)).filter(
15247
+ const held = coinKeys(inputs.filter(chunkGHUUT54D_cjs.isVirtualCoin)).filter(
15102
15248
  (key) => this._heldOutpoints.has(key)
15103
15249
  );
15104
15250
  if (held.length > 0) throw new VtxoReservedError(held, "held");
@@ -15137,14 +15283,14 @@ var Wallet2 = class extends ReadonlyWallet {
15137
15283
  const hd = provider !== void 0;
15138
15284
  const [manager, staticDescriptor, arkInfo] = await Promise.all([
15139
15285
  this.getContractManager(),
15140
- hd ? void 0 : chunkOM6FJ76H_cjs.identityDescriptor(this.identity),
15286
+ hd ? void 0 : chunkE6OOJEHL_cjs.identityDescriptor(this.identity),
15141
15287
  this.arkProvider.getInfo()
15142
15288
  ]);
15143
15289
  const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
15144
- const delegatePubKey = this.offchainTapscript instanceof chunkOM6FJ76H_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
15145
- const currentSignerPubKey = chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
15290
+ const delegatePubKey = this.offchainTapscript instanceof chunkE6OOJEHL_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
15291
+ const currentSignerPubKey = chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(arkInfo.signerPubkey), "ark signer key");
15146
15292
  const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
15147
- (s) => chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
15293
+ (s) => chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(s.pubkey), "deprecated signer key")
15148
15294
  );
15149
15295
  const deps = {
15150
15296
  indexerProvider: this.indexerProvider,
@@ -15156,7 +15302,7 @@ var Wallet2 = class extends ReadonlyWallet {
15156
15302
  deprecatedSignerPubKeys,
15157
15303
  csvTimelocks: this.walletContractTimelocks,
15158
15304
  // Boarding-exit CSV, distinct from the unilateral-exit matrix.
15159
- boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkOM6FJ76H_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
15305
+ boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkE6OOJEHL_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
15160
15306
  delegatePubKey
15161
15307
  };
15162
15308
  const result = await manager.scanContracts({
@@ -15273,7 +15419,7 @@ var Wallet2 = class extends ReadonlyWallet {
15273
15419
  throw new Error("Invalid configured public key");
15274
15420
  }
15275
15421
  const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
15276
- const forfeitPubkey = chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
15422
+ const forfeitPubkey = chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(setup.info.forfeitPubkey), "forfeit key");
15277
15423
  const forfeitAddress = btcSigner.Address(setup.network).decode(setup.info.forfeitAddress);
15278
15424
  const forfeitOutputScript = btcSigner.OutScript.encode(forfeitAddress);
15279
15425
  const serverUnrollScript = assertValidServerUnrollScript(
@@ -15321,7 +15467,8 @@ var Wallet2 = class extends ReadonlyWallet {
15321
15467
  {
15322
15468
  advertisedVtxoTreeExpiry: setup.info.vtxoTreeExpiry,
15323
15469
  ...config.minBatchExpirySeconds !== void 0 ? { minSeconds: config.minBatchExpirySeconds } : {}
15324
- }
15470
+ },
15471
+ config.oneShotSubmit
15325
15472
  );
15326
15473
  wallet.lazyInitialization = config.lazyInitialization ?? false;
15327
15474
  wallet._serverInfoSource = setup.serverInfoSource;
@@ -15441,13 +15588,13 @@ var Wallet2 = class extends ReadonlyWallet {
15441
15588
  void this.logUngatedInputs("settle({ inputs })", params.inputs);
15442
15589
  }
15443
15590
  const offchainAddress = await this.getAddress();
15444
- const offchainPkScript = chunkGGKR4O5X_cjs.ArkAddress.decode(offchainAddress).pkScript;
15591
+ const offchainPkScript = chunkGHUUT54D_cjs.ArkAddress.decode(offchainAddress).pkScript;
15445
15592
  const offchainOutputScript = base.hex.encode(offchainPkScript);
15446
15593
  if (!params) {
15447
15594
  const { fees, vtxoMaxAmount } = await this.arkProvider.getInfo();
15448
15595
  const estimator = new Estimator(fees.intentFee);
15449
15596
  let amount = 0;
15450
- const exitScript = chunkGGKR4O5X_cjs.CSVMultisigTapscript.decode(
15597
+ const exitScript = chunkGHUUT54D_cjs.CSVMultisigTapscript.decode(
15451
15598
  base.hex.decode(this.boardingTapscript.exitScript)
15452
15599
  );
15453
15600
  const boardingTimelock = exitScript.params.timelock;
@@ -15479,7 +15626,7 @@ var Wallet2 = class extends ReadonlyWallet {
15479
15626
  if (filteredVtxos.length >= MAX_VTXOS_PER_SETTLEMENT) {
15480
15627
  break;
15481
15628
  }
15482
- const inputFee = estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(vtxo));
15629
+ const inputFee = estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(vtxo));
15483
15630
  if (inputFee.satoshis >= vtxo.value) {
15484
15631
  continue;
15485
15632
  }
@@ -15531,7 +15678,7 @@ var Wallet2 = class extends ReadonlyWallet {
15531
15678
  let script;
15532
15679
  let arkAddress;
15533
15680
  try {
15534
- arkAddress = chunkGGKR4O5X_cjs.ArkAddress.decode(output.address);
15681
+ arkAddress = chunkGHUUT54D_cjs.ArkAddress.decode(output.address);
15535
15682
  } catch {
15536
15683
  arkAddress = void 0;
15537
15684
  }
@@ -15603,11 +15750,11 @@ var Wallet2 = class extends ReadonlyWallet {
15603
15750
  ]);
15604
15751
  let intentTxId;
15605
15752
  try {
15606
- intentTxId = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(intent.proof)).id;
15753
+ intentTxId = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(intent.proof)).id;
15607
15754
  } catch {
15608
15755
  intentTxId = params.inputs.map((i) => `${i.txid}:${i.vout}`).sort().join("|");
15609
15756
  }
15610
- const settleInputVtxos = params.inputs.filter(chunkGGKR4O5X_cjs.isVirtualCoin);
15757
+ const settleInputVtxos = params.inputs.filter(chunkGHUUT54D_cjs.isVirtualCoin);
15611
15758
  const contractManager = await this.getContractManager();
15612
15759
  await contractManager.assertAnnotatable(settleInputVtxos);
15613
15760
  await contractManager.assertSpendableNow?.(
@@ -15616,7 +15763,7 @@ var Wallet2 = class extends ReadonlyWallet {
15616
15763
  );
15617
15764
  if (picked) this._assertNotHeld(params.inputs);
15618
15765
  this._addPendingSpends(params.inputs);
15619
- const boardingKeys = onReserved ? coinKeys(params.inputs.filter((i) => !chunkGGKR4O5X_cjs.isVirtualCoin(i))) : [];
15766
+ const boardingKeys = onReserved ? coinKeys(params.inputs.filter((i) => !chunkGHUUT54D_cjs.isVirtualCoin(i))) : [];
15620
15767
  for (const key of boardingKeys) this._pendingSpendOutpoints.add(key);
15621
15768
  const settlingKeys = params.inputs.map((i) => `${i.txid}:${i.vout}`);
15622
15769
  for (const key of settlingKeys) this._settlingOutpoints.add(key);
@@ -15735,7 +15882,7 @@ var Wallet2 = class extends ReadonlyWallet {
15735
15882
  async maybeRotateBoardingAfterBoard(inputs) {
15736
15883
  if (!this._descriptorProvider) return;
15737
15884
  const consumedBoarding = inputs.some(
15738
- (input) => typeof input !== "string" && !chunkGGKR4O5X_cjs.isVirtualCoin(input)
15885
+ (input) => typeof input !== "string" && !chunkGHUUT54D_cjs.isVirtualCoin(input)
15739
15886
  );
15740
15887
  if (!consumedBoarding) return;
15741
15888
  try {
@@ -15746,7 +15893,7 @@ var Wallet2 = class extends ReadonlyWallet {
15746
15893
  }
15747
15894
  async handleSettlementFinalizationEvent(event, inputs, forfeitOutputScript, expectedRecipients, connectorsGraph, validatedCommitmentTxid) {
15748
15895
  const signedForfeits = [];
15749
- let settlementPsbt = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
15896
+ let settlementPsbt = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
15750
15897
  assertFinalCommitmentMatchesValidated(
15751
15898
  settlementPsbt,
15752
15899
  validatedCommitmentTxid,
@@ -15759,7 +15906,7 @@ var Wallet2 = class extends ReadonlyWallet {
15759
15906
  let connectorIndex = 0;
15760
15907
  const connectorsLeaves = connectorsGraph?.leaves() || [];
15761
15908
  for (const input of inputs) {
15762
- if (!chunkGGKR4O5X_cjs.isVirtualCoin(input)) {
15909
+ if (!chunkGHUUT54D_cjs.isVirtualCoin(input)) {
15763
15910
  let matched = false;
15764
15911
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
15765
15912
  const settlementInput = settlementPsbt.getInput(i);
@@ -15797,7 +15944,7 @@ var Wallet2 = class extends ReadonlyWallet {
15797
15944
  }
15798
15945
  continue;
15799
15946
  }
15800
- if (!chunkGGKR4O5X_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
15947
+ if (!chunkGHUUT54D_cjs.requiresForfeit(input) || isSubdust({ value: input.value }, this.dustAmount)) {
15801
15948
  continue;
15802
15949
  }
15803
15950
  if (connectorsLeaves.length === 0) {
@@ -15825,7 +15972,7 @@ var Wallet2 = class extends ReadonlyWallet {
15825
15972
  index: input.vout,
15826
15973
  witnessUtxo: {
15827
15974
  amount: BigInt(input.value),
15828
- script: chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).pkScript
15975
+ script: chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).pkScript
15829
15976
  },
15830
15977
  sighashType: btcSigner.SigHash.DEFAULT,
15831
15978
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -15844,7 +15991,7 @@ var Wallet2 = class extends ReadonlyWallet {
15844
15991
  forfeitTx = await this._signerRouter.sign(forfeitTx, [
15845
15992
  {
15846
15993
  index: 0,
15847
- lookupScript: chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).pkScript
15994
+ lookupScript: chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).pkScript
15848
15995
  }
15849
15996
  ]);
15850
15997
  signedForfeits.push(base.base64.encode(forfeitTx.toPSBT()));
@@ -15895,14 +16042,14 @@ var Wallet2 = class extends ReadonlyWallet {
15895
16042
  return { skip };
15896
16043
  }
15897
16044
  if (!this.arkProvider) {
15898
- throw new Error("Arkade provider not configured");
16045
+ throw new Error("Operator provider not configured");
15899
16046
  }
15900
16047
  const timelock = assertValidBatchExpiry(
15901
16048
  event.batchExpiry,
15902
16049
  resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
15903
16050
  );
15904
16051
  await this.arkProvider.confirmRegistration(intentId);
15905
- const sweepTapscript = chunkGGKR4O5X_cjs.CSVMultisigTapscript.encode({
16052
+ const sweepTapscript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
15906
16053
  timelock,
15907
16054
  pubkeys: [this.forfeitPubkey]
15908
16055
  }).script;
@@ -15917,14 +16064,14 @@ var Wallet2 = class extends ReadonlyWallet {
15917
16064
  throw new Error("Sweep tap tree root not set");
15918
16065
  }
15919
16066
  const xOnlyPublicKeys = event.cosignersPublicKeys.map(
15920
- (k) => base.hex.encode(chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
16067
+ (k) => base.hex.encode(chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
15921
16068
  );
15922
16069
  const signerPublicKey = await session.getPublicKey();
15923
- const xonlySignerPublicKey = chunkOM6FJ76H_cjs.toXOnly(signerPublicKey, "signer key");
16070
+ const xonlySignerPublicKey = chunkE6OOJEHL_cjs.toXOnly(signerPublicKey, "signer key");
15924
16071
  if (!xOnlyPublicKeys.includes(base.hex.encode(xonlySignerPublicKey))) {
15925
16072
  return { skip: true };
15926
16073
  }
15927
- const commitmentTx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(
16074
+ const commitmentTx = chunkGHUUT54D_cjs.Transaction.fromPSBT(
15928
16075
  base.base64.decode(event.unsignedCommitmentTx)
15929
16076
  );
15930
16077
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
@@ -16006,9 +16153,9 @@ var Wallet2 = class extends ReadonlyWallet {
16006
16153
  ...existing ?? {},
16007
16154
  intentTxId,
16008
16155
  registerProof: intent.proof,
16009
- registerProofMessage: chunkGGKR4O5X_cjs.Intent.encodeMessage(intent.message),
16156
+ registerProofMessage: chunkGHUUT54D_cjs.Proof.encodeMessage(intent.message),
16010
16157
  deleteProof: deleteIntent.proof,
16011
- deleteProofMessage: chunkGGKR4O5X_cjs.Intent.encodeMessage(deleteIntent.message),
16158
+ deleteProofMessage: chunkGHUUT54D_cjs.Intent.encodeMessage(deleteIntent.message),
16012
16159
  intentVtxos: inputs.map((i) => ({
16013
16160
  txid: i.txid,
16014
16161
  vout: i.vout
@@ -16041,7 +16188,7 @@ var Wallet2 = class extends ReadonlyWallet {
16041
16188
  try {
16042
16189
  return await this.arkProvider.registerIntent(intent);
16043
16190
  } catch (error) {
16044
- if (error instanceof chunkGGKR4O5X_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
16191
+ if (error instanceof chunkGHUUT54D_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
16045
16192
  const deleteIntent = await this.makeDeleteIntentSignature(inputs);
16046
16193
  await this.arkProvider.deleteIntent(deleteIntent);
16047
16194
  return this.arkProvider.registerIntent(intent);
@@ -16057,7 +16204,7 @@ var Wallet2 = class extends ReadonlyWallet {
16057
16204
  expire_at: 0,
16058
16205
  cosigners_public_keys: cosignerPubKeys
16059
16206
  };
16060
- const proof = chunkGGKR4O5X_cjs.Intent.create(message, coins, outputs);
16207
+ const proof = chunkGHUUT54D_cjs.Proof.create(message, coins, outputs);
16061
16208
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
16062
16209
  return {
16063
16210
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -16069,7 +16216,7 @@ var Wallet2 = class extends ReadonlyWallet {
16069
16216
  type: "delete",
16070
16217
  expire_at: 0
16071
16218
  };
16072
- const proof = chunkGGKR4O5X_cjs.Intent.create(message, coins, []);
16219
+ const proof = chunkGHUUT54D_cjs.Proof.create(message, coins, []);
16073
16220
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
16074
16221
  return {
16075
16222
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -16081,7 +16228,7 @@ var Wallet2 = class extends ReadonlyWallet {
16081
16228
  type: "get-pending-tx",
16082
16229
  expire_at: 0
16083
16230
  };
16084
- const proof = chunkGGKR4O5X_cjs.Intent.create(message, coins, []);
16231
+ const proof = chunkGHUUT54D_cjs.Proof.create(message, coins, []);
16085
16232
  const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
16086
16233
  return {
16087
16234
  proof: base.base64.encode(signedProof.toPSBT()),
@@ -16102,7 +16249,7 @@ var Wallet2 = class extends ReadonlyWallet {
16102
16249
  if (!vtxos || vtxos.length === 0) {
16103
16250
  const scriptMap = await this.getScriptMap();
16104
16251
  const allExtended = [];
16105
- const fetchedVtxos = await chunkGGKR4O5X_cjs.getAllNormalizedVtxos(this.indexerProvider, [
16252
+ const fetchedVtxos = await chunkGHUUT54D_cjs.getAllNormalizedVtxos(this.indexerProvider, [
16106
16253
  ...scriptMap.keys()
16107
16254
  ]);
16108
16255
  for (const vtxo of fetchedVtxos) {
@@ -16124,8 +16271,8 @@ var Wallet2 = class extends ReadonlyWallet {
16124
16271
  vtxos = allExtended;
16125
16272
  }
16126
16273
  const batches = [];
16127
- for (let i = 0; i < vtxos.length; i += MAX_INPUTS_PER_INTENT) {
16128
- batches.push(vtxos.slice(i, i + MAX_INPUTS_PER_INTENT));
16274
+ for (let i = 0; i < vtxos.length; i += MAX_INPUTS_PER_PROOF) {
16275
+ batches.push(vtxos.slice(i, i + MAX_INPUTS_PER_PROOF));
16129
16276
  }
16130
16277
  const unrollCandidates = this.checkpointUnrollCandidates(await this.arkProvider.getInfo());
16131
16278
  const checkpointInputs = vtxos.map((vtxo) => ({
@@ -16145,8 +16292,8 @@ var Wallet2 = class extends ReadonlyWallet {
16145
16292
  batchPending.push(pendingTx.arkTxid);
16146
16293
  try {
16147
16294
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((c) => {
16148
- const tx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(c));
16149
- chunkGGKR4O5X_cjs.assertAllowedSighashTypes(tx);
16295
+ const tx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(c));
16296
+ chunkGHUUT54D_cjs.assertAllowedSighashTypes(tx);
16150
16297
  return tx;
16151
16298
  });
16152
16299
  assertCheckpointsMatchInputs(
@@ -16215,11 +16362,11 @@ var Wallet2 = class extends ReadonlyWallet {
16215
16362
  * and one per deprecated signer — else a pre-rotation tx would stay pending forever.
16216
16363
  */
16217
16364
  checkpointUnrollCandidates(info) {
16218
- const current = chunkGGKR4O5X_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
16365
+ const current = chunkGHUUT54D_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
16219
16366
  const candidates = [this._serverUnrollScript, current];
16220
16367
  for (const deprecated of signerSetFromInfo(info).deprecated.keys()) {
16221
16368
  candidates.push(
16222
- chunkGGKR4O5X_cjs.CSVMultisigTapscript.encode({
16369
+ chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
16223
16370
  ...current.params,
16224
16371
  pubkeys: [base.hex.decode(deprecated)]
16225
16372
  })
@@ -16314,7 +16461,7 @@ var Wallet2 = class extends ReadonlyWallet {
16314
16461
  if (vtxos.length === 0) {
16315
16462
  throw new Error("No VTXOs found for this arkadeCash");
16316
16463
  }
16317
- const myPkScript = chunkGGKR4O5X_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
16464
+ const myPkScript = chunkGHUUT54D_cjs.ArkAddress.decode(await this.getAddress()).pkScript;
16318
16465
  let { spendable, recoverable, unclaimed } = this.classifyCashVtxos(vtxos);
16319
16466
  let swept = 0;
16320
16467
  const drainable = vtxos.filter(
@@ -16362,7 +16509,8 @@ var Wallet2 = class extends ReadonlyWallet {
16362
16509
  }
16363
16510
  ],
16364
16511
  outputs: [{ script: myPkScript, amount: BigInt(vtxo.value) }],
16365
- serverUnrollScript
16512
+ serverUnrollScript,
16513
+ oneShot: this.oneShotSubmit
16366
16514
  });
16367
16515
  swept += vtxo.value;
16368
16516
  } catch (error) {
@@ -16441,7 +16589,7 @@ var Wallet2 = class extends ReadonlyWallet {
16441
16589
  params: {
16442
16590
  pubKey: base.hex.encode(cash.publicKey),
16443
16591
  serverPubKey: base.hex.encode(cash.serverPubKey),
16444
- csvTimelock: chunkGGKR4O5X_cjs.timelockToSequence(cash.csvTimelock).toString()
16592
+ csvTimelock: chunkGHUUT54D_cjs.timelockToSequence(cash.csvTimelock).toString()
16445
16593
  },
16446
16594
  script: base.hex.encode(cashScript.pkScript),
16447
16595
  address: cashAddress.encode(),
@@ -16522,7 +16670,7 @@ var Wallet2 = class extends ReadonlyWallet {
16522
16670
  const recoverable = [];
16523
16671
  const unclaimed = [];
16524
16672
  for (const vtxo of vtxos) {
16525
- if (chunkGGKR4O5X_cjs.isVtxoSpent(vtxo)) {
16673
+ if (chunkGHUUT54D_cjs.isVtxoSpent(vtxo)) {
16526
16674
  unclaimed.push(cashReport(vtxo, "already-spent"));
16527
16675
  } else if (vtxo.isUnrolled) {
16528
16676
  unclaimed.push(cashReport(vtxo, "exited"));
@@ -16544,7 +16692,7 @@ var Wallet2 = class extends ReadonlyWallet {
16544
16692
  const all = [];
16545
16693
  const seen = /* @__PURE__ */ new Set();
16546
16694
  for (let pageIndex = 0; ; pageIndex++) {
16547
- const { vtxos, page } = await chunkGGKR4O5X_cjs.getNormalizedVtxos(this.indexerProvider, {
16695
+ const { vtxos, page } = await chunkGHUUT54D_cjs.getNormalizedVtxos(this.indexerProvider, {
16548
16696
  scripts,
16549
16697
  pageIndex,
16550
16698
  pageSize
@@ -16579,10 +16727,10 @@ var Wallet2 = class extends ReadonlyWallet {
16579
16727
  const identity = cash.identity;
16580
16728
  const seenTxids = /* @__PURE__ */ new Set();
16581
16729
  const pendingTxs = [];
16582
- for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
16583
- const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
16730
+ for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_PROOF) {
16731
+ const batch = inputs.slice(i, i + MAX_INPUTS_PER_PROOF);
16584
16732
  const message = { type: "get-pending-tx", expire_at: 0 };
16585
- const proof = chunkGGKR4O5X_cjs.Intent.create(message, batch, []);
16733
+ const proof = chunkGHUUT54D_cjs.Proof.create(message, batch, []);
16586
16734
  const signedProof = await identity.sign(
16587
16735
  proof,
16588
16736
  Array.from({ length: batch.length + 1 }, (_, j) => j)
@@ -16603,8 +16751,8 @@ var Wallet2 = class extends ReadonlyWallet {
16603
16751
  for (const pendingTx of pendingTxs) {
16604
16752
  try {
16605
16753
  const checkpointTxs = pendingTx.signedCheckpointTxs.map((checkpoint) => {
16606
- const tx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(checkpoint));
16607
- chunkGGKR4O5X_cjs.assertAllowedSighashTypes(tx);
16754
+ const tx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(checkpoint));
16755
+ chunkGHUUT54D_cjs.assertAllowedSighashTypes(tx);
16608
16756
  return tx;
16609
16757
  });
16610
16758
  assertCheckpointsMatchInputs(
@@ -16644,7 +16792,7 @@ var Wallet2 = class extends ReadonlyWallet {
16644
16792
  }
16645
16793
  /** Sum the outputs of an ark tx PSBT that pay the given scriptPubKey. */
16646
16794
  arkTxAmountPaidTo(arkTxPsbt, pkScriptHex) {
16647
- const arkTx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(arkTxPsbt));
16795
+ const arkTx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(arkTxPsbt));
16648
16796
  let total = 0;
16649
16797
  for (let i = 0; i < arkTx.outputsLength; i++) {
16650
16798
  const output = arkTx.getOutput(i);
@@ -16703,7 +16851,7 @@ var Wallet2 = class extends ReadonlyWallet {
16703
16851
  throw new Error("send({ maxChangeFee }): expected a non-negative safe integer");
16704
16852
  }
16705
16853
  if (selectedVtxos) {
16706
- if (inputExpiryFloor) selectedVtxos = selectedVtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo);
16854
+ if (inputExpiryFloor) selectedVtxos = selectedVtxos.map(chunkGHUUT54D_cjs.normalizeVtxo);
16707
16855
  if (inputExpiryFloor && selectedVtxos.some((coin) => !meetsInputExpiryFloor(coin, inputExpiryFloor))) {
16708
16856
  throw new Error("send({ selectedVtxos }): input expiry floor not met");
16709
16857
  }
@@ -16838,7 +16986,7 @@ var Wallet2 = class extends ReadonlyWallet {
16838
16986
  script: recipient.script,
16839
16987
  amount: BigInt(recipient.amount),
16840
16988
  // Already checked against the recipient address in `validateRecipients`.
16841
- ...recipient.tapTree ? { tapTree: chunkGGKR4O5X_cjs.toBIP371TapTree(recipient.tapTree) } : {}
16989
+ ...recipient.tapTree ? { tapTree: chunkGHUUT54D_cjs.toBIP371TapTree(recipient.tapTree) } : {}
16842
16990
  }));
16843
16991
  const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
16844
16992
  let changeAmount = totalBtcSelected - totalBtcOutput;
@@ -17030,10 +17178,10 @@ var Wallet2 = class extends ReadonlyWallet {
17030
17178
  const serverPubKey = this.arkServerPublicKey;
17031
17179
  const serverUnrollScript = this.serverUnrollScript;
17032
17180
  const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
17033
- const normalizedInputs = inputs.map(chunkGGKR4O5X_cjs.normalizeVtxo);
17034
- const at = now ?? await chunkGGKR4O5X_cjs.resolveTimeHeight(this.onchainProvider);
17181
+ const normalizedInputs = inputs.map(chunkGHUUT54D_cjs.normalizeVtxo);
17182
+ const at = now ?? await chunkGHUUT54D_cjs.resolveTimeHeight(this.onchainProvider);
17035
17183
  for (const input of normalizedInputs) {
17036
- if (!chunkGGKR4O5X_cjs.canSpendOffchain(input, at)) {
17184
+ if (!chunkGHUUT54D_cjs.canSpendOffchain(input, at)) {
17037
17185
  throw new Error(
17038
17186
  `sendSelectedVtxosToSelf: input ${input.txid}:${input.vout} is not cooperatively spendable`
17039
17187
  );
@@ -17087,7 +17235,7 @@ var Wallet2 = class extends ReadonlyWallet {
17087
17235
  }
17088
17236
  /**
17089
17237
  * Build an offchain transaction from the given inputs and outputs,
17090
- * sign it, submit to the Arkade provider, and finalize.
17238
+ * sign it, submit to the operator provider, and finalize.
17091
17239
  *
17092
17240
  * Signs whatever it is handed, ungated — see {@link settle} for the trade.
17093
17241
  *
@@ -17117,7 +17265,7 @@ var Wallet2 = class extends ReadonlyWallet {
17117
17265
  );
17118
17266
  const arkTxJobs = inputs.map((input, index) => ({
17119
17267
  index,
17120
- lookupScript: chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).pkScript
17268
+ lookupScript: chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).pkScript
17121
17269
  }));
17122
17270
  const identity = this.identity;
17123
17271
  const signer = {
@@ -17204,7 +17352,8 @@ var Wallet2 = class extends ReadonlyWallet {
17204
17352
  deprecatedServerPubkeys: [...this._deprecatedSigners.keys()].map(
17205
17353
  (h) => base.hex.decode(h)
17206
17354
  )
17207
- }
17355
+ },
17356
+ oneShot: this.oneShotSubmit
17208
17357
  }
17209
17358
  );
17210
17359
  } finally {
@@ -17226,7 +17375,7 @@ var Wallet2 = class extends ReadonlyWallet {
17226
17375
  }
17227
17376
  const checkpointIdByOutpoint = /* @__PURE__ */ new Map();
17228
17377
  for (const encoded of signedCheckpointTxs) {
17229
- const checkpoint = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
17378
+ const checkpoint = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(encoded));
17230
17379
  for (let i = 0; i < checkpoint.inputsLength; i++) {
17231
17380
  const input = checkpoint.getInput(i);
17232
17381
  if (!input.txid) continue;
@@ -17342,12 +17491,12 @@ var Wallet2 = class extends ReadonlyWallet {
17342
17491
  const spentVtxos = [];
17343
17492
  const inputArkTxIds = /* @__PURE__ */ new Set();
17344
17493
  const boardingRemovalsByAddress = /* @__PURE__ */ new Map();
17345
- const vtxoInputs = inputs.filter(chunkGGKR4O5X_cjs.isVirtualCoin);
17494
+ const vtxoInputs = inputs.filter(chunkGHUUT54D_cjs.isVirtualCoin);
17346
17495
  const cm = await this.getContractManager();
17347
17496
  const annotatedVtxos = await cm.annotateVtxos(vtxoInputs);
17348
17497
  const annotatedByKey = new Map(annotatedVtxos.map((v) => [`${v.txid}:${v.vout}`, v]));
17349
17498
  for (const input of inputs) {
17350
- if (chunkGGKR4O5X_cjs.isVirtualCoin(input)) {
17499
+ if (chunkGHUUT54D_cjs.isVirtualCoin(input)) {
17351
17500
  const outpoint = `${input.txid}:${input.vout}`;
17352
17501
  const vtxo = annotatedByKey.get(outpoint);
17353
17502
  if (!vtxo) {
@@ -17364,7 +17513,7 @@ var Wallet2 = class extends ReadonlyWallet {
17364
17513
  } else {
17365
17514
  let sourceAddress;
17366
17515
  try {
17367
- sourceAddress = chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
17516
+ sourceAddress = chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).onchainAddress(
17368
17517
  this.network
17369
17518
  );
17370
17519
  } catch {
@@ -17436,7 +17585,7 @@ function bySelectionOrder(a, b) {
17436
17585
  return b.value - a.value;
17437
17586
  }
17438
17587
  function selectVirtualCoins(coins, targetAmount) {
17439
- const sortedCoins = coins.map(chunkGGKR4O5X_cjs.normalizeVtxo).sort(bySelectionOrder);
17588
+ const sortedCoins = coins.map(chunkGHUUT54D_cjs.normalizeVtxo).sort(bySelectionOrder);
17440
17589
  const selectedCoins = [];
17441
17590
  let selectedAmount = 0;
17442
17591
  for (const coin of sortedCoins) {
@@ -17553,7 +17702,7 @@ function assertTimeoutMap(name, timeouts) {
17553
17702
  if (value === void 0) {
17554
17703
  throw new Error(`${name}.${key} must be a non-negative safe integer`);
17555
17704
  }
17556
- chunkGGKR4O5X_cjs.assertTimerMs(`${name}.${key}`, value);
17705
+ chunkGHUUT54D_cjs.assertTimerMs(`${name}.${key}`, value);
17557
17706
  }
17558
17707
  }
17559
17708
  var MessageBus = class {
@@ -17570,8 +17719,8 @@ var MessageBus = class {
17570
17719
  }) {
17571
17720
  this.walletRepository = walletRepository;
17572
17721
  this.contractRepository = contractRepository;
17573
- chunkGGKR4O5X_cjs.assertTimerMs("tickIntervalMs", tickIntervalMs);
17574
- chunkGGKR4O5X_cjs.assertTimerMs("messageTimeoutMs", messageTimeoutMs);
17722
+ chunkGHUUT54D_cjs.assertTimerMs("tickIntervalMs", tickIntervalMs);
17723
+ chunkGHUUT54D_cjs.assertTimerMs("messageTimeoutMs", messageTimeoutMs);
17575
17724
  assertTimeoutMap("messageTimeoutOverrides", messageTimeoutOverrides);
17576
17725
  this.intentRepository = intentRepository;
17577
17726
  this.onchainProvider = onchainProvider;
@@ -17827,14 +17976,14 @@ var MessageBus = class {
17827
17976
  this.initialized = true;
17828
17977
  }
17829
17978
  async buildServices(config) {
17830
- const arkProvider = new chunkGGKR4O5X_cjs.RestArkProvider(config.arkServer.url);
17979
+ const arkProvider = new chunkGHUUT54D_cjs.RestOperatorProvider(config.arkServer.url);
17831
17980
  const storage = {
17832
17981
  walletRepository: this.walletRepository,
17833
17982
  contractRepository: this.contractRepository,
17834
17983
  ...this.intentRepository && { intentRepository: this.intentRepository }
17835
17984
  };
17836
17985
  const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : void 0;
17837
- const indexerProvider = new chunk64R7CRKN_cjs.RestIndexerProvider(config.arkServer.url);
17986
+ const indexerProvider = new chunkWXNSISXK_cjs.RestIndexerProvider(config.arkServer.url);
17838
17987
  const serialized = normalizeSerializedIdentity(config.wallet);
17839
17988
  if (isSigningSerialized(serialized)) {
17840
17989
  const identity2 = hydrateIdentity(serialized);
@@ -17852,6 +18001,7 @@ var MessageBus = class {
17852
18001
  lazyInitialization: config.lazyInitialization,
17853
18002
  watcherConfig: config.watcherConfig,
17854
18003
  lookAheadWindow: config.lookAheadWindow,
18004
+ oneShotSubmit: config.oneShotSubmit,
17855
18005
  minBatchExpirySeconds: config.minBatchExpirySeconds
17856
18006
  });
17857
18007
  return { wallet, arkProvider, readonlyWallet: wallet };
@@ -18176,7 +18326,7 @@ var offboardNetworkNames = [
18176
18326
  function offboardDestinationScript(destinationAddress) {
18177
18327
  for (const networkName of offboardNetworkNames) {
18178
18328
  try {
18179
- const network = chunkGGKR4O5X_cjs.networks[networkName];
18329
+ const network = chunkGHUUT54D_cjs.networks[networkName];
18180
18330
  const addr = btcSigner.Address(network).decode(destinationAddress);
18181
18331
  return btcSigner.OutScript.encode(addr);
18182
18332
  } catch {
@@ -18216,7 +18366,7 @@ function filterOffboardInputs(vtxos, feeInfo, named) {
18216
18366
  const inputs = [];
18217
18367
  let subtotal = 0n;
18218
18368
  for (const vtxo of vtxos) {
18219
- const inputFee = estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(vtxo));
18369
+ const inputFee = estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(vtxo));
18220
18370
  if (inputFee.satoshis >= vtxo.value) {
18221
18371
  if (named) {
18222
18372
  throw new Error(
@@ -18313,7 +18463,7 @@ var Ramps = class {
18313
18463
  }
18314
18464
  amount = amount ?? totalAmount;
18315
18465
  const offchainAddress = await this.wallet.getAddress();
18316
- const offchainAddr = chunkGGKR4O5X_cjs.ArkAddress.decode(offchainAddress);
18466
+ const offchainAddr = chunkGHUUT54D_cjs.ArkAddress.decode(offchainAddress);
18317
18467
  const offchainScript = base.hex.encode(offchainAddr.pkScript);
18318
18468
  const outputFee = estimator.evalOffchainOutput({
18319
18469
  amount,
@@ -18463,7 +18613,7 @@ var Ramps = class {
18463
18613
  const ordered = [...candidates].sort(bySelectionOrder);
18464
18614
  let covered = 0n;
18465
18615
  for (let i = 0; i < ordered.length && i < MAX_VTXOS_PER_SETTLEMENT; i++) {
18466
- const fee = estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(ordered[i])).satoshis;
18616
+ const fee = estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(ordered[i])).satoshis;
18467
18617
  covered += BigInt(ordered[i].value) - BigInt(fee);
18468
18618
  if (covered < needed) continue;
18469
18619
  try {
@@ -18497,7 +18647,7 @@ var Ramps = class {
18497
18647
  async fundChange(left, estimator) {
18498
18648
  if (left <= 0n) return { change: 0n };
18499
18649
  const changeAddress = await this.wallet.getAddress();
18500
- const changeScript = base.hex.encode(chunkGGKR4O5X_cjs.ArkAddress.decode(changeAddress).pkScript);
18650
+ const changeScript = base.hex.encode(chunkGHUUT54D_cjs.ArkAddress.decode(changeAddress).pkScript);
18501
18651
  const { change } = changeAfterOutputFee(
18502
18652
  left,
18503
18653
  (amount) => BigInt(estimator.evalOffchainOutput({ amount, script: changeScript }).satoshis)
@@ -19440,7 +19590,7 @@ var WalletMessageHandler = class {
19440
19590
  this.lazyBoardingInit = payload.lazyBoarding ?? false;
19441
19591
  this.boardingEpoch++;
19442
19592
  this.boardingLoaded = false;
19443
- this.indexerProvider = new chunk64R7CRKN_cjs.RestIndexerProvider(arkServerUrl);
19593
+ this.indexerProvider = new chunkWXNSISXK_cjs.RestIndexerProvider(arkServerUrl);
19444
19594
  await this.onWalletInitialized();
19445
19595
  }
19446
19596
  /** @see RequestInitWallet.payload.lazyBoarding */
@@ -19909,7 +20059,7 @@ var WalletMessageHandler = class {
19909
20059
  this.readonlyWallet.getBoardingTxs()
19910
20060
  ]);
19911
20061
  const indexerProvider = this.indexerProvider;
19912
- const resolveTxCreatedAt = indexerProvider ? (txids) => chunkGGKR4O5X_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
20062
+ const resolveTxCreatedAt = indexerProvider ? (txids) => chunkGHUUT54D_cjs.fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
19913
20063
  return buildTransactionHistory(
19914
20064
  vtxos,
19915
20065
  boardingTxs,
@@ -19978,7 +20128,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
19978
20128
  // budget so the worker's snapshot fallback stays reachable before this
19979
20129
  // page deadline fires — lowering it below the budget would time the page
19980
20130
  // out while the worker is still seconds from answering from cache.
19981
- GET_ARKADE_INFO: chunkGGKR4O5X_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
20131
+ GET_ARKADE_INFO: chunkGHUUT54D_cjs.INFO_FETCH_TIMEOUT_MS + 8e3,
19982
20132
  INDEXER_GET_VTXOS: 2e4,
19983
20133
  INDEXER_GET_VIRTUAL_TXS: 2e4,
19984
20134
  GET_VTXOS: 2e4,
@@ -20123,7 +20273,7 @@ var ServiceWorkerAssetManager = class extends ServiceWorkerReadonlyAssetManager
20123
20273
  }
20124
20274
  };
20125
20275
  var initializeMessageBus = (serviceWorker, config, timeoutMs = 2e3) => {
20126
- chunkGGKR4O5X_cjs.assertTimerMs("messageBusTimeoutMs", timeoutMs);
20276
+ chunkGHUUT54D_cjs.assertTimerMs("messageBusTimeoutMs", timeoutMs);
20127
20277
  const initCmd = {
20128
20278
  tag: "INITIALIZE_MESSAGE_BUS",
20129
20279
  id: getRandomId(),
@@ -20211,7 +20361,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20211
20361
  }
20212
20362
  /** Shared tail of both `create()` factories: boot the bus, INIT_WALLET, cache for reinit. */
20213
20363
  static async bootstrap(wallet, options, serializedWallet, busConfig) {
20214
- const arkServer = options.arkServer ?? { url: chunkGGKR4O5X_cjs.DEFAULT_ARKADE_SERVER_URL };
20364
+ const arkServer = options.arkServer ?? { url: chunkGHUUT54D_cjs.DEFAULT_ARKADE_SERVER_URL };
20215
20365
  const initWalletPayload = {
20216
20366
  lazyBoarding: options.lazyBoarding,
20217
20367
  arkServerUrl: arkServer.url,
@@ -20221,7 +20371,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20221
20371
  Object.entries(options.messageTimeouts ?? {}).filter(([, ms]) => ms !== void 0)
20222
20372
  );
20223
20373
  for (const [key, value] of Object.entries(overrides)) {
20224
- chunkGGKR4O5X_cjs.assertTimerMs(`messageTimeouts.${key}`, value);
20374
+ chunkGHUUT54D_cjs.assertTimerMs(`messageTimeouts.${key}`, value);
20225
20375
  }
20226
20376
  const messageTimeouts = {
20227
20377
  ...DEFAULT_MESSAGE_TIMEOUTS,
@@ -20561,7 +20711,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20561
20711
  try {
20562
20712
  const response = await this.sendMessage(message);
20563
20713
  const { vtxos, page } = response.payload;
20564
- return { vtxos: vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo), page: page && { ...page } };
20714
+ return { vtxos: vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo), page: page && { ...page } };
20565
20715
  } catch (cause) {
20566
20716
  throw new Error(`Failed to get vtxos: ${cause}`, { cause });
20567
20717
  }
@@ -20670,7 +20820,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20670
20820
  };
20671
20821
  try {
20672
20822
  const response = await this.sendMessage(message);
20673
- return response.payload.vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo);
20823
+ return response.payload.vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo);
20674
20824
  } catch (error) {
20675
20825
  throw new Error(`Failed to get vtxos: ${error}`);
20676
20826
  }
@@ -20701,7 +20851,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20701
20851
  "Service worker does not support the requested contract scope or freshness check"
20702
20852
  );
20703
20853
  }
20704
- return payload.vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo);
20854
+ return payload.vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo);
20705
20855
  } catch (error) {
20706
20856
  throw new Error(`Failed to get spendable vtxos: ${error}`);
20707
20857
  }
@@ -20896,7 +21046,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
20896
21046
  };
20897
21047
  try {
20898
21048
  const response = await sendContractMessage(message);
20899
- return response.payload.vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo);
21049
+ return response.payload.vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo);
20900
21050
  } catch (cause) {
20901
21051
  throw new Error(`Failed to annotate vtxos: ${cause}`, { cause });
20902
21052
  }
@@ -21093,9 +21243,10 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
21093
21243
  }
21094
21244
  };
21095
21245
  var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
21096
- constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegate) {
21246
+ constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegate, oneShotSubmit) {
21097
21247
  super(serviceWorker, identity, walletRepository, contractRepository, messageTag);
21098
21248
  this.serviceWorker = serviceWorker;
21249
+ this.oneShotSubmit = oneShotSubmit;
21099
21250
  this.identity = identity;
21100
21251
  this.walletRepository = walletRepository;
21101
21252
  this.contractRepository = contractRepository;
@@ -21106,6 +21257,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
21106
21257
  this.hasDelegate = hasDelegate;
21107
21258
  }
21108
21259
  serviceWorker;
21260
+ oneShotSubmit;
21109
21261
  walletRepository;
21110
21262
  contractRepository;
21111
21263
  identity;
@@ -21142,7 +21294,8 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
21142
21294
  walletRepository,
21143
21295
  contractRepository,
21144
21296
  messageTag,
21145
- !!options.delegateUrl
21297
+ !!options.delegateUrl,
21298
+ options.oneShotSubmit
21146
21299
  );
21147
21300
  wallet._concurrentSpending = options.concurrentSpending === true;
21148
21301
  return _ServiceWorkerWallet.bootstrap(wallet, options, serializedWallet, {
@@ -21153,6 +21306,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
21153
21306
  lazyInitialization: options.lazyInitialization,
21154
21307
  watcherConfig: options.watcherConfig,
21155
21308
  lookAheadWindow: options.lookAheadWindow,
21309
+ oneShotSubmit: options.oneShotSubmit,
21156
21310
  minBatchExpirySeconds: options.minBatchExpirySeconds
21157
21311
  });
21158
21312
  }
@@ -21536,7 +21690,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
21536
21690
  };
21537
21691
  try {
21538
21692
  const response = await wallet.sendMessage(message);
21539
- return response.payload.vtxos.map(chunkGGKR4O5X_cjs.normalizeVtxo);
21693
+ return response.payload.vtxos.map(chunkGHUUT54D_cjs.normalizeVtxo);
21540
21694
  } catch (e) {
21541
21695
  throw new Error(`Failed to get expiring vtxos: ${e}`);
21542
21696
  }
@@ -21653,12 +21807,12 @@ var OnchainWallet = class _OnchainWallet {
21653
21807
  * @returns Configured onchain wallet
21654
21808
  * @throws Error if the configured identity cannot produce a valid x-only public key
21655
21809
  */
21656
- static async create(identity, networkName = chunkGGKR4O5X_cjs.DEFAULT_NETWORK_NAME, provider) {
21810
+ static async create(identity, networkName = chunkGHUUT54D_cjs.DEFAULT_NETWORK_NAME, provider) {
21657
21811
  const pubkey = await identity.xOnlyPublicKey();
21658
21812
  if (!pubkey) {
21659
21813
  throw new Error("Invalid configured public key");
21660
21814
  }
21661
- const network = chunkGGKR4O5X_cjs.getNetwork(networkName);
21815
+ const network = chunkGHUUT54D_cjs.getNetwork(networkName);
21662
21816
  const onchainProvider = provider || new EsploraProvider(ESPLORA_URL[networkName]);
21663
21817
  const onchainP2TR = btcSigner.p2tr(pubkey, void 0, network);
21664
21818
  return new _OnchainWallet(identity, network, onchainP2TR, onchainProvider);
@@ -21758,7 +21912,7 @@ var OnchainWallet = class _OnchainWallet {
21758
21912
  feeRate,
21759
21913
  params.address
21760
21914
  );
21761
- let tx = new chunkGGKR4O5X_cjs.Transaction();
21915
+ let tx = new chunkGHUUT54D_cjs.Transaction();
21762
21916
  for (const input of inputs) {
21763
21917
  tx.addInput({
21764
21918
  txid: input.txid,
@@ -21816,7 +21970,7 @@ var OnchainWallet = class _OnchainWallet {
21816
21970
  * @throws If the parent has no anchor, or funding cannot be selected/signed
21817
21971
  */
21818
21972
  async bumpAnchor(parentHex, feeRate) {
21819
- const parent = chunkGGKR4O5X_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
21973
+ const parent = chunkGHUUT54D_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
21820
21974
  const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
21821
21975
  const child = await this.buildBumpPackage(parent, feeRate, coins);
21822
21976
  return [parent.hex, child.hex];
@@ -22639,11 +22793,11 @@ function childTxidFromHex(txHex) {
22639
22793
 
22640
22794
  // src/providers/cachingArk.ts
22641
22795
  var DEFAULT_TTL_MS = 6e4;
22642
- var CachingArkProvider = class {
22796
+ var CachingOperatorProvider = class {
22643
22797
  constructor(inner, ttlMs = DEFAULT_TTL_MS) {
22644
22798
  this.inner = inner;
22645
22799
  this.ttlMs = ttlMs;
22646
- chunkGGKR4O5X_cjs.assertNonNegativeMs("ttlMs", ttlMs);
22800
+ chunkGHUUT54D_cjs.assertNonNegativeMs("ttlMs", ttlMs);
22647
22801
  this.unsubscribe = inner.onServerInfoChanged?.((info) => {
22648
22802
  this.cached = info;
22649
22803
  this.expiresAt = Date.now() + this.ttlMs;
@@ -22720,6 +22874,7 @@ var CachingArkProvider = class {
22720
22874
  });
22721
22875
  }
22722
22876
  };
22877
+ var CachingArkProvider = CachingOperatorProvider;
22723
22878
  var PrevTxUnavailableError = class extends Error {
22724
22879
  constructor(message, txids = []) {
22725
22880
  super(message);
@@ -22735,7 +22890,7 @@ async function resolvePrevTxs(txids, source, onchain) {
22735
22890
  try {
22736
22891
  const { txs } = await source.getVirtualTxs(wanted);
22737
22892
  for (const psbt of txs) {
22738
- const tx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
22893
+ const tx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(psbt));
22739
22894
  resolved.set(tx.id, tx.toBytes());
22740
22895
  }
22741
22896
  } catch (err) {
@@ -22768,7 +22923,7 @@ async function resolvePrevTxs(txids, source, onchain) {
22768
22923
  async function attachPrevArkTxs(tx, txids, source, onchain) {
22769
22924
  const pending = [];
22770
22925
  for (let i = 0; i < tx.inputsLength; i++) {
22771
- if (chunkGGKR4O5X_cjs.getArkPsbtFields(tx, i, chunkGGKR4O5X_cjs.PrevArkTxField).length === 0) pending.push(i);
22926
+ if (chunkGHUUT54D_cjs.getArkPsbtFields(tx, i, chunkGHUUT54D_cjs.PrevArkTxField).length === 0) pending.push(i);
22772
22927
  }
22773
22928
  if (pending.length === 0) return;
22774
22929
  const resolved = await resolvePrevTxs(
@@ -22777,13 +22932,13 @@ async function attachPrevArkTxs(tx, txids, source, onchain) {
22777
22932
  onchain
22778
22933
  );
22779
22934
  for (const i of pending) {
22780
- chunkGGKR4O5X_cjs.setArkPsbtField(tx, i, chunkGGKR4O5X_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
22935
+ chunkGHUUT54D_cjs.setArkPsbtField(tx, i, chunkGHUUT54D_cjs.PrevArkTxField, resolved.get(txidAt(txids, i)));
22781
22936
  }
22782
22937
  }
22783
22938
  async function attachPrevoutTxs(tx, source) {
22784
22939
  const pending = [];
22785
22940
  for (let i = 0; i < tx.inputsLength; i++) {
22786
- if (chunkGGKR4O5X_cjs.getArkPsbtFields(tx, i, chunkGGKR4O5X_cjs.PrevoutTxField).length > 0) continue;
22941
+ if (chunkGHUUT54D_cjs.getArkPsbtFields(tx, i, chunkGHUUT54D_cjs.PrevoutTxField).length > 0) continue;
22787
22942
  const input = tx.getInput(i);
22788
22943
  if (!input?.txid) throw new PrevTxUnavailableError(`input ${i} has no outpoint`);
22789
22944
  pending.push({ index: i, txid: base.hex.encode(input.txid) });
@@ -22798,7 +22953,7 @@ async function attachPrevoutTxs(tx, source) {
22798
22953
  resolved.set(txids[i], result.value);
22799
22954
  }
22800
22955
  for (const { index, txid } of pending) {
22801
- chunkGGKR4O5X_cjs.setArkPsbtField(tx, index, chunkGGKR4O5X_cjs.PrevoutTxField, resolved.get(txid));
22956
+ chunkGHUUT54D_cjs.setArkPsbtField(tx, index, chunkGHUUT54D_cjs.PrevoutTxField, resolved.get(txid));
22802
22957
  }
22803
22958
  }
22804
22959
  async function withPrevTxs(coins, source, onchain) {
@@ -22824,7 +22979,7 @@ exports.BIP322 = void 0;
22824
22979
  async function sign2(message, identity, network) {
22825
22980
  const xOnlyPubKey = await identity.xOnlyPublicKey();
22826
22981
  const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
22827
- const toSpend = chunkGGKR4O5X_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
22982
+ const toSpend = chunkGHUUT54D_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
22828
22983
  const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
22829
22984
  const signed = await identity.sign(toSign, [0]);
22830
22985
  signed.finalizeIdx(0);
@@ -22882,7 +23037,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
22882
23037
  if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
22883
23038
  return false;
22884
23039
  }
22885
- const toSpend = chunkGGKR4O5X_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
23040
+ const toSpend = chunkGHUUT54D_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
22886
23041
  const toSign = craftBIP322ToSignP2TR(toSpend, pkScript);
22887
23042
  const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
22888
23043
  const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
@@ -22903,7 +23058,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
22903
23058
  }
22904
23059
  const sighashType = sigWithHash[sigWithHash.length - 1];
22905
23060
  const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
22906
- const toSpend = chunkGGKR4O5X_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
23061
+ const toSpend = chunkGHUUT54D_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
22907
23062
  const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
22908
23063
  const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
22909
23064
  const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
@@ -22956,7 +23111,7 @@ function encodeCompactSize(n) {
22956
23111
  return buf;
22957
23112
  }
22958
23113
  function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
22959
- const tx = new chunkGGKR4O5X_cjs.Transaction({ version: 0 });
23114
+ const tx = new chunkGHUUT54D_cjs.Transaction({ version: 0 });
22960
23115
  tx.addInput({
22961
23116
  txid: toSpend.id,
22962
23117
  index: 0,
@@ -22970,12 +23125,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
22970
23125
  });
22971
23126
  tx.addOutput({
22972
23127
  amount: 0n,
22973
- script: chunkGGKR4O5X_cjs.OP_RETURN_EMPTY_PKSCRIPT
23128
+ script: chunkGHUUT54D_cjs.OP_RETURN_EMPTY_PKSCRIPT
22974
23129
  });
22975
23130
  return tx;
22976
23131
  }
22977
23132
  function craftBIP322ToSignSimple(toSpend, pkScript) {
22978
- const tx = new chunkGGKR4O5X_cjs.Transaction({ version: 0 });
23133
+ const tx = new chunkGHUUT54D_cjs.Transaction({ version: 0 });
22979
23134
  tx.addInput({
22980
23135
  txid: toSpend.id,
22981
23136
  index: 0,
@@ -22987,12 +23142,12 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
22987
23142
  });
22988
23143
  tx.addOutput({
22989
23144
  amount: 0n,
22990
- script: chunkGGKR4O5X_cjs.OP_RETURN_EMPTY_PKSCRIPT
23145
+ script: chunkGHUUT54D_cjs.OP_RETURN_EMPTY_PKSCRIPT
22991
23146
  });
22992
23147
  return tx;
22993
23148
  }
22994
23149
  function finalizeVirtualTx(type, psbtBase64) {
22995
- const tx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
23150
+ const tx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
22996
23151
  if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
22997
23152
  const input = tx.getInput(0);
22998
23153
  if (!input) {
@@ -23019,14 +23174,14 @@ var ExitPathError = class extends Error {
23019
23174
  reason;
23020
23175
  };
23021
23176
  function delayWeight(sequence) {
23022
- const t = chunkGGKR4O5X_cjs.sequenceToTimelock(sequence);
23177
+ const t = chunkGHUUT54D_cjs.sequenceToTimelock(sequence);
23023
23178
  return t.type === "blocks" ? Number(t.value) : Number(t.value) / 600;
23024
23179
  }
23025
23180
  async function resolveUnilateralPath(params) {
23026
23181
  const { vtxo, scriptHex, contractRepository } = params;
23027
23182
  const contract = contractRepository ? (await collectContracts(contractRepository, { script: scriptHex }))[0] : void 0;
23028
23183
  if (contract) {
23029
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
23184
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
23030
23185
  if (!handler) {
23031
23186
  throw new ExitPathError(
23032
23187
  "no-handler",
@@ -23048,12 +23203,12 @@ async function resolveUnilateralPath(params) {
23048
23203
  paths.sort((a, b) => delayWeight(a.sequence) - delayWeight(b.sequence));
23049
23204
  return { selection: paths[0], label: `${contract.type}:unilateral` };
23050
23205
  }
23051
- const decoded = chunkGGKR4O5X_cjs.VtxoScript.decode(vtxo.tapTree);
23206
+ const decoded = chunkGHUUT54D_cjs.VtxoScript.decode(vtxo.tapTree);
23052
23207
  let best;
23053
23208
  for (const exit of decoded.exitPaths()) {
23054
23209
  const leaf = decoded.findLeaf(base.hex.encode(exit.script));
23055
23210
  if (!leaf) continue;
23056
- const sequence = chunkGGKR4O5X_cjs.timelockToSequence(exit.params.timelock);
23211
+ const sequence = chunkGHUUT54D_cjs.timelockToSequence(exit.params.timelock);
23057
23212
  const weight = delayWeight(sequence);
23058
23213
  if (!best || weight < best.weight) {
23059
23214
  best = { selection: { leaf, sequence }, weight };
@@ -23262,7 +23417,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23262
23417
  let totalAmount = 0n;
23263
23418
  const txWeightEstimator = TxWeightEstimator.create();
23264
23419
  for (const vtxo of vtxos) {
23265
- if (!chunkGGKR4O5X_cjs.canSweepOnchain(vtxo)) {
23420
+ if (!chunkGHUUT54D_cjs.canSweepOnchain(vtxo)) {
23266
23421
  throw new Error(
23267
23422
  `Vtxo ${vtxo.txid}:${vtxo.vout} cannot be swept onchain: it is not fully unrolled (use unroll first), or its exit output was already spent`
23268
23423
  );
@@ -23274,7 +23429,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23274
23429
  wallet.onchainProvider.getTxStatus(vtxo.txid),
23275
23430
  resolveUnilateralPath({
23276
23431
  vtxo,
23277
- scriptHex: base.hex.encode(chunkGGKR4O5X_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23432
+ scriptHex: base.hex.encode(chunkGHUUT54D_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23278
23433
  contractRepository: wallet.contractRepository,
23279
23434
  walletDescriptor,
23280
23435
  currentTime: Date.now()
@@ -23285,7 +23440,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23285
23440
  }
23286
23441
  const spendingLeaf = resolved.selection.leaf;
23287
23442
  const sequence = resolved.selection.sequence;
23288
- const timelock = chunkGGKR4O5X_cjs.sequenceToTimelock(sequence);
23443
+ const timelock = chunkGHUUT54D_cjs.sequenceToTimelock(sequence);
23289
23444
  const elapsed = timelock.type === "blocks" ? chainTip.height >= txStatus.blockHeight + Number(timelock.value) : chainTip.time >= txStatus.blockTime + Number(timelock.value);
23290
23445
  if (!elapsed) {
23291
23446
  throw new Error(`no available exit path found for vtxo ${vtxo.txid}:${vtxo.vout}`);
@@ -23304,7 +23459,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23304
23459
  sequence,
23305
23460
  witnessUtxo: {
23306
23461
  amount: BigInt(vtxo.value),
23307
- script: chunkGGKR4O5X_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
23462
+ script: chunkGHUUT54D_cjs.VtxoScript.decode(vtxo.tapTree).pkScript
23308
23463
  },
23309
23464
  sighashType: btcSigner.SigHash.DEFAULT
23310
23465
  });
@@ -23314,7 +23469,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
23314
23469
  btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
23315
23470
  );
23316
23471
  }
23317
- const tx = new chunkGGKR4O5X_cjs.Transaction({ version: 2 });
23472
+ const tx = new chunkGHUUT54D_cjs.Transaction({ version: 2 });
23318
23473
  for (const input of inputs) {
23319
23474
  tx.addInput(input);
23320
23475
  }
@@ -23397,7 +23552,7 @@ async function buildSignedSweep(params) {
23397
23552
  `uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
23398
23553
  );
23399
23554
  }
23400
- const tx = new chunkGGKR4O5X_cjs.Transaction({ version: 2 });
23555
+ const tx = new chunkGHUUT54D_cjs.Transaction({ version: 2 });
23401
23556
  tx.addInput({
23402
23557
  txid: vtxo.txid,
23403
23558
  index: vtxo.vout,
@@ -23422,7 +23577,7 @@ async function buildSignedSweep(params) {
23422
23577
  finalScriptWitness: [
23423
23578
  tapScriptSig[0][1],
23424
23579
  ...path.extraWitness,
23425
- chunkGGKR4O5X_cjs.scriptFromTapLeafScript(path.leaf),
23580
+ chunkGHUUT54D_cjs.scriptFromTapLeafScript(path.leaf),
23426
23581
  btcSigner.TaprootControlBlock.encode(controlBlock)
23427
23582
  ]
23428
23583
  });
@@ -23452,7 +23607,7 @@ async function resolveFeeRate(opts) {
23452
23607
  }
23453
23608
  async function selectExitVtxos(opts) {
23454
23609
  if (!opts.vtxos) return opts.wallet.getVtxos();
23455
- const res = await chunkGGKR4O5X_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
23610
+ const res = await chunkGHUUT54D_cjs.getNormalizedVtxos(opts.wallet.indexerProvider, { outpoints: opts.vtxos });
23456
23611
  const scripts = [
23457
23612
  ...new Set(res.vtxos.filter((vtxo) => !vtxo.isSpent).map((vtxo) => vtxo.script))
23458
23613
  ];
@@ -23470,7 +23625,7 @@ async function selectExitVtxos(opts) {
23470
23625
  `no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
23471
23626
  );
23472
23627
  }
23473
- const handler = chunkOM6FJ76H_cjs.contractHandlers.get(contract.type);
23628
+ const handler = chunkE6OOJEHL_cjs.contractHandlers.get(contract.type);
23474
23629
  if (!handler) {
23475
23630
  throw new Error(`no contract handler registered for type '${contract.type}'`);
23476
23631
  }
@@ -23504,7 +23659,7 @@ async function computeExitLayout(opts, feeRate) {
23504
23659
  if (pendingNodes.length > 0) {
23505
23660
  const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
23506
23661
  for (const psbt of txs) {
23507
- psbts.set(chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
23662
+ psbts.set(chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
23508
23663
  }
23509
23664
  }
23510
23665
  const childVsize = Number(
@@ -23532,7 +23687,7 @@ async function computeExitLayout(opts, feeRate) {
23532
23687
  vtxo,
23533
23688
  resolved: await resolveUnilateralPath({
23534
23689
  vtxo,
23535
- scriptHex: base.hex.encode(chunkGGKR4O5X_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23690
+ scriptHex: base.hex.encode(chunkGHUUT54D_cjs.VtxoScript.decode(vtxo.tapTree).pkScript),
23536
23691
  contractRepository: wallet.contractRepository,
23537
23692
  walletDescriptor,
23538
23693
  currentTime: Date.now()
@@ -23569,7 +23724,7 @@ async function computeExitLayout(opts, feeRate) {
23569
23724
  });
23570
23725
  continue;
23571
23726
  }
23572
- const t = chunkGGKR4O5X_cjs.sequenceToTimelock(resolved.selection.sequence);
23727
+ const t = chunkGHUUT54D_cjs.sequenceToTimelock(resolved.selection.sequence);
23573
23728
  const delay = { type: t.type, value: Number(t.value) };
23574
23729
  infos.push({ outpoint, value: vtxo.value, sweepFee, path: resolved.label, delay });
23575
23730
  sweeps.push({ vtxo, resolved, sweepFee, delay });
@@ -23669,7 +23824,7 @@ var Executor = class {
23669
23824
  constructor(pkg, provider, opts) {
23670
23825
  this.pkg = pkg;
23671
23826
  this.provider = provider;
23672
- chunkGGKR4O5X_cjs.assertTimerMs("pollIntervalMs", opts?.pollIntervalMs);
23827
+ chunkGHUUT54D_cjs.assertTimerMs("pollIntervalMs", opts?.pollIntervalMs);
23673
23828
  this.pollIntervalMs = opts?.pollIntervalMs ?? 5e3;
23674
23829
  this.feeWallet = opts?.feeWallet;
23675
23830
  this.signal = opts?.signal;
@@ -23964,7 +24119,7 @@ async function prepare(opts) {
23964
24119
  txid: sweep.vtxo.txid,
23965
24120
  vout: sweep.vtxo.vout,
23966
24121
  value: sweep.vtxo.value,
23967
- pkScript: chunkGGKR4O5X_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
24122
+ pkScript: chunkGHUUT54D_cjs.VtxoScript.decode(sweep.vtxo.tapTree).pkScript
23968
24123
  },
23969
24124
  path: sweep.resolved.selection,
23970
24125
  outputAddress: opts.sweepAddress,
@@ -24053,7 +24208,7 @@ async function prepare(opts) {
24053
24208
  if (newFee <= splitterFee) break;
24054
24209
  splitterFee = newFee;
24055
24210
  }
24056
- const splitter = new chunkGGKR4O5X_cjs.Transaction({ version: 2 });
24211
+ const splitter = new chunkGHUUT54D_cjs.Transaction({ version: 2 });
24057
24212
  for (const coin of selected.inputs) {
24058
24213
  splitter.addInput({
24059
24214
  txid: coin.txid,
@@ -24192,46 +24347,46 @@ var UnilateralExit = {
24192
24347
 
24193
24348
  // src/arkade/index.ts
24194
24349
  var arkade_exports = {};
24195
- chunkGGKR4O5X_cjs.__export(arkade_exports, {
24196
- ARKADE_OP: () => chunkOM6FJ76H_cjs.ARKADE_OP,
24197
- ARKADE_OPCODES: () => chunkOM6FJ76H_cjs.ARKADE_OPCODES,
24198
- ARKADE_OPCODE_NAMES: () => chunkOM6FJ76H_cjs.ARKADE_OPCODE_NAMES,
24199
- ARKADE_OPCODE_VALUES: () => chunkOM6FJ76H_cjs.ARKADE_OPCODE_VALUES,
24200
- ARKADE_OPS: () => chunkOM6FJ76H_cjs.ARKADE_OPS,
24350
+ chunkGHUUT54D_cjs.__export(arkade_exports, {
24351
+ ARKADE_OP: () => chunkE6OOJEHL_cjs.ARKADE_OP,
24352
+ ARKADE_OPCODES: () => chunkE6OOJEHL_cjs.ARKADE_OPCODES,
24353
+ ARKADE_OPCODE_NAMES: () => chunkE6OOJEHL_cjs.ARKADE_OPCODE_NAMES,
24354
+ ARKADE_OPCODE_VALUES: () => chunkE6OOJEHL_cjs.ARKADE_OPCODE_VALUES,
24355
+ ARKADE_OPS: () => chunkE6OOJEHL_cjs.ARKADE_OPS,
24201
24356
  Arkade: () => Arkade,
24202
24357
  ArkadeContract: () => ArkadeContract,
24203
- ArkadeProgramScript: () => chunkOM6FJ76H_cjs.ArkadeProgramScript,
24204
- ArkadeScript: () => chunkOM6FJ76H_cjs.ArkadeScript,
24358
+ ArkadeProgramScript: () => chunkE6OOJEHL_cjs.ArkadeProgramScript,
24359
+ ArkadeScript: () => chunkE6OOJEHL_cjs.ArkadeScript,
24205
24360
  ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
24206
- BigNum: () => chunkOM6FJ76H_cjs.bignum_exports,
24361
+ BigNum: () => chunkE6OOJEHL_cjs.bignum_exports,
24207
24362
  OP: () => btcSigner.OP,
24208
- OPCODE_NAMES: () => chunkOM6FJ76H_cjs.OPCODE_NAMES,
24209
- OPCODE_VALUES: () => chunkOM6FJ76H_cjs.OPCODE_VALUES,
24210
- SUPPORTED_PROGRAM_VERSION: () => chunkOM6FJ76H_cjs.SUPPORTED_PROGRAM_VERSION,
24363
+ OPCODE_NAMES: () => chunkE6OOJEHL_cjs.OPCODE_NAMES,
24364
+ OPCODE_VALUES: () => chunkE6OOJEHL_cjs.OPCODE_VALUES,
24365
+ SUPPORTED_PROGRAM_VERSION: () => chunkE6OOJEHL_cjs.SUPPORTED_PROGRAM_VERSION,
24211
24366
  Script: () => btcSigner.Script,
24212
- UnsupportedProgramVersionError: () => chunkOM6FJ76H_cjs.UnsupportedProgramVersionError,
24213
- arkadeScriptHash: () => chunkOM6FJ76H_cjs.arkadeScriptHash,
24214
- arkadeWitnessHash: () => chunkOM6FJ76H_cjs.arkadeWitnessHash,
24215
- asmToBytes: () => chunkOM6FJ76H_cjs.asmToBytes,
24216
- bytesToASM: () => chunkOM6FJ76H_cjs.bytesToASM,
24217
- computeArkadeScriptPublicKey: () => chunkOM6FJ76H_cjs.computeArkadeScriptPublicKey,
24367
+ UnsupportedProgramVersionError: () => chunkE6OOJEHL_cjs.UnsupportedProgramVersionError,
24368
+ arkadeScriptHash: () => chunkE6OOJEHL_cjs.arkadeScriptHash,
24369
+ arkadeWitnessHash: () => chunkE6OOJEHL_cjs.arkadeWitnessHash,
24370
+ asmToBytes: () => chunkE6OOJEHL_cjs.asmToBytes,
24371
+ bytesToASM: () => chunkE6OOJEHL_cjs.bytesToASM,
24372
+ computeArkadeScriptPublicKey: () => chunkE6OOJEHL_cjs.computeArkadeScriptPublicKey,
24218
24373
  createArkadeBatchHandler: () => createArkadeBatchHandler,
24219
- deserializeArkadeContractParams: () => chunkOM6FJ76H_cjs.deserializeArkadeContractParams,
24220
- fromASM: () => chunkOM6FJ76H_cjs.fromASM,
24221
- getOpcodeName: () => chunkOM6FJ76H_cjs.getOpcodeName,
24222
- getOpcodeValue: () => chunkOM6FJ76H_cjs.getOpcodeValue,
24374
+ deserializeArkadeContractParams: () => chunkE6OOJEHL_cjs.deserializeArkadeContractParams,
24375
+ fromASM: () => chunkE6OOJEHL_cjs.fromASM,
24376
+ getOpcodeName: () => chunkE6OOJEHL_cjs.getOpcodeName,
24377
+ getOpcodeValue: () => chunkE6OOJEHL_cjs.getOpcodeValue,
24223
24378
  isContractArtifact: () => isContractArtifact,
24224
- parseArtifact: () => chunkOM6FJ76H_cjs.parseArtifact,
24379
+ parseArtifact: () => chunkE6OOJEHL_cjs.parseArtifact,
24225
24380
  programFromArtifact: () => programFromArtifact,
24226
24381
  resolveArkadeService: () => resolveArkadeService,
24227
- resolveAsm: () => chunkOM6FJ76H_cjs.resolveAsm,
24228
- serializeArkadeContractParams: () => chunkOM6FJ76H_cjs.serializeArkadeContractParams,
24229
- stringifyArtifact: () => chunkOM6FJ76H_cjs.stringifyArtifact,
24230
- toASM: () => chunkOM6FJ76H_cjs.toASM,
24231
- validateProgram: () => chunkOM6FJ76H_cjs.validateProgram,
24232
- witnessRefToBytes: () => chunkOM6FJ76H_cjs.witnessRefToBytes
24382
+ resolveAsm: () => chunkE6OOJEHL_cjs.resolveAsm,
24383
+ serializeArkadeContractParams: () => chunkE6OOJEHL_cjs.serializeArkadeContractParams,
24384
+ stringifyArtifact: () => chunkE6OOJEHL_cjs.stringifyArtifact,
24385
+ toASM: () => chunkE6OOJEHL_cjs.toASM,
24386
+ validateProgram: () => chunkE6OOJEHL_cjs.validateProgram,
24387
+ witnessRefToBytes: () => chunkE6OOJEHL_cjs.witnessRefToBytes
24233
24388
  });
24234
- var isVtxoCoin = (input) => chunkGGKR4O5X_cjs.isVirtualCoin(input);
24389
+ var isVtxoCoin = (input) => chunkGHUUT54D_cjs.isVirtualCoin(input);
24235
24390
  function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
24236
24391
  let batchId;
24237
24392
  let sweepTapTreeRoot;
@@ -24252,23 +24407,23 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24252
24407
  );
24253
24408
  await arkProvider.confirmRegistration(intentId);
24254
24409
  batchId = event.id;
24255
- const sweepTapscript = chunkGGKR4O5X_cjs.CSVMultisigTapscript.encode({
24410
+ const sweepTapscript = chunkGHUUT54D_cjs.CSVMultisigTapscript.encode({
24256
24411
  timelock,
24257
- pubkeys: [chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
24412
+ pubkeys: [chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(info.forfeitPubkey), "forfeit key")]
24258
24413
  }).script;
24259
24414
  sweepTapTreeRoot = payment_js.tapLeafHash(sweepTapscript);
24260
24415
  return { skip: false };
24261
24416
  },
24262
24417
  onTreeSigningStarted: async (event, vtxoTree) => {
24263
24418
  const signerPubKey = await session.getPublicKey();
24264
- const xonlySignerPubKey = chunkOM6FJ76H_cjs.toXOnly(signerPubKey, "signer key");
24419
+ const xonlySignerPubKey = chunkE6OOJEHL_cjs.toXOnly(signerPubKey, "signer key");
24265
24420
  const xOnlyPubkeys = event.cosignersPublicKeys.map(
24266
- (k) => base.hex.encode(chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
24421
+ (k) => base.hex.encode(chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(k), "cosigner key"))
24267
24422
  );
24268
24423
  if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
24269
24424
  return { skip: true };
24270
24425
  }
24271
- const commitmentTx = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
24426
+ const commitmentTx = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
24272
24427
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
24273
24428
  if (recipients && recipients.length > 0) {
24274
24429
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
@@ -24306,7 +24461,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24306
24461
  if (connectorTree) {
24307
24462
  validateConnectorsTxGraph(event.commitmentTx, connectorTree);
24308
24463
  }
24309
- let commitmentPsbt = chunkGGKR4O5X_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
24464
+ let commitmentPsbt = chunkGHUUT54D_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
24310
24465
  assertFinalCommitmentMatchesValidated(
24311
24466
  commitmentPsbt,
24312
24467
  validatedCommitmentTxid,
@@ -24348,7 +24503,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24348
24503
  boardingIndices.push(boardingIdx);
24349
24504
  continue;
24350
24505
  }
24351
- if (!chunkGGKR4O5X_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
24506
+ if (!chunkGHUUT54D_cjs.requiresForfeit(input) || isSubdust(input, info.dust)) {
24352
24507
  continue;
24353
24508
  }
24354
24509
  if (connectorIndex >= connectorLeaves.length) {
@@ -24369,7 +24524,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
24369
24524
  index: input.vout,
24370
24525
  witnessUtxo: {
24371
24526
  amount: BigInt(input.value),
24372
- script: chunkGGKR4O5X_cjs.VtxoScript.decode(input.tapTree).pkScript
24527
+ script: chunkGHUUT54D_cjs.VtxoScript.decode(input.tapTree).pkScript
24373
24528
  },
24374
24529
  sighashType: btcSigner.SigHash.DEFAULT,
24375
24530
  tapLeafScript: [input.forfeitTapLeafScript]
@@ -24480,7 +24635,7 @@ function inputDef(name, type) {
24480
24635
  return { name, type: argType(type) };
24481
24636
  }
24482
24637
  function argType(arkType) {
24483
- if (!Object.hasOwn(chunkOM6FJ76H_cjs.ARKADE_TYPE_ENCODINGS, arkType)) fail(`unknown type '${arkType}'`);
24638
+ if (!Object.hasOwn(chunkE6OOJEHL_cjs.ARKADE_TYPE_ENCODINGS, arkType)) fail(`unknown type '${arkType}'`);
24484
24639
  return arkType;
24485
24640
  }
24486
24641
  function arrayParts(type) {
@@ -24521,7 +24676,7 @@ function flatten(param, structs, stack = []) {
24521
24676
  function opcodeToken(token) {
24522
24677
  const base = token.slice(3);
24523
24678
  const name = base === "0" || /^([1-9]|1[0-6])$/.test(base) ? token : base;
24524
- if (!Object.hasOwn(chunkOM6FJ76H_cjs.ARKADE_OPS, name)) {
24679
+ if (!Object.hasOwn(chunkE6OOJEHL_cjs.ARKADE_OPS, name)) {
24525
24680
  fail(`opcode '${token}' is not in this SDK's table`);
24526
24681
  }
24527
24682
  return name;
@@ -24568,7 +24723,7 @@ function providedWitness(witness) {
24568
24723
  fail(`witness '${item.name}': injected must be boolean`);
24569
24724
  if (item.injected && item.type !== "signature")
24570
24725
  fail(`witness '${item.name}': only infrastructure signatures can be injected`);
24571
- if (item.encoding !== void 0 && item.encoding !== chunkOM6FJ76H_cjs.ARKADE_TYPE_ENCODINGS[type])
24726
+ if (item.encoding !== void 0 && item.encoding !== chunkE6OOJEHL_cjs.ARKADE_TYPE_ENCODINGS[type])
24572
24727
  fail(
24573
24728
  `witness '${item.name}': encoding '${item.encoding}' does not match type '${item.type}'`
24574
24729
  );
@@ -24577,7 +24732,7 @@ function providedWitness(witness) {
24577
24732
  }
24578
24733
  function csvTimelock(leafName, operand) {
24579
24734
  if (typeof operand === "string") return { type: "sequence", value: operand };
24580
- const timelock = chunkGGKR4O5X_cjs.sequenceToCanonicalTimelock(operand);
24735
+ const timelock = chunkGHUUT54D_cjs.sequenceToCanonicalTimelock(operand);
24581
24736
  if (!timelock) {
24582
24737
  fail(`leaf '${leafName}': CSV literal ${operand} is not a canonical BIP68 sequence`);
24583
24738
  }
@@ -24671,7 +24826,7 @@ function programFromArtifact(artifact) {
24671
24826
  if (!isNamed(field)) fail(`struct '${struct.name}': field needs a name and type`);
24672
24827
  claim(fields, field.name, "struct field");
24673
24828
  }
24674
- if (Object.hasOwn(chunkOM6FJ76H_cjs.ARKADE_TYPE_ENCODINGS, struct.name) || Object.hasOwn(NATIVE_STRUCTS, struct.name)) {
24829
+ if (Object.hasOwn(chunkE6OOJEHL_cjs.ARKADE_TYPE_ENCODINGS, struct.name) || Object.hasOwn(NATIVE_STRUCTS, struct.name)) {
24675
24830
  fail(`struct name '${struct.name}' shadows a built-in type`);
24676
24831
  }
24677
24832
  claim(structNames, struct.name, "struct");
@@ -24754,7 +24909,7 @@ function programFromArtifact(artifact) {
24754
24909
  const paramNames = /* @__PURE__ */ new Set();
24755
24910
  for (const param of params) claim(paramNames, param.name, "program parameter");
24756
24911
  return {
24757
- version: chunkOM6FJ76H_cjs.SUPPORTED_PROGRAM_VERSION,
24912
+ version: chunkE6OOJEHL_cjs.SUPPORTED_PROGRAM_VERSION,
24758
24913
  name: artifact.contractName,
24759
24914
  params,
24760
24915
  functions
@@ -24782,6 +24937,7 @@ var Arkade = class _Arkade {
24782
24937
  userKey;
24783
24938
  /** The contract manager, when contract persistence is wired up (passed in or owned). */
24784
24939
  contractManager;
24940
+ oneShotSubmit;
24785
24941
  /** Whether {@link connect} built {@link contractManager}, so {@link dispose} must stop it. */
24786
24942
  ownsContractManager;
24787
24943
  /** {@link ArkadeContract.on} handles by contract script (hex). */
@@ -24801,6 +24957,7 @@ var Arkade = class _Arkade {
24801
24957
  this.identity = fields.identity;
24802
24958
  this.userKey = fields.userKey;
24803
24959
  this.contractManager = fields.contractManager;
24960
+ this.oneShotSubmit = fields.oneShotSubmit;
24804
24961
  this.ownsContractManager = fields.ownsContractManager ?? false;
24805
24962
  }
24806
24963
  /**
@@ -24836,16 +24993,16 @@ var Arkade = class _Arkade {
24836
24993
  indexer = opts.indexer;
24837
24994
  info = await opts.arkade.getInfo();
24838
24995
  }
24839
- const serverKey = chunkOM6FJ76H_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
24840
- const checkpoint = chunkGGKR4O5X_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
24841
- const network = opts.network ?? (Object.hasOwn(chunkGGKR4O5X_cjs.networks, info.network) ? chunkGGKR4O5X_cjs.getNetwork(info.network) : chunkGGKR4O5X_cjs.DEFAULT_NETWORK);
24996
+ const serverKey = chunkE6OOJEHL_cjs.toXOnly(base.hex.decode(info.signerPubkey), "ark signer key");
24997
+ const checkpoint = chunkGHUUT54D_cjs.CSVMultisigTapscript.decode(base.hex.decode(info.checkpointTapscript));
24998
+ const network = opts.network ?? (Object.hasOwn(chunkGHUUT54D_cjs.networks, info.network) ? chunkGHUUT54D_cjs.getNetwork(info.network) : chunkGHUUT54D_cjs.DEFAULT_NETWORK);
24842
24999
  let emulatorKey;
24843
25000
  if (emulator) {
24844
- emulatorKey = base.hex.decode(chunkGGKR4O5X_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
25001
+ emulatorKey = base.hex.decode(chunkGHUUT54D_cjs.resolveEmulatorPubkey(network, opts.emulatorPubkey));
24845
25002
  }
24846
25003
  let userKey;
24847
25004
  if (opts.identity) {
24848
- userKey = chunkOM6FJ76H_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
25005
+ userKey = chunkE6OOJEHL_cjs.toXOnly(await opts.identity.xOnlyPublicKey(), "identity key");
24849
25006
  }
24850
25007
  let contractManager = opts.contractManager;
24851
25008
  let ownsContractManager = false;
@@ -24877,7 +25034,8 @@ var Arkade = class _Arkade {
24877
25034
  identity: opts.identity,
24878
25035
  userKey,
24879
25036
  contractManager,
24880
- ownsContractManager
25037
+ ownsContractManager,
25038
+ oneShotSubmit: opts.oneShotSubmit
24881
25039
  });
24882
25040
  }
24883
25041
  /**
@@ -24943,6 +25101,7 @@ var Arkade = class _Arkade {
24943
25101
  *
24944
25102
  * Declared `server`/`user` params default to the client's keys. Compiler
24945
25103
  * artifacts reserve the server key and exit delay to the connected server.
25104
+ * Struct and array params are passed whole by name (see {@link ArkadeNestedValue}).
24946
25105
  */
24947
25106
  contract(program, args = {}) {
24948
25107
  const declared = (program.params ?? []).map((p) => p.name);
@@ -24964,7 +25123,7 @@ var Arkade = class _Arkade {
24964
25123
  `compiler artifact: server exit delay ${delay}s must be a multiple of 512 seconds`
24965
25124
  );
24966
25125
  }
24967
- const sequence = BigInt(chunkGGKR4O5X_cjs.timelockToSequence(typed));
25126
+ const sequence = BigInt(chunkGHUUT54D_cjs.timelockToSequence(typed));
24968
25127
  if (args.SERVER_EXIT_DELAY !== void 0 && args.SERVER_EXIT_DELAY !== sequence && args.SERVER_EXIT_DELAY !== Number(sequence)) {
24969
25128
  throw new Error(
24970
25129
  "compiler artifact: reserved SERVER_EXIT_DELAY must match the connected server"
@@ -24986,19 +25145,19 @@ var ArkadeContract = class _ArkadeContract {
24986
25145
  constructor(client, program, args = {}, keys) {
24987
25146
  this.client = client;
24988
25147
  this.program = program;
24989
- this.args = args;
25148
+ this.args = /* @__PURE__ */ Object.create(null);
25149
+ for (const [name, value] of Object.entries(args)) flattenValue(name, value, this.args);
24990
25150
  this.keys = keys ?? {
24991
25151
  serverKey: client.serverKey,
24992
25152
  userKey: client.userKey,
24993
25153
  emulatorKey: client.emulatorKey
24994
25154
  };
24995
- this.vtxoScript = new chunkOM6FJ76H_cjs.ArkadeProgramScript(program, args, this.keys);
25155
+ this.vtxoScript = new chunkE6OOJEHL_cjs.ArkadeProgramScript(program, this.args, this.keys);
24996
25156
  this.tapTree = this.vtxoScript.encode();
24997
25157
  this.compiled = this.vtxoScript.compiled;
24998
25158
  }
24999
25159
  client;
25000
25160
  program;
25001
- args;
25002
25161
  /** The compiled taproot tree of spending-path leaves. */
25003
25162
  vtxoScript;
25004
25163
  /** Encoded taproot tree (shared spend context for every path). */
@@ -25007,6 +25166,8 @@ var ArkadeContract = class _ArkadeContract {
25007
25166
  keys;
25008
25167
  /** Spending paths in declaration order. */
25009
25168
  compiled;
25169
+ /** Constructor bindings by flattened name (`owners.0.key`), as persisted. */
25170
+ args;
25010
25171
  /**
25011
25172
  * Rebuild a callable contract from a persisted `"arkade"` row. Compiles with the stored keys,
25012
25173
  * not the client's current ones, so script and address survive a server signer rotation.
@@ -25017,7 +25178,7 @@ var ArkadeContract = class _ArkadeContract {
25017
25178
  `ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
25018
25179
  );
25019
25180
  }
25020
- const typed = chunkOM6FJ76H_cjs.deserializeArkadeContractParams(contract.params);
25181
+ const typed = chunkE6OOJEHL_cjs.deserializeArkadeContractParams(contract.params);
25021
25182
  return new _ArkadeContract(client, typed.program, typed.args, {
25022
25183
  serverKey: typed.serverKey,
25023
25184
  userKey: typed.userKey,
@@ -25069,7 +25230,7 @@ var ArkadeContract = class _ArkadeContract {
25069
25230
  toContractParams() {
25070
25231
  return {
25071
25232
  type: "arkade",
25072
- params: chunkOM6FJ76H_cjs.serializeArkadeContractParams({
25233
+ params: chunkE6OOJEHL_cjs.serializeArkadeContractParams({
25073
25234
  program: this.program,
25074
25235
  args: this.args,
25075
25236
  serverKey: this.keys.serverKey,
@@ -25156,17 +25317,17 @@ var ArkadeContract = class _ArkadeContract {
25156
25317
  const [registered] = await manager.getContracts({ script: scriptHex });
25157
25318
  if (registered) {
25158
25319
  const [withVtxos] = await manager.getContractsWithVtxos({ script: scriptHex });
25159
- return (withVtxos?.vtxos ?? []).filter((v) => !chunkGGKR4O5X_cjs.isVtxoSpent(v) && !v.isUnrolled);
25320
+ return (withVtxos?.vtxos ?? []).filter((v) => !chunkGHUUT54D_cjs.isVtxoSpent(v) && !v.isUnrolled);
25160
25321
  }
25161
25322
  }
25162
25323
  if (!this.client.indexer) {
25163
25324
  throw new Error("ArkadeContract.getUtxos: an indexer is required");
25164
25325
  }
25165
- const { vtxos } = await chunkGGKR4O5X_cjs.getNormalizedVtxos(this.client.indexer, {
25326
+ const { vtxos } = await chunkGHUUT54D_cjs.getNormalizedVtxos(this.client.indexer, {
25166
25327
  scripts: [scriptHex],
25167
25328
  spendableOnly: true
25168
25329
  });
25169
- return vtxos.filter((v) => !chunkGGKR4O5X_cjs.isVtxoSpent(v) && !v.isUnrolled);
25330
+ return vtxos.filter((v) => !chunkGHUUT54D_cjs.isVtxoSpent(v) && !v.isUnrolled);
25170
25331
  }
25171
25332
  /** Total spendable balance (requires an indexer). */
25172
25333
  async getBalance() {
@@ -25326,7 +25487,7 @@ var ArkadeTransactionBuilder = class {
25326
25487
  this.client.checkpoint
25327
25488
  );
25328
25489
  inputs.forEach(({ coin }, i) => {
25329
- if (coin.sourceTx) chunkGGKR4O5X_cjs.setArkPsbtField(arkTx, i, chunkGGKR4O5X_cjs.PrevArkTxField, coin.sourceTx);
25490
+ if (coin.sourceTx) chunkGHUUT54D_cjs.setArkPsbtField(arkTx, i, chunkGHUUT54D_cjs.PrevArkTxField, coin.sourceTx);
25330
25491
  });
25331
25492
  if (inputs.some(({ unlocker }) => unlocker.fn.arkadeScript)) {
25332
25493
  const indexer = this.client.indexer;
@@ -25346,8 +25507,8 @@ var ArkadeTransactionBuilder = class {
25346
25507
  (w) => witnessBytes(unlocker, w)
25347
25508
  );
25348
25509
  if (condition.length === 0) return;
25349
- chunkGGKR4O5X_cjs.setArkPsbtField(arkTx, i, chunkGGKR4O5X_cjs.ConditionWitness, condition);
25350
- chunkGGKR4O5X_cjs.setArkPsbtField(checkpoints[i], 0, chunkGGKR4O5X_cjs.ConditionWitness, condition);
25510
+ chunkGHUUT54D_cjs.setArkPsbtField(arkTx, i, chunkGHUUT54D_cjs.ConditionWitness, condition);
25511
+ chunkGHUUT54D_cjs.setArkPsbtField(checkpoints[i], 0, chunkGHUUT54D_cjs.ConditionWitness, condition);
25351
25512
  });
25352
25513
  const packets = [];
25353
25514
  if (this.assetSpecs.length > 0) {
@@ -25414,7 +25575,8 @@ var ArkadeTransactionBuilder = class {
25414
25575
  inputIndexes: userInputs
25415
25576
  });
25416
25577
  }
25417
- if (!client.identity) {
25578
+ const identity = client.identity;
25579
+ if (!identity) {
25418
25580
  throw new Error("a signing identity is required for non-covenant spends");
25419
25581
  }
25420
25582
  const ark = client.arkProvider;
@@ -25423,26 +25585,19 @@ var ArkadeTransactionBuilder = class {
25423
25585
  "broadcasting requires an `arkade` provider with `submitTx`/`finalizeTx` on the Arkade client"
25424
25586
  );
25425
25587
  }
25426
- const signedArk = await this.signArk(arkTx, userInputs);
25427
- const res = await ark.submitTx(
25428
- base.base64.encode(signedArk.toPSBT()),
25429
- checkpoints.map((c) => base.base64.encode(c.toPSBT()))
25430
- );
25431
- assertSubmittedArkTxid(res, signedArk, "submitTx");
25432
- const matched = matchServerCheckpoints(res.signedCheckpointTxs, checkpoints, "submitTx");
25433
- const finalCps = await Promise.all(
25434
- matched.map(async ({ server, local }) => {
25435
- const signed = await client.identity.sign(server, [0]);
25436
- const [condition] = chunkGGKR4O5X_cjs.getArkPsbtFields(local, 0, chunkGGKR4O5X_cjs.ConditionWitness);
25437
- if (condition && chunkGGKR4O5X_cjs.getArkPsbtFields(signed, 0, chunkGGKR4O5X_cjs.ConditionWitness).length === 0) {
25438
- chunkGGKR4O5X_cjs.setArkPsbtField(signed, 0, chunkGGKR4O5X_cjs.ConditionWitness, condition);
25439
- }
25440
- return base.base64.encode(signed.toPSBT());
25441
- })
25588
+ const res = await submitOffchainTx(
25589
+ ark,
25590
+ { arkTx, checkpoints },
25591
+ {
25592
+ signArkTx: async (tx) => ({ arkTx: await this.signArk(tx, userInputs) }),
25593
+ signCheckpoint: (checkpoint) => identity.sign(checkpoint, [0])
25594
+ },
25595
+ void 0,
25596
+ { oneShot: client.oneShotSubmit }
25442
25597
  );
25443
- await ark.finalizeTx(res.arkTxid, finalCps);
25444
25598
  return {
25445
25599
  txid: res.arkTxid,
25600
+ // Required by ArkadeBroadcaster; RestOperatorProvider.submitTx rejects a response without it.
25446
25601
  signedArkTx: res.finalArkTx,
25447
25602
  signedCheckpointTxs: res.signedCheckpointTxs
25448
25603
  };
@@ -25486,20 +25641,20 @@ var ArkadeTransactionBuilder = class {
25486
25641
  * A caller's packet counts for every input, unread; arkd checks what it actually routes.
25487
25642
  */
25488
25643
  routesAssetsFrom(vin) {
25489
- return this.extraPackets.some((p) => p.type() === chunk64R7CRKN_cjs.Packet.PACKET_TYPE) || this.assetSpecs.some((spec) => spec.inputs.some((i) => i.vin === vin));
25644
+ return this.extraPackets.some((p) => p.type() === chunkWXNSISXK_cjs.Packet.PACKET_TYPE) || this.assetSpecs.some((spec) => spec.inputs.some((i) => i.vin === vin));
25490
25645
  }
25491
25646
  buildAssetPacket() {
25492
25647
  const groups = this.assetSpecs.map((s) => {
25493
- const id = typeof s.assetId === "string" ? chunk64R7CRKN_cjs.AssetId.fromString(s.assetId) : chunk64R7CRKN_cjs.AssetId.fromBytes(s.assetId);
25494
- return chunk64R7CRKN_cjs.AssetGroup.create(
25648
+ const id = typeof s.assetId === "string" ? chunkWXNSISXK_cjs.AssetId.fromString(s.assetId) : chunkWXNSISXK_cjs.AssetId.fromBytes(s.assetId);
25649
+ return chunkWXNSISXK_cjs.AssetGroup.create(
25495
25650
  id,
25496
25651
  null,
25497
- s.inputs.map((i) => chunk64R7CRKN_cjs.AssetInput.create(i.vin, i.amount)),
25498
- s.outputs.map((o) => chunk64R7CRKN_cjs.AssetOutput.create(o.vout, o.amount)),
25499
- (s.metadata ?? []).map((m) => chunk64R7CRKN_cjs.Metadata.create(m.key, m.value))
25652
+ s.inputs.map((i) => chunkWXNSISXK_cjs.AssetInput.create(i.vin, i.amount)),
25653
+ s.outputs.map((o) => chunkWXNSISXK_cjs.AssetOutput.create(o.vout, o.amount)),
25654
+ (s.metadata ?? []).map((m) => chunkWXNSISXK_cjs.Metadata.create(m.key, m.value))
25500
25655
  );
25501
25656
  });
25502
- return chunk64R7CRKN_cjs.Packet.create(groups);
25657
+ return chunkWXNSISXK_cjs.Packet.create(groups);
25503
25658
  }
25504
25659
  };
25505
25660
  function unspendable(coin, now) {
@@ -25508,22 +25663,62 @@ function unspendable(coin, now) {
25508
25663
  return void 0;
25509
25664
  }
25510
25665
  function witnessBytes({ contract, args }, ref) {
25511
- return chunkOM6FJ76H_cjs.witnessRefToBytes(ref, args, contract.args);
25666
+ return chunkE6OOJEHL_cjs.witnessRefToBytes(ref, args, contract.args);
25667
+ }
25668
+ function flattenValue(name, value, out, ancestors = /* @__PURE__ */ new Set()) {
25669
+ if (typeof value !== "object" || value === null || ArrayBuffer.isView(value)) {
25670
+ if (Object.hasOwn(out, name)) throw new Error(`duplicate argument '${name}'`);
25671
+ out[name] = value;
25672
+ return;
25673
+ }
25674
+ if (ancestors.has(value)) throw new Error(`argument '${name}' must not be cyclic`);
25675
+ if (Array.isArray(value)) {
25676
+ for (let i = 0; i < value.length; i++) {
25677
+ if (!Object.hasOwn(value, i))
25678
+ throw new Error(`argument '${name}.${i}' is a sparse array element`);
25679
+ }
25680
+ }
25681
+ const entries = Object.entries(value);
25682
+ if (entries.length === 0) {
25683
+ const proto = Object.getPrototypeOf(value);
25684
+ if (proto !== Object.prototype && proto !== Array.prototype && proto !== null)
25685
+ throw new Error(`argument '${name}' must be bytes, a number, a struct or an array`);
25686
+ throw new Error(`argument '${name}' must not be an empty struct or array`);
25687
+ }
25688
+ ancestors.add(value);
25689
+ for (const [key, item] of entries) flattenValue(`${name}.${key}`, item, out, ancestors);
25690
+ ancestors.delete(value);
25512
25691
  }
25513
25692
  function bindInputs(fn, callArgs) {
25514
25693
  const inputs = fn.def.inputs ?? [];
25515
- if (callArgs.length !== inputs.length) {
25694
+ const declared = /* @__PURE__ */ new Set();
25695
+ for (const def of inputs) {
25696
+ if (declared.has(def.name)) throw new Error(`${fn.name}: duplicate input '${def.name}'`);
25697
+ declared.add(def.name);
25698
+ }
25699
+ const params = [
25700
+ ...new Map(
25701
+ inputs.map(({ name }) => {
25702
+ const root = name.split(".")[0];
25703
+ return [name.includes(".") ? `${root}.` : root, root];
25704
+ })
25705
+ ).values()
25706
+ ];
25707
+ if (callArgs.length !== params.length) {
25516
25708
  throw new Error(
25517
- `${fn.name}: expected ${inputs.length} argument(s), got ${callArgs.length}`
25709
+ `${fn.name}: expected ${params.length} argument(s), got ${callArgs.length}`
25518
25710
  );
25519
25711
  }
25520
25712
  const bound = /* @__PURE__ */ Object.create(null);
25521
- inputs.forEach((def, i) => {
25522
- if (Object.hasOwn(bound, def.name))
25523
- throw new Error(`${fn.name}: duplicate input '${def.name}'`);
25524
- chunkOM6FJ76H_cjs.validateParamValue(def, callArgs[i]);
25525
- bound[def.name] = callArgs[i];
25526
- });
25713
+ params.forEach((param, i) => flattenValue(param, callArgs[i], bound));
25714
+ for (const name of Object.keys(bound)) {
25715
+ if (!declared.has(name)) throw new Error(`${fn.name}: unexpected input '${name}'`);
25716
+ }
25717
+ for (const def of inputs) {
25718
+ if (bound[def.name] === void 0)
25719
+ throw new Error(`${fn.name}: missing input '${def.name}'`);
25720
+ chunkE6OOJEHL_cjs.validateParamValue(def, bound[def.name]);
25721
+ }
25527
25722
  return bound;
25528
25723
  }
25529
25724
  function attachExtension(tx, newPackets) {
@@ -25932,17 +26127,17 @@ var walletFeeSource = (wallet) => async () => (await wallet.arkProvider.getInfo(
25932
26127
  function offchainInputFees(vtxos, fees) {
25933
26128
  const estimator = new Estimator(fees?.intentFee ?? {});
25934
26129
  return vtxos.reduce(
25935
- (total, vtxo) => total + estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
26130
+ (total, vtxo) => total + estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(vtxo)).satoshis,
25936
26131
  0
25937
26132
  );
25938
26133
  }
25939
26134
  async function changeOutputFee(wallet, inputs, needed, fees) {
25940
26135
  const estimator = new Estimator(fees?.intentFee ?? {});
25941
26136
  const net = inputs.reduce(
25942
- (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkGGKR4O5X_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
26137
+ (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(chunkGHUUT54D_cjs.toOffchainInputFeeParams(vtxo)).satoshis),
25943
26138
  0n
25944
26139
  );
25945
- const script = base.hex.encode(chunkGGKR4O5X_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
26140
+ const script = base.hex.encode(chunkGHUUT54D_cjs.ArkAddress.decode(await wallet.getAddress()).pkScript);
25946
26141
  return changeAfterOutputFee(
25947
26142
  net - needed,
25948
26143
  (amount) => BigInt(estimator.evalOffchainOutput({ amount, script }).satoshis)
@@ -26025,6 +26220,7 @@ exports.BIP21 = BIP21;
26025
26220
  exports.BIP21Error = BIP21Error;
26026
26221
  exports.BLOCKED_UPGRADE_TIMEOUT_MS = BLOCKED_UPGRADE_TIMEOUT_MS;
26027
26222
  exports.CachingArkProvider = CachingArkProvider;
26223
+ exports.CachingOperatorProvider = CachingOperatorProvider;
26028
26224
  exports.ChainedTxType = ChainedTxType;
26029
26225
  exports.ConnectionDisposedError = ConnectionDisposedError;
26030
26226
  exports.ContractManager = ContractManager;
@@ -26088,6 +26284,7 @@ exports.ServiceWorkerTimeoutError = ServiceWorkerTimeoutError;
26088
26284
  exports.ServiceWorkerWallet = ServiceWorkerWallet;
26089
26285
  exports.SingleKey = SingleKey;
26090
26286
  exports.StaticDescriptorProvider = StaticDescriptorProvider;
26287
+ exports.TreeSignerSession = TreeSignerSession;
26091
26288
  exports.TxTree = TxTree;
26092
26289
  exports.TxType = TxType;
26093
26290
  exports.TxWeightEstimator = TxWeightEstimator;
@@ -26103,6 +26300,7 @@ exports.WalletMessageHandler = WalletMessageHandler;
26103
26300
  exports.WalletNotInitializedError = WalletNotInitializedError;
26104
26301
  exports.WsElectrumChainSource = WsElectrumChainSource;
26105
26302
  exports.adoptContractDescriptor = adoptContractDescriptor;
26303
+ exports.applyWalletStateUpdate = applyWalletStateUpdate;
26106
26304
  exports.arkAssetRail = arkAssetRail;
26107
26305
  exports.arkRail = arkRail;
26108
26306
  exports.arkTarget = arkTarget;
@@ -26167,7 +26365,7 @@ exports.deserializeVtxo = deserializeVtxo;
26167
26365
  exports.encodeArkContract = encodeArkContract;
26168
26366
  exports.exitObserverFor = exitObserverFor;
26169
26367
  exports.extendVirtualCoinForContract = extendVirtualCoinForContract;
26170
- exports.extractArkProviderUrl = extractArkProviderUrl;
26368
+ exports.extractOperatorProviderUrl = extractOperatorProviderUrl;
26171
26369
  exports.gateExclusion = gateExclusion;
26172
26370
  exports.gatedContracts = gatedContracts;
26173
26371
  exports.getAllByIndexValues = getAllByIndexValues;
@@ -26245,5 +26443,5 @@ exports.waitForIncomingFunds = waitForIncomingFunds;
26245
26443
  exports.walletFeeSource = walletFeeSource;
26246
26444
  exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
26247
26445
  exports.withPrevTxs = withPrevTxs;
26248
- //# sourceMappingURL=chunk-2OCYL6BJ.cjs.map
26249
- //# sourceMappingURL=chunk-2OCYL6BJ.cjs.map
26446
+ //# sourceMappingURL=chunk-F3FAE7VJ.cjs.map
26447
+ //# sourceMappingURL=chunk-F3FAE7VJ.cjs.map