@atomiqlabs/sdk 8.3.1 → 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/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/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
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/**
|
|
4
|
+
* Defines a type of the address used by the wallet, for proper coinselection (as coinselection
|
|
5
|
+
* depends on estimating the cost for spending the input + the cost of adding a change output)
|
|
6
|
+
*
|
|
7
|
+
* @category Bitcoin
|
|
8
|
+
*/
|
|
3
9
|
export type CoinselectAddressTypes = "p2sh-p2wpkh" | "p2wpkh" | "p2wsh" | "p2tr" | "p2pkh";
|
|
4
10
|
export type CoinselectTxInput = {
|
|
5
11
|
script?: Buffer;
|
package/dist/enums/FeeType.d.ts
CHANGED
package/dist/enums/FeeType.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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";
|
|
1
|
+
export { LightningNetworkApi, BitcoinRpc, BitcoinRpcWithAddressIndex, BitcoinNetwork, BtcHeader, BtcStoredHeader, 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
|
+
export { NostrMessenger } from "@atomiqlabs/messenger-nostr";
|
|
3
4
|
export * from "./bitcoin/wallet/BitcoinWallet";
|
|
4
5
|
export * from "./bitcoin/wallet/IBitcoinWallet";
|
|
5
6
|
export * from "./bitcoin/wallet/SingleAddressBitcoinWallet";
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.ISwapWrapper = exports.ISwap = exports.OnchainForGasWrapper = exports.OnchainForGasSwapState = exports.OnchainForGasSwap = void 0;
|
|
17
|
+
exports.LnForGasSwapState = exports.LnForGasSwap = exports.SpvFromBTCWrapper = exports.SpvFromBTCSwapState = exports.SpvFromBTCSwap = exports.IEscrowSwapWrapper = exports.IEscrowSwap = exports.IEscrowSelfInitSwap = exports.IToBTCWrapper = exports.ToBTCSwapState = exports.IToBTCSwap = exports.ToBTCWrapper = exports.ToBTCSwap = exports.ToBTCLNWrapper = exports.ToBTCLNSwap = exports.IFromBTCWrapper = exports.IFromBTCSelfInitSwap = exports.IFromBTCLNWrapper = exports.FromBTCWrapper = exports.FromBTCSwapState = exports.FromBTCSwap = exports.FromBTCLNAutoWrapper = exports.FromBTCLNAutoSwapState = exports.FromBTCLNAutoSwap = exports.FromBTCLNWrapper = exports.FromBTCLNSwapState = exports.FromBTCLNSwap = exports.Swapper = exports.IndexedDBUnifiedStorage = exports.CustomPriceProvider = exports.OKXPriceProvider = exports.KrakenPriceProvider = exports.CoinPaprikaPriceProvider = exports.CoinGeckoPriceProvider = exports.BinancePriceProvider = exports.RedundantSwapPrice = exports.IntermediaryDiscovery = exports.Intermediary = exports.NostrMessenger = exports.MempoolApiError = exports.MempoolBitcoinRpc = exports.MempoolApi = exports.SwapData = exports.SpvWithdrawalTransactionData = exports.SpvVaultData = exports.TransactionRevertedError = exports.SwapDataVerificationError = exports.SignatureVerificationError = exports.CannotInitializeATAError = exports.BitcoinNetwork = void 0;
|
|
18
|
+
exports.ISwapWrapper = exports.ISwap = exports.OnchainForGasWrapper = exports.OnchainForGasSwapState = exports.OnchainForGasSwap = exports.LnForGasWrapper = void 0;
|
|
19
19
|
var base_1 = require("@atomiqlabs/base");
|
|
20
20
|
Object.defineProperty(exports, "BitcoinNetwork", { enumerable: true, get: function () { return base_1.BitcoinNetwork; } });
|
|
21
21
|
Object.defineProperty(exports, "CannotInitializeATAError", { enumerable: true, get: function () { return base_1.CannotInitializeATAError; } });
|
|
@@ -29,6 +29,8 @@ var btc_mempool_1 = require("@atomiqlabs/btc-mempool");
|
|
|
29
29
|
Object.defineProperty(exports, "MempoolApi", { enumerable: true, get: function () { return btc_mempool_1.MempoolApi; } });
|
|
30
30
|
Object.defineProperty(exports, "MempoolBitcoinRpc", { enumerable: true, get: function () { return btc_mempool_1.MempoolBitcoinRpc; } });
|
|
31
31
|
Object.defineProperty(exports, "MempoolApiError", { enumerable: true, get: function () { return btc_mempool_1.MempoolApiError; } });
|
|
32
|
+
var messenger_nostr_1 = require("@atomiqlabs/messenger-nostr");
|
|
33
|
+
Object.defineProperty(exports, "NostrMessenger", { enumerable: true, get: function () { return messenger_nostr_1.NostrMessenger; } });
|
|
32
34
|
__exportStar(require("./bitcoin/wallet/BitcoinWallet"), exports);
|
|
33
35
|
__exportStar(require("./bitcoin/wallet/IBitcoinWallet"), exports);
|
|
34
36
|
__exportStar(require("./bitcoin/wallet/SingleAddressBitcoinWallet"), exports);
|
|
@@ -4,7 +4,7 @@ import { ChainSwapType, LNNodeLiquidity, SwapContract } from "@atomiqlabs/base";
|
|
|
4
4
|
/**
|
|
5
5
|
* Services offered by an intermediary
|
|
6
6
|
*
|
|
7
|
-
* @category
|
|
7
|
+
* @category LPs
|
|
8
8
|
*/
|
|
9
9
|
export type ServicesType = {
|
|
10
10
|
[key in SwapType]?: SwapHandlerInfoType;
|
|
@@ -12,7 +12,7 @@ export type ServicesType = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Reputation data for an intermediary on a single chain
|
|
14
14
|
*
|
|
15
|
-
* @category
|
|
15
|
+
* @category LPs
|
|
16
16
|
*/
|
|
17
17
|
export type SingleChainReputationType = {
|
|
18
18
|
[token: string]: {
|
|
@@ -29,7 +29,7 @@ export type SingleChainReputationType = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Smart chain liquidity data
|
|
31
31
|
*
|
|
32
|
-
* @category
|
|
32
|
+
* @category LPs
|
|
33
33
|
*/
|
|
34
34
|
export type SCLiquidity = {
|
|
35
35
|
[token: string]: bigint;
|
|
@@ -37,7 +37,7 @@ export type SCLiquidity = {
|
|
|
37
37
|
/**
|
|
38
38
|
* Represents an intermediary (liquidity provider)
|
|
39
39
|
*
|
|
40
|
-
* @category
|
|
40
|
+
* @category LPs
|
|
41
41
|
*/
|
|
42
42
|
export declare class Intermediary {
|
|
43
43
|
/**
|
|
@@ -6,7 +6,7 @@ import { EventEmitter } from "events";
|
|
|
6
6
|
/**
|
|
7
7
|
* Swap handler type mapping for intermediary communication
|
|
8
8
|
*
|
|
9
|
-
* @category
|
|
9
|
+
* @category LPs
|
|
10
10
|
*/
|
|
11
11
|
export declare enum SwapHandlerType {
|
|
12
12
|
TO_BTC = "TO_BTC",
|
|
@@ -21,7 +21,7 @@ export declare enum SwapHandlerType {
|
|
|
21
21
|
/**
|
|
22
22
|
* Swap handler information type
|
|
23
23
|
*
|
|
24
|
-
* @category
|
|
24
|
+
* @category LPs
|
|
25
25
|
*/
|
|
26
26
|
export type SwapHandlerInfoType = {
|
|
27
27
|
swapFeePPM: number;
|
|
@@ -37,7 +37,7 @@ export type SwapHandlerInfoType = {
|
|
|
37
37
|
/**
|
|
38
38
|
* Token bounds (min/max) for swaps
|
|
39
39
|
*
|
|
40
|
-
* @category
|
|
40
|
+
* @category LPs
|
|
41
41
|
*/
|
|
42
42
|
export type TokenBounds = {
|
|
43
43
|
[token: string]: {
|
|
@@ -48,7 +48,7 @@ export type TokenBounds = {
|
|
|
48
48
|
/**
|
|
49
49
|
* Multi-chain token bounds (min/max) for swaps
|
|
50
50
|
*
|
|
51
|
-
* @category
|
|
51
|
+
* @category LPs
|
|
52
52
|
*/
|
|
53
53
|
export type MultichainTokenBounds = {
|
|
54
54
|
[chainId: string]: TokenBounds;
|
|
@@ -56,7 +56,7 @@ export type MultichainTokenBounds = {
|
|
|
56
56
|
/**
|
|
57
57
|
* Swap bounds by swap protocol type
|
|
58
58
|
*
|
|
59
|
-
* @category
|
|
59
|
+
* @category LPs
|
|
60
60
|
*/
|
|
61
61
|
export type SwapBounds = {
|
|
62
62
|
[key in SwapType]?: TokenBounds;
|
|
@@ -64,7 +64,7 @@ export type SwapBounds = {
|
|
|
64
64
|
/**
|
|
65
65
|
* Multi-chain swap bounds
|
|
66
66
|
*
|
|
67
|
-
* @category
|
|
67
|
+
* @category LPs
|
|
68
68
|
*/
|
|
69
69
|
export type MultichainSwapBounds = {
|
|
70
70
|
[key in SwapType]?: MultichainTokenBounds;
|
|
@@ -72,7 +72,7 @@ export type MultichainSwapBounds = {
|
|
|
72
72
|
/**
|
|
73
73
|
* Discovery service for available intermediaries (liquidity providers)
|
|
74
74
|
*
|
|
75
|
-
* @category
|
|
75
|
+
* @category LPs
|
|
76
76
|
*/
|
|
77
77
|
export declare class IntermediaryDiscovery extends EventEmitter {
|
|
78
78
|
/**
|
|
@@ -13,7 +13,7 @@ const RetryUtils_1 = require("../utils/RetryUtils");
|
|
|
13
13
|
/**
|
|
14
14
|
* Swap handler type mapping for intermediary communication
|
|
15
15
|
*
|
|
16
|
-
* @category
|
|
16
|
+
* @category LPs
|
|
17
17
|
*/
|
|
18
18
|
var SwapHandlerType;
|
|
19
19
|
(function (SwapHandlerType) {
|
|
@@ -50,6 +50,8 @@ function swapHandlerTypeToSwapType(swapHandlerType) {
|
|
|
50
50
|
return SwapType_1.SwapType.SPV_VAULT_FROM_BTC;
|
|
51
51
|
case SwapHandlerType.FROM_BTCLN_AUTO:
|
|
52
52
|
return SwapType_1.SwapType.FROM_BTCLN_AUTO;
|
|
53
|
+
default:
|
|
54
|
+
return SwapType_1.SwapType.TRUSTED_FROM_BTCLN;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
@@ -89,7 +91,7 @@ const DEFAULT_CHAIN = "SOLANA";
|
|
|
89
91
|
/**
|
|
90
92
|
* Discovery service for available intermediaries (liquidity providers)
|
|
91
93
|
*
|
|
92
|
-
* @category
|
|
94
|
+
* @category LPs
|
|
93
95
|
*/
|
|
94
96
|
class IntermediaryDiscovery extends events_1.EventEmitter {
|
|
95
97
|
constructor(swapContracts, registryUrl = REGISTRY_URL, nodeUrls, httpRequestTimeout, maxWaitForOthersTimeout) {
|
|
@@ -4,7 +4,7 @@ import { ChainIds, MultiChain } from "../swapper/Swapper";
|
|
|
4
4
|
/**
|
|
5
5
|
* Asset configuration for redundant swap pricing
|
|
6
6
|
*
|
|
7
|
-
* @category Pricing
|
|
7
|
+
* @category Pricing
|
|
8
8
|
*/
|
|
9
9
|
export type RedundantSwapPriceAssets<T extends MultiChain> = {
|
|
10
10
|
binancePair?: string;
|
|
@@ -36,7 +36,7 @@ type CoinDecimals<T extends MultiChain> = {
|
|
|
36
36
|
* Swap price API using multiple price sources, handles errors on the APIs and automatically switches between them, such
|
|
37
37
|
* that there always is a functional API
|
|
38
38
|
*
|
|
39
|
-
* @category Pricing
|
|
39
|
+
* @category Pricing
|
|
40
40
|
*/
|
|
41
41
|
export declare class RedundantSwapPrice<T extends MultiChain> extends ICachedSwapPrice<T> {
|
|
42
42
|
/**
|
|
@@ -16,7 +16,7 @@ const logger = (0, Logger_1.getLogger)("RedundantSwapPrice: ");
|
|
|
16
16
|
* Swap price API using multiple price sources, handles errors on the APIs and automatically switches between them, such
|
|
17
17
|
* that there always is a functional API
|
|
18
18
|
*
|
|
19
|
-
* @category Pricing
|
|
19
|
+
* @category Pricing
|
|
20
20
|
*/
|
|
21
21
|
class RedundantSwapPrice extends ICachedSwapPrice_1.ICachedSwapPrice {
|
|
22
22
|
/**
|
|
@@ -4,7 +4,7 @@ import { ChainIds, MultiChain } from "../swapper/Swapper";
|
|
|
4
4
|
/**
|
|
5
5
|
* Swap price API using a single price source
|
|
6
6
|
*
|
|
7
|
-
* @category Pricing
|
|
7
|
+
* @category Pricing
|
|
8
8
|
*/
|
|
9
9
|
export declare class SingleSwapPrice<T extends MultiChain> extends ICachedSwapPrice<T> {
|
|
10
10
|
priceProvider: IPriceProvider<T>;
|
|
@@ -5,7 +5,7 @@ const ICachedSwapPrice_1 = require("./abstract/ICachedSwapPrice");
|
|
|
5
5
|
/**
|
|
6
6
|
* Swap price API using a single price source
|
|
7
7
|
*
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
class SingleSwapPrice extends ICachedSwapPrice_1.ICachedSwapPrice {
|
|
11
11
|
constructor(maxAllowedFeeDiffPPM, priceProvider, cacheTimeout) {
|
|
@@ -5,7 +5,7 @@ import { PriceInfoType } from "../types/PriceInfoType";
|
|
|
5
5
|
/**
|
|
6
6
|
* Chain-specific wrapper for swap pricing
|
|
7
7
|
*
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
export declare class SwapPriceWithChain<T extends MultiChain, ChainIdentifier extends ChainIds<T>> {
|
|
11
11
|
swapPrice: ISwapPrice<T>;
|
|
@@ -20,7 +20,7 @@ export declare class SwapPriceWithChain<T extends MultiChain, ChainIdentifier ex
|
|
|
20
20
|
* @param feePPM PPM fee rate as reported by the intermediary
|
|
21
21
|
* @param paidToken Amount of token to be paid to the swap
|
|
22
22
|
* @param tokenAddress Token address to be paid
|
|
23
|
-
* @param abortSignal
|
|
23
|
+
* @param abortSignal Abort signal
|
|
24
24
|
* @param preFetchedPrice An optional price pre-fetched with {@link preFetchPrice}
|
|
25
25
|
*/
|
|
26
26
|
isValidAmountSend(amountSats: bigint, satsBaseFee: bigint, feePPM: bigint, paidToken: bigint, tokenAddress: string, abortSignal?: AbortSignal, preFetchedPrice?: bigint): Promise<PriceInfoType>;
|
|
@@ -32,7 +32,7 @@ export declare class SwapPriceWithChain<T extends MultiChain, ChainIdentifier ex
|
|
|
32
32
|
* @param feePPM PPM fee rate as reported by the intermediary
|
|
33
33
|
* @param receiveToken Amount of token to be received from the swap
|
|
34
34
|
* @param tokenAddress Token address to be received
|
|
35
|
-
* @param abortSignal
|
|
35
|
+
* @param abortSignal Abort signal
|
|
36
36
|
* @param preFetchedPrice An optional price pre-fetched with {@link preFetchPrice}
|
|
37
37
|
*/
|
|
38
38
|
isValidAmountReceive(amountSats: bigint, satsBaseFee: bigint, feePPM: bigint, receiveToken: bigint, tokenAddress: string, abortSignal?: AbortSignal, preFetchedPrice?: bigint): Promise<PriceInfoType>;
|
|
@@ -40,11 +40,10 @@ export declare class SwapPriceWithChain<T extends MultiChain, ChainIdentifier ex
|
|
|
40
40
|
* Pre-fetches the pricing data for a given token, such that further calls to {@link isValidAmountReceive} or
|
|
41
41
|
* {@link isValidAmountSend} are quicker and don't need to wait for the price fetch
|
|
42
42
|
*
|
|
43
|
-
* @param chainIdentifier Chain identifier of the smart chain
|
|
44
43
|
* @param tokenAddress Token address
|
|
45
|
-
* @param abortSignal
|
|
44
|
+
* @param abortSignal Abort signal
|
|
46
45
|
*/
|
|
47
|
-
preFetchPrice(
|
|
46
|
+
preFetchPrice(tokenAddress: string, abortSignal?: AbortSignal): Promise<bigint>;
|
|
48
47
|
/**
|
|
49
48
|
* Pre-fetches the Bitcoin USD price data, such that further calls to {@link getBtcUsdValue},
|
|
50
49
|
* {@link getTokenUsdValue} or {@link getUsdValue} are quicker and don't need to wait for the price fetch
|
|
@@ -4,7 +4,7 @@ exports.SwapPriceWithChain = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Chain-specific wrapper for swap pricing
|
|
6
6
|
*
|
|
7
|
-
* @category Pricing
|
|
7
|
+
* @category Pricing
|
|
8
8
|
*/
|
|
9
9
|
class SwapPriceWithChain {
|
|
10
10
|
constructor(swapPrice, chainIdentifier) {
|
|
@@ -20,7 +20,7 @@ class SwapPriceWithChain {
|
|
|
20
20
|
* @param feePPM PPM fee rate as reported by the intermediary
|
|
21
21
|
* @param paidToken Amount of token to be paid to the swap
|
|
22
22
|
* @param tokenAddress Token address to be paid
|
|
23
|
-
* @param abortSignal
|
|
23
|
+
* @param abortSignal Abort signal
|
|
24
24
|
* @param preFetchedPrice An optional price pre-fetched with {@link preFetchPrice}
|
|
25
25
|
*/
|
|
26
26
|
async isValidAmountSend(amountSats, satsBaseFee, feePPM, paidToken, tokenAddress, abortSignal, preFetchedPrice) {
|
|
@@ -34,7 +34,7 @@ class SwapPriceWithChain {
|
|
|
34
34
|
* @param feePPM PPM fee rate as reported by the intermediary
|
|
35
35
|
* @param receiveToken Amount of token to be received from the swap
|
|
36
36
|
* @param tokenAddress Token address to be received
|
|
37
|
-
* @param abortSignal
|
|
37
|
+
* @param abortSignal Abort signal
|
|
38
38
|
* @param preFetchedPrice An optional price pre-fetched with {@link preFetchPrice}
|
|
39
39
|
*/
|
|
40
40
|
async isValidAmountReceive(amountSats, satsBaseFee, feePPM, receiveToken, tokenAddress, abortSignal, preFetchedPrice) {
|
|
@@ -44,12 +44,11 @@ class SwapPriceWithChain {
|
|
|
44
44
|
* Pre-fetches the pricing data for a given token, such that further calls to {@link isValidAmountReceive} or
|
|
45
45
|
* {@link isValidAmountSend} are quicker and don't need to wait for the price fetch
|
|
46
46
|
*
|
|
47
|
-
* @param chainIdentifier Chain identifier of the smart chain
|
|
48
47
|
* @param tokenAddress Token address
|
|
49
|
-
* @param abortSignal
|
|
48
|
+
* @param abortSignal Abort signal
|
|
50
49
|
*/
|
|
51
|
-
preFetchPrice(
|
|
52
|
-
return this.swapPrice.preFetchPrice(this.chainIdentifier,
|
|
50
|
+
preFetchPrice(tokenAddress, abortSignal) {
|
|
51
|
+
return this.swapPrice.preFetchPrice(this.chainIdentifier, tokenAddress, abortSignal);
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
54
|
* Pre-fetches the Bitcoin USD price data, such that further calls to {@link getBtcUsdValue},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChainIds, MultiChain } from "../../swapper/Swapper";
|
|
2
2
|
/**
|
|
3
3
|
* Coin type definition for price providers
|
|
4
|
-
* @category Pricing
|
|
4
|
+
* @category Pricing
|
|
5
5
|
*/
|
|
6
6
|
export type CoinType = {
|
|
7
7
|
coinId: string;
|
|
@@ -9,7 +9,7 @@ export type CoinType = {
|
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Constructor coin types for price providers
|
|
12
|
-
* @category Pricing
|
|
12
|
+
* @category Pricing
|
|
13
13
|
*/
|
|
14
14
|
export type CtorCoinTypes<T extends MultiChain> = {
|
|
15
15
|
coinId?: string;
|
|
@@ -22,7 +22,7 @@ export type CtorCoinTypes<T extends MultiChain> = {
|
|
|
22
22
|
}[];
|
|
23
23
|
/**
|
|
24
24
|
* Coin types mapping by chain
|
|
25
|
-
* @category Pricing
|
|
25
|
+
* @category Pricing
|
|
26
26
|
*/
|
|
27
27
|
export type CoinTypes<T extends MultiChain> = {
|
|
28
28
|
[chainId in keyof T]?: {
|
|
@@ -31,7 +31,7 @@ export type CoinTypes<T extends MultiChain> = {
|
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Abstract base class for price provider implementations
|
|
34
|
-
* @category Pricing
|
|
34
|
+
* @category Pricing
|
|
35
35
|
*/
|
|
36
36
|
export declare abstract class IPriceProvider<T extends MultiChain> {
|
|
37
37
|
coinsMap: CoinTypes<T>;
|
|
@@ -4,7 +4,7 @@ import { PriceInfoType } from "../../types/PriceInfoType";
|
|
|
4
4
|
/**
|
|
5
5
|
* Abstract base class for swap pricing implementations
|
|
6
6
|
*
|
|
7
|
-
* @category Pricing
|
|
7
|
+
* @category Pricing
|
|
8
8
|
*/
|
|
9
9
|
export declare abstract class ISwapPrice<T extends MultiChain = MultiChain> {
|
|
10
10
|
maxAllowedFeeDifferencePPM: bigint;
|
|
@@ -8,7 +8,7 @@ export type BinanceResponse = {
|
|
|
8
8
|
/**
|
|
9
9
|
* Price provider using Binance exchange API
|
|
10
10
|
*
|
|
11
|
-
* @category Pricing
|
|
11
|
+
* @category Pricing
|
|
12
12
|
*/
|
|
13
13
|
export declare class BinancePriceProvider<T extends MultiChain> extends ExchangePriceProvider<T> {
|
|
14
14
|
constructor(coinsMap: CtorCoinTypes<T>, url?: string, httpRequestTimeout?: number);
|
|
@@ -6,7 +6,7 @@ const HttpUtils_1 = require("../../http/HttpUtils");
|
|
|
6
6
|
/**
|
|
7
7
|
* Price provider using Binance exchange API
|
|
8
8
|
*
|
|
9
|
-
* @category Pricing
|
|
9
|
+
* @category Pricing
|
|
10
10
|
*/
|
|
11
11
|
class BinancePriceProvider extends ExchangePriceProvider_1.ExchangePriceProvider {
|
|
12
12
|
constructor(coinsMap, url = "https://api.binance.com/api/v3", httpRequestTimeout) {
|
|
@@ -8,7 +8,7 @@ export type CoinGeckoResponse<Currency extends string> = {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Price provider using CoinGecko API
|
|
11
|
-
* @category Pricing
|
|
11
|
+
* @category Pricing
|
|
12
12
|
*/
|
|
13
13
|
export declare class CoinGeckoPriceProvider<T extends MultiChain> extends HttpPriceProvider<T> {
|
|
14
14
|
constructor(coinsMap: CtorCoinTypes<T>, url?: string, httpRequestTimeout?: number);
|
|
@@ -5,7 +5,7 @@ const HttpPriceProvider_1 = require("./abstract/HttpPriceProvider");
|
|
|
5
5
|
const HttpUtils_1 = require("../../http/HttpUtils");
|
|
6
6
|
/**
|
|
7
7
|
* Price provider using CoinGecko API
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
class CoinGeckoPriceProvider extends HttpPriceProvider_1.HttpPriceProvider {
|
|
11
11
|
constructor(coinsMap, url = "https://api.coingecko.com/api/v3", httpRequestTimeout) {
|
|
@@ -10,7 +10,7 @@ export type CoinPaprikaResponse<Currency extends string> = {
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Price provider using CoinPaprika API
|
|
13
|
-
* @category Pricing
|
|
13
|
+
* @category Pricing
|
|
14
14
|
*/
|
|
15
15
|
export declare class CoinPaprikaPriceProvider<T extends MultiChain> extends HttpPriceProvider<T> {
|
|
16
16
|
constructor(coinsMap: CtorCoinTypes<T>, url?: string, httpRequestTimeout?: number);
|
|
@@ -5,7 +5,7 @@ const HttpPriceProvider_1 = require("./abstract/HttpPriceProvider");
|
|
|
5
5
|
const HttpUtils_1 = require("../../http/HttpUtils");
|
|
6
6
|
/**
|
|
7
7
|
* Price provider using CoinPaprika API
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
class CoinPaprikaPriceProvider extends HttpPriceProvider_1.HttpPriceProvider {
|
|
11
11
|
constructor(coinsMap, url = "https://api.coinpaprika.com/v1", httpRequestTimeout) {
|
|
@@ -4,7 +4,7 @@ import { CustomPriceFunction } from "../../types/CustomPriceFunction";
|
|
|
4
4
|
/**
|
|
5
5
|
* Price provider using custom pricing function
|
|
6
6
|
*
|
|
7
|
-
* @category Pricing
|
|
7
|
+
* @category Pricing
|
|
8
8
|
*/
|
|
9
9
|
export declare class CustomPriceProvider<T extends MultiChain> extends IPriceProvider<T> {
|
|
10
10
|
readonly getUsdPriceFn: CustomPriceFunction;
|
|
@@ -19,7 +19,7 @@ export type KrakenResponse = {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Price provider using Kraken exchange API
|
|
22
|
-
* @category Pricing
|
|
22
|
+
* @category Pricing
|
|
23
23
|
*/
|
|
24
24
|
export declare class KrakenPriceProvider<T extends MultiChain> extends ExchangePriceProvider<T> {
|
|
25
25
|
constructor(coinsMap: CtorCoinTypes<T>, url?: string, httpRequestTimeout?: number);
|
|
@@ -5,7 +5,7 @@ const ExchangePriceProvider_1 = require("./abstract/ExchangePriceProvider");
|
|
|
5
5
|
const HttpUtils_1 = require("../../http/HttpUtils");
|
|
6
6
|
/**
|
|
7
7
|
* Price provider using Kraken exchange API
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
class KrakenPriceProvider extends ExchangePriceProvider_1.ExchangePriceProvider {
|
|
11
11
|
constructor(coinsMap, url = "https://api.kraken.com/0", httpRequestTimeout) {
|
|
@@ -19,7 +19,7 @@ export type OKXResponse = {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Price provider using OKX exchange API
|
|
22
|
-
* @category Pricing
|
|
22
|
+
* @category Pricing
|
|
23
23
|
*/
|
|
24
24
|
export declare class OKXPriceProvider<T extends MultiChain> extends ExchangePriceProvider<T> {
|
|
25
25
|
constructor(coinsMap: CtorCoinTypes<T>, url?: string, httpRequestTimeout?: number);
|
|
@@ -5,7 +5,7 @@ const ExchangePriceProvider_1 = require("./abstract/ExchangePriceProvider");
|
|
|
5
5
|
const HttpUtils_1 = require("../../http/HttpUtils");
|
|
6
6
|
/**
|
|
7
7
|
* Price provider using OKX exchange API
|
|
8
|
-
* @category Pricing
|
|
8
|
+
* @category Pricing
|
|
9
9
|
*/
|
|
10
10
|
class OKXPriceProvider extends ExchangePriceProvider_1.ExchangePriceProvider {
|
|
11
11
|
constructor(coinsMap, url = "https://www.okx.com/api/v5", httpRequestTimeout) {
|