• Public
  • Public/Protected
  • All


  • PoolUtil



  • compareMints(mintX: Address, mintY: Address): number
  • getFeeRate(feeRate: number): Percentage
  • getProtocolFeeRate(protocolFeeRate: number): Percentage
  • Return the corresponding token type (TokenA/B) for this mint key for a Whirlpool.


    • pool: WhirlpoolData

      The Whirlpool to evaluate the mint against

    • mint: PublicKey

      The token mint PublicKey

    Returns undefined | TokenType

    The match result in the form of TokenType enum. undefined if the token mint is not part of the trade pair of the pool.

  • orderMints(mintX: Address, mintY: Address): [Address, Address]

Whirlpool Utils

  • estimateLiquidityFromTokenAmounts(currTick: number, lowerTick: number, upperTick: number, tokenAmount: TokenAmounts): BN
  • Estimate the liquidity amount required to increase/decrease liquidity.

    // TODO: At the top end of the price range, tick calcuation is off therefore the results can be off


    • currTick: number

      Whirlpool's current tick index (aka price)

    • lowerTick: number

      Position lower tick index

    • upperTick: number

      Position upper tick index

    • tokenAmount: TokenAmounts

      The desired amount of tokens to deposit/withdraw

    Returns BN

    An estimated amount of liquidity needed to deposit/withdraw the desired amount of tokens.

  • getTokenAmountsFromLiquidity(liquidity: BN, currentSqrtPrice: BN, lowerSqrtPrice: BN, upperSqrtPrice: BN, round_up: boolean): TokenAmounts
  • toBaseQuoteOrder(tokenMintAKey: PublicKey, tokenMintBKey: PublicKey): [PublicKey, PublicKey]
  • Given an arbitrary pair of token mints, this function returns an ordering of the token mints in the format [base, quote]. USD based stable coins are prioritized as the quote currency followed by variants of SOL.


    • tokenMintAKey: PublicKey

      The mint of token A in the token pair.

    • tokenMintBKey: PublicKey

      The mint of token B in the token pair.

    Returns [PublicKey, PublicKey]

    A two-element array with the tokens sorted in the order of [baseToken, quoteToken].

Generated using TypeDoc