@xchainjs/xchain-thorchain-query 0.1.15 → 0.1.17

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 CHANGED
@@ -13,7 +13,7 @@ import { AssetBCH, BCHChain } from '@xchainjs/xchain-bitcoincash';
13
13
  import { DOGEChain, AssetDOGE } from '@xchainjs/xchain-doge';
14
14
  import { ETHChain, AssetETH } from '@xchainjs/xchain-ethereum';
15
15
  import { LTCChain, AssetLTC } from '@xchainjs/xchain-litecoin';
16
- import { TransactionsApi, Configuration as Configuration$1, QueueApi, NetworkApi, PoolsApi, LiquidityProvidersApi, SaversApi, QuoteApi } from '@xchainjs/xchain-thornode';
16
+ import { TransactionsApi, Configuration as Configuration$1, QueueApi, NetworkApi, PoolsApi, LiquidityProvidersApi, SaversApi, QuoteApi, MimirApi } from '@xchainjs/xchain-thornode';
17
17
 
18
18
  /*! *****************************************************************************
19
19
  Copyright (c) Microsoft Corporation.
@@ -216,21 +216,6 @@ class Midgard {
216
216
  axiosRetry(axios, { retries: this.config.apiRetries, retryDelay: axiosRetry.exponentialDelay });
217
217
  this.midgardApis = this.config.midgardBaseUrls.map((url) => new MidgardApi(new Configuration({ basePath: url })));
218
218
  }
219
- getMimirDetails() {
220
- return __awaiter(this, void 0, void 0, function* () {
221
- const path = '/v2/thorchain/mimir';
222
- for (const baseUrl of this.config.midgardBaseUrls) {
223
- try {
224
- const { data } = yield axios.get(`${baseUrl}${path}`);
225
- return data;
226
- }
227
- catch (e) {
228
- console.error(e);
229
- }
230
- }
231
- throw new Error('Midgard not responding');
232
- });
233
- }
234
219
  /**
235
220
  *
236
221
  * @returns an array of Pools
@@ -248,67 +233,6 @@ class Midgard {
248
233
  throw new Error(`Midgard not responding`);
249
234
  });
250
235
  }
251
- /**
252
- *
253
- * @returns - constants
254
- */
255
- getConstantsDetails() {
256
- return __awaiter(this, void 0, void 0, function* () {
257
- const path = '/v2/thorchain/constants';
258
- for (const baseUrl of this.config.midgardBaseUrls) {
259
- try {
260
- const { data } = yield axios.get(`${baseUrl}${path}`);
261
- return data.int_64_values;
262
- }
263
- catch (e) {
264
- //console.error(e)
265
- }
266
- }
267
- throw new Error('Midgard not responding');
268
- });
269
- }
270
- /**
271
- *
272
- * @returns the outbound Tx Value in RUNE (Basemount)
273
- */
274
- getScheduledOutboundValue() {
275
- return __awaiter(this, void 0, void 0, function* () {
276
- const path = '/v2/thorchain/queue';
277
- for (const baseUrl of this.config.midgardBaseUrls) {
278
- try {
279
- const { data } = yield axios.get(`${baseUrl}${path}`);
280
- const value = new CryptoAmount(baseAmount(data['scheduled_outbound_value']), AssetRuneNative);
281
- return value;
282
- }
283
- catch (e) {
284
- //console.error(e)
285
- }
286
- }
287
- throw new Error('Midgard not responding');
288
- });
289
- }
290
- /**
291
- * Function that wraps Mimir and Constants to return the value from a given constant name. Searchs Mimir first.
292
- *
293
- * @param networkValueName the network value to be used to search the contsants
294
- * @returns the mimir or constants value
295
- */
296
- getNetworkValues() {
297
- return __awaiter(this, void 0, void 0, function* () {
298
- const [mimirDetails, constantDetails] = yield Promise.all([this.getMimirDetails(), this.getConstantsDetails()]);
299
- const retVal = {};
300
- // insert constants first
301
- for (const constantKey of Object.keys(constantDetails)) {
302
- retVal[constantKey.toUpperCase()] = constantDetails[constantKey];
303
- }
304
- // mimir will overwrite any dupe constants
305
- for (const mimirKey of Object.keys(mimirDetails)) {
306
- const mimirValue = mimirDetails[mimirKey];
307
- retVal[mimirKey.toUpperCase()] = mimirValue;
308
- }
309
- return retVal;
310
- });
311
- }
312
236
  /**
313
237
  * Gets the latest block using the Health endpoint within Midgard
314
238
  *
@@ -542,7 +466,44 @@ const getDoubleSwap = (inputAmount, pool1, pool2, thorchainCache) => __awaiter(v
542
466
  return SwapOutput;
543
467
  });
544
468
  /**
545
- * Works out the required inbound or outbound fee based on the chain.
469
+ * Returns the native asset for a given chain
470
+ * @param chain
471
+ * @returns the gas asset type for the given chain
472
+ */
473
+ const getChainAsset = (chain) => {
474
+ switch (chain) {
475
+ case BNBChain:
476
+ return AssetBNB;
477
+ case BTCChain:
478
+ return AssetBTC;
479
+ case ETHChain:
480
+ return AssetETH;
481
+ case THORChain:
482
+ return AssetRuneNative;
483
+ case GAIAChain:
484
+ return AssetATOM;
485
+ case BCHChain:
486
+ return AssetBCH;
487
+ case LTCChain:
488
+ return AssetLTC;
489
+ case DOGEChain:
490
+ return AssetDOGE;
491
+ case AVAXChain:
492
+ return AssetAVAX;
493
+ default:
494
+ throw Error('Unknown chain');
495
+ }
496
+ };
497
+ /**
498
+ *
499
+ * @param asset
500
+ * @returns a boolean based on Assets being compared are equal
501
+ */
502
+ const isNativeChainAsset = (asset) => {
503
+ return eqAsset(asset, getChainAsset(asset.chain));
504
+ };
505
+ /**
506
+ * Works out the required inbound fee based on the chain.
546
507
  * Call getInboundDetails to get the current gasRate
547
508
  *
548
509
  * @param sourceAsset
@@ -551,8 +512,13 @@ const getDoubleSwap = (inputAmount, pool1, pool2, thorchainCache) => __awaiter(v
551
512
  * @returns
552
513
  */
553
514
  const calcNetworkFee = (asset, inbound) => {
515
+ // synths are always 0.02R fee
554
516
  if (asset.synth)
555
517
  return new CryptoAmount(baseAmount(2000000), AssetRuneNative);
518
+ // if you are swapping a non-gas asset on a multiAsset chain (ex. ERC-20 on ETH), the
519
+ // gas fees will be paid in a diff asset than the one you are swapping
520
+ else if (!isNativeChainAsset(asset))
521
+ return new CryptoAmount(baseAmount(0), AssetRuneNative);
556
522
  switch (asset.chain) {
557
523
  case BTCChain:
558
524
  return new CryptoAmount(baseAmount(inbound.gasRate.multipliedBy(inbound.outboundTxSize)), AssetBTC);
@@ -626,35 +592,6 @@ const calcOutboundFee = (asset, inbound) => {
626
592
  return new CryptoAmount(baseAmount(2000000), AssetRuneNative);
627
593
  }
628
594
  throw new Error(`could not calculate outbound fee for ${asset.chain}`);
629
- };
630
- /**
631
- * Return the chain for a given Asset This method should live somewhere else.
632
- * @param chain
633
- * @returns the gas asset type for the given chain
634
- */
635
- const getChainAsset = (chain) => {
636
- switch (chain) {
637
- case BNBChain:
638
- return AssetBNB;
639
- case BTCChain:
640
- return AssetBTC;
641
- case ETHChain:
642
- return AssetETH;
643
- case THORChain:
644
- return AssetRuneNative;
645
- case GAIAChain:
646
- return AssetATOM;
647
- case BCHChain:
648
- return AssetBCH;
649
- case LTCChain:
650
- return AssetLTC;
651
- case DOGEChain:
652
- return AssetDOGE;
653
- case AVAXChain:
654
- return AssetAVAX;
655
- default:
656
- throw Error('Unknown chain');
657
- }
658
595
  };
659
596
 
660
597
  const defaultThornodeConfig = {
@@ -683,6 +620,7 @@ class Thornode {
683
620
  this.liquidityProvidersApi = this.config.thornodeBaseUrls.map((url) => new LiquidityProvidersApi(new Configuration$1({ basePath: url })));
684
621
  this.saversApi = this.config.thornodeBaseUrls.map((url) => new SaversApi(new Configuration$1({ basePath: url })));
685
622
  this.quoteApi = this.config.thornodeBaseUrls.map((url) => new QuoteApi(new Configuration$1({ basePath: url })));
623
+ this.mimirApi = this.config.thornodeBaseUrls.map((url) => new MimirApi(new Configuration$1({ basePath: url })));
686
624
  }
687
625
  /**
688
626
  * Returns the oubound transactions held by THORChain due to outbound delay
@@ -706,6 +644,50 @@ class Thornode {
706
644
  throw Error(`THORNode not responding`);
707
645
  });
708
646
  }
647
+ /**
648
+ * Returns queue
649
+ * May be empty if there are no transactions
650
+ *
651
+ * @returns {ScheduledQueueItem} Array
652
+ *
653
+ */
654
+ getQueue() {
655
+ return __awaiter(this, void 0, void 0, function* () {
656
+ for (const api of this.queueApi) {
657
+ try {
658
+ const queue = yield api.queue();
659
+ return queue.data;
660
+ }
661
+ catch (e) {
662
+ //console.error(e)
663
+ throw new Error(`THORNode not responding`);
664
+ }
665
+ }
666
+ throw Error(`THORNode not responding`);
667
+ });
668
+ }
669
+ /**
670
+ * Returns Mimir
671
+ * May be empty if there are no transactions
672
+ *
673
+ * @returns {ScheduledQueueItem} Array
674
+ *
675
+ */
676
+ getMimir() {
677
+ return __awaiter(this, void 0, void 0, function* () {
678
+ for (const api of this.mimirApi) {
679
+ try {
680
+ const queue = yield api.mimir();
681
+ return queue.data;
682
+ }
683
+ catch (e) {
684
+ //console.error(e)
685
+ throw new Error(`THORNode not responding`);
686
+ }
687
+ }
688
+ throw Error(`THORNode not responding`);
689
+ });
690
+ }
709
691
  /**
710
692
  *
711
693
  * @param txHash - transaction hash
@@ -785,6 +767,47 @@ class Thornode {
785
767
  throw new Error(`THORNode not responding`);
786
768
  });
787
769
  }
770
+ /**
771
+ *
772
+ * @returns Thorchain constants
773
+ */
774
+ getTcConstants() {
775
+ return __awaiter(this, void 0, void 0, function* () {
776
+ for (const api of this.networkApi) {
777
+ try {
778
+ const constants = yield api.constants();
779
+ if (constants.data.int_64_values) {
780
+ return constants.data.int_64_values;
781
+ }
782
+ }
783
+ catch (e) {
784
+ //console.error(e)
785
+ }
786
+ }
787
+ throw new Error(`THORNode not responding`);
788
+ });
789
+ }
790
+ /**
791
+ * Function that wraps Mimir and Constants to return the value from a given constant name. Searchs Mimir first.
792
+ *
793
+ * @param networkValueName the network value to be used to search the contsants
794
+ * @returns the mimir or constants value
795
+ */
796
+ getNetworkValues() {
797
+ return __awaiter(this, void 0, void 0, function* () {
798
+ const [mimirDetails, constantDetails] = yield Promise.all([this.getMimir(), this.getTcConstants()]);
799
+ const retVal = {};
800
+ // insert constants first
801
+ for (const [key, value] of Object.entries(constantDetails)) {
802
+ retVal[key.toUpperCase()] = parseInt(value);
803
+ }
804
+ // // mimir will overwrite any dupe constants
805
+ for (const [key, value] of Object.entries(mimirDetails)) {
806
+ retVal[key] = parseInt(value);
807
+ }
808
+ return retVal;
809
+ });
810
+ }
788
811
  /**
789
812
  *
790
813
  * @param asset - asset string
@@ -1093,7 +1116,7 @@ class ThorchainCache {
1093
1116
  refereshInboundDetailCache() {
1094
1117
  return __awaiter(this, void 0, void 0, function* () {
1095
1118
  const [mimirDetails, allInboundAddresses] = yield Promise.all([
1096
- this.midgard.getMimirDetails(),
1119
+ this.thornode.getMimir(),
1097
1120
  this.thornode.getInboundAddresses(),
1098
1121
  ]);
1099
1122
  const inboundDetails = {};
@@ -1149,7 +1172,7 @@ class ThorchainCache {
1149
1172
  */
1150
1173
  refereshNetworkValuesCache() {
1151
1174
  return __awaiter(this, void 0, void 0, function* () {
1152
- const networkValues = yield this.midgard.getNetworkValues();
1175
+ const networkValues = yield this.thornode.getNetworkValues();
1153
1176
  this.networkValuesCache = {
1154
1177
  lastRefreshed: Date.now(),
1155
1178
  networkValues,
@@ -1554,7 +1577,7 @@ class ThorchainQuery {
1554
1577
  ? params.input
1555
1578
  : yield this.thorchainCache.convert(params.input, params.input.asset);
1556
1579
  const inboundFeeInInboundGasAsset = calcNetworkFee(input.asset, sourceInboundDetails);
1557
- let outboundFeeInOutboundGasAsset = calcOutboundFee(params.destinationAsset, destinationInboundDetails);
1580
+ let outboundFeeInOutboundGasAsset = calcOutboundFee(params.destinationAsset, destinationInboundDetails).times(3);
1558
1581
  // Check outbound fee is equal too or greater than 1 USD * need to find a more permanent solution to this. referencing just 1 stable coin pool has problems
1559
1582
  if (params.destinationAsset.chain !== THORChain && !params.destinationAsset.synth) {
1560
1583
  const deepestUSDPOOL = yield this.thorchainCache.getDeepestUSDPool();
@@ -1564,13 +1587,12 @@ class ThorchainQuery {
1564
1587
  if (!checkOutboundFee) {
1565
1588
  const newFee = usdMinFee;
1566
1589
  outboundFeeInOutboundGasAsset = yield this.convert(newFee, AssetRuneNative);
1567
- console.log(outboundFeeInOutboundGasAsset.assetAmount.amount);
1568
1590
  }
1569
1591
  }
1570
1592
  // ----------- Remove Fees from inbound before doing the swap -----------
1571
1593
  const inboundFeeInInboundAsset = yield this.thorchainCache.convert(inboundFeeInInboundGasAsset, params.input.asset);
1572
- const inputMinusInboundFeeInAsset = input.minus(inboundFeeInInboundAsset);
1573
- // console.log('y', inputMinusInboundFeeInAsset.formatedAssetString())
1594
+ // if it a gas asset, take away inbound fee, else leave it as is. Still allow inboundFeeInInboundGasAsset to pass to swapEstimate.totalFees.inboundFee so user is aware if the gas requirements.
1595
+ const inputMinusInboundFeeInAsset = isNativeChainAsset(input.asset) ? input.minus(inboundFeeInInboundAsset) : input;
1574
1596
  // remove any affiliateFee. netInput * affiliateFee (percentage) of the destination asset type
1575
1597
  const affiliateFeePercent = params.affiliateFeeBasisPoints ? params.affiliateFeeBasisPoints / 10000 : 0;
1576
1598
  const affiliateFeeInAsset = inputMinusInboundFeeInAsset.times(affiliateFeePercent);
@@ -1591,6 +1613,7 @@ class ThorchainQuery {
1591
1613
  const swapOutputInDestinationAsset = yield this.thorchainCache.getExpectedSwapOutput(inputNetInAsset, params.destinationAsset);
1592
1614
  // ---------------- Remove Outbound Fee ---------------------- /
1593
1615
  const outboundFeeInDestinationAsset = yield this.thorchainCache.convert(outboundFeeInOutboundGasAsset, params.destinationAsset);
1616
+ //console.log(outboundFeeInDestinationAsset.formatedAssetString())
1594
1617
  const netOutputInAsset = swapOutputInDestinationAsset.output.minus(outboundFeeInDestinationAsset);
1595
1618
  const totalFees = {
1596
1619
  inboundFee: inboundFeeInInboundGasAsset,
@@ -1713,10 +1736,9 @@ class ThorchainQuery {
1713
1736
  let result = undefined;
1714
1737
  const inputInRune = yield this.thorchainCache.convert(params.input, AssetRuneNative);
1715
1738
  const feesInRune = yield this.getFeesIn(estimate.totalFees, AssetRuneNative);
1716
- const totalSwapFeesInRune = feesInRune.inboundFee
1717
- .plus(feesInRune.outboundFee)
1718
- .plus(feesInRune.swapFee)
1719
- .plus(feesInRune.affiliateFee);
1739
+ const totalSwapFeesInRune = !params.input.asset.synth && isNativeChainAsset(params.input.asset)
1740
+ ? feesInRune.inboundFee.plus(feesInRune.outboundFee).plus(feesInRune.swapFee).plus(feesInRune.affiliateFee)
1741
+ : feesInRune.outboundFee.plus(feesInRune.swapFee).plus(feesInRune.affiliateFee);
1720
1742
  const totalSwapFeesInAsset = yield this.thorchainCache.convert(totalSwapFeesInRune, params.input.asset);
1721
1743
  if (totalSwapFeesInRune.gte(inputInRune))
1722
1744
  result = `Input amount ${params.input.formatedAssetString()}(${inputInRune.formatedAssetString()}) is less than or equal to total swap fees ${totalSwapFeesInAsset.formatedAssetString()}(${totalSwapFeesInRune.formatedAssetString()}) `;
@@ -1804,7 +1826,8 @@ class ThorchainQuery {
1804
1826
  let txOutDelayRate = new CryptoAmount(baseAmount(networkValues['TXOUTDELAYRATE']), AssetRuneNative).assetAmount
1805
1827
  .amount()
1806
1828
  .toNumber();
1807
- const getScheduledOutboundValue = yield this.thorchainCache.midgard.getScheduledOutboundValue();
1829
+ const getQueue = yield this.thorchainCache.thornode.getQueue();
1830
+ const outboundValue = new CryptoAmount(baseAmount(getQueue.scheduled_outbound_value), AssetRuneNative);
1808
1831
  const thorChainblocktime = this.chainAttributes[THORChain].avgBlockTimeInSecs; // blocks required to confirm tx
1809
1832
  // If asset is equal to Rune set runeValue as outbound amount else set it to the asset's value in rune
1810
1833
  const runeValue = yield this.thorchainCache.convert(outboundAmount, AssetRuneNative);
@@ -1813,11 +1836,11 @@ class ThorchainQuery {
1813
1836
  return thorChainblocktime;
1814
1837
  }
1815
1838
  // Rune value in the outbound queue
1816
- if (getScheduledOutboundValue == undefined) {
1839
+ if (outboundValue == undefined) {
1817
1840
  throw new Error(`Could not return Scheduled Outbound Value`);
1818
1841
  }
1819
1842
  // Add OutboundAmount in rune to the oubound queue
1820
- const outboundAmountTotal = runeValue.plus(getScheduledOutboundValue);
1843
+ const outboundAmountTotal = runeValue.plus(outboundValue);
1821
1844
  // calculate the if outboundAmountTotal is over the volume threshold
1822
1845
  const volumeThreshold = outboundAmountTotal.div(minTxOutVolumeThreshold);
1823
1846
  // check delay rate
@@ -1909,7 +1932,7 @@ class ThorchainQuery {
1909
1932
  totalUnits: new BigNumber(poolAsset.pool.liquidityUnits),
1910
1933
  liquidityUnits: new BigNumber(liquidityProvider.units),
1911
1934
  };
1912
- const networkValues = yield this.thorchainCache.midgard.getNetworkValues();
1935
+ const networkValues = yield this.thorchainCache.thornode.getNetworkValues();
1913
1936
  const block = {
1914
1937
  current: blockData.thorchain,
1915
1938
  lastAdded: liquidityProvider.last_add_height,
@@ -2475,9 +2498,10 @@ class TransactionStage {
2475
2498
  const estimatedWaitTime = outboundBlock > currentTCHeight
2476
2499
  ? (outboundBlock - currentTCHeight) * this.chainAttributes[THORChain].avgBlockTimeInSecs
2477
2500
  : 0;
2501
+ const withdrawalAmount = yield this.getCryptoAmount(outAmount[0], asset);
2478
2502
  const withdrawLpInfo = {
2479
2503
  status,
2480
- withdrawalAmount: new CryptoAmount(baseAmount(outAmount[0]), asset),
2504
+ withdrawalAmount,
2481
2505
  expectedConfirmationDate,
2482
2506
  thorchainHeight: currentTCHeight,
2483
2507
  outboundHeight: outboundBlock,
@@ -2524,9 +2548,10 @@ class TransactionStage {
2524
2548
  : 0;
2525
2549
  // if the TC has process the block that the outbound tx was assigned to then its completed.
2526
2550
  const status = txData.out_txs ? WithdrawStatus.Complete : WithdrawStatus.Incomplete;
2551
+ const withdrawalAmount = yield this.getCryptoAmount(outAmount[0], asset);
2527
2552
  const withdrawSaverInfo = {
2528
2553
  status,
2529
- withdrawalAmount: new CryptoAmount(baseAmount(outAmount[0]), asset),
2554
+ withdrawalAmount,
2530
2555
  expectedConfirmationDate,
2531
2556
  thorchainHeight: currentTCHeight,
2532
2557
  finalisedHeight,
package/lib/index.js CHANGED
@@ -225,21 +225,6 @@ class Midgard {
225
225
  axiosRetry__default['default'](axios__default['default'], { retries: this.config.apiRetries, retryDelay: axiosRetry__default['default'].exponentialDelay });
226
226
  this.midgardApis = this.config.midgardBaseUrls.map((url) => new xchainMidgard.MidgardApi(new xchainMidgard.Configuration({ basePath: url })));
227
227
  }
228
- getMimirDetails() {
229
- return __awaiter(this, void 0, void 0, function* () {
230
- const path = '/v2/thorchain/mimir';
231
- for (const baseUrl of this.config.midgardBaseUrls) {
232
- try {
233
- const { data } = yield axios__default['default'].get(`${baseUrl}${path}`);
234
- return data;
235
- }
236
- catch (e) {
237
- console.error(e);
238
- }
239
- }
240
- throw new Error('Midgard not responding');
241
- });
242
- }
243
228
  /**
244
229
  *
245
230
  * @returns an array of Pools
@@ -257,67 +242,6 @@ class Midgard {
257
242
  throw new Error(`Midgard not responding`);
258
243
  });
259
244
  }
260
- /**
261
- *
262
- * @returns - constants
263
- */
264
- getConstantsDetails() {
265
- return __awaiter(this, void 0, void 0, function* () {
266
- const path = '/v2/thorchain/constants';
267
- for (const baseUrl of this.config.midgardBaseUrls) {
268
- try {
269
- const { data } = yield axios__default['default'].get(`${baseUrl}${path}`);
270
- return data.int_64_values;
271
- }
272
- catch (e) {
273
- //console.error(e)
274
- }
275
- }
276
- throw new Error('Midgard not responding');
277
- });
278
- }
279
- /**
280
- *
281
- * @returns the outbound Tx Value in RUNE (Basemount)
282
- */
283
- getScheduledOutboundValue() {
284
- return __awaiter(this, void 0, void 0, function* () {
285
- const path = '/v2/thorchain/queue';
286
- for (const baseUrl of this.config.midgardBaseUrls) {
287
- try {
288
- const { data } = yield axios__default['default'].get(`${baseUrl}${path}`);
289
- const value = new CryptoAmount(xchainUtil.baseAmount(data['scheduled_outbound_value']), xchainThorchain.AssetRuneNative);
290
- return value;
291
- }
292
- catch (e) {
293
- //console.error(e)
294
- }
295
- }
296
- throw new Error('Midgard not responding');
297
- });
298
- }
299
- /**
300
- * Function that wraps Mimir and Constants to return the value from a given constant name. Searchs Mimir first.
301
- *
302
- * @param networkValueName the network value to be used to search the contsants
303
- * @returns the mimir or constants value
304
- */
305
- getNetworkValues() {
306
- return __awaiter(this, void 0, void 0, function* () {
307
- const [mimirDetails, constantDetails] = yield Promise.all([this.getMimirDetails(), this.getConstantsDetails()]);
308
- const retVal = {};
309
- // insert constants first
310
- for (const constantKey of Object.keys(constantDetails)) {
311
- retVal[constantKey.toUpperCase()] = constantDetails[constantKey];
312
- }
313
- // mimir will overwrite any dupe constants
314
- for (const mimirKey of Object.keys(mimirDetails)) {
315
- const mimirValue = mimirDetails[mimirKey];
316
- retVal[mimirKey.toUpperCase()] = mimirValue;
317
- }
318
- return retVal;
319
- });
320
- }
321
245
  /**
322
246
  * Gets the latest block using the Health endpoint within Midgard
323
247
  *
@@ -551,7 +475,44 @@ const getDoubleSwap = (inputAmount, pool1, pool2, thorchainCache) => __awaiter(v
551
475
  return SwapOutput;
552
476
  });
553
477
  /**
554
- * Works out the required inbound or outbound fee based on the chain.
478
+ * Returns the native asset for a given chain
479
+ * @param chain
480
+ * @returns the gas asset type for the given chain
481
+ */
482
+ const getChainAsset = (chain) => {
483
+ switch (chain) {
484
+ case xchainBinance.BNBChain:
485
+ return xchainBinance.AssetBNB;
486
+ case xchainBitcoin.BTCChain:
487
+ return xchainBitcoin.AssetBTC;
488
+ case xchainEthereum.ETHChain:
489
+ return xchainEthereum.AssetETH;
490
+ case xchainThorchain.THORChain:
491
+ return xchainThorchain.AssetRuneNative;
492
+ case xchainCosmos.GAIAChain:
493
+ return xchainCosmos.AssetATOM;
494
+ case xchainBitcoincash.BCHChain:
495
+ return xchainBitcoincash.AssetBCH;
496
+ case xchainLitecoin.LTCChain:
497
+ return xchainLitecoin.AssetLTC;
498
+ case xchainDoge.DOGEChain:
499
+ return xchainDoge.AssetDOGE;
500
+ case xchainAvax.AVAXChain:
501
+ return xchainAvax.AssetAVAX;
502
+ default:
503
+ throw Error('Unknown chain');
504
+ }
505
+ };
506
+ /**
507
+ *
508
+ * @param asset
509
+ * @returns a boolean based on Assets being compared are equal
510
+ */
511
+ const isNativeChainAsset = (asset) => {
512
+ return xchainUtil.eqAsset(asset, getChainAsset(asset.chain));
513
+ };
514
+ /**
515
+ * Works out the required inbound fee based on the chain.
555
516
  * Call getInboundDetails to get the current gasRate
556
517
  *
557
518
  * @param sourceAsset
@@ -560,8 +521,13 @@ const getDoubleSwap = (inputAmount, pool1, pool2, thorchainCache) => __awaiter(v
560
521
  * @returns
561
522
  */
562
523
  const calcNetworkFee = (asset, inbound) => {
524
+ // synths are always 0.02R fee
563
525
  if (asset.synth)
564
526
  return new CryptoAmount(xchainUtil.baseAmount(2000000), xchainThorchain.AssetRuneNative);
527
+ // if you are swapping a non-gas asset on a multiAsset chain (ex. ERC-20 on ETH), the
528
+ // gas fees will be paid in a diff asset than the one you are swapping
529
+ else if (!isNativeChainAsset(asset))
530
+ return new CryptoAmount(xchainUtil.baseAmount(0), xchainThorchain.AssetRuneNative);
565
531
  switch (asset.chain) {
566
532
  case xchainBitcoin.BTCChain:
567
533
  return new CryptoAmount(xchainUtil.baseAmount(inbound.gasRate.multipliedBy(inbound.outboundTxSize)), xchainBitcoin.AssetBTC);
@@ -635,35 +601,6 @@ const calcOutboundFee = (asset, inbound) => {
635
601
  return new CryptoAmount(xchainUtil.baseAmount(2000000), xchainThorchain.AssetRuneNative);
636
602
  }
637
603
  throw new Error(`could not calculate outbound fee for ${asset.chain}`);
638
- };
639
- /**
640
- * Return the chain for a given Asset This method should live somewhere else.
641
- * @param chain
642
- * @returns the gas asset type for the given chain
643
- */
644
- const getChainAsset = (chain) => {
645
- switch (chain) {
646
- case xchainBinance.BNBChain:
647
- return xchainBinance.AssetBNB;
648
- case xchainBitcoin.BTCChain:
649
- return xchainBitcoin.AssetBTC;
650
- case xchainEthereum.ETHChain:
651
- return xchainEthereum.AssetETH;
652
- case xchainThorchain.THORChain:
653
- return xchainThorchain.AssetRuneNative;
654
- case xchainCosmos.GAIAChain:
655
- return xchainCosmos.AssetATOM;
656
- case xchainBitcoincash.BCHChain:
657
- return xchainBitcoincash.AssetBCH;
658
- case xchainLitecoin.LTCChain:
659
- return xchainLitecoin.AssetLTC;
660
- case xchainDoge.DOGEChain:
661
- return xchainDoge.AssetDOGE;
662
- case xchainAvax.AVAXChain:
663
- return xchainAvax.AssetAVAX;
664
- default:
665
- throw Error('Unknown chain');
666
- }
667
604
  };
668
605
 
669
606
  const defaultThornodeConfig = {
@@ -692,6 +629,7 @@ class Thornode {
692
629
  this.liquidityProvidersApi = this.config.thornodeBaseUrls.map((url) => new xchainThornode.LiquidityProvidersApi(new xchainThornode.Configuration({ basePath: url })));
693
630
  this.saversApi = this.config.thornodeBaseUrls.map((url) => new xchainThornode.SaversApi(new xchainThornode.Configuration({ basePath: url })));
694
631
  this.quoteApi = this.config.thornodeBaseUrls.map((url) => new xchainThornode.QuoteApi(new xchainThornode.Configuration({ basePath: url })));
632
+ this.mimirApi = this.config.thornodeBaseUrls.map((url) => new xchainThornode.MimirApi(new xchainThornode.Configuration({ basePath: url })));
695
633
  }
696
634
  /**
697
635
  * Returns the oubound transactions held by THORChain due to outbound delay
@@ -715,6 +653,50 @@ class Thornode {
715
653
  throw Error(`THORNode not responding`);
716
654
  });
717
655
  }
656
+ /**
657
+ * Returns queue
658
+ * May be empty if there are no transactions
659
+ *
660
+ * @returns {ScheduledQueueItem} Array
661
+ *
662
+ */
663
+ getQueue() {
664
+ return __awaiter(this, void 0, void 0, function* () {
665
+ for (const api of this.queueApi) {
666
+ try {
667
+ const queue = yield api.queue();
668
+ return queue.data;
669
+ }
670
+ catch (e) {
671
+ //console.error(e)
672
+ throw new Error(`THORNode not responding`);
673
+ }
674
+ }
675
+ throw Error(`THORNode not responding`);
676
+ });
677
+ }
678
+ /**
679
+ * Returns Mimir
680
+ * May be empty if there are no transactions
681
+ *
682
+ * @returns {ScheduledQueueItem} Array
683
+ *
684
+ */
685
+ getMimir() {
686
+ return __awaiter(this, void 0, void 0, function* () {
687
+ for (const api of this.mimirApi) {
688
+ try {
689
+ const queue = yield api.mimir();
690
+ return queue.data;
691
+ }
692
+ catch (e) {
693
+ //console.error(e)
694
+ throw new Error(`THORNode not responding`);
695
+ }
696
+ }
697
+ throw Error(`THORNode not responding`);
698
+ });
699
+ }
718
700
  /**
719
701
  *
720
702
  * @param txHash - transaction hash
@@ -794,6 +776,47 @@ class Thornode {
794
776
  throw new Error(`THORNode not responding`);
795
777
  });
796
778
  }
779
+ /**
780
+ *
781
+ * @returns Thorchain constants
782
+ */
783
+ getTcConstants() {
784
+ return __awaiter(this, void 0, void 0, function* () {
785
+ for (const api of this.networkApi) {
786
+ try {
787
+ const constants = yield api.constants();
788
+ if (constants.data.int_64_values) {
789
+ return constants.data.int_64_values;
790
+ }
791
+ }
792
+ catch (e) {
793
+ //console.error(e)
794
+ }
795
+ }
796
+ throw new Error(`THORNode not responding`);
797
+ });
798
+ }
799
+ /**
800
+ * Function that wraps Mimir and Constants to return the value from a given constant name. Searchs Mimir first.
801
+ *
802
+ * @param networkValueName the network value to be used to search the contsants
803
+ * @returns the mimir or constants value
804
+ */
805
+ getNetworkValues() {
806
+ return __awaiter(this, void 0, void 0, function* () {
807
+ const [mimirDetails, constantDetails] = yield Promise.all([this.getMimir(), this.getTcConstants()]);
808
+ const retVal = {};
809
+ // insert constants first
810
+ for (const [key, value] of Object.entries(constantDetails)) {
811
+ retVal[key.toUpperCase()] = parseInt(value);
812
+ }
813
+ // // mimir will overwrite any dupe constants
814
+ for (const [key, value] of Object.entries(mimirDetails)) {
815
+ retVal[key] = parseInt(value);
816
+ }
817
+ return retVal;
818
+ });
819
+ }
797
820
  /**
798
821
  *
799
822
  * @param asset - asset string
@@ -1102,7 +1125,7 @@ class ThorchainCache {
1102
1125
  refereshInboundDetailCache() {
1103
1126
  return __awaiter(this, void 0, void 0, function* () {
1104
1127
  const [mimirDetails, allInboundAddresses] = yield Promise.all([
1105
- this.midgard.getMimirDetails(),
1128
+ this.thornode.getMimir(),
1106
1129
  this.thornode.getInboundAddresses(),
1107
1130
  ]);
1108
1131
  const inboundDetails = {};
@@ -1158,7 +1181,7 @@ class ThorchainCache {
1158
1181
  */
1159
1182
  refereshNetworkValuesCache() {
1160
1183
  return __awaiter(this, void 0, void 0, function* () {
1161
- const networkValues = yield this.midgard.getNetworkValues();
1184
+ const networkValues = yield this.thornode.getNetworkValues();
1162
1185
  this.networkValuesCache = {
1163
1186
  lastRefreshed: Date.now(),
1164
1187
  networkValues,
@@ -1563,7 +1586,7 @@ class ThorchainQuery {
1563
1586
  ? params.input
1564
1587
  : yield this.thorchainCache.convert(params.input, params.input.asset);
1565
1588
  const inboundFeeInInboundGasAsset = calcNetworkFee(input.asset, sourceInboundDetails);
1566
- let outboundFeeInOutboundGasAsset = calcOutboundFee(params.destinationAsset, destinationInboundDetails);
1589
+ let outboundFeeInOutboundGasAsset = calcOutboundFee(params.destinationAsset, destinationInboundDetails).times(3);
1567
1590
  // Check outbound fee is equal too or greater than 1 USD * need to find a more permanent solution to this. referencing just 1 stable coin pool has problems
1568
1591
  if (params.destinationAsset.chain !== xchainThorchain.THORChain && !params.destinationAsset.synth) {
1569
1592
  const deepestUSDPOOL = yield this.thorchainCache.getDeepestUSDPool();
@@ -1573,13 +1596,12 @@ class ThorchainQuery {
1573
1596
  if (!checkOutboundFee) {
1574
1597
  const newFee = usdMinFee;
1575
1598
  outboundFeeInOutboundGasAsset = yield this.convert(newFee, xchainThorchain.AssetRuneNative);
1576
- console.log(outboundFeeInOutboundGasAsset.assetAmount.amount);
1577
1599
  }
1578
1600
  }
1579
1601
  // ----------- Remove Fees from inbound before doing the swap -----------
1580
1602
  const inboundFeeInInboundAsset = yield this.thorchainCache.convert(inboundFeeInInboundGasAsset, params.input.asset);
1581
- const inputMinusInboundFeeInAsset = input.minus(inboundFeeInInboundAsset);
1582
- // console.log('y', inputMinusInboundFeeInAsset.formatedAssetString())
1603
+ // if it a gas asset, take away inbound fee, else leave it as is. Still allow inboundFeeInInboundGasAsset to pass to swapEstimate.totalFees.inboundFee so user is aware if the gas requirements.
1604
+ const inputMinusInboundFeeInAsset = isNativeChainAsset(input.asset) ? input.minus(inboundFeeInInboundAsset) : input;
1583
1605
  // remove any affiliateFee. netInput * affiliateFee (percentage) of the destination asset type
1584
1606
  const affiliateFeePercent = params.affiliateFeeBasisPoints ? params.affiliateFeeBasisPoints / 10000 : 0;
1585
1607
  const affiliateFeeInAsset = inputMinusInboundFeeInAsset.times(affiliateFeePercent);
@@ -1600,6 +1622,7 @@ class ThorchainQuery {
1600
1622
  const swapOutputInDestinationAsset = yield this.thorchainCache.getExpectedSwapOutput(inputNetInAsset, params.destinationAsset);
1601
1623
  // ---------------- Remove Outbound Fee ---------------------- /
1602
1624
  const outboundFeeInDestinationAsset = yield this.thorchainCache.convert(outboundFeeInOutboundGasAsset, params.destinationAsset);
1625
+ //console.log(outboundFeeInDestinationAsset.formatedAssetString())
1603
1626
  const netOutputInAsset = swapOutputInDestinationAsset.output.minus(outboundFeeInDestinationAsset);
1604
1627
  const totalFees = {
1605
1628
  inboundFee: inboundFeeInInboundGasAsset,
@@ -1722,10 +1745,9 @@ class ThorchainQuery {
1722
1745
  let result = undefined;
1723
1746
  const inputInRune = yield this.thorchainCache.convert(params.input, xchainThorchain.AssetRuneNative);
1724
1747
  const feesInRune = yield this.getFeesIn(estimate.totalFees, xchainThorchain.AssetRuneNative);
1725
- const totalSwapFeesInRune = feesInRune.inboundFee
1726
- .plus(feesInRune.outboundFee)
1727
- .plus(feesInRune.swapFee)
1728
- .plus(feesInRune.affiliateFee);
1748
+ const totalSwapFeesInRune = !params.input.asset.synth && isNativeChainAsset(params.input.asset)
1749
+ ? feesInRune.inboundFee.plus(feesInRune.outboundFee).plus(feesInRune.swapFee).plus(feesInRune.affiliateFee)
1750
+ : feesInRune.outboundFee.plus(feesInRune.swapFee).plus(feesInRune.affiliateFee);
1729
1751
  const totalSwapFeesInAsset = yield this.thorchainCache.convert(totalSwapFeesInRune, params.input.asset);
1730
1752
  if (totalSwapFeesInRune.gte(inputInRune))
1731
1753
  result = `Input amount ${params.input.formatedAssetString()}(${inputInRune.formatedAssetString()}) is less than or equal to total swap fees ${totalSwapFeesInAsset.formatedAssetString()}(${totalSwapFeesInRune.formatedAssetString()}) `;
@@ -1813,7 +1835,8 @@ class ThorchainQuery {
1813
1835
  let txOutDelayRate = new CryptoAmount(xchainUtil.baseAmount(networkValues['TXOUTDELAYRATE']), xchainThorchain.AssetRuneNative).assetAmount
1814
1836
  .amount()
1815
1837
  .toNumber();
1816
- const getScheduledOutboundValue = yield this.thorchainCache.midgard.getScheduledOutboundValue();
1838
+ const getQueue = yield this.thorchainCache.thornode.getQueue();
1839
+ const outboundValue = new CryptoAmount(xchainUtil.baseAmount(getQueue.scheduled_outbound_value), xchainThorchain.AssetRuneNative);
1817
1840
  const thorChainblocktime = this.chainAttributes[xchainThorchain.THORChain].avgBlockTimeInSecs; // blocks required to confirm tx
1818
1841
  // If asset is equal to Rune set runeValue as outbound amount else set it to the asset's value in rune
1819
1842
  const runeValue = yield this.thorchainCache.convert(outboundAmount, xchainThorchain.AssetRuneNative);
@@ -1822,11 +1845,11 @@ class ThorchainQuery {
1822
1845
  return thorChainblocktime;
1823
1846
  }
1824
1847
  // Rune value in the outbound queue
1825
- if (getScheduledOutboundValue == undefined) {
1848
+ if (outboundValue == undefined) {
1826
1849
  throw new Error(`Could not return Scheduled Outbound Value`);
1827
1850
  }
1828
1851
  // Add OutboundAmount in rune to the oubound queue
1829
- const outboundAmountTotal = runeValue.plus(getScheduledOutboundValue);
1852
+ const outboundAmountTotal = runeValue.plus(outboundValue);
1830
1853
  // calculate the if outboundAmountTotal is over the volume threshold
1831
1854
  const volumeThreshold = outboundAmountTotal.div(minTxOutVolumeThreshold);
1832
1855
  // check delay rate
@@ -1918,7 +1941,7 @@ class ThorchainQuery {
1918
1941
  totalUnits: new bignumber_js.BigNumber(poolAsset.pool.liquidityUnits),
1919
1942
  liquidityUnits: new bignumber_js.BigNumber(liquidityProvider.units),
1920
1943
  };
1921
- const networkValues = yield this.thorchainCache.midgard.getNetworkValues();
1944
+ const networkValues = yield this.thorchainCache.thornode.getNetworkValues();
1922
1945
  const block = {
1923
1946
  current: blockData.thorchain,
1924
1947
  lastAdded: liquidityProvider.last_add_height,
@@ -2478,9 +2501,10 @@ class TransactionStage {
2478
2501
  const estimatedWaitTime = outboundBlock > currentTCHeight
2479
2502
  ? (outboundBlock - currentTCHeight) * this.chainAttributes[xchainThorchain.THORChain].avgBlockTimeInSecs
2480
2503
  : 0;
2504
+ const withdrawalAmount = yield this.getCryptoAmount(outAmount[0], asset);
2481
2505
  const withdrawLpInfo = {
2482
2506
  status,
2483
- withdrawalAmount: new CryptoAmount(xchainUtil.baseAmount(outAmount[0]), asset),
2507
+ withdrawalAmount,
2484
2508
  expectedConfirmationDate,
2485
2509
  thorchainHeight: currentTCHeight,
2486
2510
  outboundHeight: outboundBlock,
@@ -2527,9 +2551,10 @@ class TransactionStage {
2527
2551
  : 0;
2528
2552
  // if the TC has process the block that the outbound tx was assigned to then its completed.
2529
2553
  const status = txData.out_txs ? exports.WithdrawStatus.Complete : exports.WithdrawStatus.Incomplete;
2554
+ const withdrawalAmount = yield this.getCryptoAmount(outAmount[0], asset);
2530
2555
  const withdrawSaverInfo = {
2531
2556
  status,
2532
- withdrawalAmount: new CryptoAmount(xchainUtil.baseAmount(outAmount[0]), asset),
2557
+ withdrawalAmount,
2533
2558
  expectedConfirmationDate,
2534
2559
  thorchainHeight: currentTCHeight,
2535
2560
  finalisedHeight,
@@ -1,35 +1,16 @@
1
1
  import { Network } from '@xchainjs/xchain-client';
2
2
  import { Action, MemberDetails, PoolDetail, PoolStatsDetail, THORNameDetails } from '@xchainjs/xchain-midgard';
3
- import { CryptoAmount } from '../crypto-amount';
4
3
  import { MidgardConfig } from '../types';
5
4
  export declare class Midgard {
6
5
  private config;
7
6
  readonly network: Network;
8
7
  private midgardApis;
9
8
  constructor(network?: Network, config?: MidgardConfig);
10
- getMimirDetails(): Promise<Record<string, number>>;
11
9
  /**
12
10
  *
13
11
  * @returns an array of Pools
14
12
  */
15
13
  getPools(): Promise<PoolDetail[]>;
16
- /**
17
- *
18
- * @returns - constants
19
- */
20
- private getConstantsDetails;
21
- /**
22
- *
23
- * @returns the outbound Tx Value in RUNE (Basemount)
24
- */
25
- getScheduledOutboundValue(): Promise<CryptoAmount>;
26
- /**
27
- * Function that wraps Mimir and Constants to return the value from a given constant name. Searchs Mimir first.
28
- *
29
- * @param networkValueName the network value to be used to search the contsants
30
- * @returns the mimir or constants value
31
- */
32
- getNetworkValues(): Promise<Record<string, number>>;
33
14
  /**
34
15
  * Gets the latest block using the Health endpoint within Midgard
35
16
  *
@@ -49,7 +49,19 @@ export declare const getDoubleSwapFee: (inputAmount: CryptoAmount, pool1: Liquid
49
49
  */
50
50
  export declare const getDoubleSwap: (inputAmount: CryptoAmount, pool1: LiquidityPool, pool2: LiquidityPool, thorchainCache: ThorchainCache) => Promise<SwapOutput>;
51
51
  /**
52
- * Works out the required inbound or outbound fee based on the chain.
52
+ * Returns the native asset for a given chain
53
+ * @param chain
54
+ * @returns the gas asset type for the given chain
55
+ */
56
+ export declare const getChainAsset: (chain: Chain) => Asset;
57
+ /**
58
+ *
59
+ * @param asset
60
+ * @returns a boolean based on Assets being compared are equal
61
+ */
62
+ export declare const isNativeChainAsset: (asset: Asset) => boolean;
63
+ /**
64
+ * Works out the required inbound fee based on the chain.
53
65
  * Call getInboundDetails to get the current gasRate
54
66
  *
55
67
  * @param sourceAsset
@@ -68,12 +80,6 @@ export declare const calcNetworkFee: (asset: Asset, inbound: InboundDetail) => C
68
80
  * @returns
69
81
  */
70
82
  export declare const calcOutboundFee: (asset: Asset, inbound: InboundDetail) => CryptoAmount;
71
- /**
72
- * Return the chain for a given Asset This method should live somewhere else.
73
- * @param chain
74
- * @returns the gas asset type for the given chain
75
- */
76
- export declare const getChainAsset: (chain: Chain) => Asset;
77
83
  /**
78
84
  *
79
85
  * @param chain - input chain string
@@ -1,5 +1,5 @@
1
1
  import { Network } from '@xchainjs/xchain-client';
2
- import { InboundAddress, LastBlock, LiquidityProviderSummary, Pool, QuoteSaverDepositResponse, QuoteSaverWithdrawResponse, QuoteSwapResponse, Saver, SaversResponse, TxDetailsResponse, TxOutItem, TxResponse } from '@xchainjs/xchain-thornode';
2
+ import { InboundAddress, LastBlock, LiquidityProviderSummary, MimirResponse, Pool, QueueResponse, QuoteSaverDepositResponse, QuoteSaverWithdrawResponse, QuoteSwapResponse, Saver, SaversResponse, TxDetailsResponse, TxOutItem, TxResponse } from '@xchainjs/xchain-thornode';
3
3
  import { SaversWithdraw } from '../types';
4
4
  export declare type ThornodeConfig = {
5
5
  apiRetries: number;
@@ -15,6 +15,7 @@ export declare class Thornode {
15
15
  private liquidityProvidersApi;
16
16
  private saversApi;
17
17
  private quoteApi;
18
+ private mimirApi;
18
19
  constructor(network?: Network, config?: ThornodeConfig);
19
20
  /**
20
21
  * Returns the oubound transactions held by THORChain due to outbound delay
@@ -24,6 +25,22 @@ export declare class Thornode {
24
25
  *
25
26
  */
26
27
  getscheduledQueue(): Promise<TxOutItem[]>;
28
+ /**
29
+ * Returns queue
30
+ * May be empty if there are no transactions
31
+ *
32
+ * @returns {ScheduledQueueItem} Array
33
+ *
34
+ */
35
+ getQueue(): Promise<QueueResponse>;
36
+ /**
37
+ * Returns Mimir
38
+ * May be empty if there are no transactions
39
+ *
40
+ * @returns {ScheduledQueueItem} Array
41
+ *
42
+ */
43
+ getMimir(): Promise<MimirResponse>;
27
44
  /**
28
45
  *
29
46
  * @param txHash - transaction hash
@@ -47,6 +64,18 @@ export declare class Thornode {
47
64
  * @returns - thorchain pool
48
65
  */
49
66
  getPools(): Promise<Pool[]>;
67
+ /**
68
+ *
69
+ * @returns Thorchain constants
70
+ */
71
+ getTcConstants(): Promise<Record<string, string>>;
72
+ /**
73
+ * Function that wraps Mimir and Constants to return the value from a given constant name. Searchs Mimir first.
74
+ *
75
+ * @param networkValueName the network value to be used to search the contsants
76
+ * @returns the mimir or constants value
77
+ */
78
+ getNetworkValues(): Promise<Record<string, number>>;
50
79
  /**
51
80
  *
52
81
  * @param asset - asset string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain-query",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
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": [
@@ -42,7 +42,7 @@
42
42
  "@xchainjs/xchain-doge": "^0.5.6",
43
43
  "@xchainjs/xchain-ethereum": "^0.27.6",
44
44
  "@xchainjs/xchain-litecoin": "^0.10.8",
45
- "@xchainjs/xchain-midgard": "^0.4.0",
45
+ "@xchainjs/xchain-midgard": "^0.4.2",
46
46
  "@xchainjs/xchain-thorchain": "^0.27.7",
47
47
  "@xchainjs/xchain-thornode": "^0.2.0",
48
48
  "@xchainjs/xchain-util": "^0.12.0",
@@ -61,7 +61,7 @@
61
61
  "@xchainjs/xchain-bitcoin": "^0.20.7",
62
62
  "@xchainjs/xchain-litecoin": "^0.10.8",
63
63
  "@xchainjs/xchain-client": "^0.13.5",
64
- "@xchainjs/xchain-midgard": "^0.4.1",
64
+ "@xchainjs/xchain-midgard": "^0.4.2",
65
65
  "@xchainjs/xchain-thorchain": "^0.27.7",
66
66
  "@xchainjs/xchain-thornode": "^0.2.0",
67
67
  "@xchainjs/xchain-util": "^0.12.0",