@renec-foundation/redex-sdk
Version:
Typescript SDK to interact with Orca's Whirlpool program.
145 lines (144 loc) • 3.52 kB
TypeScript
/// <reference types="bn.js" />
import { BN, BorshAccountsCoder } from "@project-serum/anchor";
import { PublicKey } from "@solana/web3.js";
/**
* This file contains the types that has the same structure as the types anchor functions returns.
* These types are hard-casted by the client function.
*
* This file must be manually updated every time the idl updates as accounts will
* be hard-casted to fit the type.
*/
/**
* Supported parasable account names from the Whirlpool contract.
* @category Parsables
*/
export declare enum AccountName {
WhirlpoolsConfig = "WhirlpoolsConfig",
Position = "Position",
TickArray = "TickArray",
Whirlpool = "Whirlpool",
FeeTier = "FeeTier"
}
/**
* The Anchor coder for the Whirlpool program.
* @category Solana Accounts
*/
export declare const WHIRLPOOL_CODER: BorshAccountsCoder<string>;
/**
* Size of the Whirlpool account in bytes.
* @category Solana Accounts
*/
export declare const WHIRLPOOL_ACCOUNT_SIZE: number;
/**
* @category Solana Accounts
*/
export declare type WhirlpoolsConfigData = {
feeAuthority: PublicKey;
collectProtocolFeesAuthority: PublicKey;
rewardEmissionsSuperAuthority: PublicKey;
poolCreatorAuthority: PublicKey;
defaultFeeRate: number;
defaultProtocolFeeRate: number;
};
/**
* @category Solana Accounts
*/
export declare type WhirlpoolRewardInfoData = {
mint: PublicKey;
vault: PublicKey;
authority: PublicKey;
emissionsPerSecondX64: BN;
growthGlobalX64: BN;
};
/**
* @category Solana Accounts
*/
export declare type WhirlpoolBumpsData = {
whirlpoolBump: number;
};
/**
* @category Solana Accounts
*/
export declare type WhirlpoolData = {
isEnabled: boolean;
whirlpoolsConfig: PublicKey;
whirlpoolBump: number[];
feeRate: number;
protocolFeeRate: number;
liquidity: BN;
sqrtPrice: BN;
tickCurrentIndex: number;
protocolFeeOwedA: BN;
protocolFeeOwedB: BN;
tokenMintA: PublicKey;
tokenVaultA: PublicKey;
feeGrowthGlobalA: BN;
tokenMintB: PublicKey;
tokenVaultB: PublicKey;
feeGrowthGlobalB: BN;
rewardLastUpdatedTimestamp: BN;
rewardInfos: WhirlpoolRewardInfoData[];
tickSpacing: number;
};
/**
* @category Solana Accounts
*/
export declare type TickArrayData = {
whirlpool: PublicKey;
startTickIndex: number;
ticks: TickData[];
};
/**
* @category Solana Accounts
*/
export declare type TickData = {
initialized: boolean;
liquidityNet: BN;
liquidityGross: BN;
feeGrowthOutsideA: BN;
feeGrowthOutsideB: BN;
rewardGrowthsOutside: BN[];
};
/**
* @category Solana Accounts
*/
export declare type PositionRewardInfoData = {
growthInsideCheckpoint: BN;
amountOwed: BN;
};
/**
* @category Solana Accounts
*/
export declare type OpenPositionBumpsData = {
positionBump: number;
};
/**
* @category Solana Accounts
*/
export declare type OpenPositionWithMetadataBumpsData = {
positionBump: number;
metadataBump: number;
};
/**
* @category Solana Accounts
*/
export declare type PositionData = {
whirlpool: PublicKey;
positionMint: PublicKey;
liquidity: BN;
tickLowerIndex: number;
tickUpperIndex: number;
feeGrowthCheckpointA: BN;
feeOwedA: BN;
feeGrowthCheckpointB: BN;
feeOwedB: BN;
rewardInfos: PositionRewardInfoData[];
};
/**
* @category Solana Accounts
*/
export declare type FeeTierData = {
whirlpoolsConfig: PublicKey;
tickSpacing: number;
defaultFeeRate: number;
};