Thorchain Cache


This class manages retrieving information from up to date Thorchain


  • midgard an instance of the midgard API (could be pointing to stagenet,testnet,mainnet) (optional, default defaultMidgard)
  • thornode (optional, default defaultThornode)
  • expirePoolCacheMillis how long should the pools be cached before expiry (optional, default 6000)
  • expireInboundDetailsCacheMillis how long should the InboundDetails be cached before expiry (optional, default 6000)
  • expireNetworkValuesCacheMillis how long should the Mimir/Constants be cached before expiry (optional, default TEN_MINUTES)
  • expireAsgardCacheMillis how long should the inboundAsgard Addresses be cached before expiry


Gets the exchange rate of the from asset in terms on the to asset


  • from
  • to
  • asset cannot be RUNE.

Returns any Promise


Gets the Liquidity Pool for a given Asset


  • asset cannot be RUNE, since Rune is the other side of each pool.

Returns any Promise


Get all the Liquidity Pools currently cached. if the cache is expired, the pools wioll be re-fetched from midgard

Returns any Promise<Record<string, LiquidityPool»


Refreshes the Pool Cache

NOTE: do not call refereshPoolCache() directly, call getPools() instead which will refresh the cache if it's expired


Refreshes the InboundDetailCache Cache

NOTE: do not call refereshInboundDetailCache() directly, call getInboundDetails() instead which will refresh the cache if it's expired


Refreshes the NetworkValuesCache Cache

NOTE: do not call refereshNetworkValuesCache() directly, call getNetworkValuess() instead which will refresh the cache if it's expired


Calcuate the expected slip, output & swapFee given the current pool depths

swapFee - the amount of asset lost according to slip calculations slip - the percent (0-1) of original amount lost to slipfees output - the amount of asset expected from the swap *


  • inputAmount CryptoAmount amount to swap from
  • destinationAsset destimation Asset to swap to

Returns any SwapOutput - swap output object - output - fee - slip


Returns the exchange of a CryptoAmount to a different Asset

Ex. convert(input:100 BUSD, outAsset: BTC) -> 0.0001234 BTC


  • input amount/asset to convert to outAsset
  • outAsset the Asset you want to convert to

Returns any CryptoAmount of input


Returns any inbound details


Returns any network values