@xchainjs/xchain-thorchain-query 3.0.2 → 3.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/README.md CHANGED
@@ -130,13 +130,13 @@ Estimate AddSaver() & WithdrawSaver() & getSaverPosition() https://replit.com/@t
130
130
 
131
131
  Check transaction Stage
132
132
 
133
- ### Setting Headers for Nine Realms endpoints
133
+ ### Setting Headers for public endpoints
134
134
 
135
- If you plan on using the publically accessible endpoints provided by Nine Realms(listed below), ensure that you add a valid 'x-client-id' to all requests
135
+ If you plan on using the publicly accessible endpoints listed below, ensure that you add a valid 'x-client-id' to all requests
136
136
 
137
- - https://midgard.ninerealms.com
138
- - https://haskoin.ninerealms.com (BTC/BCH/LTC)
139
- - https://thornode.ninerealms.com
137
+ - https://gateway.liquify.com/chain/thorchain_midgard
138
+ - https://api.haskoin.com (BTC/BCH/LTC)
139
+ - https://gateway.liquify.com/chain/thorchain_api
140
140
 
141
141
  ## Example
142
142
 
package/lib/index.esm.js CHANGED
@@ -92,10 +92,18 @@ 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
+ SUI: {
96
+ blockReward: 0, // No block reward for SUI
97
+ avgBlockTimeInSecs: 0.4, // Average block time for SUI in seconds
98
+ },
95
99
  TRON: {
96
100
  blockReward: 0, // No block reward for TRON
97
101
  avgBlockTimeInSecs: 3, // Average block time for TRON in seconds
98
102
  },
103
+ ZEC: {
104
+ blockReward: 1.5625, // Block reward for Zcash (post-Canopy halving)
105
+ avgBlockTimeInSecs: 75, // Average block time for Zcash in seconds
106
+ },
99
107
  };
100
108
 
101
109
  /**
@@ -140,6 +148,7 @@ const AssetBNB = assetFromStringEx('BSC.BNB');
140
148
  const AssetBASE = assetFromStringEx('BASE.ETH');
141
149
  const AssetXRP = assetFromStringEx('XRP.XRP');
142
150
  const AssetSOL = assetFromStringEx('SOL.SOL');
151
+ const AssetSUI = assetFromStringEx('SUI.SUI');
143
152
  const AssetTRON = assetFromStringEx('TRON.TRX');
144
153
  const BNBChain = 'BNB';
145
154
  const BTCChain = 'BTC';
@@ -155,6 +164,7 @@ const THORChain = 'THOR';
155
164
  const BASEChain = 'BASE';
156
165
  const XRPChain = 'XRP';
157
166
  const SOLChain = 'SOL';
167
+ const SUIChain = 'SUI';
158
168
  const TRONChain = 'TRON';
159
169
  const THORCHAIN_DECIMAL = 8;
160
170
  const isAssetRuneNative = (asset) => assetToString(asset) === assetToString(AssetRuneNative);
@@ -204,6 +214,8 @@ const getChainAsset = (chain) => {
204
214
  return AssetXRP;
205
215
  case SOLChain:
206
216
  return AssetSOL;
217
+ case SUIChain:
218
+ return AssetSUI;
207
219
  case TRONChain:
208
220
  return AssetTRON;
209
221
  default:
@@ -267,6 +279,8 @@ const calcNetworkFee = (asset, inbound) => {
267
279
  return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetXRP);
268
280
  case SOLChain:
269
281
  return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetSOL);
282
+ case SUIChain:
283
+ return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetSUI);
270
284
  case TRONChain:
271
285
  return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetTRON);
272
286
  }
@@ -312,6 +326,8 @@ const calcOutboundFee = (asset, inbound) => {
312
326
  return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetXRP);
313
327
  case SOLChain:
314
328
  return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetSOL);
329
+ case SUIChain:
330
+ return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetSUI);
315
331
  case TRONChain:
316
332
  return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetTRON);
317
333
  }
@@ -412,15 +428,15 @@ const getLiquidityProtectionData = (depositValue, poolShare, block) => {
412
428
  const defaultThornodeConfig = {
413
429
  mainnet: {
414
430
  apiRetries: 3,
415
- thornodeBaseUrls: [`https://thornode.ninerealms.com`],
431
+ thornodeBaseUrls: [`https://thornode.thorchain.network`, `https://gateway.liquify.com/chain/thorchain_api`],
416
432
  },
417
433
  stagenet: {
418
434
  apiRetries: 3,
419
- thornodeBaseUrls: ['https://stagenet-thornode.ninerealms.com'],
435
+ thornodeBaseUrls: [],
420
436
  },
421
437
  testnet: {
422
438
  apiRetries: 3,
423
- thornodeBaseUrls: ['https://testnet.thornode.thorchain.info'],
439
+ thornodeBaseUrls: ['deprecated'],
424
440
  },
425
441
  };
426
442
  class Thornode {
@@ -2732,4 +2748,4 @@ class TransactionStage {
2732
2748
  }
2733
2749
  }
2734
2750
 
2735
- 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 };
2751
+ export { AVAXChain, AddLpStatus, AddSaverStatus, AssetATOM, AssetAVAX, AssetBASE, AssetBCH, AssetBNB, AssetBSC, AssetBTC, AssetDOGE, AssetETH, AssetLTC, AssetMAYA, AssetRuneNative, AssetSOL, AssetSUI, AssetTRON, AssetXRP, BASEChain, BCHChain, BNBChain, BSCChain, BTCChain, DOGEChain, DefaultChainAttributes, ETHChain, GAIAChain, InboundStatus, LTCChain, LiquidityPool, MAYAChain, RefundStatus, SOLChain, SUIChain, 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,10 +100,18 @@ 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
+ SUI: {
104
+ blockReward: 0, // No block reward for SUI
105
+ avgBlockTimeInSecs: 0.4, // Average block time for SUI in seconds
106
+ },
103
107
  TRON: {
104
108
  blockReward: 0, // No block reward for TRON
105
109
  avgBlockTimeInSecs: 3, // Average block time for TRON in seconds
106
110
  },
111
+ ZEC: {
112
+ blockReward: 1.5625, // Block reward for Zcash (post-Canopy halving)
113
+ avgBlockTimeInSecs: 75, // Average block time for Zcash in seconds
114
+ },
107
115
  };
108
116
 
109
117
  /**
@@ -148,6 +156,7 @@ const AssetBNB = xchainUtil.assetFromStringEx('BSC.BNB');
148
156
  const AssetBASE = xchainUtil.assetFromStringEx('BASE.ETH');
149
157
  const AssetXRP = xchainUtil.assetFromStringEx('XRP.XRP');
150
158
  const AssetSOL = xchainUtil.assetFromStringEx('SOL.SOL');
159
+ const AssetSUI = xchainUtil.assetFromStringEx('SUI.SUI');
151
160
  const AssetTRON = xchainUtil.assetFromStringEx('TRON.TRX');
152
161
  const BNBChain = 'BNB';
153
162
  const BTCChain = 'BTC';
@@ -163,6 +172,7 @@ const THORChain = 'THOR';
163
172
  const BASEChain = 'BASE';
164
173
  const XRPChain = 'XRP';
165
174
  const SOLChain = 'SOL';
175
+ const SUIChain = 'SUI';
166
176
  const TRONChain = 'TRON';
167
177
  const THORCHAIN_DECIMAL = 8;
168
178
  const isAssetRuneNative = (asset) => xchainUtil.assetToString(asset) === xchainUtil.assetToString(AssetRuneNative);
@@ -212,6 +222,8 @@ const getChainAsset = (chain) => {
212
222
  return AssetXRP;
213
223
  case SOLChain:
214
224
  return AssetSOL;
225
+ case SUIChain:
226
+ return AssetSUI;
215
227
  case TRONChain:
216
228
  return AssetTRON;
217
229
  default:
@@ -275,6 +287,8 @@ const calcNetworkFee = (asset, inbound) => {
275
287
  return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetXRP);
276
288
  case SOLChain:
277
289
  return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetSOL);
290
+ case SUIChain:
291
+ return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetSUI);
278
292
  case TRONChain:
279
293
  return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.gasRate), AssetTRON);
280
294
  }
@@ -320,6 +334,8 @@ const calcOutboundFee = (asset, inbound) => {
320
334
  return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetXRP);
321
335
  case SOLChain:
322
336
  return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetSOL);
337
+ case SUIChain:
338
+ return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetSUI);
323
339
  case TRONChain:
324
340
  return new xchainUtil.AssetCryptoAmount(xchainUtil.baseAmount(inbound.outboundFee), AssetTRON);
325
341
  }
@@ -420,15 +436,15 @@ const getLiquidityProtectionData = (depositValue, poolShare, block) => {
420
436
  const defaultThornodeConfig = {
421
437
  mainnet: {
422
438
  apiRetries: 3,
423
- thornodeBaseUrls: [`https://thornode.ninerealms.com`],
439
+ thornodeBaseUrls: [`https://thornode.thorchain.network`, `https://gateway.liquify.com/chain/thorchain_api`],
424
440
  },
425
441
  stagenet: {
426
442
  apiRetries: 3,
427
- thornodeBaseUrls: ['https://stagenet-thornode.ninerealms.com'],
443
+ thornodeBaseUrls: [],
428
444
  },
429
445
  testnet: {
430
446
  apiRetries: 3,
431
- thornodeBaseUrls: ['https://testnet.thornode.thorchain.info'],
447
+ thornodeBaseUrls: ['deprecated'],
432
448
  },
433
449
  };
434
450
  class Thornode {
@@ -2754,6 +2770,7 @@ exports.AssetLTC = AssetLTC;
2754
2770
  exports.AssetMAYA = AssetMAYA;
2755
2771
  exports.AssetRuneNative = AssetRuneNative;
2756
2772
  exports.AssetSOL = AssetSOL;
2773
+ exports.AssetSUI = AssetSUI;
2757
2774
  exports.AssetTRON = AssetTRON;
2758
2775
  exports.AssetXRP = AssetXRP;
2759
2776
  exports.BASEChain = BASEChain;
@@ -2769,6 +2786,7 @@ exports.LTCChain = LTCChain;
2769
2786
  exports.LiquidityPool = LiquidityPool;
2770
2787
  exports.MAYAChain = MAYAChain;
2771
2788
  exports.SOLChain = SOLChain;
2789
+ exports.SUIChain = SUIChain;
2772
2790
  exports.THORCHAIN_DECIMAL = THORCHAIN_DECIMAL;
2773
2791
  exports.THORChain = THORChain;
2774
2792
  exports.TRONChain = TRONChain;
@@ -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 AssetSUI: Asset;
17
18
  export declare const AssetTRON: Asset;
18
19
  export declare const BNBChain = "BNB";
19
20
  export declare const BTCChain = "BTC";
@@ -29,6 +30,7 @@ export declare const THORChain = "THOR";
29
30
  export declare const BASEChain = "BASE";
30
31
  export declare const XRPChain = "XRP";
31
32
  export declare const SOLChain = "SOL";
33
+ export declare const SUIChain = "SUI";
32
34
  export declare const TRONChain = "TRON";
33
35
  export declare const THORCHAIN_DECIMAL = 8;
34
36
  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": "3.0.2",
3
+ "version": "3.0.4",
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": [
@@ -33,13 +33,13 @@
33
33
  "postversion": "git push --follow-tags"
34
34
  },
35
35
  "dependencies": {
36
- "@xchainjs/xchain-client": "2.0.11",
37
- "@xchainjs/xchain-midgard-query": "2.0.14",
38
- "@xchainjs/xchain-thornode": "1.1.0",
39
- "@xchainjs/xchain-util": "2.0.6",
40
- "axios": "1.13.5",
36
+ "@xchainjs/xchain-client": "2.0.13",
37
+ "@xchainjs/xchain-midgard-query": "2.0.16",
38
+ "@xchainjs/xchain-thornode": "1.2.0",
39
+ "@xchainjs/xchain-util": "2.0.7",
40
+ "axios": "1.15.2",
41
41
  "axios-retry": "3.2.5",
42
- "bignumber.js": "^10.0.1"
42
+ "bignumber.js": "^11.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "axios-mock-adapter": "2.1.0"