@atomiqlabs/sdk 8.1.8 → 8.3.5
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/bitcoin/coinselect2/utils.d.ts +6 -0
- package/dist/bitcoin/wallet/BitcoinWallet.d.ts +41 -5
- package/dist/bitcoin/wallet/BitcoinWallet.js +36 -1
- package/dist/bitcoin/wallet/IBitcoinWallet.d.ts +52 -2
- package/dist/bitcoin/wallet/IBitcoinWallet.js +2 -1
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.d.ts +42 -7
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.js +36 -1
- package/dist/enums/FeeType.d.ts +8 -1
- package/dist/enums/FeeType.js +8 -1
- package/dist/enums/SwapAmountType.d.ts +7 -0
- package/dist/enums/SwapAmountType.js +7 -0
- package/dist/enums/SwapDirection.d.ts +7 -0
- package/dist/enums/SwapDirection.js +7 -0
- package/dist/enums/SwapType.d.ts +62 -1
- package/dist/enums/SwapType.js +62 -1
- package/dist/errors/IntermediaryError.d.ts +4 -0
- package/dist/errors/IntermediaryError.js +1 -0
- package/dist/errors/RequestError.d.ts +15 -1
- package/dist/errors/RequestError.js +8 -0
- package/dist/errors/UserError.d.ts +1 -0
- package/dist/errors/UserError.js +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -6
- package/dist/intermediaries/Intermediary.d.ts +61 -14
- package/dist/intermediaries/Intermediary.js +38 -11
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +62 -29
- package/dist/intermediaries/IntermediaryDiscovery.js +39 -24
- package/dist/prices/RedundantSwapPrice.d.ts +26 -5
- package/dist/prices/RedundantSwapPrice.js +22 -2
- package/dist/prices/SingleSwapPrice.d.ts +10 -7
- package/dist/prices/SingleSwapPrice.js +11 -8
- package/dist/prices/SwapPriceWithChain.d.ts +56 -19
- package/dist/prices/SwapPriceWithChain.js +62 -25
- package/dist/prices/abstract/IPriceProvider.d.ts +4 -4
- package/dist/prices/abstract/IPriceProvider.js +1 -1
- package/dist/prices/abstract/ISwapPrice.d.ts +95 -46
- package/dist/prices/abstract/ISwapPrice.js +104 -56
- package/dist/prices/providers/BinancePriceProvider.d.ts +8 -1
- package/dist/prices/providers/BinancePriceProvider.js +8 -1
- package/dist/prices/providers/CoinGeckoPriceProvider.d.ts +7 -1
- package/dist/prices/providers/CoinGeckoPriceProvider.js +7 -1
- package/dist/prices/providers/CoinPaprikaPriceProvider.d.ts +7 -1
- package/dist/prices/providers/CoinPaprikaPriceProvider.js +7 -1
- package/dist/prices/providers/CustomPriceProvider.d.ts +12 -1
- package/dist/prices/providers/CustomPriceProvider.js +12 -1
- package/dist/prices/providers/KrakenPriceProvider.d.ts +10 -1
- package/dist/prices/providers/KrakenPriceProvider.js +10 -1
- package/dist/prices/providers/OKXPriceProvider.d.ts +7 -1
- package/dist/prices/providers/OKXPriceProvider.js +7 -1
- package/dist/prices/providers/abstract/ExchangePriceProvider.d.ts +3 -0
- package/dist/prices/providers/abstract/ExchangePriceProvider.js +3 -0
- package/dist/storage/IUnifiedStorage.d.ts +19 -7
- package/dist/storage/UnifiedSwapStorage.d.ts +33 -3
- package/dist/storage/UnifiedSwapStorage.js +29 -1
- package/dist/storage-browser/IndexedDBUnifiedStorage.d.ts +31 -7
- package/dist/storage-browser/IndexedDBUnifiedStorage.js +29 -6
- package/dist/storage-browser/LocalStorageManager.d.ts +25 -1
- package/dist/storage-browser/LocalStorageManager.js +25 -1
- package/dist/swapper/Swapper.d.ts +380 -226
- package/dist/swapper/Swapper.js +383 -349
- package/dist/swapper/SwapperFactory.d.ts +66 -18
- package/dist/swapper/SwapperFactory.js +24 -3
- package/dist/swapper/SwapperUtils.d.ts +75 -28
- package/dist/swapper/SwapperUtils.js +107 -60
- package/dist/swapper/SwapperWithChain.d.ts +286 -91
- package/dist/swapper/SwapperWithChain.js +218 -64
- package/dist/swapper/SwapperWithSigner.d.ts +229 -80
- package/dist/swapper/SwapperWithSigner.js +190 -44
- package/dist/swaps/IAddressSwap.d.ts +12 -3
- package/dist/swaps/IAddressSwap.js +3 -2
- package/dist/swaps/IBTCWalletSwap.d.ts +26 -8
- package/dist/swaps/IBTCWalletSwap.js +3 -2
- package/dist/swaps/IClaimableSwap.d.ts +38 -6
- package/dist/swaps/IClaimableSwap.js +3 -2
- package/dist/swaps/IClaimableSwapWrapper.d.ts +11 -1
- package/dist/swaps/IRefundableSwap.d.ts +31 -5
- package/dist/swaps/IRefundableSwap.js +3 -2
- package/dist/swaps/ISwap.d.ts +162 -24
- package/dist/swaps/ISwap.js +92 -35
- package/dist/swaps/ISwapWithGasDrop.d.ts +8 -2
- package/dist/swaps/ISwapWithGasDrop.js +2 -1
- package/dist/swaps/ISwapWrapper.d.ts +161 -52
- package/dist/swaps/ISwapWrapper.js +131 -73
- package/dist/swaps/escrow_swaps/IEscrowSelfInitSwap.d.ts +51 -6
- package/dist/swaps/escrow_swaps/IEscrowSelfInitSwap.js +22 -12
- package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +65 -12
- package/dist/swaps/escrow_swaps/IEscrowSwap.js +38 -19
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +39 -9
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +30 -21
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +31 -15
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +33 -18
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.d.ts +97 -28
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.js +91 -27
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCWrapper.d.ts +22 -9
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCWrapper.js +24 -11
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +278 -60
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +519 -241
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +77 -26
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +132 -50
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +313 -52
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +544 -194
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +87 -26
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +147 -58
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +222 -55
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +462 -244
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +77 -23
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +116 -46
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +195 -58
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +324 -191
- package/dist/swaps/escrow_swaps/tobtc/IToBTCWrapper.d.ts +30 -5
- package/dist/swaps/escrow_swaps/tobtc/IToBTCWrapper.js +44 -19
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.d.ts +61 -20
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.js +75 -32
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +76 -50
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +106 -101
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.d.ts +37 -14
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.js +66 -20
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +46 -17
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +82 -27
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +350 -88
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +482 -215
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +76 -24
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +247 -124
- package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +148 -20
- package/dist/swaps/trusted/ln/LnForGasSwap.js +175 -45
- package/dist/swaps/trusted/ln/LnForGasWrapper.d.ts +29 -10
- package/dist/swaps/trusted/ln/LnForGasWrapper.js +30 -11
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +202 -49
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +232 -80
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.d.ts +34 -12
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +33 -14
- package/dist/types/AmountData.d.ts +2 -1
- package/dist/types/CustomPriceFunction.d.ts +8 -2
- package/dist/types/PriceInfoType.d.ts +4 -4
- package/dist/types/PriceInfoType.js +3 -3
- package/dist/types/SwapExecutionAction.d.ts +85 -4
- package/dist/types/SwapWithSigner.d.ts +5 -2
- package/dist/types/SwapWithSigner.js +5 -2
- package/dist/types/Token.d.ts +11 -5
- package/dist/types/Token.js +6 -3
- package/dist/types/TokenAmount.d.ts +3 -0
- package/dist/types/TokenAmount.js +2 -0
- package/dist/types/fees/Fee.d.ts +3 -2
- package/dist/types/fees/FeeBreakdown.d.ts +3 -2
- package/dist/types/fees/PercentagePPM.d.ts +4 -2
- package/dist/types/fees/PercentagePPM.js +2 -1
- package/dist/types/lnurl/LNURLPay.d.ts +20 -12
- package/dist/types/lnurl/LNURLPay.js +8 -4
- package/dist/types/lnurl/LNURLWithdraw.d.ts +17 -10
- package/dist/types/lnurl/LNURLWithdraw.js +8 -4
- package/dist/types/wallets/LightningInvoiceCreateService.d.ts +24 -0
- package/dist/types/wallets/LightningInvoiceCreateService.js +15 -0
- package/dist/types/wallets/MinimalBitcoinWalletInterface.d.ts +3 -1
- package/dist/types/wallets/MinimalLightningNetworkWalletInterface.d.ts +4 -2
- package/dist/utils/BitcoinUtils.d.ts +1 -0
- package/dist/utils/BitcoinUtils.js +5 -1
- package/dist/utils/SwapUtils.d.ts +58 -1
- package/dist/utils/SwapUtils.js +55 -1
- package/dist/utils/TokenUtils.d.ts +10 -2
- package/dist/utils/TokenUtils.js +12 -4
- package/package.json +3 -3
- package/src/bitcoin/coinselect2/utils.ts +6 -0
- package/src/bitcoin/wallet/BitcoinWallet.ts +41 -5
- package/src/bitcoin/wallet/IBitcoinWallet.ts +57 -2
- package/src/bitcoin/wallet/SingleAddressBitcoinWallet.ts +42 -6
- package/src/enums/FeeType.ts +8 -1
- package/src/enums/SwapAmountType.ts +7 -0
- package/src/enums/SwapDirection.ts +7 -0
- package/src/enums/SwapType.ts +62 -2
- package/src/errors/IntermediaryError.ts +4 -0
- package/src/errors/RequestError.ts +15 -1
- package/src/errors/UserError.ts +1 -0
- package/src/index.ts +12 -5
- package/src/intermediaries/Intermediary.ts +61 -14
- package/src/intermediaries/IntermediaryDiscovery.ts +69 -34
- package/src/prices/RedundantSwapPrice.ts +26 -6
- package/src/prices/SingleSwapPrice.ts +11 -8
- package/src/prices/SwapPriceWithChain.ts +63 -26
- package/src/prices/abstract/IPriceProvider.ts +4 -4
- package/src/prices/abstract/ISwapPrice.ts +115 -66
- package/src/prices/providers/BinancePriceProvider.ts +8 -1
- package/src/prices/providers/CoinGeckoPriceProvider.ts +7 -1
- package/src/prices/providers/CoinPaprikaPriceProvider.ts +7 -1
- package/src/prices/providers/CustomPriceProvider.ts +12 -1
- package/src/prices/providers/KrakenPriceProvider.ts +10 -1
- package/src/prices/providers/OKXPriceProvider.ts +7 -1
- package/src/prices/providers/abstract/ExchangePriceProvider.ts +3 -0
- package/src/storage/IUnifiedStorage.ts +19 -7
- package/src/storage/UnifiedSwapStorage.ts +33 -3
- package/src/storage-browser/IndexedDBUnifiedStorage.ts +31 -8
- package/src/storage-browser/LocalStorageManager.ts +25 -1
- package/src/swapper/Swapper.ts +599 -390
- package/src/swapper/SwapperFactory.ts +73 -24
- package/src/swapper/SwapperUtils.ts +107 -60
- package/src/swapper/SwapperWithChain.ts +320 -81
- package/src/swapper/SwapperWithSigner.ts +263 -56
- package/src/swaps/IAddressSwap.ts +13 -3
- package/src/swaps/IBTCWalletSwap.ts +26 -10
- package/src/swaps/IClaimableSwap.ts +41 -6
- package/src/swaps/IClaimableSwapWrapper.ts +11 -2
- package/src/swaps/IRefundableSwap.ts +34 -5
- package/src/swaps/ISwap.ts +224 -85
- package/src/swaps/ISwapWithGasDrop.ts +8 -2
- package/src/swaps/ISwapWrapper.ts +216 -98
- package/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts +64 -18
- package/src/swaps/escrow_swaps/IEscrowSwap.ts +83 -37
- package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +61 -30
- package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +37 -19
- package/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts +123 -50
- package/src/swaps/escrow_swaps/frombtc/IFromBTCWrapper.ts +24 -11
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +562 -258
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +156 -62
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +592 -227
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +177 -74
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +483 -245
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +141 -59
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +350 -195
- package/src/swaps/escrow_swaps/tobtc/IToBTCWrapper.ts +48 -23
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts +87 -40
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +110 -110
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.ts +89 -34
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +101 -31
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +556 -259
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +292 -148
- package/src/swaps/trusted/ln/LnForGasSwap.ts +186 -47
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +34 -15
- package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +262 -88
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +41 -19
- package/src/types/AmountData.ts +2 -1
- package/src/types/CustomPriceFunction.ts +8 -2
- package/src/types/PriceInfoType.ts +4 -4
- package/src/types/SwapExecutionAction.ts +97 -5
- package/src/types/SwapWithSigner.ts +8 -4
- package/src/types/Token.ts +12 -5
- package/src/types/TokenAmount.ts +3 -0
- package/src/types/fees/Fee.ts +3 -2
- package/src/types/fees/FeeBreakdown.ts +3 -2
- package/src/types/fees/PercentagePPM.ts +4 -2
- package/src/types/lnurl/LNURLPay.ts +20 -12
- package/src/types/lnurl/LNURLWithdraw.ts +17 -10
- package/src/types/wallets/LightningInvoiceCreateService.ts +30 -0
- package/src/types/wallets/MinimalBitcoinWalletInterface.ts +3 -1
- package/src/types/wallets/MinimalLightningNetworkWalletInterface.ts +4 -2
- package/src/utils/BitcoinUtils.ts +5 -0
- package/src/utils/SwapUtils.ts +63 -1
- package/src/utils/TokenUtils.ts +12 -4
- package/dist/bitcoin/BitcoinRpcWithAddressIndex.d.ts +0 -68
- package/dist/bitcoin/BitcoinRpcWithAddressIndex.js +0 -2
- package/dist/bitcoin/LightningNetworkApi.d.ts +0 -12
- package/dist/bitcoin/LightningNetworkApi.js +0 -2
- package/dist/bitcoin/mempool/MempoolApi.d.ts +0 -350
- package/dist/bitcoin/mempool/MempoolApi.js +0 -311
- package/dist/bitcoin/mempool/MempoolBitcoinBlock.d.ts +0 -44
- package/dist/bitcoin/mempool/MempoolBitcoinBlock.js +0 -48
- package/dist/bitcoin/mempool/MempoolBitcoinRpc.d.ts +0 -119
- package/dist/bitcoin/mempool/MempoolBitcoinRpc.js +0 -361
- package/dist/bitcoin/mempool/synchronizer/MempoolBtcRelaySynchronizer.d.ts +0 -22
- package/dist/bitcoin/mempool/synchronizer/MempoolBtcRelaySynchronizer.js +0 -105
- package/dist/errors/PaymentAuthError.d.ts +0 -11
- package/dist/errors/PaymentAuthError.js +0 -23
- package/src/errors/PaymentAuthError.ts +0 -26
|
@@ -14,83 +14,221 @@ import { BtcToken, SCToken } from "../../../../types/Token";
|
|
|
14
14
|
import { LoggerType } from "../../../../utils/Logger";
|
|
15
15
|
import { LNURLWithdraw } from "../../../../types/lnurl/LNURLWithdraw";
|
|
16
16
|
/**
|
|
17
|
-
* State enum for
|
|
18
|
-
* @category Swaps
|
|
17
|
+
* State enum for legacy Lightning -> Smart chain swaps
|
|
18
|
+
* @category Swaps/Legacy/Lightning → Smart chain
|
|
19
19
|
*/
|
|
20
20
|
export declare enum FromBTCLNSwapState {
|
|
21
|
+
/**
|
|
22
|
+
* Swap has failed as the user didn't settle the HTLC on the destination before expiration
|
|
23
|
+
*/
|
|
21
24
|
FAILED = -4,
|
|
25
|
+
/**
|
|
26
|
+
* Swap has expired for good and there is no way how it can be executed anymore
|
|
27
|
+
*/
|
|
22
28
|
QUOTE_EXPIRED = -3,
|
|
29
|
+
/**
|
|
30
|
+
* A swap is almost expired, and it should be presented to the user as expired, though
|
|
31
|
+
* there is still a chance that it will be processed
|
|
32
|
+
*/
|
|
23
33
|
QUOTE_SOFT_EXPIRED = -2,
|
|
34
|
+
/**
|
|
35
|
+
* Swap HTLC on the destination chain has expired, it is not safe anymore to settle (claim) the
|
|
36
|
+
* swap on the destination smart chain.
|
|
37
|
+
*/
|
|
24
38
|
EXPIRED = -1,
|
|
39
|
+
/**
|
|
40
|
+
* Swap quote was created, use {@link FromBTCLNSwap.getAddress} or {@link FromBTCLNSwap.getHyperlink}
|
|
41
|
+
* to get the bolt11 lightning network invoice to pay to initiate the swap, then use the
|
|
42
|
+
* {@link FromBTCLNSwap.waitForPayment} to wait till the lightning network payment is received
|
|
43
|
+
* by the intermediary (LP)
|
|
44
|
+
*/
|
|
25
45
|
PR_CREATED = 0,
|
|
46
|
+
/**
|
|
47
|
+
* Lightning network payment has been received by the intermediary (LP), the user can now settle
|
|
48
|
+
* the swap on the destination smart chain side with {@link FromBTCLNSwap.commitAndClaim} (if
|
|
49
|
+
* the underlying chain supports it - check with {@link FromBTCLNSwap.canCommitAndClaimInOneShot}),
|
|
50
|
+
* or by calling {@link FromBTCLNSwap.commit} and {@link FromBTCLNSwap.claim} separately.
|
|
51
|
+
*/
|
|
26
52
|
PR_PAID = 1,
|
|
53
|
+
/**
|
|
54
|
+
* Swap escrow HTLC has been created on the destination chain. Continue by claiming it with the
|
|
55
|
+
* {@link FromBTCLNSwap.claim} or {@link FromBTCLNSwap.txsClaim} function.
|
|
56
|
+
*/
|
|
27
57
|
CLAIM_COMMITED = 2,
|
|
58
|
+
/**
|
|
59
|
+
* Swap successfully settled and funds received on the destination chain
|
|
60
|
+
*/
|
|
28
61
|
CLAIM_CLAIMED = 3
|
|
29
62
|
}
|
|
30
63
|
export type FromBTCLNSwapInit<T extends SwapData> = IEscrowSelfInitSwapInit<T> & {
|
|
31
|
-
pr
|
|
32
|
-
secret
|
|
64
|
+
pr?: string;
|
|
65
|
+
secret?: string;
|
|
33
66
|
initialSwapData: T;
|
|
34
67
|
lnurl?: string;
|
|
35
68
|
lnurlK1?: string;
|
|
36
69
|
lnurlCallback?: string;
|
|
37
70
|
};
|
|
38
71
|
export declare function isFromBTCLNSwapInit<T extends SwapData>(obj: any): obj is FromBTCLNSwapInit<T>;
|
|
72
|
+
/**
|
|
73
|
+
* Legacy escrow (HTLC) based swap for Bitcoin Lightning -> Smart chains, requires manual settlement
|
|
74
|
+
* of the swap on the destination network once the lightning network payment is received by the LP.
|
|
75
|
+
*
|
|
76
|
+
* @category Swaps/Legacy/Lightning → Smart chain
|
|
77
|
+
*/
|
|
39
78
|
export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFromBTCSelfInitSwap<T, FromBTCLNDefinition<T>, FromBTCLNSwapState> implements IAddressSwap, IClaimableSwap<T, FromBTCLNDefinition<T>, FromBTCLNSwapState> {
|
|
79
|
+
protected readonly TYPE = SwapType.FROM_BTCLN;
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
40
83
|
protected readonly logger: LoggerType;
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
41
87
|
protected readonly inputToken: BtcToken<true>;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
88
|
+
private readonly lnurlFailSignal;
|
|
89
|
+
private readonly usesClaimHashAsId;
|
|
90
|
+
private readonly initialSwapData;
|
|
91
|
+
/**
|
|
92
|
+
* In case the swap is recovered from on-chain data, the pr saved here is just a payment hash,
|
|
93
|
+
* as it is impossible to retrieve the actual lightning network invoice paid purely from on-chain
|
|
94
|
+
* data
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private pr?;
|
|
98
|
+
private secret?;
|
|
99
|
+
private lnurl?;
|
|
100
|
+
private lnurlK1?;
|
|
101
|
+
private lnurlCallback?;
|
|
102
|
+
private prPosted?;
|
|
103
|
+
/**
|
|
104
|
+
* Sets the LNURL data for the swap
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
_setLNURLData(lnurl: string, lnurlK1: string, lnurlCallback: string): void;
|
|
52
109
|
constructor(wrapper: FromBTCLNWrapper<T>, init: FromBTCLNSwapInit<T["Data"]>);
|
|
53
110
|
constructor(wrapper: FromBTCLNWrapper<T>, obj: any);
|
|
111
|
+
/**
|
|
112
|
+
* @inheritDoc
|
|
113
|
+
* @internal
|
|
114
|
+
*/
|
|
115
|
+
protected getSwapData(): T["Data"];
|
|
116
|
+
/**
|
|
117
|
+
* @inheritDoc
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
54
120
|
protected upgradeVersion(): void;
|
|
121
|
+
/**
|
|
122
|
+
* @inheritDoc
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
55
125
|
protected getIdentifierHash(): Buffer;
|
|
56
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Returns the payment hash of the swap and lightning network invoice, or `null` if not known (i.e. if
|
|
128
|
+
* the swap was recovered from on-chain data, the payment hash might not be known)
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
protected getPaymentHash(): Buffer | null;
|
|
133
|
+
/**
|
|
134
|
+
* @inheritDoc
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
57
137
|
protected canCommit(): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* @inheritDoc
|
|
140
|
+
*/
|
|
58
141
|
getInputAddress(): string | null;
|
|
59
|
-
getInputTxId(): string;
|
|
60
142
|
/**
|
|
61
|
-
*
|
|
143
|
+
* @inheritDoc
|
|
144
|
+
*/
|
|
145
|
+
getInputTxId(): string | null;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the lightning network BOLT11 invoice that needs to be paid as an input to the swap.
|
|
148
|
+
*
|
|
149
|
+
* In case the swap is recovered from on-chain data, the address returned might be just a payment hash,
|
|
150
|
+
* as it is impossible to retrieve the actual lightning network invoice paid purely from on-chain
|
|
151
|
+
* data.
|
|
62
152
|
*/
|
|
63
153
|
getAddress(): string;
|
|
154
|
+
/**
|
|
155
|
+
* A hyperlink representation of the address + amount that the user needs to sends on the source chain.
|
|
156
|
+
* This is suitable to be displayed in a form of QR code.
|
|
157
|
+
*
|
|
158
|
+
* @remarks
|
|
159
|
+
* In case the swap is recovered from on-chain data, the address returned might be just a payment hash,
|
|
160
|
+
* as it is impossible to retrieve the actual lightning network invoice paid purely from on-chain
|
|
161
|
+
* data.
|
|
162
|
+
*/
|
|
64
163
|
getHyperlink(): string;
|
|
65
164
|
/**
|
|
66
165
|
* Returns the timeout time (in UNIX milliseconds) when the swap will definitelly be considered as expired
|
|
67
166
|
* if the LP doesn't make it expired sooner
|
|
68
167
|
*/
|
|
69
168
|
getDefinitiveExpiryTime(): number;
|
|
169
|
+
/**
|
|
170
|
+
* Returns timeout time (in UNIX milliseconds) when the swap htlc will expire
|
|
171
|
+
*/
|
|
172
|
+
getHtlcTimeoutTime(): number | null;
|
|
70
173
|
/**
|
|
71
174
|
* Returns timeout time (in UNIX milliseconds) when the LN invoice will expire
|
|
72
175
|
*/
|
|
73
176
|
getTimeoutTime(): number;
|
|
74
177
|
/**
|
|
75
|
-
*
|
|
178
|
+
* @inheritDoc
|
|
76
179
|
*/
|
|
77
|
-
getHtlcTimeoutTime(): number;
|
|
78
180
|
isFinished(): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* @inheritDoc
|
|
183
|
+
*/
|
|
79
184
|
isClaimable(): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* @inheritDoc
|
|
187
|
+
*/
|
|
80
188
|
isSuccessful(): boolean;
|
|
189
|
+
/**
|
|
190
|
+
* @inheritDoc
|
|
191
|
+
*/
|
|
81
192
|
isFailed(): boolean;
|
|
193
|
+
/**
|
|
194
|
+
* @inheritDoc
|
|
195
|
+
*/
|
|
82
196
|
isQuoteExpired(): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* @inheritDoc
|
|
199
|
+
*/
|
|
83
200
|
isQuoteSoftExpired(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* @inheritDoc
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
84
205
|
_verifyQuoteDefinitelyExpired(): Promise<boolean>;
|
|
85
|
-
|
|
206
|
+
/**
|
|
207
|
+
* @inheritDoc
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
_verifyQuoteValid(): Promise<boolean>;
|
|
211
|
+
/**
|
|
212
|
+
* @inheritDoc
|
|
213
|
+
*/
|
|
86
214
|
getInputToken(): BtcToken<true>;
|
|
215
|
+
/**
|
|
216
|
+
* @inheritDoc
|
|
217
|
+
*/
|
|
87
218
|
getInput(): TokenAmount<T["ChainId"], BtcToken<true>>;
|
|
219
|
+
/**
|
|
220
|
+
* @inheritDoc
|
|
221
|
+
*/
|
|
88
222
|
getSmartChainNetworkFee(): Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>;
|
|
223
|
+
/**
|
|
224
|
+
* @inheritDoc
|
|
225
|
+
*/
|
|
89
226
|
hasEnoughForTxFees(): Promise<{
|
|
90
227
|
enoughBalance: boolean;
|
|
91
228
|
balance: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
|
|
92
229
|
required: TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>;
|
|
93
230
|
}>;
|
|
231
|
+
private isValidSecretPreimage;
|
|
94
232
|
/**
|
|
95
233
|
* Executes the swap with the provided bitcoin lightning network wallet or LNURL
|
|
96
234
|
*
|
|
@@ -101,6 +239,8 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
|
|
|
101
239
|
* link, wallet is not required and the LN invoice can be paid externally as well (just pass null or undefined here)
|
|
102
240
|
* @param callbacks Callbacks to track the progress of the swap
|
|
103
241
|
* @param options Optional options for the swap like feeRate, AbortSignal, and timeouts/intervals
|
|
242
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
243
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
104
244
|
*/
|
|
105
245
|
execute(dstSigner: T["Signer"] | T["NativeSigner"], walletOrLnurlWithdraw?: MinimalLightningNetworkWalletInterface | LNURLWithdraw | string | null | undefined, callbacks?: {
|
|
106
246
|
onSourceTransactionReceived?: (sourceTxId: string) => void;
|
|
@@ -111,14 +251,25 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
|
|
|
111
251
|
abortSignal?: AbortSignal;
|
|
112
252
|
lightningTxCheckIntervalSeconds?: number;
|
|
113
253
|
delayBetweenCommitAndClaimSeconds?: number;
|
|
114
|
-
}): Promise<void>;
|
|
254
|
+
}, secret?: string): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* @inheritDoc
|
|
257
|
+
*
|
|
258
|
+
* @param options
|
|
259
|
+
* @param options.skipChecks Skip checks like making sure init signature is still valid and swap
|
|
260
|
+
* wasn't commited yet (this is handled on swap creation, if you commit right after quoting, you
|
|
261
|
+
* can use `skipChecks=true`)
|
|
262
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
263
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
264
|
+
*/
|
|
115
265
|
txsExecute(options?: {
|
|
116
266
|
skipChecks?: boolean;
|
|
117
|
-
}): Promise<{
|
|
267
|
+
}, secret?: string): Promise<{
|
|
118
268
|
name: "Payment";
|
|
119
269
|
description: string;
|
|
120
|
-
chain:
|
|
270
|
+
chain: "LIGHTNING";
|
|
121
271
|
txs: {
|
|
272
|
+
type: "BOLT11_PAYMENT_REQUEST";
|
|
122
273
|
address: string;
|
|
123
274
|
hyperlink: string;
|
|
124
275
|
}[];
|
|
@@ -137,6 +288,8 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
|
|
|
137
288
|
* Checks whether the LP received the LN payment and we can continue by committing & claiming the HTLC on-chain
|
|
138
289
|
*
|
|
139
290
|
* @param save If the new swap state should be saved
|
|
291
|
+
*
|
|
292
|
+
* @internal
|
|
140
293
|
*/
|
|
141
294
|
_checkIntermediaryPaymentReceived(save?: boolean): Promise<boolean | null>;
|
|
142
295
|
/**
|
|
@@ -145,108 +298,141 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
|
|
|
145
298
|
* @param signer Smart chain signer's address initiating the swap
|
|
146
299
|
* @param data Parsed swap data as returned by the intermediary
|
|
147
300
|
* @param signature Signature data as returned by the intermediary
|
|
148
|
-
*
|
|
301
|
+
*
|
|
149
302
|
* @throws {IntermediaryError} If the returned are not valid
|
|
150
303
|
* @throws {SignatureVerificationError} If the returned signature is not valid
|
|
151
304
|
* @throws {Error} If the swap is already committed on-chain
|
|
305
|
+
*
|
|
306
|
+
* @internal
|
|
152
307
|
*/
|
|
153
308
|
protected checkIntermediaryReturnedAuthData(signer: string, data: T["Data"], signature: SignatureData): Promise<void>;
|
|
154
309
|
/**
|
|
155
|
-
* Waits till
|
|
310
|
+
* Waits till a lightning network payment is received by the intermediary and client
|
|
311
|
+
* can continue by initiating (committing) & settling (claiming) the HTLC by calling
|
|
312
|
+
* either the {@link commitAndClaim} function (if the underlying chain allows commit
|
|
313
|
+
* and claim in a single transaction - check with {@link canCommitAndClaimInOneShot}).
|
|
314
|
+
* Or call {@link commit} and then {@link claim} separately.
|
|
315
|
+
*
|
|
316
|
+
* If this swap is using an LNURL-withdraw link as input, it automatically posts the
|
|
317
|
+
* generated invoice to the LNURL service to pay it.
|
|
156
318
|
*
|
|
157
319
|
* @param onPaymentReceived Callback as for when the LP reports having received the ln payment
|
|
158
320
|
* @param abortSignal Abort signal to stop waiting for payment
|
|
159
|
-
* @param checkIntervalSeconds How often to poll the intermediary for answer
|
|
321
|
+
* @param checkIntervalSeconds How often to poll the intermediary for answer (default 5 seconds)
|
|
160
322
|
*/
|
|
161
323
|
waitForPayment(onPaymentReceived?: (txId: string) => void, checkIntervalSeconds?: number, abortSignal?: AbortSignal): Promise<boolean>;
|
|
162
324
|
/**
|
|
163
|
-
*
|
|
325
|
+
* @inheritDoc
|
|
164
326
|
*
|
|
165
|
-
* @param _signer Signer to sign the transactions with, must be the same as used in the initialization
|
|
166
|
-
* @param abortSignal Abort signal to stop waiting for the transaction confirmation and abort
|
|
167
|
-
* @param skipChecks Skip checks like making sure init signature is still valid and swap wasn't commited yet
|
|
168
|
-
* (this is handled when swap is created (quoted), if you commit right after quoting, you can use skipChecks=true)
|
|
169
|
-
* @param onBeforeTxSent
|
|
170
327
|
* @throws {Error} If invalid signer is provided that doesn't match the swap data
|
|
171
328
|
*/
|
|
172
329
|
commit(_signer: T["Signer"] | T["NativeSigner"], abortSignal?: AbortSignal, skipChecks?: boolean, onBeforeTxSent?: (txId: string) => void): Promise<string>;
|
|
330
|
+
/**
|
|
331
|
+
* @inheritDoc
|
|
332
|
+
*/
|
|
173
333
|
waitTillCommited(abortSignal?: AbortSignal): Promise<void>;
|
|
174
334
|
/**
|
|
175
335
|
* Unsafe txs claim getter without state checking!
|
|
176
336
|
*
|
|
177
337
|
* @param _signer
|
|
178
|
-
* @
|
|
338
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
339
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
340
|
+
*
|
|
341
|
+
* @internal
|
|
179
342
|
*/
|
|
180
343
|
private _txsClaim;
|
|
181
344
|
/**
|
|
182
|
-
*
|
|
183
|
-
* (hash preimage)
|
|
345
|
+
* @inheritDoc
|
|
184
346
|
*
|
|
185
347
|
* @param _signer Optional signer address to use for claiming the swap, can also be different from the initializer
|
|
186
|
-
* @
|
|
348
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
349
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
350
|
+
*
|
|
351
|
+
* @throws {Error} If in invalid state (must be {@link FromBTCLNSwapState.CLAIM_COMMITED})
|
|
187
352
|
*/
|
|
188
|
-
txsClaim(_signer?: T["Signer"] | T["NativeSigner"]): Promise<T["TX"][]>;
|
|
353
|
+
txsClaim(_signer?: T["Signer"] | T["NativeSigner"], secret?: string): Promise<T["TX"][]>;
|
|
189
354
|
/**
|
|
190
|
-
*
|
|
355
|
+
* @inheritDoc
|
|
191
356
|
*
|
|
192
|
-
* @param _signer
|
|
193
|
-
* @param abortSignal
|
|
357
|
+
* @param _signer
|
|
358
|
+
* @param abortSignal
|
|
194
359
|
* @param onBeforeTxSent
|
|
360
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
361
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
195
362
|
*/
|
|
196
|
-
claim(_signer: T["Signer"] | T["NativeSigner"], abortSignal?: AbortSignal, onBeforeTxSent?: (txId: string) => void): Promise<string>;
|
|
363
|
+
claim(_signer: T["Signer"] | T["NativeSigner"], abortSignal?: AbortSignal, onBeforeTxSent?: (txId: string) => void, secret?: string): Promise<string>;
|
|
197
364
|
/**
|
|
198
|
-
*
|
|
365
|
+
* @inheritDoc
|
|
199
366
|
*
|
|
200
|
-
* @
|
|
201
|
-
* @param abortSignal AbortSignal
|
|
202
|
-
* @throws {Error} If swap is in invalid state (must be BTC_TX_CONFIRMED)
|
|
367
|
+
* @throws {Error} If swap is in invalid state (must be {@link FromBTCLNSwapState.CLAIM_COMMITED})
|
|
203
368
|
* @throws {Error} If the LP refunded sooner than we were able to claim
|
|
204
|
-
* @returns {boolean} whether the swap was claimed in time or not
|
|
205
369
|
*/
|
|
206
370
|
waitTillClaimed(maxWaitTimeSeconds?: number, abortSignal?: AbortSignal): Promise<boolean>;
|
|
207
371
|
/**
|
|
208
|
-
* Estimated transaction fee for commit & claim
|
|
372
|
+
* Estimated transaction fee for commit & claim transactions combined, required
|
|
373
|
+
* to settle the swap on the smart chain destination side.
|
|
374
|
+
*/
|
|
375
|
+
getCommitAndClaimNetworkFee(): Promise<TokenAmount<T["ChainId"], SCToken<T["ChainId"]>, true>>;
|
|
376
|
+
/**
|
|
377
|
+
* Returns whether the underlying chain supports calling commit and claim in a single call,
|
|
378
|
+
* such that you can use the {@link commitAndClaim} function. If not you have to manually
|
|
379
|
+
* call {@link commit} first and then {@link claim}.
|
|
209
380
|
*/
|
|
210
|
-
getCommitAndClaimFee(): Promise<bigint>;
|
|
211
381
|
canCommitAndClaimInOneShot(): boolean;
|
|
212
382
|
/**
|
|
213
383
|
* Returns transactions for both commit & claim operation together, such that they can be signed all at once by
|
|
214
|
-
* the wallet.
|
|
384
|
+
* the wallet. **WARNING**: transactions must be sent sequentially, such that the claim (2nd) transaction is only
|
|
215
385
|
* sent after the commit (1st) transaction confirms. Failure to do so can reveal the HTLC pre-image too soon,
|
|
216
|
-
* opening a possibility for the LP to steal funds
|
|
386
|
+
* opening a possibility for the LP to steal funds!
|
|
217
387
|
*
|
|
218
388
|
* @param skipChecks Skip checks like making sure init signature is still valid and swap wasn't commited yet
|
|
219
389
|
* (this is handled when swap is created (quoted), if you commit right after quoting, you can use skipChecks=true)
|
|
390
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
391
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
220
392
|
*
|
|
221
393
|
* @throws {Error} If in invalid state (must be PR_PAID or CLAIM_COMMITED)
|
|
222
394
|
*/
|
|
223
|
-
txsCommitAndClaim(skipChecks?: boolean): Promise<T["TX"][]>;
|
|
395
|
+
txsCommitAndClaim(skipChecks?: boolean, secret?: string): Promise<T["TX"][]>;
|
|
224
396
|
/**
|
|
225
|
-
* Commits and claims the swap, in a way that the transactions can be signed together by the
|
|
226
|
-
* then sent sequentially
|
|
397
|
+
* Commits and claims the swap, in a way that the transactions can be signed together by the provided signer and
|
|
398
|
+
* then automatically sent sequentially by the SDK. To check if the underlying chain supports this flow check
|
|
399
|
+
* the {@link canCommitAndClaimInOneShot} function.
|
|
227
400
|
*
|
|
228
401
|
* @param _signer Signer to sign the transactions with, must be the same as used in the initialization
|
|
229
402
|
* @param abortSignal Abort signal to stop waiting for the transaction confirmation and abort
|
|
230
403
|
* @param skipChecks Skip checks like making sure init signature is still valid and swap wasn't commited yet
|
|
231
404
|
* (this is handled when swap is created (quoted), if you commit right after quoting, you can use skipChecks=true)
|
|
232
|
-
* @param onBeforeCommitTxSent
|
|
233
|
-
*
|
|
405
|
+
* @param onBeforeCommitTxSent Optional callback called before the initialization (commit) transaction is
|
|
406
|
+
* broadcasted
|
|
407
|
+
* @param onBeforeClaimTxSent Optional callback called before the settlement (claim) transaction is
|
|
408
|
+
* broadcasted
|
|
409
|
+
* @param secret A swap secret to use for the claim transaction, generally only needed if the swap
|
|
410
|
+
* was recovered from on-chain data, or the pre-image was generated outside the SDK
|
|
411
|
+
*
|
|
234
412
|
* @throws {Error} If in invalid state (must be PR_PAID or CLAIM_COMMITED)
|
|
235
413
|
* @throws {Error} If invalid signer is provided that doesn't match the swap data
|
|
236
414
|
*/
|
|
237
|
-
commitAndClaim(_signer: T["Signer"] | T["NativeSigner"], abortSignal?: AbortSignal, skipChecks?: boolean, onBeforeCommitTxSent?: (txId: string) => void, onBeforeClaimTxSent?: (txId: string) => void): Promise<string[]>;
|
|
415
|
+
commitAndClaim(_signer: T["Signer"] | T["NativeSigner"], abortSignal?: AbortSignal, skipChecks?: boolean, onBeforeCommitTxSent?: (txId: string) => void, onBeforeClaimTxSent?: (txId: string) => void, secret?: string): Promise<string[]>;
|
|
238
416
|
/**
|
|
239
|
-
*
|
|
417
|
+
* Whether this swap uses an LNURL-withdraw link
|
|
240
418
|
*/
|
|
241
419
|
isLNURL(): boolean;
|
|
242
420
|
/**
|
|
243
|
-
* Gets the used LNURL or null if this is not an LNURL-withdraw swap
|
|
421
|
+
* Gets the used LNURL or `null` if this is not an LNURL-withdraw swap
|
|
244
422
|
*/
|
|
245
423
|
getLNURL(): string | null;
|
|
246
424
|
/**
|
|
247
|
-
* Pay the generated lightning network invoice with LNURL-withdraw
|
|
425
|
+
* Pay the generated lightning network invoice with an LNURL-withdraw link, this
|
|
426
|
+
* is useful when you want to display a lightning payment QR code and also want to
|
|
427
|
+
* allow payments using LNURL-withdraw NFC cards.
|
|
428
|
+
*
|
|
429
|
+
* Note that the swap needs to be created **without** an LNURL to begin with for this function
|
|
430
|
+
* to work. If this swap is already using an LNURL-withdraw link, this function throws.
|
|
248
431
|
*/
|
|
249
432
|
settleWithLNURLWithdraw(lnurl: string | LNURLWithdraw): Promise<void>;
|
|
433
|
+
/**
|
|
434
|
+
* @inheritDoc
|
|
435
|
+
*/
|
|
250
436
|
serialize(): any;
|
|
251
437
|
/**
|
|
252
438
|
* Checks the swap's state on-chain and compares it to its internal state, updates/changes it according to on-chain
|
|
@@ -255,9 +441,41 @@ export declare class FromBTCLNSwap<T extends ChainType = ChainType> extends IFro
|
|
|
255
441
|
* @private
|
|
256
442
|
*/
|
|
257
443
|
private syncStateFromChain;
|
|
444
|
+
/**
|
|
445
|
+
* @inheritDoc
|
|
446
|
+
* @internal
|
|
447
|
+
*/
|
|
258
448
|
_shouldFetchExpiryStatus(): boolean;
|
|
259
|
-
|
|
449
|
+
/**
|
|
450
|
+
* @inheritDoc
|
|
451
|
+
* @internal
|
|
452
|
+
*/
|
|
453
|
+
_shouldFetchOnchainState(): boolean;
|
|
454
|
+
/**
|
|
455
|
+
* Whether an intermediary (LP) should be contacted to get the state of this swap.
|
|
456
|
+
*
|
|
457
|
+
* @internal
|
|
458
|
+
*/
|
|
260
459
|
_shouldCheckIntermediary(): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* @inheritDoc
|
|
462
|
+
* @internal
|
|
463
|
+
*/
|
|
261
464
|
_sync(save?: boolean, quoteDefinitelyExpired?: boolean, commitStatus?: SwapCommitState, skipLpCheck?: boolean): Promise<boolean>;
|
|
465
|
+
/**
|
|
466
|
+
* @inheritDoc
|
|
467
|
+
* @internal
|
|
468
|
+
*/
|
|
469
|
+
_forciblySetOnchainState(commitStatus: SwapCommitState): Promise<boolean>;
|
|
470
|
+
/**
|
|
471
|
+
* @inheritDoc
|
|
472
|
+
* @internal
|
|
473
|
+
*/
|
|
262
474
|
_tick(save?: boolean): Promise<boolean>;
|
|
475
|
+
/**
|
|
476
|
+
* Forcibly sets the swap secret pre-image from on-chain data
|
|
477
|
+
*
|
|
478
|
+
* @internal
|
|
479
|
+
*/
|
|
480
|
+
_setSwapSecret(secret: string): void;
|
|
263
481
|
}
|