@arkade-os/boltz-swap 0.3.14 → 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-BfHIKMq0.d.ts → arkade-swaps-DRMB_apa.d.ts} +1 -1
- package/dist/{arkade-swaps-CwQbGdU9.d.cts → arkade-swaps-DkM_5yuv.d.cts} +1 -1
- 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 +2 -2
- package/dist/expo/index.d.ts +2 -2
- package/dist/expo/index.js +4 -4
- package/dist/index.cjs +43 -26
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/repositories/realm/index.d.cts +1 -1
- package/dist/repositories/realm/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/{types-x542EUL6.d.cts → types-C-2sBQWJ.d.cts} +26 -29
- package/dist/{types-x542EUL6.d.ts → types-C-2sBQWJ.d.ts} +26 -29
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWallet, ArkProvider, IndexerProvider, ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
|
|
2
|
-
import { m as BoltzSwapProvider, V as SwapManager, j as SwapRepository, X as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, k as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, h as ArkToBtcResponse, a as BoltzChainSwap, i as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-
|
|
2
|
+
import { m as BoltzSwapProvider, V as SwapManager, j as SwapRepository, X as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, k as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, h as ArkToBtcResponse, a as BoltzChainSwap, i as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-C-2sBQWJ.js';
|
|
3
3
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IWallet, ArkProvider, IndexerProvider, ArkInfo, Identity, ArkTxInput, VHTLC } from '@arkade-os/sdk';
|
|
2
|
-
import { m as BoltzSwapProvider, V as SwapManager, j as SwapRepository, X as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, k as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, h as ArkToBtcResponse, a as BoltzChainSwap, i as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-
|
|
2
|
+
import { m as BoltzSwapProvider, V as SwapManager, j as SwapRepository, X as ArkadeSwapsCreateConfig, A as ArkadeSwapsConfig, k as SwapManagerClient, C as CreateLightningInvoiceRequest, e as CreateLightningInvoiceResponse, b as BoltzReverseSwap, S as SendLightningPaymentRequest, f as SendLightningPaymentResponse, c as BoltzSubmarineSwap, h as ArkToBtcResponse, a as BoltzChainSwap, i as BtcToArkResponse, d as Chain, F as FeesResponse, g as ChainFeesResponse, L as LimitsResponse, G as GetSwapStatusResponse, B as BoltzSwap } from './types-C-2sBQWJ.cjs';
|
|
3
3
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
defineExpoSwapBackgroundTask,
|
|
3
3
|
registerExpoSwapBackgroundTask,
|
|
4
4
|
unregisterExpoSwapBackgroundTask
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-DPGNWPDB.js";
|
|
6
|
+
import "./chunk-Y6GPJDXY.js";
|
|
7
7
|
import "./chunk-3RG5ZIWI.js";
|
|
8
8
|
export {
|
|
9
9
|
defineExpoSwapBackgroundTask,
|
|
@@ -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, 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-
|
|
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';
|
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, 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-
|
|
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';
|
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 { 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-
|
|
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-
|
|
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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IArkadeSwaps } from './arkade-swaps-
|
|
2
|
-
export { A as ArkadeSwaps } from './arkade-swaps-
|
|
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-
|
|
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-
|
|
1
|
+
import { I as IArkadeSwaps } from './arkade-swaps-DRMB_apa.js';
|
|
2
|
+
export { A as ArkadeSwaps } from './arkade-swaps-DRMB_apa.js';
|
|
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.js';
|
|
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.js';
|
|
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';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
|
|
2
|
-
import { j as SwapRepository, B as BoltzSwap, l as GetSwapsFilter } from '../../types-
|
|
2
|
+
import { j as SwapRepository, B as BoltzSwap, l as GetSwapsFilter } from '../../types-C-2sBQWJ.cjs';
|
|
3
3
|
import '@arkade-os/sdk';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SQLExecutor } from '@arkade-os/sdk/repositories/sqlite';
|
|
2
|
-
import { j as SwapRepository, B as BoltzSwap, l as GetSwapsFilter } from '../../types-
|
|
2
|
+
import { j as SwapRepository, B as BoltzSwap, l as GetSwapsFilter } from '../../types-C-2sBQWJ.js';
|
|
3
3
|
import '@arkade-os/sdk';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -81,6 +81,7 @@ type GetSwapStatusResponse = {
|
|
|
81
81
|
transaction?: {
|
|
82
82
|
id: string;
|
|
83
83
|
hex?: string;
|
|
84
|
+
confirmed?: boolean;
|
|
84
85
|
eta?: number;
|
|
85
86
|
preimage?: string;
|
|
86
87
|
};
|
|
@@ -96,16 +97,18 @@ type CreateSubmarineSwapRequest = {
|
|
|
96
97
|
type CreateSubmarineSwapResponse = {
|
|
97
98
|
/** Unique swap ID. */
|
|
98
99
|
id: string;
|
|
99
|
-
/** ARK lockup address to send funds to. */
|
|
100
|
-
address: string;
|
|
101
100
|
/** Amount in satoshis to send. */
|
|
102
101
|
expectedAmount: number;
|
|
102
|
+
/** ARK lockup address to send funds to. */
|
|
103
|
+
address?: string;
|
|
103
104
|
/** Boltz's public key for the claim path. */
|
|
104
|
-
claimPublicKey
|
|
105
|
+
claimPublicKey?: string;
|
|
105
106
|
/** Whether zero-conf transactions are accepted. */
|
|
106
|
-
acceptZeroConf
|
|
107
|
+
acceptZeroConf?: boolean;
|
|
108
|
+
/** Block height for the onchain HTLC timeout. */
|
|
109
|
+
timeoutBlockHeight?: number;
|
|
107
110
|
/** Block heights for various timeout/refund scenarios. */
|
|
108
|
-
timeoutBlockHeights
|
|
111
|
+
timeoutBlockHeights?: TimeoutBlockHeights;
|
|
109
112
|
};
|
|
110
113
|
type GetSwapPreimageResponse = {
|
|
111
114
|
preimage: string;
|
|
@@ -128,13 +131,15 @@ type CreateReverseSwapResponse = {
|
|
|
128
131
|
/** BOLT11-encoded Lightning invoice to be paid. */
|
|
129
132
|
invoice: string;
|
|
130
133
|
/** On-chain amount in satoshis (after Boltz fees). */
|
|
131
|
-
onchainAmount
|
|
134
|
+
onchainAmount?: number;
|
|
132
135
|
/** ARK lockup address where Boltz will lock funds. */
|
|
133
|
-
lockupAddress
|
|
136
|
+
lockupAddress?: string;
|
|
134
137
|
/** Boltz's public key for the refund path. */
|
|
135
|
-
refundPublicKey
|
|
138
|
+
refundPublicKey?: string;
|
|
139
|
+
/** Block height for the onchain HTLC timeout. */
|
|
140
|
+
timeoutBlockHeight?: number;
|
|
136
141
|
/** Block heights for various timeout/refund scenarios. */
|
|
137
|
-
timeoutBlockHeights
|
|
142
|
+
timeoutBlockHeights?: TimeoutBlockHeights;
|
|
138
143
|
};
|
|
139
144
|
type SwapTree = {
|
|
140
145
|
claimLeaf: {
|
|
@@ -223,10 +228,11 @@ type Leaf = {
|
|
|
223
228
|
type Tree = {
|
|
224
229
|
claimLeaf: Leaf;
|
|
225
230
|
refundLeaf: Leaf;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
covenantClaimLeaf?: Leaf;
|
|
232
|
+
refundWithoutBoltzLeaf?: Leaf;
|
|
233
|
+
unilateralClaimLeaf?: Leaf;
|
|
234
|
+
unilateralRefundLeaf?: Leaf;
|
|
235
|
+
unilateralRefundWithoutBoltzLeaf?: Leaf;
|
|
230
236
|
};
|
|
231
237
|
type Details = {
|
|
232
238
|
tree: Tree;
|
|
@@ -238,7 +244,7 @@ type Details = {
|
|
|
238
244
|
};
|
|
239
245
|
lockupAddress: string;
|
|
240
246
|
serverPublicKey: string;
|
|
241
|
-
timeoutBlockHeight
|
|
247
|
+
timeoutBlockHeight?: number;
|
|
242
248
|
timeoutBlockHeights?: TimeoutBlockHeights;
|
|
243
249
|
preimageHash?: string;
|
|
244
250
|
};
|
|
@@ -249,19 +255,10 @@ type RestoredChainSwap = {
|
|
|
249
255
|
createdAt: number;
|
|
250
256
|
from: "ARK" | "BTC";
|
|
251
257
|
to: "ARK" | "BTC";
|
|
252
|
-
preimageHash
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
lockupAddress: string;
|
|
257
|
-
serverPublicKey: string;
|
|
258
|
-
timeoutBlockHeight: number;
|
|
259
|
-
transaction?: {
|
|
260
|
-
id: string;
|
|
261
|
-
vout: number;
|
|
262
|
-
};
|
|
263
|
-
tree: Tree;
|
|
264
|
-
};
|
|
258
|
+
preimageHash?: string;
|
|
259
|
+
invoice?: string;
|
|
260
|
+
refundDetails?: Details;
|
|
261
|
+
claimDetails?: Details;
|
|
265
262
|
};
|
|
266
263
|
type RestoredSubmarineSwap = {
|
|
267
264
|
to: "BTC";
|
|
@@ -269,7 +266,7 @@ type RestoredSubmarineSwap = {
|
|
|
269
266
|
from: "ARK";
|
|
270
267
|
type: "submarine";
|
|
271
268
|
createdAt: number;
|
|
272
|
-
preimageHash
|
|
269
|
+
preimageHash?: string;
|
|
273
270
|
status: BoltzSwapStatus;
|
|
274
271
|
refundDetails: Details;
|
|
275
272
|
invoice?: string;
|
|
@@ -280,7 +277,7 @@ type RestoredReverseSwap = {
|
|
|
280
277
|
from: "BTC";
|
|
281
278
|
type: "reverse";
|
|
282
279
|
createdAt: number;
|
|
283
|
-
preimageHash
|
|
280
|
+
preimageHash?: string;
|
|
284
281
|
status: BoltzSwapStatus;
|
|
285
282
|
claimDetails: Details;
|
|
286
283
|
invoice?: string;
|
|
@@ -81,6 +81,7 @@ type GetSwapStatusResponse = {
|
|
|
81
81
|
transaction?: {
|
|
82
82
|
id: string;
|
|
83
83
|
hex?: string;
|
|
84
|
+
confirmed?: boolean;
|
|
84
85
|
eta?: number;
|
|
85
86
|
preimage?: string;
|
|
86
87
|
};
|
|
@@ -96,16 +97,18 @@ type CreateSubmarineSwapRequest = {
|
|
|
96
97
|
type CreateSubmarineSwapResponse = {
|
|
97
98
|
/** Unique swap ID. */
|
|
98
99
|
id: string;
|
|
99
|
-
/** ARK lockup address to send funds to. */
|
|
100
|
-
address: string;
|
|
101
100
|
/** Amount in satoshis to send. */
|
|
102
101
|
expectedAmount: number;
|
|
102
|
+
/** ARK lockup address to send funds to. */
|
|
103
|
+
address?: string;
|
|
103
104
|
/** Boltz's public key for the claim path. */
|
|
104
|
-
claimPublicKey
|
|
105
|
+
claimPublicKey?: string;
|
|
105
106
|
/** Whether zero-conf transactions are accepted. */
|
|
106
|
-
acceptZeroConf
|
|
107
|
+
acceptZeroConf?: boolean;
|
|
108
|
+
/** Block height for the onchain HTLC timeout. */
|
|
109
|
+
timeoutBlockHeight?: number;
|
|
107
110
|
/** Block heights for various timeout/refund scenarios. */
|
|
108
|
-
timeoutBlockHeights
|
|
111
|
+
timeoutBlockHeights?: TimeoutBlockHeights;
|
|
109
112
|
};
|
|
110
113
|
type GetSwapPreimageResponse = {
|
|
111
114
|
preimage: string;
|
|
@@ -128,13 +131,15 @@ type CreateReverseSwapResponse = {
|
|
|
128
131
|
/** BOLT11-encoded Lightning invoice to be paid. */
|
|
129
132
|
invoice: string;
|
|
130
133
|
/** On-chain amount in satoshis (after Boltz fees). */
|
|
131
|
-
onchainAmount
|
|
134
|
+
onchainAmount?: number;
|
|
132
135
|
/** ARK lockup address where Boltz will lock funds. */
|
|
133
|
-
lockupAddress
|
|
136
|
+
lockupAddress?: string;
|
|
134
137
|
/** Boltz's public key for the refund path. */
|
|
135
|
-
refundPublicKey
|
|
138
|
+
refundPublicKey?: string;
|
|
139
|
+
/** Block height for the onchain HTLC timeout. */
|
|
140
|
+
timeoutBlockHeight?: number;
|
|
136
141
|
/** Block heights for various timeout/refund scenarios. */
|
|
137
|
-
timeoutBlockHeights
|
|
142
|
+
timeoutBlockHeights?: TimeoutBlockHeights;
|
|
138
143
|
};
|
|
139
144
|
type SwapTree = {
|
|
140
145
|
claimLeaf: {
|
|
@@ -223,10 +228,11 @@ type Leaf = {
|
|
|
223
228
|
type Tree = {
|
|
224
229
|
claimLeaf: Leaf;
|
|
225
230
|
refundLeaf: Leaf;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
covenantClaimLeaf?: Leaf;
|
|
232
|
+
refundWithoutBoltzLeaf?: Leaf;
|
|
233
|
+
unilateralClaimLeaf?: Leaf;
|
|
234
|
+
unilateralRefundLeaf?: Leaf;
|
|
235
|
+
unilateralRefundWithoutBoltzLeaf?: Leaf;
|
|
230
236
|
};
|
|
231
237
|
type Details = {
|
|
232
238
|
tree: Tree;
|
|
@@ -238,7 +244,7 @@ type Details = {
|
|
|
238
244
|
};
|
|
239
245
|
lockupAddress: string;
|
|
240
246
|
serverPublicKey: string;
|
|
241
|
-
timeoutBlockHeight
|
|
247
|
+
timeoutBlockHeight?: number;
|
|
242
248
|
timeoutBlockHeights?: TimeoutBlockHeights;
|
|
243
249
|
preimageHash?: string;
|
|
244
250
|
};
|
|
@@ -249,19 +255,10 @@ type RestoredChainSwap = {
|
|
|
249
255
|
createdAt: number;
|
|
250
256
|
from: "ARK" | "BTC";
|
|
251
257
|
to: "ARK" | "BTC";
|
|
252
|
-
preimageHash
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
lockupAddress: string;
|
|
257
|
-
serverPublicKey: string;
|
|
258
|
-
timeoutBlockHeight: number;
|
|
259
|
-
transaction?: {
|
|
260
|
-
id: string;
|
|
261
|
-
vout: number;
|
|
262
|
-
};
|
|
263
|
-
tree: Tree;
|
|
264
|
-
};
|
|
258
|
+
preimageHash?: string;
|
|
259
|
+
invoice?: string;
|
|
260
|
+
refundDetails?: Details;
|
|
261
|
+
claimDetails?: Details;
|
|
265
262
|
};
|
|
266
263
|
type RestoredSubmarineSwap = {
|
|
267
264
|
to: "BTC";
|
|
@@ -269,7 +266,7 @@ type RestoredSubmarineSwap = {
|
|
|
269
266
|
from: "ARK";
|
|
270
267
|
type: "submarine";
|
|
271
268
|
createdAt: number;
|
|
272
|
-
preimageHash
|
|
269
|
+
preimageHash?: string;
|
|
273
270
|
status: BoltzSwapStatus;
|
|
274
271
|
refundDetails: Details;
|
|
275
272
|
invoice?: string;
|
|
@@ -280,7 +277,7 @@ type RestoredReverseSwap = {
|
|
|
280
277
|
from: "BTC";
|
|
281
278
|
type: "reverse";
|
|
282
279
|
createdAt: number;
|
|
283
|
-
preimageHash
|
|
280
|
+
preimageHash?: string;
|
|
284
281
|
status: BoltzSwapStatus;
|
|
285
282
|
claimDetails: Details;
|
|
286
283
|
invoice?: string;
|