@arkade-os/sdk 0.4.28 → 0.4.30
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 +14 -16
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +4 -4
- package/dist/adapters/expo.d.ts +4 -4
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{ark-TZ1gXAXU.d.cts → ark-C0TMXvwO.d.cts} +92 -63
- package/dist/{ark-TZ1gXAXU.d.ts → ark-C0TMXvwO.d.ts} +92 -63
- package/dist/{asyncStorageTaskQueue-EFqSmYTg.d.cts → asyncStorageTaskQueue-DHOoNvRy.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-Cb1F_Z9s.d.ts → asyncStorageTaskQueue-Iip3xMF_.d.ts} +2 -2
- package/dist/{chunk-ADV27S4N.cjs → chunk-6FLL2Q36.cjs} +8 -8
- package/dist/chunk-6FLL2Q36.cjs.map +1 -0
- package/dist/{chunk-ZBUDLTBO.js → chunk-6NWNOLL3.js} +5 -5
- package/dist/chunk-6NWNOLL3.js.map +1 -0
- package/dist/{chunk-BQLHADL7.js → chunk-6NY27WL6.js} +341 -183
- package/dist/chunk-6NY27WL6.js.map +1 -0
- package/dist/{chunk-CFZMTDWI.js → chunk-ABWRLTX5.js} +6 -5
- package/dist/chunk-ABWRLTX5.js.map +1 -0
- package/dist/{chunk-FG5ACJJW.cjs → chunk-GIGILVVP.cjs} +11 -10
- package/dist/chunk-GIGILVVP.cjs.map +1 -0
- package/dist/{chunk-A3EMF7RN.js → chunk-GRJKJNBO.js} +3 -3
- package/dist/{chunk-A3EMF7RN.js.map → chunk-GRJKJNBO.js.map} +1 -1
- package/dist/{chunk-I3DGUUCT.cjs → chunk-IEO3XDKI.cjs} +28 -28
- package/dist/{chunk-I3DGUUCT.cjs.map → chunk-IEO3XDKI.cjs.map} +1 -1
- package/dist/{chunk-IPX2R7FR.cjs → chunk-PCEE6DRL.cjs} +7 -7
- package/dist/{chunk-IPX2R7FR.cjs.map → chunk-PCEE6DRL.cjs.map} +1 -1
- package/dist/{chunk-HW3JJ323.js → chunk-TU3LVAPX.js} +32 -31
- package/dist/chunk-TU3LVAPX.js.map +1 -0
- package/dist/{chunk-5PG7DV7A.cjs → chunk-WMIPYZSB.cjs} +34 -36
- package/dist/chunk-WMIPYZSB.cjs.map +1 -0
- package/dist/{chunk-ZLO6NETT.cjs → chunk-XWJFOP5G.cjs} +505 -337
- package/dist/chunk-XWJFOP5G.cjs.map +1 -0
- package/dist/{chunk-T64LAI7L.js → chunk-YA4G7RFB.js} +3 -3
- package/dist/{chunk-T64LAI7L.js.map → chunk-YA4G7RFB.js.map} +1 -1
- package/dist/contracts/handlers/index.cjs +6 -6
- 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-aaVGfWsV.d.ts → delegate-CEk9RHVj.d.cts} +2 -2
- package/dist/{delegate-BFZs69hp.d.cts → delegate-Ds4Hi7Xy.d.ts} +2 -2
- package/dist/{index-NDla_UoJ.d.ts → index-DA9r_7Vg.d.ts} +2 -2
- package/dist/{index-B22cA64m.d.cts → index-WIAY0DDn.d.cts} +2 -2
- package/dist/index.cjs +161 -137
- package/dist/index.d.cts +144 -17
- package/dist/index.d.ts +144 -17
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +13 -13
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +4 -4
- package/dist/repositories/sqlite/index.cjs +13 -13
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.js +4 -4
- package/dist/{taskRunner-C6Ff4OaU.d.cts → taskRunner-CdEVYgoP.d.cts} +2 -2
- package/dist/{taskRunner-yvPN8Z0K.d.ts → taskRunner-JNjIWWJi.d.ts} +2 -2
- 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 +19 -15
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +9 -7
- package/dist/wallet/expo/index.d.ts +9 -7
- package/dist/wallet/expo/index.js +11 -7
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-D9NBRqvC.d.ts → wallet-BGL6SzKQ.d.ts} +19 -15
- package/dist/{wallet-AF-p-OWj.d.cts → wallet-CMgzKP0o.d.cts} +19 -15
- 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-5PG7DV7A.cjs.map +0 -1
- package/dist/chunk-ADV27S4N.cjs.map +0 -1
- package/dist/chunk-BQLHADL7.js.map +0 -1
- package/dist/chunk-CFZMTDWI.js.map +0 -1
- package/dist/chunk-FG5ACJJW.cjs.map +0 -1
- package/dist/chunk-HW3JJ323.js.map +0 -1
- package/dist/chunk-ZBUDLTBO.js.map +0 -1
- package/dist/chunk-ZLO6NETT.cjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { craftToSpendTx, Transaction, OP_RETURN_EMPTY_PKSCRIPT, Intent, getArkPsbtFields, CosignerPublicKey, setArkPsbtField, VtxoTaprootTree, maybeArkError,
|
|
2
|
-
import { isMainnetDescriptor, descriptorIsOurs, contractHandlers, DelegateVtxo, DefaultVtxo, WALLET_RECEIVE_SOURCE, deriveDescriptorLeafPubKey } from './chunk-
|
|
3
|
-
import { VtxoScript, timelockToSequence,
|
|
4
|
-
import {
|
|
1
|
+
import { craftToSpendTx, Transaction, OP_RETURN_EMPTY_PKSCRIPT, Intent, getArkPsbtFields, CosignerPublicKey, setArkPsbtField, VtxoTaprootTree, maybeArkError, AssetRef, AssetId, AssetOutput, AssetGroup, AssetInput, Packet, Metadata, isEventSourceError, RestArkProvider, RestIndexerProvider, ArkError, BufferReader } from './chunk-6NWNOLL3.js';
|
|
2
|
+
import { isMainnetDescriptor, descriptorIsOurs, contractHandlers, DelegateVtxo, DefaultVtxo, WALLET_RECEIVE_SOURCE, deriveDescriptorLeafPubKey } from './chunk-YA4G7RFB.js';
|
|
3
|
+
import { VtxoScript, timelockToSequence, DEFAULT_NETWORK, DEFAULT_NETWORK_NAME, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, ArkAddress, getSequence, CSVMultisigTapscript, getNetwork, MultisigTapscript, networks as networks$1, DEFAULT_ARKADE_SERVER_URL } from './chunk-TU3LVAPX.js';
|
|
4
|
+
import { sha256, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr, equalBytes as equalBytes$1 } from '@scure/btc-signer/utils.js';
|
|
5
5
|
import { SigHash, Script, p2tr, RawWitness, Address, OutScript, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
|
|
6
6
|
import { hex, base58, base64 } from '@scure/base';
|
|
7
7
|
import * as musig2 from '@scure/btc-signer/musig2.js';
|
|
@@ -938,12 +938,12 @@ async function getActiveServiceWorker(path) {
|
|
|
938
938
|
return serviceWorker;
|
|
939
939
|
}
|
|
940
940
|
|
|
941
|
-
// src/providers/
|
|
942
|
-
var
|
|
941
|
+
// src/providers/delegate.ts
|
|
942
|
+
var RestDelegateProvider = class {
|
|
943
943
|
/**
|
|
944
|
-
* Create a REST
|
|
944
|
+
* Create a REST delegate provider targeting the given base URL.
|
|
945
945
|
*
|
|
946
|
-
* @param url - Base URL of the delegation service
|
|
946
|
+
* @param url - Base URL of the remote delegation service.
|
|
947
947
|
*/
|
|
948
948
|
constructor(url) {
|
|
949
949
|
this.url = url;
|
|
@@ -994,35 +994,13 @@ var RestDelegatorProvider = class {
|
|
|
994
994
|
if (!isDelegateInfo(data)) {
|
|
995
995
|
throw new Error("Invalid delegate info");
|
|
996
996
|
}
|
|
997
|
-
|
|
997
|
+
const delegateAddress = typeof data.delegateAddress === "string" && data.delegateAddress !== "" ? data.delegateAddress : typeof data.delegatorAddress === "string" && data.delegatorAddress !== "" ? data.delegatorAddress : "";
|
|
998
|
+
return { ...data, delegateAddress };
|
|
998
999
|
}
|
|
999
1000
|
};
|
|
1001
|
+
var RestDelegatorProvider = RestDelegateProvider;
|
|
1000
1002
|
function isDelegateInfo(data) {
|
|
1001
|
-
return !!data && typeof data === "object" && "pubkey" in data && "fee" in data && "
|
|
1002
|
-
}
|
|
1003
|
-
var getNetwork = (network) => {
|
|
1004
|
-
return networks2[network];
|
|
1005
|
-
};
|
|
1006
|
-
var networks2 = {
|
|
1007
|
-
bitcoin: withArkPrefix(NETWORK, "ark"),
|
|
1008
|
-
testnet: withArkPrefix(TEST_NETWORK, "tark"),
|
|
1009
|
-
signet: withArkPrefix(TEST_NETWORK, "tark"),
|
|
1010
|
-
mutinynet: withArkPrefix(TEST_NETWORK, "tark"),
|
|
1011
|
-
regtest: withArkPrefix(
|
|
1012
|
-
{
|
|
1013
|
-
...TEST_NETWORK,
|
|
1014
|
-
bech32: "bcrt",
|
|
1015
|
-
pubKeyHash: 111,
|
|
1016
|
-
scriptHash: 196
|
|
1017
|
-
},
|
|
1018
|
-
"tark"
|
|
1019
|
-
)
|
|
1020
|
-
};
|
|
1021
|
-
function withArkPrefix(network, prefix) {
|
|
1022
|
-
return {
|
|
1023
|
-
...network,
|
|
1024
|
-
hrp: prefix
|
|
1025
|
-
};
|
|
1003
|
+
return !!data && typeof data === "object" && "pubkey" in data && "fee" in data && typeof data.pubkey === "string" && typeof data.fee === "string" && data.pubkey !== "" && data.fee !== "" && (typeof data.delegateAddress === "string" && data.delegateAddress !== "" || typeof data.delegatorAddress === "string" && data.delegatorAddress !== "");
|
|
1026
1004
|
}
|
|
1027
1005
|
|
|
1028
1006
|
// src/providers/onchain.ts
|
|
@@ -1034,7 +1012,7 @@ var ESPLORA_URL = {
|
|
|
1034
1012
|
regtest: "http://localhost:3000"
|
|
1035
1013
|
};
|
|
1036
1014
|
var EsploraProvider = class {
|
|
1037
|
-
constructor(baseUrl, opts) {
|
|
1015
|
+
constructor(baseUrl = ESPLORA_URL[DEFAULT_NETWORK_NAME], opts) {
|
|
1038
1016
|
this.baseUrl = baseUrl;
|
|
1039
1017
|
this.pollingInterval = opts?.pollingInterval ?? 15e3;
|
|
1040
1018
|
this.forcePolling = opts?.forcePolling ?? false;
|
|
@@ -1695,6 +1673,30 @@ function validateAssetGroupOutput(packet, outputIndex, assetId, expectedAmount)
|
|
|
1695
1673
|
}
|
|
1696
1674
|
}
|
|
1697
1675
|
|
|
1676
|
+
// src/wallet/index.ts
|
|
1677
|
+
var TxType = /* @__PURE__ */ ((TxType2) => {
|
|
1678
|
+
TxType2["TxSent"] = "SENT";
|
|
1679
|
+
TxType2["TxReceived"] = "RECEIVED";
|
|
1680
|
+
return TxType2;
|
|
1681
|
+
})(TxType || {});
|
|
1682
|
+
function isSpendable(vtxo) {
|
|
1683
|
+
return !vtxo.isSpent;
|
|
1684
|
+
}
|
|
1685
|
+
function isRecoverable(vtxo) {
|
|
1686
|
+
return vtxo.virtualStatus.state === "swept" && isSpendable(vtxo);
|
|
1687
|
+
}
|
|
1688
|
+
function isExpired(vtxo) {
|
|
1689
|
+
if (vtxo.virtualStatus.state === "swept") return true;
|
|
1690
|
+
const expiry = vtxo.virtualStatus.batchExpiry;
|
|
1691
|
+
if (!expiry) return false;
|
|
1692
|
+
const expireAt = new Date(expiry);
|
|
1693
|
+
if (expireAt.getFullYear() < 2025) return false;
|
|
1694
|
+
return expiry <= Date.now();
|
|
1695
|
+
}
|
|
1696
|
+
function isSubdust(vtxo, dust) {
|
|
1697
|
+
return vtxo.value < dust;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1698
1700
|
// src/wallet/asset.ts
|
|
1699
1701
|
function createAssetPacket(assetInputs, receivers, changeReceiver) {
|
|
1700
1702
|
const inputsByAssetId = /* @__PURE__ */ new Map();
|
|
@@ -2241,6 +2243,77 @@ function parseProgram(text, env) {
|
|
|
2241
2243
|
}
|
|
2242
2244
|
return { program, text };
|
|
2243
2245
|
}
|
|
2246
|
+
var DUST_AMOUNT = 546;
|
|
2247
|
+
var FALLBACK_WALLET_DUST_AMOUNT = 330n;
|
|
2248
|
+
function getDustAmount(wallet) {
|
|
2249
|
+
return "dustAmount" in wallet ? wallet.dustAmount : FALLBACK_WALLET_DUST_AMOUNT;
|
|
2250
|
+
}
|
|
2251
|
+
function extendCoin(wallet, utxo) {
|
|
2252
|
+
return {
|
|
2253
|
+
...utxo,
|
|
2254
|
+
forfeitTapLeafScript: wallet.boardingTapscript.forfeit(),
|
|
2255
|
+
intentTapLeafScript: wallet.boardingTapscript.forfeit(),
|
|
2256
|
+
tapTree: wallet.boardingTapscript.encode()
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
function extendVtxoFromContract(vtxo, contract) {
|
|
2260
|
+
const handler = contractHandlers.get(contract.type);
|
|
2261
|
+
if (!handler) {
|
|
2262
|
+
throw new Error(`No handler for contract type '${contract.type}'`);
|
|
2263
|
+
}
|
|
2264
|
+
const script = handler.createScript(contract.params);
|
|
2265
|
+
return {
|
|
2266
|
+
...vtxo,
|
|
2267
|
+
forfeitTapLeafScript: script.forfeit(),
|
|
2268
|
+
intentTapLeafScript: script.forfeit(),
|
|
2269
|
+
tapTree: script.encode()
|
|
2270
|
+
};
|
|
2271
|
+
}
|
|
2272
|
+
function extendVirtualCoinForContract(vtxo, contractOrMap) {
|
|
2273
|
+
const contract = resolveContract(vtxo, contractOrMap);
|
|
2274
|
+
if (!contract) {
|
|
2275
|
+
throw new Error(
|
|
2276
|
+
"extendVirtualCoinForContract: no contract matched vtxo.script \u2014 callers must resolve the owning contract before annotating"
|
|
2277
|
+
);
|
|
2278
|
+
}
|
|
2279
|
+
return extendVtxoFromContract(vtxo, contract);
|
|
2280
|
+
}
|
|
2281
|
+
function isContractMap(value) {
|
|
2282
|
+
return typeof value.get === "function";
|
|
2283
|
+
}
|
|
2284
|
+
function resolveContract(vtxo, contractOrMap) {
|
|
2285
|
+
if (!contractOrMap) return void 0;
|
|
2286
|
+
if (isContractMap(contractOrMap)) {
|
|
2287
|
+
return contractOrMap.get(vtxo.script);
|
|
2288
|
+
}
|
|
2289
|
+
return contractOrMap;
|
|
2290
|
+
}
|
|
2291
|
+
function getRandomId() {
|
|
2292
|
+
const randomValue = crypto.getRandomValues(new Uint8Array(16));
|
|
2293
|
+
return hex.encode(randomValue);
|
|
2294
|
+
}
|
|
2295
|
+
function validateRecipients(recipients, dustAmount) {
|
|
2296
|
+
const validatedRecipients = [];
|
|
2297
|
+
for (const recipient of recipients) {
|
|
2298
|
+
let address;
|
|
2299
|
+
try {
|
|
2300
|
+
address = ArkAddress.decode(recipient.address);
|
|
2301
|
+
} catch (e) {
|
|
2302
|
+
throw new Error(`Invalid Arkade address: ${recipient.address}`);
|
|
2303
|
+
}
|
|
2304
|
+
const amount = recipient.amount || dustAmount;
|
|
2305
|
+
if (amount <= 0) {
|
|
2306
|
+
throw new Error("Amount must be positive");
|
|
2307
|
+
}
|
|
2308
|
+
validatedRecipients.push({
|
|
2309
|
+
address: recipient.address,
|
|
2310
|
+
assets: recipient.assets ?? [],
|
|
2311
|
+
amount,
|
|
2312
|
+
script: amount < dustAmount ? address.subdustPkScript : address.pkScript
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
return validatedRecipients;
|
|
2316
|
+
}
|
|
2244
2317
|
|
|
2245
2318
|
// src/wallet/vtxo-manager.ts
|
|
2246
2319
|
function isSweepCapable(wallet) {
|
|
@@ -2265,7 +2338,7 @@ async function runWithCrossInstanceLock(name, fn) {
|
|
|
2265
2338
|
await fn();
|
|
2266
2339
|
});
|
|
2267
2340
|
}
|
|
2268
|
-
var DEFAULT_THRESHOLD_SECONDS =
|
|
2341
|
+
var DEFAULT_THRESHOLD_SECONDS = 259200;
|
|
2269
2342
|
var DEFAULT_THRESHOLD_MS = DEFAULT_THRESHOLD_SECONDS * 1e3;
|
|
2270
2343
|
var DEFAULT_RENEWAL_CONFIG = {
|
|
2271
2344
|
thresholdMs: DEFAULT_THRESHOLD_MS
|
|
@@ -2276,9 +2349,6 @@ var DEFAULT_SETTLEMENT_CONFIG = {
|
|
|
2276
2349
|
boardingUtxoSweep: true,
|
|
2277
2350
|
pollIntervalMs: 6e4
|
|
2278
2351
|
};
|
|
2279
|
-
function getDustAmount(wallet) {
|
|
2280
|
-
return "dustAmount" in wallet ? wallet.dustAmount : 330n;
|
|
2281
|
-
}
|
|
2282
2352
|
function getRecoverableVtxos(vtxos, dustAmount) {
|
|
2283
2353
|
return vtxos.filter((vtxo) => {
|
|
2284
2354
|
if (isRecoverable(vtxo)) {
|
|
@@ -2494,7 +2564,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
2494
2564
|
* ```typescript
|
|
2495
2565
|
* const wallet = await Wallet.create({
|
|
2496
2566
|
* identity,
|
|
2497
|
-
*
|
|
2567
|
+
* arkProvider: new RestArkProvider(),
|
|
2498
2568
|
* settlementConfig: {
|
|
2499
2569
|
* vtxoThreshold: 86_400 // 24 hours
|
|
2500
2570
|
* },
|
|
@@ -2529,6 +2599,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
2529
2599
|
* primary way to prevent virtual outputs from expiring.
|
|
2530
2600
|
*
|
|
2531
2601
|
* @param eventCallback - Optional callback for settlement events
|
|
2602
|
+
* @param options - Optional per-call overrides; see {@link RenewVtxosOptions}
|
|
2532
2603
|
* @returns Settlement transaction ID
|
|
2533
2604
|
* @throws Error if no virtual outputs available to renew
|
|
2534
2605
|
* @throws Error if total amount is below dust threshold
|
|
@@ -2544,15 +2615,33 @@ var VtxoManager = class _VtxoManager {
|
|
|
2544
2615
|
* const txid = await manager.renewVtxos((event) => {
|
|
2545
2616
|
* console.log('Settlement event:', event.type);
|
|
2546
2617
|
* });
|
|
2618
|
+
*
|
|
2619
|
+
* // Renew only VTXOs that expire within 6 hours
|
|
2620
|
+
* const txid = await manager.renewVtxos(undefined, { thresholdSeconds: 6 * 60 * 60 });
|
|
2547
2621
|
* ```
|
|
2548
2622
|
*/
|
|
2549
|
-
async renewVtxos(eventCallback) {
|
|
2623
|
+
async renewVtxos(eventCallback, options) {
|
|
2624
|
+
if (options?.thresholdSeconds !== void 0) {
|
|
2625
|
+
const { thresholdSeconds } = options;
|
|
2626
|
+
if (typeof thresholdSeconds !== "number" || !Number.isFinite(thresholdSeconds) || thresholdSeconds <= 0) {
|
|
2627
|
+
throw new TypeError(
|
|
2628
|
+
`Invalid thresholdSeconds: expected a positive finite number, got ${String(thresholdSeconds)}`
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2550
2632
|
if (this.renewalInProgress) {
|
|
2551
2633
|
throw new Error("Renewal already in progress");
|
|
2552
2634
|
}
|
|
2553
2635
|
this.renewalInProgress = true;
|
|
2554
2636
|
try {
|
|
2555
|
-
|
|
2637
|
+
let threshold;
|
|
2638
|
+
if (options?.thresholdSeconds !== void 0) {
|
|
2639
|
+
threshold = options.thresholdSeconds * 1e3;
|
|
2640
|
+
} else if (this.settlementConfig !== false && this.settlementConfig?.vtxoThreshold !== void 0) {
|
|
2641
|
+
threshold = this.settlementConfig.vtxoThreshold * 1e3;
|
|
2642
|
+
} else {
|
|
2643
|
+
threshold = DEFAULT_RENEWAL_CONFIG.thresholdMs;
|
|
2644
|
+
}
|
|
2556
2645
|
let vtxos = await this.getExpiringVtxos(threshold);
|
|
2557
2646
|
if (vtxos.length === 0) {
|
|
2558
2647
|
throw new Error("No VTXOs available to renew");
|
|
@@ -2638,7 +2727,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
2638
2727
|
* ```typescript
|
|
2639
2728
|
* const wallet = await Wallet.create({
|
|
2640
2729
|
* identity,
|
|
2641
|
-
*
|
|
2730
|
+
* arkProvider: new RestArkProvider(),
|
|
2642
2731
|
* settlementConfig: {
|
|
2643
2732
|
* boardingUtxoSweep: true,
|
|
2644
2733
|
* },
|
|
@@ -2757,8 +2846,8 @@ var VtxoManager = class _VtxoManager {
|
|
|
2757
2846
|
this.startBoardingUtxoPoll();
|
|
2758
2847
|
}, 1e3);
|
|
2759
2848
|
try {
|
|
2760
|
-
const [
|
|
2761
|
-
this.wallet.
|
|
2849
|
+
const [delegateManager, contractManager, destination] = await Promise.all([
|
|
2850
|
+
this.wallet.getDelegateManager(),
|
|
2762
2851
|
this.wallet.getContractManager(),
|
|
2763
2852
|
this.wallet.getAddress()
|
|
2764
2853
|
]);
|
|
@@ -2788,8 +2877,8 @@ var VtxoManager = class _VtxoManager {
|
|
|
2788
2877
|
console.error("Error renewing VTXOs:", e);
|
|
2789
2878
|
});
|
|
2790
2879
|
}
|
|
2791
|
-
if (
|
|
2792
|
-
|
|
2880
|
+
if (delegateManager) {
|
|
2881
|
+
delegateManager.delegate(event.vtxos, destination).catch((e) => {
|
|
2793
2882
|
console.error("Error delegating VTXOs:", e);
|
|
2794
2883
|
});
|
|
2795
2884
|
}
|
|
@@ -3230,73 +3319,6 @@ function readUInt32BE(array, offset) {
|
|
|
3230
3319
|
function noteTapscript(preimageHash) {
|
|
3231
3320
|
return Script.encode(["SHA256", preimageHash, "EQUAL"]);
|
|
3232
3321
|
}
|
|
3233
|
-
var DUST_AMOUNT = 546;
|
|
3234
|
-
function extendCoin(wallet, utxo) {
|
|
3235
|
-
return {
|
|
3236
|
-
...utxo,
|
|
3237
|
-
forfeitTapLeafScript: wallet.boardingTapscript.forfeit(),
|
|
3238
|
-
intentTapLeafScript: wallet.boardingTapscript.forfeit(),
|
|
3239
|
-
tapTree: wallet.boardingTapscript.encode()
|
|
3240
|
-
};
|
|
3241
|
-
}
|
|
3242
|
-
function extendVtxoFromContract(vtxo, contract) {
|
|
3243
|
-
const handler = contractHandlers.get(contract.type);
|
|
3244
|
-
if (!handler) {
|
|
3245
|
-
throw new Error(`No handler for contract type '${contract.type}'`);
|
|
3246
|
-
}
|
|
3247
|
-
const script = handler.createScript(contract.params);
|
|
3248
|
-
return {
|
|
3249
|
-
...vtxo,
|
|
3250
|
-
forfeitTapLeafScript: script.forfeit(),
|
|
3251
|
-
intentTapLeafScript: script.forfeit(),
|
|
3252
|
-
tapTree: script.encode()
|
|
3253
|
-
};
|
|
3254
|
-
}
|
|
3255
|
-
function extendVirtualCoinForContract(vtxo, contractOrMap) {
|
|
3256
|
-
const contract = resolveContract(vtxo, contractOrMap);
|
|
3257
|
-
if (!contract) {
|
|
3258
|
-
throw new Error(
|
|
3259
|
-
"extendVirtualCoinForContract: no contract matched vtxo.script \u2014 callers must resolve the owning contract before annotating"
|
|
3260
|
-
);
|
|
3261
|
-
}
|
|
3262
|
-
return extendVtxoFromContract(vtxo, contract);
|
|
3263
|
-
}
|
|
3264
|
-
function isContractMap(value) {
|
|
3265
|
-
return typeof value.get === "function";
|
|
3266
|
-
}
|
|
3267
|
-
function resolveContract(vtxo, contractOrMap) {
|
|
3268
|
-
if (!contractOrMap) return void 0;
|
|
3269
|
-
if (isContractMap(contractOrMap)) {
|
|
3270
|
-
return contractOrMap.get(vtxo.script);
|
|
3271
|
-
}
|
|
3272
|
-
return contractOrMap;
|
|
3273
|
-
}
|
|
3274
|
-
function getRandomId() {
|
|
3275
|
-
const randomValue = crypto.getRandomValues(new Uint8Array(16));
|
|
3276
|
-
return hex.encode(randomValue);
|
|
3277
|
-
}
|
|
3278
|
-
function validateRecipients(recipients, dustAmount) {
|
|
3279
|
-
const validatedRecipients = [];
|
|
3280
|
-
for (const recipient of recipients) {
|
|
3281
|
-
let address;
|
|
3282
|
-
try {
|
|
3283
|
-
address = ArkAddress.decode(recipient.address);
|
|
3284
|
-
} catch (e) {
|
|
3285
|
-
throw new Error(`Invalid Arkade address: ${recipient.address}`);
|
|
3286
|
-
}
|
|
3287
|
-
const amount = recipient.amount || dustAmount;
|
|
3288
|
-
if (amount <= 0) {
|
|
3289
|
-
throw new Error("Amount must be positive");
|
|
3290
|
-
}
|
|
3291
|
-
validatedRecipients.push({
|
|
3292
|
-
address: recipient.address,
|
|
3293
|
-
assets: recipient.assets ?? [],
|
|
3294
|
-
amount,
|
|
3295
|
-
script: amount < dustAmount ? address.subdustPkScript : address.pkScript
|
|
3296
|
-
});
|
|
3297
|
-
}
|
|
3298
|
-
return validatedRecipients;
|
|
3299
|
-
}
|
|
3300
3322
|
var TxTree = class {
|
|
3301
3323
|
constructor(root, children = /* @__PURE__ */ new Map()) {
|
|
3302
3324
|
this.root = root;
|
|
@@ -4070,15 +4092,15 @@ function castMetadata(metadata) {
|
|
|
4070
4092
|
}
|
|
4071
4093
|
return md;
|
|
4072
4094
|
}
|
|
4073
|
-
var
|
|
4074
|
-
/** Create a
|
|
4075
|
-
constructor(
|
|
4076
|
-
this.
|
|
4095
|
+
var DelegateManagerImpl = class {
|
|
4096
|
+
/** Create a delegate manager from the configured provider, Arkade info source, and wallet identity. */
|
|
4097
|
+
constructor(delegateProvider, arkInfoProvider, identity) {
|
|
4098
|
+
this.delegateProvider = delegateProvider;
|
|
4077
4099
|
this.arkInfoProvider = arkInfoProvider;
|
|
4078
4100
|
this.identity = identity;
|
|
4079
4101
|
}
|
|
4080
4102
|
async getDelegateInfo() {
|
|
4081
|
-
return this.
|
|
4103
|
+
return this.delegateProvider.getDelegateInfo();
|
|
4082
4104
|
}
|
|
4083
4105
|
async delegate(vtxos, destination, delegateAt) {
|
|
4084
4106
|
if (vtxos.length === 0) {
|
|
@@ -4086,7 +4108,7 @@ var DelegatorManagerImpl = class {
|
|
|
4086
4108
|
}
|
|
4087
4109
|
const destinationScript = ArkAddress.decode(destination).pkScript;
|
|
4088
4110
|
const arkInfo = await this.arkInfoProvider.getInfo();
|
|
4089
|
-
const delegateInfo = await this.
|
|
4111
|
+
const delegateInfo = await this.delegateProvider.getDelegateInfo();
|
|
4090
4112
|
const eligible = vtxos.filter(
|
|
4091
4113
|
(v) => isAnnotated(v) && findDelegateTapLeaf(v, delegateInfo.pubkey) !== void 0
|
|
4092
4114
|
);
|
|
@@ -4097,7 +4119,7 @@ var DelegatorManagerImpl = class {
|
|
|
4097
4119
|
try {
|
|
4098
4120
|
await delegate(
|
|
4099
4121
|
this.identity,
|
|
4100
|
-
this.
|
|
4122
|
+
this.delegateProvider,
|
|
4101
4123
|
arkInfo,
|
|
4102
4124
|
delegateInfo,
|
|
4103
4125
|
eligible,
|
|
@@ -4128,7 +4150,7 @@ var DelegatorManagerImpl = class {
|
|
|
4128
4150
|
try {
|
|
4129
4151
|
await delegate(
|
|
4130
4152
|
this.identity,
|
|
4131
|
-
this.
|
|
4153
|
+
this.delegateProvider,
|
|
4132
4154
|
arkInfo,
|
|
4133
4155
|
delegateInfo,
|
|
4134
4156
|
recoverableVtxos,
|
|
@@ -4153,7 +4175,7 @@ var DelegatorManagerImpl = class {
|
|
|
4153
4175
|
groupsList.map(
|
|
4154
4176
|
async ([, vtxosGroup]) => delegate(
|
|
4155
4177
|
this.identity,
|
|
4156
|
-
this.
|
|
4178
|
+
this.delegateProvider,
|
|
4157
4179
|
arkInfo,
|
|
4158
4180
|
delegateInfo,
|
|
4159
4181
|
vtxosGroup,
|
|
@@ -4174,12 +4196,13 @@ var DelegatorManagerImpl = class {
|
|
|
4174
4196
|
return { delegated, failed };
|
|
4175
4197
|
}
|
|
4176
4198
|
};
|
|
4177
|
-
|
|
4199
|
+
var DelegatorManagerImpl = DelegateManagerImpl;
|
|
4200
|
+
async function delegate(identity, delegateProvider, arkInfo, delegateInfo, vtxos, destinationScript, delegateAt) {
|
|
4178
4201
|
if (vtxos.length === 0) {
|
|
4179
4202
|
throw new Error("unable to delegate: no vtxos provided");
|
|
4180
4203
|
}
|
|
4181
|
-
if (!
|
|
4182
|
-
throw new Error("unable to delegate:
|
|
4204
|
+
if (!delegateProvider) {
|
|
4205
|
+
throw new Error("unable to delegate: delegate provider not configured");
|
|
4183
4206
|
}
|
|
4184
4207
|
if (!delegateAt) {
|
|
4185
4208
|
const expiryTimestamp = vtxos.filter((coin) => !isRecoverable(coin) && coin.virtualStatus.batchExpiry).reduce(
|
|
@@ -4225,13 +4248,14 @@ async function delegate(identity, delegatorProvider, arkInfo, delegateInfo, vtxo
|
|
|
4225
4248
|
}
|
|
4226
4249
|
amount += BigInt(coin.value) - BigInt(inputFee.value);
|
|
4227
4250
|
}
|
|
4228
|
-
const {
|
|
4251
|
+
const { pubkey, fee } = delegateInfo;
|
|
4252
|
+
const delegateAddress = delegateInfo.delegateAddress;
|
|
4229
4253
|
const outputs = [];
|
|
4230
|
-
const
|
|
4231
|
-
if (
|
|
4254
|
+
const delegateFee = BigInt(Number(fee));
|
|
4255
|
+
if (delegateFee > 0n) {
|
|
4232
4256
|
outputs.push({
|
|
4233
|
-
script: ArkAddress.decode(
|
|
4234
|
-
amount:
|
|
4257
|
+
script: ArkAddress.decode(delegateAddress).pkScript,
|
|
4258
|
+
amount: delegateFee
|
|
4235
4259
|
});
|
|
4236
4260
|
}
|
|
4237
4261
|
const outputFee = outputs.reduce((fee2, output) => {
|
|
@@ -4245,7 +4269,7 @@ async function delegate(identity, delegatorProvider, arkInfo, delegateInfo, vtxo
|
|
|
4245
4269
|
throw new Error("Amount is below dust limit, cannot delegate");
|
|
4246
4270
|
}
|
|
4247
4271
|
amount -= BigInt(outputFee);
|
|
4248
|
-
amount -=
|
|
4272
|
+
amount -= delegateFee;
|
|
4249
4273
|
if (amount <= dust) {
|
|
4250
4274
|
throw new Error("Amount is below dust limit, cannot delegate");
|
|
4251
4275
|
}
|
|
@@ -4277,7 +4301,7 @@ async function delegate(identity, delegatorProvider, arkInfo, delegateInfo, vtxo
|
|
|
4277
4301
|
return base64.encode(forfeit.toPSBT());
|
|
4278
4302
|
})
|
|
4279
4303
|
);
|
|
4280
|
-
await
|
|
4304
|
+
await delegateProvider.delegate(registerIntent, forfeits);
|
|
4281
4305
|
}
|
|
4282
4306
|
async function makeDelegateForfeitTx(input, connectorAmount, delegatePubkey, forfeitOutputScript, identity) {
|
|
4283
4307
|
const delegateTapLeaf = findDelegateTapLeaf(input, delegatePubkey);
|
|
@@ -7722,7 +7746,7 @@ function hasToReadonly(identity) {
|
|
|
7722
7746
|
return typeof identity === "object" && identity !== null && "toReadonly" in identity && typeof identity.toReadonly === "function";
|
|
7723
7747
|
}
|
|
7724
7748
|
var ReadonlyWallet = class _ReadonlyWallet {
|
|
7725
|
-
constructor(identity, network, onchainProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, dustAmount, walletRepository, contractRepository,
|
|
7749
|
+
constructor(identity, network, onchainProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, dustAmount, walletRepository, contractRepository, delegateProvider, watcherConfig, walletContractTimelocks) {
|
|
7726
7750
|
this.identity = identity;
|
|
7727
7751
|
this.network = network;
|
|
7728
7752
|
this.onchainProvider = onchainProvider;
|
|
@@ -7732,7 +7756,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
7732
7756
|
this.dustAmount = dustAmount;
|
|
7733
7757
|
this.walletRepository = walletRepository;
|
|
7734
7758
|
this.contractRepository = contractRepository;
|
|
7735
|
-
this.
|
|
7759
|
+
this.delegateProvider = delegateProvider;
|
|
7736
7760
|
if ("descriptor" in identity) {
|
|
7737
7761
|
const descriptor = identity.descriptor;
|
|
7738
7762
|
const identityIsMainnet = !descriptor.includes("tpub");
|
|
@@ -7786,7 +7810,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
7786
7810
|
*/
|
|
7787
7811
|
static async setupWalletConfig(config, pubKey) {
|
|
7788
7812
|
const arkadeServerUrl = getArkadeServerUrl(config);
|
|
7789
|
-
const arkProvider = config.arkProvider
|
|
7813
|
+
const arkProvider = config.arkProvider || new RestArkProvider(arkadeServerUrl);
|
|
7790
7814
|
let indexerProvider = config.indexerProvider;
|
|
7791
7815
|
if (!indexerProvider) {
|
|
7792
7816
|
let indexerUrl = config.indexerUrl;
|
|
@@ -7847,7 +7871,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
7847
7871
|
type: info.boardingExitDelay < 512n ? "blocks" : "seconds"
|
|
7848
7872
|
};
|
|
7849
7873
|
const serverPubKey = hex.decode(info.signerPubkey).slice(1);
|
|
7850
|
-
const delegatePubKey = config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => hex.decode(info2.pubkey).slice(1)) : void 0;
|
|
7874
|
+
const delegatePubKey = config.delegateProvider ? await config.delegateProvider.getDelegateInfo().then((info2) => hex.decode(info2.pubkey).slice(1)) : config.delegatorProvider ? await config.delegatorProvider.getDelegateInfo().then((info2) => hex.decode(info2.pubkey).slice(1)) : void 0;
|
|
7851
7875
|
const offchainOptions = {
|
|
7852
7876
|
pubKey,
|
|
7853
7877
|
serverPubKey,
|
|
@@ -7873,7 +7897,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
7873
7897
|
walletRepository,
|
|
7874
7898
|
contractRepository,
|
|
7875
7899
|
info,
|
|
7876
|
-
|
|
7900
|
+
delegateProvider: config.delegateProvider || config.delegatorProvider,
|
|
7901
|
+
/** @deprecated alias for `delegateProvider` */
|
|
7902
|
+
delegatorProvider: config.delegateProvider || config.delegatorProvider,
|
|
7877
7903
|
walletContractTimelocks
|
|
7878
7904
|
};
|
|
7879
7905
|
}
|
|
@@ -7900,7 +7926,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
7900
7926
|
setup.dustAmount,
|
|
7901
7927
|
setup.walletRepository,
|
|
7902
7928
|
setup.contractRepository,
|
|
7903
|
-
setup.delegatorProvider,
|
|
7929
|
+
setup.delegateProvider || setup.delegatorProvider,
|
|
7904
7930
|
config.watcherConfig,
|
|
7905
7931
|
setup.walletContractTimelocks
|
|
7906
7932
|
);
|
|
@@ -8315,7 +8341,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
8315
8341
|
}
|
|
8316
8342
|
};
|
|
8317
8343
|
var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
8318
|
-
constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, renewalConfig,
|
|
8344
|
+
constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, renewalConfig, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider) {
|
|
8319
8345
|
super(
|
|
8320
8346
|
identity,
|
|
8321
8347
|
network,
|
|
@@ -8327,7 +8353,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
8327
8353
|
dustAmount,
|
|
8328
8354
|
walletRepository,
|
|
8329
8355
|
contractRepository,
|
|
8330
|
-
|
|
8356
|
+
delegateProvider,
|
|
8331
8357
|
watcherConfig,
|
|
8332
8358
|
walletContractTimelocks
|
|
8333
8359
|
);
|
|
@@ -8352,7 +8378,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
8352
8378
|
} else {
|
|
8353
8379
|
this.settlementConfig = { ...DEFAULT_SETTLEMENT_CONFIG };
|
|
8354
8380
|
}
|
|
8355
|
-
this.
|
|
8381
|
+
this._delegateManager = delegateProvider ? new DelegateManagerImpl(delegateProvider, arkProvider, identity) : void 0;
|
|
8356
8382
|
this._receiveRotator = receiveRotator;
|
|
8357
8383
|
this._descriptorProvider = descriptorProvider;
|
|
8358
8384
|
this._signerRouter = new InputSignerRouter({
|
|
@@ -8365,7 +8391,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
8365
8391
|
static MIN_FEE_RATE = 1;
|
|
8366
8392
|
// sats/vbyte
|
|
8367
8393
|
identity;
|
|
8368
|
-
|
|
8394
|
+
_delegateManager;
|
|
8369
8395
|
_vtxoManager;
|
|
8370
8396
|
_vtxoManagerInitializing;
|
|
8371
8397
|
_walletAssetManager;
|
|
@@ -8574,7 +8600,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
8574
8600
|
* ```typescript
|
|
8575
8601
|
* const wallet = await Wallet.create({
|
|
8576
8602
|
* identity,
|
|
8577
|
-
*
|
|
8603
|
+
* arkProvider: new RestArkProvider(),
|
|
8578
8604
|
* });
|
|
8579
8605
|
* ```
|
|
8580
8606
|
*/
|
|
@@ -8611,7 +8637,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
8611
8637
|
setup.walletRepository,
|
|
8612
8638
|
setup.contractRepository,
|
|
8613
8639
|
config.renewalConfig,
|
|
8614
|
-
config.delegatorProvider,
|
|
8640
|
+
config.delegateProvider || config.delegatorProvider,
|
|
8615
8641
|
config.watcherConfig,
|
|
8616
8642
|
config.settlementConfig,
|
|
8617
8643
|
setup.walletContractTimelocks,
|
|
@@ -8651,14 +8677,18 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
8651
8677
|
this.dustAmount,
|
|
8652
8678
|
this.walletRepository,
|
|
8653
8679
|
this.contractRepository,
|
|
8654
|
-
this.
|
|
8680
|
+
this.delegateProvider,
|
|
8655
8681
|
this.watcherConfig,
|
|
8656
8682
|
this.walletContractTimelocks
|
|
8657
8683
|
);
|
|
8658
8684
|
}
|
|
8659
|
-
/** Returns the
|
|
8685
|
+
/** Returns the delegate manager when delegation support is configured. */
|
|
8686
|
+
async getDelegateManager() {
|
|
8687
|
+
return this._delegateManager;
|
|
8688
|
+
}
|
|
8689
|
+
/** @deprecated alias for @see Wallet.getDelegateManager */
|
|
8660
8690
|
async getDelegatorManager() {
|
|
8661
|
-
return this.
|
|
8691
|
+
return this.getDelegateManager();
|
|
8662
8692
|
}
|
|
8663
8693
|
/**
|
|
8664
8694
|
* Send bitcoin to an Arkade address.
|
|
@@ -9914,7 +9944,7 @@ var MessageBus = class {
|
|
|
9914
9944
|
walletRepository: this.walletRepository,
|
|
9915
9945
|
contractRepository: this.contractRepository
|
|
9916
9946
|
};
|
|
9917
|
-
const
|
|
9947
|
+
const delegateProvider = config.delegateUrl ? new RestDelegateProvider(config.delegateUrl) : config.delegatorUrl ? new RestDelegateProvider(config.delegatorUrl) : void 0;
|
|
9918
9948
|
const serialized = normalizeSerializedIdentity(config.wallet);
|
|
9919
9949
|
if (isSigningSerialized(serialized)) {
|
|
9920
9950
|
const identity2 = hydrateIdentity(serialized);
|
|
@@ -9925,7 +9955,7 @@ var MessageBus = class {
|
|
|
9925
9955
|
indexerUrl: config.indexerUrl,
|
|
9926
9956
|
esploraUrl: config.esploraUrl,
|
|
9927
9957
|
storage,
|
|
9928
|
-
|
|
9958
|
+
delegateProvider,
|
|
9929
9959
|
settlementConfig: config.settlementConfig,
|
|
9930
9960
|
walletMode: config.walletMode,
|
|
9931
9961
|
watcherConfig: config.watcherConfig
|
|
@@ -9940,7 +9970,7 @@ var MessageBus = class {
|
|
|
9940
9970
|
indexerUrl: config.indexerUrl,
|
|
9941
9971
|
esploraUrl: config.esploraUrl,
|
|
9942
9972
|
storage,
|
|
9943
|
-
|
|
9973
|
+
delegateProvider,
|
|
9944
9974
|
watcherConfig: config.watcherConfig
|
|
9945
9975
|
});
|
|
9946
9976
|
return { readonlyWallet, arkProvider };
|
|
@@ -10219,6 +10249,18 @@ var MessageBus = class {
|
|
|
10219
10249
|
function toError(value) {
|
|
10220
10250
|
return value instanceof Error ? value : new Error(String(value));
|
|
10221
10251
|
}
|
|
10252
|
+
var DustChangeError = class extends Error {
|
|
10253
|
+
change;
|
|
10254
|
+
dustAmount;
|
|
10255
|
+
constructor(change, dustAmount) {
|
|
10256
|
+
super(
|
|
10257
|
+
`change ${change} sats is below dust threshold ${dustAmount}; consider exiting the full balance`
|
|
10258
|
+
);
|
|
10259
|
+
this.name = "DustChangeError";
|
|
10260
|
+
this.change = change;
|
|
10261
|
+
this.dustAmount = dustAmount;
|
|
10262
|
+
}
|
|
10263
|
+
};
|
|
10222
10264
|
var Ramps = class {
|
|
10223
10265
|
/**
|
|
10224
10266
|
* Create convenience wrappers for onboarding and offboarding flows.
|
|
@@ -10356,6 +10398,10 @@ var Ramps = class {
|
|
|
10356
10398
|
}
|
|
10357
10399
|
change = totalAmount - amount;
|
|
10358
10400
|
}
|
|
10401
|
+
const dustAmount = getDustAmount(this.wallet);
|
|
10402
|
+
if (change > 0n && change < dustAmount) {
|
|
10403
|
+
throw new DustChangeError(change, dustAmount);
|
|
10404
|
+
}
|
|
10359
10405
|
amount = amount ?? totalAmount;
|
|
10360
10406
|
const networkNames = [
|
|
10361
10407
|
"bitcoin",
|
|
@@ -10367,7 +10413,7 @@ var Ramps = class {
|
|
|
10367
10413
|
let destinationScript;
|
|
10368
10414
|
for (const networkName of networkNames) {
|
|
10369
10415
|
try {
|
|
10370
|
-
const network =
|
|
10416
|
+
const network = networks$1[networkName];
|
|
10371
10417
|
const addr = Address(network).decode(destinationAddress);
|
|
10372
10418
|
destinationScript = OutScript.encode(addr);
|
|
10373
10419
|
break;
|
|
@@ -10418,18 +10464,47 @@ var WalletNotInitializedError = class extends Error {
|
|
|
10418
10464
|
this.name = "WalletNotInitializedError";
|
|
10419
10465
|
}
|
|
10420
10466
|
};
|
|
10467
|
+
function isSerializedAggregateError(value) {
|
|
10468
|
+
if (!value || typeof value !== "object") return false;
|
|
10469
|
+
const v = value;
|
|
10470
|
+
return v.name === "AggregateError" && typeof v.message === "string" && Array.isArray(v.errors) && v.errors.every((e) => e && typeof e.name === "string" && typeof e.message === "string");
|
|
10471
|
+
}
|
|
10472
|
+
function serializeAggregateError(error) {
|
|
10473
|
+
const errors = [];
|
|
10474
|
+
for (const child of error.errors ?? []) {
|
|
10475
|
+
if (child instanceof Error) {
|
|
10476
|
+
errors.push({ name: child.name, message: child.message });
|
|
10477
|
+
} else {
|
|
10478
|
+
errors.push({ name: "Error", message: String(child) });
|
|
10479
|
+
}
|
|
10480
|
+
}
|
|
10481
|
+
return {
|
|
10482
|
+
name: "AggregateError",
|
|
10483
|
+
message: error.message,
|
|
10484
|
+
errors
|
|
10485
|
+
};
|
|
10486
|
+
}
|
|
10487
|
+
function deserializeAggregateError(payload) {
|
|
10488
|
+
const errs = payload.errors.map((e) => {
|
|
10489
|
+
const err = new Error(e.message);
|
|
10490
|
+
err.name = e.name;
|
|
10491
|
+
return err;
|
|
10492
|
+
});
|
|
10493
|
+
return new AggregateError(errs, payload.message);
|
|
10494
|
+
}
|
|
10421
10495
|
var ReadonlyWalletError = class extends Error {
|
|
10422
10496
|
constructor() {
|
|
10423
10497
|
super("Read-only wallet: operation requires signing");
|
|
10424
10498
|
this.name = "ReadonlyWalletError";
|
|
10425
10499
|
}
|
|
10426
10500
|
};
|
|
10427
|
-
var
|
|
10501
|
+
var DelegateNotConfiguredError = class extends Error {
|
|
10428
10502
|
constructor() {
|
|
10429
|
-
super("
|
|
10430
|
-
this.name = "
|
|
10503
|
+
super("Delegate not configured");
|
|
10504
|
+
this.name = "DelegateNotConfiguredError";
|
|
10431
10505
|
}
|
|
10432
10506
|
};
|
|
10507
|
+
var DelegatorNotConfiguredError = DelegateNotConfiguredError;
|
|
10433
10508
|
var DEFAULT_MESSAGE_TAG = "WALLET_UPDATER";
|
|
10434
10509
|
var WalletMessageHandler = class {
|
|
10435
10510
|
messageTag;
|
|
@@ -10512,7 +10587,10 @@ var WalletMessageHandler = class {
|
|
|
10512
10587
|
// page-side PING / MESSAGE_BUS_NOT_INITIALIZED path triggered by concurrent
|
|
10513
10588
|
// short requests (GET_STATUS, GET_BALANCE, ...).
|
|
10514
10589
|
isLongRunning(message) {
|
|
10515
|
-
return message.type === "SETTLE" || message.type === "RECOVER_VTXOS" || message.type === "RENEW_VTXOS"
|
|
10590
|
+
return message.type === "SETTLE" || message.type === "RECOVER_VTXOS" || message.type === "RENEW_VTXOS" || // HD restore walks the index range with one indexer round-trip per
|
|
10591
|
+
// step until it hits gapLimit consecutive unused indices. The bus
|
|
10592
|
+
// deadline must not race the scan; liveness stays covered by PING.
|
|
10593
|
+
message.type === "RESTORE_WALLET";
|
|
10516
10594
|
}
|
|
10517
10595
|
async handleMessage(message) {
|
|
10518
10596
|
const id = message.id;
|
|
@@ -10781,11 +10859,11 @@ var WalletMessageHandler = class {
|
|
|
10781
10859
|
}
|
|
10782
10860
|
case "GET_DELEGATE_INFO": {
|
|
10783
10861
|
const wallet = this.requireWallet();
|
|
10784
|
-
const
|
|
10785
|
-
if (!
|
|
10786
|
-
throw new
|
|
10862
|
+
const delegateManager = await wallet.getDelegateManager();
|
|
10863
|
+
if (!delegateManager) {
|
|
10864
|
+
throw new DelegateNotConfiguredError();
|
|
10787
10865
|
}
|
|
10788
|
-
const info = await
|
|
10866
|
+
const info = await delegateManager.getDelegateInfo();
|
|
10789
10867
|
return this.tagged({
|
|
10790
10868
|
id,
|
|
10791
10869
|
type: "DELEGATE_INFO",
|
|
@@ -10848,7 +10926,7 @@ var WalletMessageHandler = class {
|
|
|
10848
10926
|
payload: e
|
|
10849
10927
|
})
|
|
10850
10928
|
);
|
|
10851
|
-
});
|
|
10929
|
+
}, message.payload);
|
|
10852
10930
|
return this.tagged({
|
|
10853
10931
|
id,
|
|
10854
10932
|
type: "RENEW_VTXOS_SUCCESS",
|
|
@@ -10875,6 +10953,24 @@ var WalletMessageHandler = class {
|
|
|
10875
10953
|
payload: { txid }
|
|
10876
10954
|
});
|
|
10877
10955
|
}
|
|
10956
|
+
case "RESTORE_WALLET": {
|
|
10957
|
+
const wallet = this.requireWallet();
|
|
10958
|
+
try {
|
|
10959
|
+
await wallet.restore(message.payload);
|
|
10960
|
+
} catch (error) {
|
|
10961
|
+
if (error instanceof AggregateError) {
|
|
10962
|
+
return this.tagged({
|
|
10963
|
+
id,
|
|
10964
|
+
error: serializeAggregateError(error)
|
|
10965
|
+
});
|
|
10966
|
+
}
|
|
10967
|
+
throw error;
|
|
10968
|
+
}
|
|
10969
|
+
return this.tagged({
|
|
10970
|
+
id,
|
|
10971
|
+
type: "RESTORE_WALLET_SUCCESS"
|
|
10972
|
+
});
|
|
10973
|
+
}
|
|
10878
10974
|
default:
|
|
10879
10975
|
console.error("Unknown message type", message);
|
|
10880
10976
|
throw new Error("Unknown message");
|
|
@@ -11129,15 +11225,15 @@ var WalletMessageHandler = class {
|
|
|
11129
11225
|
}
|
|
11130
11226
|
async handleDelegate(message) {
|
|
11131
11227
|
const wallet = this.requireWallet();
|
|
11132
|
-
const
|
|
11133
|
-
if (!
|
|
11134
|
-
throw new
|
|
11228
|
+
const delegateManager = await wallet.getDelegateManager();
|
|
11229
|
+
if (!delegateManager) {
|
|
11230
|
+
throw new DelegateNotConfiguredError();
|
|
11135
11231
|
}
|
|
11136
11232
|
const { vtxoOutpoints, destination, delegateAt } = message.payload;
|
|
11137
11233
|
const allVtxos = await wallet.getVtxos();
|
|
11138
11234
|
const outpointSet = new Set(vtxoOutpoints.map((o) => `${o.txid}:${o.vout}`));
|
|
11139
11235
|
const filtered = allVtxos.filter((v) => outpointSet.has(`${v.txid}:${v.vout}`)).map((v) => ({ ...v, contractScript: v.script }));
|
|
11140
|
-
const result = await
|
|
11236
|
+
const result = await delegateManager.delegate(
|
|
11141
11237
|
filtered,
|
|
11142
11238
|
destination,
|
|
11143
11239
|
delegateAt !== void 0 ? new Date(delegateAt) : void 0
|
|
@@ -11344,6 +11440,10 @@ var DEFAULT_MESSAGE_TIMEOUTS = {
|
|
|
11344
11440
|
RECOVER_VTXOS: 5e4,
|
|
11345
11441
|
RENEW_VTXOS: 5e4,
|
|
11346
11442
|
SWEEP_EXPIRED_BOARDING_UTXOS: 5e4,
|
|
11443
|
+
// RESTORE_WALLET is a streaming/long-running path (sendMessageWithEvents)
|
|
11444
|
+
// like SETTLE; the value here is kept for type completeness and is never
|
|
11445
|
+
// enforced as an inactivity deadline.
|
|
11446
|
+
RESTORE_WALLET: 5e4,
|
|
11347
11447
|
// Misc writes
|
|
11348
11448
|
INIT_WALLET: 3e4,
|
|
11349
11449
|
CLEAR: 1e4,
|
|
@@ -11485,6 +11585,8 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
11485
11585
|
// these immediately after construction.
|
|
11486
11586
|
arkServerUrl;
|
|
11487
11587
|
arkServerPublicKey;
|
|
11588
|
+
delegateUrl;
|
|
11589
|
+
/** @deprecated alias for @see ServiceWorkerReadonlyWallet.delegateUrl */
|
|
11488
11590
|
delegatorUrl;
|
|
11489
11591
|
indexerUrl;
|
|
11490
11592
|
esploraUrl;
|
|
@@ -11523,7 +11625,11 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
11523
11625
|
key: { publicKey },
|
|
11524
11626
|
arkServerUrl: getArkadeServerUrl(options),
|
|
11525
11627
|
arkServerPublicKey: options.arkServerPublicKey,
|
|
11526
|
-
|
|
11628
|
+
delegateUrl: options.delegateUrl || options.delegatorUrl,
|
|
11629
|
+
// Keep the deprecated field populated so pre-#519 service workers
|
|
11630
|
+
// (which only read delegatorUrl) keep delegating until they activate
|
|
11631
|
+
// a newer version.
|
|
11632
|
+
delegatorUrl: options.delegateUrl || options.delegatorUrl
|
|
11527
11633
|
};
|
|
11528
11634
|
const messageTimeouts = options.messageTimeouts ? {
|
|
11529
11635
|
...DEFAULT_MESSAGE_TIMEOUTS,
|
|
@@ -11535,7 +11641,11 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
11535
11641
|
url: getArkadeServerUrl(options),
|
|
11536
11642
|
publicKey: options.arkServerPublicKey
|
|
11537
11643
|
},
|
|
11538
|
-
|
|
11644
|
+
delegateUrl: options.delegateUrl || options.delegatorUrl,
|
|
11645
|
+
// Keep the deprecated field populated so pre-#519 service workers
|
|
11646
|
+
// (which only read delegatorUrl) keep delegating until they activate
|
|
11647
|
+
// a newer version.
|
|
11648
|
+
delegatorUrl: options.delegateUrl || options.delegatorUrl,
|
|
11539
11649
|
indexerUrl: options.indexerUrl,
|
|
11540
11650
|
esploraUrl: options.esploraUrl,
|
|
11541
11651
|
watcherConfig: options.watcherConfig,
|
|
@@ -11757,7 +11867,11 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
11757
11867
|
url: this.arkServerUrl,
|
|
11758
11868
|
publicKey: this.arkServerPublicKey
|
|
11759
11869
|
},
|
|
11760
|
-
|
|
11870
|
+
delegateUrl: this.delegateUrl || this.delegatorUrl,
|
|
11871
|
+
// Keep the deprecated field populated so pre-#519 service workers
|
|
11872
|
+
// (which only read delegatorUrl) keep delegating until they activate
|
|
11873
|
+
// a newer version.
|
|
11874
|
+
delegatorUrl: this.delegateUrl || this.delegatorUrl,
|
|
11761
11875
|
indexerUrl: this.indexerUrl,
|
|
11762
11876
|
esploraUrl: this.esploraUrl,
|
|
11763
11877
|
watcherConfig: this.watcherConfig,
|
|
@@ -12126,7 +12240,7 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
12126
12240
|
}
|
|
12127
12241
|
};
|
|
12128
12242
|
var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
|
|
12129
|
-
constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag,
|
|
12243
|
+
constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegate) {
|
|
12130
12244
|
super(serviceWorker, identity, walletRepository, contractRepository, messageTag);
|
|
12131
12245
|
this.serviceWorker = serviceWorker;
|
|
12132
12246
|
this.identity = identity;
|
|
@@ -12136,13 +12250,13 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12136
12250
|
(msg) => this.sendMessage(msg),
|
|
12137
12251
|
messageTag
|
|
12138
12252
|
);
|
|
12139
|
-
this.
|
|
12253
|
+
this.hasDelegate = hasDelegate;
|
|
12140
12254
|
}
|
|
12141
12255
|
walletRepository;
|
|
12142
12256
|
contractRepository;
|
|
12143
12257
|
identity;
|
|
12144
12258
|
_assetManager;
|
|
12145
|
-
|
|
12259
|
+
hasDelegate;
|
|
12146
12260
|
get assetManager() {
|
|
12147
12261
|
return this._assetManager;
|
|
12148
12262
|
}
|
|
@@ -12166,14 +12280,18 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12166
12280
|
walletRepository,
|
|
12167
12281
|
contractRepository,
|
|
12168
12282
|
messageTag,
|
|
12169
|
-
!!options.delegatorUrl
|
|
12283
|
+
!!(options.delegateUrl || options.delegatorUrl)
|
|
12170
12284
|
);
|
|
12171
12285
|
const legacyPrivateKey = serializedWallet.type === "single-key" ? serializedWallet.privateKey : null;
|
|
12172
12286
|
const initWalletPayload = {
|
|
12173
12287
|
key: legacyPrivateKey ? { privateKey: legacyPrivateKey } : {},
|
|
12174
12288
|
arkServerUrl: getArkadeServerUrl(options),
|
|
12175
12289
|
arkServerPublicKey: options.arkServerPublicKey,
|
|
12176
|
-
|
|
12290
|
+
delegateUrl: options.delegateUrl || options.delegatorUrl,
|
|
12291
|
+
// Keep the deprecated field populated so pre-#519 service workers
|
|
12292
|
+
// (which only read delegatorUrl) keep delegating until they activate
|
|
12293
|
+
// a newer version.
|
|
12294
|
+
delegatorUrl: options.delegateUrl || options.delegatorUrl
|
|
12177
12295
|
};
|
|
12178
12296
|
const messageTimeouts = options.messageTimeouts ? {
|
|
12179
12297
|
...DEFAULT_MESSAGE_TIMEOUTS,
|
|
@@ -12185,7 +12303,11 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12185
12303
|
url: getArkadeServerUrl(options),
|
|
12186
12304
|
publicKey: options.arkServerPublicKey
|
|
12187
12305
|
},
|
|
12188
|
-
|
|
12306
|
+
delegateUrl: options.delegateUrl || options.delegatorUrl,
|
|
12307
|
+
// Keep the deprecated field populated so pre-#519 service workers
|
|
12308
|
+
// (which only read delegatorUrl) keep delegating until they activate
|
|
12309
|
+
// a newer version.
|
|
12310
|
+
delegatorUrl: options.delegateUrl || options.delegatorUrl,
|
|
12189
12311
|
indexerUrl: options.indexerUrl,
|
|
12190
12312
|
esploraUrl: options.esploraUrl,
|
|
12191
12313
|
settlementConfig: options.settlementConfig,
|
|
@@ -12266,6 +12388,38 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12266
12388
|
throw new Error(`Settlement failed: ${error}`);
|
|
12267
12389
|
}
|
|
12268
12390
|
}
|
|
12391
|
+
/**
|
|
12392
|
+
* Explicitly recover this wallet's contracts and balance on a fresh repo.
|
|
12393
|
+
* Mirrors {@link Wallet.restore} but drives the scan inside the service
|
|
12394
|
+
* worker — the materialize() callback used by `scanContracts` cannot
|
|
12395
|
+
* cross the postMessage boundary, so the entire flow runs worker-side
|
|
12396
|
+
* and only the gapLimit / outcome cross the wire.
|
|
12397
|
+
*
|
|
12398
|
+
* Uses the streaming send path so the bus deadline does not race a
|
|
12399
|
+
* long indexer-bound scan. AggregateError thrown by the worker is
|
|
12400
|
+
* reconstructed here so callers can inspect `.errors`.
|
|
12401
|
+
*/
|
|
12402
|
+
async restore(opts) {
|
|
12403
|
+
const message = {
|
|
12404
|
+
id: getRandomId(),
|
|
12405
|
+
tag: this.messageTag,
|
|
12406
|
+
type: "RESTORE_WALLET",
|
|
12407
|
+
payload: opts ?? {}
|
|
12408
|
+
};
|
|
12409
|
+
try {
|
|
12410
|
+
await this.sendMessageWithEvents(
|
|
12411
|
+
message,
|
|
12412
|
+
() => {
|
|
12413
|
+
},
|
|
12414
|
+
(resp) => resp.type === "RESTORE_WALLET_SUCCESS"
|
|
12415
|
+
);
|
|
12416
|
+
} catch (error) {
|
|
12417
|
+
if (isSerializedAggregateError(error)) {
|
|
12418
|
+
throw deserializeAggregateError(error);
|
|
12419
|
+
}
|
|
12420
|
+
throw error;
|
|
12421
|
+
}
|
|
12422
|
+
}
|
|
12269
12423
|
async send(...recipients) {
|
|
12270
12424
|
const message = {
|
|
12271
12425
|
tag: this.messageTag,
|
|
@@ -12280,8 +12434,8 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12280
12434
|
throw new Error(`Send failed: ${error}`);
|
|
12281
12435
|
}
|
|
12282
12436
|
}
|
|
12283
|
-
async
|
|
12284
|
-
if (!this.
|
|
12437
|
+
async getDelegateManager() {
|
|
12438
|
+
if (!this.hasDelegate) {
|
|
12285
12439
|
return void 0;
|
|
12286
12440
|
}
|
|
12287
12441
|
const wallet = this;
|
|
@@ -12331,6 +12485,10 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12331
12485
|
};
|
|
12332
12486
|
return manager;
|
|
12333
12487
|
}
|
|
12488
|
+
/** @deprecated alias for @see ServiceWorkerWallet.getDelegateManager */
|
|
12489
|
+
async getDelegatorManager() {
|
|
12490
|
+
return await this.getDelegateManager();
|
|
12491
|
+
}
|
|
12334
12492
|
async getVtxoManager() {
|
|
12335
12493
|
const wallet = this;
|
|
12336
12494
|
const messageTag = this.messageTag;
|
|
@@ -12385,11 +12543,12 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
12385
12543
|
throw new Error(`Failed to get expiring vtxos: ${e}`);
|
|
12386
12544
|
}
|
|
12387
12545
|
},
|
|
12388
|
-
async renewVtxos(eventCallback) {
|
|
12546
|
+
async renewVtxos(eventCallback, options) {
|
|
12389
12547
|
const message = {
|
|
12390
12548
|
tag: messageTag,
|
|
12391
12549
|
type: "RENEW_VTXOS",
|
|
12392
|
-
id: getRandomId()
|
|
12550
|
+
id: getRandomId(),
|
|
12551
|
+
payload: options
|
|
12393
12552
|
};
|
|
12394
12553
|
try {
|
|
12395
12554
|
const response = await wallet.sendMessageWithEvents(
|
|
@@ -12454,7 +12613,6 @@ var OnchainWallet = class _OnchainWallet {
|
|
|
12454
12613
|
* @param networkName - Bitcoin network name, @see NetworkName
|
|
12455
12614
|
* @param provider - Optional onchain provider override, @see OnchainProvider
|
|
12456
12615
|
* @returns Configured onchain wallet
|
|
12457
|
-
* @defaultValue `provider = new EsploraProvider('https://mempool.space/api')`
|
|
12458
12616
|
* @throws Error if the configured identity cannot produce a valid x-only public key
|
|
12459
12617
|
*/
|
|
12460
12618
|
static async create(identity, networkName = DEFAULT_NETWORK_NAME, provider) {
|
|
@@ -13780,7 +13938,7 @@ function contractFromArkContract(encoded, options = {}) {
|
|
|
13780
13938
|
metadata: options.metadata
|
|
13781
13939
|
};
|
|
13782
13940
|
}
|
|
13783
|
-
function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix =
|
|
13941
|
+
function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = DEFAULT_NETWORK.hrp, options = {}) {
|
|
13784
13942
|
const parsed = decodeArkContract(encoded);
|
|
13785
13943
|
const handler = contractHandlers.getOrThrow(parsed.type);
|
|
13786
13944
|
const params = parsed.data;
|
|
@@ -13800,6 +13958,6 @@ function isArkContract(str) {
|
|
|
13800
13958
|
return str.startsWith(ARKCONTRACT_PREFIX + "=");
|
|
13801
13959
|
}
|
|
13802
13960
|
|
|
13803
|
-
export { ArkNote, BIP322, Batch, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, 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, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, 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, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, migrateWalletRepository,
|
|
13804
|
-
//# sourceMappingURL=chunk-
|
|
13805
|
-
//# sourceMappingURL=chunk-
|
|
13961
|
+
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 };
|
|
13962
|
+
//# sourceMappingURL=chunk-6NY27WL6.js.map
|
|
13963
|
+
//# sourceMappingURL=chunk-6NY27WL6.js.map
|