@orca-so/whirlpool-sdk
Version:
Whirlpool SDK for the Orca protocol.
45 lines (44 loc) • 2.27 kB
TypeScript
/// <reference types="bn.js" />
import { Address, BN } from "@project-serum/anchor";
import { TickArrayData, TickData, PDA } from "@orca-so/whirlpool-client-sdk";
import { PublicKey } from "@solana/web3.js";
export declare class TickUtil {
private constructor();
/**
* Get the nearest (rounding down) valid tick index from the tickIndex.
* A valid tick index is a point on the tick spacing grid line.
*/
static toValid(tickIndex: number, tickSpacing: number): number;
/**
* Get the tick from tickArray with a global tickIndex.
*/
static getTick(tickArray: TickArrayData, tickIndex: number, tickSpacing: number): TickData;
static getLowerAndUpperTickArrayAddresses(tickLowerIndex: number, tickUpperIndex: number, tickSpacing: number, whirlpool: PublicKey, programId: PublicKey): [PublicKey, PublicKey];
/**
* Get the PDA of the tick array containing tickIndex.
* tickArrayOffset can be used to get neighboring tick arrays.
*/
static getPdaWithTickIndex(tickIndex: number, tickSpacing: number, whirlpool: Address, programId: Address, tickArrayOffset?: number): PDA;
static getPDAWithSqrtPrice(sqrtPriceX64: BN, tickSpacing: number, whirlpool: Address, programId: Address, tickArrayOffset?: number): PDA;
/**
* Get the startIndex of the tick array containing tickIndex.
*
* @param tickIndex
* @param tickSpacing
* @param offset can be used to get neighboring tick array startIndex.
* @returns
*/
static getStartTickIndex(tickIndex: number, tickSpacing: number, offset?: number): number;
/**
* Get the previous initialized tick index within the same tick array.
*/
static getPrevInitializedTickIndex(account: TickArrayData, currentTickIndex: number, tickSpacing: number): number | null;
/**
* Get the next initialized tick index within the same tick array.
*/
static getNextInitializedTickIndex(account: TickArrayData, currentTickIndex: number, tickSpacing: number): number | null;
private static findInitializedTick;
private static tickIndexToTickArrayIndex;
private static tickArrayIndexToTickIndex;
static getNextInitializableTickIndex(tickIndex: number, tickSpacing: number, aToB: boolean): number;
}