@orca-so/whirlpool-sdk
Version:
Whirlpool SDK for the Orca protocol.
55 lines (54 loc) • 1.62 kB
TypeScript
/// <reference types="bn.js" />
import { WhirlpoolData } from "@orca-so/whirlpool-client-sdk";
import { Address, BN } from "@project-serum/anchor";
import { u64 } from "@solana/spl-token";
import { OrcaDAL } from "../../dal/orca-dal";
export declare const MAX_TICK_ARRAY_CROSSINGS = 2;
export declare enum SwapDirection {
AtoB = "Swap A to B",
BtoA = "Swap B to A"
}
export declare enum AmountSpecified {
Input = "Specified input amount",
Output = "Specified output amount"
}
declare type SwapSimulationBaseInput = {
refresh: boolean;
dal: OrcaDAL;
poolAddress: Address;
whirlpoolData: WhirlpoolData;
amountSpecified: AmountSpecified;
swapDirection: SwapDirection;
};
declare type SwapSimulationInput = {
amount: BN;
currentSqrtPriceX64: BN;
currentTickIndex: number;
currentLiquidity: BN;
};
declare type SwapSimulationOutput = {
amountIn: BN;
amountOut: BN;
sqrtPriceLimitX64: BN;
};
declare type SwapStepSimulationInput = {
sqrtPriceX64: BN;
tickIndex: number;
liquidity: BN;
amountRemaining: u64;
tickArraysCrossed: number;
};
declare type SwapStepSimulationOutput = {
nextSqrtPriceX64: BN;
nextTickIndex: number;
input: BN;
output: BN;
tickArraysCrossed: number;
hasReachedNextTick: boolean;
};
export declare class SwapSimulator {
constructor();
simulateSwap(baseInput: SwapSimulationBaseInput, input: SwapSimulationInput): Promise<SwapSimulationOutput>;
simulateSwapStep(baseInput: SwapSimulationBaseInput, input: SwapStepSimulationInput): Promise<SwapStepSimulationOutput>;
}
export {};