UNPKG

@kamino-finance/kliquidity-sdk

Version:

Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol

40 lines 2.9 kB
import { BN } from '@coral-xyz/anchor'; import { Address, GetAccountInfoApi, GetMultipleAccountsApi, Rpc } from '@solana/kit'; import { ProgramDerivedAddress } from '@solana/addresses/dist/types/program-derived-address'; import { Percentage } from './types'; import { IncreaseLiquidityQuoteParam } from '@orca-so/whirlpools'; import { Whirlpool } from '../@codegen/whirlpools/accounts'; import { IncreaseLiquidityQuote, TransferFee } from '@orca-so/whirlpools-core'; import { Whirlpool as WhirlpoolAPIResponse } from '../services/OrcaWhirlpoolsResponse'; import Decimal from 'decimal.js/decimal'; export declare const defaultSlippagePercentageBPS = 10; export declare function getTickArray(programId: Address, whirlpoolAddress: Address, startTick: number): Promise<ProgramDerivedAddress>; export declare function getTokenAFromLiquidity(liquidity: BN, sqrtPrice0X64: BN, sqrtPrice1X64: BN, roundUp: boolean): BN; export declare function getTokenBFromLiquidity(liquidity: BN, sqrtPrice0X64: BN, sqrtPrice1X64: BN, roundUp: boolean): BN; export declare function getNearestValidTickIndexFromTickIndex(tickIndex: number, tickSpacing: number): number; export declare function getIncreaseLiquidityQuote(param: IncreaseLiquidityQuoteParam, pool: Whirlpool, tickLowerIndex: number, tickUpperIndex: number, slippageToleranceBps: number, transferFeeA: TransferFee | undefined, transferFeeB: TransferFee | undefined): IncreaseLiquidityQuote; export declare function adjustForSlippage(n: BN, { numerator, denominator }: Percentage, adjustUp: boolean): BN; export type EstimatedAprs = { fee: number; rewards: number[]; }; export declare const ZERO_APR: { fee: number; rewards: number[]; }; export declare function estimateAprsForPriceRange(pool: WhirlpoolAPIResponse, tokenPrices: Map<Address, Decimal>, fees24h: number, tickLowerIndex: number, tickUpperIndex: number, rewardsDecimals: Map<Address, number>): EstimatedAprs; export declare function getLowestInitializedTickArrayTickIndex(rpc: Rpc<GetAccountInfoApi>, whirlpoolAddress: Address, tickSpacing: number): Promise<number>; export declare function getHighestInitializedTickArrayTickIndex(rpc: Rpc<GetAccountInfoApi>, whirlpoolAddress: Address, tickSpacing: number): Promise<number>; export type LiquidityDataPoint = { liquidity: Decimal; price: Decimal; tickIndex: number; }; export type WhirlpoolLiquidityDistribution = { currentPrice: Decimal; currentTickIndex: number; datapoints: LiquidityDataPoint[]; }; export declare function getLiquidityDistribution(rpc: Rpc<GetMultipleAccountsApi>, poolAddress: Address, poolData: WhirlpoolAPIResponse, tickLower: number, tickUpper: number, whirlpoolProgramId: Address): Promise<WhirlpoolLiquidityDistribution>; export declare function getTickArrayPda(programId: Address, poolAddress: Address, startIndex: number): Promise<[Address, number]>; //# sourceMappingURL=orca.d.ts.map