@kamino-finance/klend-sdk
Version:
Typescript SDK for interacting with the Kamino Lending (klend) protocol
40 lines • 2.91 kB
TypeScript
import { FarmState, UserState, RewardInfo } from '@kamino-finance/farms-sdk';
import { Address, 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_ADMIN_MAINNET: Address;
export declare function getFarmStakeIxs(rpc: Rpc<SolanaRpcApi>, user: TransactionSigner, lamportsToStake: Decimal, farmAddress: Address, fetchedFarmState?: FarmState): Promise<Instruction[]>;
export declare function getFarmUserStatePDA(rpc: Rpc<SolanaRpcApi>, user: Address, farm: Address): Promise<Address>;
export declare function getFarmUnstakeIx(rpc: Rpc<SolanaRpcApi>, user: TransactionSigner, lamportsToUnstake: Decimal, farmAddress: Address, fetchedFarmState?: FarmState): Promise<Instruction>;
export declare function getFarmWithdrawUnstakedDepositIx(rpc: Rpc<SolanaRpcApi>, user: TransactionSigner, farm: Address, stakeTokenMint: Address): Promise<Instruction>;
export declare function getFarmUnstakeAndWithdrawIxs(connection: Rpc<SolanaRpcApi>, user: TransactionSigner, lamportsToUnstake: Decimal, farmAddress: Address, fetchedFarmState?: FarmState): Promise<UnstakeAndWithdrawFromFarmIxs>;
export declare function getSetupFarmIxsWithFarm(connection: Rpc<SolanaRpcApi>, farmAdmin: TransactionSigner, farmTokenMint: Address): Promise<SetupFarmIxsWithFarm>;
/**
* 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<SolanaRpcApi>, user: Address, farm: Address, farmTokenDecimals: number): Promise<Decimal>;
export declare function setVaultIdForFarmIx(rpc: Rpc<SolanaRpcApi>, farmAdmin: TransactionSigner, farm: Address, vault: Address): Promise<Instruction>;
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): 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<SolanaRpcApi>, userStateAddress: Address, farm: Address): Promise<Map<Address, Decimal>>;
//# sourceMappingURL=farm_utils.d.ts.map