import type { LedgerInstant } from '../utils/ledger'; import { FarmState, UserState, RewardInfo } from '@kamino-finance/farms-sdk'; import { Address, GetAccountInfoApi, Instruction, Rpc, SolanaRpcApi, TransactionSigner } from '@solana/kit'; import Decimal from 'decimal.js/decimal'; export declare const FARMS_GLOBAL_CONFIG_MAINNET: Address; export declare const FARMS_GLOBAL_CONFIG_DEVNET: Address; /** Fetches a farm state account, returning `null` if the account does not exist (mirrors the pre-Codama `FarmState.fetch` behaviour). */ export declare function fetchFarmStateOrNull(rpc: Rpc, farmAddress: Address): Promise; export declare function getFarmStakeIxs(rpc: Rpc, user: TransactionSigner, lamportsToStake: Decimal, farmAddress: Address, fetchedFarmState?: FarmState, farmsProgramId?: Address): Promise; export declare function getFarmUserStatePDA(rpc: Rpc, user: Address, farm: Address, farmsProgramId?: Address): Promise
; export declare function getFarmUnstakeIx(rpc: Rpc, user: TransactionSigner, lamportsToUnstake: Decimal, farmAddress: Address, fetchedFarmState?: FarmState, farmsProgramId?: Address): Promise; export declare function getFarmWithdrawUnstakedDepositIx(rpc: Rpc, user: TransactionSigner, farm: Address, stakeTokenMint: Address, farmsProgramId?: Address): Promise; export declare function getFarmUnstakeAndWithdrawIxs(connection: Rpc, user: TransactionSigner, lamportsToUnstake: Decimal, farmAddress: Address, fetchedFarmState?: FarmState, farmsProgramId?: Address): Promise; export declare function getSetupFarmIxsWithFarm(connection: Rpc, farmAdmin: TransactionSigner, farmTokenMint: Address, farmsGlobalConfig?: Address, farmsProgramId?: Address): Promise; /** * Returns the number of tokens the user has staked in the farm * @param connection - the connection to the cluster * @param user - the user's public key * @param farm - the farm's public key * @param farmTokenDecimals - the decimals of the farm token * @returns the number of tokens the user has staked in the farm */ export declare function getUserSharesInTokensStakedInFarm(rpc: Rpc, user: Address, farm: Address, farmTokenDecimals: number, farmsProgramId?: Address): Promise; export declare function setVaultIdForFarmIx(rpc: Rpc, farmAdmin: TransactionSigner, farm: Address, vault: Address, farmsProgramId?: Address): Promise; /** * Returns the number of shares the user has in the farm, in tokens. If less than 1 lamport is staked, returns 0. * @param userState - the user's state in the farm * @param tokenDecimals - the decimals of the farm token * @returns the number of shares the user has in the farm, in tokens */ export declare function getSharesInFarmUserPosition(userState: UserState, tokenDecimals: number): Decimal; export type SetupFarmIxsWithFarm = { farm: TransactionSigner; setupFarmIxs: Instruction[]; }; export type UnstakeAndWithdrawFromFarmIxs = { unstakeIx: Instruction; withdrawIx: Instruction; }; export declare function getRewardPerTimeUnitSecond(reward: RewardInfo, farmTotalStakeLamports: Decimal, currentTimestampSec: number): Decimal; /** * reads the pending rewards for a user in a vault farm * @param rpc - the rpc connection * @param userStateAddress - the address of the user state (computed differently depending on farm type) * @param farm - the address of the farm * @returns a map of the pending rewards per token */ export declare function getUserPendingRewardsInFarm(rpc: Rpc, userStateAddress: Address, farm: Address, currentLedgerInstant: LedgerInstant, farmsProgramId?: Address): Promise>; export declare function getValidatedFarmRewardTimeUnit(farm: Address, farmState: FarmState, currentLedgerInstant: LedgerInstant): Promise; /** * This method creates an instruction to update the pending admin of a farm * @param rpc - the rpc connection * @param signer - the signer of the transaction * @param farm - the address of the farm to update * @param newPendingAdmin - the new pending admin to set for the farm * @returns an instruction to update the pending admin of the farm */ export declare function getUpdateFarmPendingAdminIx(rpc: Rpc, signer: TransactionSigner, farm: Address, newPendingAdmin: Address, farmsProgramId?: Address): Promise; //# sourceMappingURL=farm_utils.d.ts.map