@arkade-os/sdk 0.4.61 → 0.4.62
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/{asyncStorageTaskQueue-BWDxp3Dr.d.cts → asyncStorageTaskQueue-B53mOTCw.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-Cq9FpKv6.d.ts → asyncStorageTaskQueue-Df-CTfTE.d.ts} +1 -1
- package/dist/{chunk-AUEXB42T.js → chunk-2IZW6AEK.js} +247 -84
- package/dist/chunk-2IZW6AEK.js.map +1 -0
- package/dist/{chunk-SF5NKAUA.cjs → chunk-G53HASDV.cjs} +48 -48
- package/dist/{chunk-SF5NKAUA.cjs.map → chunk-G53HASDV.cjs.map} +1 -1
- package/dist/{chunk-GDI2A65Z.js → chunk-H2ZAJOQA.js} +4 -4
- package/dist/{chunk-GDI2A65Z.js.map → chunk-H2ZAJOQA.js.map} +1 -1
- package/dist/{chunk-2JHN5RCY.cjs → chunk-I6EDUE75.cjs} +17 -17
- package/dist/{chunk-2JHN5RCY.cjs.map → chunk-I6EDUE75.cjs.map} +1 -1
- package/dist/{chunk-XLHN5L2O.js → chunk-I7RLG6VX.js} +4 -4
- package/dist/{chunk-XLHN5L2O.js.map → chunk-I7RLG6VX.js.map} +1 -1
- package/dist/{chunk-6O5OLYTZ.js → chunk-L7S5KC5B.js} +3 -3
- package/dist/{chunk-6O5OLYTZ.js.map → chunk-L7S5KC5B.js.map} +1 -1
- package/dist/{chunk-FNCQJLR2.cjs → chunk-OH2XLTXE.cjs} +3 -3
- package/dist/{chunk-FNCQJLR2.cjs.map → chunk-OH2XLTXE.cjs.map} +1 -1
- package/dist/{chunk-XMRB74HA.cjs → chunk-PWWA4DBL.cjs} +10 -10
- package/dist/{chunk-XMRB74HA.cjs.map → chunk-PWWA4DBL.cjs.map} +1 -1
- package/dist/{chunk-XFYFREPH.cjs → chunk-QRSR4HV4.cjs} +17 -17
- package/dist/{chunk-XFYFREPH.cjs.map → chunk-QRSR4HV4.cjs.map} +1 -1
- package/dist/{chunk-YVQNHELA.js → chunk-RMBI6P4N.js} +3 -3
- package/dist/{chunk-YVQNHELA.js.map → chunk-RMBI6P4N.js.map} +1 -1
- package/dist/{chunk-PVY6DMN5.js → chunk-URT2RVGB.js} +3 -3
- package/dist/{chunk-PVY6DMN5.js.map → chunk-URT2RVGB.js.map} +1 -1
- package/dist/{chunk-3NUDA3MB.cjs → chunk-Z2OZMKFV.cjs} +641 -476
- package/dist/chunk-Z2OZMKFV.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-BySzD37I.d.ts → delegate-BjYJJsml.d.ts} +1 -1
- package/dist/{delegate-C4Rl6h9l.d.cts → delegate-CC1gcvuC.d.cts} +1 -1
- package/dist/{index-C29VNcxC.d.ts → index-C888wFEV.d.ts} +2 -2
- package/dist/{index-BcRCHnzN.d.cts → index-CwBr7qzV.d.cts} +71 -12
- package/dist/{index-BcRCHnzN.d.ts → index-CwBr7qzV.d.ts} +71 -12
- package/dist/{index-Butfkm-K.d.cts → index-Cz5_WaQP.d.cts} +2 -2
- package/dist/index.cjs +274 -266
- package/dist/index.d.cts +105 -19
- package/dist/index.d.ts +105 -19
- 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-BTq3rMpI.d.cts → taskRunner-BMUndClz.d.cts} +1 -1
- package/dist/{taskRunner-DxMJYJ7Y.d.ts → taskRunner-DZWUsSzA.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 +16 -16
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +5 -5
- package/dist/wallet/expo/index.d.ts +5 -5
- package/dist/wallet/expo/index.js +7 -7
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-DrSsUden.d.cts → wallet-Dpjx6CJ7.d.ts} +14 -5
- package/dist/{wallet-BVIfg2ic.d.ts → wallet-H3f14est.d.cts} +14 -5
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-3NUDA3MB.cjs.map +0 -1
- package/dist/chunk-AUEXB42T.js.map +0 -1
package/dist/adapters/expo.cjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkQRSR4HV4_cjs = require('../chunk-QRSR4HV4.cjs');
|
|
4
|
+
require('../chunk-I6EDUE75.cjs');
|
|
5
|
+
require('../chunk-OH2XLTXE.cjs');
|
|
6
6
|
require('../chunk-5BLDMQED.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "ExpoArkProvider", {
|
|
11
11
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
12
|
+
get: function () { return chunkQRSR4HV4_cjs.ExpoArkProvider; }
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "ExpoIndexerProvider", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkQRSR4HV4_cjs.ExpoIndexerProvider; }
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=expo.cjs.map
|
|
19
19
|
//# sourceMappingURL=expo.cjs.map
|
package/dist/adapters/expo.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { l as RestArkProvider, i as SettlementEvent, T as TxNotification, m as RestIndexerProvider, n as SubscriptionResponse } from '../index-CwBr7qzV.cjs';
|
|
2
|
+
export { o as ArkProvider, p as IndexerProvider } from '../index-CwBr7qzV.cjs';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/transaction.js';
|
|
5
5
|
import '@scure/btc-signer';
|
package/dist/adapters/expo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { l as RestArkProvider, i as SettlementEvent, T as TxNotification, m as RestIndexerProvider, n as SubscriptionResponse } from '../index-CwBr7qzV.js';
|
|
2
|
+
export { o as ArkProvider, p as IndexerProvider } from '../index-CwBr7qzV.js';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/transaction.js';
|
|
5
5
|
import '@scure/btc-signer';
|
package/dist/adapters/expo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { ExpoArkProvider, ExpoIndexerProvider } from '../chunk-H2ZAJOQA.js';
|
|
2
|
+
import '../chunk-RMBI6P4N.js';
|
|
3
|
+
import '../chunk-URT2RVGB.js';
|
|
4
4
|
import '../chunk-NSBPE2FW.js';
|
|
5
5
|
//# sourceMappingURL=expo.js.map
|
|
6
6
|
//# sourceMappingURL=expo.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
3
|
+
var chunkZ2OZMKFV_cjs = require('../chunk-Z2OZMKFV.cjs');
|
|
4
|
+
require('../chunk-I6EDUE75.cjs');
|
|
5
|
+
require('../chunk-G53HASDV.cjs');
|
|
6
|
+
require('../chunk-OH2XLTXE.cjs');
|
|
7
7
|
require('../chunk-5BLDMQED.cjs');
|
|
8
8
|
|
|
9
9
|
// src/storage/indexedDB.ts
|
|
@@ -11,7 +11,7 @@ var IndexedDBStorageAdapter = class {
|
|
|
11
11
|
dbName;
|
|
12
12
|
version;
|
|
13
13
|
db = null;
|
|
14
|
-
constructor(dbName, version =
|
|
14
|
+
constructor(dbName, version = chunkZ2OZMKFV_cjs.DB_VERSION) {
|
|
15
15
|
this.dbName = dbName;
|
|
16
16
|
this.version = version;
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DB_VERSION } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
1
|
+
import { DB_VERSION } from '../chunk-2IZW6AEK.js';
|
|
2
|
+
import '../chunk-RMBI6P4N.js';
|
|
3
|
+
import '../chunk-L7S5KC5B.js';
|
|
4
|
+
import '../chunk-URT2RVGB.js';
|
|
5
5
|
import '../chunk-NSBPE2FW.js';
|
|
6
6
|
|
|
7
7
|
// src/storage/indexedDB.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-
|
|
2
|
-
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, parseHDDescriptor, DefaultVtxo, speculativeReceiveMetadata, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler, identityDescriptor } from './chunk-
|
|
3
|
-
import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, resolveEmulatorPubkey, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, RestArkProvider, toVirtualStatus, ArkError, resolveTimeHeight, canSpendOffchain, parseLegacyExpiry, isExpired, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError, networks as networks$1, isPastExpiry, fetchVtxoCreatedAtByTxid } from './chunk-
|
|
1
|
+
import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-RMBI6P4N.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, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, parseHDDescriptor, DefaultVtxo, speculativeReceiveMetadata, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler, identityDescriptor } from './chunk-L7S5KC5B.js';
|
|
3
|
+
import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, resolveEmulatorPubkey, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, isEventSourceError, isEventSourceUnavailableError, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, RestArkProvider, toVirtualStatus, ArkError, TapTreeCoder, resolveTimeHeight, canSpendOffchain, parseLegacyExpiry, isExpired, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError, networks as networks$1, isPastExpiry, fetchVtxoCreatedAtByTxid } from './chunk-URT2RVGB.js';
|
|
4
4
|
import { __export } from './chunk-NSBPE2FW.js';
|
|
5
5
|
import { sha256 as sha256$1, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
|
|
6
6
|
import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
|
|
@@ -332,6 +332,18 @@ var SingleKey = class _SingleKey {
|
|
|
332
332
|
if (signatureType === "ecdsa") return signAsync(message, this.key, { prehash: false });
|
|
333
333
|
return schnorr$1.signAsync(message, this.key);
|
|
334
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
|
|
337
|
+
* anything derived from it — is reproducible from the key alone.
|
|
338
|
+
*
|
|
339
|
+
* What lets a static wallet derive a swap preimage instead of storing one
|
|
340
|
+
* (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
|
|
341
|
+
* schnorr branch draws a random aux_rand: a preimage derived from that is
|
|
342
|
+
* unrecoverable, and the loss would only surface at claim time.
|
|
343
|
+
*/
|
|
344
|
+
async signSchnorrDeterministic(messageHash) {
|
|
345
|
+
return schnorr$1.signAsync(messageHash, this.key, new Uint8Array(32));
|
|
346
|
+
}
|
|
335
347
|
async toReadonly() {
|
|
336
348
|
return new ReadonlySingleKey(await this.compressedPublicKey());
|
|
337
349
|
}
|
|
@@ -461,6 +473,19 @@ var SeedIdentity = class _SeedIdentity {
|
|
|
461
473
|
async signMessage(message, signatureType = "schnorr") {
|
|
462
474
|
return this.signMessageWithKey(this.derivedKey, message, signatureType);
|
|
463
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0.
|
|
478
|
+
*
|
|
479
|
+
* The descriptor-less sibling of
|
|
480
|
+
* {@link signSchnorrDeterministicWithDescriptor}, for an `auto`-mode wallet
|
|
481
|
+
* whose bare `tr(pubkey)` resolves to the identity itself rather than to a
|
|
482
|
+
* {@link DescriptorIdentity}. Deliberately NOT routed through
|
|
483
|
+
* `signMessage`, whose schnorr branch draws a random aux_rand and would
|
|
484
|
+
* make the "deterministic" signature unreproducible.
|
|
485
|
+
*/
|
|
486
|
+
async signSchnorrDeterministic(messageHash) {
|
|
487
|
+
return schnorr$1.signAsync(messageHash, this.derivedKey, new Uint8Array(32));
|
|
488
|
+
}
|
|
464
489
|
signerSession() {
|
|
465
490
|
return TreeSignerSession.random();
|
|
466
491
|
}
|
|
@@ -1239,6 +1264,7 @@ var sha256 = /* @__PURE__ */ createHasher(
|
|
|
1239
1264
|
/* @__PURE__ */ oidNist(1)
|
|
1240
1265
|
);
|
|
1241
1266
|
var ARKADE_SWAP_PREIMAGE_TAG = "Arkade-RFQ-Preimage-v1";
|
|
1267
|
+
var ARKADE_SALTED_PREIMAGE_TAG = "Arkade-Contract-Preimage-Salted-v1";
|
|
1242
1268
|
function buildPreimageMessage(xonly, index) {
|
|
1243
1269
|
if (xonly.length !== 32) {
|
|
1244
1270
|
throw new Error(`x-only pubkey must be 32 bytes, got ${xonly.length}`);
|
|
@@ -1253,6 +1279,20 @@ function buildPreimageMessage(xonly, index) {
|
|
|
1253
1279
|
new DataView(message.buffer).setUint32(tag.length + 32, index, true);
|
|
1254
1280
|
return message;
|
|
1255
1281
|
}
|
|
1282
|
+
function buildSaltedPreimageMessage(xonly, salt) {
|
|
1283
|
+
if (xonly.length !== 32) {
|
|
1284
|
+
throw new Error(`x-only pubkey must be 32 bytes, got ${xonly.length}`);
|
|
1285
|
+
}
|
|
1286
|
+
if (salt.length !== 32) {
|
|
1287
|
+
throw new Error(`preimage salt must be 32 bytes, got ${salt.length}`);
|
|
1288
|
+
}
|
|
1289
|
+
const tag = new TextEncoder().encode(ARKADE_SALTED_PREIMAGE_TAG);
|
|
1290
|
+
const message = new Uint8Array(tag.length + 32 + 32);
|
|
1291
|
+
message.set(tag, 0);
|
|
1292
|
+
message.set(xonly, tag.length);
|
|
1293
|
+
message.set(salt, tag.length + 32);
|
|
1294
|
+
return message;
|
|
1295
|
+
}
|
|
1256
1296
|
var PREIMAGE_INDEX = 0;
|
|
1257
1297
|
function isPerArtifactDescriptor(descriptor) {
|
|
1258
1298
|
return parseHDDescriptor(descriptor) !== null;
|
|
@@ -1271,14 +1311,36 @@ async function provisionClaimSecret(wallet, opts = {}) {
|
|
|
1271
1311
|
throw new Error(`preimage must be 32 bytes, got ${opts.preimage.length}`);
|
|
1272
1312
|
}
|
|
1273
1313
|
const { descriptor, pubkey } = await provisionRefundKey(wallet);
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1314
|
+
const claim = async () => {
|
|
1315
|
+
if (opts.preimage) return { preimage: opts.preimage, mustPersistPreimage: true };
|
|
1316
|
+
if (isPerArtifactDescriptor(descriptor)) {
|
|
1317
|
+
return {
|
|
1318
|
+
preimage: await derivePreimage(wallet, descriptor),
|
|
1319
|
+
mustPersistPreimage: false
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
const preimageSalt2 = randomBytes(32);
|
|
1323
|
+
try {
|
|
1324
|
+
return {
|
|
1325
|
+
preimage: await derivePreimage(wallet, descriptor, preimageSalt2),
|
|
1326
|
+
preimageSalt: preimageSalt2,
|
|
1327
|
+
mustPersistPreimage: false
|
|
1328
|
+
};
|
|
1329
|
+
} catch (cause) {
|
|
1330
|
+
if (cause instanceof ForeignDescriptorError || cause instanceof WalletCannotSignError) {
|
|
1331
|
+
throw cause;
|
|
1332
|
+
}
|
|
1333
|
+
return { preimage: randomBytes(32), mustPersistPreimage: true };
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
const { preimage, preimageSalt, mustPersistPreimage } = await claim();
|
|
1276
1337
|
return {
|
|
1277
1338
|
descriptor,
|
|
1278
1339
|
pubkey,
|
|
1279
1340
|
preimage,
|
|
1280
1341
|
paymentHash: sha256(preimage),
|
|
1281
|
-
|
|
1342
|
+
...preimageSalt ? { preimageSalt } : {},
|
|
1343
|
+
mustPersistPreimage
|
|
1282
1344
|
};
|
|
1283
1345
|
}
|
|
1284
1346
|
async function contractSigner(wallet, descriptor) {
|
|
@@ -1302,33 +1364,33 @@ var WalletCannotSignError = class extends Error {
|
|
|
1302
1364
|
descriptor;
|
|
1303
1365
|
name = "WalletCannotSignError";
|
|
1304
1366
|
};
|
|
1305
|
-
async function contractPreimage(wallet, descriptor,
|
|
1306
|
-
if (stored) {
|
|
1307
|
-
if (stored.length !== 32) {
|
|
1308
|
-
throw new Error(`stored preimage must be 32 bytes, got ${stored.length}`);
|
|
1367
|
+
async function contractPreimage(wallet, descriptor, opts = {}) {
|
|
1368
|
+
if (opts.stored) {
|
|
1369
|
+
if (opts.stored.length !== 32) {
|
|
1370
|
+
throw new Error(`stored preimage must be 32 bytes, got ${opts.stored.length}`);
|
|
1309
1371
|
}
|
|
1310
|
-
return stored;
|
|
1311
|
-
}
|
|
1312
|
-
if (!isPerArtifactDescriptor(descriptor)) {
|
|
1313
|
-
throw new Error(
|
|
1314
|
-
`descriptor ${descriptor} names no single artifact, so its preimage cannot be derived; none was stored`
|
|
1315
|
-
);
|
|
1372
|
+
return opts.stored;
|
|
1316
1373
|
}
|
|
1317
|
-
return derivePreimage(wallet, descriptor);
|
|
1374
|
+
if (isPerArtifactDescriptor(descriptor)) return derivePreimage(wallet, descriptor);
|
|
1375
|
+
if (opts.salt) return derivePreimage(wallet, descriptor, opts.salt);
|
|
1376
|
+
throw new Error(
|
|
1377
|
+
`descriptor ${descriptor} names no single artifact, so its preimage cannot be derived; no salt and no stored preimage were given`
|
|
1378
|
+
);
|
|
1318
1379
|
}
|
|
1319
1380
|
function isDeterministicSigner(value) {
|
|
1320
1381
|
if (typeof value !== "object" || value === null) return false;
|
|
1321
1382
|
const v = value;
|
|
1322
1383
|
return typeof v.signSchnorrDeterministic === "function" && typeof v.xOnlyPublicKey === "function";
|
|
1323
1384
|
}
|
|
1324
|
-
async function derivePreimage(wallet, descriptor) {
|
|
1385
|
+
async function derivePreimage(wallet, descriptor, salt) {
|
|
1325
1386
|
const signer = await contractSigner(wallet, descriptor);
|
|
1326
1387
|
if (!isDeterministicSigner(signer)) {
|
|
1327
1388
|
throw new Error(
|
|
1328
1389
|
`wallet cannot sign deterministically for ${descriptor}; its preimage is not derivable`
|
|
1329
1390
|
);
|
|
1330
1391
|
}
|
|
1331
|
-
const
|
|
1392
|
+
const xonly = await signer.xOnlyPublicKey();
|
|
1393
|
+
const message = salt ? buildSaltedPreimageMessage(xonly, salt) : buildPreimageMessage(xonly, PREIMAGE_INDEX);
|
|
1332
1394
|
try {
|
|
1333
1395
|
return sha256(await signer.signSchnorrDeterministic(sha256(message)));
|
|
1334
1396
|
} catch (cause) {
|
|
@@ -3554,6 +3616,21 @@ function assertRecipientArkAddress(encoded, address, context) {
|
|
|
3554
3616
|
);
|
|
3555
3617
|
}
|
|
3556
3618
|
}
|
|
3619
|
+
function assertTapTreeDerivesAddress(encoded, tapTree, address) {
|
|
3620
|
+
let derived;
|
|
3621
|
+
try {
|
|
3622
|
+
derived = VtxoScript.decode(tapTree).pkScript;
|
|
3623
|
+
} catch (e) {
|
|
3624
|
+
throw new Error(
|
|
3625
|
+
`Invalid tapTree for ${encoded}: ${e instanceof Error ? e.message : String(e)}`
|
|
3626
|
+
);
|
|
3627
|
+
}
|
|
3628
|
+
if (hex.encode(derived) !== hex.encode(address.pkScript)) {
|
|
3629
|
+
throw new Error(
|
|
3630
|
+
`Invalid tapTree for ${encoded}: derives ${hex.encode(derived)}, address is ${hex.encode(address.pkScript)}. Expected VtxoScript.encode() form: leaf depths are ignored and the tree is rebuilt in arkd's canonical shape.`
|
|
3631
|
+
);
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3557
3634
|
function validateRecipients(recipients, dustAmount, context) {
|
|
3558
3635
|
const validatedRecipients = [];
|
|
3559
3636
|
for (const recipient of recipients) {
|
|
@@ -3568,11 +3645,15 @@ function validateRecipients(recipients, dustAmount, context) {
|
|
|
3568
3645
|
if (amount <= 0) {
|
|
3569
3646
|
throw new Error("Amount must be positive");
|
|
3570
3647
|
}
|
|
3648
|
+
if (recipient.tapTree) {
|
|
3649
|
+
assertTapTreeDerivesAddress(recipient.address, recipient.tapTree, address);
|
|
3650
|
+
}
|
|
3571
3651
|
validatedRecipients.push({
|
|
3572
3652
|
address: recipient.address,
|
|
3573
3653
|
assets: recipient.assets ?? [],
|
|
3574
3654
|
amount,
|
|
3575
|
-
script: amount < dustAmount ? address.subdustPkScript : address.pkScript
|
|
3655
|
+
script: amount < dustAmount ? address.subdustPkScript : address.pkScript,
|
|
3656
|
+
tapTree: recipient.tapTree
|
|
3576
3657
|
});
|
|
3577
3658
|
}
|
|
3578
3659
|
return validatedRecipients;
|
|
@@ -11764,6 +11845,8 @@ function computeOffchainBalance(vtxos, caps) {
|
|
|
11764
11845
|
let settled = 0;
|
|
11765
11846
|
let preconfirmed = 0;
|
|
11766
11847
|
let available = 0;
|
|
11848
|
+
let gated = 0;
|
|
11849
|
+
let intentLocked = 0;
|
|
11767
11850
|
let recoverable = 0;
|
|
11768
11851
|
let pendingRecovery = 0;
|
|
11769
11852
|
const owned = /* @__PURE__ */ new Map();
|
|
@@ -11790,7 +11873,11 @@ function computeOffchainBalance(vtxos, caps) {
|
|
|
11790
11873
|
} else {
|
|
11791
11874
|
settled += vtxo.value;
|
|
11792
11875
|
}
|
|
11793
|
-
if (isGenericallySpendable(vtxo)
|
|
11876
|
+
if (!isGenericallySpendable(vtxo)) {
|
|
11877
|
+
gated += vtxo.value;
|
|
11878
|
+
} else if (!isUnlocked(vtxo)) {
|
|
11879
|
+
intentLocked += vtxo.value;
|
|
11880
|
+
} else {
|
|
11794
11881
|
available += vtxo.value;
|
|
11795
11882
|
addAssets(spendable, vtxo);
|
|
11796
11883
|
}
|
|
@@ -11800,6 +11887,8 @@ function computeOffchainBalance(vtxos, caps) {
|
|
|
11800
11887
|
settled,
|
|
11801
11888
|
preconfirmed,
|
|
11802
11889
|
available,
|
|
11890
|
+
gated,
|
|
11891
|
+
intentLocked,
|
|
11803
11892
|
recoverable,
|
|
11804
11893
|
pendingRecovery,
|
|
11805
11894
|
total: settled + preconfirmed + recoverable + pendingRecovery,
|
|
@@ -11956,6 +12045,17 @@ function intentProofJobs(coins) {
|
|
|
11956
12045
|
}));
|
|
11957
12046
|
return [{ index: 0, lookupScript: coinJobs[0].lookupScript }, ...coinJobs];
|
|
11958
12047
|
}
|
|
12048
|
+
function asSendParams(args) {
|
|
12049
|
+
const [first] = args;
|
|
12050
|
+
if (args.length === 1 && first && "recipients" in first) {
|
|
12051
|
+
const params = first;
|
|
12052
|
+
if (params.recipients.length === 0) {
|
|
12053
|
+
throw new Error("At least one receiver is required");
|
|
12054
|
+
}
|
|
12055
|
+
return params;
|
|
12056
|
+
}
|
|
12057
|
+
return { recipients: args };
|
|
12058
|
+
}
|
|
11959
12059
|
function extractArkProviderUrl(provider) {
|
|
11960
12060
|
const serverUrl = provider.serverUrl;
|
|
11961
12061
|
return typeof serverUrl === "string" && serverUrl.length > 0 ? serverUrl : void 0;
|
|
@@ -12552,6 +12652,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
12552
12652
|
settled: offchain.settled,
|
|
12553
12653
|
preconfirmed: offchain.preconfirmed,
|
|
12554
12654
|
available: offchain.available,
|
|
12655
|
+
gated: offchain.gated,
|
|
12656
|
+
intentLocked: offchain.intentLocked,
|
|
12555
12657
|
recoverable: offchain.recoverable,
|
|
12556
12658
|
pendingRecovery: offchain.pendingRecovery,
|
|
12557
12659
|
total: totalBoarding + offchain.total,
|
|
@@ -15291,10 +15393,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
15291
15393
|
return total;
|
|
15292
15394
|
}
|
|
15293
15395
|
/**
|
|
15294
|
-
* Send BTC and/or assets to one or more recipients
|
|
15396
|
+
* Send BTC and/or assets to one or more recipients, passed either as
|
|
15397
|
+
* variadic `Recipient`s or as a single `SendParams` object — the latter
|
|
15398
|
+
* also carries the virtual outputs to spend.
|
|
15295
15399
|
*
|
|
15296
|
-
* @param args - Recipients
|
|
15400
|
+
* @param args - Recipients, or a `SendParams` object
|
|
15297
15401
|
* @returns Promise resolving to the Arkade transaction ID
|
|
15402
|
+
* @see SendParams
|
|
15298
15403
|
*
|
|
15299
15404
|
* @example
|
|
15300
15405
|
* ```typescript
|
|
@@ -15303,15 +15408,28 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
15303
15408
|
* amount: 1000, // (optional, default to dust) btc amount to send to the output
|
|
15304
15409
|
* assets: [{ assetId: 'abc123...', amount: 50n }] // (optional) list of assets to send
|
|
15305
15410
|
* });
|
|
15411
|
+
*
|
|
15412
|
+
* // choosing the inputs as well as the outputs
|
|
15413
|
+
* const txid = await wallet.send({
|
|
15414
|
+
* recipients: [{ address: 'ark1q...', amount: 1000 }],
|
|
15415
|
+
* selectedVtxos: mine, // spent as given, nothing added
|
|
15416
|
+
* });
|
|
15306
15417
|
* ```
|
|
15307
15418
|
*/
|
|
15308
15419
|
async send(...args) {
|
|
15309
|
-
|
|
15420
|
+
const params = asSendParams(args);
|
|
15421
|
+
return this._withTxLock(() => this._sendImpl(params));
|
|
15310
15422
|
}
|
|
15311
|
-
async _sendImpl(
|
|
15423
|
+
async _sendImpl({ recipients: args, selectedVtxos }) {
|
|
15312
15424
|
if (args.length === 0) {
|
|
15313
15425
|
throw new Error("At least one receiver is required");
|
|
15314
15426
|
}
|
|
15427
|
+
if (selectedVtxos && selectedVtxos.length === 0) {
|
|
15428
|
+
throw new Error("send({ selectedVtxos }): no inputs");
|
|
15429
|
+
}
|
|
15430
|
+
if (selectedVtxos) {
|
|
15431
|
+
void this.logUngatedInputs("send({ selectedVtxos })", selectedVtxos);
|
|
15432
|
+
}
|
|
15315
15433
|
const offchainTapscript = this.offchainTapscript;
|
|
15316
15434
|
const serverPubKey = this.arkServerPublicKey;
|
|
15317
15435
|
const serverUnrollScript = this.serverUnrollScript;
|
|
@@ -15322,84 +15440,123 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
15322
15440
|
Number(this.dustAmount),
|
|
15323
15441
|
this.recipientAddressContext(serverPubKey)
|
|
15324
15442
|
);
|
|
15325
|
-
|
|
15326
|
-
|
|
15327
|
-
|
|
15443
|
+
let virtualCoins = [];
|
|
15444
|
+
if (!selectedVtxos) {
|
|
15445
|
+
virtualCoins = await this.getSpendableVtxos({
|
|
15446
|
+
withRecoverable: false
|
|
15447
|
+
});
|
|
15448
|
+
}
|
|
15328
15449
|
const assetChanges = /* @__PURE__ */ new Map();
|
|
15329
|
-
let selectedCoins = [];
|
|
15450
|
+
let selectedCoins = selectedVtxos ? [...selectedVtxos] : [];
|
|
15330
15451
|
let btcAmountToSelect = 0;
|
|
15331
15452
|
for (const recipient of recipients) {
|
|
15332
15453
|
btcAmountToSelect += Math.max(recipient.amount, Number(this.dustAmount));
|
|
15333
15454
|
}
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15455
|
+
if (selectedVtxos) {
|
|
15456
|
+
for (const coin of selectedCoins) {
|
|
15457
|
+
for (const asset of coin.assets ?? []) {
|
|
15458
|
+
const existing = assetChanges.get(asset.assetId) ?? 0n;
|
|
15459
|
+
assetChanges.set(asset.assetId, existing + asset.amount);
|
|
15460
|
+
}
|
|
15337
15461
|
}
|
|
15338
|
-
for (const
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15462
|
+
for (const recipient of recipients) {
|
|
15463
|
+
for (const asset of recipient.assets) {
|
|
15464
|
+
const remaining = (assetChanges.get(asset.assetId) ?? 0n) - asset.amount;
|
|
15465
|
+
if (remaining < 0n) {
|
|
15466
|
+
throw new Error(
|
|
15467
|
+
`send({ selectedVtxos }): inputs are short ${-remaining} of asset ${asset.assetId}`
|
|
15468
|
+
);
|
|
15469
|
+
}
|
|
15470
|
+
if (remaining === 0n) {
|
|
15471
|
+
assetChanges.delete(asset.assetId);
|
|
15472
|
+
} else {
|
|
15473
|
+
assetChanges.set(asset.assetId, remaining);
|
|
15345
15474
|
}
|
|
15475
|
+
}
|
|
15476
|
+
}
|
|
15477
|
+
} else {
|
|
15478
|
+
for (const recipient of recipients) {
|
|
15479
|
+
if (!recipient.assets) {
|
|
15346
15480
|
continue;
|
|
15347
15481
|
}
|
|
15348
|
-
|
|
15349
|
-
amountToSelect
|
|
15350
|
-
assetChanges.
|
|
15482
|
+
for (const receiverAsset of recipient.assets) {
|
|
15483
|
+
let amountToSelect = receiverAsset.amount;
|
|
15484
|
+
const existingChange = assetChanges.get(receiverAsset.assetId) ?? 0n;
|
|
15485
|
+
if (existingChange >= amountToSelect) {
|
|
15486
|
+
assetChanges.set(receiverAsset.assetId, existingChange - amountToSelect);
|
|
15487
|
+
if (assetChanges.get(receiverAsset.assetId) === 0n) {
|
|
15488
|
+
assetChanges.delete(receiverAsset.assetId);
|
|
15489
|
+
}
|
|
15490
|
+
continue;
|
|
15491
|
+
}
|
|
15492
|
+
if (existingChange > 0n) {
|
|
15493
|
+
amountToSelect -= existingChange;
|
|
15494
|
+
assetChanges.delete(receiverAsset.assetId);
|
|
15495
|
+
}
|
|
15496
|
+
const availableCoins = virtualCoins.filter(
|
|
15497
|
+
(c) => !selectedCoins.find((sc) => sc.txid === c.txid && sc.vout === c.vout)
|
|
15498
|
+
);
|
|
15499
|
+
const { selected, totalAssetAmount } = selectCoinsWithAsset(
|
|
15500
|
+
availableCoins,
|
|
15501
|
+
receiverAsset.assetId,
|
|
15502
|
+
amountToSelect
|
|
15503
|
+
);
|
|
15504
|
+
for (const coin of selected) {
|
|
15505
|
+
selectedCoins.push(coin);
|
|
15506
|
+
btcAmountToSelect -= coin.value;
|
|
15507
|
+
if (coin.assets) {
|
|
15508
|
+
for (const a of coin.assets) {
|
|
15509
|
+
if (a.assetId === receiverAsset.assetId) {
|
|
15510
|
+
continue;
|
|
15511
|
+
}
|
|
15512
|
+
const existing = assetChanges.get(a.assetId) ?? 0n;
|
|
15513
|
+
assetChanges.set(a.assetId, existing + a.amount);
|
|
15514
|
+
}
|
|
15515
|
+
}
|
|
15516
|
+
}
|
|
15517
|
+
const assetChangeAmount = totalAssetAmount - amountToSelect;
|
|
15518
|
+
if (assetChangeAmount > 0n) {
|
|
15519
|
+
const existing = assetChanges.get(receiverAsset.assetId) ?? 0n;
|
|
15520
|
+
assetChanges.set(receiverAsset.assetId, existing + assetChangeAmount);
|
|
15521
|
+
}
|
|
15351
15522
|
}
|
|
15523
|
+
}
|
|
15524
|
+
if (btcAmountToSelect > 0) {
|
|
15352
15525
|
const availableCoins = virtualCoins.filter(
|
|
15353
15526
|
(c) => !selectedCoins.find((sc) => sc.txid === c.txid && sc.vout === c.vout)
|
|
15354
15527
|
);
|
|
15355
|
-
const {
|
|
15356
|
-
|
|
15357
|
-
receiverAsset.assetId,
|
|
15358
|
-
amountToSelect
|
|
15359
|
-
);
|
|
15360
|
-
for (const coin of selected) {
|
|
15361
|
-
selectedCoins.push(coin);
|
|
15362
|
-
btcAmountToSelect -= coin.value;
|
|
15528
|
+
const { inputs: btcCoins } = selectVirtualCoins(availableCoins, btcAmountToSelect);
|
|
15529
|
+
for (const coin of btcCoins) {
|
|
15363
15530
|
if (coin.assets) {
|
|
15364
|
-
for (const
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
}
|
|
15368
|
-
const existing = assetChanges.get(a.assetId) ?? 0n;
|
|
15369
|
-
assetChanges.set(a.assetId, existing + a.amount);
|
|
15531
|
+
for (const asset of coin.assets) {
|
|
15532
|
+
const existing = assetChanges.get(asset.assetId) ?? 0n;
|
|
15533
|
+
assetChanges.set(asset.assetId, existing + asset.amount);
|
|
15370
15534
|
}
|
|
15371
15535
|
}
|
|
15372
15536
|
}
|
|
15373
|
-
|
|
15374
|
-
if (assetChangeAmount > 0n) {
|
|
15375
|
-
const existing = assetChanges.get(receiverAsset.assetId) ?? 0n;
|
|
15376
|
-
assetChanges.set(receiverAsset.assetId, existing + assetChangeAmount);
|
|
15377
|
-
}
|
|
15537
|
+
selectedCoins = [...selectedCoins, ...btcCoins];
|
|
15378
15538
|
}
|
|
15379
15539
|
}
|
|
15380
|
-
if (btcAmountToSelect > 0) {
|
|
15381
|
-
const availableCoins = virtualCoins.filter(
|
|
15382
|
-
(c) => !selectedCoins.find((sc) => sc.txid === c.txid && sc.vout === c.vout)
|
|
15383
|
-
);
|
|
15384
|
-
const { inputs: btcCoins } = selectVirtualCoins(availableCoins, btcAmountToSelect);
|
|
15385
|
-
for (const coin of btcCoins) {
|
|
15386
|
-
if (coin.assets) {
|
|
15387
|
-
for (const asset of coin.assets) {
|
|
15388
|
-
const existing = assetChanges.get(asset.assetId) ?? 0n;
|
|
15389
|
-
assetChanges.set(asset.assetId, existing + asset.amount);
|
|
15390
|
-
}
|
|
15391
|
-
}
|
|
15392
|
-
}
|
|
15393
|
-
selectedCoins = [...selectedCoins, ...btcCoins];
|
|
15394
|
-
}
|
|
15395
15540
|
let totalBtcSelected = selectedCoins.reduce((sum, c) => sum + c.value, 0);
|
|
15396
15541
|
const outputs = recipients.map((recipient) => ({
|
|
15397
15542
|
script: recipient.script,
|
|
15398
|
-
amount: BigInt(recipient.amount)
|
|
15543
|
+
amount: BigInt(recipient.amount),
|
|
15544
|
+
// Already checked against the recipient address in `validateRecipients`.
|
|
15545
|
+
...recipient.tapTree ? { tapTree: TapTreeCoder.decode(recipient.tapTree) } : {}
|
|
15399
15546
|
}));
|
|
15400
15547
|
const totalBtcOutput = outputs.reduce((sum, o) => sum + Number(o.amount), 0);
|
|
15401
15548
|
let changeAmount = totalBtcSelected - totalBtcOutput;
|
|
15549
|
+
if (changeAmount < 0) {
|
|
15550
|
+
throw new Error(
|
|
15551
|
+
`send({ selectedVtxos }): inputs total ${totalBtcSelected} sats, outputs need ${totalBtcOutput}`
|
|
15552
|
+
);
|
|
15553
|
+
}
|
|
15402
15554
|
if (assetChanges.size > 0 && changeAmount < Number(this.dustAmount)) {
|
|
15555
|
+
if (selectedVtxos) {
|
|
15556
|
+
throw new Error(
|
|
15557
|
+
`send({ selectedVtxos }): ${changeAmount} sats of change cannot carry ${assetChanges.size} asset change(s), needs ${this.dustAmount}`
|
|
15558
|
+
);
|
|
15559
|
+
}
|
|
15403
15560
|
const availableCoins = virtualCoins.filter(
|
|
15404
15561
|
(c) => !selectedCoins.find((sc) => sc.txid === c.txid && sc.vout === c.vout)
|
|
15405
15562
|
);
|
|
@@ -17162,8 +17319,8 @@ var WalletMessageHandler = class {
|
|
|
17162
17319
|
});
|
|
17163
17320
|
}
|
|
17164
17321
|
case "SEND": {
|
|
17165
|
-
const { recipients } = message.payload;
|
|
17166
|
-
const txid = await this.wallet.send(...recipients);
|
|
17322
|
+
const { recipients, selectedVtxos } = message.payload;
|
|
17323
|
+
const txid = await (selectedVtxos ? this.wallet.send({ recipients, selectedVtxos }) : this.wallet.send(...recipients));
|
|
17167
17324
|
return this.tagged({
|
|
17168
17325
|
id,
|
|
17169
17326
|
type: "SEND_SUCCESS",
|
|
@@ -17411,6 +17568,8 @@ var WalletMessageHandler = class {
|
|
|
17411
17568
|
settled: offchain.settled,
|
|
17412
17569
|
preconfirmed: offchain.preconfirmed,
|
|
17413
17570
|
available: offchain.available,
|
|
17571
|
+
gated: offchain.gated,
|
|
17572
|
+
intentLocked: offchain.intentLocked,
|
|
17414
17573
|
recoverable: offchain.recoverable,
|
|
17415
17574
|
pendingRecovery: offchain.pendingRecovery,
|
|
17416
17575
|
total: totalBoarding + offchain.total,
|
|
@@ -19034,12 +19193,16 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
19034
19193
|
throw error;
|
|
19035
19194
|
}
|
|
19036
19195
|
}
|
|
19037
|
-
async send(...
|
|
19196
|
+
async send(...args) {
|
|
19197
|
+
const [first] = args;
|
|
19198
|
+
const { recipients, selectedVtxos } = args.length === 1 && first && "recipients" in first ? first : { recipients: args, selectedVtxos: void 0 };
|
|
19038
19199
|
const message = {
|
|
19039
19200
|
tag: this.messageTag,
|
|
19040
19201
|
type: "SEND",
|
|
19041
19202
|
id: getRandomId(),
|
|
19042
|
-
|
|
19203
|
+
// Omitted rather than sent as `undefined`, so an older worker sees
|
|
19204
|
+
// exactly the payload it saw before.
|
|
19205
|
+
payload: selectedVtxos ? { recipients, selectedVtxos } : { recipients }
|
|
19043
19206
|
};
|
|
19044
19207
|
try {
|
|
19045
19208
|
const response = await this.sendMessage(message);
|
|
@@ -22591,6 +22754,6 @@ function createDefaultPaymentRouter(wallet) {
|
|
|
22591
22754
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
22592
22755
|
*/
|
|
22593
22756
|
|
|
22594
|
-
export { ARKADE_MAGIC, ARKADE_SWAP_PREIMAGE_TAG, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, gateExclusion, gatedContracts, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, isWatchedContract, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, onchainRail, openDatabase, outpointExclusion, outpointReasons, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
|
|
22595
|
-
//# sourceMappingURL=chunk-
|
|
22596
|
-
//# sourceMappingURL=chunk-
|
|
22757
|
+
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, gateExclusion, gatedContracts, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, isWatchedContract, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, onchainRail, openDatabase, outpointExclusion, outpointReasons, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
|
|
22758
|
+
//# sourceMappingURL=chunk-2IZW6AEK.js.map
|
|
22759
|
+
//# sourceMappingURL=chunk-2IZW6AEK.js.map
|