UNPKG

@renec-foundation/redex-sdk

Version:

Typescript SDK to interact with Orca's Whirlpool program.

61 lines (60 loc) 3.13 kB
/// <reference types="bn.js" /> import { Percentage } from "@orca-so/common-sdk"; import { Address, BN } from "@project-serum/anchor"; import { u64 } from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; import Decimal from "decimal.js"; import { IncreaseLiquidityInput } from "../../instructions"; import { Whirlpool } from "../../whirlpool-client"; /** * @category Quotes * @param inputTokenAmount - The amount of input tokens to deposit. * @param inputTokenMint - The mint of the input token the user would like to deposit. * @param tokenMintA - The mint of tokenA in the Whirlpool the user is depositing into. * @param tokenMintB -The mint of tokenB in the Whirlpool the user is depositing into. * @param tickCurrentIndex - The Whirlpool's current tickIndex * @param sqrtPrice - The Whirlpool's current sqrtPrice * @param tickLowerIndex - The lower index of the position that we are withdrawing from. * @param tickUpperIndex - The upper index of the position that we are withdrawing from. * @param slippageTolerance - The maximum slippage allowed when calculating the minimum tokens received. */ export declare type IncreaseLiquidityQuoteParam = { inputTokenAmount: u64; inputTokenMint: PublicKey; tokenMintA: PublicKey; tokenMintB: PublicKey; tickCurrentIndex: number; sqrtPrice: BN; tickLowerIndex: number; tickUpperIndex: number; slippageTolerance: Percentage; }; /** * Return object from increase liquidity quote functions. * @category Quotes */ export declare type IncreaseLiquidityQuote = IncreaseLiquidityInput & { tokenEstA: u64; tokenEstB: u64; }; /** * Get an estimated quote on the maximum tokens required to deposit based on a specified input token amount. * * @category Quotes * @param inputTokenAmount - The amount of input tokens to deposit. * @param inputTokenMint - The mint of the input token the user would like to deposit. * @param tickLower - The lower index of the position that we are withdrawing from. * @param tickUpper - The upper index of the position that we are withdrawing from. * @param slippageTolerance - The maximum slippage allowed when calculating the minimum tokens received. * @param whirlpool - A Whirlpool helper class to help interact with the Whirlpool account. * @returns An IncreaseLiquidityInput object detailing the required token amounts & liquidity values to use when calling increase-liquidity-ix. */ export declare function increaseLiquidityQuoteByInputToken(inputTokenMint: Address, inputTokenAmount: Decimal, tickLower: number, tickUpper: number, slippageTolerance: Percentage, whirlpool: Whirlpool): IncreaseLiquidityQuote; /** * Get an estimated quote on the maximum tokens required to deposit based on a specified input token amount. * * @category Quotes * @param param IncreaseLiquidityQuoteParam * @returns An IncreaseLiquidityInput object detailing the required token amounts & liquidity values to use when calling increase-liquidity-ix. */ export declare function increaseLiquidityQuoteByInputTokenWithParams(param: IncreaseLiquidityQuoteParam): IncreaseLiquidityQuote;