ThorchainQuery Class for interacting with THORChain. Recommended main class to use for swapping with THORChain Has access to Midgard and THORNode data

Constructors

Properties

chainAttributes: Record<string, ChainAttributes>
thorchainCache: ThorchainCache

Methods

  • Finds the required confCount required for an inbound or outbound Tx to THORChain. Estimate based on Midgard data only. Finds the gas asset of the given asset (e.g. BUSD is on BNB), finds the value of asset in Gas Asset then finds the required confirmation count. ConfCount is then times by 6 seconds.

    Parameters

    • inbound: CryptoAmount

    Returns Promise<number>

    time in seconds before a Tx is confirmed by THORChain

  • Returns the exchange of a CryptoAmount to a different Asset Ex. convert(input:100 BUSD, outAsset: BTC) -> 0.0001234 BTC

    Parameters

    • input: CryptoAmount

      amount/asset to convert to outAsset

    • outAsset: Asset

    Returns Promise<CryptoAmount>

    CryptoAmount of input

  • Generate the memo and estimate the cost of registering or updating a THORName.

    Parameters

    Returns Promise<{
        memo: string;
        value: CryptoAmount;
    }>

    Memo and value of deposit.

  • Get errors related to estimating the addition of funds to a saver's pool.

    Parameters

    • addAmount: CryptoAmount

      Amount of funds to be added to the saver's pool.

    Returns Promise<string[]>

    An array of strings representing any errors encountered during the estimation process.

  • Convenience method to convert TotalFees to a different CryptoAmount TotalFees are always calculated and returned in RUNE, this method can be used to show the equivalent fees in another Asset Type

    Parameters

    Returns Promise<TotalFees>

    TotalFees in asset

  • Validate a cryptoAmount is well formed

    Parameters

    • cryptoAmount: CryptoAmount

      CryptoAmount to validate

    Returns Promise<void | Error>

    Error if the cryptoAmount is not well formed

Generated using TypeDoc