@arkade-os/sdk 0.4.48 → 0.4.49
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/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{ark-CjE0KkGp.d.cts → ark-nkSiPYNf.d.cts} +86 -24
- package/dist/{ark-CjE0KkGp.d.ts → ark-nkSiPYNf.d.ts} +86 -24
- package/dist/{asyncStorageTaskQueue-D9SOPMPC.d.ts → asyncStorageTaskQueue-DCaEE83p.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-CeLZhZFU.d.cts → asyncStorageTaskQueue-DdxhsEz6.d.cts} +1 -1
- package/dist/{chunk-ENZ4YPR2.cjs → chunk-2LAJ3RTH.cjs} +491 -418
- package/dist/chunk-2LAJ3RTH.cjs.map +1 -0
- package/dist/{chunk-NYR5H6GR.js → chunk-5QVBJUOG.js} +154 -81
- package/dist/chunk-5QVBJUOG.js.map +1 -0
- package/dist/{chunk-SYDANBJI.cjs → chunk-6UI5BFE7.cjs} +9 -9
- package/dist/{chunk-SYDANBJI.cjs.map → chunk-6UI5BFE7.cjs.map} +1 -1
- package/dist/{chunk-G6J6AEMH.js → chunk-BLJQV3N4.js} +4 -4
- package/dist/{chunk-G6J6AEMH.js.map → chunk-BLJQV3N4.js.map} +1 -1
- package/dist/{chunk-BHHLRZCS.js → chunk-CPO2UB7L.js} +4 -4
- package/dist/{chunk-BHHLRZCS.js.map → chunk-CPO2UB7L.js.map} +1 -1
- package/dist/{chunk-7TXSPRN5.cjs → chunk-E7HB3GKK.cjs} +31 -2
- package/dist/chunk-E7HB3GKK.cjs.map +1 -0
- package/dist/{chunk-ZDDBTFVO.js → chunk-EFNLTS6Q.js} +29 -3
- package/dist/chunk-EFNLTS6Q.js.map +1 -0
- package/dist/{chunk-XFMGIFBL.js → chunk-HN25T276.js} +4 -4
- package/dist/{chunk-XFMGIFBL.js.map → chunk-HN25T276.js.map} +1 -1
- package/dist/{chunk-5XMVTK5S.cjs → chunk-LJQ2VQBE.cjs} +211 -230
- package/dist/chunk-LJQ2VQBE.cjs.map +1 -0
- package/dist/{chunk-4VVTRPH3.js → chunk-MBSYQ3WX.js} +183 -201
- package/dist/chunk-MBSYQ3WX.js.map +1 -0
- package/dist/{chunk-EB3ALGTM.cjs → chunk-QDXQULVM.cjs} +13 -13
- package/dist/{chunk-EB3ALGTM.cjs.map → chunk-QDXQULVM.cjs.map} +1 -1
- package/dist/{chunk-ENDNQPZA.cjs → chunk-XOLH3LFO.cjs} +17 -17
- package/dist/{chunk-ENDNQPZA.cjs.map → chunk-XOLH3LFO.cjs.map} +1 -1
- package/dist/contracts/handlers/index.cjs +8 -8
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-D3dY-2vS.d.cts → delegate-Cqqw1T1J.d.cts} +1 -1
- package/dist/{delegate-DhGZk1r2.d.ts → delegate-D6Orvyq7.d.ts} +1 -1
- package/dist/{index-DK4_iWYy.d.ts → index-CWoogah0.d.ts} +2 -2
- package/dist/{index-D6RQROds.d.cts → index-Yd4hecbM.d.cts} +2 -2
- package/dist/index.cjs +181 -181
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-Brnak0Rc.d.cts → taskRunner-BjB5QINR.d.cts} +1 -1
- package/dist/{taskRunner-B-2MHCYG.d.ts → taskRunner-Dw7xs60Q.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +5 -5
- package/dist/{wallet-B5bwixQa.d.ts → wallet-CGkWu3xV.d.cts} +2 -2
- package/dist/{wallet-DiOrtYic.d.cts → wallet-DyUHrPyN.d.ts} +2 -2
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-4VVTRPH3.js.map +0 -1
- package/dist/chunk-5XMVTK5S.cjs.map +0 -1
- package/dist/chunk-7TXSPRN5.cjs.map +0 -1
- package/dist/chunk-ENZ4YPR2.cjs.map +0 -1
- package/dist/chunk-NYR5H6GR.js.map +0 -1
- package/dist/chunk-ZDDBTFVO.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Transaction, setArkPsbtField, PrevArkTxField, ConditionWitness, AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, craftToSpendTx, getArkPsbtFields, CosignerPublicKey, BufferReader, BufferWriter, OP_RETURN_EMPTY_PKSCRIPT, VtxoTaprootTree, baseFetch, Intent, rateGate, maybeArkError, isArkError, ArkErrorName, ProviderUnavailableError, FetchError, isFetchTimeoutError, AssetRef, isEventSourceError, RestArkProvider, RestIndexerProvider, ArkError } from './chunk-
|
|
2
|
-
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, DefaultVtxo,
|
|
3
|
-
import { VtxoScript, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, hasTerminalSpend, getNormalizedVtxos, isVirtualCoin, ArkAddress, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, timelockToSequence, DEFAULT_NETWORK_NAME, normalizeVtxo, getSequence, toBatchExpiry, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, canSpendOffchain, toVirtualStatus, resolveTimeHeight, parseLegacyExpiry, networks as networks$1, isExpired, DEFAULT_ARKADE_SERVER_URL, isPastExpiry } from './chunk-
|
|
1
|
+
import { Transaction, setArkPsbtField, PrevArkTxField, ConditionWitness, AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, craftToSpendTx, getArkPsbtFields, CosignerPublicKey, BufferReader, BufferWriter, OP_RETURN_EMPTY_PKSCRIPT, VtxoTaprootTree, baseFetch, Intent, rateGate, maybeArkError, isArkError, ArkErrorName, ProviderUnavailableError, FetchError, isFetchTimeoutError, AssetRef, isEventSourceError, RestArkProvider, RestIndexerProvider, ArkError } from './chunk-CPO2UB7L.js';
|
|
2
|
+
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, DefaultVtxo, DelegateVtxo, WALLET_RECEIVE_SOURCE, deriveDescriptorLeafPubKey, BoardingContractHandler } from './chunk-MBSYQ3WX.js';
|
|
3
|
+
import { VtxoScript, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, hasTerminalSpend, getNormalizedVtxos, isVirtualCoin, ArkAddress, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, timelockToSequence, DEFAULT_NETWORK_NAME, normalizeVtxo, getSequence, toBatchExpiry, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, canSpendOffchain, toVirtualStatus, resolveTimeHeight, parseLegacyExpiry, networks as networks$1, isExpired, DEFAULT_ARKADE_SERVER_URL, isPastExpiry } from './chunk-EFNLTS6Q.js';
|
|
4
4
|
import { __export } from './chunk-NSBPE2FW.js';
|
|
5
5
|
import { sha256, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
|
|
6
6
|
import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
|
|
@@ -8096,6 +8096,9 @@ var ContractWatcher = class {
|
|
|
8096
8096
|
reconnectAttempts = 0;
|
|
8097
8097
|
reconnectTimeoutId;
|
|
8098
8098
|
failsafePollIntervalId;
|
|
8099
|
+
/** See {@link withCoalescedSubscription}. */
|
|
8100
|
+
subscriptionBatchDepth = 0;
|
|
8101
|
+
subscriptionUpdateDeferred = false;
|
|
8099
8102
|
/**
|
|
8100
8103
|
* Create a contract watcher with the given providers and polling settings.
|
|
8101
8104
|
*
|
|
@@ -8405,7 +8408,40 @@ var ContractWatcher = class {
|
|
|
8405
8408
|
console.error("ContractWatcher poll failed:", error);
|
|
8406
8409
|
}
|
|
8407
8410
|
}
|
|
8411
|
+
/**
|
|
8412
|
+
* Run `fn` with subscription updates coalesced into a single
|
|
8413
|
+
* `subscribeForScripts` on the way out.
|
|
8414
|
+
*
|
|
8415
|
+
* {@link addContract} re-subscribes eagerly (the watcher may already be
|
|
8416
|
+
* running), and every subscribe posts the *whole* accumulated script list —
|
|
8417
|
+
* so a restore scan that discovers N contracts sends N growing POSTs,
|
|
8418
|
+
* quadratic in script-slots. Inside this scope those updates are only
|
|
8419
|
+
* marked dirty, flushed once on the way out (success and error path alike).
|
|
8420
|
+
*
|
|
8421
|
+
* A contract added inside the scope is therefore not streaming until the
|
|
8422
|
+
* flush. Nothing in the watcher closes that window — the failsafe poll
|
|
8423
|
+
* replays repository state and cannot see VTXOs no one has fetched yet. The
|
|
8424
|
+
* one caller, `scanContracts`, is covered because `Wallet.restore` follows
|
|
8425
|
+
* it with a bulk `refreshVtxos`. A new caller must provide its own
|
|
8426
|
+
* equivalent catch-up, or keep the scope short enough not to need one.
|
|
8427
|
+
*/
|
|
8428
|
+
async withCoalescedSubscription(fn) {
|
|
8429
|
+
this.subscriptionBatchDepth++;
|
|
8430
|
+
try {
|
|
8431
|
+
return await fn();
|
|
8432
|
+
} finally {
|
|
8433
|
+
this.subscriptionBatchDepth--;
|
|
8434
|
+
if (this.subscriptionBatchDepth === 0 && this.subscriptionUpdateDeferred) {
|
|
8435
|
+
this.subscriptionUpdateDeferred = false;
|
|
8436
|
+
if (this.isWatching) await this.tryUpdateSubscription();
|
|
8437
|
+
}
|
|
8438
|
+
}
|
|
8439
|
+
}
|
|
8408
8440
|
async tryUpdateSubscription() {
|
|
8441
|
+
if (this.subscriptionBatchDepth > 0) {
|
|
8442
|
+
this.subscriptionUpdateDeferred = true;
|
|
8443
|
+
return;
|
|
8444
|
+
}
|
|
8409
8445
|
const hadSubscription = this.subscriptionId !== void 0;
|
|
8410
8446
|
try {
|
|
8411
8447
|
await this.updateSubscription();
|
|
@@ -8886,21 +8922,27 @@ var ContractManager = class _ContractManager {
|
|
|
8886
8922
|
* Safety-critical invariants (spec §2.C / §4):
|
|
8887
8923
|
* - `opts.materialize(i)` throwing is structural/fatal: it is NOT
|
|
8888
8924
|
* wrapped — it propagates and aborts the scan.
|
|
8889
|
-
* - A
|
|
8890
|
-
*
|
|
8891
|
-
*
|
|
8925
|
+
* - A discovery rejection is collected into `handlerErrors` and makes its
|
|
8926
|
+
* index *indeterminate*: it does NOT advance the gap counter, and the
|
|
8927
|
+
* scan stops verifying there, reporting `truncatedAt`. Only an index
|
|
8892
8928
|
* every handler answered for can be a confirmed miss.
|
|
8893
8929
|
* - `persistAndWatchContract` rejecting is operational/fatal and
|
|
8894
|
-
* propagates (only
|
|
8895
|
-
* -
|
|
8896
|
-
*
|
|
8897
|
-
*
|
|
8898
|
-
*
|
|
8899
|
-
*
|
|
8930
|
+
* propagates (only the handler calls are guarded).
|
|
8931
|
+
* - A handler exposing {@link Discoverable.discoverRange} is asked for the
|
|
8932
|
+
* whole window in ONE call instead of one per index — the batching that
|
|
8933
|
+
* keeps a large restore from bursting into an operator's rate limiter.
|
|
8934
|
+
* Its failures are therefore range-wide: every index in the window goes
|
|
8935
|
+
* indeterminate and truncation lands on the window's first index. Its
|
|
8936
|
+
* answer must cover every requested index; an incomplete map is treated
|
|
8937
|
+
* as a rejection (see `Discoverable.discoverRange`).
|
|
8938
|
+
* - Handlers are probed concurrently (independent network reads); their
|
|
8939
|
+
* hits are persisted sequentially in `discoverables` order to preserve
|
|
8940
|
+
* the first-wins collision tie-break.
|
|
8941
|
+
* - Indices are probed `batchSize` at a time, but each window is CAPPED to
|
|
8900
8942
|
* `gapLimit - unused` indices — the most a serial scan could still reach
|
|
8901
8943
|
* before the gap window is guaranteed to close. So every index probed in
|
|
8902
8944
|
* a window is one a one-index-at-a-time scan would also reach: nothing is
|
|
8903
|
-
* over-scanned, nothing is discarded, and `materialize
|
|
8945
|
+
* over-scanned, nothing is discarded, and `materialize`/discovery are
|
|
8904
8946
|
* invoked on exactly the same index set. The window's hits are still
|
|
8905
8947
|
* processed strictly in ascending index order, so the discovered set,
|
|
8906
8948
|
* persisted rows, `highestConfirmedUsedIndex`, and `handlerErrors` are
|
|
@@ -8909,8 +8951,14 @@ var ContractManager = class _ContractManager {
|
|
|
8909
8951
|
* can surface hits above the failed index that a serial scan would never
|
|
8910
8952
|
* have reached, so a truncated batched scan discovers a superset — never
|
|
8911
8953
|
* a subset — of the serial one.
|
|
8954
|
+
* - The whole scan runs inside one coalesced subscription scope, so N
|
|
8955
|
+
* discovered contracts cost ONE `subscribeForScripts` instead of N
|
|
8956
|
+
* growing ones (see {@link ContractWatcher.withCoalescedSubscription}).
|
|
8912
8957
|
*/
|
|
8913
|
-
|
|
8958
|
+
scanContracts(opts) {
|
|
8959
|
+
return this.watcher.withCoalescedSubscription(() => this.runScan(opts));
|
|
8960
|
+
}
|
|
8961
|
+
async runScan(opts) {
|
|
8914
8962
|
const gapLimit = opts.gapLimit ?? 20;
|
|
8915
8963
|
if (!Number.isInteger(gapLimit) || gapLimit <= 0) {
|
|
8916
8964
|
throw new Error(
|
|
@@ -8934,43 +8982,80 @@ var ContractManager = class _ContractManager {
|
|
|
8934
8982
|
let truncatedAt;
|
|
8935
8983
|
let unused = 0;
|
|
8936
8984
|
let i = 0;
|
|
8937
|
-
const
|
|
8938
|
-
const
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
}
|
|
8949
|
-
|
|
8950
|
-
|
|
8985
|
+
const probeHandler = async (h, entries) => {
|
|
8986
|
+
const probe = {
|
|
8987
|
+
found: /* @__PURE__ */ new Map(),
|
|
8988
|
+
indeterminate: /* @__PURE__ */ new Set(),
|
|
8989
|
+
// Keyed by the index the failure is ANCHORED at, so errors stay
|
|
8990
|
+
// reported in ascending-index order below, exactly as the
|
|
8991
|
+
// per-index path reports them.
|
|
8992
|
+
errors: /* @__PURE__ */ new Map()
|
|
8993
|
+
};
|
|
8994
|
+
if (!h.discoverRange) {
|
|
8995
|
+
await Promise.all(
|
|
8996
|
+
entries.map(async ({ index, descriptor }) => {
|
|
8997
|
+
try {
|
|
8998
|
+
probe.found.set(
|
|
8999
|
+
index,
|
|
9000
|
+
await h.discoverAt(index, descriptor, opts.deps)
|
|
9001
|
+
);
|
|
9002
|
+
} catch (error) {
|
|
9003
|
+
probe.indeterminate.add(index);
|
|
9004
|
+
probe.errors.set(index, { handler: h.type, index, error });
|
|
9005
|
+
}
|
|
9006
|
+
})
|
|
9007
|
+
);
|
|
9008
|
+
return probe;
|
|
9009
|
+
}
|
|
9010
|
+
const from = entries[0].index;
|
|
9011
|
+
const to = entries[entries.length - 1].index;
|
|
9012
|
+
const failRange = (error) => {
|
|
9013
|
+
for (const e of entries) probe.indeterminate.add(e.index);
|
|
9014
|
+
probe.errors.set(from, {
|
|
9015
|
+
handler: h.type,
|
|
9016
|
+
index: from,
|
|
9017
|
+
...to > from && { toIndex: to },
|
|
9018
|
+
error
|
|
9019
|
+
});
|
|
9020
|
+
};
|
|
9021
|
+
let ranged;
|
|
9022
|
+
try {
|
|
9023
|
+
ranged = await h.discoverRange(entries, opts.deps);
|
|
9024
|
+
} catch (error) {
|
|
9025
|
+
failRange(error);
|
|
9026
|
+
return probe;
|
|
9027
|
+
}
|
|
9028
|
+
for (const e of entries) {
|
|
9029
|
+
const found = ranged.get(e.index);
|
|
9030
|
+
if (found) probe.found.set(e.index, found);
|
|
9031
|
+
}
|
|
9032
|
+
const missing = entries.find((e) => !ranged.has(e.index));
|
|
9033
|
+
if (missing) {
|
|
9034
|
+
failRange(
|
|
9035
|
+
new Error(
|
|
9036
|
+
`${h.type}.discoverRange resolved without index ${missing.index} of the requested range [${from}..${to}]`
|
|
9037
|
+
)
|
|
9038
|
+
);
|
|
9039
|
+
}
|
|
9040
|
+
return probe;
|
|
8951
9041
|
};
|
|
8952
9042
|
while (i <= maxIdx && unused < gapLimit) {
|
|
8953
9043
|
const windowEnd = Math.min(maxIdx, i + Math.min(batchSize, gapLimit - unused) - 1);
|
|
8954
|
-
const
|
|
8955
|
-
for (let idx = i; idx <= windowEnd; idx++)
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
9044
|
+
const entries = [];
|
|
9045
|
+
for (let idx = i; idx <= windowEnd; idx++) {
|
|
9046
|
+
entries.push({ index: idx, descriptor: opts.materialize(idx) });
|
|
9047
|
+
}
|
|
9048
|
+
const windowProbes = await Promise.all(
|
|
9049
|
+
discoverables.map((h) => probeHandler(h, entries))
|
|
9050
|
+
);
|
|
9051
|
+
for (const { index } of entries) {
|
|
8960
9052
|
let hitAtThisIndex = false;
|
|
8961
9053
|
let indeterminate = false;
|
|
8962
|
-
for (
|
|
8963
|
-
const
|
|
8964
|
-
if (
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
index,
|
|
8968
|
-
error: probe.error
|
|
8969
|
-
});
|
|
8970
|
-
indeterminate = true;
|
|
8971
|
-
continue;
|
|
8972
|
-
}
|
|
8973
|
-
for (const c of probe.found) {
|
|
9054
|
+
for (const probe of windowProbes) {
|
|
9055
|
+
const error = probe.errors.get(index);
|
|
9056
|
+
if (error) handlerErrors.push(error);
|
|
9057
|
+
if (probe.indeterminate.has(index)) indeterminate = true;
|
|
9058
|
+
for (const c of probe.found.get(index) ?? []) {
|
|
8974
9059
|
await this.persistAndWatchContract(c);
|
|
8975
9060
|
hitAtThisIndex = true;
|
|
8976
9061
|
}
|
|
@@ -9337,12 +9422,12 @@ var ContractManager = class _ContractManager {
|
|
|
9337
9422
|
* window (e.g. a spend that hasn't settled yet).
|
|
9338
9423
|
*/
|
|
9339
9424
|
async reconcilePendingFrontier(contracts) {
|
|
9340
|
-
const scripts = contracts.map((c) => c.script);
|
|
9341
9425
|
const scriptToContract = new Map(contracts.map((c) => [c.script, c]));
|
|
9342
|
-
const
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9426
|
+
const vtxos = await getAllNormalizedVtxos(
|
|
9427
|
+
this.config.indexerProvider,
|
|
9428
|
+
contracts.map((c) => c.script),
|
|
9429
|
+
{ pendingOnly: true }
|
|
9430
|
+
);
|
|
9346
9431
|
const owned = vtxos.filter((v) => scriptToContract.has(v.script));
|
|
9347
9432
|
const annotated = await this.annotateVtxos(owned);
|
|
9348
9433
|
const byContract = /* @__PURE__ */ new Map();
|
|
@@ -9418,7 +9503,6 @@ var ContractManager = class _ContractManager {
|
|
|
9418
9503
|
const result = new Map(
|
|
9419
9504
|
contracts.map((c) => [c.script, []])
|
|
9420
9505
|
);
|
|
9421
|
-
const scripts = contracts.map((c) => c.script);
|
|
9422
9506
|
const windowOpts = syncWindow ? {
|
|
9423
9507
|
...syncWindow.after !== void 0 && {
|
|
9424
9508
|
after: syncWindow.after
|
|
@@ -9427,26 +9511,18 @@ var ContractManager = class _ContractManager {
|
|
|
9427
9511
|
before: syncWindow.before
|
|
9428
9512
|
}
|
|
9429
9513
|
} : {};
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9514
|
+
const vtxos = await getAllNormalizedVtxos(
|
|
9515
|
+
this.config.indexerProvider,
|
|
9516
|
+
contracts.map((c) => c.script),
|
|
9517
|
+
{ ...windowOpts, pageSize }
|
|
9518
|
+
);
|
|
9519
|
+
const owned = vtxos.filter((v) => scriptToContract.has(v.script));
|
|
9520
|
+
const annotated = await this.annotateVtxos(owned);
|
|
9521
|
+
for (const vtxo of annotated) {
|
|
9522
|
+
result.get(vtxo.script).push({
|
|
9523
|
+
...vtxo,
|
|
9524
|
+
contractScript: vtxo.script
|
|
9438
9525
|
});
|
|
9439
|
-
const owned = vtxos.filter((v) => scriptToContract.has(v.script));
|
|
9440
|
-
const annotated = await this.annotateVtxos(owned);
|
|
9441
|
-
for (const vtxo of annotated) {
|
|
9442
|
-
result.get(vtxo.script).push({
|
|
9443
|
-
...vtxo,
|
|
9444
|
-
contractScript: vtxo.script
|
|
9445
|
-
});
|
|
9446
|
-
}
|
|
9447
|
-
hasMore = page ? vtxos.length === pageSize : false;
|
|
9448
|
-
pageIndex++;
|
|
9449
|
-
if (hasMore) await new Promise((r) => setTimeout(r, 500));
|
|
9450
9526
|
}
|
|
9451
9527
|
return result;
|
|
9452
9528
|
}
|
|
@@ -11142,9 +11218,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11142
11218
|
/** Fetch Arkade transaction ids that are still pending final settlement. */
|
|
11143
11219
|
async fetchPendingTxs() {
|
|
11144
11220
|
const scripts = await this.getWalletScripts();
|
|
11145
|
-
|
|
11146
|
-
scripts
|
|
11147
|
-
});
|
|
11221
|
+
const vtxos = await getAllNormalizedVtxos(this.indexerProvider, scripts);
|
|
11148
11222
|
return vtxos.filter(
|
|
11149
11223
|
(vtxo) => (vtxo.isSpent || vtxo.isPreconfirmed && !vtxo.isSwept) && vtxo.arkTxId !== void 0
|
|
11150
11224
|
).map((_) => _.arkTxId);
|
|
@@ -11820,7 +11894,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11820
11894
|
if (hd && result.highestConfirmedUsedIndex >= 0) {
|
|
11821
11895
|
await provider.advanceLastIndexUsed(result.highestConfirmedUsedIndex);
|
|
11822
11896
|
}
|
|
11823
|
-
await manager.refreshVtxos({ includeInactive: true });
|
|
11897
|
+
await manager.refreshVtxos({ includeInactive: true, after: 0 });
|
|
11824
11898
|
const causes = result.handlerErrors.map(
|
|
11825
11899
|
(e) => e.error instanceof Error ? e.error : new Error(String(e.error))
|
|
11826
11900
|
);
|
|
@@ -12728,10 +12802,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12728
12802
|
if (!vtxos || vtxos.length === 0) {
|
|
12729
12803
|
const scriptMap = await this.getScriptMap();
|
|
12730
12804
|
const allExtended = [];
|
|
12731
|
-
const
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
});
|
|
12805
|
+
const fetchedVtxos = await getAllNormalizedVtxos(this.indexerProvider, [
|
|
12806
|
+
...scriptMap.keys()
|
|
12807
|
+
]);
|
|
12735
12808
|
for (const vtxo of fetchedVtxos) {
|
|
12736
12809
|
const vtxoScript = scriptMap.get(vtxo.script);
|
|
12737
12810
|
if (!vtxoScript) continue;
|
|
@@ -19814,5 +19887,5 @@ function isArkContract(str) {
|
|
|
19814
19887
|
}
|
|
19815
19888
|
|
|
19816
19889
|
export { ARKADE_MAGIC, ActivityRegistry, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, arkade_exports, assertIntentIdUnique, boardingResolver, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, createDefaultActivityRegistry, createExitChainResolver, decodeArkContract, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, intentMatchesFilter, intentPageBounds, isArkContract, isBatchSignable, isCooperativelyMigratable, isDiscoverable, isRetryableProviderError, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, mergeChainedTxType, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
|
|
19817
|
-
//# sourceMappingURL=chunk-
|
|
19818
|
-
//# sourceMappingURL=chunk-
|
|
19890
|
+
//# sourceMappingURL=chunk-5QVBJUOG.js.map
|
|
19891
|
+
//# sourceMappingURL=chunk-5QVBJUOG.js.map
|