@arkade-os/sdk 0.4.29 → 0.4.31
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.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/indexedDB.cjs +2 -2
- package/dist/adapters/indexedDB.js +1 -1
- package/dist/{ark-ChhTwpLf.d.cts → ark-ibLW4Hte.d.cts} +20 -3
- package/dist/{ark-ChhTwpLf.d.ts → ark-ibLW4Hte.d.ts} +20 -3
- package/dist/{asyncStorageTaskQueue-DZ0nUuEJ.d.ts → asyncStorageTaskQueue-BEOFPNc0.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-DW1-BpI7.d.cts → asyncStorageTaskQueue-VGHXWR9F.d.cts} +1 -1
- package/dist/{chunk-TH6T23XG.js → chunk-AXGVYRAL.js} +3 -3
- package/dist/{chunk-TH6T23XG.js.map → chunk-AXGVYRAL.js.map} +1 -1
- package/dist/{chunk-GDCTOSMV.cjs → chunk-GPZH5QNA.cjs} +63 -12
- package/dist/chunk-GPZH5QNA.cjs.map +1 -0
- package/dist/{chunk-BVP2U66Q.js → chunk-HJM6JPG4.js} +63 -12
- package/dist/chunk-HJM6JPG4.js.map +1 -0
- package/dist/{chunk-PJUFOJ2L.cjs → chunk-RN2OFLC3.cjs} +7 -7
- package/dist/{chunk-PJUFOJ2L.cjs.map → chunk-RN2OFLC3.cjs.map} +1 -1
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/{delegate-DN7RELL1.d.ts → delegate-BXaR1RNG.d.ts} +1 -1
- package/dist/{delegate-4JBUkUhR.d.cts → delegate-BvNTw44a.d.cts} +1 -1
- package/dist/{index-Cn82bBUu.d.ts → index-BusKawmy.d.ts} +2 -2
- package/dist/{index-DfT5xzgY.d.cts → index-C-5Tw7VA.d.cts} +2 -2
- package/dist/index.cjs +86 -86
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1 -1
- package/dist/repositories/realm/index.cjs +10 -10
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +1 -1
- package/dist/repositories/sqlite/index.cjs +10 -10
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.js +1 -1
- package/dist/{taskRunner-B-vG08pX.d.ts → taskRunner-B1igKGAo.d.ts} +1 -1
- package/dist/{taskRunner-B-aPfHhK.d.cts → taskRunner-By92TQ1m.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +8 -8
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +2 -2
- package/dist/wallet/expo/index.cjs +9 -9
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +2 -2
- package/dist/{wallet-DjgFb_4T.d.cts → wallet-B_rxgQTu.d.cts} +2 -2
- package/dist/{wallet-CCtqT2Wb.d.ts → wallet-CyM4F7Bs.d.ts} +2 -2
- package/dist/worker/expo/index.cjs +6 -6
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-BVP2U66Q.js.map +0 -1
- package/dist/chunk-GDCTOSMV.cjs.map +0 -1
|
@@ -2256,27 +2256,57 @@ function extendCoin(wallet, utxo) {
|
|
|
2256
2256
|
tapTree: wallet.boardingTapscript.encode()
|
|
2257
2257
|
};
|
|
2258
2258
|
}
|
|
2259
|
-
function
|
|
2259
|
+
function deriveContractTapscripts(contract) {
|
|
2260
2260
|
const handler = contractHandlers.get(contract.type);
|
|
2261
2261
|
if (!handler) {
|
|
2262
2262
|
throw new Error(`No handler for contract type '${contract.type}'`);
|
|
2263
2263
|
}
|
|
2264
2264
|
const script = handler.createScript(contract.params);
|
|
2265
2265
|
return {
|
|
2266
|
-
...vtxo,
|
|
2267
2266
|
forfeitTapLeafScript: script.forfeit(),
|
|
2268
2267
|
intentTapLeafScript: script.forfeit(),
|
|
2269
2268
|
tapTree: script.encode()
|
|
2270
2269
|
};
|
|
2271
2270
|
}
|
|
2272
|
-
function
|
|
2271
|
+
function cloneTapLeafScript([
|
|
2272
|
+
controlBlock,
|
|
2273
|
+
script
|
|
2274
|
+
]) {
|
|
2275
|
+
return [
|
|
2276
|
+
{
|
|
2277
|
+
version: controlBlock.version,
|
|
2278
|
+
internalKey: new Uint8Array(controlBlock.internalKey),
|
|
2279
|
+
merklePath: controlBlock.merklePath.map((hash) => new Uint8Array(hash))
|
|
2280
|
+
},
|
|
2281
|
+
new Uint8Array(script)
|
|
2282
|
+
];
|
|
2283
|
+
}
|
|
2284
|
+
function cloneContractTapscripts(tapscripts) {
|
|
2285
|
+
return {
|
|
2286
|
+
forfeitTapLeafScript: cloneTapLeafScript(tapscripts.forfeitTapLeafScript),
|
|
2287
|
+
intentTapLeafScript: cloneTapLeafScript(tapscripts.intentTapLeafScript),
|
|
2288
|
+
tapTree: new Uint8Array(tapscripts.tapTree)
|
|
2289
|
+
};
|
|
2290
|
+
}
|
|
2291
|
+
function extendVtxoFromContract(vtxo, contract, cache) {
|
|
2292
|
+
if (!cache) {
|
|
2293
|
+
return { ...vtxo, ...deriveContractTapscripts(contract) };
|
|
2294
|
+
}
|
|
2295
|
+
let tapscripts = cache.get(contract.script);
|
|
2296
|
+
if (!tapscripts) {
|
|
2297
|
+
tapscripts = deriveContractTapscripts(contract);
|
|
2298
|
+
cache.set(contract.script, tapscripts);
|
|
2299
|
+
}
|
|
2300
|
+
return { ...vtxo, ...cloneContractTapscripts(tapscripts) };
|
|
2301
|
+
}
|
|
2302
|
+
function extendVirtualCoinForContract(vtxo, contractOrMap, cache) {
|
|
2273
2303
|
const contract = resolveContract(vtxo, contractOrMap);
|
|
2274
2304
|
if (!contract) {
|
|
2275
2305
|
throw new Error(
|
|
2276
2306
|
"extendVirtualCoinForContract: no contract matched vtxo.script \u2014 callers must resolve the owning contract before annotating"
|
|
2277
2307
|
);
|
|
2278
2308
|
}
|
|
2279
|
-
return extendVtxoFromContract(vtxo, contract);
|
|
2309
|
+
return extendVtxoFromContract(vtxo, contract, cache);
|
|
2280
2310
|
}
|
|
2281
2311
|
function isContractMap(value) {
|
|
2282
2312
|
return typeof value.get === "function";
|
|
@@ -2599,6 +2629,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
2599
2629
|
* primary way to prevent virtual outputs from expiring.
|
|
2600
2630
|
*
|
|
2601
2631
|
* @param eventCallback - Optional callback for settlement events
|
|
2632
|
+
* @param options - Optional per-call overrides; see {@link RenewVtxosOptions}
|
|
2602
2633
|
* @returns Settlement transaction ID
|
|
2603
2634
|
* @throws Error if no virtual outputs available to renew
|
|
2604
2635
|
* @throws Error if total amount is below dust threshold
|
|
@@ -2614,15 +2645,33 @@ var VtxoManager = class _VtxoManager {
|
|
|
2614
2645
|
* const txid = await manager.renewVtxos((event) => {
|
|
2615
2646
|
* console.log('Settlement event:', event.type);
|
|
2616
2647
|
* });
|
|
2648
|
+
*
|
|
2649
|
+
* // Renew only VTXOs that expire within 6 hours
|
|
2650
|
+
* const txid = await manager.renewVtxos(undefined, { thresholdSeconds: 6 * 60 * 60 });
|
|
2617
2651
|
* ```
|
|
2618
2652
|
*/
|
|
2619
|
-
async renewVtxos(eventCallback) {
|
|
2653
|
+
async renewVtxos(eventCallback, options) {
|
|
2654
|
+
if (options?.thresholdSeconds !== void 0) {
|
|
2655
|
+
const { thresholdSeconds } = options;
|
|
2656
|
+
if (typeof thresholdSeconds !== "number" || !Number.isFinite(thresholdSeconds) || thresholdSeconds <= 0) {
|
|
2657
|
+
throw new TypeError(
|
|
2658
|
+
`Invalid thresholdSeconds: expected a positive finite number, got ${String(thresholdSeconds)}`
|
|
2659
|
+
);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2620
2662
|
if (this.renewalInProgress) {
|
|
2621
2663
|
throw new Error("Renewal already in progress");
|
|
2622
2664
|
}
|
|
2623
2665
|
this.renewalInProgress = true;
|
|
2624
2666
|
try {
|
|
2625
|
-
|
|
2667
|
+
let threshold;
|
|
2668
|
+
if (options?.thresholdSeconds !== void 0) {
|
|
2669
|
+
threshold = options.thresholdSeconds * 1e3;
|
|
2670
|
+
} else if (this.settlementConfig !== false && this.settlementConfig?.vtxoThreshold !== void 0) {
|
|
2671
|
+
threshold = this.settlementConfig.vtxoThreshold * 1e3;
|
|
2672
|
+
} else {
|
|
2673
|
+
threshold = DEFAULT_RENEWAL_CONFIG.thresholdMs;
|
|
2674
|
+
}
|
|
2626
2675
|
let vtxos = await this.getExpiringVtxos(threshold);
|
|
2627
2676
|
if (vtxos.length === 0) {
|
|
2628
2677
|
throw new Error("No VTXOs available to renew");
|
|
@@ -6670,7 +6719,8 @@ var ContractManager = class _ContractManager {
|
|
|
6670
6719
|
for (const contract of contracts) {
|
|
6671
6720
|
byScript.set(contract.script, contract);
|
|
6672
6721
|
}
|
|
6673
|
-
|
|
6722
|
+
const tapscriptCache = /* @__PURE__ */ new Map();
|
|
6723
|
+
return vtxos.map((vtxo) => extendVirtualCoinForContract(vtxo, byScript, tapscriptCache));
|
|
6674
6724
|
}
|
|
6675
6725
|
buildContractsDbFilter(filter) {
|
|
6676
6726
|
return {
|
|
@@ -10907,7 +10957,7 @@ var WalletMessageHandler = class {
|
|
|
10907
10957
|
payload: e
|
|
10908
10958
|
})
|
|
10909
10959
|
);
|
|
10910
|
-
});
|
|
10960
|
+
}, message.payload);
|
|
10911
10961
|
return this.tagged({
|
|
10912
10962
|
id,
|
|
10913
10963
|
type: "RENEW_VTXOS_SUCCESS",
|
|
@@ -12524,11 +12574,12 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12524
12574
|
throw new Error(`Failed to get expiring vtxos: ${e}`);
|
|
12525
12575
|
}
|
|
12526
12576
|
},
|
|
12527
|
-
async renewVtxos(eventCallback) {
|
|
12577
|
+
async renewVtxos(eventCallback, options) {
|
|
12528
12578
|
const message = {
|
|
12529
12579
|
tag: messageTag,
|
|
12530
12580
|
type: "RENEW_VTXOS",
|
|
12531
|
-
id: getRandomId()
|
|
12581
|
+
id: getRandomId(),
|
|
12582
|
+
payload: options
|
|
12532
12583
|
};
|
|
12533
12584
|
try {
|
|
12534
12585
|
const response = await wallet.sendMessageWithEvents(
|
|
@@ -13939,5 +13990,5 @@ function isArkContract(str) {
|
|
|
13939
13990
|
}
|
|
13940
13991
|
|
|
13941
13992
|
export { ArkNote, AssetManager, BIP322, Batch, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EsploraProvider, Estimator, HDDescriptorProvider, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, Unroll, VtxoManager, Wallet2 as Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, deserializeAssets, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isBatchSignable, isDiscoverable, isExpired, isRecoverable, isSpendable, isSubdust, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, serializeAssets, serializeUtxo, serializeVtxo, setupServiceWorker, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
|
|
13942
|
-
//# sourceMappingURL=chunk-
|
|
13943
|
-
//# sourceMappingURL=chunk-
|
|
13993
|
+
//# sourceMappingURL=chunk-HJM6JPG4.js.map
|
|
13994
|
+
//# sourceMappingURL=chunk-HJM6JPG4.js.map
|