@xchainjs/xchain-thorchain-query 2.0.12 → 2.0.14
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 +13 -1
- package/lib/index.js +14 -0
- package/lib/utils/const.d.ts +2 -0
- package/package.json +2 -2
package/lib/index.esm.js
CHANGED
|
@@ -92,6 +92,10 @@ const DefaultChainAttributes = {
|
|
|
92
92
|
blockReward: 0, // No block reward for sol
|
|
93
93
|
avgBlockTimeInSecs: 0.4, // Average block time for sol in seconds
|
|
94
94
|
},
|
|
95
|
+
TRON: {
|
|
96
|
+
blockReward: 0, // No block reward for TRON
|
|
97
|
+
avgBlockTimeInSecs: 3, // Average block time for TRON in seconds
|
|
98
|
+
},
|
|
95
99
|
};
|
|
96
100
|
|
|
97
101
|
/**
|
|
@@ -136,6 +140,7 @@ const AssetBNB = assetFromStringEx('BSC.BNB');
|
|
|
136
140
|
const AssetBASE = assetFromStringEx('BASE.ETH');
|
|
137
141
|
const AssetXRP = assetFromStringEx('XRP.XRP');
|
|
138
142
|
const AssetSOL = assetFromStringEx('SOL.SOL');
|
|
143
|
+
const AssetTRON = assetFromStringEx('TRON.TRX');
|
|
139
144
|
const BNBChain = 'BNB';
|
|
140
145
|
const BTCChain = 'BTC';
|
|
141
146
|
const BCHChain = 'BCH';
|
|
@@ -150,6 +155,7 @@ const THORChain = 'THOR';
|
|
|
150
155
|
const BASEChain = 'BASE';
|
|
151
156
|
const XRPChain = 'XRP';
|
|
152
157
|
const SOLChain = 'SOL';
|
|
158
|
+
const TRONChain = 'TRON';
|
|
153
159
|
const THORCHAIN_DECIMAL = 8;
|
|
154
160
|
const isAssetRuneNative = (asset) => assetToString(asset) === assetToString(AssetRuneNative);
|
|
155
161
|
|
|
@@ -198,6 +204,8 @@ const getChainAsset = (chain) => {
|
|
|
198
204
|
return AssetXRP;
|
|
199
205
|
case SOLChain:
|
|
200
206
|
return AssetSOL;
|
|
207
|
+
case TRONChain:
|
|
208
|
+
return AssetTRON;
|
|
201
209
|
default:
|
|
202
210
|
throw Error('Unknown chain');
|
|
203
211
|
}
|
|
@@ -259,6 +267,8 @@ const calcNetworkFee = (asset, inbound) => {
|
|
|
259
267
|
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetXRP);
|
|
260
268
|
case SOLChain:
|
|
261
269
|
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetSOL);
|
|
270
|
+
case TRONChain:
|
|
271
|
+
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetTRON);
|
|
262
272
|
}
|
|
263
273
|
throw new Error(`could not calculate inbound fee for ${asset.chain}`);
|
|
264
274
|
};
|
|
@@ -302,6 +312,8 @@ const calcOutboundFee = (asset, inbound) => {
|
|
|
302
312
|
return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetXRP);
|
|
303
313
|
case SOLChain:
|
|
304
314
|
return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetSOL);
|
|
315
|
+
case TRONChain:
|
|
316
|
+
return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetTRON);
|
|
305
317
|
}
|
|
306
318
|
throw new Error(`could not calculate outbound fee for ${asset.chain}`);
|
|
307
319
|
};
|
|
@@ -3186,4 +3198,4 @@ class TransactionStage {
|
|
|
3186
3198
|
}
|
|
3187
3199
|
}
|
|
3188
3200
|
|
|
3189
|
-
export { AVAXChain, AddLpStatus, AddSaverStatus, AssetATOM, AssetAVAX, AssetBASE, AssetBCH, AssetBNB, AssetBSC, AssetBTC, AssetDOGE, AssetETH, AssetLTC, AssetMAYA, AssetRuneNative, AssetSOL, AssetXRP, BASEChain, BCHChain, BNBChain, BSCChain, BTCChain, DOGEChain, DefaultChainAttributes, ETHChain, GAIAChain, InboundStatus, LTCChain, LiquidityPool, MAYAChain, RefundStatus, SOLChain, SwapStatus, THORCHAIN_DECIMAL, THORChain, ThorchainCache, ThorchainQuery, Thornode, TransactionStage, TxType, WithdrawStatus, XRPChain, assetUSDC, calcNetworkFee, getCryptoAmountWithNotation, getLiquidityProtectionData, getLiquidityUnits, getPoolShare, getSlipOnLiquidity, isAssetRuneNative };
|
|
3201
|
+
export { AVAXChain, AddLpStatus, AddSaverStatus, AssetATOM, AssetAVAX, AssetBASE, AssetBCH, AssetBNB, AssetBSC, AssetBTC, AssetDOGE, AssetETH, AssetLTC, AssetMAYA, AssetRuneNative, AssetSOL, AssetTRON, AssetXRP, BASEChain, BCHChain, BNBChain, BSCChain, BTCChain, DOGEChain, DefaultChainAttributes, ETHChain, GAIAChain, InboundStatus, LTCChain, LiquidityPool, MAYAChain, RefundStatus, SOLChain, SwapStatus, THORCHAIN_DECIMAL, THORChain, TRONChain, ThorchainCache, ThorchainQuery, Thornode, TransactionStage, TxType, WithdrawStatus, XRPChain, assetUSDC, calcNetworkFee, getCryptoAmountWithNotation, getLiquidityProtectionData, getLiquidityUnits, getPoolShare, getSlipOnLiquidity, isAssetRuneNative };
|
package/lib/index.js
CHANGED
|
@@ -100,6 +100,10 @@ const DefaultChainAttributes = {
|
|
|
100
100
|
blockReward: 0, // No block reward for sol
|
|
101
101
|
avgBlockTimeInSecs: 0.4, // Average block time for sol in seconds
|
|
102
102
|
},
|
|
103
|
+
TRON: {
|
|
104
|
+
blockReward: 0, // No block reward for TRON
|
|
105
|
+
avgBlockTimeInSecs: 3, // Average block time for TRON in seconds
|
|
106
|
+
},
|
|
103
107
|
};
|
|
104
108
|
|
|
105
109
|
/**
|
|
@@ -144,6 +148,7 @@ const AssetBNB = xchainUtil.assetFromStringEx('BSC.BNB');
|
|
|
144
148
|
const AssetBASE = xchainUtil.assetFromStringEx('BASE.ETH');
|
|
145
149
|
const AssetXRP = xchainUtil.assetFromStringEx('XRP.XRP');
|
|
146
150
|
const AssetSOL = xchainUtil.assetFromStringEx('SOL.SOL');
|
|
151
|
+
const AssetTRON = xchainUtil.assetFromStringEx('TRON.TRX');
|
|
147
152
|
const BNBChain = 'BNB';
|
|
148
153
|
const BTCChain = 'BTC';
|
|
149
154
|
const BCHChain = 'BCH';
|
|
@@ -158,6 +163,7 @@ const THORChain = 'THOR';
|
|
|
158
163
|
const BASEChain = 'BASE';
|
|
159
164
|
const XRPChain = 'XRP';
|
|
160
165
|
const SOLChain = 'SOL';
|
|
166
|
+
const TRONChain = 'TRON';
|
|
161
167
|
const THORCHAIN_DECIMAL = 8;
|
|
162
168
|
const isAssetRuneNative = (asset) => xchainUtil.assetToString(asset) === xchainUtil.assetToString(AssetRuneNative);
|
|
163
169
|
|
|
@@ -206,6 +212,8 @@ const getChainAsset = (chain) => {
|
|
|
206
212
|
return AssetXRP;
|
|
207
213
|
case SOLChain:
|
|
208
214
|
return AssetSOL;
|
|
215
|
+
case TRONChain:
|
|
216
|
+
return AssetTRON;
|
|
209
217
|
default:
|
|
210
218
|
throw Error('Unknown chain');
|
|
211
219
|
}
|
|
@@ -267,6 +275,8 @@ const calcNetworkFee = (asset, inbound) => {
|
|
|
267
275
|
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetXRP);
|
|
268
276
|
case SOLChain:
|
|
269
277
|
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetSOL);
|
|
278
|
+
case TRONChain:
|
|
279
|
+
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetTRON);
|
|
270
280
|
}
|
|
271
281
|
throw new Error(`could not calculate inbound fee for ${asset.chain}`);
|
|
272
282
|
};
|
|
@@ -310,6 +320,8 @@ const calcOutboundFee = (asset, inbound) => {
|
|
|
310
320
|
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetXRP);
|
|
311
321
|
case SOLChain:
|
|
312
322
|
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetSOL);
|
|
323
|
+
case TRONChain:
|
|
324
|
+
return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetTRON);
|
|
313
325
|
}
|
|
314
326
|
throw new Error(`could not calculate outbound fee for ${asset.chain}`);
|
|
315
327
|
};
|
|
@@ -3208,6 +3220,7 @@ exports.AssetLTC = AssetLTC;
|
|
|
3208
3220
|
exports.AssetMAYA = AssetMAYA;
|
|
3209
3221
|
exports.AssetRuneNative = AssetRuneNative;
|
|
3210
3222
|
exports.AssetSOL = AssetSOL;
|
|
3223
|
+
exports.AssetTRON = AssetTRON;
|
|
3211
3224
|
exports.AssetXRP = AssetXRP;
|
|
3212
3225
|
exports.BASEChain = BASEChain;
|
|
3213
3226
|
exports.BCHChain = BCHChain;
|
|
@@ -3224,6 +3237,7 @@ exports.MAYAChain = MAYAChain;
|
|
|
3224
3237
|
exports.SOLChain = SOLChain;
|
|
3225
3238
|
exports.THORCHAIN_DECIMAL = THORCHAIN_DECIMAL;
|
|
3226
3239
|
exports.THORChain = THORChain;
|
|
3240
|
+
exports.TRONChain = TRONChain;
|
|
3227
3241
|
exports.ThorchainCache = ThorchainCache;
|
|
3228
3242
|
exports.ThorchainQuery = ThorchainQuery;
|
|
3229
3243
|
exports.Thornode = Thornode;
|
package/lib/utils/const.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const AssetBNB: Asset;
|
|
|
14
14
|
export declare const AssetBASE: Asset;
|
|
15
15
|
export declare const AssetXRP: Asset;
|
|
16
16
|
export declare const AssetSOL: Asset;
|
|
17
|
+
export declare const AssetTRON: Asset;
|
|
17
18
|
export declare const BNBChain = "BNB";
|
|
18
19
|
export declare const BTCChain = "BTC";
|
|
19
20
|
export declare const BCHChain = "BCH";
|
|
@@ -28,5 +29,6 @@ export declare const THORChain = "THOR";
|
|
|
28
29
|
export declare const BASEChain = "BASE";
|
|
29
30
|
export declare const XRPChain = "XRP";
|
|
30
31
|
export declare const SOLChain = "SOL";
|
|
32
|
+
export declare const TRONChain = "TRON";
|
|
31
33
|
export declare const THORCHAIN_DECIMAL = 8;
|
|
32
34
|
export declare const isAssetRuneNative: (asset: AnyAsset) => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain-query",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Thorchain query module that is responsible for estimating swap calculations and add/remove liquidity for thorchain ",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@xchainjs/xchain-client": "2.0.9",
|
|
37
|
-
"@xchainjs/xchain-midgard-query": "2.0.
|
|
37
|
+
"@xchainjs/xchain-midgard-query": "2.0.10",
|
|
38
38
|
"@xchainjs/xchain-thornode": "1.0.5",
|
|
39
39
|
"@xchainjs/xchain-util": "2.0.5",
|
|
40
40
|
"axios": "1.12.1",
|