@atomiqlabs/sdk 8.3.1 → 8.3.6
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/SingleAddressBitcoinWallet.d.ts +4 -0
- package/dist/bitcoin/wallet/SingleAddressBitcoinWallet.js +6 -0
- package/dist/enums/FeeType.d.ts +1 -1
- package/dist/enums/FeeType.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/dist/intermediaries/Intermediary.d.ts +4 -4
- package/dist/intermediaries/Intermediary.js +1 -1
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +7 -7
- package/dist/intermediaries/IntermediaryDiscovery.js +4 -2
- package/dist/prices/RedundantSwapPrice.d.ts +2 -2
- package/dist/prices/RedundantSwapPrice.js +1 -1
- package/dist/prices/SingleSwapPrice.d.ts +1 -1
- package/dist/prices/SingleSwapPrice.js +1 -1
- package/dist/prices/SwapPriceWithChain.d.ts +5 -6
- package/dist/prices/SwapPriceWithChain.js +6 -7
- package/dist/prices/abstract/IPriceProvider.d.ts +4 -4
- package/dist/prices/abstract/IPriceProvider.js +1 -1
- package/dist/prices/abstract/ISwapPrice.d.ts +1 -1
- package/dist/prices/abstract/ISwapPrice.js +1 -1
- package/dist/prices/providers/BinancePriceProvider.d.ts +1 -1
- package/dist/prices/providers/BinancePriceProvider.js +1 -1
- package/dist/prices/providers/CoinGeckoPriceProvider.d.ts +1 -1
- package/dist/prices/providers/CoinGeckoPriceProvider.js +1 -1
- package/dist/prices/providers/CoinPaprikaPriceProvider.d.ts +1 -1
- package/dist/prices/providers/CoinPaprikaPriceProvider.js +1 -1
- package/dist/prices/providers/CustomPriceProvider.d.ts +1 -1
- package/dist/prices/providers/CustomPriceProvider.js +1 -1
- package/dist/prices/providers/KrakenPriceProvider.d.ts +1 -1
- package/dist/prices/providers/KrakenPriceProvider.js +1 -1
- package/dist/prices/providers/OKXPriceProvider.d.ts +1 -1
- package/dist/prices/providers/OKXPriceProvider.js +1 -1
- package/dist/swapper/Swapper.d.ts +80 -7
- package/dist/swapper/Swapper.js +7 -5
- package/dist/swapper/SwapperFactory.d.ts +25 -1
- package/dist/swapper/SwapperFactory.js +1 -1
- package/dist/swaps/IAddressSwap.d.ts +2 -2
- package/dist/swaps/IAddressSwap.js +1 -1
- package/dist/swaps/IBTCWalletSwap.d.ts +2 -2
- package/dist/swaps/IBTCWalletSwap.js +1 -1
- package/dist/swaps/IClaimableSwap.d.ts +3 -3
- package/dist/swaps/IClaimableSwap.js +1 -1
- package/dist/swaps/IClaimableSwapWrapper.d.ts +1 -1
- package/dist/swaps/IRefundableSwap.d.ts +2 -2
- package/dist/swaps/IRefundableSwap.js +1 -1
- package/dist/swaps/ISwap.d.ts +3 -3
- package/dist/swaps/ISwap.js +2 -2
- package/dist/swaps/ISwapWithGasDrop.d.ts +2 -2
- package/dist/swaps/ISwapWithGasDrop.js +1 -1
- package/dist/swaps/ISwapWrapper.d.ts +4 -4
- package/dist/swaps/ISwapWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSelfInitSwap.d.ts +4 -2
- package/dist/swaps/escrow_swaps/IEscrowSelfInitSwap.js +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwap.d.ts +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwap.js +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/IEscrowSwapWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.d.ts +9 -5
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.js +5 -4
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.d.ts +6 -5
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +6 -5
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +4 -3
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +4 -3
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.d.ts +18 -7
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +18 -7
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.d.ts +3 -7
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +3 -7
- package/dist/swaps/escrow_swaps/tobtc/IToBTCWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/tobtc/IToBTCWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.d.ts +1 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.js +1 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.js +1 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.d.ts +1 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.js +1 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.d.ts +1 -1
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.js +1 -1
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.d.ts +36 -10
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +36 -10
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +1 -1
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +7 -4
- package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +2 -2
- package/dist/swaps/trusted/ln/LnForGasSwap.js +2 -2
- package/dist/swaps/trusted/ln/LnForGasWrapper.d.ts +1 -1
- package/dist/swaps/trusted/ln/LnForGasWrapper.js +1 -1
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.d.ts +2 -2
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +2 -2
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.d.ts +1 -1
- package/dist/swaps/trusted/onchain/OnchainForGasWrapper.js +1 -1
- package/dist/types/CustomPriceFunction.d.ts +1 -1
- package/dist/types/PriceInfoType.d.ts +4 -4
- package/dist/types/PriceInfoType.js +3 -3
- package/dist/types/SwapExecutionAction.d.ts +17 -6
- package/dist/types/SwapWithSigner.d.ts +1 -1
- package/dist/types/fees/Fee.d.ts +1 -1
- package/dist/types/fees/FeeBreakdown.d.ts +1 -1
- package/dist/types/fees/PercentagePPM.d.ts +2 -2
- package/dist/types/fees/PercentagePPM.js +1 -1
- package/dist/types/lnurl/LNURLPay.d.ts +6 -6
- package/dist/types/lnurl/LNURLPay.js +2 -2
- package/dist/types/lnurl/LNURLWithdraw.d.ts +5 -5
- package/dist/types/lnurl/LNURLWithdraw.js +2 -2
- package/dist/types/wallets/LightningInvoiceCreateService.d.ts +4 -0
- package/dist/types/wallets/MinimalLightningNetworkWalletInterface.d.ts +1 -1
- package/dist/utils/SwapUtils.d.ts +2 -0
- package/dist/utils/SwapUtils.js +2 -0
- package/package.json +1 -1
- package/src/bitcoin/coinselect2/utils.ts +6 -0
- package/src/bitcoin/wallet/SingleAddressBitcoinWallet.ts +7 -0
- package/src/enums/FeeType.ts +1 -1
- package/src/index.ts +6 -0
- package/src/intermediaries/Intermediary.ts +4 -4
- package/src/intermediaries/IntermediaryDiscovery.ts +9 -7
- package/src/prices/RedundantSwapPrice.ts +2 -2
- package/src/prices/SingleSwapPrice.ts +1 -1
- package/src/prices/SwapPriceWithChain.ts +6 -7
- package/src/prices/abstract/IPriceProvider.ts +4 -4
- package/src/prices/abstract/ISwapPrice.ts +1 -1
- package/src/prices/providers/BinancePriceProvider.ts +1 -1
- package/src/prices/providers/CoinGeckoPriceProvider.ts +1 -1
- package/src/prices/providers/CoinPaprikaPriceProvider.ts +1 -1
- package/src/prices/providers/CustomPriceProvider.ts +1 -1
- package/src/prices/providers/KrakenPriceProvider.ts +1 -1
- package/src/prices/providers/OKXPriceProvider.ts +1 -1
- package/src/swapper/Swapper.ts +88 -13
- package/src/swapper/SwapperFactory.ts +29 -3
- package/src/swaps/IAddressSwap.ts +2 -2
- package/src/swaps/IBTCWalletSwap.ts +2 -2
- package/src/swaps/IClaimableSwap.ts +3 -3
- package/src/swaps/IClaimableSwapWrapper.ts +1 -1
- package/src/swaps/IRefundableSwap.ts +2 -2
- package/src/swaps/ISwap.ts +3 -3
- package/src/swaps/ISwapWithGasDrop.ts +2 -2
- package/src/swaps/ISwapWrapper.ts +4 -4
- package/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts +4 -2
- package/src/swaps/escrow_swaps/IEscrowSwap.ts +1 -1
- package/src/swaps/escrow_swaps/IEscrowSwapWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/frombtc/IFromBTCLNWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.ts +9 -5
- package/src/swaps/escrow_swaps/frombtc/IFromBTCWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +6 -5
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +4 -3
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +18 -7
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +3 -7
- package/src/swaps/escrow_swaps/tobtc/IToBTCWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts +1 -1
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +1 -1
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.ts +1 -1
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +1 -1
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +36 -10
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +7 -4
- package/src/swaps/trusted/ln/LnForGasSwap.ts +2 -2
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +1 -1
- package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +2 -2
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +1 -1
- package/src/types/CustomPriceFunction.ts +1 -1
- package/src/types/PriceInfoType.ts +4 -4
- package/src/types/SwapExecutionAction.ts +19 -6
- package/src/types/SwapWithSigner.ts +1 -1
- package/src/types/fees/Fee.ts +1 -1
- package/src/types/fees/FeeBreakdown.ts +1 -1
- package/src/types/fees/PercentagePPM.ts +2 -2
- package/src/types/lnurl/LNURLPay.ts +6 -6
- package/src/types/lnurl/LNURLWithdraw.ts +5 -5
- package/src/types/wallets/LightningInvoiceCreateService.ts +4 -0
- package/src/types/wallets/MinimalLightningNetworkWalletInterface.ts +1 -1
- package/src/utils/SwapUtils.ts +2 -0
|
@@ -111,6 +111,13 @@ export class SingleAddressBitcoinWallet extends BitcoinWallet {
|
|
|
111
111
|
return this.address;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Returns the public key of the wallet
|
|
116
|
+
*/
|
|
117
|
+
getPublicKey(): string {
|
|
118
|
+
return Buffer.from(this.pubkey).toString("hex");
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
/**
|
|
115
122
|
* @inheritDoc
|
|
116
123
|
*/
|
package/src/enums/FeeType.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export {
|
|
|
3
3
|
BitcoinRpc,
|
|
4
4
|
BitcoinRpcWithAddressIndex,
|
|
5
5
|
BitcoinNetwork,
|
|
6
|
+
BtcHeader,
|
|
7
|
+
BtcStoredHeader,
|
|
6
8
|
BtcRelay,
|
|
7
9
|
ChainData,
|
|
8
10
|
ChainInterface,
|
|
@@ -30,6 +32,10 @@ export {
|
|
|
30
32
|
MempoolApiError
|
|
31
33
|
} from "@atomiqlabs/btc-mempool";
|
|
32
34
|
|
|
35
|
+
export {
|
|
36
|
+
NostrMessenger
|
|
37
|
+
} from "@atomiqlabs/messenger-nostr";
|
|
38
|
+
|
|
33
39
|
export * from "./bitcoin/wallet/BitcoinWallet";
|
|
34
40
|
export * from "./bitcoin/wallet/IBitcoinWallet";
|
|
35
41
|
export * from "./bitcoin/wallet/SingleAddressBitcoinWallet";
|
|
@@ -7,7 +7,7 @@ import {tryWithRetries} from "../utils/RetryUtils";
|
|
|
7
7
|
/**
|
|
8
8
|
* Services offered by an intermediary
|
|
9
9
|
*
|
|
10
|
-
* @category
|
|
10
|
+
* @category LPs
|
|
11
11
|
*/
|
|
12
12
|
export type ServicesType = {
|
|
13
13
|
[key in SwapType]?: SwapHandlerInfoType
|
|
@@ -16,7 +16,7 @@ export type ServicesType = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Reputation data for an intermediary on a single chain
|
|
18
18
|
*
|
|
19
|
-
* @category
|
|
19
|
+
* @category LPs
|
|
20
20
|
*/
|
|
21
21
|
export type SingleChainReputationType = {
|
|
22
22
|
[token: string]: {
|
|
@@ -34,7 +34,7 @@ export type SingleChainReputationType = {
|
|
|
34
34
|
/**
|
|
35
35
|
* Smart chain liquidity data
|
|
36
36
|
*
|
|
37
|
-
* @category
|
|
37
|
+
* @category LPs
|
|
38
38
|
*/
|
|
39
39
|
export type SCLiquidity = {
|
|
40
40
|
[token: string]: bigint
|
|
@@ -43,7 +43,7 @@ export type SCLiquidity = {
|
|
|
43
43
|
/**
|
|
44
44
|
* Represents an intermediary (liquidity provider)
|
|
45
45
|
*
|
|
46
|
-
* @category
|
|
46
|
+
* @category LPs
|
|
47
47
|
*/
|
|
48
48
|
export class Intermediary {
|
|
49
49
|
|
|
@@ -12,7 +12,7 @@ import {tryWithRetries} from "../utils/RetryUtils";
|
|
|
12
12
|
/**
|
|
13
13
|
* Swap handler type mapping for intermediary communication
|
|
14
14
|
*
|
|
15
|
-
* @category
|
|
15
|
+
* @category LPs
|
|
16
16
|
*/
|
|
17
17
|
export enum SwapHandlerType {
|
|
18
18
|
TO_BTC = "TO_BTC",
|
|
@@ -28,7 +28,7 @@ export enum SwapHandlerType {
|
|
|
28
28
|
/**
|
|
29
29
|
* Swap handler information type
|
|
30
30
|
*
|
|
31
|
-
* @category
|
|
31
|
+
* @category LPs
|
|
32
32
|
*/
|
|
33
33
|
export type SwapHandlerInfoType = {
|
|
34
34
|
swapFeePPM: number,
|
|
@@ -50,7 +50,7 @@ type InfoHandlerResponseEnvelope = {
|
|
|
50
50
|
/**
|
|
51
51
|
* Token bounds (min/max) for swaps
|
|
52
52
|
*
|
|
53
|
-
* @category
|
|
53
|
+
* @category LPs
|
|
54
54
|
*/
|
|
55
55
|
export type TokenBounds = {
|
|
56
56
|
[token: string]: {
|
|
@@ -62,7 +62,7 @@ export type TokenBounds = {
|
|
|
62
62
|
/**
|
|
63
63
|
* Multi-chain token bounds (min/max) for swaps
|
|
64
64
|
*
|
|
65
|
-
* @category
|
|
65
|
+
* @category LPs
|
|
66
66
|
*/
|
|
67
67
|
export type MultichainTokenBounds = {
|
|
68
68
|
[chainId: string]: TokenBounds
|
|
@@ -71,7 +71,7 @@ export type MultichainTokenBounds = {
|
|
|
71
71
|
/**
|
|
72
72
|
* Swap bounds by swap protocol type
|
|
73
73
|
*
|
|
74
|
-
* @category
|
|
74
|
+
* @category LPs
|
|
75
75
|
*/
|
|
76
76
|
export type SwapBounds = {
|
|
77
77
|
[key in SwapType]?: TokenBounds
|
|
@@ -80,7 +80,7 @@ export type SwapBounds = {
|
|
|
80
80
|
/**
|
|
81
81
|
* Multi-chain swap bounds
|
|
82
82
|
*
|
|
83
|
-
* @category
|
|
83
|
+
* @category LPs
|
|
84
84
|
*/
|
|
85
85
|
export type MultichainSwapBounds = {
|
|
86
86
|
[key in SwapType]?: MultichainTokenBounds
|
|
@@ -110,6 +110,8 @@ function swapHandlerTypeToSwapType(swapHandlerType: SwapHandlerType): SwapType {
|
|
|
110
110
|
return SwapType.SPV_VAULT_FROM_BTC;
|
|
111
111
|
case SwapHandlerType.FROM_BTCLN_AUTO:
|
|
112
112
|
return SwapType.FROM_BTCLN_AUTO;
|
|
113
|
+
default:
|
|
114
|
+
return SwapType.TRUSTED_FROM_BTCLN;
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -155,7 +157,7 @@ const DEFAULT_CHAIN = "SOLANA";
|
|
|
155
157
|
/**
|
|
156
158
|
* Discovery service for available intermediaries (liquidity providers)
|
|
157
159
|
*
|
|
158
|
-
* @category
|
|
160
|
+
* @category LPs
|
|
159
161
|
*/
|
|
160
162
|
export class IntermediaryDiscovery extends EventEmitter {
|
|
161
163
|
|
|
@@ -14,7 +14,7 @@ import {tryWithRetries} from "../utils/RetryUtils";
|
|
|
14
14
|
/**
|
|
15
15
|
* Asset configuration for redundant swap pricing
|
|
16
16
|
*
|
|
17
|
-
* @category Pricing
|
|
17
|
+
* @category Pricing
|
|
18
18
|
*/
|
|
19
19
|
export type RedundantSwapPriceAssets<T extends MultiChain> = {
|
|
20
20
|
binancePair?: string,
|
|
@@ -51,7 +51,7 @@ const logger = getLogger("RedundantSwapPrice: ");
|
|
|
51
51
|
* Swap price API using multiple price sources, handles errors on the APIs and automatically switches between them, such
|
|
52
52
|
* that there always is a functional API
|
|
53
53
|
*
|
|
54
|
-
* @category Pricing
|
|
54
|
+
* @category Pricing
|
|
55
55
|
*/
|
|
56
56
|
export class RedundantSwapPrice<T extends MultiChain> extends ICachedSwapPrice<T> {
|
|
57
57
|
|
|
@@ -7,7 +7,7 @@ import {PriceInfoType} from "../types/PriceInfoType";
|
|
|
7
7
|
/**
|
|
8
8
|
* Chain-specific wrapper for swap pricing
|
|
9
9
|
*
|
|
10
|
-
* @category Pricing
|
|
10
|
+
* @category Pricing
|
|
11
11
|
*/
|
|
12
12
|
export class SwapPriceWithChain<T extends MultiChain, ChainIdentifier extends ChainIds<T>> {
|
|
13
13
|
|
|
@@ -29,7 +29,7 @@ export class SwapPriceWithChain<T extends MultiChain, ChainIdentifier extends Ch
|
|
|
29
29
|
* @param feePPM PPM fee rate as reported by the intermediary
|
|
30
30
|
* @param paidToken Amount of token to be paid to the swap
|
|
31
31
|
* @param tokenAddress Token address to be paid
|
|
32
|
-
* @param abortSignal
|
|
32
|
+
* @param abortSignal Abort signal
|
|
33
33
|
* @param preFetchedPrice An optional price pre-fetched with {@link preFetchPrice}
|
|
34
34
|
*/
|
|
35
35
|
public async isValidAmountSend(
|
|
@@ -54,7 +54,7 @@ export class SwapPriceWithChain<T extends MultiChain, ChainIdentifier extends Ch
|
|
|
54
54
|
* @param feePPM PPM fee rate as reported by the intermediary
|
|
55
55
|
* @param receiveToken Amount of token to be received from the swap
|
|
56
56
|
* @param tokenAddress Token address to be received
|
|
57
|
-
* @param abortSignal
|
|
57
|
+
* @param abortSignal Abort signal
|
|
58
58
|
* @param preFetchedPrice An optional price pre-fetched with {@link preFetchPrice}
|
|
59
59
|
*/
|
|
60
60
|
public async isValidAmountReceive(
|
|
@@ -75,12 +75,11 @@ export class SwapPriceWithChain<T extends MultiChain, ChainIdentifier extends Ch
|
|
|
75
75
|
* Pre-fetches the pricing data for a given token, such that further calls to {@link isValidAmountReceive} or
|
|
76
76
|
* {@link isValidAmountSend} are quicker and don't need to wait for the price fetch
|
|
77
77
|
*
|
|
78
|
-
* @param chainIdentifier Chain identifier of the smart chain
|
|
79
78
|
* @param tokenAddress Token address
|
|
80
|
-
* @param abortSignal
|
|
79
|
+
* @param abortSignal Abort signal
|
|
81
80
|
*/
|
|
82
|
-
public preFetchPrice(
|
|
83
|
-
return this.swapPrice.preFetchPrice<ChainIdentifier>(this.chainIdentifier,
|
|
81
|
+
public preFetchPrice(tokenAddress: string, abortSignal?: AbortSignal): Promise<bigint> {
|
|
82
|
+
return this.swapPrice.preFetchPrice<ChainIdentifier>(this.chainIdentifier, tokenAddress, abortSignal);
|
|
84
83
|
}
|
|
85
84
|
|
|
86
85
|
/**
|
|
@@ -2,7 +2,7 @@ import {ChainIds, MultiChain} from "../../swapper/Swapper";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Coin type definition for price providers
|
|
5
|
-
* @category Pricing
|
|
5
|
+
* @category Pricing
|
|
6
6
|
*/
|
|
7
7
|
export type CoinType = {
|
|
8
8
|
coinId: string;
|
|
@@ -11,7 +11,7 @@ export type CoinType = {
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Constructor coin types for price providers
|
|
14
|
-
* @category Pricing
|
|
14
|
+
* @category Pricing
|
|
15
15
|
*/
|
|
16
16
|
export type CtorCoinTypes<T extends MultiChain> = {
|
|
17
17
|
coinId?: string,
|
|
@@ -25,7 +25,7 @@ export type CtorCoinTypes<T extends MultiChain> = {
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Coin types mapping by chain
|
|
28
|
-
* @category Pricing
|
|
28
|
+
* @category Pricing
|
|
29
29
|
*/
|
|
30
30
|
export type CoinTypes<T extends MultiChain> = {
|
|
31
31
|
[chainId in keyof T]?: {
|
|
@@ -35,7 +35,7 @@ export type CoinTypes<T extends MultiChain> = {
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Abstract base class for price provider implementations
|
|
38
|
-
* @category Pricing
|
|
38
|
+
* @category Pricing
|
|
39
39
|
*/
|
|
40
40
|
export abstract class IPriceProvider<T extends MultiChain> {
|
|
41
41
|
|
|
@@ -13,7 +13,7 @@ export type CoinPaprikaResponse<Currency extends string> = {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Price provider using CoinPaprika API
|
|
16
|
-
* @category Pricing
|
|
16
|
+
* @category Pricing
|
|
17
17
|
*/
|
|
18
18
|
export class CoinPaprikaPriceProvider<T extends MultiChain> extends HttpPriceProvider<T> {
|
|
19
19
|
|
|
@@ -5,7 +5,7 @@ import {CustomPriceFunction} from "../../types/CustomPriceFunction";
|
|
|
5
5
|
/**
|
|
6
6
|
* Price provider using custom pricing function
|
|
7
7
|
*
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
export class CustomPriceProvider<T extends MultiChain> extends IPriceProvider<T> {
|
|
11
11
|
|
package/src/swapper/Swapper.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {ISwapPrice} from "../prices/abstract/ISwapPrice";
|
|
2
2
|
import {
|
|
3
|
-
BitcoinNetwork,
|
|
3
|
+
BitcoinNetwork, BitcoinRpc, BitcoinRpcWithAddressIndex, BtcBlock,
|
|
4
4
|
BtcRelay,
|
|
5
5
|
ChainData,
|
|
6
6
|
ChainSwapType,
|
|
7
|
-
ChainType,
|
|
7
|
+
ChainType, LightningNetworkApi,
|
|
8
8
|
Messenger,
|
|
9
9
|
RelaySynchronizer
|
|
10
10
|
} from "@atomiqlabs/base";
|
|
@@ -62,7 +62,6 @@ import {isLNURLWithdraw, LNURLWithdraw} from "../types/lnurl/LNURLWithdraw";
|
|
|
62
62
|
import {isLNURLPay, LNURLPay} from "../types/lnurl/LNURLPay";
|
|
63
63
|
import {tryWithRetries} from "../utils/RetryUtils";
|
|
64
64
|
import {NotNever} from "../utils/TypeUtils";
|
|
65
|
-
import {MempoolApi, MempoolBitcoinBlock, MempoolBitcoinRpc, MempoolBtcRelaySynchronizer} from "@atomiqlabs/btc-mempool";
|
|
66
65
|
import {IEscrowSwap} from "../swaps/escrow_swaps/IEscrowSwap";
|
|
67
66
|
import {LightningInvoiceCreateService, isLightningInvoiceCreateService} from "../types/wallets/LightningInvoiceCreateService";
|
|
68
67
|
|
|
@@ -71,25 +70,96 @@ import {LightningInvoiceCreateService, isLightningInvoiceCreateService} from "..
|
|
|
71
70
|
* @category Core
|
|
72
71
|
*/
|
|
73
72
|
export type SwapperOptions = {
|
|
73
|
+
/**
|
|
74
|
+
* Manual override for the intermediary (LP) URLs for the SDK to use, by default these are fetched automatically
|
|
75
|
+
* from the registry
|
|
76
|
+
*/
|
|
74
77
|
intermediaryUrl?: string | string[],
|
|
78
|
+
/**
|
|
79
|
+
* Registry URL for where to look for active intermediary (LP) endpoint URLs
|
|
80
|
+
*/
|
|
75
81
|
registryUrl?: string,
|
|
76
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Bitcoin network to use for the swaps,
|
|
85
|
+
*/
|
|
77
86
|
bitcoinNetwork?: BitcoinNetwork,
|
|
78
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Timeout (in milliseconds) for HTTP GET requests done by the SDK
|
|
90
|
+
*/
|
|
79
91
|
getRequestTimeout?: number,
|
|
92
|
+
/**
|
|
93
|
+
* Timeout (in milliseconds) for HTTP POST requests done by the SDK
|
|
94
|
+
*/
|
|
80
95
|
postRequestTimeout?: number,
|
|
96
|
+
/**
|
|
97
|
+
* Additional parameters to be sent to the intermediaries (LPs), when requesting quotes from them
|
|
98
|
+
*/
|
|
81
99
|
defaultAdditionalParameters?: {[key: string]: any},
|
|
82
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Optional name prefix to use when creating a swap storage, you can use this to create separate storage
|
|
102
|
+
* instances that don't overlap.
|
|
103
|
+
*/
|
|
104
|
+
storagePrefix?: string,
|
|
105
|
+
/**
|
|
106
|
+
* Sets the default intermediary (LP) to use for the trusted gas swaps, if not set the SDK uses a default one
|
|
107
|
+
*/
|
|
83
108
|
defaultTrustedIntermediaryUrl?: string,
|
|
84
109
|
|
|
85
|
-
|
|
110
|
+
/**
|
|
111
|
+
* A function callback to retrieve a specific named storage container for swap persistency. If not present, the
|
|
112
|
+
* default IndexedDB storage adapter is used. When you use the SDK in non-browser based environments you need to
|
|
113
|
+
* provide this callback such that the SDK is able to use a custom storage adapter.
|
|
114
|
+
*
|
|
115
|
+
* @param storageName Name of the container to retrieve
|
|
116
|
+
*/
|
|
117
|
+
swapStorage?: (storageName: string) => IUnifiedStorage<UnifiedSwapStorageIndexes, UnifiedSwapStorageCompositeIndexes>,
|
|
86
118
|
|
|
119
|
+
/**
|
|
120
|
+
* By setting this flag, the swapper doesn't schedule automatic tick timers. To make sure the swap states are
|
|
121
|
+
* properly updated (e.g. the expired swaps properly move to the expired state), you should call the
|
|
122
|
+
* {@link Swapper._syncSwaps} function periodically. This flag should be set when you run an environment that
|
|
123
|
+
* doesn't support long-running timers - e.g. serverless environments like Azure Function Apps or AWS Lambda
|
|
124
|
+
*/
|
|
87
125
|
noTimers?: boolean,
|
|
126
|
+
/**
|
|
127
|
+
* By setting this flag, the swapper doesn't subscribe to on-chain events. To make sure the swap states are
|
|
128
|
+
* properly updated you should call the {@link Swapper._syncSwaps} function periodically. This flag should be
|
|
129
|
+
* set when you run an environment that doesn't support long-running timers and websocket connections - e.g.
|
|
130
|
+
* serverless environments like Azure Function Apps or AWS Lambda
|
|
131
|
+
*/
|
|
88
132
|
noEvents?: boolean,
|
|
133
|
+
/**
|
|
134
|
+
* By setting this flag, the swap objects will not be cached in the SDK and instead will always be loaded from
|
|
135
|
+
* the persistent storage. By default, the SDK uses a `WeakRef` mapping of swaps, to ensure that when the same
|
|
136
|
+
* swap is loaded concurrently, it returns the same object reference to both, making the changes on the object
|
|
137
|
+
* atomic. This flag should be set to `true` when running in an environment where multiple instances of the SDK
|
|
138
|
+
* access the same swap database - e.g. serverless environments like Azure Function Apps or AWS Lambda
|
|
139
|
+
*/
|
|
89
140
|
noSwapCache?: boolean,
|
|
141
|
+
/**
|
|
142
|
+
* Skip checking past swaps when the swapper is initiated with {@link Swapper.init}, you can call the
|
|
143
|
+
* {@link Swapper._syncSwaps} function later, to check the swaps. By default, the SDK checks the state
|
|
144
|
+
* of all the known swaps during init.
|
|
145
|
+
*/
|
|
90
146
|
dontCheckPastSwaps?: boolean,
|
|
147
|
+
/**
|
|
148
|
+
* Skip fetching the LPs when the swapper is initiated with {@link Swapper.init}, this means the list of available
|
|
149
|
+
* tokens and swap limits won't be available immediately. LPs will be fetched automatically later, when a swap
|
|
150
|
+
* is requested
|
|
151
|
+
*/
|
|
91
152
|
dontFetchLPs?: boolean,
|
|
92
|
-
|
|
153
|
+
/**
|
|
154
|
+
* By setting this flag the SDK persists all created swaps. By default, the SDK only saves and persists swaps that
|
|
155
|
+
* are considered initiated, i.e. when `commit()`, `execute()` or `waitTillPayment` is called (or their respective
|
|
156
|
+
* txs... prefixed variations).
|
|
157
|
+
*/
|
|
158
|
+
saveUninitializedSwaps?: boolean,
|
|
159
|
+
/**
|
|
160
|
+
* Automatically checks system time on initialize, if the system time drifts too far from the actual time
|
|
161
|
+
* (as checked from multiple server sources) it adjusts the `Date.now()` function to return proper actual time.
|
|
162
|
+
*/
|
|
93
163
|
automaticClockDriftCorrection?: boolean
|
|
94
164
|
};
|
|
95
165
|
|
|
@@ -116,8 +186,8 @@ type ChainSpecificData<T extends ChainType> = {
|
|
|
116
186
|
swapContract: T["Contract"],
|
|
117
187
|
spvVaultContract: T["SpvVaultContract"],
|
|
118
188
|
chainInterface: T["ChainInterface"],
|
|
119
|
-
btcRelay: BtcRelay<any, T["TX"],
|
|
120
|
-
synchronizer: RelaySynchronizer<any, T["TX"],
|
|
189
|
+
btcRelay: BtcRelay<any, T["TX"], BtcBlock, T["Signer"]>,
|
|
190
|
+
synchronizer: RelaySynchronizer<any, T["TX"], BtcBlock>,
|
|
121
191
|
unifiedChainEvents: UnifiedSwapEventListener<T>,
|
|
122
192
|
unifiedSwapStorage: UnifiedSwapStorage<T>,
|
|
123
193
|
reviver: (val: any) => ISwap<T>
|
|
@@ -182,7 +252,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
|
|
|
182
252
|
* Bitcoin RPC for fetching bitcoin chain data
|
|
183
253
|
* @internal
|
|
184
254
|
*/
|
|
185
|
-
readonly _bitcoinRpc:
|
|
255
|
+
readonly _bitcoinRpc: BitcoinRpcWithAddressIndex<any>;
|
|
186
256
|
/**
|
|
187
257
|
* Bitcoin network specification
|
|
188
258
|
* @internal
|
|
@@ -220,8 +290,13 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
|
|
|
220
290
|
*/
|
|
221
291
|
readonly Utils: SwapperUtils<T>;
|
|
222
292
|
|
|
293
|
+
/**
|
|
294
|
+
* @internal
|
|
295
|
+
*/
|
|
223
296
|
constructor(
|
|
224
|
-
bitcoinRpc:
|
|
297
|
+
bitcoinRpc: BitcoinRpcWithAddressIndex<any>,
|
|
298
|
+
lightningApi: LightningNetworkApi,
|
|
299
|
+
bitcoinSynchronizer: (btcRelay: BtcRelay<any, any, any>) => RelaySynchronizer<any, any, any>,
|
|
225
300
|
chainsData: CtorMultiChainData<T>,
|
|
226
301
|
pricing: ISwapPrice<T>,
|
|
227
302
|
tokens: WrapperCtorTokens<T>,
|
|
@@ -279,7 +354,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
|
|
|
279
354
|
swapContract, chainEvents, btcRelay,
|
|
280
355
|
chainInterface, spvVaultContract, spvVaultWithdrawalDataConstructor
|
|
281
356
|
} = chainData;
|
|
282
|
-
const synchronizer =
|
|
357
|
+
const synchronizer = bitcoinSynchronizer(btcRelay);
|
|
283
358
|
|
|
284
359
|
const storageHandler = swapStorage(storagePrefix + chainData.chainId);
|
|
285
360
|
const unifiedSwapStorage = new UnifiedSwapStorage<T[InputKey]>(storageHandler, this.options.noSwapCache);
|
|
@@ -326,7 +401,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
|
|
|
326
401
|
pricing,
|
|
327
402
|
tokens,
|
|
328
403
|
chainData.swapDataConstructor,
|
|
329
|
-
|
|
404
|
+
lightningApi,
|
|
330
405
|
{
|
|
331
406
|
getRequestTimeout: this.options.getRequestTimeout,
|
|
332
407
|
postRequestTimeout: this.options.postRequestTimeout,
|
|
@@ -409,7 +484,7 @@ export class Swapper<T extends MultiChain> extends EventEmitter<{
|
|
|
409
484
|
pricing,
|
|
410
485
|
tokens,
|
|
411
486
|
chainData.swapDataConstructor,
|
|
412
|
-
|
|
487
|
+
lightningApi,
|
|
413
488
|
this.messenger,
|
|
414
489
|
{
|
|
415
490
|
getRequestTimeout: this.options.getRequestTimeout,
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
BitcoinNetwork,
|
|
4
4
|
ChainType,
|
|
5
5
|
StorageObject,
|
|
6
|
-
IStorageManager, Messenger, ChainInitializer
|
|
6
|
+
IStorageManager, Messenger, ChainInitializer, BtcRelay
|
|
7
7
|
} from "@atomiqlabs/base";
|
|
8
8
|
import {SmartChainAssets, SmartChainAssetTickers} from "../SmartChainAssets";
|
|
9
9
|
import {NostrMessenger} from "@atomiqlabs/messenger-nostr";
|
|
@@ -16,7 +16,7 @@ import {RedundantSwapPrice, RedundantSwapPriceAssets} from "../prices/RedundantS
|
|
|
16
16
|
import {LocalStorageManager} from "../storage-browser/LocalStorageManager";
|
|
17
17
|
import {SingleSwapPrice} from "../prices/SingleSwapPrice";
|
|
18
18
|
import {CustomPriceFunction} from "../types/CustomPriceFunction";
|
|
19
|
-
import {MempoolApi, MempoolBitcoinRpc} from "@atomiqlabs/btc-mempool";
|
|
19
|
+
import {MempoolApi, MempoolBitcoinRpc, MempoolBtcRelaySynchronizer} from "@atomiqlabs/btc-mempool";
|
|
20
20
|
|
|
21
21
|
//Helper types
|
|
22
22
|
/**
|
|
@@ -63,11 +63,35 @@ type GetAllOptions<T extends readonly ChainInitializer<any, any, any>[]> =
|
|
|
63
63
|
* @category Core
|
|
64
64
|
*/
|
|
65
65
|
export type TypedSwapperOptions<T extends readonly ChainInitializer<any, any, any>[]> = {
|
|
66
|
+
/**
|
|
67
|
+
* A dictionary with chain-specific settings, like RPC URLs and others
|
|
68
|
+
*/
|
|
66
69
|
chains: GetAllOptions<T>,
|
|
67
|
-
|
|
70
|
+
/**
|
|
71
|
+
* A function callback to retrieve a specific named storage container for key-value persistency. If not present, the
|
|
72
|
+
* default browser Local Storage adapter is used. When you use the SDK in non-browser based environments you need
|
|
73
|
+
* to provide this callback such that the SDK is able to use a custom storage adapter.
|
|
74
|
+
*
|
|
75
|
+
* @param storageName Name of the container to retrieve
|
|
76
|
+
*/
|
|
77
|
+
chainStorageCtor?: <T extends StorageObject>(storageName: string) => IStorageManager<T>,
|
|
78
|
+
/**
|
|
79
|
+
* Maximum allowed pricing difference between intermediary (LP) returned rate and current market rate. In
|
|
80
|
+
* parts-per-million, e.g. 2% is written as `20000`.
|
|
81
|
+
*/
|
|
68
82
|
pricingFeeDifferencePPM?: bigint,
|
|
83
|
+
/**
|
|
84
|
+
* Optional pricing function to use instead of default pricing APIs. See {@link CustomPriceFunction} for details.
|
|
85
|
+
*/
|
|
69
86
|
getPriceFn?: CustomPriceFunction,
|
|
87
|
+
/**
|
|
88
|
+
* Mempool API instance or URLs to use, if not provided the defaults will be used for the specified bitcoin network
|
|
89
|
+
*/
|
|
70
90
|
mempoolApi?: MempoolApi | MempoolBitcoinRpc | string | string[],
|
|
91
|
+
/**
|
|
92
|
+
* Data propagation messenger instance to use for broadcasting data to watchtowers. By default, a Nostr-based
|
|
93
|
+
* messenger is used.
|
|
94
|
+
*/
|
|
71
95
|
messenger?: Messenger,
|
|
72
96
|
} & SwapperOptions;
|
|
73
97
|
|
|
@@ -252,6 +276,8 @@ export class SwapperFactory<T extends readonly ChainInitializer<any, ChainType,
|
|
|
252
276
|
|
|
253
277
|
return new Swapper<ToMultichain<T>>(
|
|
254
278
|
bitcoinRpc,
|
|
279
|
+
bitcoinRpc,
|
|
280
|
+
(btcRelay: BtcRelay<any, any, any>) => new MempoolBtcRelaySynchronizer(btcRelay, bitcoinRpc),
|
|
255
281
|
chains as any,
|
|
256
282
|
swapPricing,
|
|
257
283
|
pricingAssets,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type guard to check if an object is an {@link IAddressSwap}
|
|
3
3
|
*
|
|
4
|
-
* @category Swaps
|
|
4
|
+
* @category Swaps/Types
|
|
5
5
|
*/
|
|
6
6
|
export function isIAddressSwap(obj: any): obj is IAddressSwap {
|
|
7
7
|
return obj!=null &&
|
|
@@ -12,7 +12,7 @@ export function isIAddressSwap(obj: any): obj is IAddressSwap {
|
|
|
12
12
|
/**
|
|
13
13
|
* Interface for swaps which require a user to send funds to a specific address
|
|
14
14
|
*
|
|
15
|
-
* @category Swaps
|
|
15
|
+
* @category Swaps/Types
|
|
16
16
|
*/
|
|
17
17
|
export interface IAddressSwap {
|
|
18
18
|
|
|
@@ -10,7 +10,7 @@ import {BtcToken} from "../types/Token";
|
|
|
10
10
|
/**
|
|
11
11
|
* Type guard to check if an object is an {@link IBTCWalletSwap}
|
|
12
12
|
*
|
|
13
|
-
* @category Swaps
|
|
13
|
+
* @category Swaps/Types
|
|
14
14
|
*/
|
|
15
15
|
export function isIBTCWalletSwap(obj: any): obj is IBTCWalletSwap {
|
|
16
16
|
return obj!=null &&
|
|
@@ -25,7 +25,7 @@ export function isIBTCWalletSwap(obj: any): obj is IBTCWalletSwap {
|
|
|
25
25
|
/**
|
|
26
26
|
* Interface for swaps requiring Bitcoin wallet interaction
|
|
27
27
|
*
|
|
28
|
-
* @category Swaps
|
|
28
|
+
* @category Swaps/Types
|
|
29
29
|
*/
|
|
30
30
|
export interface IBTCWalletSwap {
|
|
31
31
|
|
|
@@ -5,7 +5,7 @@ import {ISwapWrapper, SwapTypeDefinition} from "./ISwapWrapper";
|
|
|
5
5
|
/**
|
|
6
6
|
* Type guard to check if an object is an {@link IClaimableSwap}
|
|
7
7
|
*
|
|
8
|
-
* @category Swaps
|
|
8
|
+
* @category Swaps/Types
|
|
9
9
|
*/
|
|
10
10
|
export function isIClaimableSwap(obj: any): obj is IClaimableSwap {
|
|
11
11
|
return obj!=null &&
|
|
@@ -18,7 +18,7 @@ export function isIClaimableSwap(obj: any): obj is IClaimableSwap {
|
|
|
18
18
|
* Interface for swaps that can end up in a claimable state, requiring the user to claim the
|
|
19
19
|
* assets on the destination chain.
|
|
20
20
|
*
|
|
21
|
-
* @category Swaps
|
|
21
|
+
* @category Swaps/Types
|
|
22
22
|
*/
|
|
23
23
|
export interface IClaimableSwap<
|
|
24
24
|
T extends ChainType = ChainType,
|
|
@@ -37,7 +37,7 @@ export interface IClaimableSwap<
|
|
|
37
37
|
* function to wait till the claim transaction is observed, processed by the SDK and state of the swap
|
|
38
38
|
* properly updated.
|
|
39
39
|
*
|
|
40
|
-
* @param _signer Address of the signer to create the
|
|
40
|
+
* @param _signer Address of the signer to create the settlement (claim) transactions for
|
|
41
41
|
*/
|
|
42
42
|
txsClaim(_signer?: string | T["Signer"] | T["NativeSigner"]): Promise<T["TX"][]>;
|
|
43
43
|
|
|
@@ -5,7 +5,7 @@ import {IClaimableSwap} from "./IClaimableSwap";
|
|
|
5
5
|
* Interface for a swap wrapper for swaps that can end up in a claimable state, requiring the user to claim the
|
|
6
6
|
* assets on the destination chain.
|
|
7
7
|
*
|
|
8
|
-
* @category Swaps
|
|
8
|
+
* @category Swaps/Abstract
|
|
9
9
|
*/
|
|
10
10
|
export interface IClaimableSwapWrapper<T extends ISwap & IClaimableSwap = ISwap & IClaimableSwap> {
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@ import {ISwapWrapper, SwapTypeDefinition} from "./ISwapWrapper";
|
|
|
5
5
|
/**
|
|
6
6
|
* Type guard to check if an object is an {@link IRefundableSwap}
|
|
7
7
|
*
|
|
8
|
-
* @category Swaps
|
|
8
|
+
* @category Swaps/Types
|
|
9
9
|
*/
|
|
10
10
|
export function isIRefundableSwap(obj: any): obj is IRefundableSwap {
|
|
11
11
|
return typeof(obj.isRefundable) === "function" &&
|
|
@@ -16,7 +16,7 @@ export function isIRefundableSwap(obj: any): obj is IRefundableSwap {
|
|
|
16
16
|
/**
|
|
17
17
|
* Interface for swaps that can be refunded in case of failure
|
|
18
18
|
*
|
|
19
|
-
* @category Swaps
|
|
19
|
+
* @category Swaps/Types
|
|
20
20
|
*/
|
|
21
21
|
export interface IRefundableSwap<
|
|
22
22
|
T extends ChainType = ChainType,
|