Documentation
    Preparing search index...

    Function swapQuoteByOutputToken

    • Get an estimated swap quote using an output token amount.

      Use this quote to get an estimated amount of input token needed to receive the defined output token amount.

      Parameters

      • whirlpool: Whirlpool

        Whirlpool to perform the swap on

      • outputTokenMint: Address

        PublicKey for the output token mint to swap into

      • tokenAmount: BN

        The maximum amount of output token to receive in this swap.

      • slippageTolerance: Percentage

        The amount of slippage to account for in this quote

      • programId: Address

        PublicKey for the Whirlpool ProgramId

      • fetcher: WhirlpoolAccountFetcherInterface
      • Optionalopts: SimpleAccountFetchOptions

        an WhirlpoolAccountFetchOptions object to define fetch and cache options when accessing on-chain accounts

      • useFallbackTickArray: UseFallbackTickArray = UseFallbackTickArray.Never

        An enum to specify when to use fallback tick array in a swap quote.

      • OptionaltimestampInSeconds: BN

        Optional parameter to generate this quote to a unix time stamp.

      Returns Promise<SwapQuote>

      a SwapQuote object with slippage adjusted SwapInput parameters & estimates on token amounts, fee & end whirlpool states.