@atomiqlabs/sdk 8.7.7 → 8.9.0
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/api/index.d.ts +1 -0
- package/api/index.js +3 -0
- package/dist/ApiList.d.ts +37 -0
- package/dist/ApiList.js +30 -0
- package/dist/api/ApiEndpoints.d.ts +393 -0
- package/dist/api/ApiEndpoints.js +2 -0
- package/dist/api/ApiParser.d.ts +10 -0
- package/dist/api/ApiParser.js +134 -0
- package/dist/api/ApiTypes.d.ts +157 -0
- package/dist/api/ApiTypes.js +75 -0
- package/dist/api/SerializedAction.d.ts +40 -0
- package/dist/api/SerializedAction.js +59 -0
- package/dist/api/SwapperApi.d.ts +50 -0
- package/dist/api/SwapperApi.js +431 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.js +24 -0
- package/dist/bitcoin/coinselect2/accumulative.d.ts +1 -0
- package/dist/bitcoin/coinselect2/accumulative.js +1 -1
- package/dist/bitcoin/coinselect2/blackjack.d.ts +1 -0
- package/dist/bitcoin/coinselect2/blackjack.js +1 -1
- package/dist/bitcoin/coinselect2/index.d.ts +3 -2
- package/dist/bitcoin/coinselect2/index.js +2 -2
- package/dist/bitcoin/coinselect2/utils.d.ts +7 -2
- package/dist/bitcoin/coinselect2/utils.js +45 -10
- package/dist/bitcoin/wallet/BitcoinWallet.d.ts +8 -25
- package/dist/bitcoin/wallet/BitcoinWallet.js +31 -18
- package/dist/bitcoin/wallet/IBitcoinWallet.d.ts +40 -2
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.d.ts +7 -2
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.js +10 -4
- package/dist/events/UnifiedSwapEventListener.d.ts +4 -3
- package/dist/events/UnifiedSwapEventListener.js +8 -2
- package/dist/http/HttpUtils.d.ts +4 -2
- package/dist/http/HttpUtils.js +10 -4
- package/dist/http/paramcoders/client/StreamingFetchPromise.d.ts +2 -1
- package/dist/http/paramcoders/client/StreamingFetchPromise.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +7 -2
- package/dist/intermediaries/IntermediaryDiscovery.js +4 -4
- package/dist/intermediaries/apis/IntermediaryAPI.d.ts +182 -15
- package/dist/intermediaries/apis/IntermediaryAPI.js +192 -31
- package/dist/intermediaries/auth/SignedKeyBasedAuth.d.ts +14 -0
- package/dist/intermediaries/auth/SignedKeyBasedAuth.js +68 -0
- package/dist/storage/IUnifiedStorage.d.ts +45 -3
- package/dist/storage/UnifiedSwapStorage.d.ts +8 -2
- package/dist/storage/UnifiedSwapStorage.js +46 -8
- package/dist/swapper/Swapper.d.ts +77 -4
- package/dist/swapper/Swapper.js +117 -25
- package/dist/swapper/SwapperUtils.d.ts +18 -2
- package/dist/swapper/SwapperUtils.js +39 -1
- package/dist/swaps/ISwap.d.ts +70 -9
- package/dist/swaps/ISwap.js +28 -6
- package/dist/swaps/ISwapWrapper.d.ts +11 -1
- package/dist/swaps/ISwapWrapper.js +23 -3
- package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwap.js +4 -2
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +2 -1
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +2 -2
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +3 -2
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +47 -31
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +201 -67
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +6 -6
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +82 -15
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +304 -98
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +6 -6
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +75 -42
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +424 -87
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +7 -7
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +54 -11
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +214 -41
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +2 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +7 -8
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +3 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +5 -5
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +85 -22
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +299 -56
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +41 -7
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +183 -58
- package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +53 -12
- package/dist/swaps/trusted/ln/LnForGasSwap.js +163 -49
- package/dist/swaps/trusted/ln/LnForGasWrapper.js +1 -2
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +14 -13
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +30 -47
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.d.ts +3 -1
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +4 -4
- package/dist/types/SwapExecutionAction.d.ts +141 -34
- package/dist/types/SwapExecutionAction.js +104 -0
- package/dist/types/SwapExecutionStep.d.ts +144 -0
- package/dist/types/SwapExecutionStep.js +87 -0
- package/dist/types/TokenAmount.d.ts +6 -0
- package/dist/types/TokenAmount.js +26 -1
- package/dist/utils/BitcoinUtils.d.ts +4 -0
- package/dist/utils/BitcoinUtils.js +73 -1
- package/dist/utils/BitcoinWalletUtils.d.ts +2 -2
- package/dist/utils/Utils.d.ts +3 -1
- package/dist/utils/Utils.js +7 -1
- package/package.json +7 -4
- package/src/api/ApiEndpoints.ts +427 -0
- package/src/api/ApiParser.ts +138 -0
- package/src/api/ApiTypes.ts +229 -0
- package/src/api/SerializedAction.ts +97 -0
- package/src/api/SwapperApi.ts +545 -0
- package/src/api/index.ts +5 -0
- package/src/bitcoin/coinselect2/accumulative.ts +2 -1
- package/src/bitcoin/coinselect2/blackjack.ts +2 -1
- package/src/bitcoin/coinselect2/index.ts +5 -4
- package/src/bitcoin/coinselect2/utils.ts +55 -14
- package/src/bitcoin/wallet/BitcoinWallet.ts +69 -57
- package/src/bitcoin/wallet/IBitcoinWallet.ts +44 -3
- package/src/bitcoin/wallet/SingleAddressBitcoinWallet.ts +12 -4
- package/src/events/UnifiedSwapEventListener.ts +11 -3
- package/src/http/HttpUtils.ts +10 -4
- package/src/http/paramcoders/client/StreamingFetchPromise.ts +4 -2
- package/src/index.ts +1 -0
- package/src/intermediaries/IntermediaryDiscovery.ts +9 -2
- package/src/intermediaries/apis/IntermediaryAPI.ts +335 -35
- package/src/intermediaries/auth/SignedKeyBasedAuth.ts +69 -0
- package/src/storage/IUnifiedStorage.ts +45 -4
- package/src/storage/UnifiedSwapStorage.ts +42 -8
- package/src/swapper/Swapper.ts +165 -24
- package/src/swapper/SwapperUtils.ts +42 -2
- package/src/swaps/ISwap.ts +88 -16
- package/src/swaps/ISwapWrapper.ts +28 -3
- package/src/swaps/escrow_swaps/IEscrowSwap.ts +5 -3
- package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +3 -1
- package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +4 -1
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +264 -67
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +6 -4
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +390 -89
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +6 -4
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +548 -94
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +7 -5
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +276 -45
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +7 -6
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +5 -3
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +413 -64
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +239 -61
- package/src/swaps/trusted/ln/LnForGasSwap.ts +211 -47
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +1 -2
- package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +32 -51
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +5 -3
- package/src/types/SwapExecutionAction.ts +266 -43
- package/src/types/SwapExecutionStep.ts +224 -0
- package/src/types/TokenAmount.ts +36 -2
- package/src/utils/BitcoinUtils.ts +73 -0
- package/src/utils/BitcoinWalletUtils.ts +2 -2
- package/src/utils/Utils.ts +10 -1
- package/src/intermediaries/apis/TrustedIntermediaryAPI.ts +0 -258
|
@@ -10,7 +10,6 @@ const UserError_1 = require("../../../../errors/UserError");
|
|
|
10
10
|
const IntermediaryError_1 = require("../../../../errors/IntermediaryError");
|
|
11
11
|
const SwapType_1 = require("../../../../enums/SwapType");
|
|
12
12
|
const Utils_1 = require("../../../../utils/Utils");
|
|
13
|
-
const IntermediaryAPI_1 = require("../../../../intermediaries/apis/IntermediaryAPI");
|
|
14
13
|
const RequestError_1 = require("../../../../errors/RequestError");
|
|
15
14
|
const IFromBTCLNWrapper_1 = require("../IFromBTCLNWrapper");
|
|
16
15
|
const RetryUtils_1 = require("../../../../utils/RetryUtils");
|
|
@@ -31,11 +30,12 @@ class FromBTCLNWrapper extends IFromBTCLNWrapper_1.IFromBTCLNWrapper {
|
|
|
31
30
|
* @param tokens
|
|
32
31
|
* @param versionedContracts
|
|
33
32
|
* @param lnApi
|
|
33
|
+
* @param lpApi
|
|
34
34
|
* @param options
|
|
35
35
|
* @param events Instance to use for emitting events
|
|
36
36
|
*/
|
|
37
|
-
constructor(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, versionedContracts, lnApi, options, events) {
|
|
38
|
-
super(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, versionedContracts, lnApi, {
|
|
37
|
+
constructor(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, versionedContracts, lnApi, lpApi, options, events) {
|
|
38
|
+
super(chainIdentifier, unifiedStorage, unifiedChainEvents, chain, prices, tokens, versionedContracts, lnApi, lpApi, {
|
|
39
39
|
...options,
|
|
40
40
|
safetyFactor: options?.safetyFactor ?? 2,
|
|
41
41
|
bitcoinBlocktime: options?.bitcoinBlocktime ?? 10 * 60,
|
|
@@ -193,7 +193,7 @@ class FromBTCLNWrapper extends IFromBTCLNWrapper_1.IFromBTCLNWrapper {
|
|
|
193
193
|
const abortController = (0, Utils_1.extendAbortController)(_abortController.signal);
|
|
194
194
|
const liquidityPromise = this.preFetchIntermediaryLiquidity(amountData, lp, abortController, version);
|
|
195
195
|
const { lnCapacityPromise, resp } = await (0, RetryUtils_1.tryWithRetries)(async (retryCount) => {
|
|
196
|
-
const { lnPublicKey, response } =
|
|
196
|
+
const { lnPublicKey, response } = this._lpApi.initFromBTCLN(this.chainIdentifier, lp.url, nativeTokenAddress, {
|
|
197
197
|
paymentHash,
|
|
198
198
|
amount: amountData.amount,
|
|
199
199
|
claimer: recipient,
|
|
@@ -201,7 +201,7 @@ class FromBTCLNWrapper extends IFromBTCLNWrapper_1.IFromBTCLNWrapper {
|
|
|
201
201
|
description: _options.description,
|
|
202
202
|
descriptionHash: _options.descriptionHash,
|
|
203
203
|
exactOut: !amountData.exactIn,
|
|
204
|
-
feeRate: (0, Utils_1.throwIfUndefined)(_preFetches.feeRatePromise[version]),
|
|
204
|
+
feeRate: (0, Utils_1.throwIfUndefined)(_preFetches.feeRatePromise[version], "Network fee rate pre-fetch failed!"),
|
|
205
205
|
additionalParams
|
|
206
206
|
}, this._options.postRequestTimeout, abortController.signal, retryCount > 0 ? false : undefined);
|
|
207
207
|
let lnCapacityPromise;
|
|
@@ -226,7 +226,7 @@ class FromBTCLNWrapper extends IFromBTCLNWrapper_1.IFromBTCLNWrapper {
|
|
|
226
226
|
this.verifyReturnedData(resp, amountData, lp, _options, decodedPr, paymentHash);
|
|
227
227
|
const [pricingInfo] = await Promise.all([
|
|
228
228
|
this.verifyReturnedPrice(lp.services[SwapType_1.SwapType.FROM_BTCLN], false, amountIn, resp.total, amountData.token, { swapFeeBtc }, _preFetches.pricePrefetchPromise, _preFetches.usdPricePrefetchPromise, abortController.signal),
|
|
229
|
-
this.verifyIntermediaryLiquidity(resp.total, (0, Utils_1.throwIfUndefined)(liquidityPromise)),
|
|
229
|
+
this.verifyIntermediaryLiquidity(resp.total, (0, Utils_1.throwIfUndefined)(liquidityPromise, "LP liquidity pre-fetch failed!")),
|
|
230
230
|
lnCapacityPromise != null ? this.verifyLnNodeCapacity(lp, decodedPr, lnCapacityPromise, abortController.signal) : Promise.resolve()
|
|
231
231
|
]);
|
|
232
232
|
const quote = new FromBTCLNSwap_1.FromBTCLNSwap(this, {
|
|
@@ -16,7 +16,9 @@ import { BtcToken, SCToken } from "../../../../types/Token";
|
|
|
16
16
|
import { LoggerType } from "../../../../utils/Logger";
|
|
17
17
|
import { LNURLWithdraw } from "../../../../types/lnurl/LNURLWithdraw";
|
|
18
18
|
import { PriceInfoType } from "../../../../types/PriceInfoType";
|
|
19
|
-
import {
|
|
19
|
+
import { SwapExecutionActionSendToAddress, SwapExecutionActionSignSmartChainTx, SwapExecutionActionWait } from "../../../../types/SwapExecutionAction";
|
|
20
|
+
import { SwapExecutionStepPayment, SwapExecutionStepSettlement } from "../../../../types/SwapExecutionStep";
|
|
21
|
+
import { SwapStateInfo } from "../../../../types/SwapStateInfo";
|
|
20
22
|
/**
|
|
21
23
|
* State enum for FromBTCLNAuto swaps
|
|
22
24
|
* @category Swaps/Lightning → Smart chain
|
|
@@ -368,7 +370,7 @@ export declare class FromBTCLNAutoSwap<T extends ChainType = ChainType> extends
|
|
|
368
370
|
*
|
|
369
371
|
* @throws {Error} If an invalid secret preimage is provided
|
|
370
372
|
*/
|
|
371
|
-
setSecretPreimage(secret: string): void
|
|
373
|
+
setSecretPreimage(secret: string): Promise<void>;
|
|
372
374
|
/**
|
|
373
375
|
* Returns whether the secret preimage for this swap is known
|
|
374
376
|
*/
|
|
@@ -395,19 +397,40 @@ export declare class FromBTCLNAutoSwap<T extends ChainType = ChainType> extends
|
|
|
395
397
|
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
396
398
|
secret?: string;
|
|
397
399
|
}): Promise<boolean>;
|
|
400
|
+
/**
|
|
401
|
+
* @internal
|
|
402
|
+
*/
|
|
403
|
+
protected _getExecutionStatus(options?: {
|
|
404
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
405
|
+
secret?: string;
|
|
406
|
+
}): Promise<{
|
|
407
|
+
steps: [SwapExecutionStepPayment<"LIGHTNING">, SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">];
|
|
408
|
+
buildCurrentAction: (actionOptions?: {
|
|
409
|
+
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
410
|
+
}) => Promise<SwapExecutionActionSendToAddress<true> | SwapExecutionActionWait<"LP" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T> | undefined>;
|
|
411
|
+
state: number;
|
|
412
|
+
}>;
|
|
413
|
+
/**
|
|
414
|
+
* @internal
|
|
415
|
+
*/
|
|
416
|
+
private _buildLightningPaymentAction;
|
|
417
|
+
/**
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
private _buildWaitLpAction;
|
|
421
|
+
/**
|
|
422
|
+
* @internal
|
|
423
|
+
*/
|
|
424
|
+
private _buildWaitSettlementAction;
|
|
398
425
|
/**
|
|
399
426
|
* @inheritDoc
|
|
427
|
+
* @internal
|
|
400
428
|
*/
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
type: "BOLT11_PAYMENT_REQUEST";
|
|
407
|
-
address: string;
|
|
408
|
-
hyperlink: string;
|
|
409
|
-
}[];
|
|
410
|
-
}[]>;
|
|
429
|
+
_submitExecutionTransactions(txs: (T["SignedTXType"] | string)[], abortSignal?: AbortSignal, requiredStates?: FromBTCLNAutoSwapState[], idempotent?: boolean): Promise<string[]>;
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
private _buildClaimSmartChainTxAction;
|
|
411
434
|
/**
|
|
412
435
|
*
|
|
413
436
|
* @param options.manualSettlementSmartChainSigner Optional smart chain signer to create a manual claim (settlement) transaction
|
|
@@ -416,11 +439,36 @@ export declare class FromBTCLNAutoSwap<T extends ChainType = ChainType> extends
|
|
|
416
439
|
* @param options.secret A swap secret to broadcast to watchtowers, generally only needed if the swap
|
|
417
440
|
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
418
441
|
*/
|
|
419
|
-
|
|
442
|
+
getExecutionAction(options?: {
|
|
420
443
|
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
421
444
|
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
422
445
|
secret?: string;
|
|
423
|
-
}): Promise<
|
|
446
|
+
}): Promise<SwapExecutionActionSendToAddress<true> | SwapExecutionActionWait<"LP" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T> | undefined>;
|
|
447
|
+
/**
|
|
448
|
+
* @inheritDoc
|
|
449
|
+
*/
|
|
450
|
+
getExecutionStatus(options?: {
|
|
451
|
+
skipBuildingAction?: boolean;
|
|
452
|
+
manualSettlementSmartChainSigner?: string | T["Signer"] | T["NativeSigner"];
|
|
453
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
454
|
+
secret?: string;
|
|
455
|
+
}): Promise<{
|
|
456
|
+
steps: [
|
|
457
|
+
SwapExecutionStepPayment<"LIGHTNING">,
|
|
458
|
+
SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">
|
|
459
|
+
];
|
|
460
|
+
currentAction: SwapExecutionActionSendToAddress<true> | SwapExecutionActionWait<"LP" | "SETTLEMENT"> | SwapExecutionActionSignSmartChainTx<T> | undefined;
|
|
461
|
+
stateInfo: SwapStateInfo<FromBTCLNAutoSwapState>;
|
|
462
|
+
}>;
|
|
463
|
+
/**
|
|
464
|
+
* @inheritDoc
|
|
465
|
+
*/
|
|
466
|
+
getExecutionSteps(options?: {
|
|
467
|
+
maxWaitTillAutomaticSettlementSeconds?: number;
|
|
468
|
+
}): Promise<[
|
|
469
|
+
SwapExecutionStepPayment<"LIGHTNING">,
|
|
470
|
+
SwapExecutionStepSettlement<T["ChainId"], "awaiting_automatic" | "awaiting_manual">
|
|
471
|
+
]>;
|
|
424
472
|
/**
|
|
425
473
|
* Checks whether the LP received the LN payment
|
|
426
474
|
*
|
|
@@ -439,6 +487,24 @@ export declare class FromBTCLNAutoSwap<T extends ChainType = ChainType> extends
|
|
|
439
487
|
* @internal
|
|
440
488
|
*/
|
|
441
489
|
_saveRealSwapData(data: T["Data"], save?: boolean): Promise<boolean>;
|
|
490
|
+
/**
|
|
491
|
+
* Waits till a lightning network payment is received by the intermediary, and the intermediary
|
|
492
|
+
* initiates the swap HTLC on the smart chain side. After the HTLC is initiated you can wait
|
|
493
|
+
* for an automatic settlement by the watchtowers with the {@link waitTillClaimed} function,
|
|
494
|
+
* or settle manually using the {@link claim} or {@link txsClaim} functions.
|
|
495
|
+
*
|
|
496
|
+
* If this swap is using an LNURL-withdraw link as input, it automatically posts the
|
|
497
|
+
* generated invoice to the LNURL service to pay it.
|
|
498
|
+
*
|
|
499
|
+
* @remarks For internal use, rather use {@link waitForPayment} which properly waits till the LP also
|
|
500
|
+
* offers a swap HTLC.
|
|
501
|
+
*
|
|
502
|
+
* @param abortSignal Abort signal to stop waiting for payment
|
|
503
|
+
* @param checkIntervalSeconds How often to poll the intermediary for answer (default 5 seconds)
|
|
504
|
+
*
|
|
505
|
+
* @internal
|
|
506
|
+
*/
|
|
507
|
+
_waitForLpPaymentReceived(checkIntervalSeconds?: number, abortSignal?: AbortSignal): Promise<boolean>;
|
|
442
508
|
/**
|
|
443
509
|
* Checks the data returned by the intermediary in the payment auth request
|
|
444
510
|
*
|
|
@@ -501,12 +567,13 @@ export declare class FromBTCLNAutoSwap<T extends ChainType = ChainType> extends
|
|
|
501
567
|
* @param abortSignal AbortSignal
|
|
502
568
|
* @param secret A swap secret to broadcast to watchtowers, generally only needed if the swap
|
|
503
569
|
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
570
|
+
* @param pollIntervalSeconds How often to poll via the watchdog
|
|
504
571
|
*
|
|
505
572
|
* @throws {Error} If swap is in invalid state (must be {@link FromBTCLNAutoSwapState.CLAIM_COMMITED})
|
|
506
573
|
* @throws {Error} If the LP refunded sooner than we were able to claim
|
|
507
574
|
* @returns {boolean} whether the swap was claimed in time or not
|
|
508
575
|
*/
|
|
509
|
-
waitTillClaimed(maxWaitTimeSeconds?: number, abortSignal?: AbortSignal, secret?: string): Promise<boolean>;
|
|
576
|
+
waitTillClaimed(maxWaitTimeSeconds?: number, abortSignal?: AbortSignal, secret?: string, pollIntervalSeconds?: number): Promise<boolean>;
|
|
510
577
|
/**
|
|
511
578
|
* Whether this swap uses an LNURL-withdraw link
|
|
512
579
|
*/
|