Documentation
    Preparing search index...
    Index

    Other

    • Return the corresponding token type (TokenA/B) for this mint key for a Whirlpool.

      Parameters

      • 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.

    • Parameters

      • mintX: Address
      • mintY: Address

      Returns [Address, Address]

    Whirlpool Utils

    • 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

      Parameters

      • 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.

      Please use estimateMaxLiquidityFromTokenAmounts instead.

    • Estimate the liquidity amount required to increase/decrease liquidity.

      Parameters

      • sqrtPriceX64: BN

        Whirlpool's current sqrt price

      • tickLowerIndex: number

        Position lower tick index

      • tickUpperIndex: 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.

    • Parameters

      • liquidity: BN
      • currentSqrtPrice: BN
      • lowerSqrtPrice: BN
      • upperSqrtPrice: BN
      • round_up: boolean

      Returns TokenAmounts

    • 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.

      Parameters

      • 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].