@shapeshiftoss/swapper 5.10.1 → 5.10.2
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.
|
@@ -3,6 +3,7 @@ import { Asset, SupportedChainIds } from '@shapeshiftoss/types';
|
|
|
3
3
|
import { ApprovalNeededOutput, BuyAssetBySellIdInput, Swapper, SwapperType, Trade, TradeQuote, TradeResult, TradeTxs } from '../../api';
|
|
4
4
|
import { ThorchainSwapperDeps } from './types';
|
|
5
5
|
export declare class ThorchainSwapper implements Swapper {
|
|
6
|
+
private swapSupportedChainIds;
|
|
6
7
|
private supportedAssetIds;
|
|
7
8
|
deps: ThorchainSwapperDeps;
|
|
8
9
|
constructor(deps: ThorchainSwapperDeps);
|
|
@@ -7,6 +7,10 @@ const getUsdRate_1 = require("./utils/getUsdRate/getUsdRate");
|
|
|
7
7
|
const thorService_1 = require("./utils/thorService");
|
|
8
8
|
class ThorchainSwapper {
|
|
9
9
|
constructor(deps) {
|
|
10
|
+
this.swapSupportedChainIds = {
|
|
11
|
+
'eip155:1': true,
|
|
12
|
+
'bip122:000000000019d6689c085ae165831e93': true
|
|
13
|
+
};
|
|
10
14
|
this.supportedAssetIds = [];
|
|
11
15
|
this.deps = deps;
|
|
12
16
|
}
|
|
@@ -15,7 +19,7 @@ class ThorchainSwapper {
|
|
|
15
19
|
const { data: responseData } = await thorService_1.thorService.get(`${this.deps.midgardUrl}/pools`);
|
|
16
20
|
const supportedAssetIds = responseData.reduce((acc, midgardPool) => {
|
|
17
21
|
const assetId = caip_1.adapters.poolAssetIdToAssetId(midgardPool.asset);
|
|
18
|
-
if (!assetId)
|
|
22
|
+
if (!assetId || !this.swapSupportedChainIds[(0, caip_1.fromAssetId)(assetId).chainId])
|
|
19
23
|
return acc;
|
|
20
24
|
acc.push(assetId);
|
|
21
25
|
return acc;
|