@xchainjs/xchain-aggregator 1.0.2 → 1.0.4
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/aggregator.d.ts +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.esm.js +73 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +72 -1
- package/lib/index.js.map +1 -1
- package/lib/protocols/chainflip/chainflipProtocol.d.ts +10 -1
- package/lib/protocols/mayachain/mayachainProtocol.d.ts +14 -0
- package/lib/protocols/thorchain/thorchainProtocol.d.ts +14 -0
- package/lib/types.d.ts +12 -1
- package/package.json +15 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyAsset, Chain } from '@xchainjs/xchain-util';
|
|
1
|
+
import { AnyAsset, Chain, CryptoAmount, TokenAsset } from '@xchainjs/xchain-util';
|
|
2
2
|
import { IProtocol, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, TxSubmitted } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Chainflip protocol
|
|
@@ -9,6 +9,15 @@ export declare class ChainflipProtocol implements IProtocol {
|
|
|
9
9
|
private wallet?;
|
|
10
10
|
private assetsData;
|
|
11
11
|
constructor(configuration?: ProtocolConfig);
|
|
12
|
+
approveRouterToSpend(_params: {
|
|
13
|
+
asset: TokenAsset;
|
|
14
|
+
amount?: CryptoAmount;
|
|
15
|
+
}): Promise<TxSubmitted>;
|
|
16
|
+
shouldBeApproved(_params: {
|
|
17
|
+
asset: TokenAsset;
|
|
18
|
+
amount: CryptoAmount;
|
|
19
|
+
address: string;
|
|
20
|
+
}): Promise<boolean>;
|
|
12
21
|
/**
|
|
13
22
|
* Check if an asset is supported in the protocol
|
|
14
23
|
* @param {Asset} asset Asset to check if it is supported
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApproveParams, IsApprovedParams } from '@xchainjs/xchain-mayachain-amm';
|
|
1
2
|
import { AnyAsset, Chain } from '@xchainjs/xchain-util';
|
|
2
3
|
import { IProtocol, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, SwapHistoryParams, TxSubmitted } from '../../types';
|
|
3
4
|
export declare class MayachainProtocol implements IProtocol {
|
|
@@ -5,7 +6,20 @@ export declare class MayachainProtocol implements IProtocol {
|
|
|
5
6
|
private mayachainQuery;
|
|
6
7
|
private mayachainAmm;
|
|
7
8
|
private configuration;
|
|
9
|
+
private wallet?;
|
|
8
10
|
constructor(configuration?: ProtocolConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Aprove tx for ERC-20
|
|
13
|
+
* @param {ApproveParams} approveParams params to approve tx
|
|
14
|
+
* @returns {TxSubmitted} Transaction hash and URL of the swap
|
|
15
|
+
*/
|
|
16
|
+
approveRouterToSpend(params: ApproveParams): Promise<TxSubmitted>;
|
|
17
|
+
/**
|
|
18
|
+
* Check if tx is approved for ERC-20
|
|
19
|
+
* @param {IsApprovedParams} isApprovedParams params to check if tx is approved
|
|
20
|
+
* @returns {string[]} array of errors
|
|
21
|
+
*/
|
|
22
|
+
shouldBeApproved(params: IsApprovedParams): Promise<boolean>;
|
|
9
23
|
/**
|
|
10
24
|
* Check if an asset is supported in the protocol
|
|
11
25
|
* @param {Asset} asset Asset to check if it is supported
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApproveParams, IsApprovedParams } from '@xchainjs/xchain-thorchain-amm';
|
|
1
2
|
import { AnyAsset, Chain } from '@xchainjs/xchain-util';
|
|
2
3
|
import { IProtocol, ProtocolConfig, QuoteSwap, QuoteSwapParams, SwapHistory, SwapHistoryParams, TxSubmitted } from '../../types';
|
|
3
4
|
export declare class ThorchainProtocol implements IProtocol {
|
|
@@ -5,7 +6,20 @@ export declare class ThorchainProtocol implements IProtocol {
|
|
|
5
6
|
private thorchainQuery;
|
|
6
7
|
private thorchainAmm;
|
|
7
8
|
private configuration;
|
|
9
|
+
private wallet?;
|
|
8
10
|
constructor(configuration?: ProtocolConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Aprove tx for ERC-20 and wait until tx is confirmed
|
|
13
|
+
* @param {ApproveParams} approveParams params to approve tx
|
|
14
|
+
* @returns {TxSubmitted} Transaction hash and URL of the swap
|
|
15
|
+
*/
|
|
16
|
+
approveRouterToSpend(params: ApproveParams): Promise<TxSubmitted>;
|
|
17
|
+
/**
|
|
18
|
+
* Check if tx should be approved for ERC-20
|
|
19
|
+
* @param {IsApprovedParams} isApprovedParams params to check if tx is approved
|
|
20
|
+
* @returns {boolean} array of errors
|
|
21
|
+
*/
|
|
22
|
+
shouldBeApproved(params: IsApprovedParams): Promise<boolean>;
|
|
9
23
|
/**
|
|
10
24
|
* Check if an asset is supported in the protocol
|
|
11
25
|
* @param {Asset} asset Asset to check if it is supported
|
package/lib/types.d.ts
CHANGED
|
@@ -108,6 +108,15 @@ type SwapHistory = {
|
|
|
108
108
|
count: number;
|
|
109
109
|
swaps: SwapResume[];
|
|
110
110
|
};
|
|
111
|
+
type ApproveParams = {
|
|
112
|
+
asset: TokenAsset;
|
|
113
|
+
amount?: CryptoAmount;
|
|
114
|
+
};
|
|
115
|
+
type IsApprovedParams = {
|
|
116
|
+
asset: TokenAsset;
|
|
117
|
+
amount: CryptoAmount;
|
|
118
|
+
address: string;
|
|
119
|
+
};
|
|
111
120
|
interface IProtocol {
|
|
112
121
|
name: Protocol;
|
|
113
122
|
isAssetSupported(asset: AnyAsset): Promise<boolean>;
|
|
@@ -115,5 +124,7 @@ interface IProtocol {
|
|
|
115
124
|
estimateSwap(params: QuoteSwapParams): Promise<QuoteSwap>;
|
|
116
125
|
doSwap(params: QuoteSwapParams): Promise<TxSubmitted>;
|
|
117
126
|
getSwapHistory(params: SwapHistoryParams): Promise<SwapHistory>;
|
|
127
|
+
approveRouterToSpend(params: ApproveParams): Promise<TxSubmitted>;
|
|
128
|
+
shouldBeApproved(params: IsApprovedParams): Promise<boolean>;
|
|
118
129
|
}
|
|
119
|
-
export { IProtocol, QuoteSwapParams, QuoteSwap, TxSubmitted, Protocol, SwapHistory, SwapResume, SwapHistoryParams };
|
|
130
|
+
export { IProtocol, QuoteSwapParams, QuoteSwap, TxSubmitted, Protocol, SwapHistory, SwapResume, SwapHistoryParams, ApproveParams, IsApprovedParams, };
|
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": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
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": "1.0.
|
|
34
|
-
"@xchainjs/xchain-mayachain": "2.0.
|
|
35
|
-
"@xchainjs/xchain-mayachain-amm": "3.0.
|
|
36
|
-
"@xchainjs/xchain-mayachain-query": "1.0.
|
|
37
|
-
"@xchainjs/xchain-thorchain": "2.0.
|
|
38
|
-
"@xchainjs/xchain-thorchain-amm": "2.0.
|
|
39
|
-
"@xchainjs/xchain-thorchain-query": "1.0.
|
|
40
|
-
"@xchainjs/xchain-util": "1.0.
|
|
41
|
-
"@xchainjs/xchain-wallet": "1.0.
|
|
33
|
+
"@xchainjs/xchain-client": "1.0.2",
|
|
34
|
+
"@xchainjs/xchain-mayachain": "2.0.2",
|
|
35
|
+
"@xchainjs/xchain-mayachain-amm": "3.0.4",
|
|
36
|
+
"@xchainjs/xchain-mayachain-query": "1.0.2",
|
|
37
|
+
"@xchainjs/xchain-thorchain": "2.0.2",
|
|
38
|
+
"@xchainjs/xchain-thorchain-amm": "2.0.4",
|
|
39
|
+
"@xchainjs/xchain-thorchain-query": "1.0.2",
|
|
40
|
+
"@xchainjs/xchain-util": "1.0.1",
|
|
41
|
+
"@xchainjs/xchain-wallet": "1.0.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@xchainjs/xchain-avax": "1.0.
|
|
45
|
-
"@xchainjs/xchain-binance": "6.0.
|
|
46
|
-
"@xchainjs/xchain-bitcoin": "1.0.
|
|
47
|
-
"@xchainjs/xchain-ethereum": "1.0.
|
|
48
|
-
"@xchainjs/xchain-kujira": "1.0.
|
|
44
|
+
"@xchainjs/xchain-avax": "1.0.4",
|
|
45
|
+
"@xchainjs/xchain-binance": "6.0.2",
|
|
46
|
+
"@xchainjs/xchain-bitcoin": "1.0.2",
|
|
47
|
+
"@xchainjs/xchain-ethereum": "1.0.4",
|
|
48
|
+
"@xchainjs/xchain-kujira": "1.0.2",
|
|
49
49
|
"axios": "1.7.4",
|
|
50
50
|
"axios-mock-adapter": "1.20.0"
|
|
51
51
|
}
|