@orca-so/whirlpool-sdk
Version:
Whirlpool SDK for the Orca protocol.
62 lines (61 loc) • 1.86 kB
TypeScript
import { u64 } from "@solana/spl-token";
import { Address, BN } from "@project-serum/anchor";
import Decimal from "decimal.js";
import { Percentage } from "../utils/public/percentage";
/*** Quotes ***/
export declare type OpenPositionQuoteParam = OpenPositionQuoteByPrice | OpenPositionQuoteByTickIndex;
export declare type OpenPositionQuoteByPrice = BaseOpenPositionQuoteParam & {
priceLower: Decimal;
priceUpper: Decimal;
};
export declare type OpenPositionQuoteByTickIndex = BaseOpenPositionQuoteParam & {
tickLowerIndex: number;
tickUpperIndex: number;
};
declare type BaseOpenPositionQuoteParam = {
poolAddress: Address;
tokenMint: Address;
tokenAmount: u64;
refresh: boolean;
slippageTolerance?: Percentage;
};
export declare type OpenPositionQuote = {
poolAddress: Address;
tickLowerIndex: number;
tickUpperIndex: number;
maxTokenA: u64;
maxTokenB: u64;
liquidity: BN;
};
export declare type ClosePositionQuoteParam = {
positionAddress: Address;
refresh: boolean;
slippageTolerance?: Percentage;
};
export declare type ClosePositionQuote = {
positionAddress: Address;
minTokenA: u64;
minTokenB: u64;
liquidity: BN;
};
export declare type SwapQuoteParam = {
poolAddress: Address;
tokenMint: Address;
tokenAmount: u64;
isInput: boolean;
slippageTolerance?: Percentage;
refresh: boolean;
};
export declare type SwapQuote = {
poolAddress: Address;
otherAmountThreshold: u64;
sqrtPriceLimitX64: BN;
amountIn: u64;
amountOut: u64;
aToB: boolean;
fixedInput: boolean;
};
/*** Type Guards ***/
export declare function isQuoteByPrice(param: OpenPositionQuoteParam): param is OpenPositionQuoteByPrice;
export declare function isQuoteByTickIndex(param: OpenPositionQuoteParam): param is OpenPositionQuoteByTickIndex;
export {};