@arkade-os/sdk 0.5.0-rc.7 → 0.5.0-rc.9

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 (72) hide show
  1. package/README.md +29 -0
  2. package/dist/adapters/expo.cjs +5 -5
  3. package/dist/adapters/expo.d.cts +2 -2
  4. package/dist/adapters/expo.d.ts +2 -2
  5. package/dist/adapters/expo.js +3 -3
  6. package/dist/{asyncStorageTaskQueue-BHOhjFiF.d.cts → asyncStorageTaskQueue-ChKX-D51.d.cts} +1 -1
  7. package/dist/{asyncStorageTaskQueue-BedBOEpT.d.ts → asyncStorageTaskQueue-DZYrAWN8.d.ts} +1 -1
  8. package/dist/{chunk-7B2QAHQU.js → chunk-3TCWQPAC.js} +251 -41
  9. package/dist/chunk-3TCWQPAC.js.map +1 -0
  10. package/dist/{chunk-XIPWLWPU.cjs → chunk-7OL2P5TV.cjs} +17 -17
  11. package/dist/{chunk-XIPWLWPU.cjs.map → chunk-7OL2P5TV.cjs.map} +1 -1
  12. package/dist/{chunk-4MB3Z33G.js → chunk-FQCMEAWN.js} +4 -4
  13. package/dist/{chunk-4MB3Z33G.js.map → chunk-FQCMEAWN.js.map} +1 -1
  14. package/dist/{chunk-2JU54RGB.js → chunk-J2K7WWMJ.js} +3 -3
  15. package/dist/{chunk-2JU54RGB.js.map → chunk-J2K7WWMJ.js.map} +1 -1
  16. package/dist/{chunk-H7KLBU6G.js → chunk-JFZBKPSV.js} +4 -4
  17. package/dist/{chunk-H7KLBU6G.js.map → chunk-JFZBKPSV.js.map} +1 -1
  18. package/dist/{chunk-EIMOVGBV.cjs → chunk-PKD5VPYX.cjs} +678 -467
  19. package/dist/chunk-PKD5VPYX.cjs.map +1 -0
  20. package/dist/{chunk-VUR6RP73.cjs → chunk-PO2ZDZZC.cjs} +10 -10
  21. package/dist/{chunk-VUR6RP73.cjs.map → chunk-PO2ZDZZC.cjs.map} +1 -1
  22. package/dist/{chunk-L6MGV7ZA.js → chunk-R4KRWX7R.js} +3 -3
  23. package/dist/{chunk-L6MGV7ZA.js.map → chunk-R4KRWX7R.js.map} +1 -1
  24. package/dist/{chunk-XOT73T36.cjs → chunk-V4JZOFYT.cjs} +18 -18
  25. package/dist/{chunk-XOT73T36.cjs.map → chunk-V4JZOFYT.cjs.map} +1 -1
  26. package/dist/{chunk-A2T3GGAK.cjs → chunk-VMVHRKXM.cjs} +50 -50
  27. package/dist/{chunk-A2T3GGAK.cjs.map → chunk-VMVHRKXM.cjs.map} +1 -1
  28. package/dist/{chunk-GLLBSULU.cjs → chunk-VTXMC4N7.cjs} +3 -3
  29. package/dist/{chunk-GLLBSULU.cjs.map → chunk-VTXMC4N7.cjs.map} +1 -1
  30. package/dist/{chunk-LFIORZO3.js → chunk-Z3QM5XFY.js} +4 -4
  31. package/dist/{chunk-LFIORZO3.js.map → chunk-Z3QM5XFY.js.map} +1 -1
  32. package/dist/contracts/handlers/index.cjs +9 -9
  33. package/dist/contracts/handlers/index.d.cts +3 -3
  34. package/dist/contracts/handlers/index.d.ts +3 -3
  35. package/dist/contracts/handlers/index.js +2 -2
  36. package/dist/{delegate-Hl92NVgS.d.ts → delegate-CyBnNY9v.d.ts} +1 -1
  37. package/dist/{delegate-Dv8aEvSp.d.cts → delegate-Cyv2suFd.d.cts} +1 -1
  38. package/dist/{hdWalletCapable-QiCK1B9d.d.cts → hdWalletCapable-D1ImQqlu.d.cts} +3 -3
  39. package/dist/{hdWalletCapable-Bqcb-XtC.d.ts → hdWalletCapable-DvumVrKW.d.ts} +3 -3
  40. package/dist/{index-F-X4BWxi.d.cts → index-BIL9boGL.d.cts} +14 -1
  41. package/dist/{index-F-X4BWxi.d.ts → index-BIL9boGL.d.ts} +14 -1
  42. package/dist/{index-CeC9FiJt.d.cts → index-DleNQcz5.d.cts} +3 -3
  43. package/dist/{index-BwEO0Yb-.d.ts → index-QVhQgYvU.d.ts} +3 -3
  44. package/dist/index.cjs +294 -290
  45. package/dist/index.d.cts +20 -9
  46. package/dist/index.d.ts +20 -9
  47. package/dist/index.js +4 -4
  48. package/dist/repositories/realm/index.cjs +20 -20
  49. package/dist/repositories/realm/index.d.cts +2 -2
  50. package/dist/repositories/realm/index.d.ts +2 -2
  51. package/dist/repositories/realm/index.js +5 -5
  52. package/dist/repositories/sqlite/index.cjs +19 -19
  53. package/dist/repositories/sqlite/index.d.cts +2 -2
  54. package/dist/repositories/sqlite/index.d.ts +2 -2
  55. package/dist/repositories/sqlite/index.js +5 -5
  56. package/dist/{taskRunner-BdU_d__J.d.ts → taskRunner-Cu4uO1to.d.ts} +2 -2
  57. package/dist/{taskRunner-CDCz7MTW.d.cts → taskRunner-DxpSuKmh.d.cts} +2 -2
  58. package/dist/wallet/expo/background.cjs +14 -14
  59. package/dist/wallet/expo/background.d.cts +3 -3
  60. package/dist/wallet/expo/background.d.ts +3 -3
  61. package/dist/wallet/expo/background.js +6 -6
  62. package/dist/wallet/expo/index.cjs +14 -14
  63. package/dist/wallet/expo/index.d.cts +4 -4
  64. package/dist/wallet/expo/index.d.ts +4 -4
  65. package/dist/wallet/expo/index.js +5 -5
  66. package/dist/worker/expo/index.cjs +9 -9
  67. package/dist/worker/expo/index.d.cts +4 -4
  68. package/dist/worker/expo/index.d.ts +4 -4
  69. package/dist/worker/expo/index.js +5 -5
  70. package/package.json +1 -1
  71. package/dist/chunk-7B2QAHQU.js.map +0 -1
  72. package/dist/chunk-EIMOVGBV.cjs.map +0 -1
package/README.md CHANGED
@@ -1371,6 +1371,35 @@ const swWallet = await ServiceWorkerWallet.setup({
1371
1371
 
1372
1372
  Raise it when the external issuer is expected to burn more than `N` consecutive addresses without any of them being paid — every index in such a run is a miss, and the funded one sits past the band. When that happens the funds are invisible until a `restore()` whose `gapLimit` is large enough to cross the run (`wallet.restore({ gapLimit: 200 })`); a default restore closes its gap window before reaching the funded index. Keep the value modest: the band adds up to `2N + 1` indices × the candidate matrix (typically 1-4 scripts each) to the wallet's subscription.
1373
1373
 
1374
+ #### Restoring plugin state
1375
+
1376
+ `wallet.restore()` is the explicit imported-wallet recovery boundary. It first restores the
1377
+ wallet's own addresses, contracts, history, and balances, then runs every restore hook registered
1378
+ for that wallet instance. `Wallet` and `ServiceWorkerWallet` both follow this ordering, and
1379
+ concurrent calls coalesce until the hooks finish.
1380
+
1381
+ ```typescript
1382
+ import { registerWalletRestoreHook } from '@arkade-os/sdk'
1383
+
1384
+ const unregister = registerWalletRestoreHook(wallet, {
1385
+ id: 'my-plugin',
1386
+ restore: async (restoredWallet) => {
1387
+ await rebuildPluginState(await restoredWallet.getTransactionHistory())
1388
+ },
1389
+ })
1390
+
1391
+ await wallet.restore()
1392
+ ```
1393
+
1394
+ Registering the same `id` again replaces that hook without changing its position. A run uses a
1395
+ stable snapshot, attempts every hook in registration order, and throws an `AggregateError` after
1396
+ all failures have been collected. If core recovery fails, hooks do not run. The returned function
1397
+ removes only that exact registration and is safe to call more than once.
1398
+
1399
+ Hooks do not run during `Wallet.create()`, `ServiceWorkerWallet.setup()`, or ordinary startup. A
1400
+ plugin should register before an application calls `restore()` and keep its normal incremental
1401
+ reconciliation for state that arrives later.
1402
+
1374
1403
  For advanced use cases, you can access the ContractManager directly to register external contracts:
1375
1404
 
1376
1405
  ```typescript
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkXIPWLWPU_cjs = require('../chunk-XIPWLWPU.cjs');
4
- require('../chunk-XOT73T36.cjs');
5
- require('../chunk-GLLBSULU.cjs');
3
+ var chunk7OL2P5TV_cjs = require('../chunk-7OL2P5TV.cjs');
4
+ require('../chunk-V4JZOFYT.cjs');
5
+ require('../chunk-VTXMC4N7.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "ExpoArkProvider", {
10
10
  enumerable: true,
11
- get: function () { return chunkXIPWLWPU_cjs.ExpoArkProvider; }
11
+ get: function () { return chunk7OL2P5TV_cjs.ExpoArkProvider; }
12
12
  });
13
13
  Object.defineProperty(exports, "ExpoIndexerProvider", {
14
14
  enumerable: true,
15
- get: function () { return chunkXIPWLWPU_cjs.ExpoIndexerProvider; }
15
+ get: function () { return chunk7OL2P5TV_cjs.ExpoIndexerProvider; }
16
16
  });
17
17
  //# sourceMappingURL=expo.cjs.map
18
18
  //# sourceMappingURL=expo.cjs.map
@@ -1,5 +1,5 @@
1
- import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-F-X4BWxi.cjs';
2
- export { t as ArkProvider, u as IndexerProvider } from '../index-F-X4BWxi.cjs';
1
+ import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-BIL9boGL.cjs';
2
+ export { t as ArkProvider, u as IndexerProvider } from '../index-BIL9boGL.cjs';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
@@ -1,5 +1,5 @@
1
- import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-F-X4BWxi.js';
2
- export { t as ArkProvider, u as IndexerProvider } from '../index-F-X4BWxi.js';
1
+ import { q as RestArkProvider, n as SettlementEvent, T as TxNotificationEvent, r as RestIndexerProvider, s as SubscriptionResponse } from '../index-BIL9boGL.js';
2
+ export { t as ArkProvider, u as IndexerProvider } from '../index-BIL9boGL.js';
3
3
  import '@scure/btc-signer/utils.js';
4
4
  import '@scure/btc-signer/transaction.js';
5
5
  import '@scure/btc-signer';
@@ -1,5 +1,5 @@
1
- export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-4MB3Z33G.js';
2
- import '../chunk-2JU54RGB.js';
3
- import '../chunk-H7KLBU6G.js';
1
+ export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-FQCMEAWN.js';
2
+ import '../chunk-J2K7WWMJ.js';
3
+ import '../chunk-JFZBKPSV.js';
4
4
  //# sourceMappingURL=expo.js.map
5
5
  //# sourceMappingURL=expo.js.map
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, b as TaskItem, c as TaskResult } from './taskRunner-CDCz7MTW.cjs';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-DxpSuKmh.cjs';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,4 +1,4 @@
1
- import { a as TaskQueue, b as TaskItem, c as TaskResult } from './taskRunner-BdU_d__J.js';
1
+ import { a as TaskQueue, c as TaskItem, d as TaskResult } from './taskRunner-Cu4uO1to.js';
2
2
 
3
3
  /**
4
4
  * Minimal async key-value storage interface.
@@ -1,6 +1,6 @@
1
- import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-2JU54RGB.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-L6MGV7ZA.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, getAllNormalizedVtxos, isPastExpiry, isRetryableProviderError, DEFAULT_PAGE_SIZE, RestArkProvider, DEFAULT_ARKADE_SERVER_URL, networkFromArkadeInfo, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, INFO_FETCH_TIMEOUT_MS, PrevoutTxField, fetchVtxoCreatedAtByTxid, EXPIRY_MIN_PLAUSIBLE_MS, ProviderUnavailableError, networks as networks$1 } from './chunk-H7KLBU6G.js';
1
+ import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-J2K7WWMJ.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-R4KRWX7R.js';
3
+ import { VtxoScript, __export, Transaction, canRecoverOnchain, 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, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, getNetwork, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, getAllNormalizedVtxos, isPastExpiry, isRetryableProviderError, DEFAULT_PAGE_SIZE, RestArkProvider, DEFAULT_ARKADE_SERVER_URL, networkFromArkadeInfo, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, INFO_FETCH_TIMEOUT_MS, PrevoutTxField, fetchVtxoCreatedAtByTxid, EXPIRY_MIN_PLAUSIBLE_MS, ProviderUnavailableError, networks as networks$1 } from './chunk-JFZBKPSV.js';
4
4
  import { sha256 as sha256$1, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
5
5
  import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
6
6
  import { hex, base58, base64, bech32m } from '@scure/base';
@@ -2657,6 +2657,12 @@ var ErrOnchainOutputNotFound = (address) => new ServerResponseMismatchError(`onc
2657
2657
  var ErrUnvalidatedOffchainOutput = (address) => new ServerResponseMismatchError(
2658
2658
  `offchain output ${address} cannot be validated: virtual output tree signing did not run`
2659
2659
  );
2660
+ var ErrIntentOutputNotFound = (index, kind) => new ServerResponseMismatchError(
2661
+ `${kind} output ${index} of the intent proof is not present in what the server built`
2662
+ );
2663
+ var ErrUnvalidatedIntentOutput = (index) => new ServerResponseMismatchError(
2664
+ `offchain output ${index} of the intent proof cannot be validated: virtual output tree signing did not run`
2665
+ );
2660
2666
  var ErrInvalidOnchainOutputAmount = (address) => new Error(`invalid onchain output amount: ${address}`);
2661
2667
  var ErrInvalidOnchainOutputAssets = (address) => new Error(`onchain output ${address} cannot have assets`);
2662
2668
  var ErrInvalidOffchainOutputAmount = (address) => new Error(`invalid offchain output ${address}, missing amount`);
@@ -2693,6 +2699,74 @@ function validateBatchRecipientsWithoutTree(commitmentTx, recipients, network) {
2693
2699
  throw ErrUnvalidatedOffchainOutput(recipient.address);
2694
2700
  }
2695
2701
  }
2702
+ function declaredIntentOutputs(signedProof, onchainOutputIndexes) {
2703
+ const proof = Transaction.fromPSBT(base64.decode(signedProof));
2704
+ const onchain = new Set(onchainOutputIndexes);
2705
+ const declared = [];
2706
+ for (let i = 0; i < proof.outputsLength; i++) {
2707
+ const output = proof.getOutput(i);
2708
+ if (!output?.script || output.script.length === 0 || !output.amount) continue;
2709
+ declared.push({
2710
+ index: i,
2711
+ script: output.script,
2712
+ amount: output.amount,
2713
+ onchain: onchain.has(i)
2714
+ });
2715
+ }
2716
+ return declared;
2717
+ }
2718
+ function validateBatchAgainstIntent(commitmentTx, vtxoTreeLeaves, declared) {
2719
+ const usedOnchain = /* @__PURE__ */ new Set();
2720
+ const usedLeaf = /* @__PURE__ */ new Set();
2721
+ for (const output of declared) {
2722
+ if (output.onchain) {
2723
+ if (!takeOnchainOutput(commitmentTx, output, usedOnchain)) {
2724
+ throw ErrIntentOutputNotFound(output.index, "onchain");
2725
+ }
2726
+ continue;
2727
+ }
2728
+ if (!takeLeafOutput(vtxoTreeLeaves, output, usedLeaf)) {
2729
+ throw ErrIntentOutputNotFound(output.index, "offchain");
2730
+ }
2731
+ }
2732
+ }
2733
+ function validateBatchAgainstIntentWithoutTree(commitmentTx, declared) {
2734
+ const usedOnchain = /* @__PURE__ */ new Set();
2735
+ for (const output of declared) {
2736
+ if (!output.onchain) {
2737
+ throw ErrUnvalidatedIntentOutput(output.index);
2738
+ }
2739
+ if (!takeOnchainOutput(commitmentTx, output, usedOnchain)) {
2740
+ throw ErrIntentOutputNotFound(output.index, "onchain");
2741
+ }
2742
+ }
2743
+ }
2744
+ function takeOnchainOutput(commitmentTx, declared, used) {
2745
+ for (let i = 0; i < commitmentTx.outputsLength; i++) {
2746
+ if (used.has(i)) continue;
2747
+ const output = commitmentTx.getOutput(i);
2748
+ if (!output?.script || output.amount !== declared.amount) continue;
2749
+ if (!equalBytes(output.script, declared.script)) continue;
2750
+ used.add(i);
2751
+ return true;
2752
+ }
2753
+ return false;
2754
+ }
2755
+ function takeLeafOutput(leaves, declared, used) {
2756
+ for (let leafIdx = 0; leafIdx < leaves.length; leafIdx++) {
2757
+ const leaf = leaves[leafIdx];
2758
+ for (let i = 0; i < leaf.outputsLength; i++) {
2759
+ const key = `${leafIdx}:${i}`;
2760
+ if (used.has(key)) continue;
2761
+ const output = leaf.getOutput(i);
2762
+ if (!output?.script || output.amount !== declared.amount) continue;
2763
+ if (!equalBytes(output.script, declared.script)) continue;
2764
+ used.add(key);
2765
+ return true;
2766
+ }
2767
+ }
2768
+ return false;
2769
+ }
2696
2770
  function validateOnchainRecipient(commitmentTx, recipient, network, usedOutputs) {
2697
2771
  const addr = Address(network).decode(recipient.address);
2698
2772
  const expectedPkScript = OutScript.encode(addr);
@@ -2942,6 +3016,39 @@ function createDefaultActivityRegistry() {
2942
3016
  return registry;
2943
3017
  }
2944
3018
 
3019
+ // src/wallet/restoreHooks.ts
3020
+ var restoreHooks = /* @__PURE__ */ new WeakMap();
3021
+ function registerWalletRestoreHook(wallet, hook) {
3022
+ const hooks = restoreHooks.get(wallet) ?? [];
3023
+ const entry = { ...hook };
3024
+ const existing = hooks.findIndex(({ id }) => id === hook.id);
3025
+ if (existing === -1) hooks.push(entry);
3026
+ else hooks[existing] = entry;
3027
+ restoreHooks.set(wallet, hooks);
3028
+ return () => {
3029
+ const current = restoreHooks.get(wallet);
3030
+ if (!current) return;
3031
+ const index = current.indexOf(entry);
3032
+ if (index === -1) return;
3033
+ current.splice(index, 1);
3034
+ if (current.length === 0) restoreHooks.delete(wallet);
3035
+ };
3036
+ }
3037
+ async function runWalletRestoreHooks(wallet) {
3038
+ const snapshot = [...restoreHooks.get(wallet) ?? []];
3039
+ const errors = [];
3040
+ for (const hook of snapshot) {
3041
+ try {
3042
+ await hook.restore(wallet);
3043
+ } catch (error) {
3044
+ errors.push(error);
3045
+ }
3046
+ }
3047
+ if (errors.length > 0) {
3048
+ throw new AggregateError(errors, "Wallet restore hooks failed");
3049
+ }
3050
+ }
3051
+
2945
3052
  // src/wallet/index.ts
2946
3053
  var TxType = /* @__PURE__ */ ((TxType2) => {
2947
3054
  TxType2["TxSent"] = "SENT";
@@ -3422,21 +3529,38 @@ function assertSubmittedArkTxid(response, signedArkTx, context) {
3422
3529
  );
3423
3530
  }
3424
3531
  }
3425
- function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeyHex, context) {
3532
+ function assertServerSignedLeaf(serverTx, localTx, inputIndex, serverPubkeys, context) {
3426
3533
  const leaf = localTx.getInput(inputIndex).tapLeafScript?.[0];
3427
3534
  if (!leaf) {
3428
3535
  throw new Error(
3429
3536
  `${context}: input ${inputIndex} carries no spend leaf to verify the server signature against`
3430
3537
  );
3431
3538
  }
3539
+ const script = scriptFromTapLeafScript(leaf);
3540
+ let leafPubkeys;
3541
+ try {
3542
+ leafPubkeys = decodeTapscript(script).params.pubkeys.map(
3543
+ (key) => hex.encode(toXOnly(key, "leaf key"))
3544
+ );
3545
+ } catch (error) {
3546
+ throw new ServerResponseMismatchError(
3547
+ `${context}: input ${inputIndex} spend leaf cannot be decoded (${error instanceof Error ? error.message : String(error)})`
3548
+ );
3549
+ }
3550
+ const signer = leafPubkeys.find((key) => serverPubkeys.has(key));
3551
+ if (!signer) {
3552
+ throw new ServerResponseMismatchError(
3553
+ `${context}: input ${inputIndex} spend leaf names no signer key the server advertises`
3554
+ );
3555
+ }
3432
3556
  try {
3433
3557
  verifyTapscriptSignatures(
3434
3558
  serverTx,
3435
3559
  inputIndex,
3436
- [serverPubkeyHex],
3560
+ [signer],
3437
3561
  void 0,
3438
3562
  void 0,
3439
- tapLeafHash(scriptFromTapLeafScript(leaf))
3563
+ tapLeafHash(script)
3440
3564
  );
3441
3565
  } catch (error) {
3442
3566
  throw new ServerResponseMismatchError(
@@ -3510,24 +3634,22 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
3510
3634
  );
3511
3635
  }
3512
3636
  const finalArkTx = Transaction.fromPSBT(base64.decode(response.finalArkTx));
3513
- const serverPubkeyHex = hex.encode(toXOnly(verify.serverPubkey, "server key"));
3637
+ const serverPubkeys = new Set(
3638
+ [verify.serverPubkey, ...verify.deprecatedServerPubkeys ?? []].map(
3639
+ (key) => hex.encode(toXOnly(key, "server key"))
3640
+ )
3641
+ );
3514
3642
  for (let i = 0; i < offchainTx.arkTx.inputsLength; i++) {
3515
3643
  assertServerSignedLeaf(
3516
3644
  finalArkTx,
3517
3645
  offchainTx.arkTx,
3518
3646
  i,
3519
- serverPubkeyHex,
3647
+ serverPubkeys,
3520
3648
  "submitTx ark tx"
3521
3649
  );
3522
3650
  }
3523
3651
  matched.forEach(
3524
- ({ server, local }, index) => assertServerSignedLeaf(
3525
- server,
3526
- local,
3527
- 0,
3528
- serverPubkeyHex,
3529
- `submitTx checkpoint ${index}`
3530
- )
3652
+ ({ server, local }, index) => assertServerSignedLeaf(server, local, 0, serverPubkeys, `submitTx checkpoint ${index}`)
3531
3653
  );
3532
3654
  }
3533
3655
  let finalCheckpoints;
@@ -7550,12 +7672,7 @@ async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos
7550
7672
  if (!expiryTimestamp || expiryTimestamp === Number.MAX_SAFE_INTEGER) {
7551
7673
  delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7552
7674
  } else {
7553
- const remainingTimeMs = expiryTimestamp - Date.now();
7554
- if (remainingTimeMs <= 0) {
7555
- delegateAt = new Date(Date.now() + 1 * 60 * 1e3);
7556
- } else {
7557
- delegateAt = new Date(expiryTimestamp - remainingTimeMs * 0.1);
7558
- }
7675
+ delegateAt = defaultDelegateAt(expiryTimestamp, arkInfo.sessionDuration);
7559
7676
  }
7560
7677
  }
7561
7678
  const { fees, dust, forfeitAddress, network } = arkInfo;
@@ -7715,6 +7832,14 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
7715
7832
  message
7716
7833
  };
7717
7834
  }
7835
+ function defaultDelegateAt(expiryTimestamp, sessionDurationSeconds, now = Date.now()) {
7836
+ const remainingTimeMs = expiryTimestamp - now;
7837
+ if (remainingTimeMs <= 0) return new Date(now + 6e4);
7838
+ const sessionLeadMs = Number(sessionDurationSeconds * 1000n);
7839
+ const leadTimeMs = Math.max(remainingTimeMs * 0.1, sessionLeadMs);
7840
+ const delegateAt = expiryTimestamp - leadTimeMs;
7841
+ return new Date(delegateAt > now ? delegateAt : now + 2e3);
7842
+ }
7718
7843
  function findDestinationOutputIndex(outputs, destinationScript) {
7719
7844
  return outputs.findIndex((o) => o.script && equalBytes(o.script, destinationScript));
7720
7845
  }
@@ -9114,13 +9239,14 @@ var ContractWatcher = class {
9114
9239
  try {
9115
9240
  const vtxosMap = await this.getContractVtxos({
9116
9241
  contractScripts,
9117
- includeSpent: false
9118
- // only spendable ones!
9242
+ includeSpent: true
9119
9243
  });
9120
9244
  for (const contractScript of contractScripts) {
9121
9245
  const state = this.contracts.get(contractScript);
9122
9246
  if (!state) continue;
9123
- const currentVtxos = vtxosMap.get(contractScript) || [];
9247
+ const known = vtxosMap.get(contractScript) || [];
9248
+ const knownByKey = new Map(known.map((v) => [`${v.txid}:${v.vout}`, v]));
9249
+ const currentVtxos = known.filter((v) => !v.isSpent);
9124
9250
  const currentKeys = new Set(currentVtxos.map((v) => `${v.txid}:${v.vout}`));
9125
9251
  const newVtxos = [];
9126
9252
  for (const vtxo of currentVtxos) {
@@ -9133,7 +9259,7 @@ var ContractWatcher = class {
9133
9259
  const spentVtxos = [];
9134
9260
  for (const [key, vtxo] of state.lastKnownVtxos) {
9135
9261
  if (!currentKeys.has(key)) {
9136
- spentVtxos.push(vtxo);
9262
+ spentVtxos.push(knownByKey.get(key) ?? vtxo);
9137
9263
  state.lastKnownVtxos.delete(key);
9138
9264
  }
9139
9265
  }
@@ -9887,6 +10013,41 @@ var ContractManager = class _ContractManager {
9887
10013
  }
9888
10014
  return contract;
9889
10015
  }
10016
+ /**
10017
+ * `createContract`'s step order, fetch batched: persist all, hydrate once,
10018
+ * then watch. Hydrating first keeps it equivalent — the watcher seeds from
10019
+ * the repository, so an unhydrated row reads as all-new. A part-way failure
10020
+ * still watches what it wrote; a retry reports those rows as existing.
10021
+ */
10022
+ async createContracts(paramsList) {
10023
+ if (paramsList.length === 0) return [];
10024
+ return this.watcher.withCoalescedSubscription(async () => {
10025
+ const upserted = [];
10026
+ try {
10027
+ for (const params of paramsList) upserted.push(await this.upsertContract(params));
10028
+ } catch (err) {
10029
+ for (const u of upserted) {
10030
+ if (!u.persisted) continue;
10031
+ await this.watcher.addContract(u.contract).catch(
10032
+ (e) => console.error(`ContractManager: ${u.contract.script} left dark`, e)
10033
+ );
10034
+ }
10035
+ throw err;
10036
+ }
10037
+ const fresh = upserted.filter((u) => u.persisted).map((u) => u.contract);
10038
+ if (fresh.length > 0) {
10039
+ try {
10040
+ await this.fetchContractVxosFromIndexer(fresh);
10041
+ this.markSyncOnline();
10042
+ } catch (err) {
10043
+ if (!isRetryableProviderError(err)) throw err;
10044
+ this.markSyncDegraded(err);
10045
+ }
10046
+ for (const contract of fresh) await this.watcher.addContract(contract);
10047
+ }
10048
+ return upserted.map((u) => u.contract);
10049
+ });
10050
+ }
9890
10051
  /**
9891
10052
  * Lightweight variant of {@link createContract} for batch discovery
9892
10053
  * paths (currently: {@link scanContracts}). Validates, dedupes, persists,
@@ -14320,7 +14481,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14320
14481
  `restore: gapLimit must be a positive integer (got ${String(opts?.gapLimit)})`
14321
14482
  );
14322
14483
  }
14323
- this._restoreInFlight = this._runRestore(gapLimit).finally(() => {
14484
+ this._restoreInFlight = (async () => {
14485
+ await this._runRestore(gapLimit);
14486
+ await runWalletRestoreHooks(this);
14487
+ })().finally(() => {
14324
14488
  this._restoreInFlight = void 0;
14325
14489
  });
14326
14490
  return this._restoreInFlight;
@@ -14933,6 +15097,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14933
15097
  const connectorsLeaves = connectorsGraph?.leaves() || [];
14934
15098
  for (const input of inputs) {
14935
15099
  if (!isVirtualCoin(input)) {
15100
+ let matched = false;
14936
15101
  for (let i = 0; i < settlementPsbt.inputsLength; i++) {
14937
15102
  const settlementInput = settlementPsbt.getInput(i);
14938
15103
  if (!settlementInput.txid || settlementInput.index === void 0) {
@@ -14959,8 +15124,14 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
14959
15124
  throw new Error(await this.unsignableBoardingInputError(input, script));
14960
15125
  }
14961
15126
  hasBoardingUtxos = true;
15127
+ matched = true;
14962
15128
  break;
14963
15129
  }
15130
+ if (!matched && !(input instanceof ArkNote)) {
15131
+ throw new Error(
15132
+ `boarding input ${input.txid}:${input.vout} is not an input of the commitment tx`
15133
+ );
15134
+ }
14964
15135
  continue;
14965
15136
  }
14966
15137
  if (canRecoverOnchain(input, { timestamp: /* @__PURE__ */ new Date() }) || isSubdust({ value: input.value }, this.dustAmount)) {
@@ -16101,18 +16272,33 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
16101
16272
  this.inputSigningJobsFromWitnessUtxos(checkpoint)
16102
16273
  )
16103
16274
  };
16104
- return submitOffchainTx(this.arkProvider, offchainTx, signer, {
16105
- // Mark pending before submitting — if we crash between submit and
16106
- // finalize, the next init recovers via finalizePendingTxs.
16107
- beforeSubmit: () => this.setPendingTxFlag(true),
16108
- afterFinalize: async () => {
16109
- try {
16110
- await this.setPendingTxFlag(false);
16111
- } catch (error) {
16112
- console.error("Failed to clear pending tx flag:", error);
16275
+ return submitOffchainTx(
16276
+ this.arkProvider,
16277
+ offchainTx,
16278
+ signer,
16279
+ {
16280
+ // Mark pending before submitting — if we crash between submit and
16281
+ // finalize, the next init recovers via finalizePendingTxs.
16282
+ beforeSubmit: () => this.setPendingTxFlag(true),
16283
+ afterFinalize: async () => {
16284
+ try {
16285
+ await this.setPendingTxFlag(false);
16286
+ } catch (error) {
16287
+ console.error("Failed to clear pending tx flag:", error);
16288
+ }
16289
+ }
16290
+ },
16291
+ {
16292
+ // Deprecated keys too: a vtxo built before a rotation is still
16293
+ // spent under the signer its leaf names.
16294
+ verifyServerSignatures: {
16295
+ serverPubkey: this._arkServerPublicKey,
16296
+ deprecatedServerPubkeys: [...this._deprecatedSigners.keys()].map(
16297
+ (h) => hex.decode(h)
16298
+ )
16113
16299
  }
16114
16300
  }
16115
- });
16301
+ );
16116
16302
  }
16117
16303
  // mark virtual outputs as spent, save change outputs if any.
16118
16304
  // `offchainTapscript` and `serverPubKey` are the epoch snapshot the
@@ -19622,6 +19808,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19622
19808
  identity;
19623
19809
  _assetManager;
19624
19810
  hasDelegate;
19811
+ _restoreInFlight;
19625
19812
  get assetManager() {
19626
19813
  return this._assetManager;
19627
19814
  }
@@ -19892,6 +20079,16 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
19892
20079
  * reconstructed here so callers can inspect `.errors`.
19893
20080
  */
19894
20081
  async restore(opts) {
20082
+ if (this._restoreInFlight) return this._restoreInFlight;
20083
+ this._restoreInFlight = (async () => {
20084
+ await this._restoreWorkerWallet(opts);
20085
+ await runWalletRestoreHooks(this);
20086
+ })().finally(() => {
20087
+ this._restoreInFlight = void 0;
20088
+ });
20089
+ return this._restoreInFlight;
20090
+ }
20091
+ async _restoreWorkerWallet(opts) {
19895
20092
  const message = {
19896
20093
  id: getRandomId(),
19897
20094
  tag: this.messageTag,
@@ -22864,6 +23061,12 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22864
23061
  validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
22865
23062
  if (recipients && recipients.length > 0) {
22866
23063
  validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
23064
+ } else {
23065
+ validateBatchAgainstIntent(
23066
+ commitmentTx,
23067
+ vtxoTree.leaves(),
23068
+ declaredIntentOutputs(signedProof, message.onchain_output_indexes)
23069
+ );
22867
23070
  }
22868
23071
  const sharedOutput = commitmentTx.getOutput(0);
22869
23072
  if (!sharedOutput?.amount) {
@@ -22898,8 +23101,15 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
22898
23101
  validatedCommitmentTxid,
22899
23102
  "arkade batch finalization"
22900
23103
  );
22901
- if (!validatedCommitmentTxid && recipients && recipients.length > 0) {
22902
- validateBatchRecipientsWithoutTree(commitmentPsbt, recipients, network);
23104
+ if (!validatedCommitmentTxid) {
23105
+ if (recipients && recipients.length > 0) {
23106
+ validateBatchRecipientsWithoutTree(commitmentPsbt, recipients, network);
23107
+ } else {
23108
+ validateBatchAgainstIntentWithoutTree(
23109
+ commitmentPsbt,
23110
+ declaredIntentOutputs(signedProof, message.onchain_output_indexes)
23111
+ );
23112
+ }
22903
23113
  }
22904
23114
  const signedForfeits = [];
22905
23115
  let connectorIndex = 0;
@@ -23919,6 +24129,6 @@ function createDefaultPaymentRouter(wallet) {
23919
24129
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
23920
24130
  */
23921
24131
 
23922
- 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, isContractVtxoEvent, 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 };
23923
- //# sourceMappingURL=chunk-7B2QAHQU.js.map
23924
- //# sourceMappingURL=chunk-7B2QAHQU.js.map
24132
+ 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, isContractVtxoEvent, 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, registerWalletRestoreHook, 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 };
24133
+ //# sourceMappingURL=chunk-3TCWQPAC.js.map
24134
+ //# sourceMappingURL=chunk-3TCWQPAC.js.map