@arkade-os/boltz-swap 0.3.13 → 0.3.15
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/{arkade-swaps-CHMKeBwG.d.ts → arkade-swaps-DRMB_apa.d.ts} +49 -49
- package/dist/{arkade-swaps-NStISj0-.d.cts → arkade-swaps-DkM_5yuv.d.cts} +49 -49
- package/dist/{background-5XMCGVMS.js → background-646NBLSK.js} +2 -2
- package/dist/{chunk-2TWYSAFO.js → chunk-DPGNWPDB.js} +1 -1
- package/dist/{chunk-AIVWXKNG.js → chunk-Y6GPJDXY.js} +43 -26
- package/dist/expo/index.cjs +43 -26
- package/dist/expo/index.d.cts +26 -26
- package/dist/expo/index.d.ts +26 -26
- package/dist/expo/index.js +4 -4
- package/dist/index.cjs +43 -26
- package/dist/index.d.cts +70 -70
- package/dist/index.d.ts +70 -70
- package/dist/index.js +1 -1
- package/dist/repositories/realm/index.d.cts +3 -3
- package/dist/repositories/realm/index.d.ts +3 -3
- package/dist/repositories/sqlite/index.d.cts +3 -3
- package/dist/repositories/sqlite/index.d.ts +3 -3
- package/dist/{types-NXkA-o9j.d.cts → types-C-2sBQWJ.d.cts} +69 -72
- package/dist/{types-NXkA-o9j.d.ts → types-C-2sBQWJ.d.ts} +69 -72
- package/package.json +6 -12
|
@@ -221,7 +221,7 @@ var isGetReverseSwapTxIdResponse = (data) => {
|
|
|
221
221
|
return data && typeof data === "object" && typeof data.id === "string" && typeof data.timeoutBlockHeight === "number";
|
|
222
222
|
};
|
|
223
223
|
var isGetSwapStatusResponse = (data) => {
|
|
224
|
-
return data && typeof data === "object" && typeof data.status === "string" && (data.zeroConfRejected === void 0 || typeof data.zeroConfRejected === "boolean") && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && (data.transaction.eta === void 0 || typeof data.transaction.eta === "number") && (data.transaction.hex === void 0 || typeof data.transaction.hex === "string") && (data.transaction.preimage === void 0 || typeof data.transaction.preimage === "string"));
|
|
224
|
+
return data && typeof data === "object" && typeof data.status === "string" && (data.zeroConfRejected === void 0 || typeof data.zeroConfRejected === "boolean") && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && (data.transaction.confirmed === void 0 || typeof data.transaction.confirmed === "boolean") && (data.transaction.eta === void 0 || typeof data.transaction.eta === "number") && (data.transaction.hex === void 0 || typeof data.transaction.hex === "string") && (data.transaction.preimage === void 0 || typeof data.transaction.preimage === "string"));
|
|
225
225
|
};
|
|
226
226
|
var isGetSubmarinePairsResponse = (data) => {
|
|
227
227
|
return data && typeof data === "object" && data.ARK && typeof data.ARK === "object" && data.ARK.BTC && typeof data.ARK.BTC === "object" && typeof data.ARK.BTC.hash === "string" && typeof data.ARK.BTC.rate === "number" && data.ARK.BTC.limits && typeof data.ARK.BTC.limits === "object" && typeof data.ARK.BTC.limits.maximal === "number" && typeof data.ARK.BTC.limits.minimal === "number" && typeof data.ARK.BTC.limits.maximalZeroConf === "number" && data.ARK.BTC.fees && typeof data.ARK.BTC.fees === "object" && typeof data.ARK.BTC.fees.percentage === "number" && typeof data.ARK.BTC.fees.minerFees === "number";
|
|
@@ -230,13 +230,13 @@ var isGetReversePairsResponse = (data) => {
|
|
|
230
230
|
return data && typeof data === "object" && data.BTC && typeof data.BTC === "object" && data.BTC.ARK && typeof data.BTC.ARK === "object" && data.BTC.ARK.hash && typeof data.BTC.ARK.hash === "string" && typeof data.BTC.ARK.rate === "number" && data.BTC.ARK.limits && typeof data.BTC.ARK.limits === "object" && typeof data.BTC.ARK.limits.maximal === "number" && typeof data.BTC.ARK.limits.minimal === "number" && data.BTC.ARK.fees && typeof data.BTC.ARK.fees === "object" && typeof data.BTC.ARK.fees.percentage === "number" && typeof data.BTC.ARK.fees.minerFees === "object" && typeof data.BTC.ARK.fees.minerFees.claim === "number" && typeof data.BTC.ARK.fees.minerFees.lockup === "number";
|
|
231
231
|
};
|
|
232
232
|
var isCreateSubmarineSwapResponse = (data) => {
|
|
233
|
-
return data && typeof data === "object" && typeof data.id === "string" && typeof data.
|
|
233
|
+
return data && typeof data === "object" && typeof data.id === "string" && typeof data.expectedAmount === "number" && (data.address === void 0 || typeof data.address === "string") && (data.claimPublicKey === void 0 || typeof data.claimPublicKey === "string") && (data.acceptZeroConf === void 0 || typeof data.acceptZeroConf === "boolean") && (data.timeoutBlockHeight === void 0 || typeof data.timeoutBlockHeight === "number") && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights));
|
|
234
234
|
};
|
|
235
235
|
var isGetSwapPreimageResponse = (data) => {
|
|
236
236
|
return data && typeof data === "object" && typeof data.preimage === "string";
|
|
237
237
|
};
|
|
238
238
|
var isCreateReverseSwapResponse = (data) => {
|
|
239
|
-
return data && typeof data === "object" && typeof data.id === "string" && typeof data.invoice === "string" && typeof data.onchainAmount === "number" && typeof data.lockupAddress === "string" && typeof data.refundPublicKey === "string" && isTimeoutBlockHeights(data.timeoutBlockHeights);
|
|
239
|
+
return data && typeof data === "object" && typeof data.id === "string" && typeof data.invoice === "string" && (data.onchainAmount === void 0 || typeof data.onchainAmount === "number") && (data.lockupAddress === void 0 || typeof data.lockupAddress === "string") && (data.refundPublicKey === void 0 || typeof data.refundPublicKey === "string") && (data.timeoutBlockHeight === void 0 || typeof data.timeoutBlockHeight === "number") && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights));
|
|
240
240
|
};
|
|
241
241
|
var isRefundSubmarineSwapResponse = (data) => {
|
|
242
242
|
return data && typeof data === "object" && typeof data.transaction === "string" && typeof data.checkpoint === "string";
|
|
@@ -275,19 +275,19 @@ var isLeaf = (data) => {
|
|
|
275
275
|
return data && typeof data === "object" && typeof data.version === "number" && typeof data.output === "string";
|
|
276
276
|
};
|
|
277
277
|
var isTree = (data) => {
|
|
278
|
-
return data && typeof data === "object" && isLeaf(data.claimLeaf) && isLeaf(data.refundLeaf) && isLeaf(data.refundWithoutBoltzLeaf) && isLeaf(data.unilateralClaimLeaf) && isLeaf(data.unilateralRefundLeaf) && isLeaf(data.unilateralRefundWithoutBoltzLeaf);
|
|
278
|
+
return data && typeof data === "object" && isLeaf(data.claimLeaf) && isLeaf(data.refundLeaf) && (data.covenantClaimLeaf === void 0 || isLeaf(data.covenantClaimLeaf)) && (data.refundWithoutBoltzLeaf === void 0 || isLeaf(data.refundWithoutBoltzLeaf)) && (data.unilateralClaimLeaf === void 0 || isLeaf(data.unilateralClaimLeaf)) && (data.unilateralRefundLeaf === void 0 || isLeaf(data.unilateralRefundLeaf)) && (data.unilateralRefundWithoutBoltzLeaf === void 0 || isLeaf(data.unilateralRefundWithoutBoltzLeaf));
|
|
279
279
|
};
|
|
280
280
|
var isDetails = (data) => {
|
|
281
|
-
return data && typeof data === "object" && isTree(data.tree) && (data.amount === void 0 || typeof data.amount === "number") && typeof data.keyIndex === "number" && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && typeof data.transaction.vout === "number") && typeof data.lockupAddress === "string" && typeof data.serverPublicKey === "string" && typeof data.timeoutBlockHeight === "number" && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights)) && (data.preimageHash === void 0 || typeof data.preimageHash === "string");
|
|
281
|
+
return data && typeof data === "object" && isTree(data.tree) && (data.amount === void 0 || typeof data.amount === "number") && typeof data.keyIndex === "number" && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && typeof data.transaction.vout === "number") && typeof data.lockupAddress === "string" && typeof data.serverPublicKey === "string" && (data.timeoutBlockHeight === void 0 || typeof data.timeoutBlockHeight === "number") && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights)) && (data.preimageHash === void 0 || typeof data.preimageHash === "string");
|
|
282
282
|
};
|
|
283
283
|
var isRestoredChainSwap = (data) => {
|
|
284
|
-
return data && typeof data === "object" && typeof data.id === "string" && data.type === "chain" && typeof data.status === "string" && typeof data.createdAt === "number" && (data.from === "ARK" || data.from === "BTC") && (data.to === "ARK" || data.to === "BTC") &&
|
|
284
|
+
return data && typeof data === "object" && typeof data.id === "string" && data.type === "chain" && typeof data.status === "string" && typeof data.createdAt === "number" && (data.from === "ARK" || data.from === "BTC") && (data.to === "ARK" || data.to === "BTC") && (data.preimageHash === void 0 || typeof data.preimageHash === "string") && (data.invoice === void 0 || typeof data.invoice === "string") && (data.refundDetails === void 0 || isDetails(data.refundDetails)) && (data.claimDetails === void 0 || isDetails(data.claimDetails));
|
|
285
285
|
};
|
|
286
286
|
var isRestoredSubmarineSwap = (data) => {
|
|
287
|
-
return data && typeof data === "object" && data.to === "BTC" && typeof data.id === "string" && data.from === "ARK" && data.type === "submarine" && typeof data.createdAt === "number" && typeof data.preimageHash === "string" && typeof data.status === "string" && isDetails(data.refundDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
287
|
+
return data && typeof data === "object" && data.to === "BTC" && typeof data.id === "string" && data.from === "ARK" && data.type === "submarine" && typeof data.createdAt === "number" && (data.preimageHash === void 0 || typeof data.preimageHash === "string") && typeof data.status === "string" && isDetails(data.refundDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
288
288
|
};
|
|
289
289
|
var isRestoredReverseSwap = (data) => {
|
|
290
|
-
return data && typeof data === "object" && data.to === "ARK" && typeof data.id === "string" && data.from === "BTC" && data.type === "reverse" && typeof data.createdAt === "number" && typeof data.preimageHash === "string" && typeof data.status === "string" && isDetails(data.claimDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
290
|
+
return data && typeof data === "object" && data.to === "ARK" && typeof data.id === "string" && data.from === "BTC" && data.type === "reverse" && typeof data.createdAt === "number" && (data.preimageHash === void 0 || typeof data.preimageHash === "string") && typeof data.status === "string" && isDetails(data.claimDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
291
291
|
};
|
|
292
292
|
var isCreateSwapsRestoreResponse = (data) => {
|
|
293
293
|
return Array.isArray(data) && data.every(
|
|
@@ -3214,6 +3214,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3214
3214
|
async claimVHTLC(pendingSwap) {
|
|
3215
3215
|
if (!pendingSwap.preimage)
|
|
3216
3216
|
throw new Error("Preimage is required to claim VHTLC");
|
|
3217
|
+
const { refundPublicKey, lockupAddress, timeoutBlockHeights } = pendingSwap.response;
|
|
3218
|
+
if (!refundPublicKey || !lockupAddress || !timeoutBlockHeights)
|
|
3219
|
+
throw new Error("Incomplete reverse swap response");
|
|
3217
3220
|
const preimage = hex8.decode(pendingSwap.preimage);
|
|
3218
3221
|
const arkInfo = await this.arkProvider.getInfo();
|
|
3219
3222
|
const address = await this.wallet.getAddress();
|
|
@@ -3223,7 +3226,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3223
3226
|
pendingSwap.id
|
|
3224
3227
|
);
|
|
3225
3228
|
const senderXOnly = normalizeToXOnlyKey(
|
|
3226
|
-
hex8.decode(
|
|
3229
|
+
hex8.decode(refundPublicKey),
|
|
3227
3230
|
"boltz",
|
|
3228
3231
|
pendingSwap.id
|
|
3229
3232
|
);
|
|
@@ -3238,11 +3241,11 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3238
3241
|
receiverPubkey: hex8.encode(receiverXOnly),
|
|
3239
3242
|
senderPubkey: hex8.encode(senderXOnly),
|
|
3240
3243
|
serverPubkey: hex8.encode(serverXOnly),
|
|
3241
|
-
timeoutBlockHeights
|
|
3244
|
+
timeoutBlockHeights
|
|
3242
3245
|
});
|
|
3243
3246
|
if (!vhtlcScript.claimScript)
|
|
3244
3247
|
throw new Error("Failed to create VHTLC script for reverse swap");
|
|
3245
|
-
if (vhtlcAddress !==
|
|
3248
|
+
if (vhtlcAddress !== lockupAddress)
|
|
3246
3249
|
throw new Error("Boltz is trying to scam us");
|
|
3247
3250
|
const { vtxos } = await this.indexerProvider.getVtxos({
|
|
3248
3251
|
scripts: [hex8.encode(vhtlcScript.pkScript)]
|
|
@@ -3383,6 +3386,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3383
3386
|
*/
|
|
3384
3387
|
async sendLightningPayment(args) {
|
|
3385
3388
|
const pendingSwap = await this.createSubmarineSwap(args);
|
|
3389
|
+
if (!pendingSwap.response.address)
|
|
3390
|
+
throw new Error("Missing address in submarine swap response");
|
|
3386
3391
|
await this.savePendingSubmarineSwap(pendingSwap);
|
|
3387
3392
|
const txid = await this.wallet.send({
|
|
3388
3393
|
address: pendingSwap.response.address,
|
|
@@ -3466,8 +3471,11 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3466
3471
|
"server",
|
|
3467
3472
|
pendingSwap.id
|
|
3468
3473
|
);
|
|
3474
|
+
const { claimPublicKey, timeoutBlockHeights } = pendingSwap.response;
|
|
3475
|
+
if (!claimPublicKey || !timeoutBlockHeights)
|
|
3476
|
+
throw new Error("Incomplete submarine swap response");
|
|
3469
3477
|
const boltzXOnlyPublicKey = normalizeToXOnlyKey(
|
|
3470
|
-
hex8.decode(
|
|
3478
|
+
hex8.decode(claimPublicKey),
|
|
3471
3479
|
"boltz",
|
|
3472
3480
|
pendingSwap.id
|
|
3473
3481
|
);
|
|
@@ -3477,7 +3485,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3477
3485
|
receiverPubkey: hex8.encode(boltzXOnlyPublicKey),
|
|
3478
3486
|
senderPubkey: hex8.encode(ourXOnlyPublicKey),
|
|
3479
3487
|
serverPubkey: hex8.encode(serverXOnlyPublicKey),
|
|
3480
|
-
timeoutBlockHeights
|
|
3488
|
+
timeoutBlockHeights
|
|
3481
3489
|
});
|
|
3482
3490
|
if (!vhtlcScript.claimScript)
|
|
3483
3491
|
throw new Error("Failed to create VHTLC script for submarine swap");
|
|
@@ -4479,7 +4487,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4479
4487
|
lockupAddress,
|
|
4480
4488
|
preimageHash,
|
|
4481
4489
|
serverPublicKey,
|
|
4482
|
-
tree
|
|
4490
|
+
tree,
|
|
4491
|
+
timeoutBlockHeights
|
|
4483
4492
|
} = swap.claimDetails;
|
|
4484
4493
|
reverseSwaps.push({
|
|
4485
4494
|
id,
|
|
@@ -4495,18 +4504,18 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4495
4504
|
onchainAmount: amount,
|
|
4496
4505
|
lockupAddress,
|
|
4497
4506
|
refundPublicKey: serverPublicKey,
|
|
4498
|
-
timeoutBlockHeights: {
|
|
4507
|
+
timeoutBlockHeights: timeoutBlockHeights ?? {
|
|
4499
4508
|
refund: extractTimeLockFromLeafOutput(
|
|
4500
|
-
tree.refundWithoutBoltzLeaf
|
|
4509
|
+
tree.refundWithoutBoltzLeaf?.output ?? ""
|
|
4501
4510
|
),
|
|
4502
4511
|
unilateralClaim: extractTimeLockFromLeafOutput(
|
|
4503
|
-
tree.unilateralClaimLeaf
|
|
4512
|
+
tree.unilateralClaimLeaf?.output ?? ""
|
|
4504
4513
|
),
|
|
4505
4514
|
unilateralRefund: extractTimeLockFromLeafOutput(
|
|
4506
|
-
tree.unilateralRefundLeaf
|
|
4515
|
+
tree.unilateralRefundLeaf?.output ?? ""
|
|
4507
4516
|
),
|
|
4508
4517
|
unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
|
|
4509
|
-
tree.unilateralRefundWithoutBoltzLeaf
|
|
4518
|
+
tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
|
|
4510
4519
|
)
|
|
4511
4520
|
}
|
|
4512
4521
|
},
|
|
@@ -4515,7 +4524,13 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4515
4524
|
preimage: ""
|
|
4516
4525
|
});
|
|
4517
4526
|
} else if (isRestoredSubmarineSwap(swap)) {
|
|
4518
|
-
const {
|
|
4527
|
+
const {
|
|
4528
|
+
amount,
|
|
4529
|
+
lockupAddress,
|
|
4530
|
+
serverPublicKey,
|
|
4531
|
+
tree,
|
|
4532
|
+
timeoutBlockHeights
|
|
4533
|
+
} = swap.refundDetails;
|
|
4519
4534
|
let preimage = "";
|
|
4520
4535
|
if (!isSubmarineFinalStatus(status)) {
|
|
4521
4536
|
try {
|
|
@@ -4546,29 +4561,31 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4546
4561
|
address: lockupAddress,
|
|
4547
4562
|
expectedAmount: amount,
|
|
4548
4563
|
claimPublicKey: serverPublicKey,
|
|
4549
|
-
timeoutBlockHeights: {
|
|
4564
|
+
timeoutBlockHeights: timeoutBlockHeights ?? {
|
|
4550
4565
|
refund: extractTimeLockFromLeafOutput(
|
|
4551
|
-
tree.refundWithoutBoltzLeaf
|
|
4566
|
+
tree.refundWithoutBoltzLeaf?.output ?? ""
|
|
4552
4567
|
),
|
|
4553
4568
|
unilateralClaim: extractTimeLockFromLeafOutput(
|
|
4554
|
-
tree.unilateralClaimLeaf
|
|
4569
|
+
tree.unilateralClaimLeaf?.output ?? ""
|
|
4555
4570
|
),
|
|
4556
4571
|
unilateralRefund: extractTimeLockFromLeafOutput(
|
|
4557
|
-
tree.unilateralRefundLeaf
|
|
4572
|
+
tree.unilateralRefundLeaf?.output ?? ""
|
|
4558
4573
|
),
|
|
4559
4574
|
unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
|
|
4560
|
-
tree.unilateralRefundWithoutBoltzLeaf
|
|
4575
|
+
tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
|
|
4561
4576
|
)
|
|
4562
4577
|
}
|
|
4563
4578
|
}
|
|
4564
4579
|
});
|
|
4565
4580
|
} else if (isRestoredChainSwap(swap)) {
|
|
4581
|
+
const refundDetails = swap.refundDetails;
|
|
4582
|
+
if (!refundDetails) continue;
|
|
4566
4583
|
const {
|
|
4567
4584
|
amount,
|
|
4568
4585
|
lockupAddress,
|
|
4569
4586
|
serverPublicKey,
|
|
4570
4587
|
timeoutBlockHeight
|
|
4571
|
-
} =
|
|
4588
|
+
} = refundDetails;
|
|
4572
4589
|
chainSwaps.push({
|
|
4573
4590
|
id,
|
|
4574
4591
|
type: "chain",
|
package/dist/expo/index.cjs
CHANGED
|
@@ -185,7 +185,7 @@ var init_boltz_swap_provider = __esm({
|
|
|
185
185
|
return data && typeof data === "object" && typeof data.id === "string" && typeof data.timeoutBlockHeight === "number";
|
|
186
186
|
};
|
|
187
187
|
isGetSwapStatusResponse = (data) => {
|
|
188
|
-
return data && typeof data === "object" && typeof data.status === "string" && (data.zeroConfRejected === void 0 || typeof data.zeroConfRejected === "boolean") && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && (data.transaction.eta === void 0 || typeof data.transaction.eta === "number") && (data.transaction.hex === void 0 || typeof data.transaction.hex === "string") && (data.transaction.preimage === void 0 || typeof data.transaction.preimage === "string"));
|
|
188
|
+
return data && typeof data === "object" && typeof data.status === "string" && (data.zeroConfRejected === void 0 || typeof data.zeroConfRejected === "boolean") && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && (data.transaction.confirmed === void 0 || typeof data.transaction.confirmed === "boolean") && (data.transaction.eta === void 0 || typeof data.transaction.eta === "number") && (data.transaction.hex === void 0 || typeof data.transaction.hex === "string") && (data.transaction.preimage === void 0 || typeof data.transaction.preimage === "string"));
|
|
189
189
|
};
|
|
190
190
|
isGetSubmarinePairsResponse = (data) => {
|
|
191
191
|
return data && typeof data === "object" && data.ARK && typeof data.ARK === "object" && data.ARK.BTC && typeof data.ARK.BTC === "object" && typeof data.ARK.BTC.hash === "string" && typeof data.ARK.BTC.rate === "number" && data.ARK.BTC.limits && typeof data.ARK.BTC.limits === "object" && typeof data.ARK.BTC.limits.maximal === "number" && typeof data.ARK.BTC.limits.minimal === "number" && typeof data.ARK.BTC.limits.maximalZeroConf === "number" && data.ARK.BTC.fees && typeof data.ARK.BTC.fees === "object" && typeof data.ARK.BTC.fees.percentage === "number" && typeof data.ARK.BTC.fees.minerFees === "number";
|
|
@@ -194,13 +194,13 @@ var init_boltz_swap_provider = __esm({
|
|
|
194
194
|
return data && typeof data === "object" && data.BTC && typeof data.BTC === "object" && data.BTC.ARK && typeof data.BTC.ARK === "object" && data.BTC.ARK.hash && typeof data.BTC.ARK.hash === "string" && typeof data.BTC.ARK.rate === "number" && data.BTC.ARK.limits && typeof data.BTC.ARK.limits === "object" && typeof data.BTC.ARK.limits.maximal === "number" && typeof data.BTC.ARK.limits.minimal === "number" && data.BTC.ARK.fees && typeof data.BTC.ARK.fees === "object" && typeof data.BTC.ARK.fees.percentage === "number" && typeof data.BTC.ARK.fees.minerFees === "object" && typeof data.BTC.ARK.fees.minerFees.claim === "number" && typeof data.BTC.ARK.fees.minerFees.lockup === "number";
|
|
195
195
|
};
|
|
196
196
|
isCreateSubmarineSwapResponse = (data) => {
|
|
197
|
-
return data && typeof data === "object" && typeof data.id === "string" && typeof data.
|
|
197
|
+
return data && typeof data === "object" && typeof data.id === "string" && typeof data.expectedAmount === "number" && (data.address === void 0 || typeof data.address === "string") && (data.claimPublicKey === void 0 || typeof data.claimPublicKey === "string") && (data.acceptZeroConf === void 0 || typeof data.acceptZeroConf === "boolean") && (data.timeoutBlockHeight === void 0 || typeof data.timeoutBlockHeight === "number") && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights));
|
|
198
198
|
};
|
|
199
199
|
isGetSwapPreimageResponse = (data) => {
|
|
200
200
|
return data && typeof data === "object" && typeof data.preimage === "string";
|
|
201
201
|
};
|
|
202
202
|
isCreateReverseSwapResponse = (data) => {
|
|
203
|
-
return data && typeof data === "object" && typeof data.id === "string" && typeof data.invoice === "string" && typeof data.onchainAmount === "number" && typeof data.lockupAddress === "string" && typeof data.refundPublicKey === "string" && isTimeoutBlockHeights(data.timeoutBlockHeights);
|
|
203
|
+
return data && typeof data === "object" && typeof data.id === "string" && typeof data.invoice === "string" && (data.onchainAmount === void 0 || typeof data.onchainAmount === "number") && (data.lockupAddress === void 0 || typeof data.lockupAddress === "string") && (data.refundPublicKey === void 0 || typeof data.refundPublicKey === "string") && (data.timeoutBlockHeight === void 0 || typeof data.timeoutBlockHeight === "number") && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights));
|
|
204
204
|
};
|
|
205
205
|
isRefundSubmarineSwapResponse = (data) => {
|
|
206
206
|
return data && typeof data === "object" && typeof data.transaction === "string" && typeof data.checkpoint === "string";
|
|
@@ -239,19 +239,19 @@ var init_boltz_swap_provider = __esm({
|
|
|
239
239
|
return data && typeof data === "object" && typeof data.version === "number" && typeof data.output === "string";
|
|
240
240
|
};
|
|
241
241
|
isTree = (data) => {
|
|
242
|
-
return data && typeof data === "object" && isLeaf(data.claimLeaf) && isLeaf(data.refundLeaf) && isLeaf(data.refundWithoutBoltzLeaf) && isLeaf(data.unilateralClaimLeaf) && isLeaf(data.unilateralRefundLeaf) && isLeaf(data.unilateralRefundWithoutBoltzLeaf);
|
|
242
|
+
return data && typeof data === "object" && isLeaf(data.claimLeaf) && isLeaf(data.refundLeaf) && (data.covenantClaimLeaf === void 0 || isLeaf(data.covenantClaimLeaf)) && (data.refundWithoutBoltzLeaf === void 0 || isLeaf(data.refundWithoutBoltzLeaf)) && (data.unilateralClaimLeaf === void 0 || isLeaf(data.unilateralClaimLeaf)) && (data.unilateralRefundLeaf === void 0 || isLeaf(data.unilateralRefundLeaf)) && (data.unilateralRefundWithoutBoltzLeaf === void 0 || isLeaf(data.unilateralRefundWithoutBoltzLeaf));
|
|
243
243
|
};
|
|
244
244
|
isDetails = (data) => {
|
|
245
|
-
return data && typeof data === "object" && isTree(data.tree) && (data.amount === void 0 || typeof data.amount === "number") && typeof data.keyIndex === "number" && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && typeof data.transaction.vout === "number") && typeof data.lockupAddress === "string" && typeof data.serverPublicKey === "string" && typeof data.timeoutBlockHeight === "number" && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights)) && (data.preimageHash === void 0 || typeof data.preimageHash === "string");
|
|
245
|
+
return data && typeof data === "object" && isTree(data.tree) && (data.amount === void 0 || typeof data.amount === "number") && typeof data.keyIndex === "number" && (data.transaction === void 0 || data.transaction && typeof data.transaction === "object" && typeof data.transaction.id === "string" && typeof data.transaction.vout === "number") && typeof data.lockupAddress === "string" && typeof data.serverPublicKey === "string" && (data.timeoutBlockHeight === void 0 || typeof data.timeoutBlockHeight === "number") && (data.timeoutBlockHeights === void 0 || isTimeoutBlockHeights(data.timeoutBlockHeights)) && (data.preimageHash === void 0 || typeof data.preimageHash === "string");
|
|
246
246
|
};
|
|
247
247
|
isRestoredChainSwap = (data) => {
|
|
248
|
-
return data && typeof data === "object" && typeof data.id === "string" && data.type === "chain" && typeof data.status === "string" && typeof data.createdAt === "number" && (data.from === "ARK" || data.from === "BTC") && (data.to === "ARK" || data.to === "BTC") &&
|
|
248
|
+
return data && typeof data === "object" && typeof data.id === "string" && data.type === "chain" && typeof data.status === "string" && typeof data.createdAt === "number" && (data.from === "ARK" || data.from === "BTC") && (data.to === "ARK" || data.to === "BTC") && (data.preimageHash === void 0 || typeof data.preimageHash === "string") && (data.invoice === void 0 || typeof data.invoice === "string") && (data.refundDetails === void 0 || isDetails(data.refundDetails)) && (data.claimDetails === void 0 || isDetails(data.claimDetails));
|
|
249
249
|
};
|
|
250
250
|
isRestoredSubmarineSwap = (data) => {
|
|
251
|
-
return data && typeof data === "object" && data.to === "BTC" && typeof data.id === "string" && data.from === "ARK" && data.type === "submarine" && typeof data.createdAt === "number" && typeof data.preimageHash === "string" && typeof data.status === "string" && isDetails(data.refundDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
251
|
+
return data && typeof data === "object" && data.to === "BTC" && typeof data.id === "string" && data.from === "ARK" && data.type === "submarine" && typeof data.createdAt === "number" && (data.preimageHash === void 0 || typeof data.preimageHash === "string") && typeof data.status === "string" && isDetails(data.refundDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
252
252
|
};
|
|
253
253
|
isRestoredReverseSwap = (data) => {
|
|
254
|
-
return data && typeof data === "object" && data.to === "ARK" && typeof data.id === "string" && data.from === "BTC" && data.type === "reverse" && typeof data.createdAt === "number" && typeof data.preimageHash === "string" && typeof data.status === "string" && isDetails(data.claimDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
254
|
+
return data && typeof data === "object" && data.to === "ARK" && typeof data.id === "string" && data.from === "BTC" && data.type === "reverse" && typeof data.createdAt === "number" && (data.preimageHash === void 0 || typeof data.preimageHash === "string") && typeof data.status === "string" && isDetails(data.claimDetails) && (data.invoice === void 0 || typeof data.invoice === "string");
|
|
255
255
|
};
|
|
256
256
|
isCreateSwapsRestoreResponse = (data) => {
|
|
257
257
|
return Array.isArray(data) && data.every(
|
|
@@ -3219,6 +3219,9 @@ var init_arkade_swaps = __esm({
|
|
|
3219
3219
|
async claimVHTLC(pendingSwap) {
|
|
3220
3220
|
if (!pendingSwap.preimage)
|
|
3221
3221
|
throw new Error("Preimage is required to claim VHTLC");
|
|
3222
|
+
const { refundPublicKey, lockupAddress, timeoutBlockHeights } = pendingSwap.response;
|
|
3223
|
+
if (!refundPublicKey || !lockupAddress || !timeoutBlockHeights)
|
|
3224
|
+
throw new Error("Incomplete reverse swap response");
|
|
3222
3225
|
const preimage = import_base9.hex.decode(pendingSwap.preimage);
|
|
3223
3226
|
const arkInfo = await this.arkProvider.getInfo();
|
|
3224
3227
|
const address = await this.wallet.getAddress();
|
|
@@ -3228,7 +3231,7 @@ var init_arkade_swaps = __esm({
|
|
|
3228
3231
|
pendingSwap.id
|
|
3229
3232
|
);
|
|
3230
3233
|
const senderXOnly = normalizeToXOnlyKey(
|
|
3231
|
-
import_base9.hex.decode(
|
|
3234
|
+
import_base9.hex.decode(refundPublicKey),
|
|
3232
3235
|
"boltz",
|
|
3233
3236
|
pendingSwap.id
|
|
3234
3237
|
);
|
|
@@ -3243,11 +3246,11 @@ var init_arkade_swaps = __esm({
|
|
|
3243
3246
|
receiverPubkey: import_base9.hex.encode(receiverXOnly),
|
|
3244
3247
|
senderPubkey: import_base9.hex.encode(senderXOnly),
|
|
3245
3248
|
serverPubkey: import_base9.hex.encode(serverXOnly),
|
|
3246
|
-
timeoutBlockHeights
|
|
3249
|
+
timeoutBlockHeights
|
|
3247
3250
|
});
|
|
3248
3251
|
if (!vhtlcScript.claimScript)
|
|
3249
3252
|
throw new Error("Failed to create VHTLC script for reverse swap");
|
|
3250
|
-
if (vhtlcAddress !==
|
|
3253
|
+
if (vhtlcAddress !== lockupAddress)
|
|
3251
3254
|
throw new Error("Boltz is trying to scam us");
|
|
3252
3255
|
const { vtxos } = await this.indexerProvider.getVtxos({
|
|
3253
3256
|
scripts: [import_base9.hex.encode(vhtlcScript.pkScript)]
|
|
@@ -3388,6 +3391,8 @@ var init_arkade_swaps = __esm({
|
|
|
3388
3391
|
*/
|
|
3389
3392
|
async sendLightningPayment(args) {
|
|
3390
3393
|
const pendingSwap = await this.createSubmarineSwap(args);
|
|
3394
|
+
if (!pendingSwap.response.address)
|
|
3395
|
+
throw new Error("Missing address in submarine swap response");
|
|
3391
3396
|
await this.savePendingSubmarineSwap(pendingSwap);
|
|
3392
3397
|
const txid = await this.wallet.send({
|
|
3393
3398
|
address: pendingSwap.response.address,
|
|
@@ -3471,8 +3476,11 @@ var init_arkade_swaps = __esm({
|
|
|
3471
3476
|
"server",
|
|
3472
3477
|
pendingSwap.id
|
|
3473
3478
|
);
|
|
3479
|
+
const { claimPublicKey, timeoutBlockHeights } = pendingSwap.response;
|
|
3480
|
+
if (!claimPublicKey || !timeoutBlockHeights)
|
|
3481
|
+
throw new Error("Incomplete submarine swap response");
|
|
3474
3482
|
const boltzXOnlyPublicKey = normalizeToXOnlyKey(
|
|
3475
|
-
import_base9.hex.decode(
|
|
3483
|
+
import_base9.hex.decode(claimPublicKey),
|
|
3476
3484
|
"boltz",
|
|
3477
3485
|
pendingSwap.id
|
|
3478
3486
|
);
|
|
@@ -3482,7 +3490,7 @@ var init_arkade_swaps = __esm({
|
|
|
3482
3490
|
receiverPubkey: import_base9.hex.encode(boltzXOnlyPublicKey),
|
|
3483
3491
|
senderPubkey: import_base9.hex.encode(ourXOnlyPublicKey),
|
|
3484
3492
|
serverPubkey: import_base9.hex.encode(serverXOnlyPublicKey),
|
|
3485
|
-
timeoutBlockHeights
|
|
3493
|
+
timeoutBlockHeights
|
|
3486
3494
|
});
|
|
3487
3495
|
if (!vhtlcScript.claimScript)
|
|
3488
3496
|
throw new Error("Failed to create VHTLC script for submarine swap");
|
|
@@ -4484,7 +4492,8 @@ var init_arkade_swaps = __esm({
|
|
|
4484
4492
|
lockupAddress,
|
|
4485
4493
|
preimageHash,
|
|
4486
4494
|
serverPublicKey,
|
|
4487
|
-
tree
|
|
4495
|
+
tree,
|
|
4496
|
+
timeoutBlockHeights
|
|
4488
4497
|
} = swap.claimDetails;
|
|
4489
4498
|
reverseSwaps.push({
|
|
4490
4499
|
id,
|
|
@@ -4500,18 +4509,18 @@ var init_arkade_swaps = __esm({
|
|
|
4500
4509
|
onchainAmount: amount,
|
|
4501
4510
|
lockupAddress,
|
|
4502
4511
|
refundPublicKey: serverPublicKey,
|
|
4503
|
-
timeoutBlockHeights: {
|
|
4512
|
+
timeoutBlockHeights: timeoutBlockHeights ?? {
|
|
4504
4513
|
refund: extractTimeLockFromLeafOutput(
|
|
4505
|
-
tree.refundWithoutBoltzLeaf
|
|
4514
|
+
tree.refundWithoutBoltzLeaf?.output ?? ""
|
|
4506
4515
|
),
|
|
4507
4516
|
unilateralClaim: extractTimeLockFromLeafOutput(
|
|
4508
|
-
tree.unilateralClaimLeaf
|
|
4517
|
+
tree.unilateralClaimLeaf?.output ?? ""
|
|
4509
4518
|
),
|
|
4510
4519
|
unilateralRefund: extractTimeLockFromLeafOutput(
|
|
4511
|
-
tree.unilateralRefundLeaf
|
|
4520
|
+
tree.unilateralRefundLeaf?.output ?? ""
|
|
4512
4521
|
),
|
|
4513
4522
|
unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
|
|
4514
|
-
tree.unilateralRefundWithoutBoltzLeaf
|
|
4523
|
+
tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
|
|
4515
4524
|
)
|
|
4516
4525
|
}
|
|
4517
4526
|
},
|
|
@@ -4520,7 +4529,13 @@ var init_arkade_swaps = __esm({
|
|
|
4520
4529
|
preimage: ""
|
|
4521
4530
|
});
|
|
4522
4531
|
} else if (isRestoredSubmarineSwap(swap)) {
|
|
4523
|
-
const {
|
|
4532
|
+
const {
|
|
4533
|
+
amount,
|
|
4534
|
+
lockupAddress,
|
|
4535
|
+
serverPublicKey,
|
|
4536
|
+
tree,
|
|
4537
|
+
timeoutBlockHeights
|
|
4538
|
+
} = swap.refundDetails;
|
|
4524
4539
|
let preimage = "";
|
|
4525
4540
|
if (!isSubmarineFinalStatus(status)) {
|
|
4526
4541
|
try {
|
|
@@ -4551,29 +4566,31 @@ var init_arkade_swaps = __esm({
|
|
|
4551
4566
|
address: lockupAddress,
|
|
4552
4567
|
expectedAmount: amount,
|
|
4553
4568
|
claimPublicKey: serverPublicKey,
|
|
4554
|
-
timeoutBlockHeights: {
|
|
4569
|
+
timeoutBlockHeights: timeoutBlockHeights ?? {
|
|
4555
4570
|
refund: extractTimeLockFromLeafOutput(
|
|
4556
|
-
tree.refundWithoutBoltzLeaf
|
|
4571
|
+
tree.refundWithoutBoltzLeaf?.output ?? ""
|
|
4557
4572
|
),
|
|
4558
4573
|
unilateralClaim: extractTimeLockFromLeafOutput(
|
|
4559
|
-
tree.unilateralClaimLeaf
|
|
4574
|
+
tree.unilateralClaimLeaf?.output ?? ""
|
|
4560
4575
|
),
|
|
4561
4576
|
unilateralRefund: extractTimeLockFromLeafOutput(
|
|
4562
|
-
tree.unilateralRefundLeaf
|
|
4577
|
+
tree.unilateralRefundLeaf?.output ?? ""
|
|
4563
4578
|
),
|
|
4564
4579
|
unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
|
|
4565
|
-
tree.unilateralRefundWithoutBoltzLeaf
|
|
4580
|
+
tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
|
|
4566
4581
|
)
|
|
4567
4582
|
}
|
|
4568
4583
|
}
|
|
4569
4584
|
});
|
|
4570
4585
|
} else if (isRestoredChainSwap(swap)) {
|
|
4586
|
+
const refundDetails = swap.refundDetails;
|
|
4587
|
+
if (!refundDetails) continue;
|
|
4571
4588
|
const {
|
|
4572
4589
|
amount,
|
|
4573
4590
|
lockupAddress,
|
|
4574
4591
|
serverPublicKey,
|
|
4575
4592
|
timeoutBlockHeight
|
|
4576
|
-
} =
|
|
4593
|
+
} = refundDetails;
|
|
4577
4594
|
chainSwaps.push({
|
|
4578
4595
|
id,
|
|
4579
4596
|
type: "chain",
|
package/dist/expo/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IArkadeSwaps, A as ArkadeSwaps } from '../arkade-swaps-
|
|
2
|
-
import { A as ArkadeSwapsConfig,
|
|
1
|
+
import { I as IArkadeSwaps, A as ArkadeSwaps } from '../arkade-swaps-DkM_5yuv.cjs';
|
|
2
|
+
import { A as ArkadeSwapsConfig, j as SwapRepository, m as BoltzSwapProvider, N as Network, k as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, F as FeesResponse, a as BoltzChainSwap, h as ArkToBtcResponse, i as BtcToArkResponse, d as Chain, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-C-2sBQWJ.cjs';
|
|
3
3
|
import { Identity, ArkProvider, IndexerProvider, IWallet, ArkInfo, ArkTxInput, VHTLC } from '@arkade-os/sdk';
|
|
4
4
|
import { AsyncStorageTaskQueue, TaskProcessor } from '@arkade-os/sdk/worker/expo';
|
|
5
5
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
@@ -138,45 +138,45 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
138
138
|
getSwapManager(): SwapManagerClient | null;
|
|
139
139
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
140
140
|
sendLightningPayment(args: SendLightningPaymentRequest): Promise<SendLightningPaymentResponse>;
|
|
141
|
-
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<
|
|
142
|
-
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<
|
|
143
|
-
claimVHTLC(pendingSwap:
|
|
144
|
-
refundVHTLC(pendingSwap:
|
|
145
|
-
waitAndClaim(pendingSwap:
|
|
141
|
+
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<BoltzSubmarineSwap>;
|
|
142
|
+
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<BoltzReverseSwap>;
|
|
143
|
+
claimVHTLC(pendingSwap: BoltzReverseSwap): Promise<void>;
|
|
144
|
+
refundVHTLC(pendingSwap: BoltzSubmarineSwap): Promise<void>;
|
|
145
|
+
waitAndClaim(pendingSwap: BoltzReverseSwap): Promise<{
|
|
146
146
|
txid: string;
|
|
147
147
|
}>;
|
|
148
|
-
waitForSwapSettlement(pendingSwap:
|
|
148
|
+
waitForSwapSettlement(pendingSwap: BoltzSubmarineSwap): Promise<{
|
|
149
149
|
preimage: string;
|
|
150
150
|
}>;
|
|
151
151
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
152
|
-
chainSwaps:
|
|
153
|
-
reverseSwaps:
|
|
154
|
-
submarineSwaps:
|
|
152
|
+
chainSwaps: BoltzChainSwap[];
|
|
153
|
+
reverseSwaps: BoltzReverseSwap[];
|
|
154
|
+
submarineSwaps: BoltzSubmarineSwap[];
|
|
155
155
|
}>;
|
|
156
|
-
enrichReverseSwapPreimage(swap:
|
|
157
|
-
enrichSubmarineSwapInvoice(swap:
|
|
156
|
+
enrichReverseSwapPreimage(swap: BoltzReverseSwap, preimage: string): BoltzReverseSwap;
|
|
157
|
+
enrichSubmarineSwapInvoice(swap: BoltzSubmarineSwap, invoice: string): BoltzSubmarineSwap;
|
|
158
158
|
arkToBtc(args: {
|
|
159
159
|
btcAddress: string;
|
|
160
160
|
senderLockAmount?: number;
|
|
161
161
|
receiverLockAmount?: number;
|
|
162
162
|
feeSatsPerByte?: number;
|
|
163
163
|
}): Promise<ArkToBtcResponse>;
|
|
164
|
-
waitAndClaimBtc(pendingSwap:
|
|
164
|
+
waitAndClaimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
165
165
|
txid: string;
|
|
166
166
|
}>;
|
|
167
|
-
claimBtc(pendingSwap:
|
|
168
|
-
refundArk(pendingSwap:
|
|
167
|
+
claimBtc(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
168
|
+
refundArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
169
169
|
btcToArk(args: {
|
|
170
170
|
feeSatsPerByte?: number;
|
|
171
171
|
senderLockAmount?: number;
|
|
172
172
|
receiverLockAmount?: number;
|
|
173
173
|
}): Promise<BtcToArkResponse>;
|
|
174
|
-
waitAndClaimArk(pendingSwap:
|
|
174
|
+
waitAndClaimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
175
175
|
txid: string;
|
|
176
176
|
}>;
|
|
177
|
-
claimArk(pendingSwap:
|
|
178
|
-
signCooperativeClaimForServer(pendingSwap:
|
|
179
|
-
waitAndClaimChain(pendingSwap:
|
|
177
|
+
claimArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
178
|
+
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
179
|
+
waitAndClaimChain(pendingSwap: BoltzChainSwap): Promise<{
|
|
180
180
|
txid: string;
|
|
181
181
|
}>;
|
|
182
182
|
createChainSwap(args: {
|
|
@@ -186,11 +186,11 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
186
186
|
feeSatsPerByte?: number;
|
|
187
187
|
senderLockAmount?: number;
|
|
188
188
|
receiverLockAmount?: number;
|
|
189
|
-
}): Promise<
|
|
189
|
+
}): Promise<BoltzChainSwap>;
|
|
190
190
|
verifyChainSwap(args: {
|
|
191
191
|
to: Chain;
|
|
192
192
|
from: Chain;
|
|
193
|
-
swap:
|
|
193
|
+
swap: BoltzChainSwap;
|
|
194
194
|
arkInfo: ArkInfo;
|
|
195
195
|
}): Promise<boolean>;
|
|
196
196
|
quoteSwap(swapId: string): Promise<number>;
|
|
@@ -216,10 +216,10 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
216
216
|
getLimits(): Promise<LimitsResponse>;
|
|
217
217
|
getLimits(from: Chain, to: Chain): Promise<LimitsResponse>;
|
|
218
218
|
getSwapStatus(swapId: string): Promise<GetSwapStatusResponse>;
|
|
219
|
-
getPendingSubmarineSwaps(): Promise<
|
|
220
|
-
getPendingReverseSwaps(): Promise<
|
|
221
|
-
getPendingChainSwaps(): Promise<
|
|
222
|
-
getSwapHistory(): Promise<
|
|
219
|
+
getPendingSubmarineSwaps(): Promise<BoltzSubmarineSwap[]>;
|
|
220
|
+
getPendingReverseSwaps(): Promise<BoltzReverseSwap[]>;
|
|
221
|
+
getPendingChainSwaps(): Promise<BoltzChainSwap[]>;
|
|
222
|
+
getSwapHistory(): Promise<BoltzSwap[]>;
|
|
223
223
|
refreshSwapsStatus(): Promise<void>;
|
|
224
224
|
}
|
|
225
225
|
/** @deprecated Use ExpoArkadeSwaps instead */
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IArkadeSwaps, A as ArkadeSwaps } from '../arkade-swaps-
|
|
2
|
-
import { A as ArkadeSwapsConfig,
|
|
1
|
+
import { I as IArkadeSwaps, A as ArkadeSwaps } from '../arkade-swaps-DRMB_apa.js';
|
|
2
|
+
import { A as ArkadeSwapsConfig, j as SwapRepository, m as BoltzSwapProvider, N as Network, k as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, b as BoltzReverseSwap, F as FeesResponse, a as BoltzChainSwap, h as ArkToBtcResponse, i as BtcToArkResponse, d as Chain, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from '../types-C-2sBQWJ.js';
|
|
3
3
|
import { Identity, ArkProvider, IndexerProvider, IWallet, ArkInfo, ArkTxInput, VHTLC } from '@arkade-os/sdk';
|
|
4
4
|
import { AsyncStorageTaskQueue, TaskProcessor } from '@arkade-os/sdk/worker/expo';
|
|
5
5
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
@@ -138,45 +138,45 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
138
138
|
getSwapManager(): SwapManagerClient | null;
|
|
139
139
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
140
140
|
sendLightningPayment(args: SendLightningPaymentRequest): Promise<SendLightningPaymentResponse>;
|
|
141
|
-
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<
|
|
142
|
-
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<
|
|
143
|
-
claimVHTLC(pendingSwap:
|
|
144
|
-
refundVHTLC(pendingSwap:
|
|
145
|
-
waitAndClaim(pendingSwap:
|
|
141
|
+
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<BoltzSubmarineSwap>;
|
|
142
|
+
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<BoltzReverseSwap>;
|
|
143
|
+
claimVHTLC(pendingSwap: BoltzReverseSwap): Promise<void>;
|
|
144
|
+
refundVHTLC(pendingSwap: BoltzSubmarineSwap): Promise<void>;
|
|
145
|
+
waitAndClaim(pendingSwap: BoltzReverseSwap): Promise<{
|
|
146
146
|
txid: string;
|
|
147
147
|
}>;
|
|
148
|
-
waitForSwapSettlement(pendingSwap:
|
|
148
|
+
waitForSwapSettlement(pendingSwap: BoltzSubmarineSwap): Promise<{
|
|
149
149
|
preimage: string;
|
|
150
150
|
}>;
|
|
151
151
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
152
|
-
chainSwaps:
|
|
153
|
-
reverseSwaps:
|
|
154
|
-
submarineSwaps:
|
|
152
|
+
chainSwaps: BoltzChainSwap[];
|
|
153
|
+
reverseSwaps: BoltzReverseSwap[];
|
|
154
|
+
submarineSwaps: BoltzSubmarineSwap[];
|
|
155
155
|
}>;
|
|
156
|
-
enrichReverseSwapPreimage(swap:
|
|
157
|
-
enrichSubmarineSwapInvoice(swap:
|
|
156
|
+
enrichReverseSwapPreimage(swap: BoltzReverseSwap, preimage: string): BoltzReverseSwap;
|
|
157
|
+
enrichSubmarineSwapInvoice(swap: BoltzSubmarineSwap, invoice: string): BoltzSubmarineSwap;
|
|
158
158
|
arkToBtc(args: {
|
|
159
159
|
btcAddress: string;
|
|
160
160
|
senderLockAmount?: number;
|
|
161
161
|
receiverLockAmount?: number;
|
|
162
162
|
feeSatsPerByte?: number;
|
|
163
163
|
}): Promise<ArkToBtcResponse>;
|
|
164
|
-
waitAndClaimBtc(pendingSwap:
|
|
164
|
+
waitAndClaimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
165
165
|
txid: string;
|
|
166
166
|
}>;
|
|
167
|
-
claimBtc(pendingSwap:
|
|
168
|
-
refundArk(pendingSwap:
|
|
167
|
+
claimBtc(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
168
|
+
refundArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
169
169
|
btcToArk(args: {
|
|
170
170
|
feeSatsPerByte?: number;
|
|
171
171
|
senderLockAmount?: number;
|
|
172
172
|
receiverLockAmount?: number;
|
|
173
173
|
}): Promise<BtcToArkResponse>;
|
|
174
|
-
waitAndClaimArk(pendingSwap:
|
|
174
|
+
waitAndClaimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
175
175
|
txid: string;
|
|
176
176
|
}>;
|
|
177
|
-
claimArk(pendingSwap:
|
|
178
|
-
signCooperativeClaimForServer(pendingSwap:
|
|
179
|
-
waitAndClaimChain(pendingSwap:
|
|
177
|
+
claimArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
178
|
+
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
179
|
+
waitAndClaimChain(pendingSwap: BoltzChainSwap): Promise<{
|
|
180
180
|
txid: string;
|
|
181
181
|
}>;
|
|
182
182
|
createChainSwap(args: {
|
|
@@ -186,11 +186,11 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
186
186
|
feeSatsPerByte?: number;
|
|
187
187
|
senderLockAmount?: number;
|
|
188
188
|
receiverLockAmount?: number;
|
|
189
|
-
}): Promise<
|
|
189
|
+
}): Promise<BoltzChainSwap>;
|
|
190
190
|
verifyChainSwap(args: {
|
|
191
191
|
to: Chain;
|
|
192
192
|
from: Chain;
|
|
193
|
-
swap:
|
|
193
|
+
swap: BoltzChainSwap;
|
|
194
194
|
arkInfo: ArkInfo;
|
|
195
195
|
}): Promise<boolean>;
|
|
196
196
|
quoteSwap(swapId: string): Promise<number>;
|
|
@@ -216,10 +216,10 @@ declare class ExpoArkadeSwaps implements IArkadeSwaps {
|
|
|
216
216
|
getLimits(): Promise<LimitsResponse>;
|
|
217
217
|
getLimits(from: Chain, to: Chain): Promise<LimitsResponse>;
|
|
218
218
|
getSwapStatus(swapId: string): Promise<GetSwapStatusResponse>;
|
|
219
|
-
getPendingSubmarineSwaps(): Promise<
|
|
220
|
-
getPendingReverseSwaps(): Promise<
|
|
221
|
-
getPendingChainSwaps(): Promise<
|
|
222
|
-
getSwapHistory(): Promise<
|
|
219
|
+
getPendingSubmarineSwaps(): Promise<BoltzSubmarineSwap[]>;
|
|
220
|
+
getPendingReverseSwaps(): Promise<BoltzReverseSwap[]>;
|
|
221
|
+
getPendingChainSwaps(): Promise<BoltzChainSwap[]>;
|
|
222
|
+
getSwapHistory(): Promise<BoltzSwap[]>;
|
|
223
223
|
refreshSwapsStatus(): Promise<void>;
|
|
224
224
|
}
|
|
225
225
|
/** @deprecated Use ExpoArkadeSwaps instead */
|