@arkade-os/sdk 0.4.51 → 0.4.53
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 +4 -2
- package/dist/adapters/expo.cjs +4 -4
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +2 -2
- package/dist/adapters/indexedDB.cjs +4 -4
- package/dist/adapters/indexedDB.js +3 -3
- package/dist/{ark-9V45Anrs.d.cts → ark-B69ugeJw.d.cts} +31 -3
- package/dist/{ark-9V45Anrs.d.ts → ark-B69ugeJw.d.ts} +31 -3
- package/dist/{asyncStorageTaskQueue-B6nXJv7m.d.cts → asyncStorageTaskQueue-B0SUQMXw.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-BZjR843B.d.ts → asyncStorageTaskQueue-DWqxuIAs.d.ts} +1 -1
- package/dist/{chunk-TS2MTRP4.js → chunk-3MMUKLCI.js} +59 -29
- package/dist/chunk-3MMUKLCI.js.map +1 -0
- package/dist/{chunk-6T5BBPKO.js → chunk-3XWDMLOI.js} +3 -3
- package/dist/{chunk-6T5BBPKO.js.map → chunk-3XWDMLOI.js.map} +1 -1
- package/dist/{chunk-6XF6ZATZ.cjs → chunk-3YC3LQ2E.cjs} +246 -213
- package/dist/chunk-3YC3LQ2E.cjs.map +1 -0
- package/dist/{chunk-5AT2NV5G.cjs → chunk-4GB73TRR.cjs} +11 -11
- package/dist/{chunk-5AT2NV5G.cjs.map → chunk-4GB73TRR.cjs.map} +1 -1
- package/dist/{chunk-4KGT3IP2.js → chunk-B4WZOJAI.js} +3 -3
- package/dist/{chunk-4KGT3IP2.js.map → chunk-B4WZOJAI.js.map} +1 -1
- package/dist/{chunk-3E4GDBYU.cjs → chunk-CZTQLA55.cjs} +7 -7
- package/dist/{chunk-3E4GDBYU.cjs.map → chunk-CZTQLA55.cjs.map} +1 -1
- package/dist/{chunk-LJQ2VQBE.cjs → chunk-IEMPH7J6.cjs} +52 -44
- package/dist/chunk-IEMPH7J6.cjs.map +1 -0
- package/dist/{chunk-3AOTJZQ4.js → chunk-LHYNNDY6.js} +3 -3
- package/dist/{chunk-3AOTJZQ4.js.map → chunk-LHYNNDY6.js.map} +1 -1
- package/dist/{chunk-FHDUEBBC.cjs → chunk-RNMLFY2V.cjs} +3 -3
- package/dist/{chunk-FHDUEBBC.cjs.map → chunk-RNMLFY2V.cjs.map} +1 -1
- package/dist/{chunk-MBSYQ3WX.js → chunk-UZLQUWYP.js} +52 -45
- package/dist/chunk-UZLQUWYP.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +7 -7
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +1 -1
- package/dist/{delegate-CJkolr2s.d.ts → delegate-BU-Cpyjw.d.ts} +1 -1
- package/dist/{delegate-tVTPM4fm.d.cts → delegate-C_Y2YrXC.d.cts} +1 -1
- package/dist/{index-B5Fdwzs_.d.ts → index-BWF-C9eh.d.ts} +2 -2
- package/dist/{index-BBAffp_8.d.cts → index-tzAInyiX.d.cts} +2 -2
- package/dist/index.cjs +169 -157
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +3 -3
- package/dist/repositories/realm/index.cjs +18 -18
- 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 +17 -17
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +4 -4
- package/dist/{taskRunner-4CrJaWHv.d.cts → taskRunner-B7svzMhT.d.cts} +1 -1
- package/dist/{taskRunner-TgdjRf_b.d.ts → taskRunner-nzJFH8qb.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- 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/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +13 -13
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +4 -4
- package/dist/{wallet-BBfhZx_Z.d.cts → wallet-B6Xiferv.d.cts} +16 -5
- package/dist/{wallet-CSSTN8Yc.d.ts → wallet-CuHAI-eW.d.ts} +16 -5
- package/dist/worker/expo/index.cjs +8 -8
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-6XF6ZATZ.cjs.map +0 -1
- package/dist/chunk-LJQ2VQBE.cjs.map +0 -1
- package/dist/chunk-MBSYQ3WX.js.map +0 -1
- package/dist/chunk-TS2MTRP4.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkRNMLFY2V_cjs = require('./chunk-RNMLFY2V.cjs');
|
|
4
|
+
var chunkIEMPH7J6_cjs = require('./chunk-IEMPH7J6.cjs');
|
|
5
5
|
var chunkE7HB3GKK_cjs = require('./chunk-E7HB3GKK.cjs');
|
|
6
6
|
var chunk5BLDMQED_cjs = require('./chunk-5BLDMQED.cjs');
|
|
7
7
|
var utils_js = require('@scure/btc-signer/utils.js');
|
|
@@ -185,7 +185,7 @@ var TreeSignerSession = class _TreeSignerSession {
|
|
|
185
185
|
noncesByPubkey.set(base.hex.encode(myPublicKey.subarray(1)), myNonce);
|
|
186
186
|
const tx = this.graph.find(txid);
|
|
187
187
|
if (!tx) throw new Error(`missing tx for txid ${txid}`);
|
|
188
|
-
const cosigners =
|
|
188
|
+
const cosigners = chunkRNMLFY2V_cjs.getArkPsbtFields(tx.root, 0, chunkRNMLFY2V_cjs.CosignerPublicKey).map(
|
|
189
189
|
(c) => base.hex.encode(c.key.subarray(1))
|
|
190
190
|
// xonly pubkey
|
|
191
191
|
);
|
|
@@ -237,7 +237,7 @@ var TreeSignerSession = class _TreeSignerSession {
|
|
|
237
237
|
if (!aggNonce) throw new Error("missing aggregate nonce");
|
|
238
238
|
const prevoutAmounts = [];
|
|
239
239
|
const prevoutScripts = [];
|
|
240
|
-
const cosigners =
|
|
240
|
+
const cosigners = chunkRNMLFY2V_cjs.getArkPsbtFields(g.root, 0, chunkRNMLFY2V_cjs.CosignerPublicKey).map((c) => c.key);
|
|
241
241
|
const { finalKey } = aggregateKeys(cosigners, true, {
|
|
242
242
|
taprootTweak: this.scriptRoot
|
|
243
243
|
});
|
|
@@ -416,7 +416,7 @@ var SeedIdentity = class _SeedIdentity {
|
|
|
416
416
|
let network;
|
|
417
417
|
if ("descriptor" in opts && typeof opts.descriptor === "string") {
|
|
418
418
|
descriptor = opts.descriptor;
|
|
419
|
-
network =
|
|
419
|
+
network = chunkIEMPH7J6_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
|
|
420
420
|
} else {
|
|
421
421
|
network = opts.isMainnet ?? true ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
|
|
422
422
|
descriptor = descriptorsScure.scriptExpressions.trBIP32({
|
|
@@ -501,7 +501,7 @@ var SeedIdentity = class _SeedIdentity {
|
|
|
501
501
|
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
502
502
|
*/
|
|
503
503
|
isOurs(descriptor) {
|
|
504
|
-
return
|
|
504
|
+
return chunkIEMPH7J6_cjs.descriptorIsOurs(descriptor, this.descriptor, utils_js.pubSchnorr(this.derivedKey));
|
|
505
505
|
}
|
|
506
506
|
/**
|
|
507
507
|
* Signs each request with the key derived from its descriptor.
|
|
@@ -538,7 +538,7 @@ var SeedIdentity = class _SeedIdentity {
|
|
|
538
538
|
}
|
|
539
539
|
// ── internal helpers ─────────────────────────────────────────────
|
|
540
540
|
derivePrivateKeyForDescriptor(descriptor) {
|
|
541
|
-
const network =
|
|
541
|
+
const network = chunkIEMPH7J6_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
|
|
542
542
|
const expansion = descriptorsScure.expand({ descriptor, network });
|
|
543
543
|
if (expansion.isRanged) {
|
|
544
544
|
throw new Error(
|
|
@@ -624,7 +624,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
|
|
|
624
624
|
*/
|
|
625
625
|
descriptor;
|
|
626
626
|
constructor(descriptor) {
|
|
627
|
-
const network =
|
|
627
|
+
const network = chunkIEMPH7J6_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
|
|
628
628
|
let expansion;
|
|
629
629
|
try {
|
|
630
630
|
expansion = descriptorsScure.expand({ descriptor, network, index: 0 });
|
|
@@ -674,7 +674,7 @@ var ReadonlyDescriptorIdentity = class _ReadonlyDescriptorIdentity {
|
|
|
674
674
|
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
675
675
|
*/
|
|
676
676
|
isOurs(descriptor) {
|
|
677
|
-
return
|
|
677
|
+
return chunkIEMPH7J6_cjs.descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
|
|
678
678
|
}
|
|
679
679
|
};
|
|
680
680
|
function serializeSeedOwnedSigningIdentity(identity) {
|
|
@@ -986,14 +986,14 @@ var RestDelegateProvider = class {
|
|
|
986
986
|
*/
|
|
987
987
|
async delegate(intent, forfeitTxs, options) {
|
|
988
988
|
const url = `${this.url}/v1/delegate`;
|
|
989
|
-
const response = await
|
|
989
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(url, {
|
|
990
990
|
method: "POST",
|
|
991
991
|
headers: {
|
|
992
992
|
"Content-Type": "application/json"
|
|
993
993
|
},
|
|
994
994
|
body: JSON.stringify({
|
|
995
995
|
intent: {
|
|
996
|
-
message:
|
|
996
|
+
message: chunkRNMLFY2V_cjs.Intent.encodeMessage(intent.message),
|
|
997
997
|
proof: intent.proof
|
|
998
998
|
},
|
|
999
999
|
forfeit_txs: forfeitTxs,
|
|
@@ -1013,7 +1013,7 @@ var RestDelegateProvider = class {
|
|
|
1013
1013
|
*/
|
|
1014
1014
|
async getDelegateInfo() {
|
|
1015
1015
|
const url = `${this.url}/v1/delegator/info`;
|
|
1016
|
-
const response = await
|
|
1016
|
+
const response = await chunkRNMLFY2V_cjs.rateGate.runHttp(url, () => chunkRNMLFY2V_cjs.baseFetch(url));
|
|
1017
1017
|
if (!response.ok) {
|
|
1018
1018
|
const errorText2 = await response.text();
|
|
1019
1019
|
throw new Error(`Failed to get delegate info: ${errorText2}`);
|
|
@@ -1049,14 +1049,14 @@ var EsploraProvider = class {
|
|
|
1049
1049
|
pollingInterval;
|
|
1050
1050
|
forcePolling;
|
|
1051
1051
|
async getCoins(address) {
|
|
1052
|
-
const response = await
|
|
1052
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/address/${address}/utxo`);
|
|
1053
1053
|
if (!response.ok) {
|
|
1054
1054
|
throw new Error(`Failed to fetch UTXOs: ${response.statusText}`);
|
|
1055
1055
|
}
|
|
1056
1056
|
return response.json();
|
|
1057
1057
|
}
|
|
1058
1058
|
async getFeeRate() {
|
|
1059
|
-
const response = await
|
|
1059
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/fee-estimates`);
|
|
1060
1060
|
if (response.status === 404) {
|
|
1061
1061
|
return void 0;
|
|
1062
1062
|
}
|
|
@@ -1077,7 +1077,7 @@ var EsploraProvider = class {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
async getTxOutspends(txid) {
|
|
1080
|
-
const response = await
|
|
1080
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/outspends`);
|
|
1081
1081
|
if (!response.ok) {
|
|
1082
1082
|
const error = await response.text();
|
|
1083
1083
|
throw new Error(`Failed to get transaction outspends: ${error}`);
|
|
@@ -1085,7 +1085,7 @@ var EsploraProvider = class {
|
|
|
1085
1085
|
return response.json();
|
|
1086
1086
|
}
|
|
1087
1087
|
async getTransactions(address) {
|
|
1088
|
-
const response = await
|
|
1088
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/address/${address}/txs`);
|
|
1089
1089
|
if (!response.ok) {
|
|
1090
1090
|
const error = await response.text();
|
|
1091
1091
|
throw new Error(`Failed to get transactions: ${error}`);
|
|
@@ -1093,7 +1093,7 @@ var EsploraProvider = class {
|
|
|
1093
1093
|
return response.json();
|
|
1094
1094
|
}
|
|
1095
1095
|
async getTxStatus(txid) {
|
|
1096
|
-
const txresponse = await
|
|
1096
|
+
const txresponse = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/tx/${txid}`);
|
|
1097
1097
|
if (!txresponse.ok) {
|
|
1098
1098
|
throw new Error(txresponse.statusText);
|
|
1099
1099
|
}
|
|
@@ -1101,7 +1101,7 @@ var EsploraProvider = class {
|
|
|
1101
1101
|
if (!tx.status.confirmed) {
|
|
1102
1102
|
return { confirmed: false };
|
|
1103
1103
|
}
|
|
1104
|
-
const response = await
|
|
1104
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/tx/${txid}/status`);
|
|
1105
1105
|
if (!response.ok) {
|
|
1106
1106
|
throw new Error(`Failed to get transaction status: ${response.statusText}`);
|
|
1107
1107
|
}
|
|
@@ -1185,7 +1185,7 @@ var EsploraProvider = class {
|
|
|
1185
1185
|
return stopFunc;
|
|
1186
1186
|
}
|
|
1187
1187
|
async getChainTip() {
|
|
1188
|
-
const tipBlocks = await
|
|
1188
|
+
const tipBlocks = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/blocks`);
|
|
1189
1189
|
if (!tipBlocks.ok) {
|
|
1190
1190
|
throw new Error(`Failed to get chain tip: ${tipBlocks.statusText}`);
|
|
1191
1191
|
}
|
|
@@ -1204,7 +1204,7 @@ var EsploraProvider = class {
|
|
|
1204
1204
|
};
|
|
1205
1205
|
}
|
|
1206
1206
|
async broadcastPackage(parent, child) {
|
|
1207
|
-
const response = await
|
|
1207
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/txs/package`, {
|
|
1208
1208
|
method: "POST",
|
|
1209
1209
|
headers: {
|
|
1210
1210
|
"Content-Type": "application/json"
|
|
@@ -1218,7 +1218,7 @@ var EsploraProvider = class {
|
|
|
1218
1218
|
return response.json();
|
|
1219
1219
|
}
|
|
1220
1220
|
async broadcastTx(tx) {
|
|
1221
|
-
const response = await
|
|
1221
|
+
const response = await chunkRNMLFY2V_cjs.baseFetch(`${this.baseUrl}/tx`, {
|
|
1222
1222
|
method: "POST",
|
|
1223
1223
|
headers: {
|
|
1224
1224
|
"Content-Type": "text/plain"
|
|
@@ -1380,7 +1380,7 @@ function findP2AOutput(tx) {
|
|
|
1380
1380
|
var CHILD_DUST_AMOUNT = 546;
|
|
1381
1381
|
function buildAnchorChild(params) {
|
|
1382
1382
|
const { parent, feeRate, fundingCoins, changeAddress, tapInternalKey, network } = params;
|
|
1383
|
-
const child = new
|
|
1383
|
+
const child = new chunkRNMLFY2V_cjs.Transaction({ version: 3, allowLegacyWitnessUtxo: true });
|
|
1384
1384
|
child.addInput(findP2AOutput(parent));
|
|
1385
1385
|
const estimator = TxWeightEstimator.create().addP2AInput();
|
|
1386
1386
|
for (const _ of fundingCoins) {
|
|
@@ -1428,7 +1428,7 @@ function buildForfeitTx(inputs, forfeitPkScript, txLocktime) {
|
|
|
1428
1428
|
);
|
|
1429
1429
|
}
|
|
1430
1430
|
function buildForfeitTxWithOutput(inputs, output, txLocktime) {
|
|
1431
|
-
const tx = new
|
|
1431
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({
|
|
1432
1432
|
version: 3,
|
|
1433
1433
|
lockTime: txLocktime
|
|
1434
1434
|
});
|
|
@@ -1504,7 +1504,7 @@ function validateVtxoTxGraph(graph, roundTransaction, sweepTapTreeRoot) {
|
|
|
1504
1504
|
if (previousScriptKey.length !== 32) {
|
|
1505
1505
|
throw new Error(`parent output ${childIndex} has invalid script`);
|
|
1506
1506
|
}
|
|
1507
|
-
const cosigners =
|
|
1507
|
+
const cosigners = chunkRNMLFY2V_cjs.getArkPsbtFields(child.root, 0, chunkRNMLFY2V_cjs.CosignerPublicKey);
|
|
1508
1508
|
if (cosigners.length === 0) {
|
|
1509
1509
|
throw ErrMissingCosignersPublicKeys;
|
|
1510
1510
|
}
|
|
@@ -1562,7 +1562,7 @@ var EmulatorPacket = class _EmulatorPacket {
|
|
|
1562
1562
|
return new _EmulatorPacket(entries);
|
|
1563
1563
|
}
|
|
1564
1564
|
static fromBytes(data) {
|
|
1565
|
-
const reader = new
|
|
1565
|
+
const reader = new chunkRNMLFY2V_cjs.BufferReader(data);
|
|
1566
1566
|
const entryCount = reader.readCompactSize();
|
|
1567
1567
|
const entries = [];
|
|
1568
1568
|
for (let i = 0; i < entryCount; i++) {
|
|
@@ -1580,7 +1580,7 @@ var EmulatorPacket = class _EmulatorPacket {
|
|
|
1580
1580
|
return _EmulatorPacket.PACKET_TYPE;
|
|
1581
1581
|
}
|
|
1582
1582
|
serialize() {
|
|
1583
|
-
const writer = new
|
|
1583
|
+
const writer = new chunkRNMLFY2V_cjs.BufferWriter();
|
|
1584
1584
|
writer.writeCompactSize(this.entries.length);
|
|
1585
1585
|
for (const entry of this.entries) {
|
|
1586
1586
|
writer.writeUint16LE(entry.vin);
|
|
@@ -1667,7 +1667,7 @@ var Extension = class _Extension {
|
|
|
1667
1667
|
`expected magic prefix ${base.hex.encode(ARKADE_MAGIC)}, got ${base.hex.encode(payload.slice(0, Math.min(payload.length, ARKADE_MAGIC.length)))}`
|
|
1668
1668
|
);
|
|
1669
1669
|
}
|
|
1670
|
-
const reader = new
|
|
1670
|
+
const reader = new chunkRNMLFY2V_cjs.BufferReader(payload.slice(ARKADE_MAGIC.length));
|
|
1671
1671
|
const packets = [];
|
|
1672
1672
|
while (reader.remaining() > 0) {
|
|
1673
1673
|
const packetType = reader.readByte();
|
|
@@ -1741,7 +1741,7 @@ var Extension = class _Extension {
|
|
|
1741
1741
|
*/
|
|
1742
1742
|
getAssetPacket() {
|
|
1743
1743
|
for (const p of this.packets) {
|
|
1744
|
-
if (p instanceof
|
|
1744
|
+
if (p instanceof chunkRNMLFY2V_cjs.Packet) {
|
|
1745
1745
|
return p;
|
|
1746
1746
|
}
|
|
1747
1747
|
}
|
|
@@ -1779,8 +1779,8 @@ var Extension = class _Extension {
|
|
|
1779
1779
|
};
|
|
1780
1780
|
function parsePacket(packetType, data) {
|
|
1781
1781
|
switch (packetType) {
|
|
1782
|
-
case
|
|
1783
|
-
return
|
|
1782
|
+
case chunkRNMLFY2V_cjs.Packet.PACKET_TYPE:
|
|
1783
|
+
return chunkRNMLFY2V_cjs.Packet.fromBytes(data);
|
|
1784
1784
|
case EmulatorPacket.PACKET_TYPE:
|
|
1785
1785
|
return EmulatorPacket.fromBytes(data);
|
|
1786
1786
|
default:
|
|
@@ -2077,7 +2077,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
|
|
|
2077
2077
|
const existing = inputsByAssetId.get(asset.assetId);
|
|
2078
2078
|
inputsByAssetId.set(asset.assetId, [
|
|
2079
2079
|
...existing ?? [],
|
|
2080
|
-
|
|
2080
|
+
chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount)
|
|
2081
2081
|
]);
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
@@ -2089,7 +2089,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
|
|
|
2089
2089
|
const existing = outputsByAssetId.get(asset.assetId);
|
|
2090
2090
|
outputsByAssetId.set(asset.assetId, [
|
|
2091
2091
|
...existing ?? [],
|
|
2092
|
-
|
|
2092
|
+
chunkRNMLFY2V_cjs.AssetOutput.create(outputIndex, asset.amount)
|
|
2093
2093
|
]);
|
|
2094
2094
|
}
|
|
2095
2095
|
}
|
|
@@ -2100,7 +2100,7 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
|
|
|
2100
2100
|
const existing = outputsByAssetId.get(asset.assetId);
|
|
2101
2101
|
outputsByAssetId.set(asset.assetId, [
|
|
2102
2102
|
...existing ?? [],
|
|
2103
|
-
|
|
2103
|
+
chunkRNMLFY2V_cjs.AssetOutput.create(outputIndex, asset.amount)
|
|
2104
2104
|
]);
|
|
2105
2105
|
}
|
|
2106
2106
|
}
|
|
@@ -2109,11 +2109,11 @@ function createAssetPacket(assetInputs, receivers, changeReceiver) {
|
|
|
2109
2109
|
for (const assetIdStr of allAssetIds) {
|
|
2110
2110
|
const inputs = inputsByAssetId.get(assetIdStr);
|
|
2111
2111
|
const outputs = outputsByAssetId.get(assetIdStr);
|
|
2112
|
-
const assetId =
|
|
2113
|
-
const group =
|
|
2112
|
+
const assetId = chunkRNMLFY2V_cjs.AssetId.fromString(assetIdStr);
|
|
2113
|
+
const group = chunkRNMLFY2V_cjs.AssetGroup.create(assetId, null, inputs ?? [], outputs ?? [], []);
|
|
2114
2114
|
groups.push(group);
|
|
2115
2115
|
}
|
|
2116
|
-
return
|
|
2116
|
+
return chunkRNMLFY2V_cjs.Packet.create(groups);
|
|
2117
2117
|
}
|
|
2118
2118
|
function selectCoinsWithAsset(coins, assetId, requiredAmount) {
|
|
2119
2119
|
const coinsWithAsset = coins.filter((coin) => coin.assets?.some((a) => a.assetId === assetId));
|
|
@@ -2230,7 +2230,7 @@ function buildVirtualTx(inputs, outputs) {
|
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
2232
|
}
|
|
2233
|
-
const tx = new
|
|
2233
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({
|
|
2234
2234
|
version: 3,
|
|
2235
2235
|
lockTime: Number(lockTime)
|
|
2236
2236
|
});
|
|
@@ -2245,7 +2245,7 @@ function buildVirtualTx(inputs, outputs) {
|
|
|
2245
2245
|
},
|
|
2246
2246
|
tapLeafScript: [input.tapLeafScript]
|
|
2247
2247
|
});
|
|
2248
|
-
|
|
2248
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(tx, i, chunkRNMLFY2V_cjs.VtxoTaprootTree, input.tapTree);
|
|
2249
2249
|
}
|
|
2250
2250
|
for (const output of outputs) {
|
|
2251
2251
|
tx.addOutput(output);
|
|
@@ -2428,14 +2428,14 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks) {
|
|
|
2428
2428
|
let finalCheckpoints;
|
|
2429
2429
|
if (userSignedCheckpoints) {
|
|
2430
2430
|
finalCheckpoints = signedCheckpointTxs.map((c, i) => {
|
|
2431
|
-
const serverSigned =
|
|
2431
|
+
const serverSigned = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(c));
|
|
2432
2432
|
combineTapscriptSigs(userSignedCheckpoints[i], serverSigned);
|
|
2433
2433
|
return base.base64.encode(serverSigned.toPSBT());
|
|
2434
2434
|
});
|
|
2435
2435
|
} else {
|
|
2436
2436
|
finalCheckpoints = await Promise.all(
|
|
2437
2437
|
signedCheckpointTxs.map(async (c) => {
|
|
2438
|
-
const tx =
|
|
2438
|
+
const tx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(c));
|
|
2439
2439
|
const signed = await signer.signCheckpoint(tx);
|
|
2440
2440
|
return base.base64.encode(signed.toPSBT());
|
|
2441
2441
|
})
|
|
@@ -2611,6 +2611,9 @@ function parseProgram(text, env) {
|
|
|
2611
2611
|
}
|
|
2612
2612
|
|
|
2613
2613
|
// src/contracts/types.ts
|
|
2614
|
+
function hasCandidates(handler) {
|
|
2615
|
+
return !!handler && typeof handler.candidatesAt === "function";
|
|
2616
|
+
}
|
|
2614
2617
|
function isDiscoverable(handler) {
|
|
2615
2618
|
return !!handler && typeof handler.discoverAt === "function";
|
|
2616
2619
|
}
|
|
@@ -2631,7 +2634,7 @@ function extendCoinWithTapscript(boardingTapscript, utxo) {
|
|
|
2631
2634
|
};
|
|
2632
2635
|
}
|
|
2633
2636
|
function deriveContractTapscripts(contract) {
|
|
2634
|
-
const handler =
|
|
2637
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(contract.type);
|
|
2635
2638
|
if (!handler) {
|
|
2636
2639
|
throw new Error(`No handler for contract type '${contract.type}'`);
|
|
2637
2640
|
}
|
|
@@ -3339,7 +3342,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
3339
3342
|
`Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
|
|
3340
3343
|
);
|
|
3341
3344
|
}
|
|
3342
|
-
const tx = new
|
|
3345
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction();
|
|
3343
3346
|
for (const utxo of expiredUtxos) {
|
|
3344
3347
|
const utxoScript = chunkE7HB3GKK_cjs.VtxoScript.decode(utxo.tapTree);
|
|
3345
3348
|
const utxoExitLeaf = utxoScript.leaves.find(
|
|
@@ -3998,8 +4001,8 @@ var VtxoManager = class _VtxoManager {
|
|
|
3998
4001
|
* or doesn't carry the metadata.
|
|
3999
4002
|
*/
|
|
4000
4003
|
extractSpentOutpoint(error) {
|
|
4001
|
-
const ark =
|
|
4002
|
-
if (!
|
|
4004
|
+
const ark = chunkRNMLFY2V_cjs.maybeArkError(error);
|
|
4005
|
+
if (!chunkRNMLFY2V_cjs.isArkError(ark, chunkRNMLFY2V_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
|
|
4003
4006
|
const raw = ark.metadata?.vtxo_outpoint;
|
|
4004
4007
|
if (typeof raw !== "string") return void 0;
|
|
4005
4008
|
const [txid, voutStr] = raw.split(":");
|
|
@@ -4473,7 +4476,7 @@ var ArkadeCash = class _ArkadeCash {
|
|
|
4473
4476
|
return SingleKey.fromPrivateKey(this._privateKey);
|
|
4474
4477
|
}
|
|
4475
4478
|
get vtxoScript() {
|
|
4476
|
-
return new
|
|
4479
|
+
return new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
4477
4480
|
pubKey: this._publicKey,
|
|
4478
4481
|
serverPubKey: this._serverPubKey,
|
|
4479
4482
|
csvTimelock: this.csvTimelock
|
|
@@ -4734,7 +4737,7 @@ async function captureExitBranch(params) {
|
|
|
4734
4737
|
const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
|
|
4735
4738
|
if (nonCommitment.length > 0) {
|
|
4736
4739
|
for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
|
|
4737
|
-
psbtByTxid.set(
|
|
4740
|
+
psbtByTxid.set(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
|
|
4738
4741
|
}
|
|
4739
4742
|
}
|
|
4740
4743
|
}
|
|
@@ -4795,7 +4798,7 @@ var IndexerExitDataSource = class {
|
|
|
4795
4798
|
pageSize: chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE
|
|
4796
4799
|
});
|
|
4797
4800
|
for (const psbt of txs) {
|
|
4798
|
-
out.set(
|
|
4801
|
+
out.set(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
|
|
4799
4802
|
}
|
|
4800
4803
|
hasMore = page ? txs.length === chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE : false;
|
|
4801
4804
|
pageIndex++;
|
|
@@ -4818,7 +4821,7 @@ function chainedTxTypeToChainTxType(t) {
|
|
|
4818
4821
|
}
|
|
4819
4822
|
}
|
|
4820
4823
|
function psbtInputTxids(psbtBase64) {
|
|
4821
|
-
const tx =
|
|
4824
|
+
const tx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
|
|
4822
4825
|
const ids = [];
|
|
4823
4826
|
for (let i = 0; i < tx.inputsLength; i++) {
|
|
4824
4827
|
const txid = tx.getInput(i).txid;
|
|
@@ -4921,7 +4924,7 @@ function createExitChainResolver(params) {
|
|
|
4921
4924
|
|
|
4922
4925
|
// src/providers/availability.ts
|
|
4923
4926
|
function isRetryableProviderError(error) {
|
|
4924
|
-
return error instanceof
|
|
4927
|
+
return error instanceof chunkRNMLFY2V_cjs.ProviderUnavailableError || error instanceof chunkRNMLFY2V_cjs.FetchError || chunkRNMLFY2V_cjs.isFetchTimeoutError(error);
|
|
4925
4928
|
}
|
|
4926
4929
|
|
|
4927
4930
|
// src/utils/syncCursors.ts
|
|
@@ -5174,7 +5177,7 @@ async function resolveArkInfo(arkProvider, walletRepository) {
|
|
|
5174
5177
|
if (!isRetryableProviderError(err)) throw err;
|
|
5175
5178
|
const snapshot = await loadArkInfoSnapshot(walletRepository);
|
|
5176
5179
|
if (!snapshot) {
|
|
5177
|
-
throw new
|
|
5180
|
+
throw new chunkRNMLFY2V_cjs.ProviderUnavailableError(
|
|
5178
5181
|
"Arkade server info is unavailable and no cached snapshot exists",
|
|
5179
5182
|
{ cause: err }
|
|
5180
5183
|
);
|
|
@@ -5709,7 +5712,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5709
5712
|
const virtualCoins = await this.wallet.getVtxos({
|
|
5710
5713
|
withRecoverable: false
|
|
5711
5714
|
});
|
|
5712
|
-
const controlAssetRef = params.controlAssetId ?
|
|
5715
|
+
const controlAssetRef = params.controlAssetId ? chunkRNMLFY2V_cjs.AssetRef.fromId(chunkRNMLFY2V_cjs.AssetId.fromString(params.controlAssetId)) : null;
|
|
5713
5716
|
const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
|
|
5714
5717
|
let totalBtcSelected = 0n;
|
|
5715
5718
|
const assetChanges = /* @__PURE__ */ new Map();
|
|
@@ -5722,8 +5725,8 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5722
5725
|
}
|
|
5723
5726
|
}
|
|
5724
5727
|
const groups = [];
|
|
5725
|
-
const issuedAssetOutput =
|
|
5726
|
-
const issuedAssetGroup =
|
|
5728
|
+
const issuedAssetOutput = chunkRNMLFY2V_cjs.AssetOutput.create(0, params.amount);
|
|
5729
|
+
const issuedAssetGroup = chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5727
5730
|
null,
|
|
5728
5731
|
controlAssetRef,
|
|
5729
5732
|
[],
|
|
@@ -5738,15 +5741,15 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5738
5741
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5739
5742
|
for (const asset of assets) {
|
|
5740
5743
|
if (asset.assetId !== assetId) continue;
|
|
5741
|
-
changeInputs.push(
|
|
5744
|
+
changeInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5742
5745
|
}
|
|
5743
5746
|
}
|
|
5744
5747
|
groups.push(
|
|
5745
|
-
|
|
5746
|
-
|
|
5748
|
+
chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5749
|
+
chunkRNMLFY2V_cjs.AssetId.fromString(assetId),
|
|
5747
5750
|
null,
|
|
5748
5751
|
changeInputs,
|
|
5749
|
-
[
|
|
5752
|
+
[chunkRNMLFY2V_cjs.AssetOutput.create(0, amount)],
|
|
5750
5753
|
[]
|
|
5751
5754
|
)
|
|
5752
5755
|
);
|
|
@@ -5759,7 +5762,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5759
5762
|
script: outputAddress.pkScript,
|
|
5760
5763
|
amount: BigInt(totalBtcSelected)
|
|
5761
5764
|
},
|
|
5762
|
-
Extension.create([
|
|
5765
|
+
Extension.create([chunkRNMLFY2V_cjs.Packet.create(groups)]).txOut()
|
|
5763
5766
|
];
|
|
5764
5767
|
const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(
|
|
5765
5768
|
coinSelection.inputs,
|
|
@@ -5767,7 +5770,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5767
5770
|
);
|
|
5768
5771
|
return {
|
|
5769
5772
|
arkTxId: arkTxid,
|
|
5770
|
-
assetId:
|
|
5773
|
+
assetId: chunkRNMLFY2V_cjs.AssetId.create(arkTxid, 0).toString()
|
|
5771
5774
|
};
|
|
5772
5775
|
}
|
|
5773
5776
|
/**
|
|
@@ -5839,16 +5842,16 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5839
5842
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5840
5843
|
for (const asset of assets) {
|
|
5841
5844
|
if (asset.assetId !== params.assetId) continue;
|
|
5842
|
-
reissueInputs.push(
|
|
5845
|
+
reissueInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5843
5846
|
}
|
|
5844
5847
|
}
|
|
5845
5848
|
const totalAssetAmount = assetToReissueAmount + params.amount;
|
|
5846
|
-
const reissueAssetIdObj =
|
|
5847
|
-
const reissueAssetGroup =
|
|
5849
|
+
const reissueAssetIdObj = chunkRNMLFY2V_cjs.AssetId.fromString(params.assetId);
|
|
5850
|
+
const reissueAssetGroup = chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5848
5851
|
reissueAssetIdObj,
|
|
5849
5852
|
null,
|
|
5850
5853
|
reissueInputs,
|
|
5851
|
-
[
|
|
5854
|
+
[chunkRNMLFY2V_cjs.AssetOutput.create(0, totalAssetAmount)],
|
|
5852
5855
|
[]
|
|
5853
5856
|
);
|
|
5854
5857
|
const groups = [reissueAssetGroup];
|
|
@@ -5857,15 +5860,15 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5857
5860
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5858
5861
|
for (const asset of assets) {
|
|
5859
5862
|
if (asset.assetId !== assetId) continue;
|
|
5860
|
-
changeInputs.push(
|
|
5863
|
+
changeInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5861
5864
|
}
|
|
5862
5865
|
}
|
|
5863
5866
|
groups.push(
|
|
5864
|
-
|
|
5865
|
-
|
|
5867
|
+
chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5868
|
+
chunkRNMLFY2V_cjs.AssetId.fromString(assetId),
|
|
5866
5869
|
null,
|
|
5867
5870
|
changeInputs,
|
|
5868
|
-
[
|
|
5871
|
+
[chunkRNMLFY2V_cjs.AssetOutput.create(0, amount)],
|
|
5869
5872
|
[]
|
|
5870
5873
|
)
|
|
5871
5874
|
);
|
|
@@ -5877,7 +5880,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5877
5880
|
script: outputAddress.pkScript,
|
|
5878
5881
|
amount: BigInt(totalBtcSelected)
|
|
5879
5882
|
},
|
|
5880
|
-
Extension.create([
|
|
5883
|
+
Extension.create([chunkRNMLFY2V_cjs.Packet.create(groups)]).txOut()
|
|
5881
5884
|
];
|
|
5882
5885
|
const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
|
|
5883
5886
|
return arkTxid;
|
|
@@ -5944,15 +5947,15 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5944
5947
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5945
5948
|
for (const asset of assets) {
|
|
5946
5949
|
if (asset.assetId !== assetId) continue;
|
|
5947
|
-
changeInputs.push(
|
|
5950
|
+
changeInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5948
5951
|
}
|
|
5949
5952
|
}
|
|
5950
5953
|
groups.push(
|
|
5951
|
-
|
|
5952
|
-
|
|
5954
|
+
chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5955
|
+
chunkRNMLFY2V_cjs.AssetId.fromString(assetId),
|
|
5953
5956
|
null,
|
|
5954
5957
|
changeInputs,
|
|
5955
|
-
amount > 0n ? [
|
|
5958
|
+
amount > 0n ? [chunkRNMLFY2V_cjs.AssetOutput.create(0, amount)] : [],
|
|
5956
5959
|
[]
|
|
5957
5960
|
)
|
|
5958
5961
|
);
|
|
@@ -5964,7 +5967,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5964
5967
|
script: outputAddress.pkScript,
|
|
5965
5968
|
amount: BigInt(totalBtcSelected)
|
|
5966
5969
|
},
|
|
5967
|
-
Extension.create([
|
|
5970
|
+
Extension.create([chunkRNMLFY2V_cjs.Packet.create(groups)]).txOut()
|
|
5968
5971
|
];
|
|
5969
5972
|
const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
|
|
5970
5973
|
return arkTxid;
|
|
@@ -5989,7 +5992,7 @@ function castMetadata(metadata) {
|
|
|
5989
5992
|
} else {
|
|
5990
5993
|
throw new Error("Invalid metadata value type");
|
|
5991
5994
|
}
|
|
5992
|
-
md.push(
|
|
5995
|
+
md.push(chunkRNMLFY2V_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
|
|
5993
5996
|
}
|
|
5994
5997
|
return md;
|
|
5995
5998
|
}
|
|
@@ -6273,7 +6276,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
|
|
|
6273
6276
|
expire_at: 0,
|
|
6274
6277
|
cosigners_public_keys: cosignerPubKeys
|
|
6275
6278
|
};
|
|
6276
|
-
const proof =
|
|
6279
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, outputs);
|
|
6277
6280
|
const signedProof = await identity.sign(proof);
|
|
6278
6281
|
return {
|
|
6279
6282
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -8322,7 +8325,7 @@ var ContractWatcher = class {
|
|
|
8322
8325
|
this.connectionState = "connected";
|
|
8323
8326
|
this.reconnectAttempts = 0;
|
|
8324
8327
|
this.listenLoop().catch((e) => {
|
|
8325
|
-
if (
|
|
8328
|
+
if (chunkRNMLFY2V_cjs.isEventSourceError(e)) {
|
|
8326
8329
|
console.debug("ContractWatcher subscription disconnected; reconnecting");
|
|
8327
8330
|
} else {
|
|
8328
8331
|
console.error(e);
|
|
@@ -8911,6 +8914,10 @@ var ContractManager = class _ContractManager {
|
|
|
8911
8914
|
*
|
|
8912
8915
|
* Entries are registered with the watcher but NOT persisted: they become
|
|
8913
8916
|
* repository rows only once funded (see {@link promoteLookAheadHits}).
|
|
8917
|
+
*
|
|
8918
|
+
* Each index contributes every {@link Discoverable.candidatesAt} candidate —
|
|
8919
|
+
* the same set `restore()`'s gap scan probes, since the wallet cannot know
|
|
8920
|
+
* which variant a third-party issuer handed out.
|
|
8914
8921
|
*/
|
|
8915
8922
|
async ensureLookAhead() {
|
|
8916
8923
|
const lookAhead = this.config.lookAhead;
|
|
@@ -8918,10 +8925,23 @@ var ContractManager = class _ContractManager {
|
|
|
8918
8925
|
const watermark = await lookAhead.currentWatermark();
|
|
8919
8926
|
const from = Math.max(0, watermark - lookAhead.size);
|
|
8920
8927
|
const to = watermark + lookAhead.size;
|
|
8928
|
+
const deps = lookAhead.candidateDeps();
|
|
8929
|
+
const handlers = chunkIEMPH7J6_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkIEMPH7J6_cjs.contractHandlers.get(t)).filter(hasCandidates);
|
|
8921
8930
|
const band = /* @__PURE__ */ new Map();
|
|
8922
8931
|
for (let index = from; index <= to; index++) {
|
|
8923
|
-
const
|
|
8924
|
-
|
|
8932
|
+
const descriptor = lookAhead.materialize(index);
|
|
8933
|
+
for (const handler of handlers) {
|
|
8934
|
+
for (const candidate of handler.candidatesAt(index, descriptor, deps)) {
|
|
8935
|
+
if (band.has(candidate.script)) continue;
|
|
8936
|
+
band.set(candidate.script, {
|
|
8937
|
+
index,
|
|
8938
|
+
params: {
|
|
8939
|
+
...candidate,
|
|
8940
|
+
...chunkIEMPH7J6_cjs.speculativeReceiveMetadata(descriptor)
|
|
8941
|
+
}
|
|
8942
|
+
});
|
|
8943
|
+
}
|
|
8944
|
+
}
|
|
8925
8945
|
}
|
|
8926
8946
|
await this.watcher.withCoalescedSubscription(async () => {
|
|
8927
8947
|
const persisted = await this.config.contractRepository.getContracts({
|
|
@@ -9058,7 +9078,7 @@ var ContractManager = class _ContractManager {
|
|
|
9058
9078
|
return result;
|
|
9059
9079
|
}
|
|
9060
9080
|
async upsertContractRow(params) {
|
|
9061
|
-
const handler =
|
|
9081
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(params.type);
|
|
9062
9082
|
if (!handler) {
|
|
9063
9083
|
throw new Error(`No handler registered for contract type '${params.type}'`);
|
|
9064
9084
|
}
|
|
@@ -9158,7 +9178,7 @@ var ContractManager = class _ContractManager {
|
|
|
9158
9178
|
`scanContracts: batchSize must be a positive integer (got ${String(opts.batchSize)})`
|
|
9159
9179
|
);
|
|
9160
9180
|
}
|
|
9161
|
-
const registered =
|
|
9181
|
+
const registered = chunkIEMPH7J6_cjs.contractHandlers.getRegisteredTypes().map((t) => chunkIEMPH7J6_cjs.contractHandlers.get(t)).filter(isDiscoverable);
|
|
9162
9182
|
const discoverables = [
|
|
9163
9183
|
...registered.filter((h) => h.type === "boarding"),
|
|
9164
9184
|
...registered.filter((h) => h.type !== "boarding")
|
|
@@ -9399,7 +9419,7 @@ var ContractManager = class _ContractManager {
|
|
|
9399
9419
|
const { contractScript, collaborative = true, walletPubKey, vtxo } = options;
|
|
9400
9420
|
const [contract] = await this.getContracts({ script: contractScript });
|
|
9401
9421
|
if (!contract) return [];
|
|
9402
|
-
const handler =
|
|
9422
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(contract.type);
|
|
9403
9423
|
if (!handler) return [];
|
|
9404
9424
|
const script = handler.createScript(contract.params);
|
|
9405
9425
|
const context = {
|
|
@@ -9419,7 +9439,7 @@ var ContractManager = class _ContractManager {
|
|
|
9419
9439
|
const { contractScript, collaborative = true, walletPubKey } = options;
|
|
9420
9440
|
const [contract] = await this.getContracts({ script: contractScript });
|
|
9421
9441
|
if (!contract) return [];
|
|
9422
|
-
const handler =
|
|
9442
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(contract.type);
|
|
9423
9443
|
if (!handler) return [];
|
|
9424
9444
|
const script = handler.createScript(contract.params);
|
|
9425
9445
|
const context = {
|
|
@@ -9866,7 +9886,7 @@ var HDDescriptorProvider = class _HDDescriptorProvider {
|
|
|
9866
9886
|
*/
|
|
9867
9887
|
materializeDescriptorAt(index) {
|
|
9868
9888
|
const descriptor = this.identity.descriptor;
|
|
9869
|
-
const network =
|
|
9889
|
+
const network = chunkIEMPH7J6_cjs.isMainnetDescriptor(descriptor) ? descriptorsScure.networks.bitcoin : descriptorsScure.networks.testnet;
|
|
9870
9890
|
const expansion = descriptorsScure.expand({ descriptor, network, index });
|
|
9871
9891
|
const keyInfo = expansion.expansionMap?.["@0"];
|
|
9872
9892
|
if (!keyInfo?.keyExpression) {
|
|
@@ -10010,7 +10030,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
|
|
|
10010
10030
|
const provider = await resolveDescriptorProvider(config, setup.walletRepository);
|
|
10011
10031
|
if (!provider) return void 0;
|
|
10012
10032
|
const allowSilentFallback = (config.walletMode ?? "auto") === "auto";
|
|
10013
|
-
const expectedContractType = setup.offchainTapscript instanceof
|
|
10033
|
+
const expectedContractType = setup.offchainTapscript instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script ? "delegate" : "default";
|
|
10014
10034
|
const factoryOpts = {
|
|
10015
10035
|
walletRepository: setup.walletRepository,
|
|
10016
10036
|
contractRepository: setup.contractRepository,
|
|
@@ -10190,9 +10210,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
|
|
|
10190
10210
|
const { tapscript: newTapscript, params } = buildReceiveContract(
|
|
10191
10211
|
wallet.offchainTapscript,
|
|
10192
10212
|
descriptor,
|
|
10193
|
-
wallet.network.hrp
|
|
10194
|
-
true
|
|
10195
|
-
);
|
|
10213
|
+
wallet.network.hrp);
|
|
10196
10214
|
const newScript = params.script;
|
|
10197
10215
|
const manager = await wallet.getContractManager();
|
|
10198
10216
|
await manager.createContract(params);
|
|
@@ -10211,7 +10229,7 @@ var WalletReceiveRotator = class _WalletReceiveRotator {
|
|
|
10211
10229
|
};
|
|
10212
10230
|
function deriveLeafPubkey(descriptor) {
|
|
10213
10231
|
try {
|
|
10214
|
-
return
|
|
10232
|
+
return chunkIEMPH7J6_cjs.deriveDescriptorLeafPubKey(descriptor);
|
|
10215
10233
|
} catch (e) {
|
|
10216
10234
|
throw new NonRangeableDescriptorError(
|
|
10217
10235
|
"Cannot derive leaf pubkey: descriptor is not a materialized, parsable tr(...) shape.",
|
|
@@ -10234,11 +10252,11 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
|
|
|
10234
10252
|
// index-0 key. Without it, spends produce unsigned PSBTs that the
|
|
10235
10253
|
// server rejects with `INVALID_PSBT_INPUT (5): missing tapscript spend sig`.
|
|
10236
10254
|
metadata: {
|
|
10237
|
-
...
|
|
10255
|
+
...{ source: chunkIEMPH7J6_cjs.WALLET_RECEIVE_SOURCE },
|
|
10238
10256
|
signingDescriptor: descriptor
|
|
10239
10257
|
}
|
|
10240
10258
|
};
|
|
10241
|
-
const params = tapscript instanceof
|
|
10259
|
+
const params = tapscript instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script ? {
|
|
10242
10260
|
...base$1,
|
|
10243
10261
|
type: "delegate",
|
|
10244
10262
|
params: {
|
|
@@ -10259,10 +10277,10 @@ function buildReceiveContract(current, descriptor, hrp, tagSource) {
|
|
|
10259
10277
|
return { tapscript, params };
|
|
10260
10278
|
}
|
|
10261
10279
|
function rebuildTapscript(current, pubKey) {
|
|
10262
|
-
if (current instanceof
|
|
10263
|
-
return new
|
|
10280
|
+
if (current instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script) {
|
|
10281
|
+
return new chunkIEMPH7J6_cjs.DelegateVtxo.Script({ ...current.options, pubKey });
|
|
10264
10282
|
}
|
|
10265
|
-
return new
|
|
10283
|
+
return new chunkIEMPH7J6_cjs.DefaultVtxo.Script({ ...current.options, pubKey });
|
|
10266
10284
|
}
|
|
10267
10285
|
async function pickActiveReceive(contractRepository, serverPubKey, expectedType) {
|
|
10268
10286
|
const candidates = await contractRepository.getContracts({
|
|
@@ -10271,7 +10289,7 @@ async function pickActiveReceive(contractRepository, serverPubKey, expectedType)
|
|
|
10271
10289
|
});
|
|
10272
10290
|
const serverPubKeyHex = base.hex.encode(serverPubKey);
|
|
10273
10291
|
const matching = candidates.filter(
|
|
10274
|
-
(c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source ===
|
|
10292
|
+
(c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkIEMPH7J6_cjs.WALLET_RECEIVE_SOURCE
|
|
10275
10293
|
).sort((a, b) => {
|
|
10276
10294
|
if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
|
|
10277
10295
|
return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
|
|
@@ -10494,7 +10512,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
|
|
|
10494
10512
|
state: "active"
|
|
10495
10513
|
});
|
|
10496
10514
|
const newest = candidates.filter(
|
|
10497
|
-
(c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source ===
|
|
10515
|
+
(c) => c.params.serverPubKey === serverPubKeyHex && c.metadata?.source === chunkIEMPH7J6_cjs.WALLET_RECEIVE_SOURCE
|
|
10498
10516
|
).sort((a, b) => {
|
|
10499
10517
|
if (b.createdAt !== a.createdAt) return b.createdAt - a.createdAt;
|
|
10500
10518
|
return signingDescriptorIndex(b.metadata?.signingDescriptor) - signingDescriptorIndex(a.metadata?.signingDescriptor);
|
|
@@ -10502,7 +10520,7 @@ async function resolveBoardingBootTapscript(contractRepository, serverPubKey, ba
|
|
|
10502
10520
|
if (!newest?.params.pubKey) return baseline;
|
|
10503
10521
|
try {
|
|
10504
10522
|
const pubKey = base.hex.decode(newest.params.pubKey);
|
|
10505
|
-
return new
|
|
10523
|
+
return new chunkIEMPH7J6_cjs.DefaultVtxo.Script({ ...baseline.options, pubKey });
|
|
10506
10524
|
} catch (e) {
|
|
10507
10525
|
console.warn("Skipping malformed boarding contract at boot", newest.script, e);
|
|
10508
10526
|
return baseline;
|
|
@@ -10822,7 +10840,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
10822
10840
|
*/
|
|
10823
10841
|
static async setupWalletConfig(config, pubKey) {
|
|
10824
10842
|
const arkadeServerUrl = getArkadeServerUrl(config);
|
|
10825
|
-
const arkProvider = config.arkProvider || new
|
|
10843
|
+
const arkProvider = config.arkProvider || new chunkRNMLFY2V_cjs.RestArkProvider(arkadeServerUrl);
|
|
10826
10844
|
let indexerProvider = config.indexerProvider;
|
|
10827
10845
|
if (!indexerProvider) {
|
|
10828
10846
|
let indexerUrl = config.indexerUrl;
|
|
@@ -10839,7 +10857,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
10839
10857
|
indexerUrl = arkadeServerUrl;
|
|
10840
10858
|
}
|
|
10841
10859
|
}
|
|
10842
|
-
indexerProvider = new
|
|
10860
|
+
indexerProvider = new chunkRNMLFY2V_cjs.RestIndexerProvider(indexerUrl);
|
|
10843
10861
|
}
|
|
10844
10862
|
const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
|
|
10845
10863
|
const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
|
|
@@ -10895,8 +10913,8 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
10895
10913
|
serverPubKey,
|
|
10896
10914
|
csvTimelock: exitTimelock
|
|
10897
10915
|
};
|
|
10898
|
-
const offchainTapscript = !delegatePubKey ? new
|
|
10899
|
-
const boardingTapscript =
|
|
10916
|
+
const offchainTapscript = !delegatePubKey ? new chunkIEMPH7J6_cjs.DefaultVtxo.Script(offchainOptions) : new chunkIEMPH7J6_cjs.DelegateVtxo.Script({ ...offchainOptions, delegatePubKey });
|
|
10917
|
+
const boardingTapscript = chunkIEMPH7J6_cjs.BoardingContractHandler.createScript({
|
|
10900
10918
|
pubKey: base.hex.encode(pubKey),
|
|
10901
10919
|
serverPubKey: base.hex.encode(serverPubKey),
|
|
10902
10920
|
csvTimelock: chunkE7HB3GKK_cjs.timelockToSequence(boardingTimelock).toString()
|
|
@@ -11240,9 +11258,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11240
11258
|
async getBoardingTapscripts(allowedSigners) {
|
|
11241
11259
|
const byScript = /* @__PURE__ */ new Map();
|
|
11242
11260
|
const add = (s) => byScript.set(base.hex.encode(s.pkScript), s);
|
|
11243
|
-
const boardingCsv = this.boardingTapscript.options.csvTimelock ??
|
|
11261
|
+
const boardingCsv = this.boardingTapscript.options.csvTimelock ?? chunkIEMPH7J6_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
11244
11262
|
add(
|
|
11245
|
-
new
|
|
11263
|
+
new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
11246
11264
|
pubKey: await this.identity.xOnlyPublicKey(),
|
|
11247
11265
|
serverPubKey: this.boardingTapscript.options.serverPubKey,
|
|
11248
11266
|
csvTimelock: boardingCsv
|
|
@@ -11257,7 +11275,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11257
11275
|
for (const c of boardingContracts) {
|
|
11258
11276
|
if (!allowed.has(toXOnlySignerHex(c.params.serverPubKey))) continue;
|
|
11259
11277
|
try {
|
|
11260
|
-
add(
|
|
11278
|
+
add(chunkIEMPH7J6_cjs.BoardingContractHandler.createScript(c.params));
|
|
11261
11279
|
} catch (e) {
|
|
11262
11280
|
console.warn("Skipping malformed boarding contract", c.script, e);
|
|
11263
11281
|
}
|
|
@@ -11459,7 +11477,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11459
11477
|
});
|
|
11460
11478
|
for (const contract of contracts) {
|
|
11461
11479
|
if (map.has(contract.script)) continue;
|
|
11462
|
-
const handler =
|
|
11480
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(contract.type);
|
|
11463
11481
|
if (handler) {
|
|
11464
11482
|
const script = handler.createScript(contract.params);
|
|
11465
11483
|
map.set(contract.script, script);
|
|
@@ -11562,7 +11580,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11562
11580
|
lookAhead: this.lookAheadConfig()
|
|
11563
11581
|
});
|
|
11564
11582
|
const baselinePubkey = await this.identity.xOnlyPublicKey();
|
|
11565
|
-
const delegatePubKey = this.offchainTapscript instanceof
|
|
11583
|
+
const delegatePubKey = this.offchainTapscript instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
|
|
11566
11584
|
const baselineSigners = [
|
|
11567
11585
|
this.offchainTapscript.options.serverPubKey,
|
|
11568
11586
|
...[...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h))
|
|
@@ -11571,7 +11589,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11571
11589
|
for (const serverPubKey of baselineSigners) {
|
|
11572
11590
|
for (const csvTimelock of this.walletContractTimelocks) {
|
|
11573
11591
|
const csvTimelockStr = chunkE7HB3GKK_cjs.timelockToSequence(csvTimelock).toString();
|
|
11574
|
-
const defaultScript = new
|
|
11592
|
+
const defaultScript = new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
11575
11593
|
pubKey: baselinePubkey,
|
|
11576
11594
|
serverPubKey,
|
|
11577
11595
|
csvTimelock
|
|
@@ -11592,7 +11610,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11592
11610
|
});
|
|
11593
11611
|
}
|
|
11594
11612
|
if (delegatePubKey) {
|
|
11595
|
-
const delegateScript = new
|
|
11613
|
+
const delegateScript = new chunkIEMPH7J6_cjs.DelegateVtxo.Script({
|
|
11596
11614
|
pubKey: baselinePubkey,
|
|
11597
11615
|
serverPubKey,
|
|
11598
11616
|
delegatePubKey,
|
|
@@ -11616,9 +11634,9 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11616
11634
|
}
|
|
11617
11635
|
}
|
|
11618
11636
|
}
|
|
11619
|
-
const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ??
|
|
11637
|
+
const boardingCsvTimelock = this.boardingTapscript.options.csvTimelock ?? chunkIEMPH7J6_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
11620
11638
|
for (const serverPubKey of baselineSigners) {
|
|
11621
|
-
const baselineBoarding = new
|
|
11639
|
+
const baselineBoarding = new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
11622
11640
|
pubKey: baselinePubkey,
|
|
11623
11641
|
serverPubKey,
|
|
11624
11642
|
csvTimelock: boardingCsvTimelock
|
|
@@ -11774,9 +11792,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11774
11792
|
* Only HD wallets have a watermark to look ahead of; static / `auto`
|
|
11775
11793
|
* wallets keep a single index-0 receive address, so the feature stays off.
|
|
11776
11794
|
*
|
|
11777
|
-
* `
|
|
11778
|
-
*
|
|
11779
|
-
*
|
|
11795
|
+
* `candidateDeps` is read at refill time, so a band rebuilt after
|
|
11796
|
+
* {@link rotateServerSigner} fans the active signer set (persisted
|
|
11797
|
+
* old-signer rows stay watched through the repository).
|
|
11780
11798
|
*/
|
|
11781
11799
|
lookAheadConfig() {
|
|
11782
11800
|
const provider = this._descriptorProvider;
|
|
@@ -11784,18 +11802,30 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11784
11802
|
return {
|
|
11785
11803
|
size: this._lookAheadWindow,
|
|
11786
11804
|
currentWatermark: async () => await provider.getLastIndexUsed() ?? -1,
|
|
11787
|
-
materialize: (index) =>
|
|
11788
|
-
|
|
11789
|
-
provider.materializeDescriptorAt(index),
|
|
11790
|
-
this.network.hrp,
|
|
11791
|
-
// Never tagged: a promoted entry was generated by someone
|
|
11792
|
-
// else, and the tag would make the next boot advertise a
|
|
11793
|
-
// third party's invoice address as our own.
|
|
11794
|
-
false
|
|
11795
|
-
).params,
|
|
11805
|
+
materialize: (index) => provider.materializeDescriptorAt(index),
|
|
11806
|
+
candidateDeps: () => this.receiveCandidateDeps(),
|
|
11796
11807
|
onPromoted: (index) => provider.advanceLastIndexUsed(index)
|
|
11797
11808
|
};
|
|
11798
11809
|
}
|
|
11810
|
+
/**
|
|
11811
|
+
* Every axis an externally issued receive script could be anchored to, not
|
|
11812
|
+
* just the wallet's own current shape: an issuer sharing the seed (NArk, a
|
|
11813
|
+
* merchant backend) picks its own contract type, and a band derived from one
|
|
11814
|
+
* variant silently misses the rest until a `restore()`.
|
|
11815
|
+
*
|
|
11816
|
+
* Read from cached state, not a fresh `getInfo`, to stay synchronous and
|
|
11817
|
+
* offline-safe; {@link refreshDeprecatedSigners} and
|
|
11818
|
+
* {@link rotateServerSigner} keep it current and re-trigger a refill.
|
|
11819
|
+
*/
|
|
11820
|
+
receiveCandidateDeps() {
|
|
11821
|
+
return {
|
|
11822
|
+
network: { hrp: this.network.hrp },
|
|
11823
|
+
serverPubKey: this.offchainTapscript.options.serverPubKey,
|
|
11824
|
+
deprecatedSignerPubKeys: [...this._deprecatedSigners.keys()].map((h) => base.hex.decode(h)),
|
|
11825
|
+
csvTimelocks: this.walletContractTimelocks,
|
|
11826
|
+
delegatePubKey: this.offchainTapscript instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0
|
|
11827
|
+
};
|
|
11828
|
+
}
|
|
11799
11829
|
_signerRouter;
|
|
11800
11830
|
/**
|
|
11801
11831
|
* @internal Sole write path for `offchainTapscript` after construction.
|
|
@@ -11885,12 +11915,12 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11885
11915
|
return this.getBoardingAddress();
|
|
11886
11916
|
}
|
|
11887
11917
|
const descriptor = await provider.getNextSigningDescriptor();
|
|
11888
|
-
const pubKey =
|
|
11889
|
-
const newBoarding = new
|
|
11918
|
+
const pubKey = chunkIEMPH7J6_cjs.deriveDescriptorLeafPubKey(descriptor);
|
|
11919
|
+
const newBoarding = new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
11890
11920
|
...this._boardingTapscript.options,
|
|
11891
11921
|
pubKey
|
|
11892
11922
|
});
|
|
11893
|
-
const csvTimelock = newBoarding.options.csvTimelock ??
|
|
11923
|
+
const csvTimelock = newBoarding.options.csvTimelock ?? chunkIEMPH7J6_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
11894
11924
|
const manager = await this.getContractManager();
|
|
11895
11925
|
await manager.createContract({
|
|
11896
11926
|
type: "boarding",
|
|
@@ -11903,7 +11933,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11903
11933
|
address: newBoarding.address(this.network.hrp, this.arkServerPublicKey).encode(),
|
|
11904
11934
|
state: "active",
|
|
11905
11935
|
metadata: {
|
|
11906
|
-
source:
|
|
11936
|
+
source: chunkIEMPH7J6_cjs.WALLET_RECEIVE_SOURCE,
|
|
11907
11937
|
signingDescriptor: descriptor
|
|
11908
11938
|
}
|
|
11909
11939
|
});
|
|
@@ -11975,21 +12005,21 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11975
12005
|
const [currentBoardingRow] = await manager.getContracts({
|
|
11976
12006
|
script: currentBoardingScript
|
|
11977
12007
|
});
|
|
11978
|
-
const newOffchain = this.offchainTapscript instanceof
|
|
12008
|
+
const newOffchain = this.offchainTapscript instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script ? new chunkIEMPH7J6_cjs.DelegateVtxo.Script({
|
|
11979
12009
|
...this.offchainTapscript.options,
|
|
11980
12010
|
serverPubKey: xonly
|
|
11981
|
-
}) : new
|
|
12011
|
+
}) : new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
11982
12012
|
...this.offchainTapscript.options,
|
|
11983
12013
|
serverPubKey: xonly
|
|
11984
12014
|
});
|
|
11985
|
-
const newBoarding = new
|
|
12015
|
+
const newBoarding = new chunkIEMPH7J6_cjs.DefaultVtxo.Script({
|
|
11986
12016
|
...this._boardingTapscript.options,
|
|
11987
12017
|
serverPubKey: xonly
|
|
11988
12018
|
});
|
|
11989
12019
|
const offchainCsv = chunkE7HB3GKK_cjs.timelockToSequence(newOffchain.options.csvTimelock).toString();
|
|
11990
12020
|
const newOffchainScript = base.hex.encode(newOffchain.pkScript);
|
|
11991
12021
|
const newOffchainAddress = newOffchain.address(this.network.hrp, xonly).encode();
|
|
11992
|
-
if (newOffchain instanceof
|
|
12022
|
+
if (newOffchain instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script) {
|
|
11993
12023
|
await manager.createContract({
|
|
11994
12024
|
type: "delegate",
|
|
11995
12025
|
params: {
|
|
@@ -12017,7 +12047,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12017
12047
|
metadata: currentOffchainRow?.metadata
|
|
12018
12048
|
});
|
|
12019
12049
|
}
|
|
12020
|
-
const boardingCsv = newBoarding.options.csvTimelock ??
|
|
12050
|
+
const boardingCsv = newBoarding.options.csvTimelock ?? chunkIEMPH7J6_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK;
|
|
12021
12051
|
await manager.createContract({
|
|
12022
12052
|
type: "boarding",
|
|
12023
12053
|
params: {
|
|
@@ -12123,7 +12153,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12123
12153
|
const hd = provider instanceof HDDescriptorProvider;
|
|
12124
12154
|
const staticDescriptor = hd ? void 0 : `tr(${base.hex.encode(await this.identity.xOnlyPublicKey())})`;
|
|
12125
12155
|
const materialize = (index) => hd ? provider.materializeDescriptorAt(index) : staticDescriptor;
|
|
12126
|
-
const delegatePubKey = this.offchainTapscript instanceof
|
|
12156
|
+
const delegatePubKey = this.offchainTapscript instanceof chunkIEMPH7J6_cjs.DelegateVtxo.Script ? this.offchainTapscript.options.delegatePubKey : void 0;
|
|
12127
12157
|
const arkInfo = await this.arkProvider.getInfo();
|
|
12128
12158
|
const currentSignerPubKey = toXOnlyPubKey(base.hex.decode(arkInfo.signerPubkey));
|
|
12129
12159
|
const deprecatedSignerPubKeys = arkInfo.deprecatedSigners.map(
|
|
@@ -12142,7 +12172,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12142
12172
|
csvTimelocks: this.walletContractTimelocks,
|
|
12143
12173
|
// Boarding-exit CSV so the boarding handler can build its
|
|
12144
12174
|
// candidate script (distinct from the unilateral-exit matrix).
|
|
12145
|
-
boardingTimelock: this.boardingTapscript.options.csvTimelock ??
|
|
12175
|
+
boardingTimelock: this.boardingTapscript.options.csvTimelock ?? chunkIEMPH7J6_cjs.DefaultVtxo.Script.DEFAULT_TIMELOCK,
|
|
12146
12176
|
delegatePubKey
|
|
12147
12177
|
};
|
|
12148
12178
|
const result = await manager.scanContracts({
|
|
@@ -12974,9 +13004,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12974
13004
|
...existing ?? {},
|
|
12975
13005
|
intentTxId,
|
|
12976
13006
|
registerProof: intent.proof,
|
|
12977
|
-
registerProofMessage:
|
|
13007
|
+
registerProofMessage: chunkRNMLFY2V_cjs.Intent.encodeMessage(intent.message),
|
|
12978
13008
|
deleteProof: deleteIntent.proof,
|
|
12979
|
-
deleteProofMessage:
|
|
13009
|
+
deleteProofMessage: chunkRNMLFY2V_cjs.Intent.encodeMessage(deleteIntent.message),
|
|
12980
13010
|
intentVtxos: inputs.map((i) => ({
|
|
12981
13011
|
txid: i.txid,
|
|
12982
13012
|
vout: i.vout
|
|
@@ -13008,7 +13038,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13008
13038
|
try {
|
|
13009
13039
|
return await this.arkProvider.registerIntent(intent);
|
|
13010
13040
|
} catch (error) {
|
|
13011
|
-
if (error instanceof
|
|
13041
|
+
if (error instanceof chunkRNMLFY2V_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
|
|
13012
13042
|
const deleteIntent = await this.makeDeleteIntentSignature(inputs);
|
|
13013
13043
|
await this.arkProvider.deleteIntent(deleteIntent);
|
|
13014
13044
|
return this.arkProvider.registerIntent(intent);
|
|
@@ -13024,7 +13054,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13024
13054
|
expire_at: 0,
|
|
13025
13055
|
cosigners_public_keys: cosignerPubKeys
|
|
13026
13056
|
};
|
|
13027
|
-
const proof =
|
|
13057
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, outputs);
|
|
13028
13058
|
const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
|
|
13029
13059
|
return {
|
|
13030
13060
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -13036,7 +13066,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13036
13066
|
type: "delete",
|
|
13037
13067
|
expire_at: 0
|
|
13038
13068
|
};
|
|
13039
|
-
const proof =
|
|
13069
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, []);
|
|
13040
13070
|
const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
|
|
13041
13071
|
return {
|
|
13042
13072
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -13048,7 +13078,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13048
13078
|
type: "get-pending-tx",
|
|
13049
13079
|
expire_at: 0
|
|
13050
13080
|
};
|
|
13051
|
-
const proof =
|
|
13081
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, []);
|
|
13052
13082
|
const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
|
|
13053
13083
|
return {
|
|
13054
13084
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -13381,7 +13411,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13381
13411
|
for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
|
|
13382
13412
|
const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
|
|
13383
13413
|
const message = { type: "get-pending-tx", expire_at: 0 };
|
|
13384
|
-
const proof =
|
|
13414
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, batch, []);
|
|
13385
13415
|
const signedProof = await identity.sign(
|
|
13386
13416
|
proof,
|
|
13387
13417
|
Array.from({ length: batch.length + 1 }, (_, j) => j)
|
|
@@ -14075,6 +14105,12 @@ var ServiceWorkerTimeoutError = class extends Error {
|
|
|
14075
14105
|
super(detail);
|
|
14076
14106
|
}
|
|
14077
14107
|
};
|
|
14108
|
+
function isMessageBusNotInitializedError(error) {
|
|
14109
|
+
return error instanceof Error && error.message.includes(MESSAGE_BUS_NOT_INITIALIZED);
|
|
14110
|
+
}
|
|
14111
|
+
function isMessageBusInitializingError(error) {
|
|
14112
|
+
return error instanceof Error && error.message.includes(MESSAGE_BUS_INITIALIZING);
|
|
14113
|
+
}
|
|
14078
14114
|
|
|
14079
14115
|
// src/worker/messageBus.ts
|
|
14080
14116
|
var LATE_DELIVERY_GRACE_MS = 5 * 6e4;
|
|
@@ -14264,7 +14300,7 @@ var MessageBus = class {
|
|
|
14264
14300
|
this.initialized = true;
|
|
14265
14301
|
}
|
|
14266
14302
|
async buildServices(config) {
|
|
14267
|
-
const arkProvider = new
|
|
14303
|
+
const arkProvider = new chunkRNMLFY2V_cjs.RestArkProvider(config.arkServer.url);
|
|
14268
14304
|
const storage = {
|
|
14269
14305
|
walletRepository: this.walletRepository,
|
|
14270
14306
|
contractRepository: this.contractRepository
|
|
@@ -15425,7 +15461,7 @@ var WalletMessageHandler = class {
|
|
|
15425
15461
|
// Wallet methods
|
|
15426
15462
|
async handleInitWallet({ payload }) {
|
|
15427
15463
|
const { arkServerUrl } = payload;
|
|
15428
|
-
this.indexerProvider = new
|
|
15464
|
+
this.indexerProvider = new chunkRNMLFY2V_cjs.RestIndexerProvider(arkServerUrl);
|
|
15429
15465
|
await this.onWalletInitialized();
|
|
15430
15466
|
}
|
|
15431
15467
|
async handleGetBalance() {
|
|
@@ -15845,12 +15881,6 @@ var WalletMessageHandler = class {
|
|
|
15845
15881
|
};
|
|
15846
15882
|
|
|
15847
15883
|
// src/wallet/serviceWorker/wallet.ts
|
|
15848
|
-
function isMessageBusNotInitializedError(error) {
|
|
15849
|
-
return error instanceof Error && error.message.includes(MESSAGE_BUS_NOT_INITIALIZED);
|
|
15850
|
-
}
|
|
15851
|
-
function isMessageBusInitializingError(error) {
|
|
15852
|
-
return error instanceof Error && error.message.includes(MESSAGE_BUS_INITIALIZING);
|
|
15853
|
-
}
|
|
15854
15884
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
15855
15885
|
var INIT_WAIT_BACKOFF_CAP_MS = 2e3;
|
|
15856
15886
|
var MAX_INIT_WAITS = 8;
|
|
@@ -17302,7 +17332,7 @@ var OnchainWallet = class _OnchainWallet {
|
|
|
17302
17332
|
if (!inputs) {
|
|
17303
17333
|
throw new Error("Fee estimation failed");
|
|
17304
17334
|
}
|
|
17305
|
-
let tx = new
|
|
17335
|
+
let tx = new chunkRNMLFY2V_cjs.Transaction();
|
|
17306
17336
|
for (const input of inputs) {
|
|
17307
17337
|
tx.addInput({
|
|
17308
17338
|
txid: input.txid,
|
|
@@ -17360,7 +17390,7 @@ var OnchainWallet = class _OnchainWallet {
|
|
|
17360
17390
|
* @throws If the parent has no anchor, or funding cannot be selected/signed
|
|
17361
17391
|
*/
|
|
17362
17392
|
async bumpAnchor(parentHex, feeRate) {
|
|
17363
|
-
const parent =
|
|
17393
|
+
const parent = chunkRNMLFY2V_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
|
|
17364
17394
|
const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
|
|
17365
17395
|
const child = await this.buildBumpPackage(parent, feeRate, coins);
|
|
17366
17396
|
return [parent.hex, child.hex];
|
|
@@ -18125,7 +18155,7 @@ exports.BIP322 = void 0;
|
|
|
18125
18155
|
async function sign2(message, identity, network) {
|
|
18126
18156
|
const xOnlyPubKey = await identity.xOnlyPublicKey();
|
|
18127
18157
|
const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
|
|
18128
|
-
const toSpend =
|
|
18158
|
+
const toSpend = chunkRNMLFY2V_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
|
|
18129
18159
|
const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
|
|
18130
18160
|
const signed = await identity.sign(toSign, [0]);
|
|
18131
18161
|
signed.finalizeIdx(0);
|
|
@@ -18183,7 +18213,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
|
|
|
18183
18213
|
if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
|
|
18184
18214
|
return false;
|
|
18185
18215
|
}
|
|
18186
|
-
const toSpend =
|
|
18216
|
+
const toSpend = chunkRNMLFY2V_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
|
|
18187
18217
|
const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
|
|
18188
18218
|
const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
|
|
18189
18219
|
const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
|
|
@@ -18204,7 +18234,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
|
|
|
18204
18234
|
}
|
|
18205
18235
|
const sighashType = sigWithHash[sigWithHash.length - 1];
|
|
18206
18236
|
const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
|
|
18207
|
-
const toSpend =
|
|
18237
|
+
const toSpend = chunkRNMLFY2V_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
|
|
18208
18238
|
const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
|
|
18209
18239
|
const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
|
|
18210
18240
|
const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
|
|
@@ -18257,7 +18287,7 @@ function encodeCompactSize(n) {
|
|
|
18257
18287
|
return buf;
|
|
18258
18288
|
}
|
|
18259
18289
|
function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
|
|
18260
|
-
const tx = new
|
|
18290
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 0 });
|
|
18261
18291
|
tx.addInput({
|
|
18262
18292
|
txid: toSpend.id,
|
|
18263
18293
|
index: 0,
|
|
@@ -18271,12 +18301,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
|
|
|
18271
18301
|
});
|
|
18272
18302
|
tx.addOutput({
|
|
18273
18303
|
amount: 0n,
|
|
18274
|
-
script:
|
|
18304
|
+
script: chunkRNMLFY2V_cjs.OP_RETURN_EMPTY_PKSCRIPT
|
|
18275
18305
|
});
|
|
18276
18306
|
return tx;
|
|
18277
18307
|
}
|
|
18278
18308
|
function craftBIP322ToSignSimple(toSpend, pkScript) {
|
|
18279
|
-
const tx = new
|
|
18309
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 0 });
|
|
18280
18310
|
tx.addInput({
|
|
18281
18311
|
txid: toSpend.id,
|
|
18282
18312
|
index: 0,
|
|
@@ -18288,7 +18318,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
|
|
|
18288
18318
|
});
|
|
18289
18319
|
tx.addOutput({
|
|
18290
18320
|
amount: 0n,
|
|
18291
|
-
script:
|
|
18321
|
+
script: chunkRNMLFY2V_cjs.OP_RETURN_EMPTY_PKSCRIPT
|
|
18292
18322
|
});
|
|
18293
18323
|
return tx;
|
|
18294
18324
|
}
|
|
@@ -18419,7 +18449,7 @@ var RestEmulatorProvider = class {
|
|
|
18419
18449
|
}
|
|
18420
18450
|
};
|
|
18421
18451
|
function finalizeVirtualTx(type, psbtBase64) {
|
|
18422
|
-
const tx =
|
|
18452
|
+
const tx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
|
|
18423
18453
|
if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
|
|
18424
18454
|
const input = tx.getInput(0);
|
|
18425
18455
|
if (!input) {
|
|
@@ -18453,7 +18483,7 @@ async function resolveUnilateralPath(params) {
|
|
|
18453
18483
|
const { vtxo, scriptHex, contractRepository } = params;
|
|
18454
18484
|
const contract = contractRepository ? (await contractRepository.getContracts({ script: scriptHex }))[0] : void 0;
|
|
18455
18485
|
if (contract) {
|
|
18456
|
-
const handler =
|
|
18486
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(contract.type);
|
|
18457
18487
|
if (!handler) {
|
|
18458
18488
|
throw new ExitPathError(
|
|
18459
18489
|
"no-handler",
|
|
@@ -18697,7 +18727,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
|
|
|
18697
18727
|
btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
|
|
18698
18728
|
);
|
|
18699
18729
|
}
|
|
18700
|
-
const tx = new
|
|
18730
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 2 });
|
|
18701
18731
|
for (const input of inputs) {
|
|
18702
18732
|
tx.addInput(input);
|
|
18703
18733
|
}
|
|
@@ -18764,7 +18794,7 @@ async function buildSignedSweep(params) {
|
|
|
18764
18794
|
`uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
|
|
18765
18795
|
);
|
|
18766
18796
|
}
|
|
18767
|
-
const tx = new
|
|
18797
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 2 });
|
|
18768
18798
|
tx.addInput({
|
|
18769
18799
|
txid: vtxo.txid,
|
|
18770
18800
|
index: vtxo.vout,
|
|
@@ -18834,7 +18864,7 @@ async function selectExitVtxos(opts) {
|
|
|
18834
18864
|
`no contract registered for vtxo script ${vtxo.script} \u2014 register the contract before exiting`
|
|
18835
18865
|
);
|
|
18836
18866
|
}
|
|
18837
|
-
const handler =
|
|
18867
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(contract.type);
|
|
18838
18868
|
if (!handler) {
|
|
18839
18869
|
throw new Error(`no contract handler registered for type '${contract.type}'`);
|
|
18840
18870
|
}
|
|
@@ -18864,7 +18894,7 @@ async function computeExitLayout(opts, feeRate) {
|
|
|
18864
18894
|
if (pendingNodes.length > 0) {
|
|
18865
18895
|
const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
|
|
18866
18896
|
for (const psbt of txs) {
|
|
18867
|
-
psbts.set(
|
|
18897
|
+
psbts.set(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
|
|
18868
18898
|
}
|
|
18869
18899
|
}
|
|
18870
18900
|
const childVsize = Number(
|
|
@@ -19311,7 +19341,7 @@ async function prepare(opts) {
|
|
|
19311
19341
|
if (newFee <= splitterFee) break;
|
|
19312
19342
|
splitterFee = newFee;
|
|
19313
19343
|
}
|
|
19314
|
-
const splitter = new
|
|
19344
|
+
const splitter = new chunkRNMLFY2V_cjs.Transaction({ version: 2 });
|
|
19315
19345
|
for (const coin of selected.inputs) {
|
|
19316
19346
|
splitter.addInput({
|
|
19317
19347
|
txid: coin.txid,
|
|
@@ -19454,39 +19484,39 @@ var UnilateralExit = {
|
|
|
19454
19484
|
// src/arkade/index.ts
|
|
19455
19485
|
var arkade_exports = {};
|
|
19456
19486
|
chunk5BLDMQED_cjs.__export(arkade_exports, {
|
|
19457
|
-
ARKADE_OP: () =>
|
|
19458
|
-
ARKADE_OPCODES: () =>
|
|
19459
|
-
ARKADE_OPCODE_NAMES: () =>
|
|
19460
|
-
ARKADE_OPCODE_VALUES: () =>
|
|
19461
|
-
ARKADE_OPS: () =>
|
|
19487
|
+
ARKADE_OP: () => chunkIEMPH7J6_cjs.ARKADE_OP,
|
|
19488
|
+
ARKADE_OPCODES: () => chunkIEMPH7J6_cjs.ARKADE_OPCODES,
|
|
19489
|
+
ARKADE_OPCODE_NAMES: () => chunkIEMPH7J6_cjs.ARKADE_OPCODE_NAMES,
|
|
19490
|
+
ARKADE_OPCODE_VALUES: () => chunkIEMPH7J6_cjs.ARKADE_OPCODE_VALUES,
|
|
19491
|
+
ARKADE_OPS: () => chunkIEMPH7J6_cjs.ARKADE_OPS,
|
|
19462
19492
|
Arkade: () => Arkade,
|
|
19463
19493
|
ArkadeContract: () => ArkadeContract,
|
|
19464
|
-
ArkadeProgramScript: () =>
|
|
19465
|
-
ArkadeScript: () =>
|
|
19494
|
+
ArkadeProgramScript: () => chunkIEMPH7J6_cjs.ArkadeProgramScript,
|
|
19495
|
+
ArkadeScript: () => chunkIEMPH7J6_cjs.ArkadeScript,
|
|
19466
19496
|
ArkadeTransactionBuilder: () => ArkadeTransactionBuilder,
|
|
19467
|
-
BigNum: () =>
|
|
19497
|
+
BigNum: () => chunkIEMPH7J6_cjs.bignum_exports,
|
|
19468
19498
|
OP: () => btcSigner.OP,
|
|
19469
|
-
OPCODE_NAMES: () =>
|
|
19470
|
-
OPCODE_VALUES: () =>
|
|
19471
|
-
SUPPORTED_PROGRAM_VERSION: () =>
|
|
19499
|
+
OPCODE_NAMES: () => chunkIEMPH7J6_cjs.OPCODE_NAMES,
|
|
19500
|
+
OPCODE_VALUES: () => chunkIEMPH7J6_cjs.OPCODE_VALUES,
|
|
19501
|
+
SUPPORTED_PROGRAM_VERSION: () => chunkIEMPH7J6_cjs.SUPPORTED_PROGRAM_VERSION,
|
|
19472
19502
|
Script: () => btcSigner.Script,
|
|
19473
|
-
arkadeScriptHash: () =>
|
|
19474
|
-
arkadeWitnessHash: () =>
|
|
19475
|
-
asmToBytes: () =>
|
|
19476
|
-
bytesToASM: () =>
|
|
19477
|
-
computeArkadeScriptPublicKey: () =>
|
|
19503
|
+
arkadeScriptHash: () => chunkIEMPH7J6_cjs.arkadeScriptHash,
|
|
19504
|
+
arkadeWitnessHash: () => chunkIEMPH7J6_cjs.arkadeWitnessHash,
|
|
19505
|
+
asmToBytes: () => chunkIEMPH7J6_cjs.asmToBytes,
|
|
19506
|
+
bytesToASM: () => chunkIEMPH7J6_cjs.bytesToASM,
|
|
19507
|
+
computeArkadeScriptPublicKey: () => chunkIEMPH7J6_cjs.computeArkadeScriptPublicKey,
|
|
19478
19508
|
createArkadeBatchHandler: () => createArkadeBatchHandler,
|
|
19479
|
-
deserializeArkadeContractParams: () =>
|
|
19480
|
-
fromASM: () =>
|
|
19481
|
-
getOpcodeName: () =>
|
|
19482
|
-
getOpcodeValue: () =>
|
|
19483
|
-
parseArtifact: () =>
|
|
19484
|
-
resolveAsm: () =>
|
|
19485
|
-
serializeArkadeContractParams: () =>
|
|
19486
|
-
stringifyArtifact: () =>
|
|
19487
|
-
toASM: () =>
|
|
19488
|
-
validateProgram: () =>
|
|
19489
|
-
witnessRefToBytes: () =>
|
|
19509
|
+
deserializeArkadeContractParams: () => chunkIEMPH7J6_cjs.deserializeArkadeContractParams,
|
|
19510
|
+
fromASM: () => chunkIEMPH7J6_cjs.fromASM,
|
|
19511
|
+
getOpcodeName: () => chunkIEMPH7J6_cjs.getOpcodeName,
|
|
19512
|
+
getOpcodeValue: () => chunkIEMPH7J6_cjs.getOpcodeValue,
|
|
19513
|
+
parseArtifact: () => chunkIEMPH7J6_cjs.parseArtifact,
|
|
19514
|
+
resolveAsm: () => chunkIEMPH7J6_cjs.resolveAsm,
|
|
19515
|
+
serializeArkadeContractParams: () => chunkIEMPH7J6_cjs.serializeArkadeContractParams,
|
|
19516
|
+
stringifyArtifact: () => chunkIEMPH7J6_cjs.stringifyArtifact,
|
|
19517
|
+
toASM: () => chunkIEMPH7J6_cjs.toASM,
|
|
19518
|
+
validateProgram: () => chunkIEMPH7J6_cjs.validateProgram,
|
|
19519
|
+
witnessRefToBytes: () => chunkIEMPH7J6_cjs.witnessRefToBytes
|
|
19490
19520
|
});
|
|
19491
19521
|
var isVtxoCoin = (input) => chunkE7HB3GKK_cjs.isVirtualCoin(input);
|
|
19492
19522
|
function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients) {
|
|
@@ -19518,7 +19548,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
|
|
|
19518
19548
|
if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
|
|
19519
19549
|
return { skip: true };
|
|
19520
19550
|
}
|
|
19521
|
-
const commitmentTx =
|
|
19551
|
+
const commitmentTx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
|
|
19522
19552
|
validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
|
|
19523
19553
|
if (recipients && recipients.length > 0) {
|
|
19524
19554
|
validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
|
|
@@ -19549,7 +19579,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
|
|
|
19549
19579
|
if (connectorTree) {
|
|
19550
19580
|
validateConnectorsTxGraph(event.commitmentTx, connectorTree);
|
|
19551
19581
|
}
|
|
19552
|
-
let commitmentPsbt =
|
|
19582
|
+
let commitmentPsbt = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
|
|
19553
19583
|
const signedForfeits = [];
|
|
19554
19584
|
let connectorIndex = 0;
|
|
19555
19585
|
const connectorLeaves = connectorTree?.leaves() || [];
|
|
@@ -19715,7 +19745,7 @@ var Arkade = class _Arkade {
|
|
|
19715
19745
|
* key respectively; explicit args always win.
|
|
19716
19746
|
*/
|
|
19717
19747
|
contract(program, args = {}) {
|
|
19718
|
-
const declared = (program.params ?? []).map(
|
|
19748
|
+
const declared = (program.params ?? []).map(chunkIEMPH7J6_cjs.inputName);
|
|
19719
19749
|
if (declared.includes("server") && args.server === void 0) {
|
|
19720
19750
|
args = { ...args, server: this.serverKey };
|
|
19721
19751
|
}
|
|
@@ -19735,7 +19765,7 @@ var ArkadeContract = class _ArkadeContract {
|
|
|
19735
19765
|
userKey: client.userKey,
|
|
19736
19766
|
emulatorKey: client.emulatorKey
|
|
19737
19767
|
};
|
|
19738
|
-
this.vtxoScript = new
|
|
19768
|
+
this.vtxoScript = new chunkIEMPH7J6_cjs.ArkadeProgramScript(program, args, this.keys);
|
|
19739
19769
|
this.tapTree = this.vtxoScript.encode();
|
|
19740
19770
|
this.compiled = this.vtxoScript.compiled;
|
|
19741
19771
|
}
|
|
@@ -19763,7 +19793,7 @@ var ArkadeContract = class _ArkadeContract {
|
|
|
19763
19793
|
`ArkadeContract.fromContract: expected contract type 'arkade', got '${contract.type}'`
|
|
19764
19794
|
);
|
|
19765
19795
|
}
|
|
19766
|
-
const typed =
|
|
19796
|
+
const typed = chunkIEMPH7J6_cjs.deserializeArkadeContractParams(contract.params);
|
|
19767
19797
|
return new _ArkadeContract(client, typed.program, typed.args, {
|
|
19768
19798
|
serverKey: typed.serverKey,
|
|
19769
19799
|
userKey: typed.userKey,
|
|
@@ -19804,7 +19834,7 @@ var ArkadeContract = class _ArkadeContract {
|
|
|
19804
19834
|
toContractParams() {
|
|
19805
19835
|
return {
|
|
19806
19836
|
type: "arkade",
|
|
19807
|
-
params:
|
|
19837
|
+
params: chunkIEMPH7J6_cjs.serializeArkadeContractParams({
|
|
19808
19838
|
program: this.program,
|
|
19809
19839
|
args: this.args,
|
|
19810
19840
|
serverKey: this.keys.serverKey,
|
|
@@ -19957,12 +19987,12 @@ var ArkadeTransactionBuilder = class {
|
|
|
19957
19987
|
this.contract.client.checkpoint
|
|
19958
19988
|
);
|
|
19959
19989
|
if (coin.sourceTx) {
|
|
19960
|
-
|
|
19990
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(arkTx, 0, chunkRNMLFY2V_cjs.PrevArkTxField, coin.sourceTx);
|
|
19961
19991
|
}
|
|
19962
19992
|
const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
|
|
19963
19993
|
if (condition.length > 0) {
|
|
19964
|
-
|
|
19965
|
-
|
|
19994
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(arkTx, 0, chunkRNMLFY2V_cjs.ConditionWitness, condition);
|
|
19995
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(checkpoints[0], 0, chunkRNMLFY2V_cjs.ConditionWitness, condition);
|
|
19966
19996
|
}
|
|
19967
19997
|
const packets = [];
|
|
19968
19998
|
if (this.assetSpecs.length > 0) {
|
|
@@ -20001,7 +20031,7 @@ var ArkadeTransactionBuilder = class {
|
|
|
20001
20031
|
base.base64.encode(signedArk2.toPSBT()),
|
|
20002
20032
|
signedCps.map((c) => base.base64.encode(c.toPSBT()))
|
|
20003
20033
|
);
|
|
20004
|
-
const txid =
|
|
20034
|
+
const txid = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
|
|
20005
20035
|
return {
|
|
20006
20036
|
txid,
|
|
20007
20037
|
signedArkTx: res2.signedArkTx,
|
|
@@ -20019,7 +20049,7 @@ var ArkadeTransactionBuilder = class {
|
|
|
20019
20049
|
const finalCps = await Promise.all(
|
|
20020
20050
|
res.signedCheckpointTxs.map(
|
|
20021
20051
|
async (b) => base.base64.encode(
|
|
20022
|
-
(await client.identity.sign(
|
|
20052
|
+
(await client.identity.sign(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(b)), [0])).toPSBT()
|
|
20023
20053
|
)
|
|
20024
20054
|
)
|
|
20025
20055
|
);
|
|
@@ -20060,23 +20090,23 @@ var ArkadeTransactionBuilder = class {
|
|
|
20060
20090
|
}
|
|
20061
20091
|
buildAssetPacket() {
|
|
20062
20092
|
const groups = this.assetSpecs.map((s) => {
|
|
20063
|
-
const id = typeof s.assetId === "string" ?
|
|
20064
|
-
return
|
|
20093
|
+
const id = typeof s.assetId === "string" ? chunkRNMLFY2V_cjs.AssetId.fromString(s.assetId) : chunkRNMLFY2V_cjs.AssetId.fromBytes(s.assetId);
|
|
20094
|
+
return chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
20065
20095
|
id,
|
|
20066
20096
|
null,
|
|
20067
|
-
s.inputs.map((i) =>
|
|
20068
|
-
s.outputs.map((o) =>
|
|
20069
|
-
(s.metadata ?? []).map((m) =>
|
|
20097
|
+
s.inputs.map((i) => chunkRNMLFY2V_cjs.AssetInput.create(i.vin, i.amount)),
|
|
20098
|
+
s.outputs.map((o) => chunkRNMLFY2V_cjs.AssetOutput.create(o.vout, o.amount)),
|
|
20099
|
+
(s.metadata ?? []).map((m) => chunkRNMLFY2V_cjs.Metadata.create(m.key, m.value))
|
|
20070
20100
|
);
|
|
20071
20101
|
});
|
|
20072
|
-
return
|
|
20102
|
+
return chunkRNMLFY2V_cjs.Packet.create(groups);
|
|
20073
20103
|
}
|
|
20074
20104
|
witnessBytes(ref) {
|
|
20075
|
-
return
|
|
20105
|
+
return chunkIEMPH7J6_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
|
|
20076
20106
|
}
|
|
20077
20107
|
};
|
|
20078
20108
|
function bindInputs(fn, callArgs) {
|
|
20079
|
-
const names = (fn.def.inputs ?? []).map(
|
|
20109
|
+
const names = (fn.def.inputs ?? []).map(chunkIEMPH7J6_cjs.inputName);
|
|
20080
20110
|
if (callArgs.length !== names.length) {
|
|
20081
20111
|
throw new Error(`${fn.name}: expected ${names.length} argument(s), got ${callArgs.length}`);
|
|
20082
20112
|
}
|
|
@@ -20129,7 +20159,7 @@ function decodeArkContract(encoded) {
|
|
|
20129
20159
|
}
|
|
20130
20160
|
function contractFromArkContract(encoded, options = {}) {
|
|
20131
20161
|
const parsed = decodeArkContract(encoded);
|
|
20132
|
-
const handler =
|
|
20162
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.get(parsed.type);
|
|
20133
20163
|
if (!handler) {
|
|
20134
20164
|
throw new Error(`No handler registered for contract type '${parsed.type}'`);
|
|
20135
20165
|
}
|
|
@@ -20145,7 +20175,7 @@ function contractFromArkContract(encoded, options = {}) {
|
|
|
20145
20175
|
}
|
|
20146
20176
|
function contractFromArkContractWithAddress(encoded, serverPubKey, addressPrefix = chunkE7HB3GKK_cjs.DEFAULT_NETWORK.hrp, options = {}) {
|
|
20147
20177
|
const parsed = decodeArkContract(encoded);
|
|
20148
|
-
const handler =
|
|
20178
|
+
const handler = chunkIEMPH7J6_cjs.contractHandlers.getOrThrow(parsed.type);
|
|
20149
20179
|
const params = parsed.data;
|
|
20150
20180
|
const vtxoScript = handler.createScript(params);
|
|
20151
20181
|
return {
|
|
@@ -20259,12 +20289,15 @@ exports.extendVirtualCoinForContract = extendVirtualCoinForContract;
|
|
|
20259
20289
|
exports.getMigrationStatus = getMigrationStatus;
|
|
20260
20290
|
exports.getRandomId = getRandomId;
|
|
20261
20291
|
exports.hasBoardingTxExpired = hasBoardingTxExpired;
|
|
20292
|
+
exports.hasCandidates = hasCandidates;
|
|
20262
20293
|
exports.intentMatchesFilter = intentMatchesFilter;
|
|
20263
20294
|
exports.intentPageBounds = intentPageBounds;
|
|
20264
20295
|
exports.isArkContract = isArkContract;
|
|
20265
20296
|
exports.isBatchSignable = isBatchSignable;
|
|
20266
20297
|
exports.isCooperativelyMigratable = isCooperativelyMigratable;
|
|
20267
20298
|
exports.isDiscoverable = isDiscoverable;
|
|
20299
|
+
exports.isMessageBusInitializingError = isMessageBusInitializingError;
|
|
20300
|
+
exports.isMessageBusNotInitializedError = isMessageBusNotInitializedError;
|
|
20268
20301
|
exports.isRetryableProviderError = isRetryableProviderError;
|
|
20269
20302
|
exports.isSubdust = isSubdust;
|
|
20270
20303
|
exports.isTerminalIntentState = isTerminalIntentState;
|
|
@@ -20292,5 +20325,5 @@ exports.validateVtxoTxGraph = validateVtxoTxGraph;
|
|
|
20292
20325
|
exports.verifyTapscriptSignatures = verifyTapscriptSignatures;
|
|
20293
20326
|
exports.waitForIncomingFunds = waitForIncomingFunds;
|
|
20294
20327
|
exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
|
|
20295
|
-
//# sourceMappingURL=chunk-
|
|
20296
|
-
//# sourceMappingURL=chunk-
|
|
20328
|
+
//# sourceMappingURL=chunk-3YC3LQ2E.cjs.map
|
|
20329
|
+
//# sourceMappingURL=chunk-3YC3LQ2E.cjs.map
|