@arkade-os/sdk 0.4.74 → 0.4.75

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 (75) hide show
  1. package/dist/adapters/expo.cjs +5 -5
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/adapters/indexedDB.cjs +5 -5
  6. package/dist/adapters/indexedDB.js +4 -4
  7. package/dist/{asyncStorageTaskQueue-D1AwLuqn.d.cts → asyncStorageTaskQueue-5k0H_cDM.d.cts} +2 -2
  8. package/dist/{asyncStorageTaskQueue-aCaOBGTS.d.ts → asyncStorageTaskQueue-DjwCbb07.d.ts} +2 -2
  9. package/dist/{chunk-QS6AZE4F.cjs → chunk-2Q2PYU3Y.cjs} +10 -10
  10. package/dist/{chunk-QS6AZE4F.cjs.map → chunk-2Q2PYU3Y.cjs.map} +1 -1
  11. package/dist/{chunk-J3XVGWMP.js → chunk-2ULUCL6A.js} +4 -4
  12. package/dist/{chunk-J3XVGWMP.js.map → chunk-2ULUCL6A.js.map} +1 -1
  13. package/dist/{chunk-LGB65ZCO.js → chunk-4GLSOP6L.js} +12 -5
  14. package/dist/chunk-4GLSOP6L.js.map +1 -0
  15. package/dist/{chunk-WIHSU3YS.cjs → chunk-EHJYR4E5.cjs} +741 -578
  16. package/dist/chunk-EHJYR4E5.cjs.map +1 -0
  17. package/dist/{chunk-ZTGTQP2W.js → chunk-FTLPTF3R.js} +306 -144
  18. package/dist/chunk-FTLPTF3R.js.map +1 -0
  19. package/dist/{chunk-KMPNH7NS.cjs → chunk-J5EX3OMM.cjs} +3 -3
  20. package/dist/{chunk-KMPNH7NS.cjs.map → chunk-J5EX3OMM.cjs.map} +1 -1
  21. package/dist/{chunk-X5BPARRD.js → chunk-PS564TAU.js} +3 -3
  22. package/dist/{chunk-X5BPARRD.js.map → chunk-PS564TAU.js.map} +1 -1
  23. package/dist/{chunk-AS3W34MG.cjs → chunk-SH23SRZE.cjs} +17 -17
  24. package/dist/{chunk-AS3W34MG.cjs.map → chunk-SH23SRZE.cjs.map} +1 -1
  25. package/dist/{chunk-KPLQN4M4.js → chunk-SKAL4MCW.js} +4 -4
  26. package/dist/{chunk-KPLQN4M4.js.map → chunk-SKAL4MCW.js.map} +1 -1
  27. package/dist/{chunk-WJVOFYTQ.js → chunk-UKFA7NVE.js} +3 -3
  28. package/dist/{chunk-WJVOFYTQ.js.map → chunk-UKFA7NVE.js.map} +1 -1
  29. package/dist/{chunk-J4ZR4VEM.cjs → chunk-YA3L3WL4.cjs} +17 -17
  30. package/dist/{chunk-J4ZR4VEM.cjs.map → chunk-YA3L3WL4.cjs.map} +1 -1
  31. package/dist/{chunk-DXLVCFVK.cjs → chunk-YYWEBYFJ.cjs} +58 -51
  32. package/dist/chunk-YYWEBYFJ.cjs.map +1 -0
  33. package/dist/contracts/handlers/index.cjs +9 -9
  34. package/dist/contracts/handlers/index.d.cts +3 -3
  35. package/dist/contracts/handlers/index.d.ts +3 -3
  36. package/dist/contracts/handlers/index.js +2 -2
  37. package/dist/{delegate-6N0DKdnG.d.cts → delegate-D0v8yT-a.d.cts} +1 -1
  38. package/dist/{delegate-z6veQfLI.d.ts → delegate-D_sW61rj.d.ts} +1 -1
  39. package/dist/{hdWalletCapable-Bncp-eF0.d.ts → hdWalletCapable-66hG5KQP.d.cts} +3 -11
  40. package/dist/{hdWalletCapable-DJT8E8sN.d.cts → hdWalletCapable-DHCNbAgl.d.ts} +3 -11
  41. package/dist/{index-BVqlZJwW.d.cts → index-B2JSxDi1.d.cts} +2 -2
  42. package/dist/{index-Bxz3cKPA.d.ts → index-TZBbMNqA.d.cts} +9 -0
  43. package/dist/{index-Bxz3cKPA.d.cts → index-TZBbMNqA.d.ts} +9 -0
  44. package/dist/{index-CKQQ1oOg.d.ts → index-vUeTpifq.d.ts} +2 -2
  45. package/dist/index.cjs +306 -302
  46. package/dist/index.d.cts +51 -14
  47. package/dist/index.d.ts +51 -14
  48. package/dist/index.js +4 -4
  49. package/dist/repositories/realm/index.cjs +19 -19
  50. package/dist/repositories/realm/index.d.cts +2 -2
  51. package/dist/repositories/realm/index.d.ts +2 -2
  52. package/dist/repositories/realm/index.js +5 -5
  53. package/dist/repositories/sqlite/index.cjs +18 -18
  54. package/dist/repositories/sqlite/index.d.cts +2 -2
  55. package/dist/repositories/sqlite/index.d.ts +2 -2
  56. package/dist/repositories/sqlite/index.js +5 -5
  57. package/dist/{taskRunner-C26IIg1F.d.cts → taskRunner-CAAPpdyi.d.cts} +2 -2
  58. package/dist/{taskRunner-KxtIKYLv.d.ts → taskRunner-CairkunF.d.ts} +2 -2
  59. package/dist/wallet/expo/background.cjs +14 -14
  60. package/dist/wallet/expo/background.d.cts +3 -3
  61. package/dist/wallet/expo/background.d.ts +3 -3
  62. package/dist/wallet/expo/background.js +6 -6
  63. package/dist/wallet/expo/index.cjs +14 -14
  64. package/dist/wallet/expo/index.d.cts +4 -4
  65. package/dist/wallet/expo/index.d.ts +4 -4
  66. package/dist/wallet/expo/index.js +5 -5
  67. package/dist/worker/expo/index.cjs +9 -9
  68. package/dist/worker/expo/index.d.cts +4 -4
  69. package/dist/worker/expo/index.d.ts +4 -4
  70. package/dist/worker/expo/index.js +5 -5
  71. package/package.json +1 -1
  72. package/dist/chunk-DXLVCFVK.cjs.map +0 -1
  73. package/dist/chunk-LGB65ZCO.js.map +0 -1
  74. package/dist/chunk-WIHSU3YS.cjs.map +0 -1
  75. package/dist/chunk-ZTGTQP2W.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-X5BPARRD.js';
2
- import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, toXOnly, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, parseHDDescriptor, identityDescriptor, DefaultVtxo, speculativeReceiveMetadata, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler } from './chunk-LGB65ZCO.js';
3
- import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, resolveEmulatorPubkey, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, assertAllowedSighashTypes, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, formatSighash, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, getAllNormalizedVtxos, isPastExpiry, isRetryableProviderError, DEFAULT_PAGE_SIZE, RestArkProvider, toVirtualStatus, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, parseLegacyExpiry, isExpired, PrevoutTxField, fetchVtxoCreatedAtByTxid, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError, networks as networks$1 } from './chunk-WJVOFYTQ.js';
1
+ import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-PS564TAU.js';
2
+ import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, toXOnly, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, parseHDDescriptor, identityDescriptor, DefaultVtxo, speculativeReceiveMetadata, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler } from './chunk-4GLSOP6L.js';
3
+ import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, networks, getNetwork, DEFAULT_NETWORK, resolveEmulatorPubkey, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, assertAllowedSighashTypes, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, formatSighash, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, getAllNormalizedVtxos, isPastExpiry, isRetryableProviderError, DEFAULT_PAGE_SIZE, RestArkProvider, toVirtualStatus, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, parseLegacyExpiry, isExpired, PrevoutTxField, fetchVtxoCreatedAtByTxid, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError } from './chunk-UKFA7NVE.js';
4
4
  import { __export } from './chunk-NSBPE2FW.js';
5
5
  import { sha256 as sha256$1, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
6
6
  import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
@@ -13,7 +13,7 @@ import { Script as Script$1 } from '@scure/btc-signer/script.js';
13
13
  import { Transaction as Transaction$1, SigHash as SigHash$1 } from '@scure/btc-signer/transaction.js';
14
14
  import { mnemonicToSeedSync, validateMnemonic } from '@scure/bip39';
15
15
  import { wordlist } from '@scure/bip39/wordlists/english.js';
16
- import { networks, scriptExpressions, HDKey, expand } from '@bitcoinerlab/descriptors-scure';
16
+ import { networks as networks$1, scriptExpressions, HDKey, expand } from '@bitcoinerlab/descriptors-scure';
17
17
  import { tapLeafHash } from '@scure/btc-signer/payment.js';
18
18
  import { Environment } from '@marcbachmann/cel-js';
19
19
 
@@ -410,9 +410,9 @@ var SeedIdentity = class _SeedIdentity {
410
410
  let network;
411
411
  if ("descriptor" in opts && typeof opts.descriptor === "string") {
412
412
  descriptor = opts.descriptor;
413
- network = isMainnetDescriptor(descriptor) ? networks.bitcoin : networks.testnet;
413
+ network = isMainnetDescriptor(descriptor) ? networks$1.bitcoin : networks$1.testnet;
414
414
  } else {
415
- network = opts.isMainnet ?? true ? networks.bitcoin : networks.testnet;
415
+ network = opts.isMainnet ?? true ? networks$1.bitcoin : networks$1.testnet;
416
416
  descriptor = scriptExpressions.trBIP32({
417
417
  masterNode: HDKey.fromMasterSeed(seed, network.bip32),
418
418
  network,
@@ -557,7 +557,7 @@ var SeedIdentity = class _SeedIdentity {
557
557
  }
558
558
  // ── internal helpers ─────────────────────────────────────────────
559
559
  derivePrivateKeyForDescriptor(descriptor) {
560
- const network = isMainnetDescriptor(descriptor) ? networks.bitcoin : networks.testnet;
560
+ const network = isMainnetDescriptor(descriptor) ? networks$1.bitcoin : networks$1.testnet;
561
561
  const expansion = expand({ descriptor, network });
562
562
  if (expansion.isRanged) {
563
563
  throw new Error(
@@ -644,7 +644,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
644
644
  */
645
645
  descriptor;
646
646
  constructor(descriptor) {
647
- const network = isMainnetDescriptor(descriptor) ? networks.bitcoin : networks.testnet;
647
+ const network = isMainnetDescriptor(descriptor) ? networks$1.bitcoin : networks$1.testnet;
648
648
  let expansion;
649
649
  try {
650
650
  expansion = expand({ descriptor, network, index: 0 });
@@ -8687,15 +8687,74 @@ async function getVtxosForContract(repo, contract) {
8687
8687
  const vtxos = repo.getVtxosForScript ? await repo.getVtxosForScript(contract.script) : filterVtxosForScript(await repo.getVtxos(contract.address), contract.script);
8688
8688
  return vtxos.map(normalizeVtxo);
8689
8689
  }
8690
- async function saveVtxosForContract(repo, contract, vtxos) {
8691
- if (repo.saveVtxosForScript) {
8692
- return repo.saveVtxosForScript(
8693
- { script: contract.script, address: contract.address },
8694
- vtxos
8695
- );
8690
+ function hasRecordedSpend(vtxo) {
8691
+ return vtxo.isSpent === true && (!!vtxo.spentBy || !!vtxo.arkTxId || !!vtxo.settledBy);
8692
+ }
8693
+ var RECORDED_SPEND_TTL_MS = 6e4;
8694
+ var recordedSpends = /* @__PURE__ */ new WeakMap();
8695
+ function registryFor(repo) {
8696
+ const existing = recordedSpends.get(repo);
8697
+ if (existing) return existing;
8698
+ const created = /* @__PURE__ */ new Map();
8699
+ recordedSpends.set(repo, created);
8700
+ return created;
8701
+ }
8702
+ var writeChains = /* @__PURE__ */ new WeakMap();
8703
+ function inVtxoWriteOrder(repo, fn) {
8704
+ const prev = writeChains.get(repo) ?? Promise.resolve();
8705
+ const run = prev.then(fn, fn);
8706
+ writeChains.set(
8707
+ repo,
8708
+ run.catch(() => {
8709
+ })
8710
+ );
8711
+ return run;
8712
+ }
8713
+ function applyRecordedSpends(repo, vtxos) {
8714
+ const registry = registryFor(repo);
8715
+ const now = Date.now();
8716
+ for (const [key, spend] of registry) {
8717
+ if (now - spend.at >= RECORDED_SPEND_TTL_MS) registry.delete(key);
8718
+ }
8719
+ for (const incoming of vtxos) {
8720
+ const key = vtxoOutpoint(incoming);
8721
+ if (!hasRecordedSpend(incoming) || registry.has(key)) continue;
8722
+ registry.set(key, {
8723
+ at: now,
8724
+ spentBy: incoming.spentBy,
8725
+ arkTxId: incoming.arkTxId,
8726
+ settledBy: incoming.settledBy
8727
+ });
8696
8728
  }
8697
- validateVtxosForScript(vtxos, contract.script, "saveVtxosForContract");
8698
- return repo.saveVtxos(contract.address, vtxos);
8729
+ if (registry.size === 0) return vtxos;
8730
+ return vtxos.map((incoming) => {
8731
+ if (hasRecordedSpend(incoming)) return incoming;
8732
+ const spent = registry.get(vtxoOutpoint(incoming));
8733
+ if (!spent) return incoming;
8734
+ const spentBy = incoming.spentBy || spent.spentBy;
8735
+ const arkTxId = incoming.arkTxId || spent.arkTxId;
8736
+ const settledBy = incoming.settledBy || spent.settledBy;
8737
+ return {
8738
+ ...incoming,
8739
+ isSpent: true,
8740
+ ...spentBy ? { spentBy } : {},
8741
+ ...arkTxId ? { arkTxId } : {},
8742
+ ...settledBy ? { settledBy } : {}
8743
+ };
8744
+ });
8745
+ }
8746
+ async function saveVtxosForContract(repo, contract, vtxos) {
8747
+ return inVtxoWriteOrder(repo, async () => {
8748
+ const rows = applyRecordedSpends(repo, vtxos);
8749
+ if (repo.saveVtxosForScript) {
8750
+ return repo.saveVtxosForScript(
8751
+ { script: contract.script, address: contract.address },
8752
+ rows
8753
+ );
8754
+ }
8755
+ validateVtxosForScript(rows, contract.script, "saveVtxosForContract");
8756
+ return repo.saveVtxos(contract.address, rows);
8757
+ });
8699
8758
  }
8700
8759
 
8701
8760
  // src/repositories/inMemory/walletRepository.ts
@@ -9788,7 +9847,21 @@ var ContractManager = class _ContractManager {
9788
9847
  }
9789
9848
  markSyncOnline() {
9790
9849
  this.lastSyncedAt = Date.now();
9791
- this.syncDegradedReason = this.annotationDegradedReason();
9850
+ this.syncDegradedReason = this.syncGapReason();
9851
+ }
9852
+ /**
9853
+ * Why a sync that just succeeded still has not covered everything it should
9854
+ * have. Both reasons outlive the sync that failed to cover them, so neither
9855
+ * is discharged by the next one succeeding — which is the point: a wallet
9856
+ * that reported itself current while the look-ahead band sat behind the
9857
+ * watermark, or while a contract could not be annotated, would be claiming
9858
+ * coverage it never had. `getSyncState()` is the channel apps already watch.
9859
+ */
9860
+ syncGapReason() {
9861
+ const annotations = this.annotationDegradedReason();
9862
+ const owedRefill = this.lookAheadRefillOwed ? "the look-ahead band is behind the allocation watermark, so a funded address inside it is not being watched yet" : void 0;
9863
+ const reasons = [annotations, owedRefill].filter((r) => r !== void 0);
9864
+ return reasons.length === 0 ? void 0 : reasons.join("; ");
9792
9865
  }
9793
9866
  /** Contracts a sync could not annotate, as `script → reason`. */
9794
9867
  annotationFailures = /* @__PURE__ */ new Map();
@@ -9822,7 +9895,13 @@ var ContractManager = class _ContractManager {
9822
9895
  for (const contract of contracts) {
9823
9896
  await this.watcher.addContract(contract);
9824
9897
  }
9825
- await this.scheduleLookAheadDrain();
9898
+ try {
9899
+ await this.scheduleLookAheadDrain();
9900
+ } catch (err) {
9901
+ if (!isRetryableProviderError(err)) throw err;
9902
+ this.lookAheadRefillOwed = true;
9903
+ this.markSyncDegraded(err);
9904
+ }
9826
9905
  try {
9827
9906
  await this.reconcileWatched();
9828
9907
  this.markSyncOnline();
@@ -10746,7 +10825,13 @@ var ContractManager = class _ContractManager {
10746
10825
  if (contract) {
10747
10826
  await saveVtxosForContract(this.config.walletRepository, contract, addressVtxos);
10748
10827
  } else {
10749
- await this.config.walletRepository.saveVtxos(address, addressVtxos);
10828
+ await inVtxoWriteOrder(
10829
+ this.config.walletRepository,
10830
+ async () => this.config.walletRepository.saveVtxos(
10831
+ address,
10832
+ applyRecordedSpends(this.config.walletRepository, addressVtxos)
10833
+ )
10834
+ );
10750
10835
  }
10751
10836
  }
10752
10837
  }
@@ -11974,7 +12059,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11974
12059
  */
11975
12060
  materializeDescriptorAt(index) {
11976
12061
  const descriptor = this.identity.descriptor;
11977
- const network = isMainnetDescriptor(descriptor) ? networks.bitcoin : networks.testnet;
12062
+ const network = isMainnetDescriptor(descriptor) ? networks$1.bitcoin : networks$1.testnet;
11978
12063
  const expansion = expand({ descriptor, network, index });
11979
12064
  const keyInfo = expansion.expansionMap?.["@0"];
11980
12065
  if (!keyInfo?.keyExpression) {
@@ -12525,8 +12610,9 @@ var InputSignerRouter = class {
12525
12610
  async classify(jobs) {
12526
12611
  const identityIndexes = [];
12527
12612
  const descriptorGroups = /* @__PURE__ */ new Map();
12613
+ const unknownIndexes = [];
12528
12614
  if (jobs.length === 0) {
12529
- return { identityIndexes, descriptorGroups };
12615
+ return { identityIndexes, descriptorGroups, unknownIndexes };
12530
12616
  }
12531
12617
  const distinctScripts = Array.from(new Set(jobs.map((j) => hex.encode(j.lookupScript))));
12532
12618
  const contracts = await this.deps.contractRepository.getContracts({
@@ -12546,6 +12632,8 @@ var InputSignerRouter = class {
12546
12632
  if (!contract) {
12547
12633
  if (scriptHex === boardingScriptHex) {
12548
12634
  identityIndexes.push(job.index);
12635
+ } else {
12636
+ unknownIndexes.push(job.index);
12549
12637
  }
12550
12638
  continue;
12551
12639
  }
@@ -12572,7 +12660,7 @@ var InputSignerRouter = class {
12572
12660
  descriptorGroups.set(descriptor, [job.index]);
12573
12661
  }
12574
12662
  }
12575
- return { identityIndexes, descriptorGroups };
12663
+ return { identityIndexes, descriptorGroups, unknownIndexes };
12576
12664
  }
12577
12665
  /**
12578
12666
  * Returns `true` when every signable input across all `jobSets` resolves
@@ -12594,12 +12682,13 @@ var InputSignerRouter = class {
12594
12682
  const plan = await this.classify(jobSets.flat());
12595
12683
  return plan.descriptorGroups.size === 0;
12596
12684
  }
12597
- async sign(tx, jobs) {
12685
+ async sign(tx, jobs, opts) {
12598
12686
  if (jobs.length === 0) return tx;
12599
- const { identityIndexes, descriptorGroups } = await this.classify(jobs);
12687
+ const { identityIndexes, descriptorGroups, unknownIndexes } = await this.classify(jobs);
12688
+ const identitySignIndexes = opts?.onUnknownScript === "sign" ? [...identityIndexes, ...unknownIndexes] : identityIndexes;
12600
12689
  let signed = tx;
12601
- if (identityIndexes.length > 0) {
12602
- signed = await this.deps.identity.sign(signed, identityIndexes);
12690
+ if (identitySignIndexes.length > 0) {
12691
+ signed = await this.deps.identity.sign(signed, identitySignIndexes);
12603
12692
  }
12604
12693
  if (descriptorGroups.size > 0) {
12605
12694
  if (!this.deps.descriptorProvider) {
@@ -13626,23 +13715,26 @@ var ReadonlyWallet = class _ReadonlyWallet {
13626
13715
  */
13627
13716
  async getBoardingUtxosForSigners(allowedSigners) {
13628
13717
  const tapscripts = await this.getBoardingTapscripts(allowedSigners);
13629
- const groups = [];
13630
- for (const tapscript of tapscripts) {
13631
- const address = tapscript.onchainAddress(this.network);
13632
- const coins = await this.onchainProvider.getCoins(address);
13633
- const utxos = coins.map((utxo) => extendCoinWithTapscript(tapscript, utxo));
13634
- await this.walletRepository.saveUtxos(address, utxos);
13635
- groups.push({
13636
- tapscript,
13637
- // Normalize so the group key matches the axis/contract x-only
13638
- // form regardless of how the tapscript's key was stored.
13639
- serverPubKey: toXOnlySignerHex(hex.encode(tapscript.options.serverPubKey)),
13640
- // Per-row CSV delay decoded from THIS tapscript's exit leaf —
13641
- // not the wallet's current boarding timelock, which a signer
13642
- // rotation may have changed.
13643
- csvTimelock: CSVMultisigTapscript.decode(hex.decode(tapscript.exitScript)).params.timelock,
13644
- coins: utxos
13645
- });
13718
+ const addresses = tapscripts.map((tapscript) => tapscript.onchainAddress(this.network));
13719
+ const groups = await Promise.all(
13720
+ tapscripts.map(async (tapscript, i) => {
13721
+ const coins = await this.onchainProvider.getCoins(addresses[i]);
13722
+ const utxos = coins.map((utxo) => extendCoinWithTapscript(tapscript, utxo));
13723
+ return {
13724
+ tapscript,
13725
+ // Normalize so the group key matches the axis/contract x-only
13726
+ // form regardless of how the tapscript's key was stored.
13727
+ serverPubKey: toXOnlySignerHex(hex.encode(tapscript.options.serverPubKey)),
13728
+ // Per-row CSV delay decoded from THIS tapscript's exit leaf —
13729
+ // not the wallet's current boarding timelock, which a signer
13730
+ // rotation may have changed.
13731
+ csvTimelock: CSVMultisigTapscript.decode(hex.decode(tapscript.exitScript)).params.timelock,
13732
+ coins: utxos
13733
+ };
13734
+ })
13735
+ );
13736
+ for (const [i, group] of groups.entries()) {
13737
+ await this.walletRepository.saveUtxos(addresses[i], group.coins);
13646
13738
  }
13647
13739
  return groups;
13648
13740
  }
@@ -15738,15 +15830,16 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
15738
15830
  console.error(`Failed to persist intent ${intentTxId} (state=${state})`, e);
15739
15831
  }
15740
15832
  }
15741
- /**
15742
- * @internal Sign an on-chain boarding exit / sweep transaction, routing
15743
- * each input to the correct key by its `witnessUtxo.script`: the identity
15744
- * for index-0 / static boarding, the per-index descriptor for a rotated
15745
- * boarding UTXO (plan §6-III.3). Used by
15746
- * {@link VtxoManager.sweepExpiredBoardingUtxos}; without it, the
15747
- * unilateral exit of a rotated boarding UTXO would be signed with the
15748
- * wrong (index-0) key and rejected.
15749
- */
15833
+ async signInputsByWitnessScript(tx) {
15834
+ const signed = await this._signerRouter.sign(
15835
+ tx,
15836
+ this.inputSigningJobsFromWitnessUtxos(tx),
15837
+ {
15838
+ onUnknownScript: "sign"
15839
+ }
15840
+ );
15841
+ return signed;
15842
+ }
15750
15843
  async signOnchainBoardingTx(tx) {
15751
15844
  const signed = await this._signerRouter.sign(tx, this.inputSigningJobsFromWitnessUtxos(tx));
15752
15845
  return signed;
@@ -17596,6 +17689,18 @@ var DustChangeError = class extends Error {
17596
17689
  this.dustAmount = dustAmount;
17597
17690
  }
17598
17691
  };
17692
+ var OversizedChangeError = class extends Error {
17693
+ change;
17694
+ maxAmount;
17695
+ constructor(change, maxAmount) {
17696
+ super(
17697
+ `change ${change} sats is above the server's ${maxAmount} sat per-output ceiling; exit more of the balance, or split it into smaller VTXOs first`
17698
+ );
17699
+ this.name = "OversizedChangeError";
17700
+ this.change = change;
17701
+ this.maxAmount = maxAmount;
17702
+ }
17703
+ };
17599
17704
  var offboardNetworkNames = [
17600
17705
  "bitcoin",
17601
17706
  "regtest",
@@ -17606,7 +17711,7 @@ var offboardNetworkNames = [
17606
17711
  function offboardDestinationScript(destinationAddress) {
17607
17712
  for (const networkName of offboardNetworkNames) {
17608
17713
  try {
17609
- const network = networks$1[networkName];
17714
+ const network = networks[networkName];
17610
17715
  const addr = Address(network).decode(destinationAddress);
17611
17716
  return OutScript.encode(addr);
17612
17717
  } catch {
@@ -17627,11 +17732,50 @@ function settleChangeAgainstFee(change, feeOn) {
17627
17732
  `change fee does not settle after ${CHANGE_FEE_MAX_ROUNDS} rounds (${change} sats of change); settle the full balance instead`
17628
17733
  );
17629
17734
  }
17735
+ function changeAfterOutputFee(left, feeOn) {
17736
+ if (left <= 0n) return { change: 0n, fee: 0n };
17737
+ const change = settleChangeAgainstFee(left, feeOn);
17738
+ return { change, fee: left - change };
17739
+ }
17630
17740
  function reportUngatedInputs(wallet, inputs) {
17631
17741
  if (!("logUngatedInputs" in wallet)) return;
17632
17742
  const logger = wallet;
17633
17743
  void logger.logUngatedInputs("Ramps.offboard({ vtxos })", inputs);
17634
17744
  }
17745
+ function filterOffboardInputs(vtxos, feeInfo, named) {
17746
+ const estimator = new Estimator(feeInfo?.intentFee ?? {});
17747
+ const inputs = [];
17748
+ let subtotal = 0n;
17749
+ for (const vtxo of vtxos) {
17750
+ const inputFee = estimator.evalOffchainInput(toOffchainInputFeeParams(vtxo));
17751
+ if (inputFee.satoshis >= vtxo.value) {
17752
+ if (named) {
17753
+ throw new Error(
17754
+ `selected vtxo ${vtxo.txid}:${vtxo.vout} costs ${inputFee.satoshis} sats to spend and is worth ${vtxo.value} \u2014 drop it from the selection`
17755
+ );
17756
+ }
17757
+ continue;
17758
+ }
17759
+ inputs.push(vtxo);
17760
+ subtotal += BigInt(vtxo.value) - BigInt(inputFee.satoshis);
17761
+ }
17762
+ if (inputs.length === 0) {
17763
+ throw new Error("No vtxos available after deducting fees");
17764
+ }
17765
+ return { inputs, subtotal };
17766
+ }
17767
+ async function serverVtxoMaxAmount(wallet) {
17768
+ const provider = wallet.arkProvider;
17769
+ if (!provider) return void 0;
17770
+ return (await provider.getInfo()).vtxoMaxAmount;
17771
+ }
17772
+ function assertChangeSettleable(change, dustAmount, maxAmount) {
17773
+ if (change === 0n) return;
17774
+ if (change < dustAmount) throw new DustChangeError(change, dustAmount);
17775
+ if (maxAmount !== void 0 && maxAmount >= 0n && change > maxAmount) {
17776
+ throw new OversizedChangeError(change, maxAmount);
17777
+ }
17778
+ }
17635
17779
  var Ramps = class {
17636
17780
  /**
17637
17781
  * Create convenience wrappers for onboarding and offboarding flows.
@@ -17757,81 +17901,87 @@ var Ramps = class {
17757
17901
  async offboard(destinationAddress, feeInfo, amount, eventCallback, vtxos) {
17758
17902
  const named = vtxos !== void 0;
17759
17903
  if (vtxos) reportUngatedInputs(this.wallet, vtxos);
17760
- vtxos ??= await this.wallet.getSpendableVtxos({
17904
+ const spendable = vtxos ?? await this.wallet.getSpendableVtxos({
17761
17905
  withRecoverable: true,
17762
17906
  withUnrolled: false
17763
17907
  });
17764
17908
  const estimator = new Estimator(feeInfo?.intentFee ?? {});
17765
- const filteredVtxos = [];
17766
- let totalAmount = 0n;
17767
- for (const vtxo of vtxos) {
17768
- const inputFee = estimator.evalOffchainInput(toOffchainInputFeeParams(vtxo));
17769
- if (inputFee.satoshis >= vtxo.value) {
17770
- if (named) {
17771
- throw new Error(
17772
- `selected vtxo ${vtxo.txid}:${vtxo.vout} costs ${inputFee.satoshis} sats to spend and is worth ${vtxo.value} \u2014 drop it from the selection`
17773
- );
17774
- }
17775
- continue;
17776
- }
17777
- filteredVtxos.push(vtxo);
17778
- totalAmount += BigInt(vtxo.value) - BigInt(inputFee.satoshis);
17779
- }
17780
- if (filteredVtxos.length === 0) {
17781
- throw new Error("No vtxos available after deducting fees");
17782
- }
17783
- let change = 0n;
17784
- if (amount) {
17785
- if (amount > totalAmount) {
17786
- throw new Error("Amount is greater than total amount of vtxos after fees");
17787
- }
17788
- change = totalAmount - amount;
17789
- }
17790
- let changeAddress;
17791
- if (change > 0n) {
17792
- changeAddress = await this.wallet.getAddress();
17793
- const changeScript = hex.encode(ArkAddress.decode(changeAddress).pkScript);
17794
- change = settleChangeAgainstFee(
17795
- change,
17796
- (amount2) => BigInt(estimator.evalOffchainOutput({ amount: amount2, script: changeScript }).satoshis)
17797
- );
17798
- }
17799
- const dustAmount = getDustAmount(this.wallet);
17800
- if (change > 0n && change < dustAmount) {
17801
- throw new DustChangeError(change, dustAmount);
17802
- }
17803
- amount = amount ?? totalAmount;
17804
- const destinationScript = offboardDestinationScript(destinationAddress);
17909
+ const { inputs, subtotal } = filterOffboardInputs(spendable, feeInfo, named);
17910
+ if (amount && amount > subtotal) {
17911
+ throw new Error("Amount is greater than total amount of vtxos after fees");
17912
+ }
17913
+ const handed = amount || subtotal;
17914
+ const { change, changeAddress } = await this.fundChange(
17915
+ amount ? subtotal - handed : 0n,
17916
+ estimator
17917
+ );
17805
17918
  const outputFee = estimator.evalOnchainOutput({
17806
- amount,
17807
- script: hex.encode(destinationScript)
17919
+ amount: handed,
17920
+ script: hex.encode(offboardDestinationScript(destinationAddress))
17808
17921
  });
17809
- if (BigInt(outputFee.satoshis) > amount) {
17922
+ if (BigInt(outputFee.satoshis) > handed) {
17810
17923
  throw new Error(
17811
- `can't deduct fees from offboard amount (${outputFee.satoshis} > ${amount})`
17924
+ `can't deduct fees from offboard amount (${outputFee.satoshis} > ${handed})`
17812
17925
  );
17813
17926
  }
17814
- amount -= BigInt(outputFee.satoshis);
17815
17927
  const outputs = [
17816
- {
17817
- address: destinationAddress,
17818
- amount
17819
- }
17928
+ { address: destinationAddress, amount: handed - BigInt(outputFee.satoshis) }
17820
17929
  ];
17821
- if (change > 0n) {
17822
- const offchainAddress = changeAddress;
17823
- outputs.push({
17824
- address: offchainAddress,
17825
- amount: change
17826
- });
17930
+ if (change > 0n) outputs.push({ address: changeAddress, amount: change });
17931
+ return this.wallet.settle({ inputs, outputs }, eventCallback);
17932
+ }
17933
+ /**
17934
+ * Collaboratively exit with the DESTINATION paid exactly `amount`, pricing the
17935
+ * fee on that output rather than on a grossed-up figure. {@link offboard} keeps
17936
+ * the other anchor, which needs `g - fee(g) = amount` solved — impossible for
17937
+ * a program charging the whole output.
17938
+ */
17939
+ async offboardExact(params) {
17940
+ const { destinationAddress, feeInfo, amount, eventCallback, vtxos } = params;
17941
+ if (amount <= 0n) {
17942
+ throw new Error(`offboard amount must be positive, got ${amount}`);
17827
17943
  }
17828
- return this.wallet.settle(
17829
- {
17830
- inputs: filteredVtxos,
17831
- outputs
17832
- },
17833
- eventCallback
17944
+ const named = vtxos !== void 0;
17945
+ if (vtxos) reportUngatedInputs(this.wallet, vtxos);
17946
+ const spendable = vtxos ?? await this.wallet.getSpendableVtxos({
17947
+ withRecoverable: true,
17948
+ withUnrolled: false
17949
+ });
17950
+ const estimator = new Estimator(feeInfo?.intentFee ?? {});
17951
+ const { inputs, subtotal } = filterOffboardInputs(spendable, feeInfo, named);
17952
+ const outputFee = BigInt(
17953
+ estimator.evalOnchainOutput({
17954
+ amount,
17955
+ script: hex.encode(offboardDestinationScript(destinationAddress))
17956
+ }).satoshis
17834
17957
  );
17958
+ const needed = amount + outputFee;
17959
+ if (needed > subtotal) {
17960
+ throw new Error(
17961
+ `selected vtxos net ${subtotal} sats, ${needed} needed to deliver ${amount} exactly (${amount} + a ${outputFee} sat exit fee)`
17962
+ );
17963
+ }
17964
+ const { change, changeAddress } = await this.fundChange(subtotal - needed, estimator);
17965
+ const outputs = [{ address: destinationAddress, amount }];
17966
+ if (change > 0n) outputs.push({ address: changeAddress, amount: change });
17967
+ return this.wallet.settle({ inputs, outputs }, eventCallback);
17968
+ }
17969
+ /** Fund the change output: pay its own fee, then judge it against both
17970
+ * server-side bounds. `0n` in is `0n` out — no change output at all. */
17971
+ async fundChange(left, estimator) {
17972
+ if (left <= 0n) return { change: 0n };
17973
+ const changeAddress = await this.wallet.getAddress();
17974
+ const changeScript = hex.encode(ArkAddress.decode(changeAddress).pkScript);
17975
+ const { change } = changeAfterOutputFee(
17976
+ left,
17977
+ (amount) => BigInt(estimator.evalOffchainOutput({ amount, script: changeScript }).satoshis)
17978
+ );
17979
+ assertChangeSettleable(
17980
+ change,
17981
+ getDustAmount(this.wallet),
17982
+ await serverVtxoMaxAmount(this.wallet)
17983
+ );
17984
+ return { change, changeAddress };
17835
17985
  }
17836
17986
  };
17837
17987
 
@@ -22539,7 +22689,7 @@ function sweepFeeFor(path, outputAddress, network, feeRate) {
22539
22689
  return Number(estimator.vsize().fee(BigInt(Math.ceil(feeRate))));
22540
22690
  }
22541
22691
  async function buildSignedSweep(params) {
22542
- const { vtxo, path, outputAddress, feeRate, network, identity } = params;
22692
+ const { vtxo, path, outputAddress, feeRate, network, identity, signer } = params;
22543
22693
  const fee = sweepFeeFor(path, outputAddress, network, feeRate);
22544
22694
  const sendAmount = BigInt(vtxo.value) - BigInt(fee);
22545
22695
  if (sendAmount < BigInt(DUST_AMOUNT)) {
@@ -22557,7 +22707,7 @@ async function buildSignedSweep(params) {
22557
22707
  sighashType: SigHash.DEFAULT
22558
22708
  });
22559
22709
  tx.addOutputAddress(outputAddress, sendAmount, network);
22560
- const signed = await identity.sign(tx);
22710
+ const signed = signer ? await signer(tx) : await identity.sign(tx);
22561
22711
  if (!path.extraWitness || path.extraWitness.length === 0) {
22562
22712
  signed.finalize();
22563
22713
  return { tx: signed, fee };
@@ -23109,7 +23259,8 @@ async function prepare(opts) {
23109
23259
  outputAddress: opts.sweepAddress,
23110
23260
  feeRate,
23111
23261
  network: wallet.network,
23112
- identity: wallet.identity
23262
+ identity: wallet.identity,
23263
+ signer: (tx2) => wallet.signInputsByWitnessScript(tx2)
23113
23264
  });
23114
23265
  activeOutpoints.add(outpoint);
23115
23266
  sweepSteps.push({
@@ -23600,7 +23751,7 @@ var Arkade = class _Arkade {
23600
23751
  const info = await opts.arkade.getInfo();
23601
23752
  const serverKey = toXOnly(hex.decode(info.signerPubkey), "ark signer key");
23602
23753
  const checkpoint = CSVMultisigTapscript.decode(hex.decode(info.checkpointTapscript));
23603
- const network = opts.network ?? DEFAULT_NETWORK;
23754
+ const network = opts.network ?? (Object.hasOwn(networks, info.network) ? getNetwork(info.network) : DEFAULT_NETWORK);
23604
23755
  let emulatorKey;
23605
23756
  if (opts.emulator) {
23606
23757
  emulatorKey = hex.decode(resolveEmulatorPubkey(network, opts.emulatorPubkey));
@@ -24422,18 +24573,6 @@ function arkAssetRail() {
24422
24573
  };
24423
24574
  }
24424
24575
  var walletFeeSource = (wallet) => async () => (await wallet.arkProvider.getInfo()).fees;
24425
- var GROSS_UP_MAX_ROUNDS = 8;
24426
- function grossUpOffboard(net, feeInfo, script) {
24427
- const estimator = new Estimator(feeInfo?.intentFee ?? {});
24428
- const feeAt = (amount) => estimator.evalOnchainOutput({ amount: BigInt(amount), script }).satoshis;
24429
- let gross = net;
24430
- for (let i = 0; i < GROSS_UP_MAX_ROUNDS; i++) {
24431
- const next = net + feeAt(gross);
24432
- if (next === gross) break;
24433
- gross = next;
24434
- }
24435
- return { gross, fee: gross - net };
24436
- }
24437
24576
  function offchainInputFees(vtxos, fees) {
24438
24577
  const estimator = new Estimator(fees?.intentFee ?? {});
24439
24578
  return vtxos.reduce(
@@ -24441,6 +24580,18 @@ function offchainInputFees(vtxos, fees) {
24441
24580
  0
24442
24581
  );
24443
24582
  }
24583
+ async function changeOutputFee(wallet, inputs, needed, fees) {
24584
+ const estimator = new Estimator(fees?.intentFee ?? {});
24585
+ const net = inputs.reduce(
24586
+ (total, vtxo) => total + BigInt(vtxo.value) - BigInt(estimator.evalOffchainInput(toOffchainInputFeeParams(vtxo)).satoshis),
24587
+ 0n
24588
+ );
24589
+ const script = hex.encode(ArkAddress.decode(await wallet.getAddress()).pkScript);
24590
+ return changeAfterOutputFee(
24591
+ net - needed,
24592
+ (amount) => BigInt(estimator.evalOffchainOutput({ amount, script }).satoshis)
24593
+ ).fee;
24594
+ }
24444
24595
  function onchainRail(deps) {
24445
24596
  if (typeof deps?.feeInfo !== "function") {
24446
24597
  throw new Error("onchain rail: a feeInfo source is required");
@@ -24456,23 +24607,34 @@ function onchainRail(deps) {
24456
24607
  const amt = resolveSendAmount("onchain", req.raw, req.amount);
24457
24608
  const fees = await deps.feeInfo();
24458
24609
  const script = hex.encode(offboardDestinationScript(address));
24459
- const { gross, fee } = grossUpOffboard(amt, fees, script);
24610
+ const exitFee = Number(
24611
+ new Estimator(fees?.intentFee ?? {}).evalOnchainOutput({
24612
+ amount: BigInt(amt),
24613
+ script
24614
+ }).satoshis
24615
+ );
24460
24616
  const selectedVtxos = selectionOf(req);
24461
24617
  const inputFee = selectedVtxos ? offchainInputFees(selectedVtxos, fees) : 0;
24618
+ const changeFee = selectedVtxos ? await changeOutputFee(
24619
+ ctx.wallet,
24620
+ selectedVtxos,
24621
+ BigInt(amt) + BigInt(exitFee),
24622
+ fees
24623
+ ) : 0n;
24462
24624
  return {
24463
24625
  railId: "onchain",
24464
24626
  amount: amt,
24465
- fee: fee + inputFee,
24466
- total: gross + inputFee,
24627
+ fee: exitFee + inputFee + Number(changeFee),
24628
+ total: amt + exitFee + inputFee + Number(changeFee),
24467
24629
  send: async () => makeHandle("onchain", async (emit) => {
24468
24630
  const ramps = new Ramps(ctx.wallet);
24469
- const txid = selectedVtxos ? await ramps.offboard(
24470
- address,
24471
- fees,
24472
- BigInt(gross),
24473
- void 0,
24474
- selectedVtxos
24475
- ) : await ramps.offboard(address, fees, BigInt(gross));
24631
+ const txid = await ramps.offboardExact({
24632
+ destinationAddress: address,
24633
+ feeInfo: fees,
24634
+ amount: BigInt(amt),
24635
+ // Omitted, not undefined: an empty set covers nothing.
24636
+ ...selectedVtxos ? { vtxos: selectedVtxos } : {}
24637
+ });
24476
24638
  const result = { railId: "onchain", txid };
24477
24639
  emit({ status: "settled", result });
24478
24640
  return result;
@@ -24495,6 +24657,6 @@ function createDefaultPaymentRouter(wallet) {
24495
24657
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
24496
24658
  */
24497
24659
 
24498
- export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletCannotAllocateAddressError, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertNoAssets, assertNoSelection, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deleteByIndex, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, exitObserverFor, extendVirtualCoinForContract, extractArkProviderUrl, gateExclusion, gatedContracts, getAllByIndexValues, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, isWatchedContract, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, requiresMigration, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, selectionOf, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, warnAndFilterVtxosForScript, withPrevTxs };
24499
- //# sourceMappingURL=chunk-ZTGTQP2W.js.map
24500
- //# sourceMappingURL=chunk-ZTGTQP2W.js.map
24660
+ export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, OversizedChangeError, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletCannotAllocateAddressError, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertNoAssets, assertNoSelection, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deleteByIndex, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, exitObserverFor, extendVirtualCoinForContract, extractArkProviderUrl, gateExclusion, gatedContracts, getAllByIndexValues, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, isWatchedContract, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, requiresMigration, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, selectionOf, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, warnAndFilterVtxosForScript, withPrevTxs };
24661
+ //# sourceMappingURL=chunk-FTLPTF3R.js.map
24662
+ //# sourceMappingURL=chunk-FTLPTF3R.js.map