PriceModule is a static class that provides functions for fetching and calculating token prices for a set of pools or mints.

PriceModule will be removed in the future release. Please use endpoint which provides prices.

Other

  • Fetches and calculates the prices for a set of tokens. This method will derive the pools that need to be queried from the mints and is not performant.

    Parameters

    Returns Promise<PriceMap>

    A map of token addresses to prices.

    PriceModule will be removed in the future release. Please use endpoint which provides prices.

PriceModule

  • Calculate the price of each token in the mints array.

    Each token will be priced against the first quote token in the config.quoteTokens array with sufficient liquidity. If a token does not have sufficient liquidity against the first quote token, then it will be priced against the next quote token in the array. If a token does not have sufficient liquidity against any quote token, then the price will be set to null.

    Parameters

    • mints: Address[]

      The mints to calculate prices for.

    • priceCalcData: PriceCalculationData

      The data required to calculate prices.

    • config: GetPricesConfig = defaultGetPricesConfig

      The configuration for the price calculation.

    • thresholdConfig: GetPricesThresholdConfig = defaultGetPricesThresholdConfig

      The threshold configuration for the price calculation.

    Returns PriceMap

    A map of token addresses to prices.

    PriceModule will be removed in the future release. Please use endpoint which provides prices.