import { Connection, PublicKey, Signer, TransactionInstruction } from "@solana/web3.js"; import BN from "bn.js"; import { Base, InnerTransaction, InstructionType, TokenAccount, TxVersion } from "../base"; import { GetMultipleAccountsInfoConfig } from "../common"; import { BigNumberish } from "../entity"; import { SplAccount } from "../spl"; import { FarmLedger, FarmState } from "./layout"; export declare const poolTypeV6: { readonly 'Standard SPL': 0; readonly 'Option tokens': 1; }; export type FarmPoolKeys = { readonly id: PublicKey; readonly lpMint: PublicKey; readonly version: number; readonly programId: PublicKey; readonly authority: PublicKey; readonly lpVault: PublicKey; readonly upcoming: boolean; readonly rewardInfos: ({ readonly rewardMint: PublicKey; readonly rewardVault: PublicKey; } | { readonly rewardMint: PublicKey; readonly rewardVault: PublicKey; readonly rewardOpenTime: number; readonly rewardEndTime: number; readonly rewardPerSecond: number; readonly rewardType: keyof typeof poolTypeV6; })[]; }; /** * Full user keys that build transaction need */ export interface FarmUserKeys { ledger: PublicKey; auxiliaryLedgers?: PublicKey[]; lpTokenAccount: PublicKey; rewardTokenAccounts: PublicKey[]; owner: PublicKey; } export interface FarmRewardInfo { rewardMint: PublicKey; rewardPerSecond: BigNumberish; rewardOpenTime: BigNumberish; rewardEndTime: BigNumberish; rewardType: keyof typeof poolTypeV6; } export interface FarmDepositInstructionParams { poolKeys: FarmPoolKeys; userKeys: FarmUserKeys; amount: BigNumberish; } export type FarmWithdrawInstructionParams = FarmDepositInstructionParams; export interface FarmCreateAssociatedLedgerAccountInstructionParams { poolKeys: FarmPoolKeys; userKeys: { ledger: PublicKey; owner: PublicKey; }; } export interface FarmCreateInstructionParamsV6 { version: 6; programId: PublicKey; lpMint: PublicKey; rewardInfos: { rewardMint: PublicKey; rewardPerSecond: BigNumberish; rewardOpenTime: BigNumberish; rewardEndTime: BigNumberish; rewardType: keyof typeof poolTypeV6; }[]; lockInfo: { lockMint: PublicKey; lockVault: PublicKey; }; } export type FarmCreateInstructionParams = FarmCreateInstructionParamsV6; export interface FarmRestartInstructionParamsV6 { connection: Connection; poolKeys: FarmPoolKeys; userKeys: { tokenAccounts: TokenAccount[]; owner: PublicKey; payer?: PublicKey; }; newRewardInfo: FarmRewardInfo; } export type FarmRestartInstructionParams = FarmRestartInstructionParamsV6; export interface FarmCreatorWithdrawRewardInstructionParamsV6 { poolKeys: FarmPoolKeys; userKeys: { userRewardToken: PublicKey; owner: PublicKey; payer?: PublicKey; }; withdrawMint: PublicKey; } export type FarmCreatorWithdrawRewardInstructionParams = FarmCreatorWithdrawRewardInstructionParamsV6; export interface FarmCreatorWithdrawRewardInstructionSimpleParamsV6 { connection: Connection; poolKeys: FarmPoolKeys; userKeys: { tokenAccounts: TokenAccount[]; owner: PublicKey; payer?: PublicKey; }; withdrawMint: PublicKey; } export type FarmCreatorWithdrawRewardInstructionSimpleParams = FarmCreatorWithdrawRewardInstructionSimpleParamsV6; export interface FarmCreatorAddRewardTokenInstructionParamsV6 { connection: Connection; poolKeys: FarmPoolKeys; userKeys: { tokenAccounts: TokenAccount[]; owner: PublicKey; payer?: PublicKey; }; newRewardInfo: FarmRewardInfo; } export type FarmCreatorAddRewardTokenInstructionParams = FarmCreatorAddRewardTokenInstructionParamsV6; export interface MakeCreateFarmInstructionParamsV6 { connection: Connection; userKeys: { tokenAccounts: TokenAccount[]; owner: PublicKey; payer?: PublicKey; }; poolInfo: FarmCreateInstructionParams; } export type makeCreateFarmInstructionParams = MakeCreateFarmInstructionParamsV6; export interface MakeCreateFarmInstructionParamsV6Simple { connection: Connection; userKeys: { tokenAccounts: TokenAccount[]; owner: PublicKey; payer?: PublicKey; }; poolInfo: FarmCreateInstructionParams; } export type makeCreateFarmInstructionSimpleParams = MakeCreateFarmInstructionParamsV6Simple; export interface FarmFetchMultipleInfoParams { connection: Connection; pools: FarmPoolKeys[]; owner?: PublicKey; config?: GetMultipleAccountsInfoConfig; } export interface FarmFetchMultipleInfoReturnItem { apiPoolInfo: FarmPoolKeys; state: FarmState; lpVault: SplAccount; ledger?: FarmLedger; wrapped?: { pendingRewards: BN[]; }; } export interface FarmFetchMultipleInfoReturn { [id: string]: FarmFetchMultipleInfoReturnItem; } export declare class Farm extends Base { static getStateLayout(version: number): import("./layout").FarmStateLayout; static getLedgerLayout(version: number): import("./layout").FarmLedgerLayout; static getLayouts(version: number): { state: import("./layout").FarmStateLayout; ledger: import("./layout").FarmLedgerLayout; }; static getAssociatedAuthority({ programId, poolId }: { programId: PublicKey; poolId: PublicKey; }): { publicKey: PublicKey; nonce: number; }; static getAssociatedLedgerAccount({ programId, poolId, owner, version }: { programId: PublicKey; poolId: PublicKey; owner: PublicKey; version: number; }): PublicKey; static getAssociatedLedgerPoolAccount({ programId, poolId, mint, type, }: { programId: PublicKey; poolId: PublicKey; mint: PublicKey; type: "lpVault" | "rewardVault"; }): PublicKey; static makeDepositInstruction(params: FarmDepositInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeDepositInstructionV3({ poolKeys, userKeys, amount }: FarmDepositInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeDepositInstructionV5({ poolKeys, userKeys, amount }: FarmDepositInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeDepositInstructionV6({ poolKeys, userKeys, amount }: FarmDepositInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeWithdrawInstruction(params: FarmWithdrawInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeWithdrawInstructionV3({ poolKeys, userKeys, amount }: FarmWithdrawInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeWithdrawInstructionV5({ poolKeys, userKeys, amount }: FarmWithdrawInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeWithdrawInstructionV6({ poolKeys, userKeys, amount }: FarmWithdrawInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeCreateAssociatedLedgerAccountInstruction(params: FarmCreateAssociatedLedgerAccountInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeCreateAssociatedLedgerAccountInstructionV3({ poolKeys, userKeys, }: FarmCreateAssociatedLedgerAccountInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeCreateAssociatedLedgerAccountInstructionV5({ poolKeys, userKeys, }: FarmCreateAssociatedLedgerAccountInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeCreateFarmInstruction({ connection, userKeys, poolInfo }: makeCreateFarmInstructionParams): Promise<{ address: { farmId: PublicKey; }; innerTransaction: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }>; static makeCreateFarmInstructionV6({ connection, userKeys, poolInfo }: MakeCreateFarmInstructionParamsV6): Promise<{ address: { farmId: PublicKey; }; innerTransaction: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }>; static makeCreatorWithdrawFarmRewardInstruction(params: FarmCreatorWithdrawRewardInstructionParams): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static makeCreatorWithdrawFarmRewardInstructionV6({ poolKeys, userKeys, withdrawMint, }: FarmCreatorWithdrawRewardInstructionParamsV6): { address: {}; innerTransaction: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }; }; static fetchMultipleInfoAndUpdate({ connection, pools, owner, config }: FarmFetchMultipleInfoParams): Promise; static updatePoolInfo(poolInfo: FarmState, lpVault: SplAccount, slot: number, chainTime: number): FarmState; static makeCreatorWithdrawFarmRewardInstructionSimple(params: FarmCreatorWithdrawRewardInstructionSimpleParams): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeCreatorWithdrawFarmRewardInstructionV6Simple({ connection, poolKeys, userKeys, withdrawMint, }: FarmCreatorWithdrawRewardInstructionSimpleParamsV6): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeCreateFarmInstructionSimple({ connection, userKeys, poolInfo }: makeCreateFarmInstructionSimpleParams): Promise<{ address: { farmId: PublicKey; }; innerTransactions: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeCreateFarmInstructionV6Simple({ connection, userKeys, poolInfo }: MakeCreateFarmInstructionParamsV6Simple): Promise<{ address: { farmId: PublicKey; }; innerTransactions: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeRestartFarmInstructionSimple(params: FarmRestartInstructionParams): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeRestartFarmInstructionV6Simple({ connection, poolKeys, userKeys, newRewardInfo, }: FarmRestartInstructionParamsV6): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeFarmCreatorAddRewardTokenInstructionSimple(params: FarmCreatorAddRewardTokenInstructionParams): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeFarmCreatorAddRewardTokenInstructionV6Simple({ connection, poolKeys, userKeys, newRewardInfo, }: FarmCreatorAddRewardTokenInstructionParamsV6): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: Signer[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeDepositInstructionSimple({ connection, poolKeys, fetchPoolInfo, ownerInfo, amount, associatedOnly }: { connection: Connection; poolKeys: FarmPoolKeys; fetchPoolInfo: FarmFetchMultipleInfoReturnItem; ownerInfo: { feePayer: PublicKey; wallet: PublicKey; tokenAccounts: TokenAccount[]; useSOLBalance?: boolean; }; amount: BN; associatedOnly?: boolean; }): Promise<{ address: {}; innerTransactions: { instructions: TransactionInstruction[]; signers: any[]; lookupTableAddress: any[]; instructionTypes: InstructionType[]; supportedVersion: TxVersion[]; }[]; }>; static makeWithdrawInstructionSimple({ connection, fetchPoolInfo, ownerInfo, amount, associatedOnly }: { connection: Connection; fetchPoolInfo: FarmFetchMultipleInfoReturnItem; ownerInfo: { feePayer: PublicKey; wallet: PublicKey; tokenAccounts: TokenAccount[]; useSOLBalance?: boolean; }; amount: BN; associatedOnly?: boolean; }): Promise<{ address: {}; innerTransactions: InnerTransaction[]; }>; static makeHarvestAllRewardInstructionSimple({ connection, fetchPoolInfos, ownerInfo, associatedOnly }: { connection: Connection; fetchPoolInfos: FarmFetchMultipleInfoReturn; ownerInfo: { feePayer: PublicKey; wallet: PublicKey; tokenAccounts: TokenAccount[]; useSOLBalance?: boolean; }; associatedOnly?: boolean; }): Promise<{ address: {}; innerTransactions: InnerTransaction[]; }>; }