@xchainjs/xchain-thorchain-query 0.1.0-beta → 0.1.0-beta1
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 +11 -6
- package/lib/index.js +10 -5
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObservedTxStatusEnum, TransactionsApi, Configuration as Configuration$1, QueueApi, NetworkApi, PoolsApi } from '@xchainjs/xchain-thornode';
|
|
2
|
-
import { assetToBase, formatAssetAmountCurrency, baseToAsset, eqAsset, assetToString, baseAmount, AssetRuneNative, Chain, AssetAtom, AssetLUNA, AssetAVAX, AssetETH, AssetBNB, AssetDOGE, AssetLTC, AssetBCH, AssetBTC, AvalancheChain, TerraChain, DOGEChain, LTCChain, BCHChain, CosmosChain, THORChain, ETHChain, BTCChain, BNBChain, isAssetRuneNative, assetFromString } from '@xchainjs/xchain-util';
|
|
2
|
+
import { assetToBase, formatAssetAmountCurrency, baseToAsset, eqAsset, assetToString, baseAmount, AssetRuneNative, Chain, AssetAtom, AssetLUNA, AssetAVAX, AssetETH, AssetBNB, AssetDOGE, AssetLTC, AssetBCH, AssetBTC, AvalancheChain, TerraChain, DOGEChain, LTCChain, BCHChain, CosmosChain, THORChain, ETHChain, BTCChain, BNBChain, isAssetRuneNative, assetFromString, assetFromStringEx } from '@xchainjs/xchain-util';
|
|
3
3
|
import BigNumber$1, { BigNumber } from 'bignumber.js';
|
|
4
4
|
import { Network } from '@xchainjs/xchain-client';
|
|
5
5
|
import { MidgardApi, Configuration } from '@xchainjs/xchain-midgard';
|
|
@@ -836,6 +836,8 @@ class ThorchainQuery {
|
|
|
836
836
|
if (!pool)
|
|
837
837
|
throw Error(`No pool found from memo`);
|
|
838
838
|
const getAsset = assetFromString(pool[1].toUpperCase());
|
|
839
|
+
if (!getAsset)
|
|
840
|
+
throw Error(`Invalid pool asset`);
|
|
839
841
|
// Retrieve thorchain blockHeight for the tx
|
|
840
842
|
if (!((_b = txData.observed_tx.tx) === null || _b === void 0 ? void 0 : _b.id))
|
|
841
843
|
throw Error('No action observed');
|
|
@@ -1042,12 +1044,15 @@ const TEN_MINUTES = 10 * 60 * 1000;
|
|
|
1042
1044
|
const DEFAULT_THORCHAIN_DECIMALS = 8;
|
|
1043
1045
|
const USD_ASSETS = {
|
|
1044
1046
|
mainnet: [
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1047
|
+
assetFromStringEx('BNB.BUSD-BD1'),
|
|
1048
|
+
assetFromStringEx('ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48'),
|
|
1049
|
+
assetFromStringEx('ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7'),
|
|
1050
|
+
],
|
|
1051
|
+
stagenet: [assetFromStringEx('ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7')],
|
|
1052
|
+
testnet: [
|
|
1053
|
+
assetFromStringEx('BNB.BUSD-74E'),
|
|
1054
|
+
assetFromStringEx('ETH.USDT-0XA3910454BF2CB59B8B3A401589A3BACC5CA42306'),
|
|
1048
1055
|
],
|
|
1049
|
-
stagenet: [assetFromString('ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7')],
|
|
1050
|
-
testnet: [assetFromString('BNB.BUSD-74E'), assetFromString('ETH.USDT-0XA3910454BF2CB59B8B3A401589A3BACC5CA42306')],
|
|
1051
1056
|
};
|
|
1052
1057
|
/**
|
|
1053
1058
|
* This class manages retrieving information from up to date Thorchain
|
package/lib/index.js
CHANGED
|
@@ -845,6 +845,8 @@ class ThorchainQuery {
|
|
|
845
845
|
if (!pool)
|
|
846
846
|
throw Error(`No pool found from memo`);
|
|
847
847
|
const getAsset = xchainUtil.assetFromString(pool[1].toUpperCase());
|
|
848
|
+
if (!getAsset)
|
|
849
|
+
throw Error(`Invalid pool asset`);
|
|
848
850
|
// Retrieve thorchain blockHeight for the tx
|
|
849
851
|
if (!((_b = txData.observed_tx.tx) === null || _b === void 0 ? void 0 : _b.id))
|
|
850
852
|
throw Error('No action observed');
|
|
@@ -1051,12 +1053,15 @@ const TEN_MINUTES = 10 * 60 * 1000;
|
|
|
1051
1053
|
const DEFAULT_THORCHAIN_DECIMALS = 8;
|
|
1052
1054
|
const USD_ASSETS = {
|
|
1053
1055
|
mainnet: [
|
|
1054
|
-
xchainUtil.
|
|
1055
|
-
xchainUtil.
|
|
1056
|
-
xchainUtil.
|
|
1056
|
+
xchainUtil.assetFromStringEx('BNB.BUSD-BD1'),
|
|
1057
|
+
xchainUtil.assetFromStringEx('ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48'),
|
|
1058
|
+
xchainUtil.assetFromStringEx('ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7'),
|
|
1059
|
+
],
|
|
1060
|
+
stagenet: [xchainUtil.assetFromStringEx('ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7')],
|
|
1061
|
+
testnet: [
|
|
1062
|
+
xchainUtil.assetFromStringEx('BNB.BUSD-74E'),
|
|
1063
|
+
xchainUtil.assetFromStringEx('ETH.USDT-0XA3910454BF2CB59B8B3A401589A3BACC5CA42306'),
|
|
1057
1064
|
],
|
|
1058
|
-
stagenet: [xchainUtil.assetFromString('ETH.USDT-0XDAC17F958D2EE523A2206206994597C13D831EC7')],
|
|
1059
|
-
testnet: [xchainUtil.assetFromString('BNB.BUSD-74E'), xchainUtil.assetFromString('ETH.USDT-0XA3910454BF2CB59B8B3A401589A3BACC5CA42306')],
|
|
1060
1065
|
};
|
|
1061
1066
|
/**
|
|
1062
1067
|
* This class manages retrieving information from up to date Thorchain
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain-query",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-beta1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Thorchain query module that is resposible for estimating swap calculations and add/remove liquidity for thorchain ",
|
|
6
6
|
"keywords": [
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"postversion": "git push --follow-tags"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@xchainjs/xchain-client": "^0.13.
|
|
36
|
+
"@xchainjs/xchain-client": "^0.13.1",
|
|
37
37
|
"@xchainjs/xchain-midgard": "^0.1.0-alpha2",
|
|
38
38
|
"@xchainjs/xchain-thornode": "^0.1.0-alpha4",
|
|
39
|
-
"@xchainjs/xchain-util": "^0.
|
|
39
|
+
"@xchainjs/xchain-util": "^0.10.0",
|
|
40
40
|
"axios": "^0.25.0",
|
|
41
41
|
"axios-retry": "^3.2.5",
|
|
42
42
|
"bignumber.js": "^9.0.0",
|
|
43
43
|
"rimraf": "~3.0.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@xchainjs/xchain-client": "^0.13.
|
|
46
|
+
"@xchainjs/xchain-client": "^0.13.1",
|
|
47
47
|
"@xchainjs/xchain-midgard": "^0.1.0-alpha2",
|
|
48
48
|
"@xchainjs/xchain-thornode": "^0.1.0-alpha4",
|
|
49
|
-
"@xchainjs/xchain-util": "^0.
|
|
49
|
+
"@xchainjs/xchain-util": "^0.10.0",
|
|
50
50
|
"axios": "^0.25.0",
|
|
51
51
|
"axios-retry": "^3.2.5",
|
|
52
52
|
"bignumber.js": "^9.0.0",
|