Thorchain Cache

ThorchainCache

This class manages retrieving information from up to date Thorchain

Parameters

  • thornode an instance of the thornode API (could be pointing to stagenet,testnet,mainnet) (optional, default defaultThornode)
  • midgardQuery an instance of the midgard query class (could be pointing to stagenet,testnet,mainnet) (optional, default defaultMidgardQuery)
  • 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)

getExchangeRate

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

Parameters

  • from
  • to
  • asset cannot be RUNE.

Returns any Promise

getPoolForAsset

Gets the Liquidity Pool for a given Asset

Parameters

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

Returns any Promise

getPools

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

Returns any Promise<Record<string, LiquidityPool»

refreshPoolCache

Refreshes the Pool Cache

refreshInboundDetailCache

Refreshes the InboundDetailCache Cache

convert

Returns the exchange of a CryptoAmount to a different Asset

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

Parameters

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

Returns any CryptoAmount of input

getInboundDetails

Returns any inbound details

getNetworkValues

Returns any network values