@atomiqlabs/sdk 8.1.8 → 8.3.1
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/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 +7 -0
- package/dist/enums/FeeType.js +7 -0
- 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 +4 -5
- package/dist/index.js +3 -4
- package/dist/intermediaries/Intermediary.d.ts +57 -10
- package/dist/intermediaries/Intermediary.js +37 -10
- package/dist/intermediaries/IntermediaryDiscovery.d.ts +55 -22
- package/dist/intermediaries/IntermediaryDiscovery.js +35 -22
- package/dist/prices/RedundantSwapPrice.d.ts +24 -3
- package/dist/prices/RedundantSwapPrice.js +21 -1
- package/dist/prices/SingleSwapPrice.d.ts +9 -6
- package/dist/prices/SingleSwapPrice.js +10 -7
- package/dist/prices/SwapPriceWithChain.d.ts +54 -16
- package/dist/prices/SwapPriceWithChain.js +58 -20
- package/dist/prices/abstract/ISwapPrice.d.ts +94 -45
- package/dist/prices/abstract/ISwapPrice.js +103 -55
- package/dist/prices/providers/BinancePriceProvider.d.ts +7 -0
- package/dist/prices/providers/BinancePriceProvider.js +7 -0
- package/dist/prices/providers/CoinGeckoPriceProvider.d.ts +6 -0
- package/dist/prices/providers/CoinGeckoPriceProvider.js +6 -0
- package/dist/prices/providers/CoinPaprikaPriceProvider.d.ts +6 -0
- package/dist/prices/providers/CoinPaprikaPriceProvider.js +6 -0
- package/dist/prices/providers/CustomPriceProvider.d.ts +11 -0
- package/dist/prices/providers/CustomPriceProvider.js +11 -0
- package/dist/prices/providers/KrakenPriceProvider.d.ts +9 -0
- package/dist/prices/providers/KrakenPriceProvider.js +9 -0
- package/dist/prices/providers/OKXPriceProvider.d.ts +6 -0
- package/dist/prices/providers/OKXPriceProvider.js +6 -0
- 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 +302 -221
- package/dist/swapper/Swapper.js +376 -344
- package/dist/swapper/SwapperFactory.d.ts +41 -17
- package/dist/swapper/SwapperFactory.js +23 -2
- 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 +10 -1
- package/dist/swaps/IAddressSwap.js +2 -1
- package/dist/swaps/IBTCWalletSwap.d.ts +24 -6
- package/dist/swaps/IBTCWalletSwap.js +2 -1
- package/dist/swaps/IClaimableSwap.d.ts +36 -4
- package/dist/swaps/IClaimableSwap.js +2 -1
- package/dist/swaps/IClaimableSwapWrapper.d.ts +11 -1
- package/dist/swaps/IRefundableSwap.d.ts +29 -3
- package/dist/swaps/IRefundableSwap.js +2 -1
- package/dist/swaps/ISwap.d.ts +159 -21
- package/dist/swaps/ISwap.js +90 -33
- package/dist/swaps/ISwapWithGasDrop.d.ts +6 -0
- package/dist/swaps/ISwapWithGasDrop.js +1 -0
- package/dist/swaps/ISwapWrapper.d.ts +157 -48
- package/dist/swaps/ISwapWrapper.js +130 -72
- package/dist/swaps/escrow_swaps/IEscrowSelfInitSwap.d.ts +49 -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 +94 -29
- package/dist/swaps/escrow_swaps/frombtc/IFromBTCSelfInitSwap.js +90 -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 +275 -58
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.js +516 -239
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.d.ts +76 -25
- package/dist/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.js +131 -49
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.d.ts +311 -51
- package/dist/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.js +542 -193
- 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 +209 -53
- package/dist/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.js +449 -242
- 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 +197 -56
- package/dist/swaps/escrow_swaps/tobtc/IToBTCSwap.js +326 -189
- 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 +60 -19
- package/dist/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.js +74 -31
- 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 +36 -13
- package/dist/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.js +65 -19
- 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 +328 -92
- package/dist/swaps/spv_swaps/SpvFromBTCSwap.js +460 -219
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.d.ts +76 -24
- package/dist/swaps/spv_swaps/SpvFromBTCWrapper.js +244 -124
- package/dist/swaps/trusted/ln/LnForGasSwap.d.ts +146 -18
- package/dist/swaps/trusted/ln/LnForGasSwap.js +173 -43
- 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 +200 -47
- package/dist/swaps/trusted/onchain/OnchainForGasSwap.js +230 -78
- 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 +7 -1
- package/dist/types/SwapExecutionAction.d.ts +74 -4
- package/dist/types/SwapWithSigner.d.ts +4 -1
- 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 +2 -1
- package/dist/types/fees/FeeBreakdown.d.ts +2 -1
- package/dist/types/fees/PercentagePPM.d.ts +2 -0
- package/dist/types/fees/PercentagePPM.js +1 -0
- package/dist/types/lnurl/LNURLPay.d.ts +14 -6
- package/dist/types/lnurl/LNURLPay.js +6 -2
- package/dist/types/lnurl/LNURLWithdraw.d.ts +12 -5
- package/dist/types/lnurl/LNURLWithdraw.js +6 -2
- package/dist/types/wallets/LightningInvoiceCreateService.d.ts +20 -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 +3 -1
- package/dist/utils/BitcoinUtils.d.ts +1 -0
- package/dist/utils/BitcoinUtils.js +5 -1
- package/dist/utils/SwapUtils.d.ts +56 -1
- package/dist/utils/SwapUtils.js +53 -1
- package/dist/utils/TokenUtils.d.ts +10 -2
- package/dist/utils/TokenUtils.js +12 -4
- package/package.json +3 -3
- 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 +7 -0
- 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 +6 -5
- package/src/intermediaries/Intermediary.ts +57 -10
- package/src/intermediaries/IntermediaryDiscovery.ts +60 -27
- package/src/prices/RedundantSwapPrice.ts +24 -4
- package/src/prices/SingleSwapPrice.ts +10 -7
- package/src/prices/SwapPriceWithChain.ts +59 -21
- package/src/prices/abstract/ISwapPrice.ts +114 -65
- package/src/prices/providers/BinancePriceProvider.ts +7 -0
- package/src/prices/providers/CoinGeckoPriceProvider.ts +6 -0
- package/src/prices/providers/CoinPaprikaPriceProvider.ts +6 -0
- package/src/prices/providers/CustomPriceProvider.ts +11 -0
- package/src/prices/providers/KrakenPriceProvider.ts +9 -0
- package/src/prices/providers/OKXPriceProvider.ts +6 -0
- 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 +512 -378
- package/src/swapper/SwapperFactory.ts +44 -21
- 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 +11 -1
- package/src/swaps/IBTCWalletSwap.ts +24 -8
- package/src/swaps/IClaimableSwap.ts +39 -4
- package/src/swaps/IClaimableSwapWrapper.ts +11 -2
- package/src/swaps/IRefundableSwap.ts +32 -3
- package/src/swaps/ISwap.ts +221 -82
- package/src/swaps/ISwapWithGasDrop.ts +6 -0
- package/src/swaps/ISwapWrapper.ts +212 -94
- package/src/swaps/escrow_swaps/IEscrowSelfInitSwap.ts +62 -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 +120 -51
- package/src/swaps/escrow_swaps/frombtc/IFromBTCWrapper.ts +24 -11
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNSwap.ts +559 -256
- package/src/swaps/escrow_swaps/frombtc/ln/FromBTCLNWrapper.ts +155 -61
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoSwap.ts +590 -226
- package/src/swaps/escrow_swaps/frombtc/ln_auto/FromBTCLNAutoWrapper.ts +177 -74
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCSwap.ts +470 -243
- package/src/swaps/escrow_swaps/frombtc/onchain/FromBTCWrapper.ts +141 -59
- package/src/swaps/escrow_swaps/tobtc/IToBTCSwap.ts +352 -193
- package/src/swaps/escrow_swaps/tobtc/IToBTCWrapper.ts +48 -23
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNSwap.ts +86 -39
- package/src/swaps/escrow_swaps/tobtc/ln/ToBTCLNWrapper.ts +110 -110
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCSwap.ts +88 -33
- package/src/swaps/escrow_swaps/tobtc/onchain/ToBTCWrapper.ts +101 -31
- package/src/swaps/spv_swaps/SpvFromBTCSwap.ts +534 -263
- package/src/swaps/spv_swaps/SpvFromBTCWrapper.ts +289 -148
- package/src/swaps/trusted/ln/LnForGasSwap.ts +184 -45
- package/src/swaps/trusted/ln/LnForGasWrapper.ts +34 -15
- package/src/swaps/trusted/onchain/OnchainForGasSwap.ts +260 -86
- package/src/swaps/trusted/onchain/OnchainForGasWrapper.ts +41 -19
- package/src/types/AmountData.ts +2 -1
- package/src/types/CustomPriceFunction.ts +7 -1
- package/src/types/SwapExecutionAction.ts +84 -5
- package/src/types/SwapWithSigner.ts +7 -3
- package/src/types/Token.ts +12 -5
- package/src/types/TokenAmount.ts +3 -0
- package/src/types/fees/Fee.ts +2 -1
- package/src/types/fees/FeeBreakdown.ts +2 -1
- package/src/types/fees/PercentagePPM.ts +2 -0
- package/src/types/lnurl/LNURLPay.ts +14 -6
- package/src/types/lnurl/LNURLWithdraw.ts +12 -5
- package/src/types/wallets/LightningInvoiceCreateService.ts +26 -0
- package/src/types/wallets/MinimalBitcoinWalletInterface.ts +3 -1
- package/src/types/wallets/MinimalLightningNetworkWalletInterface.ts +3 -1
- package/src/utils/BitcoinUtils.ts +5 -0
- package/src/utils/SwapUtils.ts +61 -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
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An error or inconsistency in the intermediary's returned data, this will blacklist the intermediary
|
|
3
|
+
*
|
|
3
4
|
* @category Errors
|
|
4
5
|
*/
|
|
5
6
|
export declare class IntermediaryError extends Error {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the error is recoverable and intermediary (LP) shouldn't be blacklisted for it
|
|
9
|
+
*/
|
|
6
10
|
recoverable: boolean;
|
|
7
11
|
originalStack?: string;
|
|
8
12
|
constructor(msg: string, originalError?: any, recoverable?: boolean);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IntermediaryError = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* An error or inconsistency in the intermediary's returned data, this will blacklist the intermediary
|
|
6
|
+
*
|
|
6
7
|
* @category Errors
|
|
7
8
|
*/
|
|
8
9
|
class IntermediaryError extends Error {
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An error returned by the intermediary in a http response
|
|
3
|
+
*
|
|
3
4
|
* @category Errors
|
|
4
5
|
*/
|
|
5
6
|
export declare class RequestError extends Error {
|
|
6
7
|
httpCode: number;
|
|
7
8
|
constructor(msg: string, httpCode: number);
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Parses a message + a response code returned by the intermediary (LP) as an error
|
|
11
|
+
*
|
|
12
|
+
* @param msg Raw response
|
|
13
|
+
* @param httpCode HTTP response status code
|
|
14
|
+
*/
|
|
15
|
+
static parse(msg: string, httpCode: number): RequestError | OutOfBoundsError;
|
|
9
16
|
}
|
|
10
17
|
/**
|
|
11
18
|
* An error indicating out of bounds (amount too high or too low) on swap initialization
|
|
19
|
+
*
|
|
12
20
|
* @category Errors
|
|
13
21
|
*/
|
|
14
22
|
export declare class OutOfBoundsError extends RequestError {
|
|
23
|
+
/**
|
|
24
|
+
* Swap minimum in base units of the token in which the quote was requested
|
|
25
|
+
*/
|
|
15
26
|
min: bigint;
|
|
27
|
+
/**
|
|
28
|
+
* Swap maximum in base units of the token in which the quote was requested
|
|
29
|
+
*/
|
|
16
30
|
max: bigint;
|
|
17
31
|
constructor(msg: string, httpCode: number, min: bigint, max: bigint);
|
|
18
32
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OutOfBoundsError = exports.RequestError = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* An error returned by the intermediary in a http response
|
|
6
|
+
*
|
|
6
7
|
* @category Errors
|
|
7
8
|
*/
|
|
8
9
|
class RequestError extends Error {
|
|
@@ -18,6 +19,12 @@ class RequestError extends Error {
|
|
|
18
19
|
Object.setPrototypeOf(this, RequestError.prototype);
|
|
19
20
|
this.httpCode = httpCode;
|
|
20
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Parses a message + a response code returned by the intermediary (LP) as an error
|
|
24
|
+
*
|
|
25
|
+
* @param msg Raw response
|
|
26
|
+
* @param httpCode HTTP response status code
|
|
27
|
+
*/
|
|
21
28
|
static parse(msg, httpCode) {
|
|
22
29
|
try {
|
|
23
30
|
const parsed = JSON.parse(msg);
|
|
@@ -33,6 +40,7 @@ class RequestError extends Error {
|
|
|
33
40
|
exports.RequestError = RequestError;
|
|
34
41
|
/**
|
|
35
42
|
* An error indicating out of bounds (amount too high or too low) on swap initialization
|
|
43
|
+
*
|
|
36
44
|
* @category Errors
|
|
37
45
|
*/
|
|
38
46
|
class OutOfBoundsError extends RequestError {
|
package/dist/errors/UserError.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export { LightningNetworkApi, BitcoinRpc, BitcoinRpcWithAddressIndex, BitcoinNetwork, BtcRelay, ChainData, ChainInterface, ChainType, CannotInitializeATAError, SignatureVerificationError, SwapDataVerificationError, TransactionRevertedError, ChainEvents, Messenger, SpvVaultContract, SpvVaultData, SpvWithdrawalTransactionData, ExecutionData, IStorageManager, StorageObject, SwapContract, SwapData } from "@atomiqlabs/base";
|
|
1
|
+
export { LightningNetworkApi, BitcoinRpc, BitcoinRpcWithAddressIndex, BitcoinNetwork, BtcRelay, ChainData, ChainInterface, ChainType, CannotInitializeATAError, SignatureVerificationError, SwapDataVerificationError, TransactionRevertedError, ChainEvents, Messenger, SpvVaultContract, SpvVaultData, SpvWithdrawalTransactionData, ExecutionData, IStorageManager, StorageObject, SwapContract, SwapData, AbstractSigner } from "@atomiqlabs/base";
|
|
2
2
|
export { MempoolApi, MempoolBitcoinRpc, MempoolApiError } from "@atomiqlabs/btc-mempool";
|
|
3
3
|
export * from "./bitcoin/wallet/BitcoinWallet";
|
|
4
4
|
export * from "./bitcoin/wallet/IBitcoinWallet";
|
|
5
|
-
export * from "./types/wallets/MinimalBitcoinWalletInterface";
|
|
6
|
-
export * from "./types/wallets/MinimalLightningNetworkWalletInterface";
|
|
7
5
|
export * from "./bitcoin/wallet/SingleAddressBitcoinWallet";
|
|
8
6
|
export { CoinselectAddressTypes } from "./bitcoin/coinselect2";
|
|
9
7
|
export * from "./enums/FeeType";
|
|
@@ -11,7 +9,6 @@ export * from "./enums/SwapAmountType";
|
|
|
11
9
|
export * from "./enums/SwapDirection";
|
|
12
10
|
export * from "./enums/SwapType";
|
|
13
11
|
export * from "./errors/IntermediaryError";
|
|
14
|
-
export * from "./errors/PaymentAuthError";
|
|
15
12
|
export * from "./errors/RequestError";
|
|
16
13
|
export * from "./errors/UserError";
|
|
17
14
|
export { Intermediary } from "./intermediaries/Intermediary";
|
|
@@ -72,9 +69,11 @@ export * from "./types/fees/FeeBreakdown";
|
|
|
72
69
|
export * from "./types/fees/PercentagePPM";
|
|
73
70
|
export * from "./types/lnurl/LNURLPay";
|
|
74
71
|
export * from "./types/lnurl/LNURLWithdraw";
|
|
72
|
+
export * from "./types/wallets/MinimalBitcoinWalletInterface";
|
|
73
|
+
export * from "./types/wallets/MinimalLightningNetworkWalletInterface";
|
|
74
|
+
export * from "./types/wallets/LightningInvoiceCreateService";
|
|
75
75
|
export * from "./types/AmountData";
|
|
76
76
|
export * from "./types/CustomPriceFunction";
|
|
77
|
-
export * from "./types/PriceInfoType";
|
|
78
77
|
export * from "./types/SwapExecutionAction";
|
|
79
78
|
export * from "./types/SwapWithSigner";
|
|
80
79
|
export * from "./types/Token";
|
package/dist/index.js
CHANGED
|
@@ -31,15 +31,12 @@ Object.defineProperty(exports, "MempoolBitcoinRpc", { enumerable: true, get: fun
|
|
|
31
31
|
Object.defineProperty(exports, "MempoolApiError", { enumerable: true, get: function () { return btc_mempool_1.MempoolApiError; } });
|
|
32
32
|
__exportStar(require("./bitcoin/wallet/BitcoinWallet"), exports);
|
|
33
33
|
__exportStar(require("./bitcoin/wallet/IBitcoinWallet"), exports);
|
|
34
|
-
__exportStar(require("./types/wallets/MinimalBitcoinWalletInterface"), exports);
|
|
35
|
-
__exportStar(require("./types/wallets/MinimalLightningNetworkWalletInterface"), exports);
|
|
36
34
|
__exportStar(require("./bitcoin/wallet/SingleAddressBitcoinWallet"), exports);
|
|
37
35
|
__exportStar(require("./enums/FeeType"), exports);
|
|
38
36
|
__exportStar(require("./enums/SwapAmountType"), exports);
|
|
39
37
|
__exportStar(require("./enums/SwapDirection"), exports);
|
|
40
38
|
__exportStar(require("./enums/SwapType"), exports);
|
|
41
39
|
__exportStar(require("./errors/IntermediaryError"), exports);
|
|
42
|
-
__exportStar(require("./errors/PaymentAuthError"), exports);
|
|
43
40
|
__exportStar(require("./errors/RequestError"), exports);
|
|
44
41
|
__exportStar(require("./errors/UserError"), exports);
|
|
45
42
|
var Intermediary_1 = require("./intermediaries/Intermediary");
|
|
@@ -144,9 +141,11 @@ __exportStar(require("./types/fees/FeeBreakdown"), exports);
|
|
|
144
141
|
__exportStar(require("./types/fees/PercentagePPM"), exports);
|
|
145
142
|
__exportStar(require("./types/lnurl/LNURLPay"), exports);
|
|
146
143
|
__exportStar(require("./types/lnurl/LNURLWithdraw"), exports);
|
|
144
|
+
__exportStar(require("./types/wallets/MinimalBitcoinWalletInterface"), exports);
|
|
145
|
+
__exportStar(require("./types/wallets/MinimalLightningNetworkWalletInterface"), exports);
|
|
146
|
+
__exportStar(require("./types/wallets/LightningInvoiceCreateService"), exports);
|
|
147
147
|
__exportStar(require("./types/AmountData"), exports);
|
|
148
148
|
__exportStar(require("./types/CustomPriceFunction"), exports);
|
|
149
|
-
__exportStar(require("./types/PriceInfoType"), exports);
|
|
150
149
|
__exportStar(require("./types/SwapExecutionAction"), exports);
|
|
151
150
|
__exportStar(require("./types/SwapWithSigner"), exports);
|
|
152
151
|
__exportStar(require("./types/Token"), exports);
|
|
@@ -3,6 +3,7 @@ import { SwapHandlerInfoType } from "./IntermediaryDiscovery";
|
|
|
3
3
|
import { ChainSwapType, LNNodeLiquidity, SwapContract } from "@atomiqlabs/base";
|
|
4
4
|
/**
|
|
5
5
|
* Services offered by an intermediary
|
|
6
|
+
*
|
|
6
7
|
* @category Pricing and LPs
|
|
7
8
|
*/
|
|
8
9
|
export type ServicesType = {
|
|
@@ -10,6 +11,7 @@ export type ServicesType = {
|
|
|
10
11
|
};
|
|
11
12
|
/**
|
|
12
13
|
* Reputation data for an intermediary on a single chain
|
|
14
|
+
*
|
|
13
15
|
* @category Pricing and LPs
|
|
14
16
|
*/
|
|
15
17
|
export type SingleChainReputationType = {
|
|
@@ -26,21 +28,35 @@ export type SingleChainReputationType = {
|
|
|
26
28
|
};
|
|
27
29
|
/**
|
|
28
30
|
* Smart chain liquidity data
|
|
31
|
+
*
|
|
29
32
|
* @category Pricing and LPs
|
|
30
33
|
*/
|
|
31
34
|
export type SCLiquidity = {
|
|
32
35
|
[token: string]: bigint;
|
|
33
36
|
};
|
|
34
37
|
/**
|
|
35
|
-
* Represents
|
|
38
|
+
* Represents an intermediary (liquidity provider)
|
|
39
|
+
*
|
|
36
40
|
* @category Pricing and LPs
|
|
37
41
|
*/
|
|
38
42
|
export declare class Intermediary {
|
|
43
|
+
/**
|
|
44
|
+
* Base URL where the intermediary is listening for HTTP requests
|
|
45
|
+
*/
|
|
39
46
|
readonly url: string;
|
|
47
|
+
/**
|
|
48
|
+
* Addresses of the intermediary on smart chains, used for checking the provided signatures
|
|
49
|
+
*/
|
|
40
50
|
readonly addresses: {
|
|
41
51
|
[chainIdentifier: string]: string;
|
|
42
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Swap protocol services offered by the intermediary
|
|
55
|
+
*/
|
|
43
56
|
readonly services: ServicesType;
|
|
57
|
+
/**
|
|
58
|
+
* Input/output swap bounds for various swap protocols offered by the intermediary
|
|
59
|
+
*/
|
|
44
60
|
readonly swapBounds: {
|
|
45
61
|
[swapType in SwapType]?: {
|
|
46
62
|
[chainIdentifier: string]: {
|
|
@@ -57,18 +73,38 @@ export declare class Intermediary {
|
|
|
57
73
|
};
|
|
58
74
|
};
|
|
59
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Reputation of the intermediary on different smart chains, this is only fetched
|
|
78
|
+
* on-demand when creating a swap where reputation is checked
|
|
79
|
+
*/
|
|
60
80
|
reputation: {
|
|
61
81
|
[chainIdentifier: string]: SingleChainReputationType;
|
|
62
82
|
};
|
|
83
|
+
/**
|
|
84
|
+
* Liquidity of the intermediary across different smart chains, this is only fetched
|
|
85
|
+
* on-demand when creating a swap where intermediary's liquidity is checked
|
|
86
|
+
*/
|
|
63
87
|
liquidity: {
|
|
64
88
|
[chainIdentifier: string]: SCLiquidity;
|
|
65
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Data about a lightning network node used by this intermediary, if it offers lightning
|
|
92
|
+
* network swaps, this is only fetched on-demand when creating a Bitcoin Lightning -> Smart chain
|
|
93
|
+
* swap through the intermediary (which necessitates checking intermediary's channel capacities)
|
|
94
|
+
*/
|
|
66
95
|
lnData?: LNNodeLiquidity;
|
|
67
96
|
constructor(url: string, addresses: {
|
|
68
97
|
[chainIdentifier: string]: string;
|
|
69
98
|
}, services: ServicesType, reputation?: {
|
|
70
99
|
[chainIdentifier: string]: SingleChainReputationType;
|
|
71
100
|
});
|
|
101
|
+
/**
|
|
102
|
+
* Returns the input/output swap limit for given swap type, chain and token
|
|
103
|
+
*
|
|
104
|
+
* @param swapType Swap protocol service to check
|
|
105
|
+
* @param chainId Chain identifier of the smart chain to check
|
|
106
|
+
* @param tokenAddress Address of the token to check
|
|
107
|
+
*/
|
|
72
108
|
getSwapLimits(swapType: SwapType, chainId: string, tokenAddress: string): {
|
|
73
109
|
input: {
|
|
74
110
|
min?: bigint;
|
|
@@ -82,29 +118,40 @@ export declare class Intermediary {
|
|
|
82
118
|
/**
|
|
83
119
|
* Returns tokens supported by the intermediary, optionally constrained to the specific swap types
|
|
84
120
|
*
|
|
85
|
-
* @param chainIdentifier
|
|
86
|
-
* @param swapTypesArr
|
|
121
|
+
* @param chainIdentifier Chain identifier of the smart chain to check
|
|
122
|
+
* @param swapTypesArr An array of swap type services to check
|
|
87
123
|
* @private
|
|
88
124
|
*/
|
|
89
125
|
private getSupportedTokens;
|
|
90
126
|
/**
|
|
91
127
|
* Fetches, returns and saves the reputation of the intermediary, either for all or just for a single token
|
|
92
128
|
*
|
|
93
|
-
* @param chainIdentifier
|
|
94
|
-
* @param swapContract
|
|
95
|
-
* @param tokens
|
|
129
|
+
* @param chainIdentifier Chain identifier of the chain on which to fetch the reputation
|
|
130
|
+
* @param swapContract Swap contract for the requested smart chain
|
|
131
|
+
* @param tokens An optional array of tokens to fetch the data for (by default it uses all tokens supported
|
|
132
|
+
* by the intermediary)
|
|
96
133
|
* @param abortSignal
|
|
97
134
|
*/
|
|
98
135
|
getReputation(chainIdentifier: string, swapContract: SwapContract<any>, tokens?: string[], abortSignal?: AbortSignal): Promise<SingleChainReputationType>;
|
|
99
136
|
/**
|
|
100
|
-
* Fetches, returns and saves the liquidity of the
|
|
137
|
+
* Fetches, returns and saves the liquidity of the intermediary for a specific token
|
|
101
138
|
*
|
|
102
|
-
* @param chainIdentifier
|
|
103
|
-
* @param swapContract
|
|
104
|
-
* @param token
|
|
139
|
+
* @param chainIdentifier Chain identifier of the chain on which to fetch the reputation
|
|
140
|
+
* @param swapContract Swap contract for the requested smart chain
|
|
141
|
+
* @param token Token address of the token to fetch the liquidity for
|
|
105
142
|
* @param abortSignal
|
|
106
143
|
*/
|
|
107
144
|
getLiquidity(chainIdentifier: string, swapContract: SwapContract<any>, token: string, abortSignal?: AbortSignal): Promise<bigint>;
|
|
145
|
+
/**
|
|
146
|
+
* Checks whether the intermediary supports swaps of any tokens on the smart chain
|
|
147
|
+
*
|
|
148
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
149
|
+
*/
|
|
108
150
|
supportsChain(chainIdentifier: string): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Returns intermediary's address on a given smart chain
|
|
153
|
+
*
|
|
154
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
155
|
+
*/
|
|
109
156
|
getAddress(chainIdentifier: string): string;
|
|
110
157
|
}
|
|
@@ -4,12 +4,21 @@ exports.Intermediary = void 0;
|
|
|
4
4
|
const SwapType_1 = require("../enums/SwapType");
|
|
5
5
|
const RetryUtils_1 = require("../utils/RetryUtils");
|
|
6
6
|
/**
|
|
7
|
-
* Represents
|
|
7
|
+
* Represents an intermediary (liquidity provider)
|
|
8
|
+
*
|
|
8
9
|
* @category Pricing and LPs
|
|
9
10
|
*/
|
|
10
11
|
class Intermediary {
|
|
11
12
|
constructor(url, addresses, services, reputation = {}) {
|
|
13
|
+
/**
|
|
14
|
+
* Reputation of the intermediary on different smart chains, this is only fetched
|
|
15
|
+
* on-demand when creating a swap where reputation is checked
|
|
16
|
+
*/
|
|
12
17
|
this.reputation = {};
|
|
18
|
+
/**
|
|
19
|
+
* Liquidity of the intermediary across different smart chains, this is only fetched
|
|
20
|
+
* on-demand when creating a swap where intermediary's liquidity is checked
|
|
21
|
+
*/
|
|
13
22
|
this.liquidity = {};
|
|
14
23
|
this.url = url;
|
|
15
24
|
this.addresses = addresses;
|
|
@@ -33,14 +42,21 @@ class Intermediary {
|
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the input/output swap limit for given swap type, chain and token
|
|
47
|
+
*
|
|
48
|
+
* @param swapType Swap protocol service to check
|
|
49
|
+
* @param chainId Chain identifier of the smart chain to check
|
|
50
|
+
* @param tokenAddress Address of the token to check
|
|
51
|
+
*/
|
|
36
52
|
getSwapLimits(swapType, chainId, tokenAddress) {
|
|
37
53
|
return this.swapBounds[swapType]?.[chainId]?.[tokenAddress];
|
|
38
54
|
}
|
|
39
55
|
/**
|
|
40
56
|
* Returns tokens supported by the intermediary, optionally constrained to the specific swap types
|
|
41
57
|
*
|
|
42
|
-
* @param chainIdentifier
|
|
43
|
-
* @param swapTypesArr
|
|
58
|
+
* @param chainIdentifier Chain identifier of the smart chain to check
|
|
59
|
+
* @param swapTypesArr An array of swap type services to check
|
|
44
60
|
* @private
|
|
45
61
|
*/
|
|
46
62
|
getSupportedTokens(chainIdentifier, swapTypesArr = [
|
|
@@ -63,9 +79,10 @@ class Intermediary {
|
|
|
63
79
|
/**
|
|
64
80
|
* Fetches, returns and saves the reputation of the intermediary, either for all or just for a single token
|
|
65
81
|
*
|
|
66
|
-
* @param chainIdentifier
|
|
67
|
-
* @param swapContract
|
|
68
|
-
* @param tokens
|
|
82
|
+
* @param chainIdentifier Chain identifier of the chain on which to fetch the reputation
|
|
83
|
+
* @param swapContract Swap contract for the requested smart chain
|
|
84
|
+
* @param tokens An optional array of tokens to fetch the data for (by default it uses all tokens supported
|
|
85
|
+
* by the intermediary)
|
|
69
86
|
* @param abortSignal
|
|
70
87
|
*/
|
|
71
88
|
async getReputation(chainIdentifier, swapContract, tokens, abortSignal) {
|
|
@@ -89,11 +106,11 @@ class Intermediary {
|
|
|
89
106
|
return reputation;
|
|
90
107
|
}
|
|
91
108
|
/**
|
|
92
|
-
* Fetches, returns and saves the liquidity of the
|
|
109
|
+
* Fetches, returns and saves the liquidity of the intermediary for a specific token
|
|
93
110
|
*
|
|
94
|
-
* @param chainIdentifier
|
|
95
|
-
* @param swapContract
|
|
96
|
-
* @param token
|
|
111
|
+
* @param chainIdentifier Chain identifier of the chain on which to fetch the reputation
|
|
112
|
+
* @param swapContract Swap contract for the requested smart chain
|
|
113
|
+
* @param token Token address of the token to fetch the liquidity for
|
|
97
114
|
* @param abortSignal
|
|
98
115
|
*/
|
|
99
116
|
async getLiquidity(chainIdentifier, swapContract, token, abortSignal) {
|
|
@@ -103,11 +120,21 @@ class Intermediary {
|
|
|
103
120
|
this.liquidity[chainIdentifier][token] = result;
|
|
104
121
|
return result;
|
|
105
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Checks whether the intermediary supports swaps of any tokens on the smart chain
|
|
125
|
+
*
|
|
126
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
127
|
+
*/
|
|
106
128
|
supportsChain(chainIdentifier) {
|
|
107
129
|
if (this.addresses[chainIdentifier] == null)
|
|
108
130
|
return false;
|
|
109
131
|
return this.getSupportedTokens(chainIdentifier).size !== 0;
|
|
110
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Returns intermediary's address on a given smart chain
|
|
135
|
+
*
|
|
136
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
137
|
+
*/
|
|
111
138
|
getAddress(chainIdentifier) {
|
|
112
139
|
return this.addresses[chainIdentifier];
|
|
113
140
|
}
|
|
@@ -4,7 +4,8 @@ import { SwapType } from "../enums/SwapType";
|
|
|
4
4
|
import { SwapContract } from "@atomiqlabs/base";
|
|
5
5
|
import { EventEmitter } from "events";
|
|
6
6
|
/**
|
|
7
|
-
* Swap handler type
|
|
7
|
+
* Swap handler type mapping for intermediary communication
|
|
8
|
+
*
|
|
8
9
|
* @category Pricing and LPs
|
|
9
10
|
*/
|
|
10
11
|
export declare enum SwapHandlerType {
|
|
@@ -19,6 +20,7 @@ export declare enum SwapHandlerType {
|
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Swap handler information type
|
|
23
|
+
*
|
|
22
24
|
* @category Pricing and LPs
|
|
23
25
|
*/
|
|
24
26
|
export type SwapHandlerInfoType = {
|
|
@@ -34,6 +36,7 @@ export type SwapHandlerInfoType = {
|
|
|
34
36
|
};
|
|
35
37
|
/**
|
|
36
38
|
* Token bounds (min/max) for swaps
|
|
39
|
+
*
|
|
37
40
|
* @category Pricing and LPs
|
|
38
41
|
*/
|
|
39
42
|
export type TokenBounds = {
|
|
@@ -43,14 +46,16 @@ export type TokenBounds = {
|
|
|
43
46
|
};
|
|
44
47
|
};
|
|
45
48
|
/**
|
|
46
|
-
* Multi-chain token bounds
|
|
49
|
+
* Multi-chain token bounds (min/max) for swaps
|
|
50
|
+
*
|
|
47
51
|
* @category Pricing and LPs
|
|
48
52
|
*/
|
|
49
53
|
export type MultichainTokenBounds = {
|
|
50
54
|
[chainId: string]: TokenBounds;
|
|
51
55
|
};
|
|
52
56
|
/**
|
|
53
|
-
* Swap bounds by type
|
|
57
|
+
* Swap bounds by swap protocol type
|
|
58
|
+
*
|
|
54
59
|
* @category Pricing and LPs
|
|
55
60
|
*/
|
|
56
61
|
export type SwapBounds = {
|
|
@@ -58,26 +63,46 @@ export type SwapBounds = {
|
|
|
58
63
|
};
|
|
59
64
|
/**
|
|
60
65
|
* Multi-chain swap bounds
|
|
66
|
+
*
|
|
61
67
|
* @category Pricing and LPs
|
|
62
68
|
*/
|
|
63
69
|
export type MultichainSwapBounds = {
|
|
64
70
|
[key in SwapType]?: MultichainTokenBounds;
|
|
65
71
|
};
|
|
66
72
|
/**
|
|
67
|
-
* Discovery service for available liquidity providers
|
|
73
|
+
* Discovery service for available intermediaries (liquidity providers)
|
|
74
|
+
*
|
|
68
75
|
* @category Pricing and LPs
|
|
69
76
|
*/
|
|
70
77
|
export declare class IntermediaryDiscovery extends EventEmitter {
|
|
78
|
+
/**
|
|
79
|
+
* A current list of active intermediaries
|
|
80
|
+
*/
|
|
71
81
|
intermediaries: Intermediary[];
|
|
82
|
+
/**
|
|
83
|
+
* Swap contracts for checking intermediary signatures
|
|
84
|
+
*/
|
|
72
85
|
swapContracts: {
|
|
73
86
|
[key: string]: SwapContract;
|
|
74
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Registry URL used as a source for the list of intermediaries, this should be a link to a
|
|
90
|
+
* github-hosted JSON file
|
|
91
|
+
*/
|
|
75
92
|
registryUrl: string;
|
|
93
|
+
/**
|
|
94
|
+
* Timeout for the HTTP handshake (/info) requests sent to the intermediaries
|
|
95
|
+
*/
|
|
76
96
|
httpRequestTimeout?: number;
|
|
77
97
|
/**
|
|
78
|
-
* Maximum time (in millis) to wait for other
|
|
98
|
+
* Maximum time (in millis) to wait for other intermediary's responses after the first one was founds
|
|
79
99
|
*/
|
|
80
100
|
maxWaitForOthersTimeout?: number;
|
|
101
|
+
/**
|
|
102
|
+
* The intermediary URLs passed in the constructor, to be used instead of querying the registry
|
|
103
|
+
*
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
81
106
|
private overrideNodeUrls?;
|
|
82
107
|
constructor(swapContracts: {
|
|
83
108
|
[key: string]: SwapContract;
|
|
@@ -107,14 +132,19 @@ export declare class IntermediaryDiscovery extends EventEmitter {
|
|
|
107
132
|
*/
|
|
108
133
|
private loadIntermediary;
|
|
109
134
|
/**
|
|
110
|
-
* Returns the intermediary at the provided URL, either from the already fetched list of LPs
|
|
135
|
+
* Returns the intermediary at the provided URL, either from the already fetched list of LPs
|
|
136
|
+
* or fetches the data on-demand, by sending the handshake HTTP request (/info) to the LP.
|
|
111
137
|
*
|
|
112
|
-
*
|
|
138
|
+
* Doesn't save the fetched intermediary to the list of intermediaries if it isn't already
|
|
139
|
+
* part of the known intermediaries
|
|
140
|
+
*
|
|
141
|
+
* @param url Base URL of the intermediary, which accepts HTTP requests
|
|
113
142
|
* @param abortSignal
|
|
114
143
|
*/
|
|
115
144
|
getIntermediary(url: string, abortSignal?: AbortSignal): Promise<Intermediary | null>;
|
|
116
145
|
/**
|
|
117
146
|
* Reloads the saves a list of intermediaries
|
|
147
|
+
*
|
|
118
148
|
* @param abortSignal
|
|
119
149
|
*/
|
|
120
150
|
reloadIntermediaries(abortSignal?: AbortSignal): Promise<void>;
|
|
@@ -124,39 +154,42 @@ export declare class IntermediaryDiscovery extends EventEmitter {
|
|
|
124
154
|
* @param abortSignal
|
|
125
155
|
*/
|
|
126
156
|
init(abortSignal?: AbortSignal): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Returns known swap bounds (in satoshis - BTC) by aggregating values from all known intermediaries
|
|
159
|
+
*/
|
|
127
160
|
getMultichainSwapBounds(): MultichainSwapBounds;
|
|
128
161
|
/**
|
|
129
|
-
* Returns aggregate swap bounds (in
|
|
162
|
+
* Returns aggregate swap bounds (in satoshis - BTC) as indicated by the intermediaries
|
|
130
163
|
*/
|
|
131
164
|
getSwapBounds(chainIdentifier: string): SwapBounds;
|
|
132
165
|
/**
|
|
133
|
-
* Returns the aggregate swap minimum (in
|
|
166
|
+
* Returns the aggregate swap minimum (in satoshis - BTC) for a specific swap type & token
|
|
134
167
|
* as indicated by the intermediaries
|
|
135
168
|
*
|
|
136
|
-
* @param chainIdentifier
|
|
137
|
-
* @param swapType
|
|
138
|
-
* @param
|
|
169
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
170
|
+
* @param swapType Swap protocol type
|
|
171
|
+
* @param tokenAddress Token address
|
|
139
172
|
*/
|
|
140
|
-
getSwapMinimum(chainIdentifier: string, swapType: SwapType,
|
|
173
|
+
getSwapMinimum(chainIdentifier: string, swapType: SwapType, tokenAddress: string): number | null;
|
|
141
174
|
/**
|
|
142
|
-
* Returns the aggregate swap maximum (in
|
|
175
|
+
* Returns the aggregate swap maximum (in satoshis - BTC) for a specific swap type & token
|
|
143
176
|
* as indicated by the intermediaries
|
|
144
177
|
*
|
|
145
|
-
* @param chainIdentifier
|
|
146
|
-
* @param swapType
|
|
147
|
-
* @param
|
|
178
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
179
|
+
* @param swapType Swap protocol type
|
|
180
|
+
* @param tokenAddress Token address
|
|
148
181
|
*/
|
|
149
|
-
getSwapMaximum(chainIdentifier: string, swapType: SwapType,
|
|
182
|
+
getSwapMaximum(chainIdentifier: string, swapType: SwapType, tokenAddress: string): number | null;
|
|
150
183
|
/**
|
|
151
184
|
* Returns swap candidates for a specific swap type & token address
|
|
152
185
|
*
|
|
153
|
-
* @param chainIdentifier
|
|
154
|
-
* @param swapType
|
|
155
|
-
* @param tokenAddress
|
|
186
|
+
* @param chainIdentifier Chain identifier of the smart chain
|
|
187
|
+
* @param swapType Swap protocol type
|
|
188
|
+
* @param tokenAddress Token address
|
|
156
189
|
* @param amount Amount to be swapped in sats - BTC
|
|
157
190
|
* @param count How many intermediaries to return at most
|
|
158
191
|
*/
|
|
159
|
-
getSwapCandidates(chainIdentifier: string, swapType: SwapType, tokenAddress:
|
|
192
|
+
getSwapCandidates(chainIdentifier: string, swapType: SwapType, tokenAddress: string, amount?: bigint, count?: number): Intermediary[];
|
|
160
193
|
/**
|
|
161
194
|
* Removes a specific intermediary from the list of active intermediaries (used for blacklisting)
|
|
162
195
|
*
|