@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
package/dist/expo/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
registerExpoSwapBackgroundTask,
|
|
5
5
|
swapsPollProcessor,
|
|
6
6
|
unregisterExpoSwapBackgroundTask
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-DPGNWPDB.js";
|
|
8
8
|
import {
|
|
9
9
|
ArkadeSwaps
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-Y6GPJDXY.js";
|
|
11
11
|
import "../chunk-3RG5ZIWI.js";
|
|
12
12
|
|
|
13
13
|
// src/expo/arkade-lightning.ts
|
|
@@ -56,7 +56,7 @@ var ExpoArkadeSwaps = class _ExpoArkadeSwaps {
|
|
|
56
56
|
await instance.seedSwapPollTask();
|
|
57
57
|
if (config.background.minimumBackgroundInterval) {
|
|
58
58
|
try {
|
|
59
|
-
const { registerExpoSwapBackgroundTask: registerExpoSwapBackgroundTask2 } = await import("../background-
|
|
59
|
+
const { registerExpoSwapBackgroundTask: registerExpoSwapBackgroundTask2 } = await import("../background-646NBLSK.js");
|
|
60
60
|
await registerExpoSwapBackgroundTask2(
|
|
61
61
|
config.background.taskName,
|
|
62
62
|
{
|
|
@@ -129,7 +129,7 @@ var ExpoArkadeSwaps = class _ExpoArkadeSwaps {
|
|
|
129
129
|
}
|
|
130
130
|
await this.inner.dispose();
|
|
131
131
|
try {
|
|
132
|
-
const { unregisterExpoSwapBackgroundTask: unregisterExpoSwapBackgroundTask2 } = await import("../background-
|
|
132
|
+
const { unregisterExpoSwapBackgroundTask: unregisterExpoSwapBackgroundTask2 } = await import("../background-646NBLSK.js");
|
|
133
133
|
await unregisterExpoSwapBackgroundTask2(this.taskName);
|
|
134
134
|
} catch (err) {
|
|
135
135
|
const message = err instanceof Error ? err.message : String(err);
|
package/dist/index.cjs
CHANGED
|
@@ -314,7 +314,7 @@ var isGetReverseSwapTxIdResponse = (data) => {
|
|
|
314
314
|
return data && typeof data === "object" && typeof data.id === "string" && typeof data.timeoutBlockHeight === "number";
|
|
315
315
|
};
|
|
316
316
|
var isGetSwapStatusResponse = (data) => {
|
|
317
|
-
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"));
|
|
317
|
+
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"));
|
|
318
318
|
};
|
|
319
319
|
var isGetSubmarinePairsResponse = (data) => {
|
|
320
320
|
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";
|
|
@@ -323,13 +323,13 @@ var isGetReversePairsResponse = (data) => {
|
|
|
323
323
|
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";
|
|
324
324
|
};
|
|
325
325
|
var isCreateSubmarineSwapResponse = (data) => {
|
|
326
|
-
return data && typeof data === "object" && typeof data.id === "string" && typeof data.
|
|
326
|
+
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));
|
|
327
327
|
};
|
|
328
328
|
var isGetSwapPreimageResponse = (data) => {
|
|
329
329
|
return data && typeof data === "object" && typeof data.preimage === "string";
|
|
330
330
|
};
|
|
331
331
|
var isCreateReverseSwapResponse = (data) => {
|
|
332
|
-
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);
|
|
332
|
+
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));
|
|
333
333
|
};
|
|
334
334
|
var isRefundSubmarineSwapResponse = (data) => {
|
|
335
335
|
return data && typeof data === "object" && typeof data.transaction === "string" && typeof data.checkpoint === "string";
|
|
@@ -368,19 +368,19 @@ var isLeaf = (data) => {
|
|
|
368
368
|
return data && typeof data === "object" && typeof data.version === "number" && typeof data.output === "string";
|
|
369
369
|
};
|
|
370
370
|
var isTree = (data) => {
|
|
371
|
-
return data && typeof data === "object" && isLeaf(data.claimLeaf) && isLeaf(data.refundLeaf) && isLeaf(data.refundWithoutBoltzLeaf) && isLeaf(data.unilateralClaimLeaf) && isLeaf(data.unilateralRefundLeaf) && isLeaf(data.unilateralRefundWithoutBoltzLeaf);
|
|
371
|
+
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));
|
|
372
372
|
};
|
|
373
373
|
var isDetails = (data) => {
|
|
374
|
-
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");
|
|
374
|
+
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");
|
|
375
375
|
};
|
|
376
376
|
var isRestoredChainSwap = (data) => {
|
|
377
|
-
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") &&
|
|
377
|
+
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));
|
|
378
378
|
};
|
|
379
379
|
var isRestoredSubmarineSwap = (data) => {
|
|
380
|
-
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");
|
|
380
|
+
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");
|
|
381
381
|
};
|
|
382
382
|
var isRestoredReverseSwap = (data) => {
|
|
383
|
-
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");
|
|
383
|
+
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");
|
|
384
384
|
};
|
|
385
385
|
var isCreateSwapsRestoreResponse = (data) => {
|
|
386
386
|
return Array.isArray(data) && data.every(
|
|
@@ -3273,6 +3273,9 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3273
3273
|
async claimVHTLC(pendingSwap) {
|
|
3274
3274
|
if (!pendingSwap.preimage)
|
|
3275
3275
|
throw new Error("Preimage is required to claim VHTLC");
|
|
3276
|
+
const { refundPublicKey, lockupAddress, timeoutBlockHeights } = pendingSwap.response;
|
|
3277
|
+
if (!refundPublicKey || !lockupAddress || !timeoutBlockHeights)
|
|
3278
|
+
throw new Error("Incomplete reverse swap response");
|
|
3276
3279
|
const preimage = import_base9.hex.decode(pendingSwap.preimage);
|
|
3277
3280
|
const arkInfo = await this.arkProvider.getInfo();
|
|
3278
3281
|
const address = await this.wallet.getAddress();
|
|
@@ -3282,7 +3285,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3282
3285
|
pendingSwap.id
|
|
3283
3286
|
);
|
|
3284
3287
|
const senderXOnly = normalizeToXOnlyKey(
|
|
3285
|
-
import_base9.hex.decode(
|
|
3288
|
+
import_base9.hex.decode(refundPublicKey),
|
|
3286
3289
|
"boltz",
|
|
3287
3290
|
pendingSwap.id
|
|
3288
3291
|
);
|
|
@@ -3297,11 +3300,11 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3297
3300
|
receiverPubkey: import_base9.hex.encode(receiverXOnly),
|
|
3298
3301
|
senderPubkey: import_base9.hex.encode(senderXOnly),
|
|
3299
3302
|
serverPubkey: import_base9.hex.encode(serverXOnly),
|
|
3300
|
-
timeoutBlockHeights
|
|
3303
|
+
timeoutBlockHeights
|
|
3301
3304
|
});
|
|
3302
3305
|
if (!vhtlcScript.claimScript)
|
|
3303
3306
|
throw new Error("Failed to create VHTLC script for reverse swap");
|
|
3304
|
-
if (vhtlcAddress !==
|
|
3307
|
+
if (vhtlcAddress !== lockupAddress)
|
|
3305
3308
|
throw new Error("Boltz is trying to scam us");
|
|
3306
3309
|
const { vtxos } = await this.indexerProvider.getVtxos({
|
|
3307
3310
|
scripts: [import_base9.hex.encode(vhtlcScript.pkScript)]
|
|
@@ -3442,6 +3445,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3442
3445
|
*/
|
|
3443
3446
|
async sendLightningPayment(args) {
|
|
3444
3447
|
const pendingSwap = await this.createSubmarineSwap(args);
|
|
3448
|
+
if (!pendingSwap.response.address)
|
|
3449
|
+
throw new Error("Missing address in submarine swap response");
|
|
3445
3450
|
await this.savePendingSubmarineSwap(pendingSwap);
|
|
3446
3451
|
const txid = await this.wallet.send({
|
|
3447
3452
|
address: pendingSwap.response.address,
|
|
@@ -3525,8 +3530,11 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3525
3530
|
"server",
|
|
3526
3531
|
pendingSwap.id
|
|
3527
3532
|
);
|
|
3533
|
+
const { claimPublicKey, timeoutBlockHeights } = pendingSwap.response;
|
|
3534
|
+
if (!claimPublicKey || !timeoutBlockHeights)
|
|
3535
|
+
throw new Error("Incomplete submarine swap response");
|
|
3528
3536
|
const boltzXOnlyPublicKey = normalizeToXOnlyKey(
|
|
3529
|
-
import_base9.hex.decode(
|
|
3537
|
+
import_base9.hex.decode(claimPublicKey),
|
|
3530
3538
|
"boltz",
|
|
3531
3539
|
pendingSwap.id
|
|
3532
3540
|
);
|
|
@@ -3536,7 +3544,7 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
3536
3544
|
receiverPubkey: import_base9.hex.encode(boltzXOnlyPublicKey),
|
|
3537
3545
|
senderPubkey: import_base9.hex.encode(ourXOnlyPublicKey),
|
|
3538
3546
|
serverPubkey: import_base9.hex.encode(serverXOnlyPublicKey),
|
|
3539
|
-
timeoutBlockHeights
|
|
3547
|
+
timeoutBlockHeights
|
|
3540
3548
|
});
|
|
3541
3549
|
if (!vhtlcScript.claimScript)
|
|
3542
3550
|
throw new Error("Failed to create VHTLC script for submarine swap");
|
|
@@ -4538,7 +4546,8 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4538
4546
|
lockupAddress,
|
|
4539
4547
|
preimageHash,
|
|
4540
4548
|
serverPublicKey,
|
|
4541
|
-
tree
|
|
4549
|
+
tree,
|
|
4550
|
+
timeoutBlockHeights
|
|
4542
4551
|
} = swap.claimDetails;
|
|
4543
4552
|
reverseSwaps.push({
|
|
4544
4553
|
id,
|
|
@@ -4554,18 +4563,18 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4554
4563
|
onchainAmount: amount,
|
|
4555
4564
|
lockupAddress,
|
|
4556
4565
|
refundPublicKey: serverPublicKey,
|
|
4557
|
-
timeoutBlockHeights: {
|
|
4566
|
+
timeoutBlockHeights: timeoutBlockHeights ?? {
|
|
4558
4567
|
refund: extractTimeLockFromLeafOutput(
|
|
4559
|
-
tree.refundWithoutBoltzLeaf
|
|
4568
|
+
tree.refundWithoutBoltzLeaf?.output ?? ""
|
|
4560
4569
|
),
|
|
4561
4570
|
unilateralClaim: extractTimeLockFromLeafOutput(
|
|
4562
|
-
tree.unilateralClaimLeaf
|
|
4571
|
+
tree.unilateralClaimLeaf?.output ?? ""
|
|
4563
4572
|
),
|
|
4564
4573
|
unilateralRefund: extractTimeLockFromLeafOutput(
|
|
4565
|
-
tree.unilateralRefundLeaf
|
|
4574
|
+
tree.unilateralRefundLeaf?.output ?? ""
|
|
4566
4575
|
),
|
|
4567
4576
|
unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
|
|
4568
|
-
tree.unilateralRefundWithoutBoltzLeaf
|
|
4577
|
+
tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
|
|
4569
4578
|
)
|
|
4570
4579
|
}
|
|
4571
4580
|
},
|
|
@@ -4574,7 +4583,13 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4574
4583
|
preimage: ""
|
|
4575
4584
|
});
|
|
4576
4585
|
} else if (isRestoredSubmarineSwap(swap)) {
|
|
4577
|
-
const {
|
|
4586
|
+
const {
|
|
4587
|
+
amount,
|
|
4588
|
+
lockupAddress,
|
|
4589
|
+
serverPublicKey,
|
|
4590
|
+
tree,
|
|
4591
|
+
timeoutBlockHeights
|
|
4592
|
+
} = swap.refundDetails;
|
|
4578
4593
|
let preimage = "";
|
|
4579
4594
|
if (!isSubmarineFinalStatus(status)) {
|
|
4580
4595
|
try {
|
|
@@ -4605,29 +4620,31 @@ var ArkadeSwaps = class _ArkadeSwaps {
|
|
|
4605
4620
|
address: lockupAddress,
|
|
4606
4621
|
expectedAmount: amount,
|
|
4607
4622
|
claimPublicKey: serverPublicKey,
|
|
4608
|
-
timeoutBlockHeights: {
|
|
4623
|
+
timeoutBlockHeights: timeoutBlockHeights ?? {
|
|
4609
4624
|
refund: extractTimeLockFromLeafOutput(
|
|
4610
|
-
tree.refundWithoutBoltzLeaf
|
|
4625
|
+
tree.refundWithoutBoltzLeaf?.output ?? ""
|
|
4611
4626
|
),
|
|
4612
4627
|
unilateralClaim: extractTimeLockFromLeafOutput(
|
|
4613
|
-
tree.unilateralClaimLeaf
|
|
4628
|
+
tree.unilateralClaimLeaf?.output ?? ""
|
|
4614
4629
|
),
|
|
4615
4630
|
unilateralRefund: extractTimeLockFromLeafOutput(
|
|
4616
|
-
tree.unilateralRefundLeaf
|
|
4631
|
+
tree.unilateralRefundLeaf?.output ?? ""
|
|
4617
4632
|
),
|
|
4618
4633
|
unilateralRefundWithoutReceiver: extractTimeLockFromLeafOutput(
|
|
4619
|
-
tree.unilateralRefundWithoutBoltzLeaf
|
|
4634
|
+
tree.unilateralRefundWithoutBoltzLeaf?.output ?? ""
|
|
4620
4635
|
)
|
|
4621
4636
|
}
|
|
4622
4637
|
}
|
|
4623
4638
|
});
|
|
4624
4639
|
} else if (isRestoredChainSwap(swap)) {
|
|
4640
|
+
const refundDetails = swap.refundDetails;
|
|
4641
|
+
if (!refundDetails) continue;
|
|
4625
4642
|
const {
|
|
4626
4643
|
amount,
|
|
4627
4644
|
lockupAddress,
|
|
4628
4645
|
serverPublicKey,
|
|
4629
4646
|
timeoutBlockHeight
|
|
4630
|
-
} =
|
|
4647
|
+
} = refundDetails;
|
|
4631
4648
|
chainSwaps.push({
|
|
4632
4649
|
id,
|
|
4633
4650
|
type: "chain",
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IArkadeSwaps } from './arkade-swaps-
|
|
2
|
-
export { A as ArkadeSwaps } from './arkade-swaps-
|
|
3
|
-
import {
|
|
4
|
-
export { X as ArkadeSwapsCreateConfig,
|
|
1
|
+
import { I as IArkadeSwaps } from './arkade-swaps-DkM_5yuv.cjs';
|
|
2
|
+
export { A as ArkadeSwaps } from './arkade-swaps-DkM_5yuv.cjs';
|
|
3
|
+
import { B as BoltzSwap, D as DecodedInvoice, a as BoltzChainSwap, b as BoltzReverseSwap, c as BoltzSubmarineSwap, A as ArkadeSwapsConfig, N as Network, C as CreateLightningInvoiceRequest, S as SendLightningPaymentRequest, F as FeesResponse, d as Chain, e as CreateLightningInvoiceResponse, f as SendLightningPaymentResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, h as ArkToBtcResponse, i as BtcToArkResponse, j as SwapRepository, k as SwapManagerClient, l as GetSwapsFilter } from './types-C-2sBQWJ.cjs';
|
|
4
|
+
export { X as ArkadeSwapsCreateConfig, m as BoltzSwapProvider, n as BoltzSwapStatus, W as IncomingPaymentSubscription, V as SwapManager, $ as SwapManagerCallbacks, Z as SwapManagerConfig, _ as SwapManagerEvents, Y as Vtxo, o as isChainClaimableStatus, p as isChainFailedStatus, q as isChainFinalStatus, r as isChainPendingStatus, s as isChainRefundableStatus, t as isChainSignableStatus, u as isChainSuccessStatus, v as isChainSwapClaimable, w as isChainSwapRefundable, x as isPendingChainSwap, y as isPendingReverseSwap, z as isPendingSubmarineSwap, E as isReverseClaimableStatus, H as isReverseFailedStatus, I as isReverseFinalStatus, J as isReversePendingStatus, K as isReverseSuccessStatus, M as isReverseSwapClaimable, O as isSubmarineFailedStatus, P as isSubmarineFinalStatus, Q as isSubmarinePendingStatus, T as isSubmarineRefundableStatus, R as isSubmarineSuccessStatus, U as isSubmarineSwapRefundable } from './types-C-2sBQWJ.cjs';
|
|
5
5
|
import { Transaction } from '@scure/btc-signer';
|
|
6
6
|
import { MessageHandler, RequestEnvelope, ArkInfo, ResponseEnvelope, IWallet, IReadonlyWallet, VHTLC, Identity, ArkTxInput } from '@arkade-os/sdk';
|
|
7
7
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
@@ -15,7 +15,7 @@ interface ErrorOptions {
|
|
|
15
15
|
/** Whether the swap's funds can be refunded. */
|
|
16
16
|
isRefundable?: boolean;
|
|
17
17
|
/** The associated pending swap, if available. */
|
|
18
|
-
pendingSwap?:
|
|
18
|
+
pendingSwap?: BoltzSwap;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Base error class for all swap-related errors.
|
|
@@ -27,7 +27,7 @@ declare class SwapError extends Error {
|
|
|
27
27
|
/** Whether the swap can be refunded (default: false). */
|
|
28
28
|
isRefundable: boolean;
|
|
29
29
|
/** The pending swap associated with this error, if available. */
|
|
30
|
-
pendingSwap?:
|
|
30
|
+
pendingSwap?: BoltzSwap;
|
|
31
31
|
constructor(options?: ErrorOptions);
|
|
32
32
|
}
|
|
33
33
|
/** Thrown when a Lightning invoice expires before being paid. The swap may be refundable. */
|
|
@@ -99,35 +99,35 @@ declare const verifySignatures: (tx: Transaction, inputIndex: number, requiredSi
|
|
|
99
99
|
* Generic type for swap save functions
|
|
100
100
|
*/
|
|
101
101
|
type SwapSaver = {
|
|
102
|
-
saveChainSwap?: (swap:
|
|
103
|
-
saveReverseSwap?: (swap:
|
|
104
|
-
saveSubmarineSwap?: (swap:
|
|
102
|
+
saveChainSwap?: (swap: BoltzChainSwap) => Promise<void>;
|
|
103
|
+
saveReverseSwap?: (swap: BoltzReverseSwap) => Promise<void>;
|
|
104
|
+
saveSubmarineSwap?: (swap: BoltzSubmarineSwap) => Promise<void>;
|
|
105
105
|
};
|
|
106
106
|
/**
|
|
107
107
|
* Save a swap of any type using the appropriate saver function
|
|
108
108
|
* This eliminates the need for type checking in multiple places
|
|
109
109
|
*/
|
|
110
|
-
declare function saveSwap(swap:
|
|
110
|
+
declare function saveSwap(swap: BoltzSwap, saver: SwapSaver): Promise<void>;
|
|
111
111
|
/**
|
|
112
112
|
* Update a reverse swap's status and save it
|
|
113
113
|
*/
|
|
114
|
-
declare function updateReverseSwapStatus(swap:
|
|
114
|
+
declare function updateReverseSwapStatus(swap: BoltzReverseSwap, status: BoltzReverseSwap["status"], saveFunc: (swap: BoltzReverseSwap) => Promise<void>, additionalFields?: Partial<BoltzReverseSwap>): Promise<void>;
|
|
115
115
|
/**
|
|
116
116
|
* Update a submarine swap's status and save it
|
|
117
117
|
*/
|
|
118
|
-
declare function updateSubmarineSwapStatus(swap:
|
|
118
|
+
declare function updateSubmarineSwapStatus(swap: BoltzSubmarineSwap, status: BoltzSubmarineSwap["status"], saveFunc: (swap: BoltzSubmarineSwap) => Promise<void>, additionalFields?: Partial<BoltzSubmarineSwap>): Promise<void>;
|
|
119
119
|
/**
|
|
120
120
|
* Update a chain swap's status and save it
|
|
121
121
|
*/
|
|
122
|
-
declare function updateChainSwapStatus(swap:
|
|
122
|
+
declare function updateChainSwapStatus(swap: BoltzChainSwap, status: BoltzChainSwap["status"], saveFunc: (swap: BoltzChainSwap) => Promise<void>, additionalFields?: Partial<BoltzChainSwap>): Promise<void>;
|
|
123
123
|
/**
|
|
124
124
|
* Enrich a reverse swap with its preimage after validation.
|
|
125
125
|
*/
|
|
126
|
-
declare function enrichReverseSwapPreimage(swap:
|
|
126
|
+
declare function enrichReverseSwapPreimage(swap: BoltzReverseSwap, preimage: string): BoltzReverseSwap;
|
|
127
127
|
/**
|
|
128
128
|
* Enrich a submarine swap with its invoice after validation.
|
|
129
129
|
*/
|
|
130
|
-
declare function enrichSubmarineSwapInvoice(swap:
|
|
130
|
+
declare function enrichSubmarineSwapInvoice(swap: BoltzSubmarineSwap, invoice: string): BoltzSubmarineSwap;
|
|
131
131
|
|
|
132
132
|
type RequestInitArkSwaps = RequestEnvelope & {
|
|
133
133
|
type: "INIT_ARKADE_SWAPS";
|
|
@@ -164,7 +164,7 @@ type RequestCreateSubmarineSwap = RequestEnvelope & {
|
|
|
164
164
|
};
|
|
165
165
|
type ResponseCreateSubmarineSwap = ResponseEnvelope & {
|
|
166
166
|
type: "SUBMARINE_SWAP_CREATED";
|
|
167
|
-
payload:
|
|
167
|
+
payload: BoltzSubmarineSwap;
|
|
168
168
|
};
|
|
169
169
|
type RequestCreateReverseSwap = RequestEnvelope & {
|
|
170
170
|
type: "CREATE_REVERSE_SWAP";
|
|
@@ -172,25 +172,25 @@ type RequestCreateReverseSwap = RequestEnvelope & {
|
|
|
172
172
|
};
|
|
173
173
|
type ResponseCreateReverseSwap = ResponseEnvelope & {
|
|
174
174
|
type: "REVERSE_SWAP_CREATED";
|
|
175
|
-
payload:
|
|
175
|
+
payload: BoltzReverseSwap;
|
|
176
176
|
};
|
|
177
177
|
type RequestClaimVhtlc = RequestEnvelope & {
|
|
178
178
|
type: "CLAIM_VHTLC";
|
|
179
|
-
payload:
|
|
179
|
+
payload: BoltzReverseSwap;
|
|
180
180
|
};
|
|
181
181
|
type ResponseClaimVhtlc = ResponseEnvelope & {
|
|
182
182
|
type: "VHTLC_CLAIMED";
|
|
183
183
|
};
|
|
184
184
|
type RequestRefundVhtlc = RequestEnvelope & {
|
|
185
185
|
type: "REFUND_VHTLC";
|
|
186
|
-
payload:
|
|
186
|
+
payload: BoltzSubmarineSwap;
|
|
187
187
|
};
|
|
188
188
|
type ResponseRefundVhtlc = ResponseEnvelope & {
|
|
189
189
|
type: "VHTLC_REFUNDED";
|
|
190
190
|
};
|
|
191
191
|
type RequestWaitAndClaim = RequestEnvelope & {
|
|
192
192
|
type: "WAIT_AND_CLAIM";
|
|
193
|
-
payload:
|
|
193
|
+
payload: BoltzReverseSwap;
|
|
194
194
|
};
|
|
195
195
|
type ResponseWaitAndClaim = ResponseEnvelope & {
|
|
196
196
|
type: "WAIT_AND_CLAIMED";
|
|
@@ -200,7 +200,7 @@ type ResponseWaitAndClaim = ResponseEnvelope & {
|
|
|
200
200
|
};
|
|
201
201
|
type RequestWaitForSwapSettlement = RequestEnvelope & {
|
|
202
202
|
type: "WAIT_FOR_SWAP_SETTLEMENT";
|
|
203
|
-
payload:
|
|
203
|
+
payload: BoltzSubmarineSwap;
|
|
204
204
|
};
|
|
205
205
|
type ResponseWaitForSwapSettlement = ResponseEnvelope & {
|
|
206
206
|
type: "SWAP_SETTLED";
|
|
@@ -215,32 +215,32 @@ type RequestRestoreSwaps = RequestEnvelope & {
|
|
|
215
215
|
type ResponseRestoreSwaps = ResponseEnvelope & {
|
|
216
216
|
type: "SWAPS_RESTORED";
|
|
217
217
|
payload: {
|
|
218
|
-
chainSwaps:
|
|
219
|
-
reverseSwaps:
|
|
220
|
-
submarineSwaps:
|
|
218
|
+
chainSwaps: BoltzChainSwap[];
|
|
219
|
+
reverseSwaps: BoltzReverseSwap[];
|
|
220
|
+
submarineSwaps: BoltzSubmarineSwap[];
|
|
221
221
|
};
|
|
222
222
|
};
|
|
223
223
|
type RequestEnrichReverseSwapPreimage = RequestEnvelope & {
|
|
224
224
|
type: "ENRICH_REVERSE_SWAP_PREIMAGE";
|
|
225
225
|
payload: {
|
|
226
|
-
swap:
|
|
226
|
+
swap: BoltzReverseSwap;
|
|
227
227
|
preimage: string;
|
|
228
228
|
};
|
|
229
229
|
};
|
|
230
230
|
type ResponseEnrichReverseSwapPreimage = ResponseEnvelope & {
|
|
231
231
|
type: "REVERSE_SWAP_PREIMAGE_ENRICHED";
|
|
232
|
-
payload:
|
|
232
|
+
payload: BoltzReverseSwap;
|
|
233
233
|
};
|
|
234
234
|
type RequestEnrichSubmarineSwapInvoice = RequestEnvelope & {
|
|
235
235
|
type: "ENRICH_SUBMARINE_SWAP_INVOICE";
|
|
236
236
|
payload: {
|
|
237
|
-
swap:
|
|
237
|
+
swap: BoltzSubmarineSwap;
|
|
238
238
|
invoice: string;
|
|
239
239
|
};
|
|
240
240
|
};
|
|
241
241
|
type ResponseEnrichSubmarineSwapInvoice = ResponseEnvelope & {
|
|
242
242
|
type: "SUBMARINE_SWAP_INVOICE_ENRICHED";
|
|
243
|
-
payload:
|
|
243
|
+
payload: BoltzSubmarineSwap;
|
|
244
244
|
};
|
|
245
245
|
type RequestGetFees = RequestEnvelope & {
|
|
246
246
|
type: "GET_FEES";
|
|
@@ -279,28 +279,28 @@ type RequestGetPendingSubmarineSwaps = RequestEnvelope & {
|
|
|
279
279
|
};
|
|
280
280
|
type ResponseGetPendingSubmarineSwaps = ResponseEnvelope & {
|
|
281
281
|
type: "PENDING_SUBMARINE_SWAPS";
|
|
282
|
-
payload:
|
|
282
|
+
payload: BoltzSubmarineSwap[];
|
|
283
283
|
};
|
|
284
284
|
type RequestGetPendingReverseSwaps = RequestEnvelope & {
|
|
285
285
|
type: "GET_PENDING_REVERSE_SWAPS";
|
|
286
286
|
};
|
|
287
287
|
type ResponseGetPendingReverseSwaps = ResponseEnvelope & {
|
|
288
288
|
type: "PENDING_REVERSE_SWAPS";
|
|
289
|
-
payload:
|
|
289
|
+
payload: BoltzReverseSwap[];
|
|
290
290
|
};
|
|
291
291
|
type RequestGetPendingChainSwaps = RequestEnvelope & {
|
|
292
292
|
type: "GET_PENDING_CHAIN_SWAPS";
|
|
293
293
|
};
|
|
294
294
|
type ResponseGetPendingChainSwaps = ResponseEnvelope & {
|
|
295
295
|
type: "PENDING_CHAIN_SWAPS";
|
|
296
|
-
payload:
|
|
296
|
+
payload: BoltzChainSwap[];
|
|
297
297
|
};
|
|
298
298
|
type RequestGetSwapHistory = RequestEnvelope & {
|
|
299
299
|
type: "GET_SWAP_HISTORY";
|
|
300
300
|
};
|
|
301
301
|
type ResponseGetSwapHistory = ResponseEnvelope & {
|
|
302
302
|
type: "SWAP_HISTORY";
|
|
303
|
-
payload: (
|
|
303
|
+
payload: (BoltzReverseSwap | BoltzSubmarineSwap | BoltzChainSwap)[];
|
|
304
304
|
};
|
|
305
305
|
type RequestRefreshSwapsStatus = RequestEnvelope & {
|
|
306
306
|
type: "REFRESH_SWAPS_STATUS";
|
|
@@ -346,11 +346,11 @@ type RequestCreateChainSwap = RequestEnvelope & {
|
|
|
346
346
|
};
|
|
347
347
|
type ResponseCreateChainSwap = ResponseEnvelope & {
|
|
348
348
|
type: "CHAIN_SWAP_CREATED";
|
|
349
|
-
payload:
|
|
349
|
+
payload: BoltzChainSwap;
|
|
350
350
|
};
|
|
351
351
|
type RequestWaitAndClaimChain = RequestEnvelope & {
|
|
352
352
|
type: "WAIT_AND_CLAIM_CHAIN";
|
|
353
|
-
payload:
|
|
353
|
+
payload: BoltzChainSwap;
|
|
354
354
|
};
|
|
355
355
|
type ResponseWaitAndClaimChain = ResponseEnvelope & {
|
|
356
356
|
type: "CHAIN_CLAIMED";
|
|
@@ -360,7 +360,7 @@ type ResponseWaitAndClaimChain = ResponseEnvelope & {
|
|
|
360
360
|
};
|
|
361
361
|
type RequestWaitAndClaimArk = RequestEnvelope & {
|
|
362
362
|
type: "WAIT_AND_CLAIM_ARK";
|
|
363
|
-
payload:
|
|
363
|
+
payload: BoltzChainSwap;
|
|
364
364
|
};
|
|
365
365
|
type ResponseWaitAndClaimArk = ResponseEnvelope & {
|
|
366
366
|
type: "ARK_CLAIMED";
|
|
@@ -370,7 +370,7 @@ type ResponseWaitAndClaimArk = ResponseEnvelope & {
|
|
|
370
370
|
};
|
|
371
371
|
type RequestWaitAndClaimBtc = RequestEnvelope & {
|
|
372
372
|
type: "WAIT_AND_CLAIM_BTC";
|
|
373
|
-
payload:
|
|
373
|
+
payload: BoltzChainSwap;
|
|
374
374
|
};
|
|
375
375
|
type ResponseWaitAndClaimBtc = ResponseEnvelope & {
|
|
376
376
|
type: "BTC_CLAIMED";
|
|
@@ -380,28 +380,28 @@ type ResponseWaitAndClaimBtc = ResponseEnvelope & {
|
|
|
380
380
|
};
|
|
381
381
|
type RequestClaimArk = RequestEnvelope & {
|
|
382
382
|
type: "CLAIM_ARK";
|
|
383
|
-
payload:
|
|
383
|
+
payload: BoltzChainSwap;
|
|
384
384
|
};
|
|
385
385
|
type ResponseClaimArk = ResponseEnvelope & {
|
|
386
386
|
type: "ARK_CLAIM_EXECUTED";
|
|
387
387
|
};
|
|
388
388
|
type RequestClaimBtc = RequestEnvelope & {
|
|
389
389
|
type: "CLAIM_BTC";
|
|
390
|
-
payload:
|
|
390
|
+
payload: BoltzChainSwap;
|
|
391
391
|
};
|
|
392
392
|
type ResponseClaimBtc = ResponseEnvelope & {
|
|
393
393
|
type: "BTC_CLAIM_EXECUTED";
|
|
394
394
|
};
|
|
395
395
|
type RequestRefundArk = RequestEnvelope & {
|
|
396
396
|
type: "REFUND_ARK";
|
|
397
|
-
payload:
|
|
397
|
+
payload: BoltzChainSwap;
|
|
398
398
|
};
|
|
399
399
|
type ResponseRefundArk = ResponseEnvelope & {
|
|
400
400
|
type: "ARK_REFUND_EXECUTED";
|
|
401
401
|
};
|
|
402
402
|
type RequestSignServerClaim = RequestEnvelope & {
|
|
403
403
|
type: "SIGN_SERVER_CLAIM";
|
|
404
|
-
payload:
|
|
404
|
+
payload: BoltzChainSwap;
|
|
405
405
|
};
|
|
406
406
|
type ResponseSignServerClaim = ResponseEnvelope & {
|
|
407
407
|
type: "SERVER_CLAIM_SIGNED";
|
|
@@ -411,7 +411,7 @@ type RequestVerifyChainSwap = RequestEnvelope & {
|
|
|
411
411
|
payload: {
|
|
412
412
|
to: Chain;
|
|
413
413
|
from: Chain;
|
|
414
|
-
swap:
|
|
414
|
+
swap: BoltzChainSwap;
|
|
415
415
|
arkInfo: ArkInfo;
|
|
416
416
|
};
|
|
417
417
|
};
|
|
@@ -447,7 +447,7 @@ type ResponseSwapManagerStop = ResponseEnvelope & {
|
|
|
447
447
|
};
|
|
448
448
|
type RequestSwapManagerAddSwap = RequestEnvelope & {
|
|
449
449
|
type: "SM-ADD_SWAP";
|
|
450
|
-
payload:
|
|
450
|
+
payload: BoltzReverseSwap | BoltzSubmarineSwap | BoltzChainSwap;
|
|
451
451
|
};
|
|
452
452
|
type ResponseSwapManagerAddSwap = ResponseEnvelope & {
|
|
453
453
|
type: "SM-SWAP_ADDED";
|
|
@@ -466,7 +466,7 @@ type RequestSwapManagerGetPending = RequestEnvelope & {
|
|
|
466
466
|
};
|
|
467
467
|
type ResponseSwapManagerGetPending = ResponseEnvelope & {
|
|
468
468
|
type: "SM-PENDING_SWAPS";
|
|
469
|
-
payload: (
|
|
469
|
+
payload: (BoltzReverseSwap | BoltzSubmarineSwap | BoltzChainSwap)[];
|
|
470
470
|
};
|
|
471
471
|
type RequestSwapManagerHasSwap = RequestEnvelope & {
|
|
472
472
|
type: "SM-HAS_SWAP";
|
|
@@ -573,20 +573,20 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
573
573
|
getSwapManager(): SwapManagerClient | null;
|
|
574
574
|
createLightningInvoice(args: CreateLightningInvoiceRequest): Promise<CreateLightningInvoiceResponse>;
|
|
575
575
|
sendLightningPayment(args: SendLightningPaymentRequest): Promise<SendLightningPaymentResponse>;
|
|
576
|
-
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<
|
|
577
|
-
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<
|
|
578
|
-
claimVHTLC(pendingSwap:
|
|
579
|
-
refundVHTLC(pendingSwap:
|
|
580
|
-
waitAndClaim(pendingSwap:
|
|
576
|
+
createSubmarineSwap(args: SendLightningPaymentRequest): Promise<BoltzSubmarineSwap>;
|
|
577
|
+
createReverseSwap(args: CreateLightningInvoiceRequest): Promise<BoltzReverseSwap>;
|
|
578
|
+
claimVHTLC(pendingSwap: BoltzReverseSwap): Promise<void>;
|
|
579
|
+
refundVHTLC(pendingSwap: BoltzSubmarineSwap): Promise<void>;
|
|
580
|
+
waitAndClaim(pendingSwap: BoltzReverseSwap): Promise<{
|
|
581
581
|
txid: string;
|
|
582
582
|
}>;
|
|
583
|
-
waitForSwapSettlement(pendingSwap:
|
|
583
|
+
waitForSwapSettlement(pendingSwap: BoltzSubmarineSwap): Promise<{
|
|
584
584
|
preimage: string;
|
|
585
585
|
}>;
|
|
586
586
|
restoreSwaps(boltzFees?: FeesResponse): Promise<{
|
|
587
|
-
chainSwaps:
|
|
588
|
-
reverseSwaps:
|
|
589
|
-
submarineSwaps:
|
|
587
|
+
chainSwaps: BoltzChainSwap[];
|
|
588
|
+
reverseSwaps: BoltzReverseSwap[];
|
|
589
|
+
submarineSwaps: BoltzSubmarineSwap[];
|
|
590
590
|
}>;
|
|
591
591
|
arkToBtc(args: {
|
|
592
592
|
btcAddress: string;
|
|
@@ -606,29 +606,29 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
606
606
|
feeSatsPerByte?: number;
|
|
607
607
|
senderLockAmount?: number;
|
|
608
608
|
receiverLockAmount?: number;
|
|
609
|
-
}): Promise<
|
|
610
|
-
waitAndClaimChain(pendingSwap:
|
|
609
|
+
}): Promise<BoltzChainSwap>;
|
|
610
|
+
waitAndClaimChain(pendingSwap: BoltzChainSwap): Promise<{
|
|
611
611
|
txid: string;
|
|
612
612
|
}>;
|
|
613
|
-
waitAndClaimArk(pendingSwap:
|
|
613
|
+
waitAndClaimArk(pendingSwap: BoltzChainSwap): Promise<{
|
|
614
614
|
txid: string;
|
|
615
615
|
}>;
|
|
616
|
-
waitAndClaimBtc(pendingSwap:
|
|
616
|
+
waitAndClaimBtc(pendingSwap: BoltzChainSwap): Promise<{
|
|
617
617
|
txid: string;
|
|
618
618
|
}>;
|
|
619
|
-
claimArk(pendingSwap:
|
|
620
|
-
claimBtc(pendingSwap:
|
|
621
|
-
refundArk(pendingSwap:
|
|
622
|
-
signCooperativeClaimForServer(pendingSwap:
|
|
619
|
+
claimArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
620
|
+
claimBtc(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
621
|
+
refundArk(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
622
|
+
signCooperativeClaimForServer(pendingSwap: BoltzChainSwap): Promise<void>;
|
|
623
623
|
verifyChainSwap(args: {
|
|
624
624
|
to: Chain;
|
|
625
625
|
from: Chain;
|
|
626
|
-
swap:
|
|
626
|
+
swap: BoltzChainSwap;
|
|
627
627
|
arkInfo: ArkInfo;
|
|
628
628
|
}): Promise<boolean>;
|
|
629
629
|
quoteSwap(swapId: string): Promise<number>;
|
|
630
|
-
enrichReverseSwapPreimage(swap:
|
|
631
|
-
enrichSubmarineSwapInvoice(swap:
|
|
630
|
+
enrichReverseSwapPreimage(swap: BoltzReverseSwap, preimage: string): BoltzReverseSwap;
|
|
631
|
+
enrichSubmarineSwapInvoice(swap: BoltzSubmarineSwap, invoice: string): BoltzSubmarineSwap;
|
|
632
632
|
createVHTLCScript(_args: {
|
|
633
633
|
network: string;
|
|
634
634
|
preimageHash: Uint8Array;
|
|
@@ -651,10 +651,10 @@ declare class ServiceWorkerArkadeSwaps implements IArkadeSwaps {
|
|
|
651
651
|
getLimits(): Promise<LimitsResponse>;
|
|
652
652
|
getLimits(from: Chain, to: Chain): Promise<LimitsResponse>;
|
|
653
653
|
getSwapStatus(swapId: string): Promise<GetSwapStatusResponse>;
|
|
654
|
-
getPendingSubmarineSwaps(): Promise<
|
|
655
|
-
getPendingReverseSwaps(): Promise<
|
|
656
|
-
getPendingChainSwaps(): Promise<
|
|
657
|
-
getSwapHistory(): Promise<(
|
|
654
|
+
getPendingSubmarineSwaps(): Promise<BoltzSubmarineSwap[]>;
|
|
655
|
+
getPendingReverseSwaps(): Promise<BoltzReverseSwap[]>;
|
|
656
|
+
getPendingChainSwaps(): Promise<BoltzChainSwap[]>;
|
|
657
|
+
getSwapHistory(): Promise<(BoltzReverseSwap | BoltzSubmarineSwap | BoltzChainSwap)[]>;
|
|
658
658
|
refreshSwapsStatus(): Promise<void>;
|
|
659
659
|
/**
|
|
660
660
|
* Reset all swap state: stops the SwapManager and clears the swap repository.
|
|
@@ -717,9 +717,9 @@ declare class IndexedDbSwapRepository implements SwapRepository {
|
|
|
717
717
|
private db;
|
|
718
718
|
constructor(dbName?: string);
|
|
719
719
|
private getDB;
|
|
720
|
-
saveSwap<T extends
|
|
720
|
+
saveSwap<T extends BoltzSwap>(swap: T): Promise<void>;
|
|
721
721
|
deleteSwap(id: string): Promise<void>;
|
|
722
|
-
getAllSwaps<T extends
|
|
722
|
+
getAllSwaps<T extends BoltzSwap>(filter?: GetSwapsFilter): Promise<T[]>;
|
|
723
723
|
clear(): Promise<void>;
|
|
724
724
|
private getSwapsByIndexValues;
|
|
725
725
|
private getAllSwapsFromStore;
|
|
@@ -729,4 +729,4 @@ declare class IndexedDbSwapRepository implements SwapRepository {
|
|
|
729
729
|
[Symbol.asyncDispose](): Promise<void>;
|
|
730
730
|
}
|
|
731
731
|
|
|
732
|
-
export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError,
|
|
732
|
+
export { ArkToBtcResponse, ArkadeSwapsMessageHandler as ArkadeLightningMessageHandler, ArkadeSwapsConfig, ArkadeSwapsMessageHandler, BoltzChainSwap, BoltzReverseSwap, BoltzSubmarineSwap, BoltzSwap, BtcToArkResponse, Chain, ChainFeesResponse, CreateLightningInvoiceRequest, CreateLightningInvoiceResponse, DecodedInvoice, FeesResponse, IndexedDbSwapRepository, InsufficientFundsError, InvoiceExpiredError, InvoiceFailedToPayError, LimitsResponse, type Logger, Network, NetworkError, PreimageFetchError, SchemaError, SendLightningPaymentRequest, SendLightningPaymentResponse, ServiceWorkerArkadeSwaps as ServiceWorkerArkadeLightning, ServiceWorkerArkadeSwaps, SwapError, SwapExpiredError, SwapManagerClient, SwapRepository, type SwapSaver, TransactionFailedError, decodeInvoice, enrichReverseSwapPreimage, enrichSubmarineSwapInvoice, getInvoicePaymentHash, getInvoiceSatoshis, isValidArkAddress, logger, migrateToSwapRepository, saveSwap, setLogger, updateChainSwapStatus, updateReverseSwapStatus, updateSubmarineSwapStatus, verifySignatures };
|