@xchainjs/xchain-aggregator 0.1.18 → 0.2.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.
@@ -0,0 +1,50 @@
1
+ import { Asset, Chain } from '@xchainjs/xchain-util';
2
+ import { Wallet } from '@xchainjs/xchain-wallet';
3
+ import { IProtocol, QuoteSwap, QuoteSwapParams, SwapHistory, TxSubmitted } from '../../types';
4
+ /**
5
+ * Chainflip protocol
6
+ */
7
+ export declare class ChainflipProtocol implements IProtocol {
8
+ readonly name = "Chainflip";
9
+ private sdk;
10
+ private wallet;
11
+ private assetsData;
12
+ constructor(wallet?: Wallet);
13
+ /**
14
+ * Check if an asset is supported in the protocol
15
+ * @param {Asset} asset Asset to check if it is supported
16
+ * @returns {boolean} True if the asset is supported, otherwise false
17
+ */
18
+ isAssetSupported(asset: Asset): Promise<boolean>;
19
+ /**
20
+ * Retrieve the supported chains by the protocol
21
+ * @returns {Chain[]} the supported chains by the protocol
22
+ */
23
+ getSupportedChains(): Promise<Chain[]>;
24
+ /**
25
+ * Estimate swap by validating the swap parameters.
26
+ *
27
+ * @param {QuoteSwapParams} quoteSwapParams Swap parameters.
28
+ * @returns {QuoteSwap} Quote swap result. If swap cannot be done, it returns an empty QuoteSwap with reasons.
29
+ */
30
+ estimateSwap(params: QuoteSwapParams): Promise<QuoteSwap>;
31
+ /**
32
+ * Perform a swap operation between assets.
33
+ * @param {QuoteSwapParams} quoteSwapParams Swap parameters
34
+ * @returns {TxSubmitted} Transaction hash and URL of the swap
35
+ */
36
+ doSwap(params: QuoteSwapParams): Promise<TxSubmitted>;
37
+ /**
38
+ * Get historical swaps
39
+ * @throws {Error} - Method not implemented.
40
+ * @returns the swap history
41
+ */
42
+ getSwapHistory(): Promise<SwapHistory>;
43
+ /**
44
+ * Get asset data
45
+ * @param {Asset} asset - Asset of which return data
46
+ * @throws {Error} - If asset is not supported in Chainflip
47
+ * @returns the asset data
48
+ */
49
+ private getAssetData;
50
+ }
@@ -0,0 +1 @@
1
+ export { ChainflipProtocol } from './chainflipProtocol';
@@ -0,0 +1,6 @@
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';
3
+ export declare const cChainToXChain: (chain: CChain) => XChain;
4
+ export declare const xChainToCChain: (chain: XChain) => CChain;
5
+ export declare const cAssetToXAsset: (asset: AssetData) => XAsset;
6
+ export declare const xAssetToCAsset: (asset: XAsset) => CAsset;
@@ -1,2 +1,3 @@
1
1
  export { MayachainProtocol } from './mayachain';
2
2
  export { ThorchainProtocol } from './thorchain';
3
+ export { ChainflipProtocol } from './chainflip';
package/lib/types.d.ts CHANGED
@@ -15,7 +15,7 @@ type Fees = {
15
15
  affiliateFee: CryptoAmount;
16
16
  outboundFee: CryptoAmount;
17
17
  };
18
- type Protocol = 'Thorchain' | 'Mayachain';
18
+ type Protocol = 'Thorchain' | 'Mayachain' | 'Chainflip';
19
19
  /**
20
20
  * Represents a quote for a swap operation.
21
21
  */
@@ -62,7 +62,7 @@ type SwapResume = {
62
62
  date: Date;
63
63
  status: 'success' | 'pending';
64
64
  inboundTx: TransactionAction;
65
- outboundTx: TransactionAction;
65
+ outboundTx?: TransactionAction;
66
66
  };
67
67
  type SwapHistory = {
68
68
  count: number;
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.1.18",
4
+ "version": "0.2.0",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
7
7
  "module": "lib/index.esm.js",
@@ -29,22 +29,23 @@
29
29
  "directory": "release/package"
30
30
  },
31
31
  "dependencies": {
32
+ "@chainflip/sdk": "1.3.0",
32
33
  "@xchainjs/xchain-client": "0.16.7",
33
- "@xchainjs/xchain-mayachain": "1.0.8",
34
- "@xchainjs/xchain-mayachain-amm": "2.0.7",
35
- "@xchainjs/xchain-mayachain-query": "0.1.15",
36
- "@xchainjs/xchain-thorchain": "1.0.11",
37
- "@xchainjs/xchain-thorchain-amm": "1.1.12",
38
- "@xchainjs/xchain-thorchain-query": "0.7.13",
34
+ "@xchainjs/xchain-mayachain": "1.0.10",
35
+ "@xchainjs/xchain-mayachain-amm": "2.0.9",
36
+ "@xchainjs/xchain-mayachain-query": "0.1.16",
37
+ "@xchainjs/xchain-thorchain": "1.1.0",
38
+ "@xchainjs/xchain-thorchain-amm": "1.1.14",
39
+ "@xchainjs/xchain-thorchain-query": "0.7.14",
39
40
  "@xchainjs/xchain-util": "0.13.6",
40
- "@xchainjs/xchain-wallet": "0.1.16"
41
+ "@xchainjs/xchain-wallet": "0.1.18"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@xchainjs/xchain-avax": "0.5.5",
44
45
  "@xchainjs/xchain-binance": "5.7.16",
45
46
  "@xchainjs/xchain-bitcoin": "0.23.18",
46
47
  "@xchainjs/xchain-ethereum": "0.32.5",
47
- "@xchainjs/xchain-kujira": "0.1.19",
48
+ "@xchainjs/xchain-kujira": "0.1.20",
48
49
  "axios": "1.3.6",
49
50
  "axios-mock-adapter": "1.20.0"
50
51
  }