Fetch the current swap price for a given liquidity pool

Input: None

Returns: The swap price for a given AMM pool.

Example: Fetch the exchange rate from the Orca SOL/USDC pool

{ "lpExchangeRateTask": { "orcaPoolAddress": "APDFRM3HMr8CAGXwKHiu2f5ePSpaiEJhaURwhsRrUUt9" } }

Example: Fetch the exchange rate from the Raydium SOL/USDC pool

{ "lpExchangeRateTask": { "raydiumPoolAddress": "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2" } }

Implements

Constructors

Properties

PoolAddress?: "mercurialPoolAddress" | "saberPoolAddress" | "orcaPoolAddress" | "raydiumPoolAddress" | "orcaPoolTokenMintAddress" | "portReserveAddress"

LpExchangeRateTask PoolAddress.

inTokenAddress: string

Used alongside mercurial_pool_address to specify the input token for a swap.

mercurialPoolAddress?: string

Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js

orcaPoolAddress?: string

Pool address for an Orca LP pool or whirlpool. A full list of Orca LP pools can be found here: https://www.orca.so/pools

orcaPoolTokenMintAddress?: string

@deprecated Use orcaPoolAddress

outTokenAddress: string

Used alongside mercurial_pool_address to specify the output token for a swap.

portReserveAddress?: string

The Port reserve pubkey. A full list can be found here: https://api-v1.port.finance/reserves

raydiumPoolAddress?: string

The Raydium liquidity pool ammId. A full list can be found here: https://raydium.io/pools

saberPoolAddress?: string

Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist

Methods

  • Converts this LpExchangeRateTask to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new LpExchangeRateTask instance using the specified properties.

    Parameters

    Returns LpExchangeRateTask

    LpExchangeRateTask instance

  • Decodes a LpExchangeRateTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns LpExchangeRateTask

    LpExchangeRateTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes a LpExchangeRateTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns LpExchangeRateTask

    LpExchangeRateTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified LpExchangeRateTask message. Does not implicitly verify messages.

    Parameters

    • message: ILpExchangeRateTask

      LpExchangeRateTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified LpExchangeRateTask message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: ILpExchangeRateTask

      LpExchangeRateTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a LpExchangeRateTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns LpExchangeRateTask

    LpExchangeRateTask

  • Gets the default type url for LpExchangeRateTask

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from a LpExchangeRateTask message. Also converts values to other types if specified.

    Parameters

    • message: LpExchangeRateTask

      LpExchangeRateTask

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies a LpExchangeRateTask message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not