@arkade-os/sdk 0.5.0-rc.2 → 0.5.0-rc.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 (118) hide show
  1. package/README.md +12 -67
  2. package/dist/adapters/expo.cjs +5 -6
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -4
  6. package/dist/{asyncStorageTaskQueue-C5rBYlru.d.ts → asyncStorageTaskQueue-BCiOgs5x.d.ts} +2 -2
  7. package/dist/{asyncStorageTaskQueue-BuDvgWh6.d.cts → asyncStorageTaskQueue-CTIwKrt5.d.cts} +2 -2
  8. package/dist/{chunk-3R476TDV.js → chunk-4EZOMPAO.js} +14 -38
  9. package/dist/chunk-4EZOMPAO.js.map +1 -0
  10. package/dist/{chunk-D25O4EGY.cjs → chunk-5NLJUXXQ.cjs} +10 -10
  11. package/dist/{chunk-D25O4EGY.cjs.map → chunk-5NLJUXXQ.cjs.map} +1 -1
  12. package/dist/{chunk-JZWLXNHV.cjs → chunk-C5Y2R63Z.cjs} +25 -71
  13. package/dist/chunk-C5Y2R63Z.cjs.map +1 -0
  14. package/dist/{chunk-6DNR46C7.js → chunk-CIBGIZUW.js} +4 -4
  15. package/dist/{chunk-6DNR46C7.js.map → chunk-CIBGIZUW.js.map} +1 -1
  16. package/dist/{chunk-43FKNLX4.cjs → chunk-F7HJO5GT.cjs} +61 -85
  17. package/dist/chunk-F7HJO5GT.cjs.map +1 -0
  18. package/dist/{chunk-ISO4TI5J.js → chunk-GLZNJFAT.js} +25 -67
  19. package/dist/chunk-GLZNJFAT.js.map +1 -0
  20. package/dist/{chunk-HLCGYOIH.cjs → chunk-GPJSGLWM.cjs} +17 -17
  21. package/dist/{chunk-HLCGYOIH.cjs.map → chunk-GPJSGLWM.cjs.map} +1 -1
  22. package/dist/{chunk-ZOTXDOS5.js → chunk-MOWSLXGO.js} +4 -4
  23. package/dist/{chunk-ZOTXDOS5.js.map → chunk-MOWSLXGO.js.map} +1 -1
  24. package/dist/{chunk-ZRNQV6HV.js → chunk-PYTAH2NY.js} +167 -703
  25. package/dist/chunk-PYTAH2NY.js.map +1 -0
  26. package/dist/{chunk-NVZJSKZS.cjs → chunk-SYRQJS5N.cjs} +18 -19
  27. package/dist/chunk-SYRQJS5N.cjs.map +1 -0
  28. package/dist/{chunk-4PKLULWT.js → chunk-XHASFSDU.js} +3 -4
  29. package/dist/chunk-XHASFSDU.js.map +1 -0
  30. package/dist/{chunk-GMZZQXV5.cjs → chunk-ZHLYFRYY.cjs} +583 -1128
  31. package/dist/chunk-ZHLYFRYY.cjs.map +1 -0
  32. package/dist/contracts/handlers/index.cjs +9 -10
  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 -3
  36. package/dist/{delegate-1yp1HyP7.d.cts → delegate-CpQIgTs7.d.cts} +1 -1
  37. package/dist/{delegate-BAX5QftB.d.ts → delegate-Dv-us16c.d.ts} +1 -1
  38. package/dist/{hdWalletCapable-CmEU0NP1.d.ts → hdWalletCapable-BC4Fmmht.d.ts} +7 -25
  39. package/dist/{hdWalletCapable-eJgaT-ec.d.cts → hdWalletCapable-DotEa5rZ.d.cts} +7 -25
  40. package/dist/{index-DUxufw76.d.ts → index-Czz9HSqE.d.cts} +21 -220
  41. package/dist/{index-DUxufw76.d.cts → index-Czz9HSqE.d.ts} +21 -220
  42. package/dist/{index-Bem5vKzX.d.ts → index-DUkvXxpt.d.ts} +3 -3
  43. package/dist/{index-W_oMcOmG.d.cts → index-DdJt5fRc.d.cts} +3 -3
  44. package/dist/index.cjs +291 -340
  45. package/dist/index.d.cts +58 -223
  46. package/dist/index.d.ts +58 -223
  47. package/dist/index.js +4 -5
  48. package/dist/repositories/realm/index.cjs +57 -24
  49. package/dist/repositories/realm/index.cjs.map +1 -1
  50. package/dist/repositories/realm/index.d.cts +12 -4
  51. package/dist/repositories/realm/index.d.ts +12 -4
  52. package/dist/repositories/realm/index.js +43 -10
  53. package/dist/repositories/realm/index.js.map +1 -1
  54. package/dist/repositories/sqlite/index.cjs +103 -33
  55. package/dist/repositories/sqlite/index.cjs.map +1 -1
  56. package/dist/repositories/sqlite/index.d.cts +12 -2
  57. package/dist/repositories/sqlite/index.d.ts +12 -2
  58. package/dist/repositories/sqlite/index.js +90 -20
  59. package/dist/repositories/sqlite/index.js.map +1 -1
  60. package/dist/{taskRunner-Dr3NStc0.d.cts → taskRunner-7E_Rx8bD.d.cts} +2 -2
  61. package/dist/{taskRunner-D_iPiZIi.d.ts → taskRunner-DUId1UJ8.d.ts} +2 -2
  62. package/dist/wallet/expo/background.cjs +14 -15
  63. package/dist/wallet/expo/background.cjs.map +1 -1
  64. package/dist/wallet/expo/background.d.cts +3 -3
  65. package/dist/wallet/expo/background.d.ts +3 -3
  66. package/dist/wallet/expo/background.js +6 -7
  67. package/dist/wallet/expo/background.js.map +1 -1
  68. package/dist/wallet/expo/index.cjs +15 -23
  69. package/dist/wallet/expo/index.cjs.map +1 -1
  70. package/dist/wallet/expo/index.d.cts +4 -7
  71. package/dist/wallet/expo/index.d.ts +4 -7
  72. package/dist/wallet/expo/index.js +7 -15
  73. package/dist/wallet/expo/index.js.map +1 -1
  74. package/dist/worker/expo/index.cjs +9 -10
  75. package/dist/worker/expo/index.cjs.map +1 -1
  76. package/dist/worker/expo/index.d.cts +4 -4
  77. package/dist/worker/expo/index.d.ts +4 -4
  78. package/dist/worker/expo/index.js +5 -6
  79. package/dist/worker/expo/index.js.map +1 -1
  80. package/package.json +4 -42
  81. package/dist/adapters/asyncStorage.cjs +0 -48
  82. package/dist/adapters/asyncStorage.cjs.map +0 -1
  83. package/dist/adapters/asyncStorage.d.cts +0 -16
  84. package/dist/adapters/asyncStorage.d.ts +0 -16
  85. package/dist/adapters/asyncStorage.js +0 -46
  86. package/dist/adapters/asyncStorage.js.map +0 -1
  87. package/dist/adapters/fileSystem.cjs +0 -116
  88. package/dist/adapters/fileSystem.cjs.map +0 -1
  89. package/dist/adapters/fileSystem.d.cts +0 -17
  90. package/dist/adapters/fileSystem.d.ts +0 -17
  91. package/dist/adapters/fileSystem.js +0 -93
  92. package/dist/adapters/fileSystem.js.map +0 -1
  93. package/dist/adapters/indexedDB.cjs +0 -103
  94. package/dist/adapters/indexedDB.cjs.map +0 -1
  95. package/dist/adapters/indexedDB.d.cts +0 -18
  96. package/dist/adapters/indexedDB.d.ts +0 -18
  97. package/dist/adapters/indexedDB.js +0 -101
  98. package/dist/adapters/indexedDB.js.map +0 -1
  99. package/dist/adapters/localStorage.cjs +0 -50
  100. package/dist/adapters/localStorage.cjs.map +0 -1
  101. package/dist/adapters/localStorage.d.cts +0 -14
  102. package/dist/adapters/localStorage.d.ts +0 -14
  103. package/dist/adapters/localStorage.js +0 -48
  104. package/dist/adapters/localStorage.js.map +0 -1
  105. package/dist/chunk-3R476TDV.js.map +0 -1
  106. package/dist/chunk-43FKNLX4.cjs.map +0 -1
  107. package/dist/chunk-4PKLULWT.js.map +0 -1
  108. package/dist/chunk-5BLDMQED.cjs +0 -18
  109. package/dist/chunk-5BLDMQED.cjs.map +0 -1
  110. package/dist/chunk-GMZZQXV5.cjs.map +0 -1
  111. package/dist/chunk-ISO4TI5J.js.map +0 -1
  112. package/dist/chunk-JZWLXNHV.cjs.map +0 -1
  113. package/dist/chunk-NSBPE2FW.js +0 -15
  114. package/dist/chunk-NSBPE2FW.js.map +0 -1
  115. package/dist/chunk-NVZJSKZS.cjs.map +0 -1
  116. package/dist/chunk-ZRNQV6HV.js.map +0 -1
  117. package/dist/index-C0IanN1m.d.cts +0 -11
  118. package/dist/index-C0IanN1m.d.ts +0 -11
@@ -1,7 +1,6 @@
1
- import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-4PKLULWT.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-3R476TDV.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, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, RestArkProvider, networkFromArkadeInfo, toVirtualStatus, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, parseLegacyExpiry, isExpired, INFO_FETCH_TIMEOUT_MS, PrevoutTxField, ProviderUnavailableError, DEFAULT_ARKADE_SERVER_URL, networks as networks$1, isPastExpiry, fetchVtxoCreatedAtByTxid } from './chunk-ISO4TI5J.js';
4
- import { __export } from './chunk-NSBPE2FW.js';
1
+ import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-XHASFSDU.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-4EZOMPAO.js';
3
+ import { VtxoScript, __export, Transaction, isVirtualCoin, canRecoverOnchain, CSVMultisigTapscript, DEFAULT_NETWORK, resolveEmulatorPubkey, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, ServerResponseMismatchError, getArkPsbtFields, CosignerPublicKey, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, normalizeVtxo, assertAllowedSighashTypes, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, formatSighash, getSequence, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, getNetwork, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, RestArkProvider, DEFAULT_ARKADE_SERVER_URL, networkFromArkadeInfo, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, INFO_FETCH_TIMEOUT_MS, PrevoutTxField, EXPIRY_MIN_PLAUSIBLE_MS, ProviderUnavailableError, networks as networks$1, isPastExpiry, fetchVtxoCreatedAtByTxid } from './chunk-GLZNJFAT.js';
5
4
  import { sha256 as sha256$1, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
6
5
  import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
7
6
  import { hex, base58, base64, bech32m } from '@scure/base';
@@ -498,29 +497,17 @@ var SeedIdentity = class _SeedIdentity {
498
497
  async toReadonly() {
499
498
  return ReadonlyDescriptorIdentity.fromDescriptor(this.descriptor);
500
499
  }
501
- /**
502
- * Returns true when `descriptor` is derived from this identity's seed.
503
- * HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
504
- * match by raw pubkey. See {@link descriptorIsOurs}.
505
- *
506
- * @deprecated Prefer `DescriptorProvider.isOurs()` via
507
- * `HDDescriptorProvider` for rotating HD wallets or
508
- * `StaticDescriptorProvider` for legacy single-key wallets.
509
- */
510
- isOurs(descriptor) {
500
+ /** Returns true when `descriptor` is derived from this identity's seed. */
501
+ ownsDescriptor(descriptor) {
511
502
  return descriptorIsOurs(descriptor, this.descriptor, pubSchnorr(this.derivedKey));
512
503
  }
513
504
  /**
514
505
  * Signs each request with the key derived from its descriptor.
515
- * Each descriptor must share this identity's seed ({@link isOurs}).
516
- *
517
- * @deprecated Prefer `DescriptorProvider.signWithDescriptor()` via
518
- * `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
519
- * this method only as backing implementation for descriptor providers.
506
+ * Each descriptor must share this identity's seed ({@link ownsDescriptor}).
520
507
  */
521
- async signWithDescriptor(requests) {
508
+ async signDescriptorTransactions(requests) {
522
509
  return requests.map((request) => {
523
- if (!this.isOurs(request.descriptor)) {
510
+ if (!this.ownsDescriptor(request.descriptor)) {
524
511
  throw new Error(
525
512
  `Descriptor ${request.descriptor} does not belong to this identity`
526
513
  );
@@ -529,15 +516,9 @@ var SeedIdentity = class _SeedIdentity {
529
516
  return this.signTxWithKey(request.tx, key, request.inputIndexes);
530
517
  });
531
518
  }
532
- /**
533
- * Signs a message with the key derived from `descriptor`.
534
- *
535
- * @deprecated Prefer `DescriptorProvider.signMessageWithDescriptor()` via
536
- * `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
537
- * this method only as backing implementation for descriptor providers.
538
- */
539
- async signMessageWithDescriptor(descriptor, message, signatureType = "schnorr") {
540
- if (!this.isOurs(descriptor)) {
519
+ /** Signs a message with the key derived from `descriptor`. */
520
+ async signDescriptorMessage(descriptor, message, signatureType = "schnorr") {
521
+ if (!this.ownsDescriptor(descriptor)) {
541
522
  throw new Error(`Descriptor ${descriptor} does not belong to this identity`);
542
523
  }
543
524
  const key = this.derivePrivateKeyForDescriptor(descriptor);
@@ -549,7 +530,7 @@ var SeedIdentity = class _SeedIdentity {
549
530
  * which swap preimage derivation reads through.
550
531
  */
551
532
  async signSchnorrDeterministicWithDescriptor(descriptor, messageHash) {
552
- if (!this.isOurs(descriptor)) {
533
+ if (!this.ownsDescriptor(descriptor)) {
553
534
  throw new Error(`Descriptor ${descriptor} does not belong to this identity`);
554
535
  }
555
536
  const key = this.derivePrivateKeyForDescriptor(descriptor);
@@ -683,17 +664,8 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
683
664
  }
684
665
  return bip32.publicKey;
685
666
  }
686
- /**
687
- * Returns true when `descriptor` derives from this identity's xpub.
688
- * HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
689
- * fall back to comparing against the index-0 x-only pubkey. See
690
- * {@link descriptorIsOurs}.
691
- *
692
- * @deprecated Prefer `DescriptorProvider.isOurs()` via
693
- * `HDDescriptorProvider` for rotating HD wallets or
694
- * `StaticDescriptorProvider` for legacy single-key wallets.
695
- */
696
- isOurs(descriptor) {
667
+ /** Returns true when `descriptor` derives from this identity's xpub. */
668
+ ownsDescriptor(descriptor) {
697
669
  return descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
698
670
  }
699
671
  };
@@ -783,25 +755,9 @@ function hydrateIdentity(s) {
783
755
  );
784
756
  }
785
757
  }
786
- var warnedLegacyShape = false;
787
758
  function normalizeSerializedIdentity(shape) {
788
- if ("type" in shape) {
789
- assertValidSerializedIdentity(shape);
790
- return shape;
791
- }
792
- if (!warnedLegacyShape) {
793
- warnedLegacyShape = true;
794
- console.warn(
795
- "[ts-sdk] Received legacy serialized identity shape (privateKey/publicKey). Upgrade the page build to the latest @arkade-os/sdk \u2014 this compatibility path will be removed in the next major."
796
- );
797
- }
798
- if ("privateKey" in shape && typeof shape.privateKey === "string") {
799
- return { type: "single-key", privateKey: shape.privateKey };
800
- }
801
- if ("publicKey" in shape && typeof shape.publicKey === "string") {
802
- return { type: "readonly-single-key", publicKey: shape.publicKey };
803
- }
804
- throw new Error("Unrecognized serialized identity shape");
759
+ assertValidSerializedIdentity(shape);
760
+ return shape;
805
761
  }
806
762
  function assertValidSerializedIdentity(s) {
807
763
  const kind = s.type;
@@ -899,7 +855,7 @@ var DescriptorIdentity = class {
899
855
  function isHDCapableIdentity(value) {
900
856
  if (typeof value !== "object" || value === null) return false;
901
857
  const v = value;
902
- return typeof v.descriptor === "string" && typeof v.isOurs === "function" && typeof v.signWithDescriptor === "function" && typeof v.signMessageWithDescriptor === "function";
858
+ return typeof v.descriptor === "string" && typeof v.ownsDescriptor === "function" && typeof v.signDescriptorTransactions === "function" && typeof v.signDescriptorMessage === "function";
903
859
  }
904
860
 
905
861
  // src/identity/index.ts
@@ -926,7 +882,12 @@ var WalletCannotAllocateAddressError = class extends Error {
926
882
  }
927
883
  };
928
884
  async function resolveDescriptorSigner(descriptor, identity, provider) {
929
- const owner = provider?.isOurs(descriptor) ? provider : isHDCapableIdentity(identity) && identity.isOurs(descriptor) ? identity : void 0;
885
+ const providerOwner = provider?.isOurs(descriptor) ? provider : void 0;
886
+ const identityOwner = !providerOwner && isHDCapableIdentity(identity) && identity.ownsDescriptor(descriptor) ? {
887
+ signWithDescriptor: (requests) => identity.signDescriptorTransactions(requests),
888
+ signMessageWithDescriptor: (ownedDescriptor, message, signatureType) => identity.signDescriptorMessage(ownedDescriptor, message, signatureType)
889
+ } : void 0;
890
+ const owner = providerOwner ?? identityOwner;
930
891
  if (owner && parseHDDescriptor(descriptor)) {
931
892
  return new DescriptorIdentity({ descriptor, signer: owner, base: identity });
932
893
  }
@@ -1625,13 +1586,11 @@ var RestDelegateProvider = class {
1625
1586
  if (!isDelegateInfo(data)) {
1626
1587
  throw new Error("Invalid delegate info");
1627
1588
  }
1628
- const delegateAddress = typeof data.delegateAddress === "string" && data.delegateAddress !== "" ? data.delegateAddress : typeof data.delegatorAddress === "string" && data.delegatorAddress !== "" ? data.delegatorAddress : "";
1629
- return { ...data, delegateAddress };
1589
+ return data;
1630
1590
  }
1631
1591
  };
1632
- var RestDelegatorProvider = RestDelegateProvider;
1633
1592
  function isDelegateInfo(data) {
1634
- return !!data && typeof data === "object" && "pubkey" in data && "fee" in data && typeof data.pubkey === "string" && typeof data.fee === "string" && data.pubkey !== "" && data.fee !== "" && (typeof data.delegateAddress === "string" && data.delegateAddress !== "" || typeof data.delegatorAddress === "string" && data.delegatorAddress !== "");
1593
+ return !!data && typeof data === "object" && "pubkey" in data && "fee" in data && typeof data.pubkey === "string" && typeof data.fee === "string" && data.pubkey !== "" && data.fee !== "" && typeof data.delegateAddress === "string" && data.delegateAddress !== "";
1635
1594
  }
1636
1595
  var ESPLORA_URL = {
1637
1596
  bitcoin: "https://mempool.arkade.sh/api",
@@ -2016,7 +1975,10 @@ var EsploraProvider = class {
2016
1975
  return { subscribers, teardown, started };
2017
1976
  }
2018
1977
  async getChainTip() {
2019
- const tipBlocks = await baseFetch(`${this.baseUrl}/blocks`);
1978
+ let tipBlocks = await baseFetch(`${this.baseUrl}/blocks`);
1979
+ if (tipBlocks.status === 404) {
1980
+ tipBlocks = await baseFetch(`${this.baseUrl}/v1/blocks`);
1981
+ }
2020
1982
  if (!tipBlocks.ok) {
2021
1983
  throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
2022
1984
  }
@@ -4096,10 +4058,6 @@ function deductOffchainOutputFee(subtotal, estimator, arkAddress) {
4096
4058
  }
4097
4059
  var DEFAULT_THRESHOLD_SECONDS = 259200;
4098
4060
  var DEFAULT_THRESHOLD_MS = DEFAULT_THRESHOLD_SECONDS * 1e3;
4099
- var DEFAULT_RENEWAL_CONFIG = {
4100
- thresholdMs: DEFAULT_THRESHOLD_MS
4101
- // 3 days
4102
- };
4103
4061
  var DEFAULT_SETTLEMENT_CONFIG = {
4104
4062
  vtxoThreshold: DEFAULT_THRESHOLD_SECONDS,
4105
4063
  boardingUtxoSweep: true,
@@ -4203,24 +4161,12 @@ function mergeSignerReports(...reportLists) {
4203
4161
  return Array.from(bySigner.values());
4204
4162
  }
4205
4163
  var VtxoManager = class _VtxoManager {
4206
- constructor(wallet, renewalConfig, settlementConfig) {
4164
+ constructor(wallet, settlementConfig) {
4207
4165
  this.wallet = wallet;
4208
- this.renewalConfig = renewalConfig;
4209
- if (settlementConfig !== void 0) {
4210
- this.settlementConfig = settlementConfig;
4211
- } else if (renewalConfig && renewalConfig.enabled) {
4212
- this.settlementConfig = {
4213
- vtxoThreshold: renewalConfig.thresholdMs ? renewalConfig.thresholdMs / 1e3 : void 0
4214
- };
4215
- } else if (renewalConfig) {
4216
- this.settlementConfig = false;
4217
- } else {
4218
- this.settlementConfig = { ...DEFAULT_SETTLEMENT_CONFIG };
4219
- }
4166
+ this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
4220
4167
  this.contractEventsSubscriptionReady = this.initializeSubscription();
4221
4168
  }
4222
4169
  wallet;
4223
- renewalConfig;
4224
4170
  settlementConfig;
4225
4171
  contractEventsSubscriptionReady;
4226
4172
  disposePromise;
@@ -4525,7 +4471,7 @@ var VtxoManager = class _VtxoManager {
4525
4471
  } else if (this.settlementConfig !== false && this.settlementConfig && this.settlementConfig.vtxoThreshold !== void 0) {
4526
4472
  threshold = this.settlementConfig.vtxoThreshold * 1e3;
4527
4473
  } else {
4528
- threshold = this.renewalConfig?.thresholdMs ?? DEFAULT_RENEWAL_CONFIG.thresholdMs;
4474
+ threshold = DEFAULT_THRESHOLD_MS;
4529
4475
  }
4530
4476
  return getExpiringAndRecoverableVtxos(
4531
4477
  vtxos,
@@ -4583,7 +4529,7 @@ var VtxoManager = class _VtxoManager {
4583
4529
  } else if (this.settlementConfig !== false && this.settlementConfig?.vtxoThreshold !== void 0) {
4584
4530
  threshold = this.settlementConfig.vtxoThreshold * 1e3;
4585
4531
  } else {
4586
- threshold = DEFAULT_RENEWAL_CONFIG.thresholdMs;
4532
+ threshold = DEFAULT_THRESHOLD_MS;
4587
4533
  }
4588
4534
  const now = await fetchTimeHeight(this.wallet);
4589
4535
  let vtxos = await this.selectExpiringVtxos(threshold, now);
@@ -5029,7 +4975,7 @@ var VtxoManager = class _VtxoManager {
5029
4975
  awaitingSweepCount = spendable.length;
5030
4976
  awaitingSweepValue = value;
5031
4977
  for (const v of spendable) {
5032
- const exp = toBatchExpiry(v);
4978
+ const exp = v.expiresAt?.getTime();
5033
4979
  if (exp !== void 0 && (nextSweepEta === void 0 || exp < nextSweepEta)) {
5034
4980
  nextSweepEta = exp;
5035
4981
  }
@@ -7494,7 +7440,7 @@ var DelegateManagerImpl = class {
7494
7440
  recoverableVtxos.push(vtxo);
7495
7441
  continue;
7496
7442
  }
7497
- const expiry = toBatchExpiry(vtxo);
7443
+ const expiry = vtxo.expiresAt?.getTime();
7498
7444
  if (!expiry) continue;
7499
7445
  const dayKey = getDayTimestamp(expiry);
7500
7446
  groupByExpiry.set(dayKey, [...groupByExpiry.get(dayKey) ?? [], vtxo]);
@@ -7549,7 +7495,6 @@ var DelegateManagerImpl = class {
7549
7495
  return { delegated, failed };
7550
7496
  }
7551
7497
  };
7552
- var DelegatorManagerImpl = DelegateManagerImpl;
7553
7498
  async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos, destinationScript, delegateAt) {
7554
7499
  if (vtxos.length === 0) {
7555
7500
  throw new Error("unable to delegate: no vtxos provided");
@@ -7559,7 +7504,10 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7559
7504
  }
7560
7505
  if (!delegateAt) {
7561
7506
  const now = { timestamp: /* @__PURE__ */ new Date() };
7562
- const expiryTimestamp = vtxos.filter((coin) => !canRecoverOnchain(coin, now) && toBatchExpiry(coin)).reduce((min, coin) => Math.min(min, toBatchExpiry(coin)), Number.MAX_SAFE_INTEGER);
7507
+ const expiryTimestamp = vtxos.filter((coin) => !canRecoverOnchain(coin, now) && coin.expiresAt).reduce(
7508
+ (min, coin) => Math.min(min, coin.expiresAt.getTime()),
7509
+ Number.MAX_SAFE_INTEGER
7510
+ );
7563
7511
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
7564
7512
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7565
7513
  } else {
@@ -8035,7 +7983,6 @@ var STORE_CONTRACTS = "contracts";
8035
7983
  var STORE_INTENTS = "intents";
8036
7984
  var STORE_VIRTUAL_TXS = "virtualTxs";
8037
7985
  var STORE_VTXO_BRANCHES = "vtxoBranches";
8038
- var LEGACY_STORE_CONTRACT_COLLECTIONS = "contractsCollections";
8039
7986
  var DB_VERSION = 3;
8040
7987
  var INTENT_DB_VERSION = 5;
8041
7988
  function initDatabase(db, oldVersion, transaction) {
@@ -8059,11 +8006,6 @@ function initDatabase(db, oldVersion, transaction) {
8059
8006
  unique: false
8060
8007
  });
8061
8008
  }
8062
- if (!vtxosStore.indexNames.contains("virtualStatus")) {
8063
- vtxosStore.createIndex("virtualStatus", "virtualStatus", {
8064
- unique: false
8065
- });
8066
- }
8067
8009
  if (!vtxosStore.indexNames.contains("createdAt")) {
8068
8010
  vtxosStore.createIndex("createdAt", "createdAt", {
8069
8011
  unique: false
@@ -8176,11 +8118,6 @@ function initDatabase(db, oldVersion, transaction) {
8176
8118
  });
8177
8119
  }
8178
8120
  }
8179
- if (!db.objectStoreNames.contains(LEGACY_STORE_CONTRACT_COLLECTIONS)) {
8180
- db.createObjectStore(LEGACY_STORE_CONTRACT_COLLECTIONS, {
8181
- keyPath: "key"
8182
- });
8183
- }
8184
8121
  if (oldVersion >= 1 && oldVersion < 3 && transaction) {
8185
8122
  const vtxosStore = transaction.objectStore(STORE_VTXOS);
8186
8123
  if (!vtxosStore.indexNames.contains("script")) {
@@ -9717,8 +9654,7 @@ var ContractManager = class _ContractManager {
9717
9654
  async advanceLookAheadWatermark(index) {
9718
9655
  const lookAhead = this.config.lookAhead;
9719
9656
  if (!lookAhead) return;
9720
- const advance = lookAhead.advanceWatermark ?? lookAhead.onPromoted;
9721
- await advance?.(index);
9657
+ await lookAhead.advanceWatermark?.(index);
9722
9658
  }
9723
9659
  /**
9724
9660
  * Promote every look-ahead entry funded by `vtxos` into a real repository
@@ -9927,7 +9863,7 @@ var ContractManager = class _ContractManager {
9927
9863
  );
9928
9864
  } catch (error) {
9929
9865
  probe.indeterminate.add(index);
9930
- probe.errors.set(index, { handler: h.type, index, error });
9866
+ probe.errors.set(index, { handler: h.type, fromIndex: index, error });
9931
9867
  }
9932
9868
  })
9933
9869
  );
@@ -9939,7 +9875,7 @@ var ContractManager = class _ContractManager {
9939
9875
  for (const e of entries) probe.indeterminate.add(e.index);
9940
9876
  probe.errors.set(from, {
9941
9877
  handler: h.type,
9942
- index: from,
9878
+ fromIndex: from,
9943
9879
  ...to > from && { toIndex: to },
9944
9880
  error
9945
9881
  });
@@ -10001,7 +9937,6 @@ var ContractManager = class _ContractManager {
10001
9937
  );
10002
9938
  }
10003
9939
  return {
10004
- lastIndexUsed: highestConfirmedUsedIndex,
10005
9940
  highestConfirmedUsedIndex,
10006
9941
  ...truncatedAt !== void 0 && { truncatedAt },
10007
9942
  handlerErrors
@@ -10079,8 +10014,8 @@ var ContractManager = class _ContractManager {
10079
10014
  );
10080
10015
  }
10081
10016
  /** @inheritdoc */
10082
- async assertSpendableNow(vtxos, walletPubKey) {
10083
- const refused = await this.unspendableNowReasons(vtxos, walletPubKey);
10017
+ async assertSpendableNow(vtxos, walletDescriptor) {
10018
+ const refused = await this.unspendableNowReasons(vtxos, walletDescriptor);
10084
10019
  if (refused.size === 0) return;
10085
10020
  if (refused.size === 1) throw new Error([...refused.values()][0]);
10086
10021
  throw new Error(
@@ -10088,7 +10023,7 @@ var ContractManager = class _ContractManager {
10088
10023
  );
10089
10024
  }
10090
10025
  /** @inheritdoc */
10091
- async unspendableNowReasons(vtxos, walletPubKey) {
10026
+ async unspendableNowReasons(vtxos, walletDescriptor) {
10092
10027
  const refused = /* @__PURE__ */ new Map();
10093
10028
  if (vtxos.length === 0) return refused;
10094
10029
  const contracts = await this.config.contractRepository.getContracts({
@@ -10101,7 +10036,7 @@ var ContractManager = class _ContractManager {
10101
10036
  });
10102
10037
  if (asking.length === 0) return refused;
10103
10038
  const tip = await this.currentChainTip();
10104
- const walletKey = await walletPubKey?.();
10039
+ const walletDescriptorValue = await walletDescriptor?.();
10105
10040
  for (const vtxo of asking) {
10106
10041
  const contract = byScript.get(vtxo.script);
10107
10042
  const handler = contractHandlers.get(contract.type);
@@ -10111,7 +10046,7 @@ var ContractManager = class _ContractManager {
10111
10046
  currentTime: Date.now(),
10112
10047
  blockHeight: tip?.height,
10113
10048
  chainTime: tip?.time,
10114
- walletPubKey: walletKey,
10049
+ walletDescriptor: walletDescriptorValue,
10115
10050
  // `isVirtualCoin` alone is too weak here: it only asks for a
10116
10051
  // string `script`, which every AssertSpendableInput has, so a
10117
10052
  // bare outpoint would be published as a coin with no `status`.
@@ -10272,7 +10207,7 @@ var ContractManager = class _ContractManager {
10272
10207
  * @param options - Options for getting spendable paths
10273
10208
  */
10274
10209
  async getSpendablePaths(options) {
10275
- const { contractScript, collaborative = true, walletPubKey, vtxo } = options;
10210
+ const { contractScript, collaborative = true, walletDescriptor, vtxo } = options;
10276
10211
  const [contract] = await this.getContracts({ script: contractScript });
10277
10212
  if (!contract) return [];
10278
10213
  const handler = contractHandlers.get(contract.type);
@@ -10284,7 +10219,7 @@ var ContractManager = class _ContractManager {
10284
10219
  currentTime: Date.now(),
10285
10220
  blockHeight: tip?.height,
10286
10221
  chainTime: tip?.time,
10287
- walletPubKey,
10222
+ walletDescriptor,
10288
10223
  vtxo
10289
10224
  };
10290
10225
  return handler.getSpendablePaths(script, contract, context);
@@ -10300,7 +10235,7 @@ var ContractManager = class _ContractManager {
10300
10235
  * @param options - Options for getting spending paths
10301
10236
  */
10302
10237
  async getAllSpendingPaths(options) {
10303
- const { contractScript, collaborative = true, walletPubKey } = options;
10238
+ const { contractScript, collaborative = true, walletDescriptor } = options;
10304
10239
  const [contract] = await this.getContracts({ script: contractScript });
10305
10240
  if (!contract) return [];
10306
10241
  const handler = contractHandlers.get(contract.type);
@@ -10309,7 +10244,7 @@ var ContractManager = class _ContractManager {
10309
10244
  const context = {
10310
10245
  collaborative,
10311
10246
  currentTime: Date.now(),
10312
- walletPubKey
10247
+ walletDescriptor
10313
10248
  };
10314
10249
  return handler.getAllSpendingPaths(script, contract, context);
10315
10250
  }
@@ -10752,10 +10687,6 @@ var serializeUtxo = (u) => ({
10752
10687
  intentTapLeafScript: serializeTapLeaf(u.intentTapLeafScript),
10753
10688
  extraWitness: u.extraWitness?.map(hex.encode)
10754
10689
  });
10755
- var serializeTransaction = (t) => ({
10756
- ...t,
10757
- assets: serializeAssets(t.assets)
10758
- });
10759
10690
  var deserializeTapLeaf = (t) => {
10760
10691
  const cb = TaprootControlBlock.decode(hex.decode(t.cb));
10761
10692
  const s = hex.decode(t.s);
@@ -10777,10 +10708,6 @@ var deserializeUtxo = (o) => ({
10777
10708
  intentTapLeafScript: deserializeTapLeaf(o.intentTapLeafScript),
10778
10709
  extraWitness: o.extraWitness?.map(hex.decode)
10779
10710
  });
10780
- var deserializeTransaction = (o) => ({
10781
- ...o,
10782
- assets: deserializeAssets(o.assets)
10783
- });
10784
10711
 
10785
10712
  // src/repositories/indexedDB/contractRepository.ts
10786
10713
  var IndexedDBContractRepository = class {
@@ -10895,6 +10822,37 @@ function normalizeFilter(filter) {
10895
10822
  return res;
10896
10823
  }
10897
10824
 
10825
+ // src/repositories/legacyVtxoFacts.ts
10826
+ function parseLegacyExpiry(batchExpiry) {
10827
+ if (typeof batchExpiry !== "number" || !Number.isFinite(batchExpiry) || batchExpiry <= 0) {
10828
+ return {};
10829
+ }
10830
+ if (batchExpiry >= EXPIRY_MIN_PLAUSIBLE_MS) return { expiresAt: new Date(batchExpiry) };
10831
+ return { expiresAtHeight: batchExpiry / 1e3 };
10832
+ }
10833
+ function legacyVtxoFacts(status) {
10834
+ let blob = status;
10835
+ if (typeof blob === "string") {
10836
+ try {
10837
+ blob = JSON.parse(blob);
10838
+ } catch {
10839
+ return void 0;
10840
+ }
10841
+ }
10842
+ if (typeof blob !== "object" || blob === null) return void 0;
10843
+ const { state, commitmentTxIds, batchExpiry } = blob;
10844
+ if (state === void 0 && commitmentTxIds === void 0 && batchExpiry === void 0) {
10845
+ return void 0;
10846
+ }
10847
+ return {
10848
+ isSpent: state === "spent",
10849
+ isSwept: state === "swept",
10850
+ isPreconfirmed: state === "preconfirmed",
10851
+ commitmentTxIds: Array.isArray(commitmentTxIds) ? commitmentTxIds : void 0,
10852
+ ...parseLegacyExpiry(batchExpiry)
10853
+ };
10854
+ }
10855
+
10898
10856
  // src/repositories/indexedDB/walletRepository.ts
10899
10857
  var IndexedDBWalletRepository = class {
10900
10858
  version = 1;
@@ -11116,6 +11074,20 @@ function deserializeVtxoWithBackfill(o) {
11116
11074
  if (!o.script) {
11117
11075
  o = { ...o, script: scriptFromArkAddress(o.address) };
11118
11076
  }
11077
+ if (o.isSwept === void 0 && o.isPreconfirmed === void 0) {
11078
+ const facts = legacyVtxoFacts(o.virtualStatus);
11079
+ if (facts) {
11080
+ o = {
11081
+ ...o,
11082
+ isSpent: o.isSpent ?? facts.isSpent,
11083
+ isSwept: facts.isSwept,
11084
+ isPreconfirmed: facts.isPreconfirmed,
11085
+ commitmentTxIds: o.commitmentTxIds ?? facts.commitmentTxIds,
11086
+ expiresAt: o.expiresAt ?? facts.expiresAt,
11087
+ expiresAtHeight: o.expiresAtHeight ?? facts.expiresAtHeight
11088
+ };
11089
+ }
11090
+ }
11119
11091
  return deserializeVtxo(o);
11120
11092
  }
11121
11093
  function isCanonicalRow(row) {
@@ -11144,323 +11116,6 @@ function getLifecycleWeight(v) {
11144
11116
  if (v.arkTxId) weight += 2;
11145
11117
  return weight;
11146
11118
  }
11147
-
11148
- // src/repositories/migrations/walletRepositoryImpl.ts
11149
- var getVtxosStorageKey = (address) => `vtxos:${address}`;
11150
- var getUtxosStorageKey = (address) => `utxos:${address}`;
11151
- var getTransactionsStorageKey = (address) => `tx:${address}`;
11152
- var walletStateStorageKey = "wallet:state";
11153
- var WalletRepositoryImpl = class {
11154
- version = 1;
11155
- storage;
11156
- constructor(storage) {
11157
- this.storage = storage;
11158
- }
11159
- async getVtxos(address) {
11160
- const stored = await this.storage.getItem(getVtxosStorageKey(address));
11161
- if (!stored) return [];
11162
- try {
11163
- const parsed = JSON.parse(stored);
11164
- return parsed.map(deserializeVtxo);
11165
- } catch (error) {
11166
- console.error(`Failed to parse VTXOs for address ${address}:`, error);
11167
- return [];
11168
- }
11169
- }
11170
- async saveVtxos(address, vtxos) {
11171
- const storedVtxos = await this.getVtxos(address);
11172
- for (const vtxo of vtxos) {
11173
- const existing = storedVtxos.findIndex(
11174
- (v) => v.txid === vtxo.txid && v.vout === vtxo.vout
11175
- );
11176
- if (existing !== -1) {
11177
- storedVtxos[existing] = vtxo;
11178
- } else {
11179
- storedVtxos.push(vtxo);
11180
- }
11181
- }
11182
- await this.storage.setItem(
11183
- getVtxosStorageKey(address),
11184
- JSON.stringify(storedVtxos.map(serializeVtxo))
11185
- );
11186
- }
11187
- async clearVtxos(address) {
11188
- return this.deleteVtxos(address);
11189
- }
11190
- async deleteVtxos(address) {
11191
- await this.storage.removeItem(getVtxosStorageKey(address));
11192
- }
11193
- async getUtxos(address) {
11194
- const stored = await this.storage.getItem(getUtxosStorageKey(address));
11195
- if (!stored) return [];
11196
- try {
11197
- const parsed = JSON.parse(stored);
11198
- return parsed.map(deserializeUtxo);
11199
- } catch (error) {
11200
- console.error(`Failed to parse UTXOs for address ${address}:`, error);
11201
- return [];
11202
- }
11203
- }
11204
- async saveUtxos(address, utxos) {
11205
- const storedUtxos = await this.getUtxos(address);
11206
- utxos.forEach((utxo) => {
11207
- const existing = storedUtxos.findIndex(
11208
- (u) => u.txid === utxo.txid && u.vout === utxo.vout
11209
- );
11210
- if (existing !== -1) {
11211
- storedUtxos[existing] = utxo;
11212
- } else {
11213
- storedUtxos.push(utxo);
11214
- }
11215
- });
11216
- await this.storage.setItem(
11217
- getUtxosStorageKey(address),
11218
- JSON.stringify(storedUtxos.map(serializeUtxo))
11219
- );
11220
- }
11221
- async clearUtxos(address) {
11222
- return this.deleteVtxos(address);
11223
- }
11224
- async deleteUtxos(address) {
11225
- await this.storage.removeItem(getUtxosStorageKey(address));
11226
- }
11227
- async getTransactionHistory(address) {
11228
- const storageKey = getTransactionsStorageKey(address);
11229
- const stored = await this.storage.getItem(storageKey);
11230
- if (!stored) return [];
11231
- try {
11232
- const parsed = JSON.parse(stored);
11233
- return parsed.map(deserializeTransaction);
11234
- } catch (error) {
11235
- console.error(`Failed to parse transactions for address ${address}:`, error);
11236
- return [];
11237
- }
11238
- }
11239
- async saveTransactions(address, txs) {
11240
- const storedTransactions = await this.getTransactionHistory(address);
11241
- for (const tx of txs) {
11242
- const existing = storedTransactions.findIndex(
11243
- (t) => t.key.boardingTxid === tx.key.boardingTxid && t.key.commitmentTxid === tx.key.commitmentTxid && t.key.arkTxid === tx.key.arkTxid
11244
- );
11245
- if (existing !== -1) {
11246
- storedTransactions[existing] = tx;
11247
- } else {
11248
- storedTransactions.push(tx);
11249
- }
11250
- }
11251
- await this.storage.setItem(
11252
- getTransactionsStorageKey(address),
11253
- JSON.stringify(storedTransactions.map(serializeTransaction))
11254
- );
11255
- }
11256
- async clearTransactions(address) {
11257
- return this.deleteTransactions(address);
11258
- }
11259
- async deleteTransactions(address) {
11260
- await this.storage.removeItem(getTransactionsStorageKey(address));
11261
- }
11262
- async getWalletState() {
11263
- const stored = await this.storage.getItem(walletStateStorageKey);
11264
- if (!stored) return null;
11265
- try {
11266
- const state = JSON.parse(stored);
11267
- return state;
11268
- } catch (error) {
11269
- console.error("Failed to parse wallet state:", error);
11270
- return null;
11271
- }
11272
- }
11273
- async saveWalletState(state) {
11274
- await this.storage.setItem(walletStateStorageKey, JSON.stringify(state));
11275
- }
11276
- // New method added in V2, not implemented for legacy
11277
- async clear() {
11278
- throw new Error("Method not implemented.");
11279
- }
11280
- async [Symbol.asyncDispose]() {
11281
- return;
11282
- }
11283
- };
11284
-
11285
- // src/repositories/migrations/fromStorageAdapter.ts
11286
- var MIGRATION_KEY = (repoType) => `migration-from-storage-adapter-${repoType}`;
11287
- async function getMigrationStatus(repoType, storageAdapter) {
11288
- try {
11289
- const migration = await storageAdapter.getItem(MIGRATION_KEY(repoType));
11290
- if (migration === "done") return "done";
11291
- if (migration === "in-progress") return "in-progress";
11292
- return "pending";
11293
- } catch (e) {
11294
- if (e instanceof DOMException && e.name === "NotFoundError") return "not-needed";
11295
- throw e;
11296
- }
11297
- }
11298
- async function requiresMigration(repoType, storageAdapter) {
11299
- const status = await getMigrationStatus(repoType, storageAdapter);
11300
- return status === "pending" || status === "in-progress";
11301
- }
11302
- async function rollbackMigration(repoType, storageAdapter) {
11303
- await storageAdapter.removeItem(MIGRATION_KEY(repoType));
11304
- }
11305
- async function migrateWalletRepository(storageAdapter, fresh, addresses) {
11306
- const migrate = await requiresMigration("wallet", storageAdapter);
11307
- if (!migrate) return;
11308
- await storageAdapter.setItem(MIGRATION_KEY("wallet"), "in-progress");
11309
- const old = new WalletRepositoryImpl(storageAdapter);
11310
- const walletData = await old.getWalletState();
11311
- const onchainAddrData = await Promise.all(
11312
- addresses.onchain.map(async (address) => {
11313
- const utxos = await old.getUtxos(address);
11314
- return { address, utxos };
11315
- })
11316
- );
11317
- const offchainAddrData = await Promise.all(
11318
- addresses.offchain.map(async (address) => {
11319
- const vtxos = await old.getVtxos(address);
11320
- const txs = await old.getTransactionHistory(address);
11321
- return { address, vtxos, txs };
11322
- })
11323
- );
11324
- await Promise.all([
11325
- walletData && fresh.saveWalletState(walletData),
11326
- ...offchainAddrData.map(
11327
- (addressData) => Promise.all([
11328
- fresh.saveVtxos(addressData.address, addressData.vtxos),
11329
- fresh.saveTransactions(addressData.address, addressData.txs)
11330
- ])
11331
- ),
11332
- ...onchainAddrData.map(
11333
- (addressData) => fresh.saveUtxos(addressData.address, addressData.utxos)
11334
- )
11335
- ]);
11336
- await storageAdapter.setItem(MIGRATION_KEY("wallet"), "done");
11337
- }
11338
-
11339
- // src/repositories/migrations/contractRepositoryImpl.ts
11340
- var getContractStorageKey = (id, key) => `contract:${id}:${key}`;
11341
- var getCollectionStorageKey = (type) => `collection:${type}`;
11342
- var ContractRepositoryImpl = class {
11343
- storage;
11344
- constructor(storage) {
11345
- this.storage = storage;
11346
- }
11347
- get version() {
11348
- throw new TypeError(
11349
- "ContractRepositoryImpl is a migration shim and does not implement contract rows."
11350
- );
11351
- }
11352
- async getContractData(contractId, key) {
11353
- const stored = await this.storage.getItem(getContractStorageKey(contractId, key));
11354
- if (!stored) return null;
11355
- try {
11356
- const data = JSON.parse(stored);
11357
- return data;
11358
- } catch (error) {
11359
- console.error(`Failed to parse contract data for ${contractId}:${key}:`, error);
11360
- return null;
11361
- }
11362
- }
11363
- async setContractData(contractId, key, data) {
11364
- try {
11365
- await this.storage.setItem(
11366
- getContractStorageKey(contractId, key),
11367
- JSON.stringify(data)
11368
- );
11369
- } catch (error) {
11370
- console.error(`Failed to persist contract data for ${contractId}:${key}:`, error);
11371
- throw error;
11372
- }
11373
- }
11374
- async deleteContractData(contractId, key) {
11375
- try {
11376
- await this.storage.removeItem(getContractStorageKey(contractId, key));
11377
- } catch (error) {
11378
- console.error(`Failed to remove contract data for ${contractId}:${key}:`, error);
11379
- throw error;
11380
- }
11381
- }
11382
- async getContractCollection(contractType) {
11383
- const stored = await this.storage.getItem(getCollectionStorageKey(contractType));
11384
- if (!stored) return [];
11385
- try {
11386
- const collection = JSON.parse(stored);
11387
- return collection;
11388
- } catch (error) {
11389
- console.error(`Failed to parse contract collection ${contractType}:`, error);
11390
- return [];
11391
- }
11392
- }
11393
- async saveToContractCollection(contractType, item, idField) {
11394
- const collection = await this.getContractCollection(contractType);
11395
- const itemId = item[idField];
11396
- if (itemId === void 0 || itemId === null) {
11397
- throw new Error(`Item is missing required field '${String(idField)}'`);
11398
- }
11399
- const existingIndex = collection.findIndex((i) => i[idField] === itemId);
11400
- let newCollection;
11401
- if (existingIndex !== -1) {
11402
- newCollection = [
11403
- ...collection.slice(0, existingIndex),
11404
- item,
11405
- ...collection.slice(existingIndex + 1)
11406
- ];
11407
- } else {
11408
- newCollection = [...collection, item];
11409
- }
11410
- try {
11411
- await this.storage.setItem(
11412
- getCollectionStorageKey(contractType),
11413
- JSON.stringify(newCollection)
11414
- );
11415
- } catch (error) {
11416
- console.error(`Failed to persist contract collection ${contractType}:`, error);
11417
- throw error;
11418
- }
11419
- }
11420
- async removeFromContractCollection(contractType, id, idField) {
11421
- if (id === void 0 || id === null) {
11422
- throw new Error(`Invalid id provided for removal: ${String(id)}`);
11423
- }
11424
- const collection = await this.getContractCollection(contractType);
11425
- const filtered = collection.filter((item) => item[idField] !== id);
11426
- try {
11427
- await this.storage.setItem(
11428
- getCollectionStorageKey(contractType),
11429
- JSON.stringify(filtered)
11430
- );
11431
- } catch (error) {
11432
- console.error(
11433
- `Failed to persist contract collection removal for ${contractType}:`,
11434
- error
11435
- );
11436
- throw error;
11437
- }
11438
- }
11439
- // The following methods are implemented for compatibility with the new ContractRepository interface
11440
- // but aren't used.
11441
- async getContracts(_) {
11442
- throw new TypeError(
11443
- "Method not implemented, this is a legacy class and should only be used for migrating data."
11444
- );
11445
- }
11446
- async saveContract(_) {
11447
- throw new TypeError(
11448
- "Method not implemented, this is a legacy class and should only be used for migrating data."
11449
- );
11450
- }
11451
- async deleteContract(_) {
11452
- throw new TypeError(
11453
- "Method not implemented, this is a legacy class and should only be used for migrating data."
11454
- );
11455
- }
11456
- // used only for tests
11457
- async clear() {
11458
- await this.storage.clear();
11459
- }
11460
- async [Symbol.asyncDispose]() {
11461
- return;
11462
- }
11463
- };
11464
11119
  var HD_SETTINGS_KEY = "hd";
11465
11120
  var HARDENED_INDEX_OFFSET = 2147483648;
11466
11121
  var HDDescriptorProvider = class _HDDescriptorProvider {
@@ -11547,7 +11202,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11547
11202
  * simple `tr(pubkey)` descriptors.
11548
11203
  */
11549
11204
  isOurs(descriptor) {
11550
- return this.identity.isOurs(descriptor);
11205
+ return this.identity.ownsDescriptor(descriptor);
11551
11206
  }
11552
11207
  /**
11553
11208
  * Signs each request with the key derived from its descriptor. Delegates
@@ -11555,11 +11210,11 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
11555
11210
  * holds the seed.
11556
11211
  */
11557
11212
  async signWithDescriptor(requests) {
11558
- return this.identity.signWithDescriptor(requests);
11213
+ return this.identity.signDescriptorTransactions(requests);
11559
11214
  }
11560
11215
  /** Signs a message using the key derived from `descriptor`. */
11561
11216
  async signMessageWithDescriptor(descriptor, message, signatureType = "schnorr") {
11562
- return this.identity.signMessageWithDescriptor(descriptor, message, signatureType);
11217
+ return this.identity.signDescriptorMessage(descriptor, message, signatureType);
11563
11218
  }
11564
11219
  /**
11565
11220
  * HD providers participate in receive rotation. The default
@@ -12233,7 +11888,6 @@ var InputSignerRouter = class {
12233
11888
  };
12234
11889
 
12235
11890
  // src/wallet/wallet.ts
12236
- var getArkadeServerUrl = ({ arkServerUrl }) => arkServerUrl || DEFAULT_ARKADE_SERVER_URL;
12237
11891
  function intentProofJobs(coins) {
12238
11892
  if (coins.length === 0) return [];
12239
11893
  const coinJobs = coins.map((coin, i) => ({
@@ -12723,25 +12377,16 @@ var ReadonlyWallet = class _ReadonlyWallet {
12723
12377
  * Extracts common logic used by both ReadonlyWallet.create() and Wallet.create().
12724
12378
  */
12725
12379
  static async setupWalletConfig(config, pubKey) {
12726
- const arkadeServerUrl = getArkadeServerUrl(config);
12727
- const arkProvider = config.arkProvider || new RestArkProvider(arkadeServerUrl);
12380
+ const arkProvider = config.arkProvider || new RestArkProvider();
12728
12381
  let indexerProvider = config.indexerProvider;
12729
12382
  if (!indexerProvider) {
12730
- let indexerUrl = config.indexerUrl;
12731
- if (!indexerUrl) {
12732
- if (config.arkProvider) {
12733
- const derived = extractArkProviderUrl(config.arkProvider);
12734
- if (!derived) {
12735
- throw new Error(
12736
- "indexerUrl is required when arkProvider is provided without a discoverable serverUrl"
12737
- );
12738
- }
12739
- indexerUrl = derived;
12740
- } else {
12741
- indexerUrl = arkadeServerUrl;
12742
- }
12383
+ const derived = extractArkProviderUrl(arkProvider);
12384
+ if (!derived && config.arkProvider) {
12385
+ throw new Error(
12386
+ "indexerProvider is required when arkProvider is provided without a discoverable serverUrl"
12387
+ );
12743
12388
  }
12744
- indexerProvider = new RestIndexerProvider(indexerUrl);
12389
+ indexerProvider = new RestIndexerProvider(derived ?? DEFAULT_ARKADE_SERVER_URL);
12745
12390
  }
12746
12391
  const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
12747
12392
  const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
@@ -12766,8 +12411,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12766
12411
  );
12767
12412
  }
12768
12413
  }
12769
- const esploraUrl = config.esploraUrl || ESPLORA_URL[info.network];
12770
- const onchainProvider = config.onchainProvider || new EsploraProvider(esploraUrl);
12414
+ const onchainProvider = config.onchainProvider || new EsploraProvider(ESPLORA_URL[info.network]);
12771
12415
  if (config.exitTimelock) {
12772
12416
  const { value, type } = config.exitTimelock;
12773
12417
  if (value < 512n && type !== "blocks" || value >= 512n && type !== "seconds") {
@@ -12791,7 +12435,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12791
12435
  type: info.boardingExitDelay < 512n ? "blocks" : "seconds"
12792
12436
  };
12793
12437
  const serverPubKey = toXOnly(hex.decode(info.signerPubkey), "ark signer key");
12794
- const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => toXOnly(hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => toXOnly(hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12438
+ const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => toXOnly(hex.decode(info2.pubkey), "delegate key")).catch(() => void 0) : void 0;
12795
12439
  const offchainOptions = {
12796
12440
  pubKey,
12797
12441
  serverPubKey,
@@ -12818,9 +12462,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12818
12462
  info,
12819
12463
  serverInfoSource,
12820
12464
  serverInfoLastOnlineAt,
12821
- delegateProvider: config.delegateProvider || config.delegatorProvider,
12822
- /** @deprecated alias for `delegateProvider` */
12823
- delegatorProvider: config.delegateProvider || config.delegatorProvider,
12465
+ delegateProvider: config.delegateProvider,
12824
12466
  walletContractTimelocks
12825
12467
  };
12826
12468
  }
@@ -12848,7 +12490,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12848
12490
  setup.dustAmount,
12849
12491
  setup.walletRepository,
12850
12492
  setup.contractRepository,
12851
- setup.delegateProvider || setup.delegatorProvider,
12493
+ setup.delegateProvider,
12852
12494
  config.watcherConfig,
12853
12495
  setup.walletContractTimelocks
12854
12496
  );
@@ -12936,7 +12578,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
12936
12578
  * The raw reporting/recovery read: escrowed, locked and awaiting-recovery
12937
12579
  * funds are all present. Coin selection must use
12938
12580
  * {@link getSpendableVtxos} instead — feeding this straight into
12939
- * `settle({ inputs })` or `sendBitcoin({ selectedVtxos })` bypasses the
12581
+ * `settle({ inputs })` or `send({ selectedVtxos })` bypasses the
12940
12582
  * generic-spending gate.
12941
12583
  *
12942
12584
  * @param filter - Optional flags controlling whether recoverable or unrolled VTXOs are included
@@ -13205,7 +12847,6 @@ var ReadonlyWallet = class _ReadonlyWallet {
13205
12847
  },
13206
12848
  isUnrolled: true,
13207
12849
  ...boardingFacts,
13208
- virtualStatus: toVirtualStatus(boardingFacts),
13209
12850
  spentBy: "",
13210
12851
  createdAt: tx.status.confirmed ? new Date(tx.status.block_time * 1e3) : /* @__PURE__ */ new Date(0),
13211
12852
  script: scriptHex
@@ -13683,7 +13324,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
13683
13324
  }
13684
13325
  };
13685
13326
  var Wallet2 = class _Wallet extends ReadonlyWallet {
13686
- constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, renewalConfig, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, lookAheadWindow, batchExpiryPolicy, checkpointExitDelayPolicy) {
13327
+ constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, lookAheadWindow, batchExpiryPolicy, checkpointExitDelayPolicy) {
13687
13328
  super(
13688
13329
  identity,
13689
13330
  network,
@@ -13705,22 +13346,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
13705
13346
  this.batchExpiryPolicy = batchExpiryPolicy;
13706
13347
  this.checkpointExitDelayPolicy = checkpointExitDelayPolicy;
13707
13348
  this.identity = identity;
13708
- this.renewalConfig = {
13709
- enabled: renewalConfig?.enabled ?? false,
13710
- ...DEFAULT_RENEWAL_CONFIG,
13711
- ...renewalConfig
13712
- };
13713
- if (settlementConfig !== void 0) {
13714
- this.settlementConfig = settlementConfig;
13715
- } else if (renewalConfig && this.renewalConfig.enabled) {
13716
- this.settlementConfig = {
13717
- vtxoThreshold: renewalConfig.thresholdMs ? renewalConfig.thresholdMs / 1e3 : void 0
13718
- };
13719
- } else if (renewalConfig) {
13720
- this.settlementConfig = false;
13721
- } else {
13722
- this.settlementConfig = { ...DEFAULT_SETTLEMENT_CONFIG };
13723
- }
13349
+ this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
13724
13350
  this._delegateManager = delegateProvider ? new DelegateManagerImpl(delegateProvider, arkProvider, identity) : void 0;
13725
13351
  this._serverUnrollScript = serverUnrollScript;
13726
13352
  this._receiveRotator = receiveRotator;
@@ -14405,7 +14031,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14405
14031
  }
14406
14032
  /**
14407
14033
  * Async mutex that serializes all operations submitting VTXOs to the Arkade
14408
- * server (`settle`, `send`, `sendBitcoin`). This prevents VtxoManager's
14034
+ * server (`settle`, `send`). This prevents VtxoManager's
14409
14035
  * background renewal from racing with user-initiated transactions for the
14410
14036
  * same VTXO inputs.
14411
14037
  */
@@ -14535,8 +14161,6 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14535
14161
  );
14536
14162
  }
14537
14163
  }
14538
- /** @deprecated Use settlementConfig instead */
14539
- renewalConfig;
14540
14164
  settlementConfig;
14541
14165
  /**
14542
14166
  * Broadcast access bound to this wallet's server, so a plugin needs only
@@ -14565,7 +14189,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14565
14189
  return this._vtxoManagerInitializing;
14566
14190
  }
14567
14191
  this._vtxoManagerInitializing = Promise.resolve(
14568
- new VtxoManager(this, this.renewalConfig, this.settlementConfig)
14192
+ new VtxoManager(this, this.settlementConfig)
14569
14193
  );
14570
14194
  try {
14571
14195
  const manager = await this._vtxoManagerInitializing;
@@ -14661,8 +14285,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14661
14285
  setup.dustAmount,
14662
14286
  setup.walletRepository,
14663
14287
  setup.contractRepository,
14664
- config.renewalConfig,
14665
- config.delegateProvider || config.delegatorProvider,
14288
+ config.delegateProvider,
14666
14289
  config.watcherConfig,
14667
14290
  config.settlementConfig,
14668
14291
  setup.walletContractTimelocks,
@@ -14751,74 +14374,6 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14751
14374
  async getDelegateManager() {
14752
14375
  return this._delegateManager;
14753
14376
  }
14754
- /** @deprecated alias for @see Wallet.getDelegateManager */
14755
- async getDelegatorManager() {
14756
- return this.getDelegateManager();
14757
- }
14758
- /**
14759
- * Send bitcoin to an Arkade address.
14760
- *
14761
- * @deprecated Use `send`.
14762
- * @param params - Send parameters
14763
- */
14764
- async sendBitcoin(params) {
14765
- if (params.amount <= 0) {
14766
- throw new Error("Amount must be positive");
14767
- }
14768
- if (!isValidArkAddress(params.address)) {
14769
- throw new Error("Invalid Arkade address " + params.address);
14770
- }
14771
- if (params.selectedVtxos && params.selectedVtxos.length > 0) {
14772
- void this.logUngatedInputs("sendBitcoin({ selectedVtxos })", params.selectedVtxos);
14773
- return this._withTxLock(async () => {
14774
- const offchainTapscript = this.offchainTapscript;
14775
- const serverPubKey = this.arkServerPublicKey;
14776
- const serverUnrollScript = this.serverUnrollScript;
14777
- const arkAddress = offchainTapscript.address(this.network.hrp, serverPubKey);
14778
- const selectedVtxoSum = params.selectedVtxos.map((v) => v.value).reduce((a, b) => a + b, 0);
14779
- if (selectedVtxoSum < params.amount) {
14780
- throw new Error("Selected VTXOs do not cover specified amount");
14781
- }
14782
- const changeAmount = selectedVtxoSum - params.amount;
14783
- const selected = {
14784
- inputs: params.selectedVtxos,
14785
- changeAmount: BigInt(changeAmount)
14786
- };
14787
- const outputAddress = ArkAddress.decode(params.address);
14788
- assertRecipientArkadeAddress(
14789
- params.address,
14790
- outputAddress,
14791
- this.recipientAddressContext(serverPubKey)
14792
- );
14793
- const outputScript = BigInt(params.amount) < this.dustAmount ? outputAddress.subdustPkScript : outputAddress.pkScript;
14794
- const outputs = [
14795
- {
14796
- script: outputScript,
14797
- amount: BigInt(params.amount)
14798
- }
14799
- ];
14800
- if (selected.changeAmount > 0n) {
14801
- const changeOutputScript = selected.changeAmount < this.dustAmount ? arkAddress.subdustPkScript : arkAddress.pkScript;
14802
- outputs.push({
14803
- script: changeOutputScript,
14804
- amount: BigInt(selected.changeAmount)
14805
- });
14806
- }
14807
- return this._submitOffchainSpend(selected.inputs, outputs, {
14808
- sentAmount: params.amount,
14809
- changeAmount: selected.changeAmount,
14810
- changeVout: selected.changeAmount > 0n ? outputs.length - 1 : 0,
14811
- offchainTapscript,
14812
- serverPubKey,
14813
- serverUnrollScript
14814
- });
14815
- });
14816
- }
14817
- return this.send({
14818
- address: params.address,
14819
- amount: params.amount
14820
- });
14821
- }
14822
14377
  /**
14823
14378
  * Settle boarding inputs and/or virtual outputs into a finalized mainnet transaction.
14824
14379
  *
@@ -16162,7 +15717,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16162
15717
  }
16163
15718
  /**
16164
15719
  * Shared tail of every Ark-transaction spend path (`send`, selected-VTXO
16165
- * `sendBitcoin`, and {@link sendSelectedVtxosToSelf}): hide the inputs from
15720
+ * `send`, and {@link sendSelectedVtxosToSelf}): hide the inputs from
16166
15721
  * concurrent `getVtxos()`, build+submit the offchain tx, persist the spent
16167
15722
  * inputs and any wallet-owned (change / self) output, then release the
16168
15723
  * pending-spend hold. Callers own coin selection, output construction, and
@@ -16377,14 +15932,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16377
15932
  const spentBy = checkpointIdByOutpoint.get(`${vtxo.txid}:${vtxo.vout}`);
16378
15933
  spentVtxos.push({
16379
15934
  ...spentFacts,
16380
- virtualStatus: toVirtualStatus(spentFacts),
16381
15935
  ...spentBy ? { spentBy } : {},
16382
15936
  arkTxId: arkTxid
16383
15937
  });
16384
15938
  for (const id of vtxo.commitmentTxIds) {
16385
15939
  commitmentTxIds.add(id);
16386
15940
  }
16387
- const vtxoExpiry = toBatchExpiry(vtxo);
15941
+ const vtxoExpiry = vtxo.expiresAt?.getTime();
16388
15942
  if (vtxoExpiry) {
16389
15943
  batchExpiry = Math.min(batchExpiry, vtxoExpiry);
16390
15944
  }
@@ -16397,7 +15951,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16397
15951
  isSwept: false,
16398
15952
  isPreconfirmed: true,
16399
15953
  commitmentTxIds: Array.from(commitmentTxIds),
16400
- ...parseLegacyExpiry(batchExpiry)
15954
+ expiresAt: new Date(batchExpiry)
16401
15955
  };
16402
15956
  changeVtxo = {
16403
15957
  txid: arkTxid,
@@ -16409,7 +15963,6 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16409
15963
  tapTree: offchainTapscript.encode(),
16410
15964
  value: Number(changeAmount),
16411
15965
  ...changeFacts,
16412
- virtualStatus: toVirtualStatus(changeFacts),
16413
15966
  spentBy: "",
16414
15967
  status: {
16415
15968
  confirmed: false
@@ -16495,7 +16048,6 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16495
16048
  const settledFacts = { ...vtxo, isSpent: true };
16496
16049
  spentVtxos.push({
16497
16050
  ...settledFacts,
16498
- virtualStatus: toVirtualStatus(settledFacts),
16499
16051
  settledBy: commitmentTxid
16500
16052
  });
16501
16053
  } else {
@@ -16560,8 +16112,8 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16560
16112
  };
16561
16113
  function selectVirtualCoins(coins, targetAmount) {
16562
16114
  const sortedCoins = coins.map(normalizeVtxo).sort((a, b) => {
16563
- const expiryA = toBatchExpiry(a) || Number.MAX_SAFE_INTEGER;
16564
- const expiryB = toBatchExpiry(b) || Number.MAX_SAFE_INTEGER;
16115
+ const expiryA = a.expiresAt?.getTime() || Number.MAX_SAFE_INTEGER;
16116
+ const expiryB = b.expiresAt?.getTime() || Number.MAX_SAFE_INTEGER;
16565
16117
  if (expiryA !== expiryB) {
16566
16118
  return expiryA - expiryB;
16567
16119
  }
@@ -16936,16 +16488,16 @@ var MessageBus = class {
16936
16488
  contractRepository: this.contractRepository,
16937
16489
  ...this.intentRepository && { intentRepository: this.intentRepository }
16938
16490
  };
16939
- const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : config.delegatorUrl ? new RestDelegateProvider(config.delegatorUrl) : void 0;
16491
+ const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : void 0;
16492
+ const indexerProvider = new RestIndexerProvider(config.arkServer.url);
16940
16493
  const serialized = normalizeSerializedIdentity(config.wallet);
16941
16494
  if (isSigningSerialized(serialized)) {
16942
16495
  const identity2 = hydrateIdentity(serialized);
16943
16496
  const wallet = await Wallet2.create({
16944
16497
  identity: identity2,
16945
- arkServerUrl: config.arkServer.url,
16498
+ arkProvider,
16946
16499
  arkServerPublicKey: config.arkServer.publicKey,
16947
- indexerUrl: config.indexerUrl,
16948
- esploraUrl: config.esploraUrl,
16500
+ indexerProvider,
16949
16501
  storage,
16950
16502
  delegateProvider,
16951
16503
  settlementConfig: config.settlementConfig,
@@ -16960,10 +16512,9 @@ var MessageBus = class {
16960
16512
  const identity = hydrateIdentity(serialized);
16961
16513
  const readonlyWallet = await ReadonlyWallet.create({
16962
16514
  identity,
16963
- arkServerUrl: config.arkServer.url,
16515
+ arkProvider,
16964
16516
  arkServerPublicKey: config.arkServer.publicKey,
16965
- indexerUrl: config.indexerUrl,
16966
- esploraUrl: config.esploraUrl,
16517
+ indexerProvider,
16967
16518
  storage,
16968
16519
  delegateProvider,
16969
16520
  watcherConfig: config.watcherConfig
@@ -17502,7 +17053,6 @@ var DelegateNotConfiguredError = class extends Error {
17502
17053
  this.name = "DelegateNotConfiguredError";
17503
17054
  }
17504
17055
  };
17505
- var DelegatorNotConfiguredError = DelegateNotConfiguredError;
17506
17056
  var DEFAULT_MESSAGE_TAG = "WALLET_UPDATER";
17507
17057
  var serializeMigrationVtxoRef = (ref) => ({
17508
17058
  txid: ref.txid,
@@ -17749,13 +17299,6 @@ var WalletMessageHandler = class {
17749
17299
  ...response
17750
17300
  });
17751
17301
  }
17752
- case "SEND_BITCOIN": {
17753
- const response = await this.handleSendBitcoin(message);
17754
- return this.tagged({
17755
- id,
17756
- ...response
17757
- });
17758
- }
17759
17302
  case "GET_ADDRESS": {
17760
17303
  const address = await this.readonlyWallet.getAddress();
17761
17304
  return this.tagged({
@@ -18075,8 +17618,9 @@ var WalletMessageHandler = class {
18075
17618
  });
18076
17619
  }
18077
17620
  case "SEND": {
17621
+ const wallet = this.requireWallet();
18078
17622
  const { recipients, selectedVtxos } = message.payload;
18079
- const txid = await (selectedVtxos ? this.wallet.send({ recipients, selectedVtxos }) : this.wallet.send(...recipients));
17623
+ const txid = await (selectedVtxos ? wallet.send({ recipients, selectedVtxos }) : wallet.send(...recipients));
18080
17624
  return this.tagged({
18081
17625
  id,
18082
17626
  type: "SEND_SUCCESS",
@@ -18094,7 +17638,7 @@ var WalletMessageHandler = class {
18094
17638
  }
18095
17639
  case "ISSUE": {
18096
17640
  const { params } = message.payload;
18097
- const result = await this.wallet.assetManager.issue(params);
17641
+ const result = await this.requireWallet().assetManager.issue(params);
18098
17642
  return this.tagged({
18099
17643
  id,
18100
17644
  type: "ISSUE_SUCCESS",
@@ -18103,7 +17647,7 @@ var WalletMessageHandler = class {
18103
17647
  }
18104
17648
  case "REISSUE": {
18105
17649
  const { params } = message.payload;
18106
- const txid = await this.wallet.assetManager.reissue(params);
17650
+ const txid = await this.requireWallet().assetManager.reissue(params);
18107
17651
  return this.tagged({
18108
17652
  id,
18109
17653
  type: "REISSUE_SUCCESS",
@@ -18112,7 +17656,7 @@ var WalletMessageHandler = class {
18112
17656
  }
18113
17657
  case "BURN": {
18114
17658
  const { params } = message.payload;
18115
- const txid = await this.wallet.assetManager.burn(params);
17659
+ const txid = await this.requireWallet().assetManager.burn(params);
18116
17660
  return this.tagged({
18117
17661
  id,
18118
17662
  type: "BURN_SUCCESS",
@@ -18495,17 +18039,6 @@ var WalletMessageHandler = class {
18495
18039
  }
18496
18040
  return { type: "SETTLE_SUCCESS", payload: { txid } };
18497
18041
  }
18498
- async handleSendBitcoin(message) {
18499
- const wallet = this.requireWallet();
18500
- const txid = await wallet.sendBitcoin(message.payload);
18501
- if (!txid) {
18502
- throw new Error("Send bitcoin failed");
18503
- }
18504
- return {
18505
- type: "SEND_BITCOIN_SUCCESS",
18506
- payload: { txid }
18507
- };
18508
- }
18509
18042
  async handleSignTransaction(message) {
18510
18043
  const wallet = this.requireWallet();
18511
18044
  const { tx, inputIndexes } = message.payload;
@@ -18576,13 +18109,7 @@ var WalletMessageHandler = class {
18576
18109
  if (dustAmount != null && isSubdust(v, dustAmount)) {
18577
18110
  return false;
18578
18111
  }
18579
- if (isRecoverable(v)) {
18580
- return false;
18581
- }
18582
- if (isExpired(v)) {
18583
- return false;
18584
- }
18585
- return true;
18112
+ return canSpendOffchain(v, { timestamp: /* @__PURE__ */ new Date() });
18586
18113
  });
18587
18114
  }
18588
18115
  /** Tear down handler subscriptions, then delegate the full wipe to the wallet. */
@@ -18762,7 +18289,6 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
18762
18289
  // SETTLE / RECOVER_VTXOS / RENEW_VTXOS go through the streaming path and
18763
18290
  // are treated as long-running on both sides of the bus: the values below
18764
18291
  // are retained only for type completeness and are never enforced.
18765
- SEND_BITCOIN: 5e4,
18766
18292
  SEND: 5e4,
18767
18293
  SETTLE: 5e4,
18768
18294
  // Broadcast: the server round-trip a spend ends in, so it belongs
@@ -18928,13 +18454,8 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18928
18454
  // Denormalized from options so buildInitConfig() can rebuild the init
18929
18455
  // envelope on demand for SDK-factory-created wallets. `create()` sets
18930
18456
  // these immediately after construction.
18931
- arkServerUrl;
18932
- arkServerPublicKey;
18457
+ arkServer;
18933
18458
  delegateUrl;
18934
- /** @deprecated alias for @see ServiceWorkerReadonlyWallet.delegateUrl */
18935
- delegatorUrl;
18936
- indexerUrl;
18937
- esploraUrl;
18938
18459
  watcherConfig;
18939
18460
  settlementConfig;
18940
18461
  reinitPromise = null;
@@ -18965,16 +18486,10 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18965
18486
  messageTag
18966
18487
  );
18967
18488
  const serializedWallet = await serializeReadonlyIdentity(options.identity);
18968
- const publicKey = await options.identity.compressedPublicKey().then(hex.encode);
18489
+ const arkServer = options.arkServer ?? { url: "https://arkade.computer" };
18969
18490
  const initWalletPayload = {
18970
- key: { publicKey },
18971
- arkServerUrl: getArkadeServerUrl(options),
18972
- arkServerPublicKey: options.arkServerPublicKey,
18973
- delegateUrl: options.delegateUrl || options.delegatorUrl,
18974
- // Keep the deprecated field populated so pre-#519 service workers
18975
- // (which only read delegatorUrl) keep delegating until they activate
18976
- // a newer version.
18977
- delegatorUrl: options.delegateUrl || options.delegatorUrl
18491
+ arkServerUrl: arkServer.url,
18492
+ arkServerPublicKey: arkServer.publicKey
18978
18493
  };
18979
18494
  const messageTimeouts = options.messageTimeouts ? {
18980
18495
  ...DEFAULT_MESSAGE_TIMEOUTS,
@@ -18982,17 +18497,8 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
18982
18497
  } : DEFAULT_MESSAGE_TIMEOUTS;
18983
18498
  const busInitConfig = {
18984
18499
  wallet: serializedWallet,
18985
- arkServer: {
18986
- url: getArkadeServerUrl(options),
18987
- publicKey: options.arkServerPublicKey
18988
- },
18989
- delegateUrl: options.delegateUrl || options.delegatorUrl,
18990
- // Keep the deprecated field populated so pre-#519 service workers
18991
- // (which only read delegatorUrl) keep delegating until they activate
18992
- // a newer version.
18993
- delegatorUrl: options.delegateUrl || options.delegatorUrl,
18994
- indexerUrl: options.indexerUrl,
18995
- esploraUrl: options.esploraUrl,
18500
+ arkServer,
18501
+ delegateUrl: options.delegateUrl,
18996
18502
  watcherConfig: options.watcherConfig,
18997
18503
  messageTimeouts
18998
18504
  };
@@ -19025,7 +18531,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19025
18531
  * ```typescript
19026
18532
  * const wallet = await ServiceWorkerReadonlyWallet.setup({
19027
18533
  * serviceWorkerPath: '/service-worker.js',
19028
- * arkServerUrl: 'https://arkade.computer',
18534
+ * arkServer: { url: 'https://arkade.computer' },
19029
18535
  * identity: ReadonlySingleKey.fromPublicKey('your_public_key_hex')
19030
18536
  * });
19031
18537
  * ```
@@ -19194,23 +18700,14 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19194
18700
  */
19195
18701
  async buildInitConfig() {
19196
18702
  if (this.initConfig) return this.initConfig;
19197
- if (!this.arkServerUrl) {
18703
+ if (!this.arkServer) {
19198
18704
  throw new Error("Cannot re-initialize: wallet was not initialized via the SDK factory");
19199
18705
  }
19200
18706
  const wallet = await this.serializeIdentity();
19201
18707
  this.initConfig = {
19202
18708
  wallet,
19203
- arkServer: {
19204
- url: this.arkServerUrl,
19205
- publicKey: this.arkServerPublicKey
19206
- },
19207
- delegateUrl: this.delegateUrl || this.delegatorUrl,
19208
- // Keep the deprecated field populated so pre-#519 service workers
19209
- // (which only read delegatorUrl) keep delegating until they activate
19210
- // a newer version.
19211
- delegatorUrl: this.delegateUrl || this.delegatorUrl,
19212
- indexerUrl: this.indexerUrl,
19213
- esploraUrl: this.esploraUrl,
18709
+ arkServer: this.arkServer,
18710
+ delegateUrl: this.delegateUrl,
19214
18711
  watcherConfig: this.watcherConfig,
19215
18712
  settlementConfig: this.settlementConfig
19216
18713
  };
@@ -19219,14 +18716,12 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
19219
18716
  /** Minimal INIT_WALLET payload used on reinitialize when the cache is gone. */
19220
18717
  buildInitWalletPayload() {
19221
18718
  if (this.initWalletPayload) return this.initWalletPayload;
19222
- if (!this.arkServerUrl) {
18719
+ if (!this.arkServer) {
19223
18720
  throw new Error("Cannot re-initialize: wallet was not initialized via the SDK factory");
19224
18721
  }
19225
18722
  this.initWalletPayload = {
19226
- // `key` is deprecated and ignored by the current handler.
19227
- key: {},
19228
- arkServerUrl: this.arkServerUrl,
19229
- arkServerPublicKey: this.arkServerPublicKey
18723
+ arkServerUrl: this.arkServer.url,
18724
+ arkServerPublicKey: this.arkServer.publicKey
19230
18725
  };
19231
18726
  return this.initWalletPayload;
19232
18727
  }
@@ -19840,18 +19335,12 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19840
19335
  walletRepository,
19841
19336
  contractRepository,
19842
19337
  messageTag,
19843
- !!(options.delegateUrl || options.delegatorUrl)
19338
+ !!options.delegateUrl
19844
19339
  );
19845
- const legacyPrivateKey = serializedWallet.type === "single-key" ? serializedWallet.privateKey : null;
19340
+ const arkServer = options.arkServer ?? { url: "https://arkade.computer" };
19846
19341
  const initWalletPayload = {
19847
- key: legacyPrivateKey ? { privateKey: legacyPrivateKey } : {},
19848
- arkServerUrl: getArkadeServerUrl(options),
19849
- arkServerPublicKey: options.arkServerPublicKey,
19850
- delegateUrl: options.delegateUrl || options.delegatorUrl,
19851
- // Keep the deprecated field populated so pre-#519 service workers
19852
- // (which only read delegatorUrl) keep delegating until they activate
19853
- // a newer version.
19854
- delegatorUrl: options.delegateUrl || options.delegatorUrl
19342
+ arkServerUrl: arkServer.url,
19343
+ arkServerPublicKey: arkServer.publicKey
19855
19344
  };
19856
19345
  const messageTimeouts = options.messageTimeouts ? {
19857
19346
  ...DEFAULT_MESSAGE_TIMEOUTS,
@@ -19859,17 +19348,8 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19859
19348
  } : DEFAULT_MESSAGE_TIMEOUTS;
19860
19349
  const busInitConfig = {
19861
19350
  wallet: serializedWallet,
19862
- arkServer: {
19863
- url: getArkadeServerUrl(options),
19864
- publicKey: options.arkServerPublicKey
19865
- },
19866
- delegateUrl: options.delegateUrl || options.delegatorUrl,
19867
- // Keep the deprecated field populated so pre-#519 service workers
19868
- // (which only read delegatorUrl) keep delegating until they activate
19869
- // a newer version.
19870
- delegatorUrl: options.delegateUrl || options.delegatorUrl,
19871
- indexerUrl: options.indexerUrl,
19872
- esploraUrl: options.esploraUrl,
19351
+ arkServer,
19352
+ delegateUrl: options.delegateUrl,
19873
19353
  settlementConfig: options.settlementConfig,
19874
19354
  walletMode: options.walletMode,
19875
19355
  watcherConfig: options.watcherConfig,
@@ -19905,7 +19385,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19905
19385
  * ```typescript
19906
19386
  * const wallet = await ServiceWorkerWallet.setup({
19907
19387
  * serviceWorkerPath: '/service-worker.js',
19908
- * arkServerUrl: 'https://arkade.computer',
19388
+ * arkServer: { url: 'https://arkade.computer' },
19909
19389
  * identity: MnemonicIdentity.fromMnemonic('abandon abandon...')
19910
19390
  * });
19911
19391
  * ```
@@ -20068,20 +19548,6 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
20068
19548
  }
20069
19549
  };
20070
19550
  }
20071
- async sendBitcoin(params) {
20072
- const message = {
20073
- id: getRandomId(),
20074
- tag: this.messageTag,
20075
- type: "SEND_BITCOIN",
20076
- payload: params
20077
- };
20078
- try {
20079
- const response = await this.sendMessage(message);
20080
- return response.payload.txid;
20081
- } catch (error) {
20082
- throw new Error(`Failed to send bitcoin: ${error}`);
20083
- }
20084
- }
20085
19551
  async settle(params, callback) {
20086
19552
  const message = {
20087
19553
  id: getRandomId(),
@@ -20199,10 +19665,6 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
20199
19665
  };
20200
19666
  return manager;
20201
19667
  }
20202
- /** @deprecated alias for @see ServiceWorkerWallet.getDelegateManager */
20203
- async getDelegatorManager() {
20204
- return await this.getDelegateManager();
20205
- }
20206
19668
  async getVtxoManager() {
20207
19669
  const wallet = this;
20208
19670
  const messageTag = this.messageTag;
@@ -21863,8 +21325,7 @@ async function resolveUnilateralPath(params) {
21863
21325
  const paths = handler.getAllSpendingPaths(script, contract, {
21864
21326
  collaborative: false,
21865
21327
  currentTime: params.currentTime,
21866
- walletDescriptor: params.walletDescriptor,
21867
- walletPubKey: params.walletPubKeyHex
21328
+ walletDescriptor: params.walletDescriptor
21868
21329
  }).filter((p) => p.sequence !== void 0);
21869
21330
  if (paths.length === 0) {
21870
21331
  throw new ExitPathError(
@@ -22113,7 +21574,6 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
22113
21574
  vtxo,
22114
21575
  scriptHex: hex.encode(VtxoScript.decode(vtxo.tapTree).pkScript),
22115
21576
  contractRepository: wallet.contractRepository,
22116
- walletPubKeyHex: hex.encode(await wallet.identity.xOnlyPublicKey()),
22117
21577
  currentTime: Date.now()
22118
21578
  });
22119
21579
  const spendingLeaf = resolved.selection.leaf;
@@ -22352,7 +21812,7 @@ async function computeExitLayout(opts, feeRate) {
22352
21812
  (s) => s.parent.id,
22353
21813
  (s) => parentInputTxids(s.parent)
22354
21814
  );
22355
- const walletPubKeyHex = hex.encode(await wallet.identity.xOnlyPublicKey());
21815
+ const walletDescriptor = hex.encode(await wallet.identity.xOnlyPublicKey());
22356
21816
  const infos = [];
22357
21817
  const sweeps = [];
22358
21818
  for (const vtxo of vtxos) {
@@ -22362,7 +21822,7 @@ async function computeExitLayout(opts, feeRate) {
22362
21822
  vtxo,
22363
21823
  scriptHex: hex.encode(VtxoScript.decode(vtxo.tapTree).pkScript),
22364
21824
  contractRepository: wallet.contractRepository,
22365
- walletPubKeyHex,
21825
+ walletDescriptor,
22366
21826
  currentTime: Date.now()
22367
21827
  });
22368
21828
  const sweepFee = sweepFeeFor(
@@ -23150,7 +22610,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
23150
22610
  boardingIndices.push(boardingIdx);
23151
22611
  continue;
23152
22612
  }
23153
- if (isRecoverable(input) || isSubdust(input, info.dust)) {
22613
+ if (canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust(input, info.dust)) {
23154
22614
  continue;
23155
22615
  }
23156
22616
  if (connectorIndex >= connectorLeaves.length) {
@@ -24080,6 +23540,7 @@ function arkAssetRail() {
24080
23540
  }
24081
23541
  };
24082
23542
  }
23543
+ var walletFeeSource = (wallet) => async () => (await wallet.arkProvider.getInfo()).fees;
24083
23544
  var GROSS_UP_MAX_ROUNDS = 8;
24084
23545
  function grossUpOffboard(net, feeInfo, script) {
24085
23546
  const estimator = new Estimator(feeInfo?.intentFee ?? {});
@@ -24092,7 +23553,10 @@ function grossUpOffboard(net, feeInfo, script) {
24092
23553
  }
24093
23554
  return { gross, fee: gross - net };
24094
23555
  }
24095
- function onchainRail() {
23556
+ function onchainRail(deps) {
23557
+ if (typeof deps?.feeInfo !== "function") {
23558
+ throw new Error("onchain rail: a feeInfo source is required");
23559
+ }
24096
23560
  return {
24097
23561
  id: "onchain",
24098
23562
  match: (req) => btcTarget(req.raw) !== void 0,
@@ -24102,7 +23566,7 @@ function onchainRail() {
24102
23566
  assertNoAssets("onchain", req);
24103
23567
  const address = btcTarget(req.raw);
24104
23568
  const amt = resolveSendAmount("onchain", req.raw, req.amount);
24105
- const { fees } = await ctx.wallet.arkProvider.getInfo();
23569
+ const fees = await deps.feeInfo();
24106
23570
  const script = hex.encode(offboardDestinationScript(address));
24107
23571
  const { gross, fee } = grossUpOffboard(amt, fees, script);
24108
23572
  return {
@@ -24130,7 +23594,7 @@ function createDefaultPaymentRouter(wallet) {
24130
23594
  return new PaymentRouter({
24131
23595
  wallet,
24132
23596
  prefs: { priority: ["ark", "ark-asset", "onchain"] }
24133
- }).use(arkRail()).use(arkAssetRail()).use(onchainRail());
23597
+ }).use(arkRail()).use(arkAssetRail()).use(onchainRail({ feeInfo: walletFeeSource(wallet) }));
24134
23598
  }
24135
23599
  /*! Bundled license information:
24136
23600
 
@@ -24138,6 +23602,6 @@ function createDefaultPaymentRouter(wallet) {
24138
23602
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
24139
23603
  */
24140
23604
 
24141
- 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, assertRecipientArkadeAddress, 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, 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, requiresMigration, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript, withPrevTxs };
24142
- //# sourceMappingURL=chunk-ZRNQV6HV.js.map
24143
- //# sourceMappingURL=chunk-ZRNQV6HV.js.map
23605
+ 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, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, 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, 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, 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, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertNoAssets, assertRecipientArkadeAddress, 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, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, isWatchedContract, legacyVtxoFacts, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, warnAndFilterVtxosForScript, withPrevTxs };
23606
+ //# sourceMappingURL=chunk-PYTAH2NY.js.map
23607
+ //# sourceMappingURL=chunk-PYTAH2NY.js.map