@arkade-os/sdk 0.4.52 → 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/dist/adapters/expo.cjs +4 -4
- package/dist/adapters/expo.js +2 -2
- package/dist/adapters/indexedDB.cjs +3 -3
- package/dist/adapters/indexedDB.js +2 -2
- package/dist/{asyncStorageTaskQueue-DScPdQAy.d.cts → asyncStorageTaskQueue-B0SUQMXw.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-BImF14sj.d.ts → asyncStorageTaskQueue-DWqxuIAs.d.ts} +2 -2
- package/dist/{chunk-AXCKRS2D.js → chunk-3MMUKLCI.js} +10 -10
- package/dist/{chunk-AXCKRS2D.js.map → chunk-3MMUKLCI.js.map} +1 -1
- package/dist/{chunk-WIVQWYPZ.js → chunk-3XWDMLOI.js} +3 -3
- package/dist/{chunk-WIVQWYPZ.js.map → chunk-3XWDMLOI.js.map} +1 -1
- package/dist/{chunk-ML33GFCH.cjs → chunk-3YC3LQ2E.cjs} +116 -114
- package/dist/{chunk-ML33GFCH.cjs.map → chunk-3YC3LQ2E.cjs.map} +1 -1
- package/dist/{chunk-E6RT5XYB.cjs → chunk-4GB73TRR.cjs} +11 -11
- package/dist/{chunk-E6RT5XYB.cjs.map → chunk-4GB73TRR.cjs.map} +1 -1
- package/dist/{chunk-3ZGANANS.js → chunk-B4WZOJAI.js} +3 -3
- package/dist/{chunk-3ZGANANS.js.map → chunk-B4WZOJAI.js.map} +1 -1
- package/dist/{chunk-3Z5HK35D.cjs → chunk-CZTQLA55.cjs} +7 -7
- package/dist/{chunk-3Z5HK35D.cjs.map → chunk-CZTQLA55.cjs.map} +1 -1
- package/dist/{chunk-ZK3JITHP.js → chunk-LHYNNDY6.js} +3 -3
- package/dist/{chunk-ZK3JITHP.js.map → chunk-LHYNNDY6.js.map} +1 -1
- package/dist/{chunk-FZPYPEWN.cjs → chunk-RNMLFY2V.cjs} +3 -3
- package/dist/{chunk-FZPYPEWN.cjs.map → chunk-RNMLFY2V.cjs.map} +1 -1
- package/dist/index.cjs +154 -146
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/repositories/realm/index.cjs +17 -17
- package/dist/repositories/realm/index.js +3 -3
- package/dist/repositories/sqlite/index.cjs +16 -16
- package/dist/repositories/sqlite/index.js +3 -3
- package/dist/{taskRunner-ClwI8jU8.d.cts → taskRunner-B7svzMhT.d.cts} +1 -1
- package/dist/{taskRunner-Cf80BqSy.d.ts → taskRunner-nzJFH8qb.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +13 -13
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +2 -2
- package/dist/wallet/expo/background.d.ts +2 -2
- package/dist/wallet/expo/background.js +5 -5
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +12 -12
- package/dist/wallet/expo/index.d.cts +1 -1
- package/dist/wallet/expo/index.d.ts +1 -1
- package/dist/wallet/expo/index.js +3 -3
- package/dist/worker/expo/index.cjs +7 -7
- package/dist/worker/expo/index.d.cts +3 -3
- package/dist/worker/expo/index.d.ts +3 -3
- package/dist/worker/expo/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRNMLFY2V_cjs = require('./chunk-RNMLFY2V.cjs');
|
|
4
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');
|
|
@@ -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
|
});
|
|
@@ -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
|
})
|
|
@@ -3342,7 +3342,7 @@ var VtxoManager = class _VtxoManager {
|
|
|
3342
3342
|
`Sweep not economical: output ${outputAmount} sats after ${fee} sats fee is below dust (${dustAmount} sats)`
|
|
3343
3343
|
);
|
|
3344
3344
|
}
|
|
3345
|
-
const tx = new
|
|
3345
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction();
|
|
3346
3346
|
for (const utxo of expiredUtxos) {
|
|
3347
3347
|
const utxoScript = chunkE7HB3GKK_cjs.VtxoScript.decode(utxo.tapTree);
|
|
3348
3348
|
const utxoExitLeaf = utxoScript.leaves.find(
|
|
@@ -4001,8 +4001,8 @@ var VtxoManager = class _VtxoManager {
|
|
|
4001
4001
|
* or doesn't carry the metadata.
|
|
4002
4002
|
*/
|
|
4003
4003
|
extractSpentOutpoint(error) {
|
|
4004
|
-
const ark =
|
|
4005
|
-
if (!
|
|
4004
|
+
const ark = chunkRNMLFY2V_cjs.maybeArkError(error);
|
|
4005
|
+
if (!chunkRNMLFY2V_cjs.isArkError(ark, chunkRNMLFY2V_cjs.ArkErrorName.VTXO_ALREADY_SPENT)) return void 0;
|
|
4006
4006
|
const raw = ark.metadata?.vtxo_outpoint;
|
|
4007
4007
|
if (typeof raw !== "string") return void 0;
|
|
4008
4008
|
const [txid, voutStr] = raw.split(":");
|
|
@@ -4737,7 +4737,7 @@ async function captureExitBranch(params) {
|
|
|
4737
4737
|
const nonCommitment = ordered.filter((c) => chainTxTypeToChainedExit(c.type) !== 1 /* Commitment */).map((c) => c.txid);
|
|
4738
4738
|
if (nonCommitment.length > 0) {
|
|
4739
4739
|
for (const psbt of await resolver.getVirtualTxs(nonCommitment)) {
|
|
4740
|
-
psbtByTxid.set(
|
|
4740
|
+
psbtByTxid.set(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
|
|
4741
4741
|
}
|
|
4742
4742
|
}
|
|
4743
4743
|
}
|
|
@@ -4798,7 +4798,7 @@ var IndexerExitDataSource = class {
|
|
|
4798
4798
|
pageSize: chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE
|
|
4799
4799
|
});
|
|
4800
4800
|
for (const psbt of txs) {
|
|
4801
|
-
out.set(
|
|
4801
|
+
out.set(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
|
|
4802
4802
|
}
|
|
4803
4803
|
hasMore = page ? txs.length === chunkE7HB3GKK_cjs.DEFAULT_PAGE_SIZE : false;
|
|
4804
4804
|
pageIndex++;
|
|
@@ -4821,7 +4821,7 @@ function chainedTxTypeToChainTxType(t) {
|
|
|
4821
4821
|
}
|
|
4822
4822
|
}
|
|
4823
4823
|
function psbtInputTxids(psbtBase64) {
|
|
4824
|
-
const tx =
|
|
4824
|
+
const tx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
|
|
4825
4825
|
const ids = [];
|
|
4826
4826
|
for (let i = 0; i < tx.inputsLength; i++) {
|
|
4827
4827
|
const txid = tx.getInput(i).txid;
|
|
@@ -4924,7 +4924,7 @@ function createExitChainResolver(params) {
|
|
|
4924
4924
|
|
|
4925
4925
|
// src/providers/availability.ts
|
|
4926
4926
|
function isRetryableProviderError(error) {
|
|
4927
|
-
return error instanceof
|
|
4927
|
+
return error instanceof chunkRNMLFY2V_cjs.ProviderUnavailableError || error instanceof chunkRNMLFY2V_cjs.FetchError || chunkRNMLFY2V_cjs.isFetchTimeoutError(error);
|
|
4928
4928
|
}
|
|
4929
4929
|
|
|
4930
4930
|
// src/utils/syncCursors.ts
|
|
@@ -5177,7 +5177,7 @@ async function resolveArkInfo(arkProvider, walletRepository) {
|
|
|
5177
5177
|
if (!isRetryableProviderError(err)) throw err;
|
|
5178
5178
|
const snapshot = await loadArkInfoSnapshot(walletRepository);
|
|
5179
5179
|
if (!snapshot) {
|
|
5180
|
-
throw new
|
|
5180
|
+
throw new chunkRNMLFY2V_cjs.ProviderUnavailableError(
|
|
5181
5181
|
"Arkade server info is unavailable and no cached snapshot exists",
|
|
5182
5182
|
{ cause: err }
|
|
5183
5183
|
);
|
|
@@ -5712,7 +5712,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5712
5712
|
const virtualCoins = await this.wallet.getVtxos({
|
|
5713
5713
|
withRecoverable: false
|
|
5714
5714
|
});
|
|
5715
|
-
const controlAssetRef = params.controlAssetId ?
|
|
5715
|
+
const controlAssetRef = params.controlAssetId ? chunkRNMLFY2V_cjs.AssetRef.fromId(chunkRNMLFY2V_cjs.AssetId.fromString(params.controlAssetId)) : null;
|
|
5716
5716
|
const coinSelection = selectVirtualCoins(virtualCoins, Number(this.wallet.dustAmount));
|
|
5717
5717
|
let totalBtcSelected = 0n;
|
|
5718
5718
|
const assetChanges = /* @__PURE__ */ new Map();
|
|
@@ -5725,8 +5725,8 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5725
5725
|
}
|
|
5726
5726
|
}
|
|
5727
5727
|
const groups = [];
|
|
5728
|
-
const issuedAssetOutput =
|
|
5729
|
-
const issuedAssetGroup =
|
|
5728
|
+
const issuedAssetOutput = chunkRNMLFY2V_cjs.AssetOutput.create(0, params.amount);
|
|
5729
|
+
const issuedAssetGroup = chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5730
5730
|
null,
|
|
5731
5731
|
controlAssetRef,
|
|
5732
5732
|
[],
|
|
@@ -5741,15 +5741,15 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5741
5741
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5742
5742
|
for (const asset of assets) {
|
|
5743
5743
|
if (asset.assetId !== assetId) continue;
|
|
5744
|
-
changeInputs.push(
|
|
5744
|
+
changeInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5745
5745
|
}
|
|
5746
5746
|
}
|
|
5747
5747
|
groups.push(
|
|
5748
|
-
|
|
5749
|
-
|
|
5748
|
+
chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5749
|
+
chunkRNMLFY2V_cjs.AssetId.fromString(assetId),
|
|
5750
5750
|
null,
|
|
5751
5751
|
changeInputs,
|
|
5752
|
-
[
|
|
5752
|
+
[chunkRNMLFY2V_cjs.AssetOutput.create(0, amount)],
|
|
5753
5753
|
[]
|
|
5754
5754
|
)
|
|
5755
5755
|
);
|
|
@@ -5762,7 +5762,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5762
5762
|
script: outputAddress.pkScript,
|
|
5763
5763
|
amount: BigInt(totalBtcSelected)
|
|
5764
5764
|
},
|
|
5765
|
-
Extension.create([
|
|
5765
|
+
Extension.create([chunkRNMLFY2V_cjs.Packet.create(groups)]).txOut()
|
|
5766
5766
|
];
|
|
5767
5767
|
const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(
|
|
5768
5768
|
coinSelection.inputs,
|
|
@@ -5770,7 +5770,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5770
5770
|
);
|
|
5771
5771
|
return {
|
|
5772
5772
|
arkTxId: arkTxid,
|
|
5773
|
-
assetId:
|
|
5773
|
+
assetId: chunkRNMLFY2V_cjs.AssetId.create(arkTxid, 0).toString()
|
|
5774
5774
|
};
|
|
5775
5775
|
}
|
|
5776
5776
|
/**
|
|
@@ -5842,16 +5842,16 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5842
5842
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5843
5843
|
for (const asset of assets) {
|
|
5844
5844
|
if (asset.assetId !== params.assetId) continue;
|
|
5845
|
-
reissueInputs.push(
|
|
5845
|
+
reissueInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5846
5846
|
}
|
|
5847
5847
|
}
|
|
5848
5848
|
const totalAssetAmount = assetToReissueAmount + params.amount;
|
|
5849
|
-
const reissueAssetIdObj =
|
|
5850
|
-
const reissueAssetGroup =
|
|
5849
|
+
const reissueAssetIdObj = chunkRNMLFY2V_cjs.AssetId.fromString(params.assetId);
|
|
5850
|
+
const reissueAssetGroup = chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5851
5851
|
reissueAssetIdObj,
|
|
5852
5852
|
null,
|
|
5853
5853
|
reissueInputs,
|
|
5854
|
-
[
|
|
5854
|
+
[chunkRNMLFY2V_cjs.AssetOutput.create(0, totalAssetAmount)],
|
|
5855
5855
|
[]
|
|
5856
5856
|
);
|
|
5857
5857
|
const groups = [reissueAssetGroup];
|
|
@@ -5860,15 +5860,15 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5860
5860
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5861
5861
|
for (const asset of assets) {
|
|
5862
5862
|
if (asset.assetId !== assetId) continue;
|
|
5863
|
-
changeInputs.push(
|
|
5863
|
+
changeInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5864
5864
|
}
|
|
5865
5865
|
}
|
|
5866
5866
|
groups.push(
|
|
5867
|
-
|
|
5868
|
-
|
|
5867
|
+
chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5868
|
+
chunkRNMLFY2V_cjs.AssetId.fromString(assetId),
|
|
5869
5869
|
null,
|
|
5870
5870
|
changeInputs,
|
|
5871
|
-
[
|
|
5871
|
+
[chunkRNMLFY2V_cjs.AssetOutput.create(0, amount)],
|
|
5872
5872
|
[]
|
|
5873
5873
|
)
|
|
5874
5874
|
);
|
|
@@ -5880,7 +5880,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5880
5880
|
script: outputAddress.pkScript,
|
|
5881
5881
|
amount: BigInt(totalBtcSelected)
|
|
5882
5882
|
},
|
|
5883
|
-
Extension.create([
|
|
5883
|
+
Extension.create([chunkRNMLFY2V_cjs.Packet.create(groups)]).txOut()
|
|
5884
5884
|
];
|
|
5885
5885
|
const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
|
|
5886
5886
|
return arkTxid;
|
|
@@ -5947,15 +5947,15 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5947
5947
|
for (const [inputIndex, assets] of assetInputs) {
|
|
5948
5948
|
for (const asset of assets) {
|
|
5949
5949
|
if (asset.assetId !== assetId) continue;
|
|
5950
|
-
changeInputs.push(
|
|
5950
|
+
changeInputs.push(chunkRNMLFY2V_cjs.AssetInput.create(inputIndex, asset.amount));
|
|
5951
5951
|
}
|
|
5952
5952
|
}
|
|
5953
5953
|
groups.push(
|
|
5954
|
-
|
|
5955
|
-
|
|
5954
|
+
chunkRNMLFY2V_cjs.AssetGroup.create(
|
|
5955
|
+
chunkRNMLFY2V_cjs.AssetId.fromString(assetId),
|
|
5956
5956
|
null,
|
|
5957
5957
|
changeInputs,
|
|
5958
|
-
amount > 0n ? [
|
|
5958
|
+
amount > 0n ? [chunkRNMLFY2V_cjs.AssetOutput.create(0, amount)] : [],
|
|
5959
5959
|
[]
|
|
5960
5960
|
)
|
|
5961
5961
|
);
|
|
@@ -5967,7 +5967,7 @@ var AssetManager = class extends ReadonlyAssetManager {
|
|
|
5967
5967
|
script: outputAddress.pkScript,
|
|
5968
5968
|
amount: BigInt(totalBtcSelected)
|
|
5969
5969
|
},
|
|
5970
|
-
Extension.create([
|
|
5970
|
+
Extension.create([chunkRNMLFY2V_cjs.Packet.create(groups)]).txOut()
|
|
5971
5971
|
];
|
|
5972
5972
|
const { arkTxid } = await this.wallet.buildAndSubmitOffchainTx(selectedCoins, outputs);
|
|
5973
5973
|
return arkTxid;
|
|
@@ -5992,7 +5992,7 @@ function castMetadata(metadata) {
|
|
|
5992
5992
|
} else {
|
|
5993
5993
|
throw new Error("Invalid metadata value type");
|
|
5994
5994
|
}
|
|
5995
|
-
md.push(
|
|
5995
|
+
md.push(chunkRNMLFY2V_cjs.Metadata.create(textEncoder.encode(key), valueBytes));
|
|
5996
5996
|
}
|
|
5997
5997
|
return md;
|
|
5998
5998
|
}
|
|
@@ -6276,7 +6276,7 @@ async function makeSignedDelegateIntent(identity, coins, outputs, onchainOutputs
|
|
|
6276
6276
|
expire_at: 0,
|
|
6277
6277
|
cosigners_public_keys: cosignerPubKeys
|
|
6278
6278
|
};
|
|
6279
|
-
const proof =
|
|
6279
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, outputs);
|
|
6280
6280
|
const signedProof = await identity.sign(proof);
|
|
6281
6281
|
return {
|
|
6282
6282
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -8325,7 +8325,7 @@ var ContractWatcher = class {
|
|
|
8325
8325
|
this.connectionState = "connected";
|
|
8326
8326
|
this.reconnectAttempts = 0;
|
|
8327
8327
|
this.listenLoop().catch((e) => {
|
|
8328
|
-
if (
|
|
8328
|
+
if (chunkRNMLFY2V_cjs.isEventSourceError(e)) {
|
|
8329
8329
|
console.debug("ContractWatcher subscription disconnected; reconnecting");
|
|
8330
8330
|
} else {
|
|
8331
8331
|
console.error(e);
|
|
@@ -10840,7 +10840,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
10840
10840
|
*/
|
|
10841
10841
|
static async setupWalletConfig(config, pubKey) {
|
|
10842
10842
|
const arkadeServerUrl = getArkadeServerUrl(config);
|
|
10843
|
-
const arkProvider = config.arkProvider || new
|
|
10843
|
+
const arkProvider = config.arkProvider || new chunkRNMLFY2V_cjs.RestArkProvider(arkadeServerUrl);
|
|
10844
10844
|
let indexerProvider = config.indexerProvider;
|
|
10845
10845
|
if (!indexerProvider) {
|
|
10846
10846
|
let indexerUrl = config.indexerUrl;
|
|
@@ -10857,7 +10857,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
10857
10857
|
indexerUrl = arkadeServerUrl;
|
|
10858
10858
|
}
|
|
10859
10859
|
}
|
|
10860
|
-
indexerProvider = new
|
|
10860
|
+
indexerProvider = new chunkRNMLFY2V_cjs.RestIndexerProvider(indexerUrl);
|
|
10861
10861
|
}
|
|
10862
10862
|
const walletRepository = config.storage?.walletRepository ?? new IndexedDBWalletRepository();
|
|
10863
10863
|
const contractRepository = config.storage?.contractRepository ?? new IndexedDBContractRepository();
|
|
@@ -13004,9 +13004,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13004
13004
|
...existing ?? {},
|
|
13005
13005
|
intentTxId,
|
|
13006
13006
|
registerProof: intent.proof,
|
|
13007
|
-
registerProofMessage:
|
|
13007
|
+
registerProofMessage: chunkRNMLFY2V_cjs.Intent.encodeMessage(intent.message),
|
|
13008
13008
|
deleteProof: deleteIntent.proof,
|
|
13009
|
-
deleteProofMessage:
|
|
13009
|
+
deleteProofMessage: chunkRNMLFY2V_cjs.Intent.encodeMessage(deleteIntent.message),
|
|
13010
13010
|
intentVtxos: inputs.map((i) => ({
|
|
13011
13011
|
txid: i.txid,
|
|
13012
13012
|
vout: i.vout
|
|
@@ -13038,7 +13038,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13038
13038
|
try {
|
|
13039
13039
|
return await this.arkProvider.registerIntent(intent);
|
|
13040
13040
|
} catch (error) {
|
|
13041
|
-
if (error instanceof
|
|
13041
|
+
if (error instanceof chunkRNMLFY2V_cjs.ArkError && error.code === 0 && error.message.includes("duplicated input")) {
|
|
13042
13042
|
const deleteIntent = await this.makeDeleteIntentSignature(inputs);
|
|
13043
13043
|
await this.arkProvider.deleteIntent(deleteIntent);
|
|
13044
13044
|
return this.arkProvider.registerIntent(intent);
|
|
@@ -13054,7 +13054,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13054
13054
|
expire_at: 0,
|
|
13055
13055
|
cosigners_public_keys: cosignerPubKeys
|
|
13056
13056
|
};
|
|
13057
|
-
const proof =
|
|
13057
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, outputs);
|
|
13058
13058
|
const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
|
|
13059
13059
|
return {
|
|
13060
13060
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -13066,7 +13066,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13066
13066
|
type: "delete",
|
|
13067
13067
|
expire_at: 0
|
|
13068
13068
|
};
|
|
13069
|
-
const proof =
|
|
13069
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, []);
|
|
13070
13070
|
const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
|
|
13071
13071
|
return {
|
|
13072
13072
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -13078,7 +13078,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13078
13078
|
type: "get-pending-tx",
|
|
13079
13079
|
expire_at: 0
|
|
13080
13080
|
};
|
|
13081
|
-
const proof =
|
|
13081
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, coins, []);
|
|
13082
13082
|
const signedProof = await this._signerRouter.sign(proof, intentProofJobs(coins));
|
|
13083
13083
|
return {
|
|
13084
13084
|
proof: base.base64.encode(signedProof.toPSBT()),
|
|
@@ -13411,7 +13411,7 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13411
13411
|
for (let i = 0; i < inputs.length; i += MAX_INPUTS_PER_INTENT) {
|
|
13412
13412
|
const batch = inputs.slice(i, i + MAX_INPUTS_PER_INTENT);
|
|
13413
13413
|
const message = { type: "get-pending-tx", expire_at: 0 };
|
|
13414
|
-
const proof =
|
|
13414
|
+
const proof = chunkRNMLFY2V_cjs.Intent.create(message, batch, []);
|
|
13415
13415
|
const signedProof = await identity.sign(
|
|
13416
13416
|
proof,
|
|
13417
13417
|
Array.from({ length: batch.length + 1 }, (_, j) => j)
|
|
@@ -14105,6 +14105,12 @@ var ServiceWorkerTimeoutError = class extends Error {
|
|
|
14105
14105
|
super(detail);
|
|
14106
14106
|
}
|
|
14107
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
|
+
}
|
|
14108
14114
|
|
|
14109
14115
|
// src/worker/messageBus.ts
|
|
14110
14116
|
var LATE_DELIVERY_GRACE_MS = 5 * 6e4;
|
|
@@ -14294,7 +14300,7 @@ var MessageBus = class {
|
|
|
14294
14300
|
this.initialized = true;
|
|
14295
14301
|
}
|
|
14296
14302
|
async buildServices(config) {
|
|
14297
|
-
const arkProvider = new
|
|
14303
|
+
const arkProvider = new chunkRNMLFY2V_cjs.RestArkProvider(config.arkServer.url);
|
|
14298
14304
|
const storage = {
|
|
14299
14305
|
walletRepository: this.walletRepository,
|
|
14300
14306
|
contractRepository: this.contractRepository
|
|
@@ -15455,7 +15461,7 @@ var WalletMessageHandler = class {
|
|
|
15455
15461
|
// Wallet methods
|
|
15456
15462
|
async handleInitWallet({ payload }) {
|
|
15457
15463
|
const { arkServerUrl } = payload;
|
|
15458
|
-
this.indexerProvider = new
|
|
15464
|
+
this.indexerProvider = new chunkRNMLFY2V_cjs.RestIndexerProvider(arkServerUrl);
|
|
15459
15465
|
await this.onWalletInitialized();
|
|
15460
15466
|
}
|
|
15461
15467
|
async handleGetBalance() {
|
|
@@ -15875,12 +15881,6 @@ var WalletMessageHandler = class {
|
|
|
15875
15881
|
};
|
|
15876
15882
|
|
|
15877
15883
|
// src/wallet/serviceWorker/wallet.ts
|
|
15878
|
-
function isMessageBusNotInitializedError(error) {
|
|
15879
|
-
return error instanceof Error && error.message.includes(MESSAGE_BUS_NOT_INITIALIZED);
|
|
15880
|
-
}
|
|
15881
|
-
function isMessageBusInitializingError(error) {
|
|
15882
|
-
return error instanceof Error && error.message.includes(MESSAGE_BUS_INITIALIZING);
|
|
15883
|
-
}
|
|
15884
15884
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
15885
15885
|
var INIT_WAIT_BACKOFF_CAP_MS = 2e3;
|
|
15886
15886
|
var MAX_INIT_WAITS = 8;
|
|
@@ -17332,7 +17332,7 @@ var OnchainWallet = class _OnchainWallet {
|
|
|
17332
17332
|
if (!inputs) {
|
|
17333
17333
|
throw new Error("Fee estimation failed");
|
|
17334
17334
|
}
|
|
17335
|
-
let tx = new
|
|
17335
|
+
let tx = new chunkRNMLFY2V_cjs.Transaction();
|
|
17336
17336
|
for (const input of inputs) {
|
|
17337
17337
|
tx.addInput({
|
|
17338
17338
|
txid: input.txid,
|
|
@@ -17390,7 +17390,7 @@ var OnchainWallet = class _OnchainWallet {
|
|
|
17390
17390
|
* @throws If the parent has no anchor, or funding cannot be selected/signed
|
|
17391
17391
|
*/
|
|
17392
17392
|
async bumpAnchor(parentHex, feeRate) {
|
|
17393
|
-
const parent =
|
|
17393
|
+
const parent = chunkRNMLFY2V_cjs.Transaction.fromRaw(base.hex.decode(parentHex));
|
|
17394
17394
|
const coins = (await this.getCoins()).filter((c) => c.status.confirmed);
|
|
17395
17395
|
const child = await this.buildBumpPackage(parent, feeRate, coins);
|
|
17396
17396
|
return [parent.hex, child.hex];
|
|
@@ -18155,7 +18155,7 @@ exports.BIP322 = void 0;
|
|
|
18155
18155
|
async function sign2(message, identity, network) {
|
|
18156
18156
|
const xOnlyPubKey = await identity.xOnlyPublicKey();
|
|
18157
18157
|
const payment = btcSigner.p2tr(xOnlyPubKey, void 0, network);
|
|
18158
|
-
const toSpend =
|
|
18158
|
+
const toSpend = chunkRNMLFY2V_cjs.craftToSpendTx(message, payment.script, TAG_BIP322);
|
|
18159
18159
|
const toSign = craftBIP322ToSignP2TR(toSpend, payment.script, xOnlyPubKey);
|
|
18160
18160
|
const signed = await identity.sign(toSign, [0]);
|
|
18161
18161
|
signed.finalizeIdx(0);
|
|
@@ -18213,7 +18213,7 @@ function verifyP2TR(message, witnessItems, pkScript, pubkey) {
|
|
|
18213
18213
|
if (sighashType !== btcSigner.SigHash.DEFAULT && sighashType !== btcSigner.SigHash.ALL) {
|
|
18214
18214
|
return false;
|
|
18215
18215
|
}
|
|
18216
|
-
const toSpend =
|
|
18216
|
+
const toSpend = chunkRNMLFY2V_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
|
|
18217
18217
|
const toSign = craftBIP322ToSignP2TR(toSpend, pkScript, pubkey);
|
|
18218
18218
|
const sighash = toSign.preimageWitnessV1(0, [pkScript], sighashType, [0n]);
|
|
18219
18219
|
const rawSig = sig.length === 65 ? sig.subarray(0, 64) : sig;
|
|
@@ -18234,7 +18234,7 @@ function verifyP2WPKH(message, witnessItems, pkScript, addressHash) {
|
|
|
18234
18234
|
}
|
|
18235
18235
|
const sighashType = sigWithHash[sigWithHash.length - 1];
|
|
18236
18236
|
const derSig = sigWithHash.subarray(0, sigWithHash.length - 1);
|
|
18237
|
-
const toSpend =
|
|
18237
|
+
const toSpend = chunkRNMLFY2V_cjs.craftToSpendTx(message, pkScript, TAG_BIP322);
|
|
18238
18238
|
const toSign = craftBIP322ToSignSimple(toSpend, pkScript);
|
|
18239
18239
|
const scriptCode = btcSigner.OutScript.encode({ type: "pkh", hash: addressHash });
|
|
18240
18240
|
const sighash = toSign.preimageWitnessV0(0, scriptCode, sighashType, 0n);
|
|
@@ -18287,7 +18287,7 @@ function encodeCompactSize(n) {
|
|
|
18287
18287
|
return buf;
|
|
18288
18288
|
}
|
|
18289
18289
|
function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
|
|
18290
|
-
const tx = new
|
|
18290
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 0 });
|
|
18291
18291
|
tx.addInput({
|
|
18292
18292
|
txid: toSpend.id,
|
|
18293
18293
|
index: 0,
|
|
@@ -18301,12 +18301,12 @@ function craftBIP322ToSignP2TR(toSpend, pkScript, tapInternalKey) {
|
|
|
18301
18301
|
});
|
|
18302
18302
|
tx.addOutput({
|
|
18303
18303
|
amount: 0n,
|
|
18304
|
-
script:
|
|
18304
|
+
script: chunkRNMLFY2V_cjs.OP_RETURN_EMPTY_PKSCRIPT
|
|
18305
18305
|
});
|
|
18306
18306
|
return tx;
|
|
18307
18307
|
}
|
|
18308
18308
|
function craftBIP322ToSignSimple(toSpend, pkScript) {
|
|
18309
|
-
const tx = new
|
|
18309
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 0 });
|
|
18310
18310
|
tx.addInput({
|
|
18311
18311
|
txid: toSpend.id,
|
|
18312
18312
|
index: 0,
|
|
@@ -18318,7 +18318,7 @@ function craftBIP322ToSignSimple(toSpend, pkScript) {
|
|
|
18318
18318
|
});
|
|
18319
18319
|
tx.addOutput({
|
|
18320
18320
|
amount: 0n,
|
|
18321
|
-
script:
|
|
18321
|
+
script: chunkRNMLFY2V_cjs.OP_RETURN_EMPTY_PKSCRIPT
|
|
18322
18322
|
});
|
|
18323
18323
|
return tx;
|
|
18324
18324
|
}
|
|
@@ -18449,7 +18449,7 @@ var RestEmulatorProvider = class {
|
|
|
18449
18449
|
}
|
|
18450
18450
|
};
|
|
18451
18451
|
function finalizeVirtualTx(type, psbtBase64) {
|
|
18452
|
-
const tx =
|
|
18452
|
+
const tx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbtBase64));
|
|
18453
18453
|
if (type === "INDEXER_CHAINED_TX_TYPE_TREE" /* TREE */) {
|
|
18454
18454
|
const input = tx.getInput(0);
|
|
18455
18455
|
if (!input) {
|
|
@@ -18727,7 +18727,7 @@ async function prepareUnrollTransaction(wallet, vtxoTxIds, outputAddress) {
|
|
|
18727
18727
|
btcSigner.TaprootControlBlock.encode(spendingLeaf[0]).length
|
|
18728
18728
|
);
|
|
18729
18729
|
}
|
|
18730
|
-
const tx = new
|
|
18730
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 2 });
|
|
18731
18731
|
for (const input of inputs) {
|
|
18732
18732
|
tx.addInput(input);
|
|
18733
18733
|
}
|
|
@@ -18794,7 +18794,7 @@ async function buildSignedSweep(params) {
|
|
|
18794
18794
|
`uneconomic vtxo ${vtxo.txid}:${vtxo.vout}: value ${vtxo.value} - fee ${fee} < dust`
|
|
18795
18795
|
);
|
|
18796
18796
|
}
|
|
18797
|
-
const tx = new
|
|
18797
|
+
const tx = new chunkRNMLFY2V_cjs.Transaction({ version: 2 });
|
|
18798
18798
|
tx.addInput({
|
|
18799
18799
|
txid: vtxo.txid,
|
|
18800
18800
|
index: vtxo.vout,
|
|
@@ -18894,7 +18894,7 @@ async function computeExitLayout(opts, feeRate) {
|
|
|
18894
18894
|
if (pendingNodes.length > 0) {
|
|
18895
18895
|
const txs = await resolver.getVirtualTxs(pendingNodes.map((n) => n.txid));
|
|
18896
18896
|
for (const psbt of txs) {
|
|
18897
|
-
psbts.set(
|
|
18897
|
+
psbts.set(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(psbt)).id, psbt);
|
|
18898
18898
|
}
|
|
18899
18899
|
}
|
|
18900
18900
|
const childVsize = Number(
|
|
@@ -19341,7 +19341,7 @@ async function prepare(opts) {
|
|
|
19341
19341
|
if (newFee <= splitterFee) break;
|
|
19342
19342
|
splitterFee = newFee;
|
|
19343
19343
|
}
|
|
19344
|
-
const splitter = new
|
|
19344
|
+
const splitter = new chunkRNMLFY2V_cjs.Transaction({ version: 2 });
|
|
19345
19345
|
for (const coin of selected.inputs) {
|
|
19346
19346
|
splitter.addInput({
|
|
19347
19347
|
txid: coin.txid,
|
|
@@ -19548,7 +19548,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
|
|
|
19548
19548
|
if (!xOnlyPubkeys.includes(base.hex.encode(xonlySignerPubKey))) {
|
|
19549
19549
|
return { skip: true };
|
|
19550
19550
|
}
|
|
19551
|
-
const commitmentTx =
|
|
19551
|
+
const commitmentTx = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(event.unsignedCommitmentTx));
|
|
19552
19552
|
validateVtxoTxGraph(vtxoTree, commitmentTx, sweepTapTreeRoot);
|
|
19553
19553
|
if (recipients && recipients.length > 0) {
|
|
19554
19554
|
validateBatchRecipients(commitmentTx, vtxoTree.leaves(), recipients, network);
|
|
@@ -19579,7 +19579,7 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
|
|
|
19579
19579
|
if (connectorTree) {
|
|
19580
19580
|
validateConnectorsTxGraph(event.commitmentTx, connectorTree);
|
|
19581
19581
|
}
|
|
19582
|
-
let commitmentPsbt =
|
|
19582
|
+
let commitmentPsbt = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(event.commitmentTx));
|
|
19583
19583
|
const signedForfeits = [];
|
|
19584
19584
|
let connectorIndex = 0;
|
|
19585
19585
|
const connectorLeaves = connectorTree?.leaves() || [];
|
|
@@ -19987,12 +19987,12 @@ var ArkadeTransactionBuilder = class {
|
|
|
19987
19987
|
this.contract.client.checkpoint
|
|
19988
19988
|
);
|
|
19989
19989
|
if (coin.sourceTx) {
|
|
19990
|
-
|
|
19990
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(arkTx, 0, chunkRNMLFY2V_cjs.PrevArkTxField, coin.sourceTx);
|
|
19991
19991
|
}
|
|
19992
19992
|
const condition = (def.tapscript.witness ?? []).map((w) => this.witnessBytes(w));
|
|
19993
19993
|
if (condition.length > 0) {
|
|
19994
|
-
|
|
19995
|
-
|
|
19994
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(arkTx, 0, chunkRNMLFY2V_cjs.ConditionWitness, condition);
|
|
19995
|
+
chunkRNMLFY2V_cjs.setArkPsbtField(checkpoints[0], 0, chunkRNMLFY2V_cjs.ConditionWitness, condition);
|
|
19996
19996
|
}
|
|
19997
19997
|
const packets = [];
|
|
19998
19998
|
if (this.assetSpecs.length > 0) {
|
|
@@ -20031,7 +20031,7 @@ var ArkadeTransactionBuilder = class {
|
|
|
20031
20031
|
base.base64.encode(signedArk2.toPSBT()),
|
|
20032
20032
|
signedCps.map((c) => base.base64.encode(c.toPSBT()))
|
|
20033
20033
|
);
|
|
20034
|
-
const txid =
|
|
20034
|
+
const txid = chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(res2.signedArkTx)).id;
|
|
20035
20035
|
return {
|
|
20036
20036
|
txid,
|
|
20037
20037
|
signedArkTx: res2.signedArkTx,
|
|
@@ -20049,7 +20049,7 @@ var ArkadeTransactionBuilder = class {
|
|
|
20049
20049
|
const finalCps = await Promise.all(
|
|
20050
20050
|
res.signedCheckpointTxs.map(
|
|
20051
20051
|
async (b) => base.base64.encode(
|
|
20052
|
-
(await client.identity.sign(
|
|
20052
|
+
(await client.identity.sign(chunkRNMLFY2V_cjs.Transaction.fromPSBT(base.base64.decode(b)), [0])).toPSBT()
|
|
20053
20053
|
)
|
|
20054
20054
|
)
|
|
20055
20055
|
);
|
|
@@ -20090,16 +20090,16 @@ var ArkadeTransactionBuilder = class {
|
|
|
20090
20090
|
}
|
|
20091
20091
|
buildAssetPacket() {
|
|
20092
20092
|
const groups = this.assetSpecs.map((s) => {
|
|
20093
|
-
const id = typeof s.assetId === "string" ?
|
|
20094
|
-
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(
|
|
20095
20095
|
id,
|
|
20096
20096
|
null,
|
|
20097
|
-
s.inputs.map((i) =>
|
|
20098
|
-
s.outputs.map((o) =>
|
|
20099
|
-
(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))
|
|
20100
20100
|
);
|
|
20101
20101
|
});
|
|
20102
|
-
return
|
|
20102
|
+
return chunkRNMLFY2V_cjs.Packet.create(groups);
|
|
20103
20103
|
}
|
|
20104
20104
|
witnessBytes(ref) {
|
|
20105
20105
|
return chunkIEMPH7J6_cjs.witnessRefToBytes(ref, this.args, this.contract.args);
|
|
@@ -20296,6 +20296,8 @@ exports.isArkContract = isArkContract;
|
|
|
20296
20296
|
exports.isBatchSignable = isBatchSignable;
|
|
20297
20297
|
exports.isCooperativelyMigratable = isCooperativelyMigratable;
|
|
20298
20298
|
exports.isDiscoverable = isDiscoverable;
|
|
20299
|
+
exports.isMessageBusInitializingError = isMessageBusInitializingError;
|
|
20300
|
+
exports.isMessageBusNotInitializedError = isMessageBusNotInitializedError;
|
|
20299
20301
|
exports.isRetryableProviderError = isRetryableProviderError;
|
|
20300
20302
|
exports.isSubdust = isSubdust;
|
|
20301
20303
|
exports.isTerminalIntentState = isTerminalIntentState;
|
|
@@ -20323,5 +20325,5 @@ exports.validateVtxoTxGraph = validateVtxoTxGraph;
|
|
|
20323
20325
|
exports.verifyTapscriptSignatures = verifyTapscriptSignatures;
|
|
20324
20326
|
exports.waitForIncomingFunds = waitForIncomingFunds;
|
|
20325
20327
|
exports.warnAndFilterVtxosForScript = warnAndFilterVtxosForScript;
|
|
20326
|
-
//# sourceMappingURL=chunk-
|
|
20327
|
-
//# sourceMappingURL=chunk-
|
|
20328
|
+
//# sourceMappingURL=chunk-3YC3LQ2E.cjs.map
|
|
20329
|
+
//# sourceMappingURL=chunk-3YC3LQ2E.cjs.map
|