@xchainjs/xchain-aggregator 0.2.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.esm.js +14 -6
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +13 -5
- package/lib/index.js.map +1 -1
- package/lib/protocols/chainflip/chainflipProtocol.d.ts +2 -2
- package/lib/protocols/chainflip/types.d.ts +2 -0
- package/lib/protocols/chainflip/utils.d.ts +3 -3
- package/lib/protocols/mayachain/mayachainProtocol.d.ts +2 -2
- package/lib/protocols/mayachain/types.d.ts +2 -0
- package/lib/protocols/thorchain/thorchainProtocol.d.ts +2 -2
- package/lib/types.d.ts +10 -10
- package/package.json +15 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyAsset, Chain } from '@xchainjs/xchain-util';
|
|
2
2
|
import { IProtocol, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, TxSubmitted } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Chainflip protocol
|
|
@@ -14,7 +14,7 @@ export declare class ChainflipProtocol implements IProtocol {
|
|
|
14
14
|
* @param {Asset} asset Asset to check if it is supported
|
|
15
15
|
* @returns {boolean} True if the asset is supported, otherwise false
|
|
16
16
|
*/
|
|
17
|
-
isAssetSupported(asset:
|
|
17
|
+
isAssetSupported(asset: AnyAsset): Promise<boolean>;
|
|
18
18
|
/**
|
|
19
19
|
* Retrieve the supported chains by the protocol
|
|
20
20
|
* @returns {Chain[]} the supported chains by the protocol
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Asset as CAsset, AssetData, Chain as CChain } from '@chainflip/sdk/swap';
|
|
2
|
-
import { Asset as XAsset, Chain as XChain } from '@xchainjs/xchain-util';
|
|
2
|
+
import { Asset as XAsset, Chain as XChain, TokenAsset as XTokenAsset } from '@xchainjs/xchain-util';
|
|
3
3
|
export declare const cChainToXChain: (chain: CChain) => XChain;
|
|
4
4
|
export declare const xChainToCChain: (chain: XChain) => CChain;
|
|
5
|
-
export declare const cAssetToXAsset: (asset: AssetData) => XAsset;
|
|
6
|
-
export declare const xAssetToCAsset: (asset: XAsset) => CAsset;
|
|
5
|
+
export declare const cAssetToXAsset: (asset: AssetData) => XAsset | XTokenAsset;
|
|
6
|
+
export declare const xAssetToCAsset: (asset: XAsset | XTokenAsset) => CAsset;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyAsset, Chain } from '@xchainjs/xchain-util';
|
|
2
2
|
import { IProtocol, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, SwapHistoryParams, TxSubmitted } from '../../types';
|
|
3
3
|
export declare class MayachainProtocol implements IProtocol {
|
|
4
4
|
readonly name = "Mayachain";
|
|
@@ -11,7 +11,7 @@ export declare class MayachainProtocol implements IProtocol {
|
|
|
11
11
|
* @param {Asset} asset Asset to check if it is supported
|
|
12
12
|
* @returns {boolean} True if the asset is supported, otherwise false
|
|
13
13
|
*/
|
|
14
|
-
isAssetSupported(asset:
|
|
14
|
+
isAssetSupported(asset: AnyAsset): Promise<boolean>;
|
|
15
15
|
/**
|
|
16
16
|
* Retrieve the supported chains by the protocol
|
|
17
17
|
* @returns {Chain[]} the supported chains by the protocol
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyAsset, Chain } from '@xchainjs/xchain-util';
|
|
2
2
|
import { IProtocol, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, SwapHistoryParams, TxSubmitted } from '../../types';
|
|
3
3
|
export declare class ThorchainProtocol implements IProtocol {
|
|
4
4
|
readonly name = "Thorchain";
|
|
@@ -11,7 +11,7 @@ export declare class ThorchainProtocol implements IProtocol {
|
|
|
11
11
|
* @param {Asset} asset Asset to check if it is supported
|
|
12
12
|
* @returns {boolean} True if the asset is supported, otherwise false
|
|
13
13
|
*/
|
|
14
|
-
isAssetSupported(asset:
|
|
14
|
+
isAssetSupported(asset: AnyAsset): Promise<boolean>;
|
|
15
15
|
/**
|
|
16
16
|
* Retrieve the supported chains by the protocol
|
|
17
17
|
* @returns {Chain[]} the supported chains by the protocol
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
|
-
import { Address, Asset, Chain, CryptoAmount } from '@xchainjs/xchain-util';
|
|
2
|
+
import { Address, AnyAsset, Asset, Chain, CryptoAmount, SynthAsset, TokenAsset, TradeAsset } from '@xchainjs/xchain-util';
|
|
3
3
|
import { Wallet } from '@xchainjs/xchain-wallet';
|
|
4
4
|
/**
|
|
5
5
|
* TxSubmitted
|
|
@@ -12,9 +12,9 @@ type TxSubmitted = {
|
|
|
12
12
|
* Fees
|
|
13
13
|
*/
|
|
14
14
|
type Fees = {
|
|
15
|
-
asset: Asset;
|
|
16
|
-
affiliateFee: CryptoAmount
|
|
17
|
-
outboundFee: CryptoAmount
|
|
15
|
+
asset: Asset | TokenAsset | SynthAsset | TradeAsset;
|
|
16
|
+
affiliateFee: CryptoAmount<Asset | TokenAsset | SynthAsset | TradeAsset>;
|
|
17
|
+
outboundFee: CryptoAmount<Asset | TokenAsset | SynthAsset | TradeAsset>;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Protocols supported by the Aggregator
|
|
@@ -65,8 +65,8 @@ type QuoteSwap = {
|
|
|
65
65
|
protocol: Protocol;
|
|
66
66
|
toAddress: Address;
|
|
67
67
|
memo: string;
|
|
68
|
-
expectedAmount: CryptoAmount
|
|
69
|
-
dustThreshold: CryptoAmount
|
|
68
|
+
expectedAmount: CryptoAmount<Asset | TokenAsset | SynthAsset | TradeAsset>;
|
|
69
|
+
dustThreshold: CryptoAmount<Asset | TokenAsset | SynthAsset | TradeAsset>;
|
|
70
70
|
fees: Fees;
|
|
71
71
|
totalSwapSeconds: number;
|
|
72
72
|
slipBasisPoints: number;
|
|
@@ -78,9 +78,9 @@ type QuoteSwap = {
|
|
|
78
78
|
* Represents parameters for quoting a swap operation.
|
|
79
79
|
*/
|
|
80
80
|
type QuoteSwapParams = {
|
|
81
|
-
fromAsset: Asset;
|
|
82
|
-
destinationAsset: Asset;
|
|
83
|
-
amount: CryptoAmount
|
|
81
|
+
fromAsset: Asset | TokenAsset | SynthAsset | TradeAsset;
|
|
82
|
+
destinationAsset: Asset | TokenAsset | SynthAsset | TradeAsset;
|
|
83
|
+
amount: CryptoAmount<Asset | TokenAsset | SynthAsset | TradeAsset>;
|
|
84
84
|
fromAddress?: string;
|
|
85
85
|
destinationAddress?: string;
|
|
86
86
|
height?: number;
|
|
@@ -110,7 +110,7 @@ type SwapHistory = {
|
|
|
110
110
|
};
|
|
111
111
|
interface IProtocol {
|
|
112
112
|
name: Protocol;
|
|
113
|
-
isAssetSupported(asset:
|
|
113
|
+
isAssetSupported(asset: AnyAsset): Promise<boolean>;
|
|
114
114
|
getSupportedChains(): Promise<Chain[]>;
|
|
115
115
|
estimateSwap(params: QuoteSwapParams): Promise<QuoteSwap>;
|
|
116
116
|
doSwap(params: QuoteSwapParams): Promise<TxSubmitted>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-aggregator",
|
|
3
3
|
"description": "Protocol aggregator to make actions in different protocols",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.esm.js",
|
|
@@ -30,22 +30,22 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@chainflip/sdk": "1.3.0",
|
|
33
|
-
"@xchainjs/xchain-client": "0.
|
|
34
|
-
"@xchainjs/xchain-mayachain": "
|
|
35
|
-
"@xchainjs/xchain-mayachain-amm": "
|
|
36
|
-
"@xchainjs/xchain-mayachain-query": "0.
|
|
37
|
-
"@xchainjs/xchain-thorchain": "
|
|
38
|
-
"@xchainjs/xchain-thorchain-amm": "
|
|
39
|
-
"@xchainjs/xchain-thorchain-query": "0.
|
|
40
|
-
"@xchainjs/xchain-util": "0.
|
|
41
|
-
"@xchainjs/xchain-wallet": "0.
|
|
33
|
+
"@xchainjs/xchain-client": "1.0.0",
|
|
34
|
+
"@xchainjs/xchain-mayachain": "2.0.0",
|
|
35
|
+
"@xchainjs/xchain-mayachain-amm": "3.0.0",
|
|
36
|
+
"@xchainjs/xchain-mayachain-query": "1.0.0",
|
|
37
|
+
"@xchainjs/xchain-thorchain": "2.0.0",
|
|
38
|
+
"@xchainjs/xchain-thorchain-amm": "2.0.0",
|
|
39
|
+
"@xchainjs/xchain-thorchain-query": "1.0.0",
|
|
40
|
+
"@xchainjs/xchain-util": "1.0.0",
|
|
41
|
+
"@xchainjs/xchain-wallet": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@xchainjs/xchain-avax": "0.
|
|
45
|
-
"@xchainjs/xchain-binance": "
|
|
46
|
-
"@xchainjs/xchain-bitcoin": "0.
|
|
47
|
-
"@xchainjs/xchain-ethereum": "0.
|
|
48
|
-
"@xchainjs/xchain-kujira": "0.
|
|
44
|
+
"@xchainjs/xchain-avax": "1.0.0",
|
|
45
|
+
"@xchainjs/xchain-binance": "6.0.0",
|
|
46
|
+
"@xchainjs/xchain-bitcoin": "1.0.0",
|
|
47
|
+
"@xchainjs/xchain-ethereum": "1.0.0",
|
|
48
|
+
"@xchainjs/xchain-kujira": "1.0.0",
|
|
49
49
|
"axios": "1.3.6",
|
|
50
50
|
"axios-mock-adapter": "1.20.0"
|
|
51
51
|
}
|