@arkade-os/sdk 0.5.13 → 0.5.15
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 +55 -1
- package/dist/adapters/expo.cjs +6 -6
- 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/artifact-DA5YHM2k.d.cts +87 -0
- package/dist/artifact-DacurepK.d.ts +87 -0
- package/dist/{asyncStorageTaskQueue-Dhbe00Ya.d.ts → asyncStorageTaskQueue-B3umqlkb.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-Y4BlVm41.d.cts → asyncStorageTaskQueue-Dq6AJHNv.d.cts} +1 -1
- package/dist/{chunk-TYSUFG2K.cjs → chunk-35GRSVCZ.cjs} +11 -11
- package/dist/{chunk-TYSUFG2K.cjs.map → chunk-35GRSVCZ.cjs.map} +1 -1
- package/dist/{chunk-X57WKONW.js → chunk-43APGKWL.js} +130 -22
- package/dist/chunk-43APGKWL.js.map +1 -0
- package/dist/{chunk-6WPP4UGN.cjs → chunk-CMFRCBZW.cjs} +1245 -658
- package/dist/chunk-CMFRCBZW.cjs.map +1 -0
- package/dist/{chunk-HS7TKVOZ.cjs → chunk-FKHUXSYW.cjs} +8 -4
- package/dist/chunk-FKHUXSYW.cjs.map +1 -0
- package/dist/{chunk-BP4NA7HK.js → chunk-HVUZKXB2.js} +4 -4
- package/dist/{chunk-BP4NA7HK.js.map → chunk-HVUZKXB2.js.map} +1 -1
- package/dist/{chunk-6XVTGWQK.cjs → chunk-INQAIZUO.cjs} +17 -17
- package/dist/{chunk-6XVTGWQK.cjs.map → chunk-INQAIZUO.cjs.map} +1 -1
- package/dist/{chunk-WFJPLXOE.cjs → chunk-JSYS2KX3.cjs} +18 -18
- package/dist/{chunk-WFJPLXOE.cjs.map → chunk-JSYS2KX3.cjs.map} +1 -1
- package/dist/{chunk-QSERJPTT.js → chunk-R37I633T.js} +22 -17
- package/dist/chunk-R37I633T.js.map +1 -0
- package/dist/{chunk-ACIQZLWL.cjs → chunk-UNLH3NNG.cjs} +129 -20
- package/dist/chunk-UNLH3NNG.cjs.map +1 -0
- package/dist/{chunk-TD4PKK2I.cjs → chunk-VIQF74QJ.cjs} +38 -33
- package/dist/chunk-VIQF74QJ.cjs.map +1 -0
- package/dist/{chunk-D4QH6L54.js → chunk-XPZ7TMXH.js} +4 -4
- package/dist/{chunk-D4QH6L54.js.map → chunk-XPZ7TMXH.js.map} +1 -1
- package/dist/{chunk-BA36SQY2.js → chunk-YYSHQPCG.js} +3 -3
- package/dist/{chunk-BA36SQY2.js.map → chunk-YYSHQPCG.js.map} +1 -1
- package/dist/{chunk-LHLRG2BE.js → chunk-Z4LG3CZ4.js} +8 -5
- package/dist/chunk-Z4LG3CZ4.js.map +1 -0
- package/dist/{chunk-Y3AWLHQP.js → chunk-ZECZ2MKX.js} +730 -143
- package/dist/chunk-ZECZ2MKX.js.map +1 -0
- package/dist/compiler.cjs +5 -5
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +10 -10
- package/dist/compiler.d.ts +10 -10
- package/dist/compiler.js +5 -5
- package/dist/compiler.js.map +1 -1
- package/dist/contracts/handlers/index.cjs +11 -11
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +3 -3
- package/dist/{index-BQwrHcOh.d.cts → index-Bi22mLsh.d.cts} +212 -43
- package/dist/{index-BapVvuoI.d.ts → index-CiLMmCHX.d.ts} +2 -2
- package/dist/{index-DuXylQrN.d.ts → index-DOdoDqvM.d.ts} +212 -43
- package/dist/{index-BaTItxPx.d.cts → index-DnKugm-h.d.cts} +2 -2
- package/dist/index.cjs +327 -327
- package/dist/index.d.cts +149 -114
- package/dist/index.d.ts +149 -114
- package/dist/index.js +5 -5
- package/dist/{program-DPzf5qsk.d.cts → program-ZWUAWy_9.d.cts} +1 -1
- package/dist/{program-38A2Twvj.d.ts → program-zdDO4cMt.d.ts} +1 -1
- package/dist/repositories/realm/index.cjs +38 -38
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +6 -6
- package/dist/repositories/sqlite/index.cjs +36 -36
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +6 -6
- package/dist/{taskRunner-BxOmg-O6.d.ts → taskRunner-CoE4Xx9K.d.ts} +1 -1
- package/dist/{taskRunner-D2itCXf6.d.cts → taskRunner-DFG0BN_R.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +15 -15
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +7 -7
- package/dist/wallet/expo/index.cjs +19 -16
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +3 -2
- package/dist/wallet/expo/index.d.ts +3 -2
- package/dist/wallet/expo/index.js +9 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +10 -10
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +6 -6
- package/package.json +3 -3
- package/dist/chunk-6WPP4UGN.cjs.map +0 -1
- package/dist/chunk-ACIQZLWL.cjs.map +0 -1
- package/dist/chunk-HS7TKVOZ.cjs.map +0 -1
- package/dist/chunk-LHLRG2BE.js.map +0 -1
- package/dist/chunk-QSERJPTT.js.map +0 -1
- package/dist/chunk-TD4PKK2I.cjs.map +0 -1
- package/dist/chunk-X57WKONW.js.map +0 -1
- package/dist/chunk-Y3AWLHQP.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Packet, AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, RestIndexerProvider, BufferReader, BufferWriter, IndexerUtxosUnsupportedError, AssetRef } from './chunk-
|
|
2
|
-
import { contractHandlers, speculativeReceiveMetadata, ExecutorContractHandler, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, normalizeToDescriptor, extractPubKey, parseHDDescriptor, identityDescriptor, DelegateVtxo, WALLET_RECEIVE_SOURCE, DefaultVtxo, executorContractParams, evenOwnerKey, DEFAULT_TEMPLATE_IDS, executorKeysOf, defaultVariables, BoardingContractHandler, DefaultContractHandler, delegateDiscoveryKeys, exitSequence } from './chunk-
|
|
3
|
-
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, programFromArtifact, parseArtifact, isContractArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, UnsupportedProgramVersionError, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, staticWitness, validateParamValue } from './chunk-
|
|
4
|
-
import { Transaction, requiresForfeit, setArkPsbtField, ConditionWitness, toOffchainInputFeeParams, normalizeVtxo, Proof, isVtxoSpent, getNormalizedVtxos, PrevArkTxField, craftToSpendTx, RestOperatorProvider, isVirtualCoin, ServerResponseMismatchError, getArkPsbtFields, CosignerPublicKey, isArkError, ArkErrorName, assertNonNegativeMs, isRetryableProviderError, OUTPOINT_QUERY_CHUNK_SIZE, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, VtxoTaprootTree, PrevoutTxField, OnchainCosignUnsupportedError, assertAllowedSighashTypes, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, baseFetch, HttpResponseError, assertTimerMs, isEventSourceError, isEventSourceUnavailableError, retryAfterMsFromError, MAX_COOLDOWN_MS, isPastExpiry, formatSighash, rateGate, OnchainCosignRejectedError, timeoutSignal, canRecoverOnchain, maybeArkError, READ_TIMEOUT_MS, OnchainCosignAmbiguousError, ArkError, indexerPages, resolveTimeHeight, canSpendOffchain, INFO_FETCH_TIMEOUT_MS, fetchVtxoCreatedAtByTxid, EXPIRY_MIN_PLAUSIBLE_MS, ProviderUnavailableError, ONCHAIN_COSIGN_REJECTED_PREFIX, ONCHAIN_COSIGN_AMBIGUOUS_PREFIX, ONCHAIN_COSIGN_UNSUPPORTED_PREFIX } from './chunk-
|
|
5
|
-
import { VtxoScript, __export, toXOnly, CSVMultisigTapscript, networks, getNetwork, DEFAULT_NETWORK, resolveEmulatorPubkey,
|
|
1
|
+
import { Packet, AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, RestIndexerProvider, BufferReader, BufferWriter, IndexerUtxosUnsupportedError, AssetRef } from './chunk-YYSHQPCG.js';
|
|
2
|
+
import { contractHandlers, speculativeReceiveMetadata, ExecutorContractHandler, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, normalizeToDescriptor, extractPubKey, parseHDDescriptor, identityDescriptor, DelegateVtxo, WALLET_RECEIVE_SOURCE, DefaultVtxo, executorContractParams, evenOwnerKey, DEFAULT_TEMPLATE_IDS, executorKeysOf, defaultVariables, BoardingContractHandler, DefaultContractHandler, delegateDiscoveryKeys, exitSequence } from './chunk-R37I633T.js';
|
|
3
|
+
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, programFromArtifact, parseArtifact, isContractArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, UnsupportedProgramVersionError, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, staticWitness, instantiatedContracts, validateParamValue } from './chunk-43APGKWL.js';
|
|
4
|
+
import { Transaction, requiresForfeit, setArkPsbtField, ConditionWitness, toOffchainInputFeeParams, normalizeVtxo, Proof, isVtxoSpent, getNormalizedVtxos, PrevArkTxField, craftToSpendTx, RestOperatorProvider, isVirtualCoin, ServerResponseMismatchError, getArkPsbtFields, CosignerPublicKey, isArkError, ArkErrorName, assertNonNegativeMs, isRetryableProviderError, OUTPOINT_QUERY_CHUNK_SIZE, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, VtxoTaprootTree, PrevoutTxField, OnchainCosignUnsupportedError, assertAllowedSighashTypes, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, baseFetch, HttpResponseError, assertTimerMs, isEventSourceError, isEventSourceUnavailableError, retryAfterMsFromError, MAX_COOLDOWN_MS, isPastExpiry, formatSighash, rateGate, OnchainCosignRejectedError, timeoutSignal, canRecoverOnchain, maybeArkError, READ_TIMEOUT_MS, OnchainCosignAmbiguousError, ArkError, isTransientOperatorError, indexerPages, resolveTimeHeight, canSpendOffchain, INFO_FETCH_TIMEOUT_MS, fetchVtxoCreatedAtByTxid, EXPIRY_MIN_PLAUSIBLE_MS, ProviderUnavailableError, ONCHAIN_COSIGN_REJECTED_PREFIX, ONCHAIN_COSIGN_AMBIGUOUS_PREFIX, ONCHAIN_COSIGN_UNSUPPORTED_PREFIX } from './chunk-Z4LG3CZ4.js';
|
|
5
|
+
import { VtxoScript, __export, toXOnly, CSVMultisigTapscript, networks, getNetwork, DEFAULT_NETWORK, resolveEmulatorPubkey, decodeTapscript, CLTVMultisigTapscript, ConditionCSVMultisigTapscript, timelockToSequence, ArkAddress, sequenceToTimelock, DEFAULT_ARKADE_SERVER_URL, DEFAULT_NETWORK_NAME, scriptFromTapLeafScript, proofTapLeafScriptOf, classifyAgainstSignerSet, networkFromOperatorInfo, toXOnlySignerHex, getSequence, signerSetFromInfo, isCooperativelyMigratable, MultisigTapscript, DEFAULT_ARKADE_EMULATOR_URL, retiredDelegatePubKeys, toBIP371TapTree } from './chunk-GB67AGXG.js';
|
|
6
6
|
import { entropyToMnemonic, mnemonicToSeedSync, validateMnemonic } from '@scure/bip39';
|
|
7
7
|
import { wordlist } from '@scure/bip39/wordlists/english.js';
|
|
8
8
|
import * as musig2 from '@scure/btc-signer/musig2.js';
|
|
@@ -1889,29 +1889,22 @@ var RestExecutorProvider = class {
|
|
|
1889
1889
|
body: JSON.stringify(body),
|
|
1890
1890
|
signal: options.signal
|
|
1891
1891
|
});
|
|
1892
|
-
if (response.status === 429) {
|
|
1893
|
-
rateGate.reportRateLimited(url, response.headers?.get("retry-after"));
|
|
1894
|
-
}
|
|
1895
1892
|
if (!response.ok) {
|
|
1896
|
-
throw await failure(
|
|
1893
|
+
throw await failure(
|
|
1894
|
+
response,
|
|
1895
|
+
"register delegation",
|
|
1896
|
+
await postErrorBody(url, response)
|
|
1897
|
+
);
|
|
1897
1898
|
}
|
|
1898
1899
|
const data = await response.json();
|
|
1899
1900
|
return parseDelegation(isObject(data) ? data.delegation : void 0);
|
|
1900
1901
|
}
|
|
1901
1902
|
async getDelegation(address, options = {}) {
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1903
|
+
const data = await this.getJson(
|
|
1904
|
+
`/v1/delegation?address=${encodeURIComponent(address)}`,
|
|
1905
|
+
"get Executor delegation",
|
|
1906
|
+
options.signal
|
|
1906
1907
|
);
|
|
1907
|
-
if (!response.ok) {
|
|
1908
|
-
const body = await response.text();
|
|
1909
|
-
throw new ExecutorRequestError(
|
|
1910
|
-
`Failed to get Executor delegation (${response.status}): ${body}`,
|
|
1911
|
-
response.status === 404 && !isGrpcNotFound(body) ? void 0 : response.status
|
|
1912
|
-
);
|
|
1913
|
-
}
|
|
1914
|
-
const data = await response.json();
|
|
1915
1908
|
if (!isObject(data)) {
|
|
1916
1909
|
throw new Error("Invalid Executor delegation response");
|
|
1917
1910
|
}
|
|
@@ -1920,28 +1913,104 @@ var RestExecutorProvider = class {
|
|
|
1920
1913
|
coins: optionalArray(data.coins, "coins").map(parseCoin)
|
|
1921
1914
|
};
|
|
1922
1915
|
}
|
|
1916
|
+
async registerArtifact(document, options = {}) {
|
|
1917
|
+
const data = await this.postJson(
|
|
1918
|
+
"/v1/artifact",
|
|
1919
|
+
{ document: documentText(document) },
|
|
1920
|
+
"register Executor artifact",
|
|
1921
|
+
options.signal
|
|
1922
|
+
);
|
|
1923
|
+
return parseArtifact2(isObject(data) ? data.artifact : void 0);
|
|
1924
|
+
}
|
|
1925
|
+
async getArtifact(id, options = {}) {
|
|
1926
|
+
const data = await this.getJson(
|
|
1927
|
+
`/v1/artifact/${encodeURIComponent(id)}`,
|
|
1928
|
+
"get Executor artifact",
|
|
1929
|
+
options.signal
|
|
1930
|
+
);
|
|
1931
|
+
return parseArtifact2(isObject(data) ? data.artifact : void 0);
|
|
1932
|
+
}
|
|
1933
|
+
async registerTemplate(document, options = {}) {
|
|
1934
|
+
const data = await this.postJson(
|
|
1935
|
+
"/v1/template",
|
|
1936
|
+
{ document: documentText(document) },
|
|
1937
|
+
"register Executor template",
|
|
1938
|
+
options.signal
|
|
1939
|
+
);
|
|
1940
|
+
return parseTemplateDetails(isObject(data) ? data.template : void 0);
|
|
1941
|
+
}
|
|
1942
|
+
async getTemplate(id, options = {}) {
|
|
1943
|
+
const data = await this.getJson(
|
|
1944
|
+
`/v1/template/${encodeURIComponent(id)}`,
|
|
1945
|
+
"get Executor template",
|
|
1946
|
+
options.signal
|
|
1947
|
+
);
|
|
1948
|
+
return parseTemplateDetails(isObject(data) ? data.template : void 0);
|
|
1949
|
+
}
|
|
1950
|
+
async postJson(path, body, what, signal) {
|
|
1951
|
+
const url = this.endpoint(path);
|
|
1952
|
+
const response = await baseFetch(url, {
|
|
1953
|
+
method: "POST",
|
|
1954
|
+
headers: { "Content-Type": "application/json" },
|
|
1955
|
+
body: JSON.stringify(body),
|
|
1956
|
+
signal
|
|
1957
|
+
});
|
|
1958
|
+
if (!response.ok) {
|
|
1959
|
+
throw await notFoundFailure(response, what, await postErrorBody(url, response));
|
|
1960
|
+
}
|
|
1961
|
+
return response.json();
|
|
1962
|
+
}
|
|
1963
|
+
async getJson(path, what, signal) {
|
|
1964
|
+
const url = this.endpoint(path);
|
|
1965
|
+
const response = await rateGate.runHttp(url, () => baseFetch(url, { signal }));
|
|
1966
|
+
if (!response.ok) {
|
|
1967
|
+
throw await notFoundFailure(response, what);
|
|
1968
|
+
}
|
|
1969
|
+
return response.json();
|
|
1970
|
+
}
|
|
1923
1971
|
};
|
|
1924
|
-
async function
|
|
1972
|
+
async function notFoundFailure(response, what, text) {
|
|
1973
|
+
const body = text ?? await response.text();
|
|
1925
1974
|
return new ExecutorRequestError(
|
|
1926
|
-
`Failed to ${what} (${response.status}): ${
|
|
1975
|
+
`Failed to ${what} (${response.status}): ${body}`,
|
|
1976
|
+
response.status === 404 && grpcCode(body) !== 5 ? void 0 : response.status
|
|
1977
|
+
);
|
|
1978
|
+
}
|
|
1979
|
+
async function failure(response, what, text) {
|
|
1980
|
+
return new ExecutorRequestError(
|
|
1981
|
+
`Failed to ${what} (${response.status}): ${text ?? await response.text()}`,
|
|
1927
1982
|
response.status
|
|
1928
1983
|
);
|
|
1929
1984
|
}
|
|
1930
|
-
function
|
|
1985
|
+
async function postErrorBody(url, response) {
|
|
1986
|
+
let body;
|
|
1987
|
+
try {
|
|
1988
|
+
body = await response.text();
|
|
1989
|
+
return body;
|
|
1990
|
+
} finally {
|
|
1991
|
+
if (response.status === 429 && (body === void 0 || grpcCode(body) !== 8)) {
|
|
1992
|
+
rateGate.reportRateLimited(url, response.headers?.get("retry-after"));
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
function documentText(document) {
|
|
1997
|
+
return typeof document === "string" ? document : JSON.stringify(document);
|
|
1998
|
+
}
|
|
1999
|
+
function grpcCode(body) {
|
|
1931
2000
|
try {
|
|
1932
2001
|
const parsed = JSON.parse(body);
|
|
1933
|
-
return isObject(parsed)
|
|
2002
|
+
return isObject(parsed) ? parsed.code : void 0;
|
|
1934
2003
|
} catch {
|
|
1935
|
-
return
|
|
2004
|
+
return void 0;
|
|
1936
2005
|
}
|
|
1937
2006
|
}
|
|
1938
2007
|
function isObject(value) {
|
|
1939
2008
|
return typeof value === "object" && value !== null;
|
|
1940
2009
|
}
|
|
1941
|
-
function requiredString(object, key) {
|
|
2010
|
+
function requiredString(object, key, what = "info") {
|
|
1942
2011
|
const value = object[key];
|
|
1943
2012
|
if (typeof value !== "string" || value.length === 0) {
|
|
1944
|
-
throw new Error(`Invalid Executor
|
|
2013
|
+
throw new Error(`Invalid Executor ${what}: missing ${key}`);
|
|
1945
2014
|
}
|
|
1946
2015
|
return value;
|
|
1947
2016
|
}
|
|
@@ -2039,18 +2108,52 @@ function parseTemplate(value) {
|
|
|
2039
2108
|
}
|
|
2040
2109
|
return { id: value.id, status: typeof value.status === "string" ? value.status : "" };
|
|
2041
2110
|
}
|
|
2111
|
+
function parseTemplateDetails(value) {
|
|
2112
|
+
if (!isObject(value)) throw new Error("Invalid Executor template");
|
|
2113
|
+
const artifactIds = optionalArray(value.artifactIds, "artifactIds");
|
|
2114
|
+
if (artifactIds.some((id) => typeof id !== "string" || id.length === 0)) {
|
|
2115
|
+
throw new Error("Invalid Executor template: artifactIds are not strings");
|
|
2116
|
+
}
|
|
2117
|
+
return {
|
|
2118
|
+
id: requiredString(value, "id", "template"),
|
|
2119
|
+
status: requiredString(value, "status", "template"),
|
|
2120
|
+
document: requiredString(value, "document", "template"),
|
|
2121
|
+
artifactIds,
|
|
2122
|
+
params: optionalArray(value.params, "params").map((param) => {
|
|
2123
|
+
if (!isObject(param)) throw new Error("Invalid Executor template param");
|
|
2124
|
+
return {
|
|
2125
|
+
name: requiredString(param, "name", "template param"),
|
|
2126
|
+
type: requiredString(param, "type", "template param")
|
|
2127
|
+
};
|
|
2128
|
+
}),
|
|
2129
|
+
type: requiredString(value, "type", "template"),
|
|
2130
|
+
createdAt: parseOptionalInt64(value.createdAt, "createdAt")
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2133
|
+
function parseArtifact2(value) {
|
|
2134
|
+
if (!isObject(value)) throw new Error("Invalid Executor artifact");
|
|
2135
|
+
return {
|
|
2136
|
+
id: requiredString(value, "id", "artifact"),
|
|
2137
|
+
document: requiredString(value, "document", "artifact"),
|
|
2138
|
+
createdAt: parseOptionalInt64(value.createdAt, "createdAt")
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2042
2141
|
function parseExecutorInfo(value) {
|
|
2043
2142
|
if (!isObject(value)) throw new Error("Invalid Executor info");
|
|
2044
2143
|
const info = {
|
|
2045
2144
|
version: requiredString(value, "version"),
|
|
2046
2145
|
network: requiredString(value, "network"),
|
|
2047
|
-
|
|
2048
|
-
|
|
2146
|
+
batchCosignerPubkey: requiredString(value, "batchCosignerPubkey"),
|
|
2147
|
+
operatorPubkey: requiredString(value, "operatorPubkey"),
|
|
2049
2148
|
emulatorPubkey: requiredString(value, "emulatorPubkey")
|
|
2050
2149
|
};
|
|
2051
|
-
decodeCompressed(info.
|
|
2052
|
-
decodeCompressed(info.
|
|
2150
|
+
decodeCompressed(info.batchCosignerPubkey, "batchCosignerPubkey");
|
|
2151
|
+
decodeCompressed(info.operatorPubkey, "operatorPubkey");
|
|
2053
2152
|
decodeCompressed(info.emulatorPubkey, "emulatorPubkey");
|
|
2153
|
+
if (value.sealingPubkey !== void 0 && value.sealingPubkey !== "") {
|
|
2154
|
+
info.sealingPubkey = requiredString(value, "sealingPubkey");
|
|
2155
|
+
decodeCompressed(info.sealingPubkey, "sealingPubkey");
|
|
2156
|
+
}
|
|
2054
2157
|
return info;
|
|
2055
2158
|
}
|
|
2056
2159
|
function decodeCompressed(value, label) {
|
|
@@ -3940,6 +4043,9 @@ function validateRecipients(recipients, dustAmount, context) {
|
|
|
3940
4043
|
if (amount <= 0) {
|
|
3941
4044
|
throw new Error("Amount must be positive");
|
|
3942
4045
|
}
|
|
4046
|
+
if ((recipient.assets?.length ?? 0) > 0 && amount < dustAmount) {
|
|
4047
|
+
throw new Error(`Asset recipient amount ${amount} is below dust ${dustAmount}`);
|
|
4048
|
+
}
|
|
3943
4049
|
if (recipient.tapTree) {
|
|
3944
4050
|
assertTapTreeDerivesAddress(recipient.address, recipient.tapTree, address);
|
|
3945
4051
|
}
|
|
@@ -4551,6 +4657,11 @@ function verifyTapscriptSignatures(tx, inputIndex, requiredSigners, excludePubke
|
|
|
4551
4657
|
);
|
|
4552
4658
|
}
|
|
4553
4659
|
}
|
|
4660
|
+
if (signature.length !== 64 && (signature.length !== 65 || signature[64] === SigHash.DEFAULT)) {
|
|
4661
|
+
throw new Error(
|
|
4662
|
+
`Input ${inputIndex}: signature from ${pubKeyHex} is not a BIP-341 signature encoding (${signature.length} bytes)`
|
|
4663
|
+
);
|
|
4664
|
+
}
|
|
4554
4665
|
const sighashType = signature.length === 65 ? signature[64] : SigHash.DEFAULT;
|
|
4555
4666
|
const sig = signature.subarray(0, 64);
|
|
4556
4667
|
if (!allowedSighashTypes.includes(sighashType)) {
|
|
@@ -5807,6 +5918,13 @@ var NonRangeableDescriptorError = class extends Error {
|
|
|
5807
5918
|
}
|
|
5808
5919
|
};
|
|
5809
5920
|
var ROTATION_MAX_BACKOFF_MS = 6e4;
|
|
5921
|
+
function isReceiptAtDisplayed(event, wallet) {
|
|
5922
|
+
if (event.type !== "vtxo_received") return false;
|
|
5923
|
+
if (event.contractScript === wallet.defaultContractScript) return true;
|
|
5924
|
+
if (!isContractVtxoEvent(event)) return false;
|
|
5925
|
+
const { type, params } = event.contract;
|
|
5926
|
+
return type === ExecutorContractHandler.type && params.template === "renewal" && params.owner?.slice(2).toLowerCase() === hex.encode(wallet.offchainTapscript.options.pubKey);
|
|
5927
|
+
}
|
|
5810
5928
|
var WalletReceiveRotator = class _WalletReceiveRotator {
|
|
5811
5929
|
constructor(provider, priorTaggedScript, logger) {
|
|
5812
5930
|
this.provider = provider;
|
|
@@ -5900,8 +6018,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
|
|
|
5900
6018
|
async install(wallet) {
|
|
5901
6019
|
const manager = await wallet.getContractManager();
|
|
5902
6020
|
this.unsubscribe = manager.onContractEvent((event) => {
|
|
5903
|
-
if (event
|
|
5904
|
-
if (event.contractScript !== wallet.defaultContractScript) return;
|
|
6021
|
+
if (!isReceiptAtDisplayed(event, wallet)) return;
|
|
5905
6022
|
this.chain = this.chain.catch(() => void 0).then(() => this.runRotateWithBackoff(wallet));
|
|
5906
6023
|
});
|
|
5907
6024
|
}
|
|
@@ -5984,6 +6101,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
|
|
|
5984
6101
|
const newScript = params.script;
|
|
5985
6102
|
const manager = await managerPromise;
|
|
5986
6103
|
await manager.createContract(params);
|
|
6104
|
+
await wallet.registerReceiveTwin?.(descriptor);
|
|
5987
6105
|
wallet.setOffchainTapscriptForRotation(newTapscript);
|
|
5988
6106
|
const previousTagged = this.currentTaggedScript;
|
|
5989
6107
|
if (previousTagged !== void 0 && previousTagged !== newScript) {
|
|
@@ -6092,12 +6210,19 @@ var DELEGATION_STATUS_KEY = "delegationStatus";
|
|
|
6092
6210
|
var DELEGATION_EXPIRES_KEY = "delegationExpiresAt";
|
|
6093
6211
|
var DELEGATION_REGISTERED_KEY = "delegationRegisteredAt";
|
|
6094
6212
|
var DELEGATION_LOCAL_STATUS = "local";
|
|
6213
|
+
async function ownAddress(wallet) {
|
|
6214
|
+
return ArkAddress.decode(await (wallet.getOwnAddress?.() ?? wallet.getAddress()));
|
|
6215
|
+
}
|
|
6216
|
+
var SCRIPT_CACHE_LIMIT = 512;
|
|
6095
6217
|
var scriptCache = /* @__PURE__ */ new Map();
|
|
6096
6218
|
function cachedScript(params) {
|
|
6097
6219
|
const key = JSON.stringify(Object.entries(params).sort(([a], [b]) => a < b ? -1 : 1));
|
|
6098
6220
|
let script = scriptCache.get(key);
|
|
6099
6221
|
if (!script) {
|
|
6100
6222
|
script = ExecutorContractHandler.createScript(params);
|
|
6223
|
+
if (scriptCache.size >= SCRIPT_CACHE_LIMIT) {
|
|
6224
|
+
scriptCache.delete(scriptCache.keys().next().value);
|
|
6225
|
+
}
|
|
6101
6226
|
scriptCache.set(key, script);
|
|
6102
6227
|
}
|
|
6103
6228
|
return script;
|
|
@@ -6118,30 +6243,56 @@ async function delegatedContracts(identity, getContracts, template) {
|
|
|
6118
6243
|
const descriptor = contract.metadata?.signingDescriptor;
|
|
6119
6244
|
const held = owner === identityKey || typeof descriptor === "string" && hex.encode(deriveDescriptorLeafPubKey(descriptor)) === owner;
|
|
6120
6245
|
if (!held || owner === void 0) continue;
|
|
6121
|
-
const
|
|
6122
|
-
if (
|
|
6123
|
-
const expiresAt = contract.metadata?.[DELEGATION_EXPIRES_KEY];
|
|
6124
|
-
watches.push({
|
|
6125
|
-
contract,
|
|
6126
|
-
owner,
|
|
6127
|
-
script,
|
|
6128
|
-
signer: toXOnlySignerHex(contract.params.serverPubKey),
|
|
6129
|
-
live: contract.metadata?.[DELEGATION_STATUS_KEY] === "active" && !(typeof expiresAt === "number" && expiresAt > 0 && expiresAt <= now)
|
|
6130
|
-
});
|
|
6246
|
+
const watch = watchOf(contract, owner, now);
|
|
6247
|
+
if (watch) watches.push(watch);
|
|
6131
6248
|
} catch (e) {
|
|
6132
6249
|
console.warn("Skipping malformed delegated contract", contract.script, e);
|
|
6133
6250
|
}
|
|
6134
6251
|
}
|
|
6135
6252
|
return watches;
|
|
6136
6253
|
}
|
|
6254
|
+
function watchOf(contract, owner, now) {
|
|
6255
|
+
const script = cachedScript(contract.params);
|
|
6256
|
+
if (hex.encode(script.pkScript) !== contract.script) return void 0;
|
|
6257
|
+
const expiresAt = contract.metadata?.[DELEGATION_EXPIRES_KEY];
|
|
6258
|
+
return {
|
|
6259
|
+
contract,
|
|
6260
|
+
owner,
|
|
6261
|
+
script,
|
|
6262
|
+
signer: toXOnlySignerHex(contract.params.serverPubKey),
|
|
6263
|
+
live: contract.metadata?.[DELEGATION_STATUS_KEY] === "active" && !(typeof expiresAt === "number" && expiresAt > 0 && expiresAt <= now)
|
|
6264
|
+
};
|
|
6265
|
+
}
|
|
6266
|
+
var warnedStatusless = /* @__PURE__ */ new Set();
|
|
6267
|
+
async function receiveTwin(getContracts, owner, signer) {
|
|
6268
|
+
const rows = (await getContracts({ type: ["executor"] })).filter(
|
|
6269
|
+
(c) => c.params.template === "renewal" && c.params.owner?.slice(2).toLowerCase() === owner && c.params.serverPubKey !== void 0 && toXOnlySignerHex(c.params.serverPubKey) === signer
|
|
6270
|
+
).sort((a, b) => registeredAt(b) - registeredAt(a));
|
|
6271
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
6272
|
+
for (const contract of rows) {
|
|
6273
|
+
const watch = watchOf(contract, owner, now);
|
|
6274
|
+
if (watch?.live) return watch;
|
|
6275
|
+
if (contract.metadata?.[DELEGATION_STATUS_KEY] === void 0) warnStatusless(contract);
|
|
6276
|
+
}
|
|
6277
|
+
return void 0;
|
|
6278
|
+
}
|
|
6279
|
+
function warnStatusless(contract) {
|
|
6280
|
+
if (warnedStatusless.has(contract.script)) return;
|
|
6281
|
+
if (warnedStatusless.size >= SCRIPT_CACHE_LIMIT) {
|
|
6282
|
+
warnedStatusless.delete(warnedStatusless.values().next().value);
|
|
6283
|
+
}
|
|
6284
|
+
warnedStatusless.add(contract.script);
|
|
6285
|
+
console.warn(
|
|
6286
|
+
`Executor renewal watch ${contract.address} has no delegation status, as after a restore: the wallet shows its own address until registerRenewal() confirms it`
|
|
6287
|
+
);
|
|
6288
|
+
}
|
|
6137
6289
|
async function watchExecutorContracts(wallet, keys, params, registered, descriptor) {
|
|
6138
|
-
const [owner,
|
|
6290
|
+
const [owner, { hrp, serverPubKey }, manager] = await Promise.all([
|
|
6139
6291
|
descriptor === void 0 ? wallet.identity.compressedPublicKey() : ownerKey(wallet.identity, descriptor),
|
|
6140
|
-
wallet
|
|
6292
|
+
ownAddress(wallet),
|
|
6141
6293
|
wallet.getContractManager()
|
|
6142
6294
|
]);
|
|
6143
6295
|
const signing = descriptor === void 0 || equalBytes(owner.subarray(1), await wallet.identity.xOnlyPublicKey()) ? void 0 : descriptor;
|
|
6144
|
-
const { hrp, serverPubKey } = ArkAddress.decode(address);
|
|
6145
6296
|
const templates = params.boardingExitDelay === void 0 ? ["renewal"] : ["renewal", "boarding"];
|
|
6146
6297
|
const contracts = [];
|
|
6147
6298
|
for (const template of templates) {
|
|
@@ -6212,6 +6363,11 @@ function reRegistrationOf(watch) {
|
|
|
6212
6363
|
}
|
|
6213
6364
|
};
|
|
6214
6365
|
}
|
|
6366
|
+
function sameDelegation(a, b) {
|
|
6367
|
+
const p = ExecutorContractHandler.deserializeParams(a.contract.params);
|
|
6368
|
+
const q = ExecutorContractHandler.deserializeParams(b.contract.params);
|
|
6369
|
+
return p.renewalWindow === q.renewalWindow && p.maxFee === q.maxFee && p.exitDelay === q.exitDelay && p.boardingExitDelay === q.boardingExitDelay && equalBytes(p.emulatorPubKey, q.emulatorPubKey);
|
|
6370
|
+
}
|
|
6215
6371
|
function renewalScript(owner, keys, params) {
|
|
6216
6372
|
const script = ExecutorContractHandler.createScript(
|
|
6217
6373
|
executorContractParams("renewal", owner, keys, params)
|
|
@@ -6313,6 +6469,11 @@ var ExecutorManagerImpl = class {
|
|
|
6313
6469
|
}
|
|
6314
6470
|
return first;
|
|
6315
6471
|
}
|
|
6472
|
+
/** @internal The renewal watch of `descriptor`'s key alone, under the params of `options`. */
|
|
6473
|
+
async registerRenewalAt(descriptor, options, registration = {}) {
|
|
6474
|
+
const context = this.lazyContext();
|
|
6475
|
+
return await this.storedWatch(descriptor, options, registration, "renewal") ?? await this.registerAt(await context(), descriptor, options, registration, "renewal");
|
|
6476
|
+
}
|
|
6316
6477
|
/** @internal {@link registerBoarding} for `descriptor`'s key; the displayed one by default. */
|
|
6317
6478
|
async registerBoardingAt(descriptor, options, registration = {}) {
|
|
6318
6479
|
const key = descriptor ?? await this.displayedDescriptor();
|
|
@@ -6333,10 +6494,11 @@ var ExecutorManagerImpl = class {
|
|
|
6333
6494
|
* registration moves the boarding address. One that cannot be revived stops being live, and
|
|
6334
6495
|
* the wallet boards its deposits itself. A failing watch leaves the others to be tried.
|
|
6335
6496
|
*
|
|
6336
|
-
* Only a
|
|
6337
|
-
* registered other key
|
|
6338
|
-
*
|
|
6339
|
-
*
|
|
6497
|
+
* Only a watch the wallet still needs is revived: the displayed boarding and receive keys', the
|
|
6498
|
+
* most recently registered other key's, and a renewal watch whose contract holds an unspent
|
|
6499
|
+
* coin, which the Executor must keep renewing while the wallet is offline. A lapsed watch of
|
|
6500
|
+
* any other key ends instead: it never held a coin, or none is left, and reviving it would
|
|
6501
|
+
* repeat for every rotation, forever.
|
|
6340
6502
|
*
|
|
6341
6503
|
* The status reads run as called; only the writes go through `write`, so a caller that orders
|
|
6342
6504
|
* them with its rotations holds those back for one write, never for the whole refresh.
|
|
@@ -6395,7 +6557,7 @@ var ExecutorManagerImpl = class {
|
|
|
6395
6557
|
(w) => w.contract.script === lapsed.contract.script
|
|
6396
6558
|
);
|
|
6397
6559
|
if (!watch?.live) return;
|
|
6398
|
-
if (!await this.keyInUse(watch.owner, context.server)) {
|
|
6560
|
+
if (!await this.keyInUse(watch.owner, context.server) && !(template === "renewal" && await this.holdsCoin(watch.contract))) {
|
|
6399
6561
|
await this.endWatch(watch, status);
|
|
6400
6562
|
return;
|
|
6401
6563
|
}
|
|
@@ -6426,19 +6588,28 @@ var ExecutorManagerImpl = class {
|
|
|
6426
6588
|
)
|
|
6427
6589
|
});
|
|
6428
6590
|
}
|
|
6591
|
+
/** Whether `contract` holds an unspent, unswept coin, as stored. */
|
|
6592
|
+
async holdsCoin(contract) {
|
|
6593
|
+
const manager = await this.wallet.getContractManager();
|
|
6594
|
+
const [stored] = await manager.getStoredContractsWithVtxos({ script: contract.script });
|
|
6595
|
+
return (stored?.vtxos ?? []).some((v) => !isVtxoSpent(v) && !v.isSwept);
|
|
6596
|
+
}
|
|
6429
6597
|
/**
|
|
6430
|
-
* The displayed key,
|
|
6431
|
-
*
|
|
6432
|
-
*
|
|
6598
|
+
* The displayed boarding key, the displayed receive key, and the most recently registered
|
|
6599
|
+
* other key with a live watch, whose params a rotation copies when the displayed key has no
|
|
6600
|
+
* watch.
|
|
6433
6601
|
*/
|
|
6434
6602
|
async keyInUse(owner, server) {
|
|
6435
6603
|
const displayed = await ownerKey(this.wallet.identity, await this.displayedDescriptor());
|
|
6436
6604
|
const displayedOwner = hex.encode(displayed.subarray(1));
|
|
6437
|
-
|
|
6605
|
+
const receiveOwner = this.wallet.offchainTapscript ? hex.encode(this.wallet.offchainTapscript.options.pubKey) : void 0;
|
|
6606
|
+
if (owner === displayedOwner || owner === receiveOwner) return true;
|
|
6438
6607
|
const others = [
|
|
6439
6608
|
...await this.heldWatches("boarding"),
|
|
6440
6609
|
...await this.heldWatches("renewal")
|
|
6441
|
-
].filter(
|
|
6610
|
+
].filter(
|
|
6611
|
+
(w) => w.live && w.signer === server && w.owner !== displayedOwner && w.owner !== receiveOwner
|
|
6612
|
+
).sort((a, b) => registeredAt(b.contract) - registeredAt(a.contract));
|
|
6442
6613
|
return others[0]?.owner === owner;
|
|
6443
6614
|
}
|
|
6444
6615
|
/**
|
|
@@ -6467,11 +6638,10 @@ var ExecutorManagerImpl = class {
|
|
|
6467
6638
|
* params, or older ones registered again to move the boarding address back.
|
|
6468
6639
|
*/
|
|
6469
6640
|
async storedWatch(descriptor, options, { emulatorPubkey }, template) {
|
|
6470
|
-
const [
|
|
6471
|
-
this.wallet
|
|
6641
|
+
const [{ hrp, serverPubKey }, owner] = await Promise.all([
|
|
6642
|
+
ownAddress(this.wallet),
|
|
6472
6643
|
ownerKey(this.wallet.identity, descriptor)
|
|
6473
6644
|
]);
|
|
6474
|
-
const { hrp, serverPubKey } = ArkAddress.decode(address);
|
|
6475
6645
|
const server = hex.encode(serverPubKey);
|
|
6476
6646
|
const xOnlyOwner = hex.encode(owner.subarray(1));
|
|
6477
6647
|
const watch = (await this.heldWatches(template)).find(
|
|
@@ -6500,7 +6670,7 @@ var ExecutorManagerImpl = class {
|
|
|
6500
6670
|
}
|
|
6501
6671
|
/** The wallet's operator key, x-only hex: the signer a live watch is registered under. */
|
|
6502
6672
|
async operatorSigner() {
|
|
6503
|
-
return hex.encode(
|
|
6673
|
+
return hex.encode((await ownAddress(this.wallet)).serverPubKey);
|
|
6504
6674
|
}
|
|
6505
6675
|
/**
|
|
6506
6676
|
* Both templates register the displayed boarding key: boarding moves its deposits in, renewal
|
|
@@ -6528,11 +6698,11 @@ var ExecutorManagerImpl = class {
|
|
|
6528
6698
|
`Executor runs on ${info.network}, the wallet's operator on ${operator.network}`
|
|
6529
6699
|
);
|
|
6530
6700
|
}
|
|
6531
|
-
const { hrp, serverPubKey } =
|
|
6701
|
+
const { hrp, serverPubKey } = await ownAddress(this.wallet);
|
|
6532
6702
|
const server = hex.encode(serverPubKey);
|
|
6533
|
-
if (info.
|
|
6703
|
+
if (info.operatorPubkey.slice(2).toLowerCase() !== server) {
|
|
6534
6704
|
throw new Error(
|
|
6535
|
-
`Executor's operator key ${info.
|
|
6705
|
+
`Executor's operator key ${info.operatorPubkey} is not the wallet's operator ${server}`
|
|
6536
6706
|
);
|
|
6537
6707
|
}
|
|
6538
6708
|
return {
|
|
@@ -6559,8 +6729,8 @@ var ExecutorManagerImpl = class {
|
|
|
6559
6729
|
const owner = await ownerKey(this.wallet.identity, descriptor);
|
|
6560
6730
|
const params = resolveParams(options, operator, template);
|
|
6561
6731
|
const keys = {
|
|
6562
|
-
|
|
6563
|
-
|
|
6732
|
+
batchCosignerPubkey: info.batchCosignerPubkey,
|
|
6733
|
+
operatorPubkey: info.operatorPubkey,
|
|
6564
6734
|
emulatorPubkey: info.emulatorPubkey
|
|
6565
6735
|
};
|
|
6566
6736
|
const variables = defaultVariables(template, owner, params);
|
|
@@ -8822,6 +8992,11 @@ async function arkadeCashActivity(records, txs) {
|
|
|
8822
8992
|
return activities.filter((activity) => activity.intent?.kind === "arkade-cash");
|
|
8823
8993
|
}
|
|
8824
8994
|
|
|
8995
|
+
// src/repositories/vtxoReservationRepository.ts
|
|
8996
|
+
function reservationOutpointSetKey(outpoints) {
|
|
8997
|
+
return outpoints.map(({ txid, vout }) => `${txid}:${vout}`).sort().join("|");
|
|
8998
|
+
}
|
|
8999
|
+
|
|
8825
9000
|
// src/wallet/intentReconciliation.ts
|
|
8826
9001
|
var NON_TERMINAL_INTENT_STATES = ALL_BATCH_REGISTRATION_STATES.filter((s) => !isTerminalBatchRegistrationState(s));
|
|
8827
9002
|
function isConsumed(vtxo) {
|
|
@@ -10871,7 +11046,7 @@ function createManagedConnection(dbName, version, initDatabase2) {
|
|
|
10871
11046
|
// src/repositories/indexedDB/vtxoReservationRepository.ts
|
|
10872
11047
|
var STORE = "reservations";
|
|
10873
11048
|
var IndexedDBVtxoReservationRepository = class {
|
|
10874
|
-
version =
|
|
11049
|
+
version = 2;
|
|
10875
11050
|
connection;
|
|
10876
11051
|
constructor(dbName) {
|
|
10877
11052
|
this.connection = createManagedConnection(dbName, 1, (db) => {
|
|
@@ -10894,6 +11069,22 @@ var IndexedDBVtxoReservationRepository = class {
|
|
|
10894
11069
|
transaction.objectStore(STORE).delete(id);
|
|
10895
11070
|
await awaitTransaction(transaction);
|
|
10896
11071
|
}
|
|
11072
|
+
async deleteReservationIfMatches(id, expected) {
|
|
11073
|
+
const expectedKey = reservationOutpointSetKey(expected);
|
|
11074
|
+
const db = await this.connection.get();
|
|
11075
|
+
const transaction = db.transaction(STORE, "readwrite");
|
|
11076
|
+
const store = transaction.objectStore(STORE);
|
|
11077
|
+
let deleted = false;
|
|
11078
|
+
const request = store.get(id);
|
|
11079
|
+
request.onsuccess = () => {
|
|
11080
|
+
const current = request.result;
|
|
11081
|
+
if (!current || reservationOutpointSetKey(current.outpoints) !== expectedKey) return;
|
|
11082
|
+
store.delete(id);
|
|
11083
|
+
deleted = true;
|
|
11084
|
+
};
|
|
11085
|
+
await awaitTransaction(transaction);
|
|
11086
|
+
return deleted;
|
|
11087
|
+
}
|
|
10897
11088
|
async [Symbol.asyncDispose]() {
|
|
10898
11089
|
await this.connection[Symbol.asyncDispose]();
|
|
10899
11090
|
}
|
|
@@ -15525,6 +15716,7 @@ var MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD = 1e3;
|
|
|
15525
15716
|
var MAINNET_UNILATERAL_EXIT_DELAY = 605184n;
|
|
15526
15717
|
var EXECUTOR_REFRESH_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
15527
15718
|
var EXECUTOR_REFRESHED_KEY = "executorRefreshedAt";
|
|
15719
|
+
var EXECUTOR_RECEIVE_RETRY_MS = 10 * 60 * 1e3;
|
|
15528
15720
|
function dedupeTimelocks(timelocks) {
|
|
15529
15721
|
const seen = /* @__PURE__ */ new Set();
|
|
15530
15722
|
const deduped = [];
|
|
@@ -15625,9 +15817,6 @@ function omittedOutpoints(before, after) {
|
|
|
15625
15817
|
function coinKeys(inputs) {
|
|
15626
15818
|
return inputs.filter((input) => typeof input === "object" && input !== null).map((input) => `${input.txid}:${input.vout}`);
|
|
15627
15819
|
}
|
|
15628
|
-
function outpointSetKey(outpoints) {
|
|
15629
|
-
return outpoints.map(({ txid, vout }) => `${txid}:${vout}`).sort().join("|");
|
|
15630
|
-
}
|
|
15631
15820
|
function assertNoPersistentReservation(inputs, reservations) {
|
|
15632
15821
|
const held = coinKeys(inputs).filter((key) => reservations?.has(key));
|
|
15633
15822
|
if (held.length > 0) throw new VtxoReservedError(held, "held");
|
|
@@ -16120,9 +16309,17 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
16120
16309
|
wallet.refreshDeprecatedSigners(setup.info);
|
|
16121
16310
|
return wallet;
|
|
16122
16311
|
}
|
|
16312
|
+
/**
|
|
16313
|
+
* The wallet's own address, under its own key: what its hrp and operator key are read from.
|
|
16314
|
+
* Not where to receive; that is {@link getAddress}, which answers the delegated twin once the
|
|
16315
|
+
* Executor watches this key.
|
|
16316
|
+
*/
|
|
16123
16317
|
get arkAddress() {
|
|
16124
16318
|
return this.offchainTapscript.address(this.network.hrp, this.arkServerPublicKey);
|
|
16125
16319
|
}
|
|
16320
|
+
async getOwnAddress() {
|
|
16321
|
+
return this.arkAddress.encode();
|
|
16322
|
+
}
|
|
16126
16323
|
/**
|
|
16127
16324
|
* Get the pkScript hex for the wallet's primary offchain address.
|
|
16128
16325
|
* For the full wallet-owned script set registered in ContractManager, use getWalletScripts().
|
|
@@ -16131,11 +16328,42 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
16131
16328
|
return hex.encode(this.offchainTapscript.pkScript);
|
|
16132
16329
|
}
|
|
16133
16330
|
/**
|
|
16134
|
-
* Returns the
|
|
16135
|
-
*
|
|
16331
|
+
* Returns the Arkade address to receive at: the delegated twin of the current receive key
|
|
16332
|
+
* while its Executor renewal watch is live, so the Executor renews what lands here while the
|
|
16333
|
+
* wallet is offline; the wallet's own address otherwise. See
|
|
16334
|
+
* {@link IExecutorManager.registerRenewal}.
|
|
16335
|
+
*
|
|
16336
|
+
* The answer changes without a receipt when a watch registers or ends, and when the operator
|
|
16337
|
+
* signer rotates: do not store it. Use {@link arkAddress} for the wallet's own address.
|
|
16136
16338
|
*/
|
|
16137
16339
|
async getAddress() {
|
|
16138
|
-
|
|
16340
|
+
const serverPubKey = this.arkServerPublicKey;
|
|
16341
|
+
const tapscript = await this.destinationTapscript(serverPubKey);
|
|
16342
|
+
return tapscript.address(this.network.hrp, serverPubKey).encode();
|
|
16343
|
+
}
|
|
16344
|
+
/**
|
|
16345
|
+
* Where receives go under `serverPubKey`: the live Executor renewal watch of the receive key
|
|
16346
|
+
* (the delegated twin), else `own`. With `amount`, a twin the Executor cannot renew it at
|
|
16347
|
+
* (`maxFee + dust` or less) gives way to `own`. Fail-open: a lookup must not fail a receive.
|
|
16348
|
+
*
|
|
16349
|
+
* Callers read `own` and `serverPubKey` before their first await, then pass them here.
|
|
16350
|
+
*/
|
|
16351
|
+
async destinationTapscript(serverPubKey, own = this.offchainTapscript, amount) {
|
|
16352
|
+
try {
|
|
16353
|
+
const twin = await receiveTwin(
|
|
16354
|
+
(filter) => collectContracts(this.contractRepository, filter),
|
|
16355
|
+
hex.encode(own.options.pubKey),
|
|
16356
|
+
toXOnlySignerHex(hex.encode(serverPubKey))
|
|
16357
|
+
);
|
|
16358
|
+
if (twin && (amount === void 0 || this.renews(twin, amount))) return twin.script;
|
|
16359
|
+
} catch (e) {
|
|
16360
|
+
console.warn("Unable to inspect Executor renewal watches", e);
|
|
16361
|
+
}
|
|
16362
|
+
return own;
|
|
16363
|
+
}
|
|
16364
|
+
/** Whether the Executor can renew `amount` at `watch`: not for `maxFee + dust` or less. */
|
|
16365
|
+
renews(watch, amount) {
|
|
16366
|
+
return amount > BigInt(watch.contract.params.maxFee) + this.dustAmount;
|
|
16139
16367
|
}
|
|
16140
16368
|
/**
|
|
16141
16369
|
* Returns the onchain boarding address used to move funds into Arkade: with an Executor
|
|
@@ -17504,6 +17732,80 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
17504
17732
|
console.warn("Failed to register an Executor watch for the new boarding address", e);
|
|
17505
17733
|
}
|
|
17506
17734
|
}
|
|
17735
|
+
/**
|
|
17736
|
+
* @internal Register the Executor twin of the receive key at `descriptor`, under the params
|
|
17737
|
+
* of {@link delegationSource}: none means the app never opted in, and nothing is done.
|
|
17738
|
+
* Only the displayed key gets one: look-ahead addresses may have been issued to others and
|
|
17739
|
+
* are not delegated. Never throws: on failure the own address is shown until
|
|
17740
|
+
* {@link syncReceiveDelegation} registers the twin.
|
|
17741
|
+
*/
|
|
17742
|
+
async registerReceiveTwin(descriptor) {
|
|
17743
|
+
const executor = this._executorManager;
|
|
17744
|
+
if (!executor) return;
|
|
17745
|
+
try {
|
|
17746
|
+
const watch = this.delegationSource(
|
|
17747
|
+
await this.liveRenewalWatches(
|
|
17748
|
+
toXOnlySignerHex(hex.encode(this.arkServerPublicKey))
|
|
17749
|
+
)
|
|
17750
|
+
);
|
|
17751
|
+
if (!watch) return;
|
|
17752
|
+
const { options, registration } = reRegistrationOf(watch);
|
|
17753
|
+
await executor.registerRenewalAt(descriptor, options, registration);
|
|
17754
|
+
} catch (e) {
|
|
17755
|
+
console.warn("Failed to register an Executor watch for the new receive address", e);
|
|
17756
|
+
}
|
|
17757
|
+
}
|
|
17758
|
+
/**
|
|
17759
|
+
* The live renewal watch whose params a twin copies: the displayed boarding key's, which
|
|
17760
|
+
* `registerRenewal` registers with the app's params, else the newest.
|
|
17761
|
+
*/
|
|
17762
|
+
delegationSource(watches) {
|
|
17763
|
+
const boarding = hex.encode(this._boardingTapscript.options.pubKey);
|
|
17764
|
+
return watches.find((w) => w.owner === boarding) ?? watches[0];
|
|
17765
|
+
}
|
|
17766
|
+
_receiveSyncFailedAt = 0;
|
|
17767
|
+
/**
|
|
17768
|
+
* @internal The upkeep of receive delegation for an HD wallet that opted in, run from the poll
|
|
17769
|
+
* and at boot, and never throwing:
|
|
17770
|
+
* - the receive key never is the displayed boarding key, as a payment at the twin would
|
|
17771
|
+
* rotate boarding: it rotates boarding first, once, when they coincide;
|
|
17772
|
+
* - the displayed receive key gets its twin when a rotation could not register one, or a new
|
|
17773
|
+
* one when the app registered renewal with other params since.
|
|
17774
|
+
*
|
|
17775
|
+
* A failure is not tried again for a few minutes, as the Executor may be down.
|
|
17776
|
+
*/
|
|
17777
|
+
syncReceiveDelegation() {
|
|
17778
|
+
const executor = this._executorManager;
|
|
17779
|
+
if (!executor || !this._descriptorProvider) return Promise.resolve();
|
|
17780
|
+
return this.onBoardChain(async () => {
|
|
17781
|
+
if (this._executorStopping || Date.now() - this._receiveSyncFailedAt < EXECUTOR_RECEIVE_RETRY_MS) {
|
|
17782
|
+
return;
|
|
17783
|
+
}
|
|
17784
|
+
const signer = toXOnlySignerHex(hex.encode(this.arkServerPublicKey));
|
|
17785
|
+
const watches = await this.liveRenewalWatches(signer);
|
|
17786
|
+
if (watches.length === 0) return;
|
|
17787
|
+
const key = hex.encode(this.offchainTapscript.options.pubKey);
|
|
17788
|
+
if (key === hex.encode(this._boardingTapscript.options.pubKey)) {
|
|
17789
|
+
await this.rotateBoarding();
|
|
17790
|
+
}
|
|
17791
|
+
const source = this.delegationSource(watches);
|
|
17792
|
+
const twin = watches.find((w) => w.owner === key);
|
|
17793
|
+
if (twin && sameDelegation(twin, source)) return;
|
|
17794
|
+
const [row] = await (await this.getContractManager()).getContracts({
|
|
17795
|
+
script: this.defaultContractScript
|
|
17796
|
+
});
|
|
17797
|
+
const descriptor = row?.metadata?.signingDescriptor;
|
|
17798
|
+
const { options, registration } = reRegistrationOf(source);
|
|
17799
|
+
await executor.registerRenewalAt(
|
|
17800
|
+
typeof descriptor === "string" ? descriptor : await identityDescriptor(this.identity),
|
|
17801
|
+
options,
|
|
17802
|
+
registration
|
|
17803
|
+
);
|
|
17804
|
+
}).catch((e) => {
|
|
17805
|
+
this._receiveSyncFailedAt = Date.now();
|
|
17806
|
+
console.warn("Failed to keep the receive address under Executor delegation", e);
|
|
17807
|
+
});
|
|
17808
|
+
}
|
|
17507
17809
|
/**
|
|
17508
17810
|
* Startup work for an Executor: refresh its watches (every wallet), then, with a descriptor
|
|
17509
17811
|
* provider, rotate-on-board. The Executor boards a deposit into the renewal contract of its
|
|
@@ -17545,7 +17847,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
17545
17847
|
* Best-effort: never throws. Never call it from a board chain task: it would wait on itself.
|
|
17546
17848
|
*/
|
|
17547
17849
|
refreshExecutorWatches() {
|
|
17548
|
-
this._executorRefreshing ??= this.refreshExecutorWatchesNow().finally(() => {
|
|
17850
|
+
this._executorRefreshing ??= this.refreshExecutorWatchesNow().then(() => this.syncReceiveDelegation()).finally(() => {
|
|
17549
17851
|
this._executorRefreshing = void 0;
|
|
17550
17852
|
});
|
|
17551
17853
|
return this._executorRefreshing;
|
|
@@ -17894,6 +18196,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
17894
18196
|
}
|
|
17895
18197
|
async _doRotateServerSigner(xonly, newServerUnrollScript) {
|
|
17896
18198
|
if (equalBytes(xonly, this.arkServerPublicKey)) return;
|
|
18199
|
+
const previousSigner = toXOnlySignerHex(hex.encode(this.arkServerPublicKey));
|
|
17897
18200
|
const manager = await this.getContractManager();
|
|
17898
18201
|
const currentBoardingScript = hex.encode(this._boardingTapscript.pkScript);
|
|
17899
18202
|
const [offchainRows2, boardingRows] = await Promise.all([
|
|
@@ -17966,6 +18269,14 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
17966
18269
|
} catch (e) {
|
|
17967
18270
|
console.warn("look-ahead refill after server-signer rotation failed", e);
|
|
17968
18271
|
}
|
|
18272
|
+
if (this._executorManager) {
|
|
18273
|
+
const held = await this.liveRenewalWatches(previousSigner).catch(() => []);
|
|
18274
|
+
if (held.length > 0) {
|
|
18275
|
+
console.warn(
|
|
18276
|
+
"Executor delegations stay under the previous operator key, and getAddress() shows the own address: call registerRenewal() again to delegate under the new one"
|
|
18277
|
+
);
|
|
18278
|
+
}
|
|
18279
|
+
}
|
|
17969
18280
|
}
|
|
17970
18281
|
/**
|
|
17971
18282
|
* Serializes `settle`/`send` so VtxoManager's background renewal can't race user
|
|
@@ -18035,6 +18346,16 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
18035
18346
|
// Own queue, not the tx lock: a settle holds that for a whole batch round. The pending and
|
|
18036
18347
|
// held sets already order a hold against a spend.
|
|
18037
18348
|
reservationQueue = Promise.resolve();
|
|
18349
|
+
requireReservationRepository() {
|
|
18350
|
+
const repository = this.reservationRepository;
|
|
18351
|
+
if (!repository) throw new Error("VTXO reservation repository is required");
|
|
18352
|
+
if (repository.version !== 2 || typeof repository.deleteReservationIfMatches !== "function") {
|
|
18353
|
+
throw new Error(
|
|
18354
|
+
"VTXO reservation repository version 2 with atomic release is required"
|
|
18355
|
+
);
|
|
18356
|
+
}
|
|
18357
|
+
return repository;
|
|
18358
|
+
}
|
|
18038
18359
|
withReservationWrite(fn) {
|
|
18039
18360
|
const run = this.reservationQueue.then(fn);
|
|
18040
18361
|
this.reservationQueue = run.catch(() => void 0);
|
|
@@ -18047,13 +18368,13 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
18047
18368
|
}
|
|
18048
18369
|
/** Restored before automatic spending. Reusing an owner id must name the same inputs. */
|
|
18049
18370
|
async reserveVtxosPersistently(outpoints, id) {
|
|
18050
|
-
|
|
18371
|
+
const repository = this.requireReservationRepository();
|
|
18051
18372
|
if (typeof id !== "string" || !id) throw new Error("Reservation id is required");
|
|
18052
18373
|
const snapshot = outpoints.map(({ txid, vout }) => ({ txid, vout }));
|
|
18053
18374
|
await this.withReservationWrite(async () => {
|
|
18054
18375
|
const existing = this.persistentReservations.get(id);
|
|
18055
18376
|
if (existing) {
|
|
18056
|
-
if (
|
|
18377
|
+
if (reservationOutpointSetKey(existing) !== reservationOutpointSetKey(snapshot)) {
|
|
18057
18378
|
throw new Error("Reservation id already holds different inputs");
|
|
18058
18379
|
}
|
|
18059
18380
|
return;
|
|
@@ -18063,7 +18384,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
18063
18384
|
this.persistentReservedOutpoints.add(`${txid}:${vout}`);
|
|
18064
18385
|
try {
|
|
18065
18386
|
await assertNoIntentLockedInputs(snapshot, this.intentRepository);
|
|
18066
|
-
await
|
|
18387
|
+
await repository.saveReservation({ id, outpoints: snapshot });
|
|
18067
18388
|
this.persistentReservations.set(id, snapshot);
|
|
18068
18389
|
} catch (error) {
|
|
18069
18390
|
hold.release();
|
|
@@ -18079,11 +18400,12 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
18079
18400
|
* newer hold under its id alone.
|
|
18080
18401
|
*/
|
|
18081
18402
|
async releaseVtxoReservation(id, expected) {
|
|
18082
|
-
|
|
18403
|
+
const repository = this.requireReservationRepository();
|
|
18083
18404
|
await this.withReservationWrite(async () => {
|
|
18084
18405
|
const outpoints = this.persistentReservations.get(id) ?? [];
|
|
18085
|
-
if (expected &&
|
|
18086
|
-
|
|
18406
|
+
if (expected && reservationOutpointSetKey(outpoints) !== reservationOutpointSetKey(expected))
|
|
18407
|
+
return;
|
|
18408
|
+
if (!await repository.deleteReservationIfMatches(id, expected ?? outpoints)) return;
|
|
18087
18409
|
this.persistentReservations.delete(id);
|
|
18088
18410
|
const stillNamed = new Set(
|
|
18089
18411
|
[...this.persistentReservations.values()].flat().map(({ txid, vout }) => `${txid}:${vout}`)
|
|
@@ -18270,6 +18592,11 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
18270
18592
|
settlementConfig;
|
|
18271
18593
|
_concurrentSpending = false;
|
|
18272
18594
|
_submitsAwaitingFinalize = 0;
|
|
18595
|
+
pendingTxRecoveryDeferred = false;
|
|
18596
|
+
/** @internal */
|
|
18597
|
+
get hasDeferredPendingTxRecovery() {
|
|
18598
|
+
return this.pendingTxRecoveryDeferred;
|
|
18599
|
+
}
|
|
18273
18600
|
/** @see WalletConfig.concurrentSpending */
|
|
18274
18601
|
get concurrentSpending() {
|
|
18275
18602
|
return this._concurrentSpending;
|
|
@@ -18281,10 +18608,18 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
18281
18608
|
async getArkadeBroadcaster() {
|
|
18282
18609
|
const ark = this.arkProvider;
|
|
18283
18610
|
return {
|
|
18284
|
-
submitTx: (signedArkTx, checkpointTxs) =>
|
|
18611
|
+
submitTx: async (signedArkTx, checkpointTxs) => {
|
|
18612
|
+
this.assertNoDeferredPendingTxRecovery();
|
|
18613
|
+
return ark.submitTx(signedArkTx, checkpointTxs);
|
|
18614
|
+
},
|
|
18285
18615
|
finalizeTx: (arkTxid, finalCheckpointTxs) => ark.finalizeTx(arkTxid, finalCheckpointTxs)
|
|
18286
18616
|
};
|
|
18287
18617
|
}
|
|
18618
|
+
assertNoDeferredPendingTxRecovery() {
|
|
18619
|
+
if (this.pendingTxRecoveryDeferred) {
|
|
18620
|
+
throw new Error("Pending Arkade transaction recovery is required before sending");
|
|
18621
|
+
}
|
|
18622
|
+
}
|
|
18288
18623
|
get assetManager() {
|
|
18289
18624
|
this._walletAssetManager ??= new AssetManager(this);
|
|
18290
18625
|
return this._walletAssetManager;
|
|
@@ -19482,12 +19817,42 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19482
19817
|
* @returns Array of transaction IDs that were finalized
|
|
19483
19818
|
*/
|
|
19484
19819
|
async finalizePendingTxs(vtxos) {
|
|
19820
|
+
return this.finalizePendingTxsImpl(vtxos);
|
|
19821
|
+
}
|
|
19822
|
+
/** @internal */
|
|
19823
|
+
async deferPendingTxRecovery() {
|
|
19824
|
+
this.pendingTxRecoveryDeferred = await this.hasPendingTxFlag();
|
|
19825
|
+
return this.pendingTxRecoveryDeferred;
|
|
19826
|
+
}
|
|
19827
|
+
/** @internal */
|
|
19828
|
+
async resumeDeferredPendingTxs(isCurrent) {
|
|
19829
|
+
const info = await this.getOperatorInfo({ requireLive: true });
|
|
19830
|
+
if (info.network !== this.network.name) {
|
|
19831
|
+
throw new Error("Operator network changed while recovering pending transactions");
|
|
19832
|
+
}
|
|
19833
|
+
await this._withTxLock(async () => {
|
|
19834
|
+
if (!isCurrent()) return;
|
|
19835
|
+
try {
|
|
19836
|
+
await this.finalizePendingTxsImpl(void 0, { info, isCurrent });
|
|
19837
|
+
} catch (error) {
|
|
19838
|
+
if (!isTransientOperatorError(error) && isCurrent()) {
|
|
19839
|
+
this.pendingTxRecoveryDeferred = false;
|
|
19840
|
+
}
|
|
19841
|
+
throw error;
|
|
19842
|
+
}
|
|
19843
|
+
if (isCurrent()) this.pendingTxRecoveryDeferred = false;
|
|
19844
|
+
});
|
|
19845
|
+
}
|
|
19846
|
+
async finalizePendingTxsImpl(vtxos, recovery) {
|
|
19847
|
+
const isCurrent = recovery?.isCurrent ?? (() => true);
|
|
19485
19848
|
const hasPending = await this.hasPendingTxFlag();
|
|
19486
|
-
if (!hasPending) {
|
|
19849
|
+
if (!hasPending || !isCurrent()) {
|
|
19850
|
+
if (!hasPending && isCurrent()) this.pendingTxRecoveryDeferred = false;
|
|
19487
19851
|
return { finalized: [], pending: [] };
|
|
19488
19852
|
}
|
|
19489
19853
|
if (!vtxos || vtxos.length === 0) {
|
|
19490
19854
|
const scriptMap = await this.getScriptMap();
|
|
19855
|
+
if (!isCurrent()) return { finalized: [], pending: [] };
|
|
19491
19856
|
const allExtended = [];
|
|
19492
19857
|
const fetchedVtxos = await getAllNormalizedVtxos(this.indexerProvider, [
|
|
19493
19858
|
...scriptMap.keys()
|
|
@@ -19495,7 +19860,9 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19495
19860
|
for (const vtxo of fetchedVtxos) {
|
|
19496
19861
|
const vtxoScript = scriptMap.get(vtxo.script);
|
|
19497
19862
|
if (!vtxoScript) continue;
|
|
19498
|
-
if (
|
|
19863
|
+
if (recovery) {
|
|
19864
|
+
if (isSubdust(vtxo, this.dustAmount) || vtxo.isUnrolled) continue;
|
|
19865
|
+
} else if (!vtxo.isSpent && !(vtxo.isPreconfirmed && !vtxo.isSwept)) {
|
|
19499
19866
|
continue;
|
|
19500
19867
|
}
|
|
19501
19868
|
allExtended.push({
|
|
@@ -19514,19 +19881,24 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19514
19881
|
for (let i = 0; i < vtxos.length; i += MAX_INPUTS_PER_PROOF) {
|
|
19515
19882
|
batches.push(vtxos.slice(i, i + MAX_INPUTS_PER_PROOF));
|
|
19516
19883
|
}
|
|
19517
|
-
const unrollCandidates = this.checkpointUnrollCandidates(
|
|
19884
|
+
const unrollCandidates = this.checkpointUnrollCandidates(
|
|
19885
|
+
recovery?.info ?? await this.arkProvider.getInfo()
|
|
19886
|
+
);
|
|
19887
|
+
if (!isCurrent()) return { finalized: [], pending: [] };
|
|
19518
19888
|
const checkpointInputs = vtxos.map((vtxo) => ({
|
|
19519
19889
|
...vtxo,
|
|
19520
19890
|
tapLeafScript: vtxo.forfeitTapLeafScript
|
|
19521
19891
|
}));
|
|
19522
19892
|
const seen = /* @__PURE__ */ new Set();
|
|
19523
|
-
const results = await Promise.
|
|
19893
|
+
const results = await Promise.allSettled(
|
|
19524
19894
|
batches.map(async (batch) => {
|
|
19525
19895
|
const batchFinalized = [];
|
|
19526
19896
|
const batchPending = [];
|
|
19527
19897
|
const intent = await this.makeGetPendingTxIntentSignature(batch);
|
|
19898
|
+
if (!isCurrent()) return { finalized: batchFinalized, pending: batchPending };
|
|
19528
19899
|
const pendingTxs = await this.arkProvider.getPendingTxs(intent);
|
|
19529
19900
|
for (const pendingTx of pendingTxs) {
|
|
19901
|
+
if (!isCurrent()) break;
|
|
19530
19902
|
if (seen.has(pendingTx.arkTxid)) continue;
|
|
19531
19903
|
seen.add(pendingTx.arkTxid);
|
|
19532
19904
|
batchPending.push(pendingTx.arkTxid);
|
|
@@ -19562,6 +19934,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19562
19934
|
);
|
|
19563
19935
|
const identity = this.identity;
|
|
19564
19936
|
const batchEligible = isBatchSignable(identity) && await this._signerRouter.canBatch(...checkpointJobs);
|
|
19937
|
+
if (!isCurrent()) break;
|
|
19565
19938
|
let finalCheckpoints;
|
|
19566
19939
|
if (batchEligible) {
|
|
19567
19940
|
const requests = checkpointTxs.map((tx, i) => ({
|
|
@@ -19586,9 +19959,11 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19586
19959
|
})
|
|
19587
19960
|
);
|
|
19588
19961
|
}
|
|
19962
|
+
if (!isCurrent()) break;
|
|
19589
19963
|
await this.arkProvider.finalizeTx(pendingTx.arkTxid, finalCheckpoints);
|
|
19590
19964
|
batchFinalized.push(pendingTx.arkTxid);
|
|
19591
19965
|
} catch (error) {
|
|
19966
|
+
if (recovery && isTransientOperatorError(error)) throw error;
|
|
19592
19967
|
console.error(
|
|
19593
19968
|
`Failed to finalize transaction ${pendingTx.arkTxid}:`,
|
|
19594
19969
|
error
|
|
@@ -19604,11 +19979,13 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19604
19979
|
const finalized = [];
|
|
19605
19980
|
const pending = [];
|
|
19606
19981
|
for (const result of results) {
|
|
19607
|
-
|
|
19608
|
-
|
|
19982
|
+
if (result.status === "rejected") throw result.reason;
|
|
19983
|
+
finalized.push(...result.value.finalized);
|
|
19984
|
+
pending.push(...result.value.pending);
|
|
19609
19985
|
}
|
|
19610
|
-
if (finalized.length === pending.length) {
|
|
19611
|
-
await this.setPendingTxFlag(false);
|
|
19986
|
+
if (finalized.length === pending.length && isCurrent()) {
|
|
19987
|
+
await this.setPendingTxFlag(false, isCurrent);
|
|
19988
|
+
if (isCurrent()) this.pendingTxRecoveryDeferred = false;
|
|
19612
19989
|
}
|
|
19613
19990
|
return { finalized, pending };
|
|
19614
19991
|
}
|
|
@@ -19643,11 +20020,11 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
19643
20020
|
const state = await this.walletRepository.getWalletState();
|
|
19644
20021
|
return state?.settings?.hasPendingTx === true;
|
|
19645
20022
|
}
|
|
19646
|
-
async setPendingTxFlag(value) {
|
|
19647
|
-
await updateWalletState(
|
|
19648
|
-
|
|
19649
|
-
settings: { ...state.settings, hasPendingTx: value }
|
|
19650
|
-
|
|
20023
|
+
async setPendingTxFlag(value, isCurrent = () => true) {
|
|
20024
|
+
await updateWalletState(
|
|
20025
|
+
this.walletRepository,
|
|
20026
|
+
(state) => isCurrent() ? { ...state, settings: { ...state.settings, hasPendingTx: value } } : state
|
|
20027
|
+
);
|
|
19651
20028
|
}
|
|
19652
20029
|
/**
|
|
19653
20030
|
* Create an ArkadeCash bearer instrument: sends `amount` to a DefaultVtxo controlled by a fresh
|
|
@@ -20445,8 +20822,8 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
20445
20822
|
}
|
|
20446
20823
|
/**
|
|
20447
20824
|
* Change follows its inputs: a send spending a coin at a live renewal watch returns the change
|
|
20448
|
-
* to that contract, so the Executor keeps renewing it.
|
|
20449
|
-
* send must not fail over a delegation lookup.
|
|
20825
|
+
* to that contract, so the Executor keeps renewing it. Otherwise it goes where receives go.
|
|
20826
|
+
* Fail-open: a send must not fail over a delegation lookup.
|
|
20450
20827
|
*/
|
|
20451
20828
|
async changeTapscriptFor(inputs, changeAmount, serverPubKey, own) {
|
|
20452
20829
|
try {
|
|
@@ -20458,8 +20835,9 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
20458
20835
|
}
|
|
20459
20836
|
} catch (e) {
|
|
20460
20837
|
console.warn("Unable to inspect Executor renewal watches", e);
|
|
20838
|
+
return own;
|
|
20461
20839
|
}
|
|
20462
|
-
return own;
|
|
20840
|
+
return this.destinationTapscript(serverPubKey, own, BigInt(changeAmount));
|
|
20463
20841
|
}
|
|
20464
20842
|
/** The live Executor renewal watches under `signer`, the operator's x-only key. */
|
|
20465
20843
|
async liveRenewalWatches(signer) {
|
|
@@ -20467,35 +20845,34 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
20467
20845
|
(w) => w.live && w.signer === signer
|
|
20468
20846
|
);
|
|
20469
20847
|
}
|
|
20470
|
-
/** Whether the Executor can renew `amount` at `watch`: not for `maxFee + dust` or less. */
|
|
20471
|
-
renews(watch, amount) {
|
|
20472
|
-
return amount > BigInt(watch.contract.params.maxFee) + this.dustAmount;
|
|
20473
|
-
}
|
|
20474
20848
|
/**
|
|
20475
|
-
* @internal Where the wallet's own renewals pay `amount`:
|
|
20476
|
-
*
|
|
20477
|
-
*
|
|
20478
|
-
*
|
|
20479
|
-
*
|
|
20480
|
-
*
|
|
20481
|
-
*
|
|
20482
|
-
*
|
|
20483
|
-
* delegation lookup.
|
|
20849
|
+
* @internal Where the wallet's own renewals pay `amount`: {@link getAddress}, except for
|
|
20850
|
+
* `maxFee + dust` or less, which the Executor cannot renew, and when any of `inputScripts`
|
|
20851
|
+
* sits at a live renewal contract, whatever the reason: the Executor had its chance at that
|
|
20852
|
+
* coin, and paying it back there only repeats the miss. Both pay the wallet's own address.
|
|
20853
|
+
* Fail-open: a renewal must not fail over a delegation lookup.
|
|
20854
|
+
*
|
|
20855
|
+
* {@link VtxoManager} does not ask for a renewal of a coin that carries assets: `settle()`
|
|
20856
|
+
* places assets only at {@link getAddress}, which that renewal pays whatever the rules above say.
|
|
20484
20857
|
*/
|
|
20485
20858
|
async renewalAddress(amount, inputScripts = []) {
|
|
20486
|
-
const own =
|
|
20487
|
-
|
|
20488
|
-
|
|
20489
|
-
|
|
20490
|
-
|
|
20491
|
-
|
|
20492
|
-
|
|
20493
|
-
|
|
20494
|
-
|
|
20495
|
-
|
|
20496
|
-
|
|
20497
|
-
|
|
20859
|
+
const own = this.offchainTapscript;
|
|
20860
|
+
const serverPubKey = this.arkServerPublicKey;
|
|
20861
|
+
const addressOf = (tapscript) => tapscript.address(this.network.hrp, serverPubKey).encode();
|
|
20862
|
+
if (inputScripts.length > 0) {
|
|
20863
|
+
try {
|
|
20864
|
+
const live = await this.liveRenewalWatches(
|
|
20865
|
+
toXOnlySignerHex(hex.encode(serverPubKey))
|
|
20866
|
+
);
|
|
20867
|
+
if (live.some((w) => inputScripts.includes(w.contract.script))) {
|
|
20868
|
+
return addressOf(own);
|
|
20869
|
+
}
|
|
20870
|
+
} catch (e) {
|
|
20871
|
+
console.warn("Unable to inspect Executor renewal watches", e);
|
|
20872
|
+
return addressOf(own);
|
|
20873
|
+
}
|
|
20498
20874
|
}
|
|
20875
|
+
return addressOf(await this.destinationTapscript(serverPubKey, own, amount));
|
|
20499
20876
|
}
|
|
20500
20877
|
/**
|
|
20501
20878
|
* Shared submit/persist tail of `send` and {@link sendSelectedVtxosToSelf}; callers own coin
|
|
@@ -20630,6 +21007,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
20630
21007
|
});
|
|
20631
21008
|
}
|
|
20632
21009
|
async _buildAndSubmitOffchainTx(inputs, outputs, serverUnrollScript, options) {
|
|
21010
|
+
this.assertNoDeferredPendingTxRecovery();
|
|
20633
21011
|
await assertNoIntentLockedInputs(inputs, this.intentRepository);
|
|
20634
21012
|
assertNoPersistentReservation(inputs, this.persistentReservedOutpoints);
|
|
20635
21013
|
const validUntil = captureSendDeadline(options?.validUntil);
|
|
@@ -21467,8 +21845,8 @@ var MessageBus = class {
|
|
|
21467
21845
|
*/
|
|
21468
21846
|
initChain = Promise.resolve();
|
|
21469
21847
|
/**
|
|
21470
|
-
* Number of inits accepted but not yet settled (queued or
|
|
21471
|
-
* bus refuses ordinary wallet messages while this is > 0.
|
|
21848
|
+
* Number of inits and releases accepted but not yet settled (queued or
|
|
21849
|
+
* running). The bus refuses ordinary wallet messages while this is > 0.
|
|
21472
21850
|
*/
|
|
21473
21851
|
pendingInitCount = 0;
|
|
21474
21852
|
buildServicesFn;
|
|
@@ -21645,6 +22023,30 @@ var MessageBus = class {
|
|
|
21645
22023
|
this.initChain = run.catch(() => void 0);
|
|
21646
22024
|
return run;
|
|
21647
22025
|
}
|
|
22026
|
+
/**
|
|
22027
|
+
* Back to a fresh worker's state. On the init chain, so a later init
|
|
22028
|
+
* builds only after these handlers stop.
|
|
22029
|
+
*/
|
|
22030
|
+
release(epoch) {
|
|
22031
|
+
this.pendingInitCount += 1;
|
|
22032
|
+
const run = this.initChain.then(async () => {
|
|
22033
|
+
if (epoch !== this.broadcastEpoch || !this.initialized) return;
|
|
22034
|
+
this.initialized = false;
|
|
22035
|
+
this.invalidateBroadcasts();
|
|
22036
|
+
if (this.tickTimeout !== null) {
|
|
22037
|
+
self.clearTimeout(this.tickTimeout);
|
|
22038
|
+
this.tickTimeout = null;
|
|
22039
|
+
}
|
|
22040
|
+
await Promise.all(
|
|
22041
|
+
Array.from(this.handlers.values()).map((h) => h.stop().catch(() => {
|
|
22042
|
+
}))
|
|
22043
|
+
);
|
|
22044
|
+
}).finally(() => {
|
|
22045
|
+
this.pendingInitCount -= 1;
|
|
22046
|
+
});
|
|
22047
|
+
this.initChain = run.catch(() => void 0);
|
|
22048
|
+
return run;
|
|
22049
|
+
}
|
|
21648
22050
|
/**
|
|
21649
22051
|
* The bus serves ordinary wallet messages only when it is initialized AND
|
|
21650
22052
|
* no init is in flight.
|
|
@@ -21664,7 +22066,8 @@ var MessageBus = class {
|
|
|
21664
22066
|
broadcast: (response) => {
|
|
21665
22067
|
if (epoch !== this.broadcastEpoch) return;
|
|
21666
22068
|
this.broadcastToClients([response]);
|
|
21667
|
-
}
|
|
22069
|
+
},
|
|
22070
|
+
release: () => this.release(epoch)
|
|
21668
22071
|
};
|
|
21669
22072
|
if (this.initialized) {
|
|
21670
22073
|
this.initialized = false;
|
|
@@ -22316,6 +22719,12 @@ var Ramps = class {
|
|
|
22316
22719
|
*
|
|
22317
22720
|
* Returns the onchain txid instead when onchain coins alone cover `amount`
|
|
22318
22721
|
* and were spent via arkd cosigning.
|
|
22722
|
+
*
|
|
22723
|
+
* Rethrows a cosign that failed after the client signed (`OnchainCosignRejectedError`,
|
|
22724
|
+
* `OnchainCosignAmbiguousError`): the operator may still hold that signed tx and complete it,
|
|
22725
|
+
* so paying from other coins can pay twice. No batch here can conflict with it, as arkd
|
|
22726
|
+
* refuses an intent mixing onchain inputs and outputs. See "Onchain cosigning" in the README for
|
|
22727
|
+
* the caller's options.
|
|
22319
22728
|
*/
|
|
22320
22729
|
async offboardExact(params) {
|
|
22321
22730
|
const { destinationAddress, feeInfo, amount, eventCallback, vtxos } = params;
|
|
@@ -22667,6 +23076,7 @@ var WalletMessageHandler = class {
|
|
|
22667
23076
|
incomingFundsSubscription;
|
|
22668
23077
|
incomingFundsRegistrations = /* @__PURE__ */ new WeakMap();
|
|
22669
23078
|
contractEventsSubscription;
|
|
23079
|
+
retryPendingTxs;
|
|
22670
23080
|
onNextTick = [];
|
|
22671
23081
|
channel;
|
|
22672
23082
|
// One counter per subscription field, bumped exactly where that field is
|
|
@@ -22697,6 +23107,9 @@ var WalletMessageHandler = class {
|
|
|
22697
23107
|
// lifecycle methods
|
|
22698
23108
|
async start(...params) {
|
|
22699
23109
|
const [services, repositories, channel] = params;
|
|
23110
|
+
if (services.wallet?.serverInfoSource === "cache") {
|
|
23111
|
+
await services.wallet.deferPendingTxRecovery();
|
|
23112
|
+
}
|
|
22700
23113
|
this.readonlyWallet = services.readonlyWallet;
|
|
22701
23114
|
this.wallet = services.wallet;
|
|
22702
23115
|
this.walletRequestBinding = services.walletRequestBinding ? Object.freeze({ ...services.walletRequestBinding }) : void 0;
|
|
@@ -22705,6 +23118,7 @@ var WalletMessageHandler = class {
|
|
|
22705
23118
|
this.walletRepository = repositories.walletRepository;
|
|
22706
23119
|
this.channel = channel;
|
|
22707
23120
|
this.onNextTick = [];
|
|
23121
|
+
this.retryPendingTxs = void 0;
|
|
22708
23122
|
}
|
|
22709
23123
|
async stop() {
|
|
22710
23124
|
const wallet = this.wallet ?? this.readonlyWallet;
|
|
@@ -22716,6 +23130,7 @@ var WalletMessageHandler = class {
|
|
|
22716
23130
|
this.channel = void 0;
|
|
22717
23131
|
this.walletRequestBinding = void 0;
|
|
22718
23132
|
this.onNextTick = [];
|
|
23133
|
+
this.retryPendingTxs = void 0;
|
|
22719
23134
|
if (this.incomingFundsSubscription) {
|
|
22720
23135
|
this.incomingFundsSubscription();
|
|
22721
23136
|
this.incomingFundsSubscription = void 0;
|
|
@@ -22737,6 +23152,9 @@ var WalletMessageHandler = class {
|
|
|
22737
23152
|
}
|
|
22738
23153
|
}
|
|
22739
23154
|
async tick(_now) {
|
|
23155
|
+
const retryPendingTxs = this.retryPendingTxs;
|
|
23156
|
+
this.retryPendingTxs = void 0;
|
|
23157
|
+
void retryPendingTxs?.();
|
|
22740
23158
|
const pending = this.onNextTick.splice(0);
|
|
22741
23159
|
const results = await Promise.allSettled(pending.map((fn) => fn()));
|
|
22742
23160
|
return results.map((result) => {
|
|
@@ -22873,6 +23291,11 @@ var WalletMessageHandler = class {
|
|
|
22873
23291
|
throw new Error("Invalid scoped wallet request");
|
|
22874
23292
|
}
|
|
22875
23293
|
const context = this.captureRequestContext(message.payload.binding);
|
|
23294
|
+
if (request.type === "DISPOSE") {
|
|
23295
|
+
const release = this.channel?.release;
|
|
23296
|
+
await (release ? release() : this.stop());
|
|
23297
|
+
return this.tagged({ id: request.id, type: "DISPOSE_SUCCESS" });
|
|
23298
|
+
}
|
|
22876
23299
|
if (request.type === "CLEAR" && this.longRunningOperations.size > 0) {
|
|
22877
23300
|
throw new Error(
|
|
22878
23301
|
"Cannot clear the wallet while a long-running operation such as a settlement is in progress"
|
|
@@ -22887,6 +23310,7 @@ var WalletMessageHandler = class {
|
|
|
22887
23310
|
this.contractEventsEpoch++;
|
|
22888
23311
|
this.boardingEpoch++;
|
|
22889
23312
|
this.onNextTick = [];
|
|
23313
|
+
this.retryPendingTxs = void 0;
|
|
22890
23314
|
}
|
|
22891
23315
|
const execution = pending ? settledWithin(pending, this.drainBudgetMs).then((drained) => {
|
|
22892
23316
|
if (!drained) {
|
|
@@ -22960,6 +23384,14 @@ var WalletMessageHandler = class {
|
|
|
22960
23384
|
payload: { address }
|
|
22961
23385
|
});
|
|
22962
23386
|
}
|
|
23387
|
+
case "GET_OWN_ADDRESS": {
|
|
23388
|
+
const address = await readonlyWallet.getOwnAddress();
|
|
23389
|
+
return this.tagged({
|
|
23390
|
+
id,
|
|
23391
|
+
type: "OWN_ADDRESS",
|
|
23392
|
+
payload: { address }
|
|
23393
|
+
});
|
|
23394
|
+
}
|
|
22963
23395
|
case "GET_BOARDING_ADDRESS": {
|
|
22964
23396
|
const address = await readonlyWallet.getBoardingAddress();
|
|
22965
23397
|
return this.tagged({
|
|
@@ -23746,12 +24178,21 @@ var WalletMessageHandler = class {
|
|
|
23746
24178
|
return;
|
|
23747
24179
|
}
|
|
23748
24180
|
this.initEpoch++;
|
|
24181
|
+
this.retryPendingTxs = void 0;
|
|
23749
24182
|
const init = this.newGeneration("init");
|
|
24183
|
+
if (signingWallet?.serverInfoSource === "cache" && !signingWallet.hasDeferredPendingTxRecovery) {
|
|
24184
|
+
await signingWallet.deferPendingTxRecovery();
|
|
24185
|
+
if (init.stale) return;
|
|
24186
|
+
}
|
|
24187
|
+
const deferred = signingWallet?.hasDeferredPendingTxRecovery === true;
|
|
24188
|
+
if (signingWallet && deferred) {
|
|
24189
|
+
this.schedulePendingTxRecovery(signingWallet, context, init);
|
|
24190
|
+
}
|
|
23750
24191
|
await this.ensureContractEventBroadcasting(context);
|
|
23751
24192
|
if (init.stale) return;
|
|
23752
24193
|
await this.refreshCachedData({ lazyBoarding }, context, init);
|
|
23753
24194
|
if (init.stale) return;
|
|
23754
|
-
if (signingWallet) {
|
|
24195
|
+
if (signingWallet && !deferred) {
|
|
23755
24196
|
try {
|
|
23756
24197
|
const vtxos = await this.getVtxosFromRepo(void 0, context);
|
|
23757
24198
|
if (init.stale) return;
|
|
@@ -23767,7 +24208,13 @@ var WalletMessageHandler = class {
|
|
|
23767
24208
|
`Recovered ${finalized.length}/${pending.length} pending transactions: ${finalized.join(", ")}`
|
|
23768
24209
|
);
|
|
23769
24210
|
} catch (error) {
|
|
23770
|
-
|
|
24211
|
+
if (init.stale) return;
|
|
24212
|
+
if (isTransientOperatorError(error) && await signingWallet.deferPendingTxRecovery()) {
|
|
24213
|
+
if (init.stale) return;
|
|
24214
|
+
this.schedulePendingTxRecovery(signingWallet, context, init);
|
|
24215
|
+
} else {
|
|
24216
|
+
console.error("Error recovering pending transactions:", error);
|
|
24217
|
+
}
|
|
23771
24218
|
}
|
|
23772
24219
|
if (init.stale) return;
|
|
23773
24220
|
}
|
|
@@ -23793,6 +24240,33 @@ var WalletMessageHandler = class {
|
|
|
23793
24240
|
}
|
|
23794
24241
|
}
|
|
23795
24242
|
}
|
|
24243
|
+
schedulePendingTxRecovery(wallet, context, init) {
|
|
24244
|
+
const reported = /* @__PURE__ */ new Set();
|
|
24245
|
+
const retry = async () => {
|
|
24246
|
+
if (init.stale) return;
|
|
24247
|
+
try {
|
|
24248
|
+
await this.runOwnedOperation(
|
|
24249
|
+
context,
|
|
24250
|
+
() => wallet.resumeDeferredPendingTxs(() => !init.stale)
|
|
24251
|
+
);
|
|
24252
|
+
} catch (error) {
|
|
24253
|
+
if (init.stale) return;
|
|
24254
|
+
if (!wallet.hasDeferredPendingTxRecovery) {
|
|
24255
|
+
console.error("Error recovering pending transactions:", error);
|
|
24256
|
+
return;
|
|
24257
|
+
}
|
|
24258
|
+
if (!isTransientOperatorError(error)) {
|
|
24259
|
+
const reason = String(error);
|
|
24260
|
+
if (!reported.has(reason)) {
|
|
24261
|
+
reported.add(reason);
|
|
24262
|
+
console.error("Retrying pending transaction recovery:", error);
|
|
24263
|
+
}
|
|
24264
|
+
}
|
|
24265
|
+
this.retryPendingTxs = retry;
|
|
24266
|
+
}
|
|
24267
|
+
};
|
|
24268
|
+
this.retryPendingTxs = retry;
|
|
24269
|
+
}
|
|
23796
24270
|
async registerIncomingFunds(wallet, emitter, context) {
|
|
23797
24271
|
const repository = context.walletRepository;
|
|
23798
24272
|
if (emitter.stale) return;
|
|
@@ -24222,6 +24696,7 @@ var initWaitBackoffMs = (attempt) => Math.min(100 * 2 ** attempt, INIT_WAIT_BACK
|
|
|
24222
24696
|
var DEFAULT_MESSAGE_TIMEOUTS = {
|
|
24223
24697
|
// Fast reads — fail quickly
|
|
24224
24698
|
GET_ADDRESS: 1e4,
|
|
24699
|
+
GET_OWN_ADDRESS: 1e4,
|
|
24225
24700
|
GET_BALANCE: 1e4,
|
|
24226
24701
|
GET_BOARDING_ADDRESS: 1e4,
|
|
24227
24702
|
GET_STATUS: 1e4,
|
|
@@ -24302,6 +24777,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
|
|
|
24302
24777
|
INIT_WALLET: 3e4,
|
|
24303
24778
|
SCOPED_WALLET_REQUEST_V1: 3e4,
|
|
24304
24779
|
CLEAR: 1e4,
|
|
24780
|
+
DISPOSE: 3e4,
|
|
24305
24781
|
SIGN_TRANSACTION: 3e4,
|
|
24306
24782
|
CREATE_CONTRACT: 3e4,
|
|
24307
24783
|
UPDATE_CONTRACT: 3e4,
|
|
@@ -24315,6 +24791,7 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
|
|
|
24315
24791
|
};
|
|
24316
24792
|
var DEDUPABLE_REQUEST_TYPES = /* @__PURE__ */ new Set([
|
|
24317
24793
|
"GET_ADDRESS",
|
|
24794
|
+
"GET_OWN_ADDRESS",
|
|
24318
24795
|
"GET_OPERATOR_INFO",
|
|
24319
24796
|
"INDEXER_GET_VTXOS",
|
|
24320
24797
|
"INDEXER_GET_VIRTUAL_TXS",
|
|
@@ -24484,6 +24961,8 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24484
24961
|
messageBusTimeoutMs;
|
|
24485
24962
|
messageTimeouts = DEFAULT_MESSAGE_TIMEOUTS;
|
|
24486
24963
|
reinitPromise = null;
|
|
24964
|
+
disposed = false;
|
|
24965
|
+
disposePromise;
|
|
24487
24966
|
pingPromise = null;
|
|
24488
24967
|
inflightRequests = /* @__PURE__ */ new Map();
|
|
24489
24968
|
get assetManager() {
|
|
@@ -24666,6 +25145,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24666
25145
|
});
|
|
24667
25146
|
}
|
|
24668
25147
|
async sendMessage(request) {
|
|
25148
|
+
this.assertNotDisposed();
|
|
24669
25149
|
if (!DEDUPABLE_REQUEST_TYPES.has(request.type)) {
|
|
24670
25150
|
return this.sendMessageWithRetry(request);
|
|
24671
25151
|
}
|
|
@@ -24709,17 +25189,20 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24709
25189
|
// send a message, retrying up to 2 times if the service worker was
|
|
24710
25190
|
// killed and restarted by the OS (mobile browsers do this aggressively)
|
|
24711
25191
|
async sendMessageWithRetry(request, withEvents) {
|
|
25192
|
+
this.assertNotDisposed();
|
|
24712
25193
|
request = this.scopeRequest(request);
|
|
24713
25194
|
if (this.initConfig) {
|
|
24714
25195
|
try {
|
|
24715
25196
|
await this.pingServiceWorker();
|
|
24716
25197
|
} catch {
|
|
25198
|
+
this.assertNotDisposed();
|
|
24717
25199
|
await this.reinitialize();
|
|
24718
25200
|
}
|
|
24719
25201
|
}
|
|
24720
25202
|
const timeoutMs = this.getTimeoutForRequest(request);
|
|
24721
25203
|
const maxRetries = 2;
|
|
24722
25204
|
for (let attempt = 0, initWaits = 0; ; attempt++) {
|
|
25205
|
+
this.assertNotDisposed();
|
|
24723
25206
|
try {
|
|
24724
25207
|
if (withEvents) {
|
|
24725
25208
|
return await this.sendMessageStreaming(
|
|
@@ -24731,6 +25214,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24731
25214
|
return await this.sendMessageDirect(request, timeoutMs);
|
|
24732
25215
|
} catch (error) {
|
|
24733
25216
|
if (isMessageBusInitializingError(error)) {
|
|
25217
|
+
this.assertNotDisposed();
|
|
24734
25218
|
if (initWaits >= MAX_INIT_WAITS) throw error;
|
|
24735
25219
|
await sleep(initWaitBackoffMs(initWaits++));
|
|
24736
25220
|
attempt--;
|
|
@@ -24739,6 +25223,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24739
25223
|
if (!isMessageBusNotInitializedError(error) || attempt >= maxRetries) {
|
|
24740
25224
|
throw error;
|
|
24741
25225
|
}
|
|
25226
|
+
this.assertNotDisposed();
|
|
24742
25227
|
await this.reinitialize();
|
|
24743
25228
|
}
|
|
24744
25229
|
}
|
|
@@ -24771,11 +25256,14 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24771
25256
|
return this.initWalletPayload;
|
|
24772
25257
|
}
|
|
24773
25258
|
async reinitialize() {
|
|
25259
|
+
this.assertNotDisposed();
|
|
24774
25260
|
if (this.reinitPromise) return this.reinitPromise;
|
|
24775
25261
|
this.reinitPromise = (async () => {
|
|
24776
25262
|
const config = await this.buildInitConfig();
|
|
25263
|
+
this.assertNotDisposed();
|
|
24777
25264
|
const payload = this.buildInitWalletPayload();
|
|
24778
25265
|
await initializeMessageBus(this.serviceWorker, config, this.messageBusTimeoutMs);
|
|
25266
|
+
this.assertNotDisposed();
|
|
24779
25267
|
const initMessage = {
|
|
24780
25268
|
tag: this.messageTag,
|
|
24781
25269
|
type: "INIT_WALLET",
|
|
@@ -24783,6 +25271,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24783
25271
|
payload
|
|
24784
25272
|
};
|
|
24785
25273
|
await this.assertWorkerIdentityMatches();
|
|
25274
|
+
this.assertNotDisposed();
|
|
24786
25275
|
await this.sendMessageDirect(
|
|
24787
25276
|
this.scopeRequest(initMessage),
|
|
24788
25277
|
this.getTimeoutForRequest(initMessage)
|
|
@@ -24836,6 +25325,49 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24836
25325
|
}
|
|
24837
25326
|
this.walletRequestBinding ??= Object.freeze({ ...binding });
|
|
24838
25327
|
}
|
|
25328
|
+
assertNotDisposed() {
|
|
25329
|
+
if (this.disposed) throw new Error("Service worker wallet is disposed");
|
|
25330
|
+
}
|
|
25331
|
+
/**
|
|
25332
|
+
* Revoke this worker wallet and proxy without deleting persisted data or
|
|
25333
|
+
* holds; call again after a failure to retry.
|
|
25334
|
+
*/
|
|
25335
|
+
dispose() {
|
|
25336
|
+
this.disposed = true;
|
|
25337
|
+
this.disposePromise ??= this.disposeWorker().catch((error) => {
|
|
25338
|
+
this.disposePromise = void 0;
|
|
25339
|
+
throw error;
|
|
25340
|
+
});
|
|
25341
|
+
return this.disposePromise;
|
|
25342
|
+
}
|
|
25343
|
+
async disposeWorker() {
|
|
25344
|
+
await this.reinitPromise?.catch(() => void 0);
|
|
25345
|
+
const message = {
|
|
25346
|
+
id: getRandomId(),
|
|
25347
|
+
tag: this.messageTag,
|
|
25348
|
+
type: "DISPOSE"
|
|
25349
|
+
};
|
|
25350
|
+
for (let initWaits = 0; ; ) {
|
|
25351
|
+
try {
|
|
25352
|
+
const response = await this.sendMessageDirect(
|
|
25353
|
+
this.scopeRequest(message),
|
|
25354
|
+
this.getTimeoutForRequest(message)
|
|
25355
|
+
);
|
|
25356
|
+
if (response.type !== "DISPOSE_SUCCESS") {
|
|
25357
|
+
throw new Error("Worker did not confirm wallet disposal");
|
|
25358
|
+
}
|
|
25359
|
+
return;
|
|
25360
|
+
} catch (error) {
|
|
25361
|
+
if (isMessageBusInitializingError(error)) {
|
|
25362
|
+
if (initWaits >= MAX_INIT_WAITS) throw error;
|
|
25363
|
+
await sleep(initWaitBackoffMs(initWaits++));
|
|
25364
|
+
continue;
|
|
25365
|
+
}
|
|
25366
|
+
if (isMessageBusNotInitializedError(error)) return;
|
|
25367
|
+
throw error;
|
|
25368
|
+
}
|
|
25369
|
+
}
|
|
25370
|
+
}
|
|
24839
25371
|
/** This tells the service worker to wipe all locally persisted wallet data. */
|
|
24840
25372
|
async clear() {
|
|
24841
25373
|
const message = {
|
|
@@ -24858,6 +25390,22 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
24858
25390
|
throw new Error(`Failed to get address: ${error}`);
|
|
24859
25391
|
}
|
|
24860
25392
|
}
|
|
25393
|
+
async getOwnAddress() {
|
|
25394
|
+
const message = {
|
|
25395
|
+
id: getRandomId(),
|
|
25396
|
+
tag: this.messageTag,
|
|
25397
|
+
type: "GET_OWN_ADDRESS"
|
|
25398
|
+
};
|
|
25399
|
+
try {
|
|
25400
|
+
const response = await this.sendMessage(message);
|
|
25401
|
+
return response.payload.address;
|
|
25402
|
+
} catch (error) {
|
|
25403
|
+
if (error instanceof Error && error.message === "Unknown message") {
|
|
25404
|
+
return this.getAddress();
|
|
25405
|
+
}
|
|
25406
|
+
throw new Error(`Failed to get own address: ${error}`);
|
|
25407
|
+
}
|
|
25408
|
+
}
|
|
24861
25409
|
async getBoardingAddress() {
|
|
24862
25410
|
const message = {
|
|
24863
25411
|
id: getRandomId(),
|
|
@@ -25079,11 +25627,12 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
25079
25627
|
}
|
|
25080
25628
|
/** Subscribe to contract and coin updates bound to this proxy's wallet. */
|
|
25081
25629
|
onWalletUpdate(callback) {
|
|
25630
|
+
this.assertNotDisposed();
|
|
25082
25631
|
const binding = this.walletRequestBinding;
|
|
25083
25632
|
const tag = this.messageTag;
|
|
25084
25633
|
const messageHandler = (event) => {
|
|
25085
25634
|
const response = event.data;
|
|
25086
|
-
if (!binding || !response || response.tag !== tag || response.broadcast !== true || !["CONTRACT_EVENT", "VTXO_UPDATE", "UTXO_UPDATE"].includes(response.type) || response.walletRequestBinding?.scope !== binding.scope || response.walletRequestBinding?.network !== binding.network) {
|
|
25635
|
+
if (this.disposed || !binding || !response || response.tag !== tag || response.broadcast !== true || !["CONTRACT_EVENT", "VTXO_UPDATE", "UTXO_UPDATE"].includes(response.type) || response.walletRequestBinding?.scope !== binding.scope || response.walletRequestBinding?.network !== binding.network) {
|
|
25087
25636
|
return;
|
|
25088
25637
|
}
|
|
25089
25638
|
callback(response);
|
|
@@ -28925,7 +29474,9 @@ var Arkade = class _Arkade {
|
|
|
28925
29474
|
* the program's literal type, so `functions` is strongly typed.
|
|
28926
29475
|
*
|
|
28927
29476
|
* Declared `server`/`user` params default to the client's keys. Compiler
|
|
28928
|
-
* artifacts reserve the operator key and exit delay to the connected operator
|
|
29477
|
+
* artifacts reserve the operator key and exit delay to the connected operator,
|
|
29478
|
+
* and the witness program of each contract they instantiate to the derived one
|
|
29479
|
+
* (see {@link ArkadeContract}'s constructor).
|
|
28929
29480
|
* Struct and array params are passed whole by name (see {@link ArkadeNestedValue}).
|
|
28930
29481
|
*/
|
|
28931
29482
|
contract(program, args = {}) {
|
|
@@ -28937,18 +29488,7 @@ var Arkade = class _Arkade {
|
|
|
28937
29488
|
args = { ...args, user: this.userKey };
|
|
28938
29489
|
}
|
|
28939
29490
|
if (declared.includes("SERVER_EXIT_DELAY")) {
|
|
28940
|
-
const
|
|
28941
|
-
if (delay === void 0 || delay <= 0n)
|
|
28942
|
-
throw new Error(
|
|
28943
|
-
"compiler artifact: server must provide a positive unilateral exit delay"
|
|
28944
|
-
);
|
|
28945
|
-
const typed = toTimelock(delay);
|
|
28946
|
-
if (typed.type === "seconds" && delay % 512n !== 0n) {
|
|
28947
|
-
throw new Error(
|
|
28948
|
-
`compiler artifact: server exit delay ${delay}s must be a multiple of 512 seconds`
|
|
28949
|
-
);
|
|
28950
|
-
}
|
|
28951
|
-
const sequence = BigInt(timelockToSequence(typed));
|
|
29491
|
+
const sequence = exitDelaySequence(this.serverExitDelay);
|
|
28952
29492
|
if (args.SERVER_EXIT_DELAY !== void 0 && args.SERVER_EXIT_DELAY !== sequence && args.SERVER_EXIT_DELAY !== Number(sequence)) {
|
|
28953
29493
|
throw new Error(
|
|
28954
29494
|
"compiler artifact: reserved SERVER_EXIT_DELAY must match the connected server"
|
|
@@ -28967,6 +29507,11 @@ var Arkade = class _Arkade {
|
|
|
28967
29507
|
}
|
|
28968
29508
|
};
|
|
28969
29509
|
var ArkadeContract = class _ArkadeContract {
|
|
29510
|
+
/**
|
|
29511
|
+
* Compile `program` with `args` against `keys` (the client's by default). Each contract a
|
|
29512
|
+
* compiler artifact instantiates is bound to its witness program, derived with `keys` and the
|
|
29513
|
+
* client's exit delay; a value passed for it by hand must match.
|
|
29514
|
+
*/
|
|
28970
29515
|
constructor(client, program, args = {}, keys) {
|
|
28971
29516
|
this.client = client;
|
|
28972
29517
|
this.program = program;
|
|
@@ -28977,6 +29522,7 @@ var ArkadeContract = class _ArkadeContract {
|
|
|
28977
29522
|
userKey: client.userKey,
|
|
28978
29523
|
emulatorKey: client.emulatorKey
|
|
28979
29524
|
};
|
|
29525
|
+
instantiate(program, this.args, this.keys, client.serverExitDelay);
|
|
28980
29526
|
this.vtxoScript = new ArkadeProgramScript(program, this.args, this.keys);
|
|
28981
29527
|
this.tapTree = this.vtxoScript.encode();
|
|
28982
29528
|
this.compiled = this.vtxoScript.compiled;
|
|
@@ -29597,6 +30143,47 @@ function unspendable(coin, now) {
|
|
|
29597
30143
|
function witnessBytes({ contract, args }, segment, ref) {
|
|
29598
30144
|
return witnessRefToBytes(ref, args[segment], contract.args);
|
|
29599
30145
|
}
|
|
30146
|
+
function exitDelaySequence(delay) {
|
|
30147
|
+
if (delay === void 0 || delay <= 0n)
|
|
30148
|
+
throw new Error("compiler artifact: server must provide a positive unilateral exit delay");
|
|
30149
|
+
const typed = toTimelock(delay);
|
|
30150
|
+
if (typed.type === "seconds" && delay % 512n !== 0n) {
|
|
30151
|
+
throw new Error(
|
|
30152
|
+
`compiler artifact: server exit delay ${delay}s must be a multiple of 512 seconds`
|
|
30153
|
+
);
|
|
30154
|
+
}
|
|
30155
|
+
return BigInt(timelockToSequence(typed));
|
|
30156
|
+
}
|
|
30157
|
+
function instantiate(program, args, keys, exitDelay) {
|
|
30158
|
+
const defs = new Map((program.params ?? []).map((def) => [def.name, def]));
|
|
30159
|
+
for (const [param, child] of Object.entries(instantiatedContracts(program))) {
|
|
30160
|
+
const childArgs = { server: keys.serverKey };
|
|
30161
|
+
for (const [name, from] of Object.entries(child.args)) {
|
|
30162
|
+
if (typeof from !== "string") {
|
|
30163
|
+
childArgs[name] = from;
|
|
30164
|
+
continue;
|
|
30165
|
+
}
|
|
30166
|
+
const value = Object.hasOwn(args, from) ? args[from] : void 0;
|
|
30167
|
+
if (value === void 0) {
|
|
30168
|
+
throw new Error(`program parameter '${from}' is declared but not bound in args`);
|
|
30169
|
+
}
|
|
30170
|
+
validateParamValue(defs.get(from), value);
|
|
30171
|
+
childArgs[name] = value;
|
|
30172
|
+
}
|
|
30173
|
+
if (child.program.params?.some((p) => p.name === "SERVER_EXIT_DELAY")) {
|
|
30174
|
+
childArgs.SERVER_EXIT_DELAY = exitDelaySequence(exitDelay);
|
|
30175
|
+
}
|
|
30176
|
+
instantiate(child.program, childArgs, keys, exitDelay);
|
|
30177
|
+
const key = new ArkadeProgramScript(child.program, childArgs, keys).tweakedPublicKey;
|
|
30178
|
+
const passed = args[param];
|
|
30179
|
+
if (passed !== void 0 && !(passed instanceof Uint8Array && equalBytes(passed, key))) {
|
|
30180
|
+
throw new Error(
|
|
30181
|
+
`compiler artifact: '${param}' must be the ${child.program.name} witness program derived from its arguments`
|
|
30182
|
+
);
|
|
30183
|
+
}
|
|
30184
|
+
args[param] = key;
|
|
30185
|
+
}
|
|
30186
|
+
}
|
|
29600
30187
|
function flattenValue(name, value, out, ancestors = /* @__PURE__ */ new Set()) {
|
|
29601
30188
|
if (typeof value !== "object" || value === null || ArrayBuffer.isView(value)) {
|
|
29602
30189
|
if (Object.hasOwn(out, name)) throw new Error(`duplicate argument '${name}'`);
|
|
@@ -30150,5 +30737,5 @@ function createDefaultPaymentRouter(wallet) {
|
|
|
30150
30737
|
*/
|
|
30151
30738
|
|
|
30152
30739
|
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, Arkade, ArkadeCash, ArkadeCashCreateError, ArkadeCashOperatorMismatchError, AssetManager, BATCH_REGISTRATION_TERMINAL_STATES, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, CachingOperatorProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_PASSKEY_LABEL, DELEGATION_EXPIRES_KEY, DELEGATION_LOCAL_STATUS, DELEGATION_REGISTERED_KEY, DELEGATION_STATUS_KEY, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, ExecutorManagerImpl, ExecutorRequestError, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryBatchRegistrationRepository, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBBatchRegistrationRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBVtxoReservationRepository, IndexedDBWalletRepository, KeyringDescriptorProvider, MAX_PAGE_SIZE, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainCosignPreflightError, OnchainWallet, OversizedChangeError, P2A, PasskeyCancelled, PasskeyUnconfirmed, PaymentRouter, PrevTxUnavailableError, PrfUnavailable, REGTEST_MIN_BATCH_EXPIRY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestEmulatorProvider, RestExecutorProvider, SeedIdentity, SendDeadlineExceededError, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, StaticDescriptorProvider, TreeSignerSession, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, VtxoReservedError, Wallet2 as Wallet, WalletCannotAllocateAddressError, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WsElectrumChainSource, addArkadeCashRecord, adoptContractDescriptor, applyWalletStateUpdate, arkAssetRail, arkRail, arkTarget, arkadeCashId, arkadeCashResolver, arkade_exports, assertFinalCommitmentMatchesValidated, assertHistoryPageFilter, assertIntentIdUnique, assertNoAssets, assertNoSelection, assertPageRequest, assertRecipientArkadeAddress, assertSendDeadline, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, captureSendDeadline, checkSaveVtxosForScript, claimWithPreimageIdentity, classifyBoardingExpiry, closeDatabase, collabExitResolver, collectBatchRegistrations, collectContracts, collectIntents, collectPages, collectScriptVtxos, collectTransactionHistory, collectUtxos, collectVtxos, combineTapscriptSigs, compareHistoryCursors, contractFilterMatchesNothing, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createArkadeCashTracker, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, createPrfPasskey, createdAtToIso, decodeArkContract, decodeBoardingExit, defaultBatchExpiryPolicy, deleteByIndex, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, evaluatePrf, exitObserverFor, extendVirtualCoinForContract, extractOperatorProviderUrl, gateExclusion, gatedContracts, getAllByIndexValues, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCosignFallback, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalBatchRegistrationState, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, iteratePages, legacyVtxoFacts, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeArkadeCashRecord, mergeChainedTxType, mnemonicFromPrf, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, pageResult, prfSupport, promisifyRequest, provisionClaimSecret, provisionRefundKey, readArkadeCash, registerWalletRestoreHook, resolveAssetAmount, resolveBatchExpiryPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, saveVtxosForContract, scopeOf, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, selectionOf, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signingDescriptorIndex, strictSigningDescriptorIndex, submitViaEmulator, tryResolveSendAmount, utxoEntries, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, warnAndFilterVtxosForScript, watchExecutorContracts, withPrevTxs };
|
|
30153
|
-
//# sourceMappingURL=chunk-
|
|
30154
|
-
//# sourceMappingURL=chunk-
|
|
30740
|
+
//# sourceMappingURL=chunk-ZECZ2MKX.js.map
|
|
30741
|
+
//# sourceMappingURL=chunk-ZECZ2MKX.js.map
|