@arkade-os/sdk 0.4.70 → 0.4.72
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.
- package/README.md +29 -0
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-BgUJN-3X.d.ts → asyncStorageTaskQueue-DhhNZc4v.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-Cstx6hS7.d.cts → asyncStorageTaskQueue-s5lUGWxu.d.cts} +1 -1
- package/dist/{chunk-JJ7AXR4O.cjs → chunk-4BWZ437E.cjs} +21 -17
- package/dist/chunk-4BWZ437E.cjs.map +1 -0
- package/dist/{chunk-3KW4TWP2.cjs → chunk-4C5PMGBB.cjs} +51 -25
- package/dist/chunk-4C5PMGBB.cjs.map +1 -0
- package/dist/{chunk-TXSF2DKX.js → chunk-5GQFYVWP.js} +30 -5
- package/dist/chunk-5GQFYVWP.js.map +1 -0
- package/dist/{chunk-57636V35.cjs → chunk-6FTHFJAN.cjs} +30 -4
- package/dist/chunk-6FTHFJAN.cjs.map +1 -0
- package/dist/{chunk-JVHO6XHG.js → chunk-BHLYB44A.js} +476 -78
- package/dist/chunk-BHLYB44A.js.map +1 -0
- package/dist/{chunk-6UM55KPZ.js → chunk-CB6QPAO5.js} +3 -3
- package/dist/{chunk-6UM55KPZ.js.map → chunk-CB6QPAO5.js.map} +1 -1
- package/dist/{chunk-IUFTICRY.js → chunk-CZPBPMO2.js} +4 -4
- package/dist/{chunk-IUFTICRY.js.map → chunk-CZPBPMO2.js.map} +1 -1
- package/dist/{chunk-F5E7LI6G.js → chunk-IGER5FPC.js} +37 -11
- package/dist/chunk-IGER5FPC.js.map +1 -0
- package/dist/{chunk-B73Q75IL.cjs → chunk-KDMHEWTD.cjs} +10 -10
- package/dist/{chunk-B73Q75IL.cjs.map → chunk-KDMHEWTD.cjs.map} +1 -1
- package/dist/{chunk-3OKEUDHU.cjs → chunk-NPM5YZBC.cjs} +49 -49
- package/dist/{chunk-3OKEUDHU.cjs.map → chunk-NPM5YZBC.cjs.map} +1 -1
- package/dist/{chunk-UG3EZDLF.js → chunk-S5PUFSXC.js} +8 -4
- package/dist/chunk-S5PUFSXC.js.map +1 -0
- package/dist/{chunk-XTCOSZ34.cjs → chunk-U5I3ITV7.cjs} +907 -507
- package/dist/chunk-U5I3ITV7.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-DrwIar11.d.cts → delegate-BJp8f6LT.d.cts} +1 -1
- package/dist/{delegate-BPdzTbwN.d.ts → delegate-Ckz_TWzM.d.ts} +1 -1
- package/dist/{hdWalletCapable-D4WH35z0.d.cts → hdWalletCapable-DA9bJ5eB.d.cts} +2 -2
- package/dist/{hdWalletCapable-DyxCiNVE.d.ts → hdWalletCapable-DABgAD-T.d.ts} +2 -2
- package/dist/{index-TZJvbIaA.d.ts → index-B8xrELXY.d.ts} +2 -2
- package/dist/{index-BqhpAqqj.d.cts → index-DSbDm0Io.d.cts} +2 -2
- package/dist/{index-dWRqYSdS.d.ts → index-Dg0-TvBQ.d.cts} +149 -5
- package/dist/{index-dWRqYSdS.d.cts → index-Dg0-TvBQ.d.ts} +149 -5
- package/dist/index.cjs +309 -297
- package/dist/index.d.cts +91 -12
- package/dist/index.d.ts +91 -12
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-CzYKyJ9c.d.cts → taskRunner-BH_FxaNI.d.cts} +1 -1
- package/dist/{taskRunner-D2fnbqYw.d.ts → taskRunner-DrVz2QZs.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +5 -5
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-3KW4TWP2.cjs.map +0 -1
- package/dist/chunk-57636V35.cjs.map +0 -1
- package/dist/chunk-F5E7LI6G.js.map +0 -1
- package/dist/chunk-JJ7AXR4O.cjs.map +0 -1
- package/dist/chunk-JVHO6XHG.js.map +0 -1
- package/dist/chunk-TXSF2DKX.js.map +0 -1
- package/dist/chunk-UG3EZDLF.js.map +0 -1
- package/dist/chunk-XTCOSZ34.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-
|
|
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-
|
|
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,
|
|
1
|
+
import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-IGER5FPC.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-CB6QPAO5.js';
|
|
3
|
+
import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, resolveEmulatorPubkey, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, assertAllowedSighashTypes, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, formatSighash, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, getAllNormalizedVtxos, isPastExpiry, isRetryableProviderError, DEFAULT_PAGE_SIZE, RestArkProvider, toVirtualStatus, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, parseLegacyExpiry, isExpired, PrevoutTxField, fetchVtxoCreatedAtByTxid, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError, networks as networks$1 } from './chunk-5GQFYVWP.js';
|
|
4
4
|
import { __export } from './chunk-NSBPE2FW.js';
|
|
5
5
|
import { sha256 as sha256$1, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
|
|
6
6
|
import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
|
|
@@ -2983,6 +2983,39 @@ function createDefaultActivityRegistry() {
|
|
|
2983
2983
|
return registry;
|
|
2984
2984
|
}
|
|
2985
2985
|
|
|
2986
|
+
// src/wallet/restoreHooks.ts
|
|
2987
|
+
var restoreHooks = /* @__PURE__ */ new WeakMap();
|
|
2988
|
+
function registerWalletRestoreHook(wallet, hook) {
|
|
2989
|
+
const hooks = restoreHooks.get(wallet) ?? [];
|
|
2990
|
+
const entry = { ...hook };
|
|
2991
|
+
const existing = hooks.findIndex(({ id }) => id === hook.id);
|
|
2992
|
+
if (existing === -1) hooks.push(entry);
|
|
2993
|
+
else hooks[existing] = entry;
|
|
2994
|
+
restoreHooks.set(wallet, hooks);
|
|
2995
|
+
return () => {
|
|
2996
|
+
const current = restoreHooks.get(wallet);
|
|
2997
|
+
if (!current) return;
|
|
2998
|
+
const index = current.indexOf(entry);
|
|
2999
|
+
if (index === -1) return;
|
|
3000
|
+
current.splice(index, 1);
|
|
3001
|
+
if (current.length === 0) restoreHooks.delete(wallet);
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
async function runWalletRestoreHooks(wallet) {
|
|
3005
|
+
const snapshot = [...restoreHooks.get(wallet) ?? []];
|
|
3006
|
+
const errors = [];
|
|
3007
|
+
for (const hook of snapshot) {
|
|
3008
|
+
try {
|
|
3009
|
+
await hook.restore(wallet);
|
|
3010
|
+
} catch (error) {
|
|
3011
|
+
errors.push(error);
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
if (errors.length > 0) {
|
|
3015
|
+
throw new AggregateError(errors, "Wallet restore hooks failed");
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
|
|
2986
3019
|
// src/wallet/index.ts
|
|
2987
3020
|
var TxType = /* @__PURE__ */ ((TxType2) => {
|
|
2988
3021
|
TxType2["TxSent"] = "SENT";
|
|
@@ -3618,6 +3651,26 @@ function claimWithPreimageIdentity(identity, preimage) {
|
|
|
3618
3651
|
}
|
|
3619
3652
|
};
|
|
3620
3653
|
}
|
|
3654
|
+
|
|
3655
|
+
// src/contracts/types.ts
|
|
3656
|
+
function watchStateOf(contract) {
|
|
3657
|
+
return contract.watch ?? "watched";
|
|
3658
|
+
}
|
|
3659
|
+
function isWatchedContract(contract) {
|
|
3660
|
+
return watchStateOf(contract) !== "retained";
|
|
3661
|
+
}
|
|
3662
|
+
function hasCandidates(handler) {
|
|
3663
|
+
return !!handler && typeof handler.candidatesAt === "function";
|
|
3664
|
+
}
|
|
3665
|
+
function isDiscoverable(handler) {
|
|
3666
|
+
return !!handler && typeof handler.discoverAt === "function";
|
|
3667
|
+
}
|
|
3668
|
+
function isTapscriptDeriving(handler) {
|
|
3669
|
+
return !!handler && typeof handler.deriveTapscripts === "function";
|
|
3670
|
+
}
|
|
3671
|
+
function isContractVtxoEvent(event) {
|
|
3672
|
+
return "contract" in event && event.contract !== void 0;
|
|
3673
|
+
}
|
|
3621
3674
|
var AmountVariableName = "amount";
|
|
3622
3675
|
var ExpiryVariableName = "expiry";
|
|
3623
3676
|
var BirthVariableName = "birth";
|
|
@@ -3773,23 +3826,6 @@ function parseProgram(text, env) {
|
|
|
3773
3826
|
}
|
|
3774
3827
|
return { program, text };
|
|
3775
3828
|
}
|
|
3776
|
-
|
|
3777
|
-
// src/contracts/types.ts
|
|
3778
|
-
function watchStateOf(contract) {
|
|
3779
|
-
return contract.watch ?? "watched";
|
|
3780
|
-
}
|
|
3781
|
-
function isWatchedContract(contract) {
|
|
3782
|
-
return watchStateOf(contract) !== "retained";
|
|
3783
|
-
}
|
|
3784
|
-
function hasCandidates(handler) {
|
|
3785
|
-
return !!handler && typeof handler.candidatesAt === "function";
|
|
3786
|
-
}
|
|
3787
|
-
function isDiscoverable(handler) {
|
|
3788
|
-
return !!handler && typeof handler.discoverAt === "function";
|
|
3789
|
-
}
|
|
3790
|
-
function isTapscriptDeriving(handler) {
|
|
3791
|
-
return !!handler && typeof handler.deriveTapscripts === "function";
|
|
3792
|
-
}
|
|
3793
3829
|
var DUST_AMOUNT = 546;
|
|
3794
3830
|
var FALLBACK_WALLET_DUST_AMOUNT = 330n;
|
|
3795
3831
|
function getDustAmount(wallet) {
|
|
@@ -3954,9 +3990,18 @@ function gatedContracts(contracts) {
|
|
|
3954
3990
|
}
|
|
3955
3991
|
return gated;
|
|
3956
3992
|
}
|
|
3993
|
+
function gatedFrom(snapshot) {
|
|
3994
|
+
return gatedContracts(snapshot.map((entry) => entry.contract));
|
|
3995
|
+
}
|
|
3996
|
+
function gatedTypeOf(vtxo, gated) {
|
|
3997
|
+
return vtxo.script === void 0 ? void 0 : gated.get(vtxo.script);
|
|
3998
|
+
}
|
|
3999
|
+
function isGatedVtxo(vtxo, gated) {
|
|
4000
|
+
return gatedTypeOf(vtxo, gated) !== void 0;
|
|
4001
|
+
}
|
|
3957
4002
|
function gateExclusion(gated) {
|
|
3958
4003
|
return (vtxo) => {
|
|
3959
|
-
const type = vtxo
|
|
4004
|
+
const type = gatedTypeOf(vtxo, gated);
|
|
3960
4005
|
if (type === void 0) return void 0;
|
|
3961
4006
|
if (!contractHandlers.has(type)) {
|
|
3962
4007
|
return `at ${vtxo.script} (contract type '${type}') has no handler registered in this build`;
|
|
@@ -5339,7 +5384,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
5339
5384
|
this.wallet.getAddress()
|
|
5340
5385
|
]);
|
|
5341
5386
|
const stopWatching = contractManager.onContractEvent((event) => {
|
|
5342
|
-
if (event.type !== "vtxo_received") {
|
|
5387
|
+
if (event.type !== "vtxo_received" || !isContractVtxoEvent(event)) {
|
|
5343
5388
|
return;
|
|
5344
5389
|
}
|
|
5345
5390
|
const msSinceLastRenewal = Date.now() - this.lastRenewalTimestamp;
|
|
@@ -6934,6 +6979,24 @@ var Batch;
|
|
|
6934
6979
|
})(Batch || (Batch = {}));
|
|
6935
6980
|
|
|
6936
6981
|
// src/utils/transactionHistory.ts
|
|
6982
|
+
function localCreatedAtByTxid(vtxos) {
|
|
6983
|
+
const createdAt = /* @__PURE__ */ new Map();
|
|
6984
|
+
for (const vtxo of vtxos) {
|
|
6985
|
+
if (vtxo.txid && !createdAt.has(vtxo.txid)) {
|
|
6986
|
+
createdAt.set(vtxo.txid, vtxo.createdAt.getTime());
|
|
6987
|
+
}
|
|
6988
|
+
}
|
|
6989
|
+
return createdAt;
|
|
6990
|
+
}
|
|
6991
|
+
function gatedTouchpoints(gated) {
|
|
6992
|
+
const paidIn = /* @__PURE__ */ new Set();
|
|
6993
|
+
const paidOut = /* @__PURE__ */ new Set();
|
|
6994
|
+
for (const vtxo of gated) {
|
|
6995
|
+
if (vtxo.txid) paidIn.add(vtxo.txid);
|
|
6996
|
+
if (vtxo.isSpent && vtxo.arkTxId) paidOut.add(vtxo.arkTxId);
|
|
6997
|
+
}
|
|
6998
|
+
return { paidIn, paidOut };
|
|
6999
|
+
}
|
|
6937
7000
|
var txKey = {
|
|
6938
7001
|
commitmentTxid: "",
|
|
6939
7002
|
boardingTxid: "",
|
|
@@ -6985,24 +7048,27 @@ function subtractAssets(spent, change) {
|
|
|
6985
7048
|
if (map.size === 0) return void 0;
|
|
6986
7049
|
return Array.from(map, ([assetId, amount]) => ({ assetId, amount }));
|
|
6987
7050
|
}
|
|
6988
|
-
function collectArkTxidsNeedingCreatedAt(vtxos) {
|
|
6989
|
-
const ownTxids = new Set(vtxos.map((v) => v.txid));
|
|
7051
|
+
function collectArkTxidsNeedingCreatedAt(vtxos, localCreatedAt) {
|
|
6990
7052
|
const txids = /* @__PURE__ */ new Set();
|
|
6991
7053
|
for (const vtxo of vtxos) {
|
|
6992
|
-
if (vtxo.isSpent && vtxo.arkTxId && !
|
|
7054
|
+
if (vtxo.isSpent && vtxo.arkTxId && !localCreatedAt.has(vtxo.arkTxId)) {
|
|
6993
7055
|
txids.add(vtxo.arkTxId);
|
|
6994
7056
|
}
|
|
6995
7057
|
}
|
|
6996
7058
|
return [...txids];
|
|
6997
7059
|
}
|
|
6998
|
-
async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt) {
|
|
6999
|
-
const
|
|
7000
|
-
const
|
|
7060
|
+
async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnore, resolveTxCreatedAt, gatedScripts = /* @__PURE__ */ new Map()) {
|
|
7061
|
+
const normalized = vtxos.map(normalizeVtxo).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
7062
|
+
const localCreatedAt = localCreatedAtByTxid(normalized);
|
|
7063
|
+
const gatedVtxos = normalized.filter((vtxo) => isGatedVtxo(vtxo, gatedScripts));
|
|
7064
|
+
const ownVtxos = normalized.filter((vtxo) => !isGatedVtxo(vtxo, gatedScripts));
|
|
7065
|
+
const { paidIn: paidIntoGated, paidOut: paidOutOfGated } = gatedTouchpoints(gatedVtxos);
|
|
7066
|
+
const txidsNeedingCreatedAt = resolveTxCreatedAt ? collectArkTxidsNeedingCreatedAt(ownVtxos, localCreatedAt) : [];
|
|
7001
7067
|
const resolvedCreatedAt = resolveTxCreatedAt && txidsNeedingCreatedAt.length > 0 ? await resolveTxCreatedAt(txidsNeedingCreatedAt) : /* @__PURE__ */ new Map();
|
|
7002
7068
|
const unmatchedSettledBoardingTxs = allBoardingTxs.filter(isSettledBoardingReceive).sort((a, b) => a.createdAt - b.createdAt);
|
|
7003
7069
|
const sent = [];
|
|
7004
7070
|
let received = [];
|
|
7005
|
-
for (const vtxo of
|
|
7071
|
+
for (const vtxo of ownVtxos) {
|
|
7006
7072
|
if (vtxo.status.isLeaf) {
|
|
7007
7073
|
const commitmentTxid = vtxo.commitmentTxIds[0];
|
|
7008
7074
|
const vtxoCreatedAt = vtxo.createdAt.getTime();
|
|
@@ -7012,7 +7078,7 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
|
|
|
7012
7078
|
unmatchedSettledBoardingTxs,
|
|
7013
7079
|
(tx) => tx.createdAt <= vtxoCreatedAt && (tx.key.commitmentTxid === commitmentTxid || tx.key.commitmentTxid === vtxo.settledBy)
|
|
7014
7080
|
);
|
|
7015
|
-
} else if (
|
|
7081
|
+
} else if (ownVtxos.filter((v) => v.settledBy === vtxo.commitmentTxIds[0]).length === 0) {
|
|
7016
7082
|
const duplicateBoardingReceive = consumeBoardingReceive(
|
|
7017
7083
|
unmatchedSettledBoardingTxs,
|
|
7018
7084
|
(tx) => tx.amount === vtxo.value && tx.createdAt <= vtxoCreatedAt
|
|
@@ -7033,11 +7099,14 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
|
|
|
7033
7099
|
});
|
|
7034
7100
|
}
|
|
7035
7101
|
}
|
|
7036
|
-
} else if (
|
|
7102
|
+
} else if (ownVtxos.filter((v) => v.arkTxId === vtxo.txid).length === 0) {
|
|
7037
7103
|
const assets = collectAssets([vtxo]);
|
|
7038
7104
|
received.push({
|
|
7039
7105
|
key: { ...txKey, arkTxid: vtxo.txid },
|
|
7040
|
-
|
|
7106
|
+
// The escrow paying out: a swap fill or a cancel spends the
|
|
7107
|
+
// gated coin and lands the proceeds here. Nothing else about
|
|
7108
|
+
// the row changes — the tag only names the counterparty.
|
|
7109
|
+
tag: paidOutOfGated.has(vtxo.txid) ? "gated" : "offchain",
|
|
7041
7110
|
type: "RECEIVED" /* TxReceived */,
|
|
7042
7111
|
amount: vtxo.value,
|
|
7043
7112
|
settled: vtxo.status.isLeaf || vtxo.isSpent,
|
|
@@ -7047,8 +7116,8 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
|
|
|
7047
7116
|
}
|
|
7048
7117
|
if (vtxo.isSpent) {
|
|
7049
7118
|
if (vtxo.arkTxId && !sent.some((s) => s.key.arkTxid === vtxo.arkTxId)) {
|
|
7050
|
-
const changes =
|
|
7051
|
-
const allSpent =
|
|
7119
|
+
const changes = ownVtxos.filter((_) => _.txid === vtxo.arkTxId);
|
|
7120
|
+
const allSpent = ownVtxos.filter((v) => v.arkTxId === vtxo.arkTxId);
|
|
7052
7121
|
const spentAmount = allSpent.reduce((acc, v) => acc + v.value, 0);
|
|
7053
7122
|
let txAmount = 0;
|
|
7054
7123
|
let txTime = 0;
|
|
@@ -7058,13 +7127,16 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
|
|
|
7058
7127
|
txTime = changes[0].createdAt.getTime();
|
|
7059
7128
|
} else {
|
|
7060
7129
|
txAmount = spentAmount;
|
|
7061
|
-
txTime = resolvedCreatedAt.get(vtxo.arkTxId) ?? vtxo.createdAt.getTime() + 1;
|
|
7130
|
+
txTime = localCreatedAt.get(vtxo.arkTxId) ?? resolvedCreatedAt.get(vtxo.arkTxId) ?? vtxo.createdAt.getTime() + 1;
|
|
7062
7131
|
}
|
|
7063
7132
|
const assets = subtractAssets(allSpent, changes);
|
|
7064
7133
|
if (txAmount !== 0 || assets) {
|
|
7065
7134
|
sent.push({
|
|
7066
7135
|
key: { ...txKey, arkTxid: vtxo.arkTxId },
|
|
7067
|
-
|
|
7136
|
+
// Funding the escrow: an output of this tx landed on a
|
|
7137
|
+
// gated contract of the wallet's, so the send is to the
|
|
7138
|
+
// user's own covenant rather than to a stranger.
|
|
7139
|
+
tag: paidIntoGated.has(vtxo.arkTxId) ? "gated" : "offchain",
|
|
7068
7140
|
type: "SENT" /* TxSent */,
|
|
7069
7141
|
amount: txAmount,
|
|
7070
7142
|
settled: true,
|
|
@@ -7074,10 +7146,10 @@ async function buildTransactionHistory(vtxos, allBoardingTxs, commitmentsToIgnor
|
|
|
7074
7146
|
}
|
|
7075
7147
|
}
|
|
7076
7148
|
if (vtxo.settledBy && !commitmentsToIgnore.has(vtxo.settledBy) && !sent.some((s) => s.key.commitmentTxid === vtxo.settledBy)) {
|
|
7077
|
-
const changes =
|
|
7149
|
+
const changes = ownVtxos.filter(
|
|
7078
7150
|
(v) => v.status.isLeaf && v.commitmentTxIds.length > 0 && v.commitmentTxIds.every((_) => vtxo.settledBy === _)
|
|
7079
7151
|
);
|
|
7080
|
-
const forfeitVtxos =
|
|
7152
|
+
const forfeitVtxos = ownVtxos.filter((v) => v.settledBy === vtxo.settledBy);
|
|
7081
7153
|
const forfeitAmount = forfeitVtxos.reduce((acc, v) => acc + v.value, 0);
|
|
7082
7154
|
if (changes.length > 0) {
|
|
7083
7155
|
const settledAmount = changes.reduce((acc, v) => acc + v.value, 0);
|
|
@@ -8711,6 +8783,8 @@ var DEFAULT_CONTRACT_WATCHER_CONFIG = {
|
|
|
8711
8783
|
var ContractWatcher = class {
|
|
8712
8784
|
config;
|
|
8713
8785
|
contracts = /* @__PURE__ */ new Map();
|
|
8786
|
+
/** In-memory and process-lifetime; never persisted. */
|
|
8787
|
+
watchedScripts = /* @__PURE__ */ new Map();
|
|
8714
8788
|
subscriptionId;
|
|
8715
8789
|
abortController;
|
|
8716
8790
|
isWatching = false;
|
|
@@ -8831,6 +8905,47 @@ var ContractWatcher = class {
|
|
|
8831
8905
|
getWatchedContracts() {
|
|
8832
8906
|
return this.getAllContracts().filter(isWatchedContract);
|
|
8833
8907
|
}
|
|
8908
|
+
/**
|
|
8909
|
+
* Every script the subscription must carry. Wider than
|
|
8910
|
+
* {@link getWatchedContracts}, which stays the sync scope.
|
|
8911
|
+
*/
|
|
8912
|
+
getSubscribedScripts() {
|
|
8913
|
+
const scripts = new Set(this.getWatchedContracts().map((c) => c.script));
|
|
8914
|
+
for (const script of this.watchedScripts.keys()) {
|
|
8915
|
+
scripts.add(script);
|
|
8916
|
+
}
|
|
8917
|
+
return Array.from(scripts);
|
|
8918
|
+
}
|
|
8919
|
+
/** @see IContractManager.watchScript for the delivery and filter contract. */
|
|
8920
|
+
async addWatchedScript(script, options) {
|
|
8921
|
+
const existing = this.watchedScripts.get(script);
|
|
8922
|
+
if (existing) {
|
|
8923
|
+
if (options?.label !== void 0) existing.label = options.label;
|
|
8924
|
+
return;
|
|
8925
|
+
}
|
|
8926
|
+
this.watchedScripts.set(script, {
|
|
8927
|
+
label: options?.label,
|
|
8928
|
+
lastKnownVtxos: /* @__PURE__ */ new Map()
|
|
8929
|
+
});
|
|
8930
|
+
if (this.isWatching) {
|
|
8931
|
+
await this.pollWatchedScripts([script]);
|
|
8932
|
+
await this.tryUpdateSubscription();
|
|
8933
|
+
}
|
|
8934
|
+
}
|
|
8935
|
+
/** Stop watching a script added by {@link addWatchedScript}. */
|
|
8936
|
+
async removeWatchedScript(script) {
|
|
8937
|
+
if (!this.watchedScripts.delete(script)) return;
|
|
8938
|
+
if (this.isWatching) {
|
|
8939
|
+
await this.tryUpdateSubscription();
|
|
8940
|
+
}
|
|
8941
|
+
}
|
|
8942
|
+
/** Every script registered via {@link addWatchedScript}. */
|
|
8943
|
+
getWatchedScripts() {
|
|
8944
|
+
return Array.from(this.watchedScripts.entries()).map(([script, state]) => ({
|
|
8945
|
+
script,
|
|
8946
|
+
label: state.label
|
|
8947
|
+
}));
|
|
8948
|
+
}
|
|
8834
8949
|
/**
|
|
8835
8950
|
* Get virtual outputs for contracts, grouped by contract script.
|
|
8836
8951
|
* @see WalletRepository for `repo`
|
|
@@ -9022,8 +9137,72 @@ var ContractWatcher = class {
|
|
|
9022
9137
|
}
|
|
9023
9138
|
async pollAllContracts() {
|
|
9024
9139
|
const scripts = this.getWatchedContracts().map((c) => c.script);
|
|
9140
|
+
if (scripts.length > 0) {
|
|
9141
|
+
await this.pollContracts(scripts);
|
|
9142
|
+
}
|
|
9143
|
+
await this.pollWatchedScripts(Array.from(this.watchedScripts.keys()));
|
|
9144
|
+
}
|
|
9145
|
+
/**
|
|
9146
|
+
* Poll watch-only scripts against the indexer and emit the delta.
|
|
9147
|
+
*
|
|
9148
|
+
* Separate from {@link pollContracts} because that one diffs the wallet
|
|
9149
|
+
* repository, which is permanently empty for a script this wallet does not
|
|
9150
|
+
* own — reusing it would report every live output as spent on every tick.
|
|
9151
|
+
* Not a second poll loop: same timer and callers, different source.
|
|
9152
|
+
*/
|
|
9153
|
+
async pollWatchedScripts(candidates) {
|
|
9154
|
+
if (!this.eventCallback) return;
|
|
9155
|
+
const scripts = candidates.filter((s) => {
|
|
9156
|
+
const state = this.contracts.get(s);
|
|
9157
|
+
return this.watchedScripts.has(s) && (state === void 0 || !isWatchedContract(state.contract));
|
|
9158
|
+
});
|
|
9025
9159
|
if (scripts.length === 0) return;
|
|
9026
|
-
|
|
9160
|
+
const now = Date.now();
|
|
9161
|
+
let current;
|
|
9162
|
+
try {
|
|
9163
|
+
current = await getAllNormalizedVtxos(this.config.indexerProvider, scripts, {
|
|
9164
|
+
spendableOnly: true
|
|
9165
|
+
});
|
|
9166
|
+
} catch (error) {
|
|
9167
|
+
console.error("ContractWatcher watch-only poll failed:", error);
|
|
9168
|
+
return;
|
|
9169
|
+
}
|
|
9170
|
+
const byScript = /* @__PURE__ */ new Map();
|
|
9171
|
+
for (const vtxo of current) {
|
|
9172
|
+
let bucket = byScript.get(vtxo.script);
|
|
9173
|
+
if (!bucket) {
|
|
9174
|
+
bucket = [];
|
|
9175
|
+
byScript.set(vtxo.script, bucket);
|
|
9176
|
+
}
|
|
9177
|
+
bucket.push(vtxo);
|
|
9178
|
+
}
|
|
9179
|
+
for (const script of scripts) {
|
|
9180
|
+
const state = this.watchedScripts.get(script);
|
|
9181
|
+
if (!state) continue;
|
|
9182
|
+
const currentVtxos = byScript.get(script) || [];
|
|
9183
|
+
const currentKeys = new Set(currentVtxos.map((v) => `${v.txid}:${v.vout}`));
|
|
9184
|
+
const newVtxos = [];
|
|
9185
|
+
for (const vtxo of currentVtxos) {
|
|
9186
|
+
const key = `${vtxo.txid}:${vtxo.vout}`;
|
|
9187
|
+
if (!state.lastKnownVtxos.has(key)) {
|
|
9188
|
+
newVtxos.push(vtxo);
|
|
9189
|
+
state.lastKnownVtxos.set(key, vtxo);
|
|
9190
|
+
}
|
|
9191
|
+
}
|
|
9192
|
+
const spentVtxos = [];
|
|
9193
|
+
for (const [key, vtxo] of state.lastKnownVtxos) {
|
|
9194
|
+
if (!currentKeys.has(key)) {
|
|
9195
|
+
spentVtxos.push(vtxo);
|
|
9196
|
+
state.lastKnownVtxos.delete(key);
|
|
9197
|
+
}
|
|
9198
|
+
}
|
|
9199
|
+
if (newVtxos.length > 0) {
|
|
9200
|
+
this.emitWatchedScriptEvent(script, newVtxos, "vtxo_received", now);
|
|
9201
|
+
}
|
|
9202
|
+
if (spentVtxos.length > 0) {
|
|
9203
|
+
this.emitWatchedScriptEvent(script, spentVtxos, "vtxo_spent", now);
|
|
9204
|
+
}
|
|
9205
|
+
}
|
|
9027
9206
|
}
|
|
9028
9207
|
/**
|
|
9029
9208
|
* Poll specific contracts and emit events for changes.
|
|
@@ -9034,13 +9213,14 @@ var ContractWatcher = class {
|
|
|
9034
9213
|
try {
|
|
9035
9214
|
const vtxosMap = await this.getContractVtxos({
|
|
9036
9215
|
contractScripts,
|
|
9037
|
-
includeSpent:
|
|
9038
|
-
// only spendable ones!
|
|
9216
|
+
includeSpent: true
|
|
9039
9217
|
});
|
|
9040
9218
|
for (const contractScript of contractScripts) {
|
|
9041
9219
|
const state = this.contracts.get(contractScript);
|
|
9042
9220
|
if (!state) continue;
|
|
9043
|
-
const
|
|
9221
|
+
const known = vtxosMap.get(contractScript) || [];
|
|
9222
|
+
const knownByKey = new Map(known.map((v) => [`${v.txid}:${v.vout}`, v]));
|
|
9223
|
+
const currentVtxos = known.filter((v) => !v.isSpent);
|
|
9044
9224
|
const currentKeys = new Set(currentVtxos.map((v) => `${v.txid}:${v.vout}`));
|
|
9045
9225
|
const newVtxos = [];
|
|
9046
9226
|
for (const vtxo of currentVtxos) {
|
|
@@ -9053,7 +9233,7 @@ var ContractWatcher = class {
|
|
|
9053
9233
|
const spentVtxos = [];
|
|
9054
9234
|
for (const [key, vtxo] of state.lastKnownVtxos) {
|
|
9055
9235
|
if (!currentKeys.has(key)) {
|
|
9056
|
-
spentVtxos.push(vtxo);
|
|
9236
|
+
spentVtxos.push(knownByKey.get(key) ?? vtxo);
|
|
9057
9237
|
state.lastKnownVtxos.delete(key);
|
|
9058
9238
|
}
|
|
9059
9239
|
}
|
|
@@ -9124,10 +9304,10 @@ var ContractWatcher = class {
|
|
|
9124
9304
|
/**
|
|
9125
9305
|
* Update the subscription with scripts that should be watched.
|
|
9126
9306
|
*
|
|
9127
|
-
* @see
|
|
9307
|
+
* @see getSubscribedScripts
|
|
9128
9308
|
*/
|
|
9129
9309
|
async updateSubscription() {
|
|
9130
|
-
const scriptsToWatch = this.
|
|
9310
|
+
const scriptsToWatch = this.getSubscribedScripts();
|
|
9131
9311
|
if (scriptsToWatch.length === 0) {
|
|
9132
9312
|
if (this.subscriptionId) {
|
|
9133
9313
|
try {
|
|
@@ -9211,16 +9391,26 @@ var ContractWatcher = class {
|
|
|
9211
9391
|
*/
|
|
9212
9392
|
processSubscriptionVtxos(vtxos, eventType, timestamp) {
|
|
9213
9393
|
const byContract = /* @__PURE__ */ new Map();
|
|
9394
|
+
const byWatchedScript = /* @__PURE__ */ new Map();
|
|
9214
9395
|
let unknownScript = 0;
|
|
9396
|
+
const now = { timestamp: /* @__PURE__ */ new Date() };
|
|
9215
9397
|
for (const vtxo of vtxos) {
|
|
9216
|
-
|
|
9398
|
+
const state = this.contracts.get(vtxo.script);
|
|
9399
|
+
const watchOnly = this.watchedScripts.has(vtxo.script);
|
|
9400
|
+
const preferContract = state !== void 0 && (!watchOnly || isWatchedContract(state.contract));
|
|
9401
|
+
const target = preferContract ? byContract : watchOnly ? byWatchedScript : void 0;
|
|
9402
|
+
if (!target) {
|
|
9217
9403
|
unknownScript++;
|
|
9218
9404
|
continue;
|
|
9219
9405
|
}
|
|
9220
|
-
|
|
9406
|
+
if (target === byWatchedScript && eventType === "vtxo_received") {
|
|
9407
|
+
const n = normalizeVtxo(vtxo);
|
|
9408
|
+
if (hasTerminalSpend(n) || n.isSwept || isPastExpiry(n, now)) continue;
|
|
9409
|
+
}
|
|
9410
|
+
let bucket = target.get(vtxo.script);
|
|
9221
9411
|
if (!bucket) {
|
|
9222
9412
|
bucket = [];
|
|
9223
|
-
|
|
9413
|
+
target.set(vtxo.script, bucket);
|
|
9224
9414
|
}
|
|
9225
9415
|
bucket.push(vtxo);
|
|
9226
9416
|
}
|
|
@@ -9243,6 +9433,29 @@ var ContractWatcher = class {
|
|
|
9243
9433
|
}
|
|
9244
9434
|
this.emitVtxoEvent(contractScript, bucketVtxos, eventType, timestamp);
|
|
9245
9435
|
}
|
|
9436
|
+
for (const [script, bucketVtxos] of byWatchedScript) {
|
|
9437
|
+
const state = this.watchedScripts.get(script);
|
|
9438
|
+
if (state) {
|
|
9439
|
+
for (const vtxo of bucketVtxos) {
|
|
9440
|
+
const key = `${vtxo.txid}:${vtxo.vout}`;
|
|
9441
|
+
if (eventType === "vtxo_received") {
|
|
9442
|
+
state.lastKnownVtxos.set(key, vtxo);
|
|
9443
|
+
} else {
|
|
9444
|
+
state.lastKnownVtxos.delete(key);
|
|
9445
|
+
}
|
|
9446
|
+
}
|
|
9447
|
+
}
|
|
9448
|
+
this.emitWatchedScriptEvent(script, bucketVtxos, eventType, timestamp);
|
|
9449
|
+
}
|
|
9450
|
+
}
|
|
9451
|
+
/** As {@link emitVtxoEvent}, less the `contract` and the annotation. */
|
|
9452
|
+
emitWatchedScriptEvent(script, vtxos, eventType, timestamp) {
|
|
9453
|
+
if (!this.eventCallback) return;
|
|
9454
|
+
if (eventType === "vtxo_received") {
|
|
9455
|
+
this.eventCallback({ type: "vtxo_received", contractScript: script, vtxos, timestamp });
|
|
9456
|
+
return;
|
|
9457
|
+
}
|
|
9458
|
+
this.eventCallback({ type: "vtxo_spent", contractScript: script, vtxos, timestamp });
|
|
9246
9459
|
}
|
|
9247
9460
|
/**
|
|
9248
9461
|
* Emit a virtual output event for a contract.
|
|
@@ -9414,6 +9627,7 @@ var ContractManager = class _ContractManager {
|
|
|
9414
9627
|
syncDegradedReason;
|
|
9415
9628
|
/** Epoch-ms of the last successful provider sync, if any. */
|
|
9416
9629
|
lastSyncedAt;
|
|
9630
|
+
syncedAtByScript = /* @__PURE__ */ new Map();
|
|
9417
9631
|
/** Last chain tip read, with the epoch-ms it was read at. @see currentChainTip */
|
|
9418
9632
|
chainTipCache;
|
|
9419
9633
|
/** In-flight chain tip read, so concurrent cache misses share one. */
|
|
@@ -9467,6 +9681,10 @@ var ContractManager = class _ContractManager {
|
|
|
9467
9681
|
lastSyncedAt: this.lastSyncedAt
|
|
9468
9682
|
};
|
|
9469
9683
|
}
|
|
9684
|
+
/** @see ContractManagerConfig.vtxoSyncMaxAgeMs — for factory-built managers. */
|
|
9685
|
+
setVtxoSyncMaxAge(maxAgeMs) {
|
|
9686
|
+
this.config.vtxoSyncMaxAgeMs = maxAgeMs;
|
|
9687
|
+
}
|
|
9470
9688
|
markSyncOnline() {
|
|
9471
9689
|
this.lastSyncedAt = Date.now();
|
|
9472
9690
|
this.syncDegradedReason = this.annotationDegradedReason();
|
|
@@ -9770,6 +9988,41 @@ var ContractManager = class _ContractManager {
|
|
|
9770
9988
|
}
|
|
9771
9989
|
return contract;
|
|
9772
9990
|
}
|
|
9991
|
+
/**
|
|
9992
|
+
* `createContract`'s step order, fetch batched: persist all, hydrate once,
|
|
9993
|
+
* then watch. Hydrating first keeps it equivalent — the watcher seeds from
|
|
9994
|
+
* the repository, so an unhydrated row reads as all-new. A part-way failure
|
|
9995
|
+
* still watches what it wrote; a retry reports those rows as existing.
|
|
9996
|
+
*/
|
|
9997
|
+
async createContracts(paramsList) {
|
|
9998
|
+
if (paramsList.length === 0) return [];
|
|
9999
|
+
return this.watcher.withCoalescedSubscription(async () => {
|
|
10000
|
+
const upserted = [];
|
|
10001
|
+
try {
|
|
10002
|
+
for (const params of paramsList) upserted.push(await this.upsertContract(params));
|
|
10003
|
+
} catch (err) {
|
|
10004
|
+
for (const u of upserted) {
|
|
10005
|
+
if (!u.persisted) continue;
|
|
10006
|
+
await this.watcher.addContract(u.contract).catch(
|
|
10007
|
+
(e) => console.error(`ContractManager: ${u.contract.script} left dark`, e)
|
|
10008
|
+
);
|
|
10009
|
+
}
|
|
10010
|
+
throw err;
|
|
10011
|
+
}
|
|
10012
|
+
const fresh = upserted.filter((u) => u.persisted).map((u) => u.contract);
|
|
10013
|
+
if (fresh.length > 0) {
|
|
10014
|
+
try {
|
|
10015
|
+
await this.fetchContractVxosFromIndexer(fresh);
|
|
10016
|
+
this.markSyncOnline();
|
|
10017
|
+
} catch (err) {
|
|
10018
|
+
if (!isRetryableProviderError(err)) throw err;
|
|
10019
|
+
this.markSyncDegraded(err);
|
|
10020
|
+
}
|
|
10021
|
+
for (const contract of fresh) await this.watcher.addContract(contract);
|
|
10022
|
+
}
|
|
10023
|
+
return upserted.map((u) => u.contract);
|
|
10024
|
+
});
|
|
10025
|
+
}
|
|
9773
10026
|
/**
|
|
9774
10027
|
* Lightweight variant of {@link createContract} for batch discovery
|
|
9775
10028
|
* paths (currently: {@link scanContracts}). Validates, dedupes, persists,
|
|
@@ -10031,12 +10284,16 @@ var ContractManager = class _ContractManager {
|
|
|
10031
10284
|
}
|
|
10032
10285
|
async getContractsWithVtxos(filter, pageSize) {
|
|
10033
10286
|
const contracts = await this.getContracts(filter);
|
|
10034
|
-
|
|
10035
|
-
await this.
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10287
|
+
if (this.syncedWithin(contracts, this.config.vtxoSyncMaxAgeMs ?? 0)) {
|
|
10288
|
+
await this.demoteFundedAwaitingContracts(contracts);
|
|
10289
|
+
} else {
|
|
10290
|
+
try {
|
|
10291
|
+
await this.syncContracts({ contracts, pageSize });
|
|
10292
|
+
this.markSyncOnline();
|
|
10293
|
+
} catch (err) {
|
|
10294
|
+
if (!isRetryableProviderError(err)) throw err;
|
|
10295
|
+
this.markSyncDegraded(err);
|
|
10296
|
+
}
|
|
10040
10297
|
}
|
|
10041
10298
|
const vtxos = await this.getVtxosForContracts(contracts);
|
|
10042
10299
|
return contracts.map((contract) => ({
|
|
@@ -10398,6 +10655,18 @@ var ContractManager = class _ContractManager {
|
|
|
10398
10655
|
async isWatching() {
|
|
10399
10656
|
return this.watcher.isCurrentlyWatching();
|
|
10400
10657
|
}
|
|
10658
|
+
/** @see IContractManager.watchScript */
|
|
10659
|
+
async watchScript(script, options) {
|
|
10660
|
+
await this.watcher.addWatchedScript(script, options);
|
|
10661
|
+
}
|
|
10662
|
+
/** @see IContractManager.unwatchScript */
|
|
10663
|
+
async unwatchScript(script) {
|
|
10664
|
+
await this.watcher.removeWatchedScript(script);
|
|
10665
|
+
}
|
|
10666
|
+
/** @see IContractManager.getWatchedScripts */
|
|
10667
|
+
async getWatchedScripts() {
|
|
10668
|
+
return this.watcher.getWatchedScripts();
|
|
10669
|
+
}
|
|
10401
10670
|
/**
|
|
10402
10671
|
* Emit an event to all registered callbacks.
|
|
10403
10672
|
*/
|
|
@@ -10418,11 +10687,15 @@ var ContractManager = class _ContractManager {
|
|
|
10418
10687
|
try {
|
|
10419
10688
|
switch (event.type) {
|
|
10420
10689
|
// Delta-sync only the changed virtual outputs for this contract.
|
|
10690
|
+
// The guard below is the ownership boundary: a watch-only script
|
|
10691
|
+
// reports these same types, so it must precede `syncContracts`.
|
|
10421
10692
|
case "vtxo_received":
|
|
10693
|
+
if (!isContractVtxoEvent(event)) break;
|
|
10422
10694
|
await this.syncContracts({ contracts: [event.contract] });
|
|
10423
10695
|
this.markSyncOnline();
|
|
10424
10696
|
break;
|
|
10425
10697
|
case "vtxo_spent":
|
|
10698
|
+
if (!isContractVtxoEvent(event)) break;
|
|
10426
10699
|
await this.syncContracts({ contracts: [event.contract] });
|
|
10427
10700
|
this.markSyncOnline();
|
|
10428
10701
|
if (this.config.onVtxosSpent) {
|
|
@@ -10435,6 +10708,7 @@ var ContractManager = class _ContractManager {
|
|
|
10435
10708
|
}
|
|
10436
10709
|
break;
|
|
10437
10710
|
case "connection_reset":
|
|
10711
|
+
this.syncedAtByScript.clear();
|
|
10438
10712
|
await this.scheduleLookAheadDrain();
|
|
10439
10713
|
await this.reconcileWatched();
|
|
10440
10714
|
this.markSyncOnline();
|
|
@@ -10481,9 +10755,21 @@ var ContractManager = class _ContractManager {
|
|
|
10481
10755
|
const cutoff = cursorCutoff(requestStartedAt);
|
|
10482
10756
|
await advanceSyncCursor(this.config.walletRepository, cutoff);
|
|
10483
10757
|
}
|
|
10758
|
+
if (options.window === void 0) {
|
|
10759
|
+
for (const contract of contracts) {
|
|
10760
|
+
this.syncedAtByScript.set(contract.script, requestStartedAt);
|
|
10761
|
+
}
|
|
10762
|
+
}
|
|
10484
10763
|
await this.demoteFundedAwaitingContracts(contracts);
|
|
10485
10764
|
return result;
|
|
10486
10765
|
}
|
|
10766
|
+
syncedWithin(contracts, maxAgeMs) {
|
|
10767
|
+
if (maxAgeMs <= 0) return false;
|
|
10768
|
+
const floor = Date.now() - maxAgeMs;
|
|
10769
|
+
return contracts.every(
|
|
10770
|
+
(contract) => (this.syncedAtByScript.get(contract.script) ?? 0) >= floor
|
|
10771
|
+
);
|
|
10772
|
+
}
|
|
10487
10773
|
/**
|
|
10488
10774
|
* Demote every `awaiting-funds` contract in `contracts` that has been
|
|
10489
10775
|
* funded — the automatic half of {@link ContractWatchState}.
|
|
@@ -12889,7 +13175,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
12889
13175
|
const vtxos = filterSnapshotVtxos(snapshot, filter, this._pendingSpendOutpoints);
|
|
12890
13176
|
const { gated, pendingRecovery } = this.spendabilityView(snapshot);
|
|
12891
13177
|
const selectable = vtxos.filter(
|
|
12892
|
-
(vtxo) => !
|
|
13178
|
+
(vtxo) => !isGatedVtxo(vtxo, gated) && !pendingRecovery.has(`${vtxo.txid}:${vtxo.vout}`)
|
|
12893
13179
|
);
|
|
12894
13180
|
const unlocked = await spendableVtxosExcludingLocked(selectable, this.intentRepository);
|
|
12895
13181
|
logExcludedVtxos("getSpendableVtxos", vtxos, [
|
|
@@ -12987,7 +13273,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
12987
13273
|
*/
|
|
12988
13274
|
spendabilityView(snapshot) {
|
|
12989
13275
|
return {
|
|
12990
|
-
gated:
|
|
13276
|
+
gated: gatedFrom(snapshot),
|
|
12991
13277
|
pendingRecovery: this.selectPendingRecovery(snapshot)
|
|
12992
13278
|
};
|
|
12993
13279
|
}
|
|
@@ -13002,7 +13288,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
13002
13288
|
return {
|
|
13003
13289
|
now: { timestamp: /* @__PURE__ */ new Date() },
|
|
13004
13290
|
isPendingRecovery: (vtxo) => pendingRecovery.has(`${vtxo.txid}:${vtxo.vout}`),
|
|
13005
|
-
isGenericallySpendable: (vtxo) => !
|
|
13291
|
+
isGenericallySpendable: (vtxo) => !isGatedVtxo(vtxo, gated),
|
|
13006
13292
|
isUnlocked: (vtxo) => unlocked.has(`${vtxo.txid}:${vtxo.vout}`)
|
|
13007
13293
|
};
|
|
13008
13294
|
}
|
|
@@ -13042,16 +13328,18 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
13042
13328
|
* Return wallet transaction history derived from Arkade state and boarding transactions.
|
|
13043
13329
|
*/
|
|
13044
13330
|
async getTransactionHistory() {
|
|
13045
|
-
const
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13331
|
+
const [snapshot, { boardingTxs, commitmentsToIgnore }] = await Promise.all([
|
|
13332
|
+
this.contractSnapshot(),
|
|
13333
|
+
this.getBoardingTxs()
|
|
13334
|
+
]);
|
|
13335
|
+
const allVtxos = snapshot.flatMap((_) => _.vtxos);
|
|
13049
13336
|
const resolveTxCreatedAt = (txids) => fetchVtxoCreatedAtByTxid(this.indexerProvider, txids);
|
|
13050
13337
|
return buildTransactionHistory(
|
|
13051
13338
|
allVtxos,
|
|
13052
13339
|
boardingTxs,
|
|
13053
13340
|
commitmentsToIgnore,
|
|
13054
|
-
resolveTxCreatedAt
|
|
13341
|
+
resolveTxCreatedAt,
|
|
13342
|
+
gatedFrom(snapshot)
|
|
13055
13343
|
);
|
|
13056
13344
|
}
|
|
13057
13345
|
/**
|
|
@@ -13349,7 +13637,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
13349
13637
|
const cm = await this.getContractManager();
|
|
13350
13638
|
let annotationQueue = Promise.resolve();
|
|
13351
13639
|
indexerStopFunc = cm.onContractEvent((event) => {
|
|
13352
|
-
if (event
|
|
13640
|
+
if (!isContractVtxoEvent(event)) {
|
|
13353
13641
|
return;
|
|
13354
13642
|
}
|
|
13355
13643
|
if (event.contract.type !== "default" && event.contract.type !== "delegate") {
|
|
@@ -14411,7 +14699,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
14411
14699
|
`restore: gapLimit must be a positive integer (got ${String(opts?.gapLimit)})`
|
|
14412
14700
|
);
|
|
14413
14701
|
}
|
|
14414
|
-
this._restoreInFlight =
|
|
14702
|
+
this._restoreInFlight = (async () => {
|
|
14703
|
+
await this._runRestore(gapLimit);
|
|
14704
|
+
await runWalletRestoreHooks(this);
|
|
14705
|
+
})().finally(() => {
|
|
14415
14706
|
this._restoreInFlight = void 0;
|
|
14416
14707
|
});
|
|
14417
14708
|
return this._restoreInFlight;
|
|
@@ -17421,6 +17712,9 @@ var DelegateNotConfiguredError = class extends Error {
|
|
|
17421
17712
|
};
|
|
17422
17713
|
var DelegatorNotConfiguredError = DelegateNotConfiguredError;
|
|
17423
17714
|
var DEFAULT_MESSAGE_TAG = "WALLET_UPDATER";
|
|
17715
|
+
function unsupportedByManager(method) {
|
|
17716
|
+
return new Error(`Contract manager does not support ${method}`);
|
|
17717
|
+
}
|
|
17424
17718
|
var serializeMigrationVtxoRef = (ref) => ({
|
|
17425
17719
|
txid: ref.txid,
|
|
17426
17720
|
vout: ref.vout,
|
|
@@ -17728,8 +18022,7 @@ var WalletMessageHandler = class {
|
|
|
17728
18022
|
});
|
|
17729
18023
|
}
|
|
17730
18024
|
case "GET_TRANSACTION_HISTORY": {
|
|
17731
|
-
const
|
|
17732
|
-
const transactions = await this.buildTransactionHistoryFromCache(allVtxos) ?? [];
|
|
18025
|
+
const transactions = await this.buildTransactionHistoryFromCache() ?? [];
|
|
17733
18026
|
return this.tagged({
|
|
17734
18027
|
id,
|
|
17735
18028
|
type: "TRANSACTION_HISTORY",
|
|
@@ -17805,6 +18098,39 @@ var WalletMessageHandler = class {
|
|
|
17805
18098
|
payload: { contracts }
|
|
17806
18099
|
});
|
|
17807
18100
|
}
|
|
18101
|
+
case "WATCH_SCRIPT": {
|
|
18102
|
+
const manager = await this.readonlyWallet.getContractManager();
|
|
18103
|
+
if (!manager.watchScript) throw unsupportedByManager("watchScript");
|
|
18104
|
+
await manager.watchScript(message.payload.script, {
|
|
18105
|
+
label: message.payload.label
|
|
18106
|
+
});
|
|
18107
|
+
return this.tagged({
|
|
18108
|
+
id,
|
|
18109
|
+
type: "SCRIPT_WATCHED",
|
|
18110
|
+
payload: { script: message.payload.script }
|
|
18111
|
+
});
|
|
18112
|
+
}
|
|
18113
|
+
case "UNWATCH_SCRIPT": {
|
|
18114
|
+
const manager = await this.readonlyWallet.getContractManager();
|
|
18115
|
+
if (!manager.unwatchScript) throw unsupportedByManager("unwatchScript");
|
|
18116
|
+
await manager.unwatchScript(message.payload.script);
|
|
18117
|
+
return this.tagged({
|
|
18118
|
+
id,
|
|
18119
|
+
type: "SCRIPT_UNWATCHED",
|
|
18120
|
+
payload: { script: message.payload.script }
|
|
18121
|
+
});
|
|
18122
|
+
}
|
|
18123
|
+
case "GET_WATCHED_SCRIPTS": {
|
|
18124
|
+
const manager = await this.readonlyWallet.getContractManager();
|
|
18125
|
+
if (!manager.getWatchedScripts) {
|
|
18126
|
+
throw unsupportedByManager("getWatchedScripts");
|
|
18127
|
+
}
|
|
18128
|
+
return this.tagged({
|
|
18129
|
+
id,
|
|
18130
|
+
type: "WATCHED_SCRIPTS",
|
|
18131
|
+
payload: { scripts: await manager.getWatchedScripts() }
|
|
18132
|
+
});
|
|
18133
|
+
}
|
|
17808
18134
|
case "ANNOTATE_VTXOS": {
|
|
17809
18135
|
const manager = await this.readonlyWallet.getContractManager();
|
|
17810
18136
|
const annotated = await manager.annotateVtxos(message.payload.vtxos);
|
|
@@ -18178,7 +18504,7 @@ var WalletMessageHandler = class {
|
|
|
18178
18504
|
unconfirmed += utxo.value;
|
|
18179
18505
|
}
|
|
18180
18506
|
}
|
|
18181
|
-
const gated =
|
|
18507
|
+
const gated = gatedFrom(snapshot);
|
|
18182
18508
|
const unlocked = new Set(
|
|
18183
18509
|
(await spendableVtxosExcludingLocked(allVtxos, this.readonlyWallet?.intentRepository)).map((vtxo) => `${vtxo.txid}:${vtxo.vout}`)
|
|
18184
18510
|
);
|
|
@@ -18186,7 +18512,7 @@ var WalletMessageHandler = class {
|
|
|
18186
18512
|
const offchain = computeOffchainBalance(allVtxos, {
|
|
18187
18513
|
now: { timestamp: /* @__PURE__ */ new Date() },
|
|
18188
18514
|
isPendingRecovery: (vtxo) => pendingOutpoints.has(`${vtxo.txid}:${vtxo.vout}`),
|
|
18189
|
-
isGenericallySpendable: (vtxo) => !
|
|
18515
|
+
isGenericallySpendable: (vtxo) => !isGatedVtxo(vtxo, gated),
|
|
18190
18516
|
isUnlocked: (vtxo) => unlocked.has(`${vtxo.txid}:${vtxo.vout}`)
|
|
18191
18517
|
});
|
|
18192
18518
|
return {
|
|
@@ -18326,7 +18652,6 @@ var WalletMessageHandler = class {
|
|
|
18326
18652
|
if (!this.readonlyWallet || !this.walletRepository) {
|
|
18327
18653
|
return;
|
|
18328
18654
|
}
|
|
18329
|
-
const vtxos = await this.getVtxosFromRepo();
|
|
18330
18655
|
const boardingAddresses = await this.readonlyWallet.getBoardingAddresses();
|
|
18331
18656
|
const fresh = await this.readonlyWallet.getBoardingUtxos();
|
|
18332
18657
|
const freshKeys = new Set(fresh.map((u) => `${u.txid}:${u.vout}`));
|
|
@@ -18338,7 +18663,7 @@ var WalletMessageHandler = class {
|
|
|
18338
18663
|
if (kept.length > 0) await this.walletRepository.saveUtxos(addr, kept);
|
|
18339
18664
|
}
|
|
18340
18665
|
const address = await this.readonlyWallet.getAddress();
|
|
18341
|
-
const txs = await this.buildTransactionHistoryFromCache(
|
|
18666
|
+
const txs = await this.buildTransactionHistoryFromCache();
|
|
18342
18667
|
if (txs) await this.walletRepository.saveTransactions(address, txs);
|
|
18343
18668
|
}
|
|
18344
18669
|
/**
|
|
@@ -18546,13 +18871,29 @@ var WalletMessageHandler = class {
|
|
|
18546
18871
|
/**
|
|
18547
18872
|
* Build transaction history from cached virtual outputs, hitting the indexer only for
|
|
18548
18873
|
* uncached timestamps. Best-effort, like the plain Wallet path.
|
|
18549
|
-
|
|
18550
|
-
|
|
18874
|
+
*
|
|
18875
|
+
* Takes its own {@link repoSnapshot} rather than a caller-supplied VTXO
|
|
18876
|
+
* list: the coins and the gate that judges them have to come off one read
|
|
18877
|
+
* or they answer about different instants, and being the worker's only
|
|
18878
|
+
* history builder means neither caller can supply one without the other.
|
|
18879
|
+
* The snapshot and the boarding read are independent, so they run together
|
|
18880
|
+
* — the same pairing `handleGetBalance` makes.
|
|
18881
|
+
*/
|
|
18882
|
+
async buildTransactionHistoryFromCache() {
|
|
18551
18883
|
if (!this.readonlyWallet) return null;
|
|
18552
|
-
const { boardingTxs, commitmentsToIgnore } = await
|
|
18884
|
+
const [{ snapshot, vtxos }, { boardingTxs, commitmentsToIgnore }] = await Promise.all([
|
|
18885
|
+
this.repoSnapshot(),
|
|
18886
|
+
this.readonlyWallet.getBoardingTxs()
|
|
18887
|
+
]);
|
|
18553
18888
|
const indexerProvider = this.indexerProvider;
|
|
18554
18889
|
const resolveTxCreatedAt = indexerProvider ? (txids) => fetchVtxoCreatedAtByTxid(indexerProvider, txids) : void 0;
|
|
18555
|
-
return buildTransactionHistory(
|
|
18890
|
+
return buildTransactionHistory(
|
|
18891
|
+
vtxos,
|
|
18892
|
+
boardingTxs,
|
|
18893
|
+
commitmentsToIgnore,
|
|
18894
|
+
resolveTxCreatedAt,
|
|
18895
|
+
gatedFrom(snapshot)
|
|
18896
|
+
);
|
|
18556
18897
|
}
|
|
18557
18898
|
async ensureContractEventBroadcasting() {
|
|
18558
18899
|
const wallet = this.readonlyWallet;
|
|
@@ -18608,6 +18949,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
|
|
|
18608
18949
|
GET_TRANSACTION_HISTORY: 2e4,
|
|
18609
18950
|
GET_CONTRACTS: 2e4,
|
|
18610
18951
|
GET_CONTRACTS_WITH_VTXOS: 2e4,
|
|
18952
|
+
GET_WATCHED_SCRIPTS: 1e4,
|
|
18611
18953
|
ANNOTATE_VTXOS: 2e4,
|
|
18612
18954
|
GET_SPENDABLE_PATHS: 2e4,
|
|
18613
18955
|
GET_ALL_SPENDING_PATHS: 2e4,
|
|
@@ -18644,6 +18986,10 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
|
|
|
18644
18986
|
SIGN_TRANSACTION: 3e4,
|
|
18645
18987
|
CREATE_CONTRACT: 3e4,
|
|
18646
18988
|
UPDATE_CONTRACT: 3e4,
|
|
18989
|
+
// Registering a watch is an in-memory map write plus one subscription
|
|
18990
|
+
// update — no indexer round trip on the request path.
|
|
18991
|
+
WATCH_SCRIPT: 1e4,
|
|
18992
|
+
UNWATCH_SCRIPT: 1e4,
|
|
18647
18993
|
DELETE_CONTRACT: 1e4,
|
|
18648
18994
|
REFRESH_VTXOS: 3e4,
|
|
18649
18995
|
REFRESH_OUTPOINTS: 3e4
|
|
@@ -18664,6 +19010,7 @@ var DEDUPABLE_REQUEST_TYPES = /* @__PURE__ */ new Set([
|
|
|
18664
19010
|
"GET_SPENDABLE_VTXOS",
|
|
18665
19011
|
"GET_CONTRACTS",
|
|
18666
19012
|
"GET_CONTRACTS_WITH_VTXOS",
|
|
19013
|
+
"GET_WATCHED_SCRIPTS",
|
|
18667
19014
|
"ANNOTATE_VTXOS",
|
|
18668
19015
|
"GET_SPENDABLE_PATHS",
|
|
18669
19016
|
"GET_ALL_SPENDING_PATHS",
|
|
@@ -19372,6 +19719,46 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
19372
19719
|
throw new Error("Failed to get contracts with vtxos");
|
|
19373
19720
|
}
|
|
19374
19721
|
},
|
|
19722
|
+
async watchScript(script, options) {
|
|
19723
|
+
const message = {
|
|
19724
|
+
type: "WATCH_SCRIPT",
|
|
19725
|
+
id: getRandomId(),
|
|
19726
|
+
tag: messageTag,
|
|
19727
|
+
payload: { script, label: options?.label }
|
|
19728
|
+
};
|
|
19729
|
+
try {
|
|
19730
|
+
await sendContractMessage(message);
|
|
19731
|
+
} catch (e) {
|
|
19732
|
+
throw new Error("Failed to watch script");
|
|
19733
|
+
}
|
|
19734
|
+
},
|
|
19735
|
+
async unwatchScript(script) {
|
|
19736
|
+
const message = {
|
|
19737
|
+
type: "UNWATCH_SCRIPT",
|
|
19738
|
+
id: getRandomId(),
|
|
19739
|
+
tag: messageTag,
|
|
19740
|
+
payload: { script }
|
|
19741
|
+
};
|
|
19742
|
+
try {
|
|
19743
|
+
await sendContractMessage(message);
|
|
19744
|
+
} catch (e) {
|
|
19745
|
+
throw new Error("Failed to unwatch script");
|
|
19746
|
+
}
|
|
19747
|
+
},
|
|
19748
|
+
async getWatchedScripts() {
|
|
19749
|
+
const message = {
|
|
19750
|
+
type: "GET_WATCHED_SCRIPTS",
|
|
19751
|
+
id: getRandomId(),
|
|
19752
|
+
tag: messageTag,
|
|
19753
|
+
payload: {}
|
|
19754
|
+
};
|
|
19755
|
+
try {
|
|
19756
|
+
const response = await sendContractMessage(message);
|
|
19757
|
+
return response.payload.scripts;
|
|
19758
|
+
} catch (e) {
|
|
19759
|
+
throw new Error("Failed to get watched scripts");
|
|
19760
|
+
}
|
|
19761
|
+
},
|
|
19375
19762
|
getSyncState() {
|
|
19376
19763
|
return syncState;
|
|
19377
19764
|
},
|
|
@@ -19602,6 +19989,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
19602
19989
|
identity;
|
|
19603
19990
|
_assetManager;
|
|
19604
19991
|
hasDelegate;
|
|
19992
|
+
_restoreInFlight;
|
|
19605
19993
|
get assetManager() {
|
|
19606
19994
|
return this._assetManager;
|
|
19607
19995
|
}
|
|
@@ -19864,6 +20252,16 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
19864
20252
|
* reconstructed here so callers can inspect `.errors`.
|
|
19865
20253
|
*/
|
|
19866
20254
|
async restore(opts) {
|
|
20255
|
+
if (this._restoreInFlight) return this._restoreInFlight;
|
|
20256
|
+
this._restoreInFlight = (async () => {
|
|
20257
|
+
await this._restoreWorkerWallet(opts);
|
|
20258
|
+
await runWalletRestoreHooks(this);
|
|
20259
|
+
})().finally(() => {
|
|
20260
|
+
this._restoreInFlight = void 0;
|
|
20261
|
+
});
|
|
20262
|
+
return this._restoreInFlight;
|
|
20263
|
+
}
|
|
20264
|
+
async _restoreWorkerWallet(opts) {
|
|
19867
20265
|
const message = {
|
|
19868
20266
|
id: getRandomId(),
|
|
19869
20267
|
tag: this.messageTag,
|
|
@@ -21453,7 +21851,7 @@ var RestEmulatorProvider = class {
|
|
|
21453
21851
|
serverUrl;
|
|
21454
21852
|
async getInfo() {
|
|
21455
21853
|
const url = `${this.serverUrl}/v1/info`;
|
|
21456
|
-
const response = await
|
|
21854
|
+
const response = await baseFetch(url);
|
|
21457
21855
|
if (!response.ok) {
|
|
21458
21856
|
const errorText2 = await response.text();
|
|
21459
21857
|
throw new Error(`Failed to get emulator info: ${errorText2}`);
|
|
@@ -23888,6 +24286,6 @@ function createDefaultPaymentRouter(wallet) {
|
|
|
23888
24286
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
23889
24287
|
*/
|
|
23890
24288
|
|
|
23891
|
-
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, 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, walletFeeSource, warnAndFilterVtxosForScript, withPrevTxs };
|
|
23892
|
-
//# sourceMappingURL=chunk-
|
|
23893
|
-
//# sourceMappingURL=chunk-
|
|
24289
|
+
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, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deleteByIndex, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, exitObserverFor, extendVirtualCoinForContract, extractArkProviderUrl, gateExclusion, gatedContracts, getAllByIndexValues, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, isWatchedContract, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, requiresMigration, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, warnAndFilterVtxosForScript, withPrevTxs };
|
|
24290
|
+
//# sourceMappingURL=chunk-BHLYB44A.js.map
|
|
24291
|
+
//# sourceMappingURL=chunk-BHLYB44A.js.map
|