Thorchain Cache
ThorchainCache
This class manages retrieving information from up to date Thorchain
Parameters
thornodean instance of the thornode API (could be pointing to stagenet,testnet,mainnet) (optional, defaultdefaultThornode)midgardQueryan instance of the midgard query class (could be pointing to stagenet,testnet,mainnet) (optional, defaultdefaultMidgardQuery)expirePoolCacheMillishow long should the pools be cached before expiry (optional, default6000)expireInboundDetailsCacheMillishow long should the InboundDetails be cached before expiry (optional, default6000)expireNetworkValuesCacheMillishow long should the Mimir/Constants be cached before expiry (optional, defaultTEN_MINUTES)
getExchangeRate
Gets the exchange rate of the from asset in terms on the to asset
Parameters
fromtoassetcannot be RUNE.
Returns any Promise
getPoolForAsset
Gets the Liquidity Pool for a given Asset
Parameters
assetcannot 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
inputamount/asset to convert to outAssetoutAssetthe Asset you want to convert to
Returns any CryptoAmount of input
getInboundDetails
Returns any inbound details
getNetworkValues
Returns any network values