@kamino-finance/farms-sdk
Version:
246 lines • 9.1 kB
TypeScript
import { Address, GetAccountInfoApi, GetMultipleAccountsApi, Rpc } from "@solana/kit";
import BN from "bn.js";
import * as types from "../types";
export interface FarmStateFields {
farmAdmin: Address;
globalConfig: Address;
token: types.TokenInfoFields;
rewardInfos: Array<types.RewardInfoFields>;
numRewardTokens: BN;
/** Data used to calculate the rewards of the user */
numUsers: BN;
/**
* The number of token in the `farm_vault` staked (getting rewards and fees)
* Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
*/
totalStakedAmount: BN;
farmVault: Address;
farmVaultsAuthority: Address;
farmVaultsAuthorityBump: BN;
/**
* Only used for delegate farms
* Set to `default()` otherwise
*/
delegateAuthority: Address;
/**
* Raw representation of a `TimeUnit`
* Seconds = 0, Slots = 1
*/
timeUnit: number;
/**
* Automatically set to true in case of a full authority withdrawal
* If true, the farm is frozen and no more deposits are allowed
*/
isFarmFrozen: number;
/**
* Indicates if the farm is a delegate farm
* If true, the farm is a delegate farm and the `delegate_authority` is set*
*/
isFarmDelegated: number;
padding0: Array<number>;
/**
* Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
* Set to `default()` if unused (only the depositors can withdraw their funds)
*/
withdrawAuthority: Address;
/**
* Delay between a user deposit and the moment it is considered as staked
* 0 if unused
*/
depositWarmupPeriod: number;
/** Delay between a user unstake and the ability to withdraw his deposit. */
withdrawalCooldownPeriod: number;
/** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
totalActiveStakeScaled: BN;
/**
* Total pending stake of tokens in the farm (scaled from `Decimal` representation).
* (can be used by `withdraw_authority` but don't get rewards or fees)
*/
totalPendingStakeScaled: BN;
/** Total pending amount of tokens in the farm */
totalPendingAmount: BN;
/** Slashed amounts from early withdrawal */
slashedAmountCurrent: BN;
slashedAmountCumulative: BN;
slashedAmountSpillAddress: Address;
/** Locking stake */
lockingMode: BN;
lockingStartTimestamp: BN;
lockingDuration: BN;
lockingEarlyWithdrawalPenaltyBps: BN;
depositCapAmount: BN;
scopePrices: Address;
scopeOraclePriceId: BN;
scopeOracleMaxAge: BN;
pendingFarmAdmin: Address;
strategyId: Address;
delegatedRpsAdmin: Address;
vaultId: Address;
secondDelegatedAuthority: Address;
padding: Array<BN>;
}
export interface FarmStateJSON {
farmAdmin: string;
globalConfig: string;
token: types.TokenInfoJSON;
rewardInfos: Array<types.RewardInfoJSON>;
numRewardTokens: string;
/** Data used to calculate the rewards of the user */
numUsers: string;
/**
* The number of token in the `farm_vault` staked (getting rewards and fees)
* Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
*/
totalStakedAmount: string;
farmVault: string;
farmVaultsAuthority: string;
farmVaultsAuthorityBump: string;
/**
* Only used for delegate farms
* Set to `default()` otherwise
*/
delegateAuthority: string;
/**
* Raw representation of a `TimeUnit`
* Seconds = 0, Slots = 1
*/
timeUnit: number;
/**
* Automatically set to true in case of a full authority withdrawal
* If true, the farm is frozen and no more deposits are allowed
*/
isFarmFrozen: number;
/**
* Indicates if the farm is a delegate farm
* If true, the farm is a delegate farm and the `delegate_authority` is set*
*/
isFarmDelegated: number;
padding0: Array<number>;
/**
* Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
* Set to `default()` if unused (only the depositors can withdraw their funds)
*/
withdrawAuthority: string;
/**
* Delay between a user deposit and the moment it is considered as staked
* 0 if unused
*/
depositWarmupPeriod: number;
/** Delay between a user unstake and the ability to withdraw his deposit. */
withdrawalCooldownPeriod: number;
/** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
totalActiveStakeScaled: string;
/**
* Total pending stake of tokens in the farm (scaled from `Decimal` representation).
* (can be used by `withdraw_authority` but don't get rewards or fees)
*/
totalPendingStakeScaled: string;
/** Total pending amount of tokens in the farm */
totalPendingAmount: string;
/** Slashed amounts from early withdrawal */
slashedAmountCurrent: string;
slashedAmountCumulative: string;
slashedAmountSpillAddress: string;
/** Locking stake */
lockingMode: string;
lockingStartTimestamp: string;
lockingDuration: string;
lockingEarlyWithdrawalPenaltyBps: string;
depositCapAmount: string;
scopePrices: string;
scopeOraclePriceId: string;
scopeOracleMaxAge: string;
pendingFarmAdmin: string;
strategyId: string;
delegatedRpsAdmin: string;
vaultId: string;
secondDelegatedAuthority: string;
padding: Array<string>;
}
export declare class FarmState {
readonly farmAdmin: Address;
readonly globalConfig: Address;
readonly token: types.TokenInfo;
readonly rewardInfos: Array<types.RewardInfo>;
readonly numRewardTokens: BN;
/** Data used to calculate the rewards of the user */
readonly numUsers: BN;
/**
* The number of token in the `farm_vault` staked (getting rewards and fees)
* Set such as `farm_vault.amount = total_staked_amount + total_pending_amount`
*/
readonly totalStakedAmount: BN;
readonly farmVault: Address;
readonly farmVaultsAuthority: Address;
readonly farmVaultsAuthorityBump: BN;
/**
* Only used for delegate farms
* Set to `default()` otherwise
*/
readonly delegateAuthority: Address;
/**
* Raw representation of a `TimeUnit`
* Seconds = 0, Slots = 1
*/
readonly timeUnit: number;
/**
* Automatically set to true in case of a full authority withdrawal
* If true, the farm is frozen and no more deposits are allowed
*/
readonly isFarmFrozen: number;
/**
* Indicates if the farm is a delegate farm
* If true, the farm is a delegate farm and the `delegate_authority` is set*
*/
readonly isFarmDelegated: number;
readonly padding0: Array<number>;
/**
* Withdraw authority for the farm, allowed to lock deposited funds and withdraw them
* Set to `default()` if unused (only the depositors can withdraw their funds)
*/
readonly withdrawAuthority: Address;
/**
* Delay between a user deposit and the moment it is considered as staked
* 0 if unused
*/
readonly depositWarmupPeriod: number;
/** Delay between a user unstake and the ability to withdraw his deposit. */
readonly withdrawalCooldownPeriod: number;
/** Total active stake of tokens in the farm (scaled from `Decimal` representation). */
readonly totalActiveStakeScaled: BN;
/**
* Total pending stake of tokens in the farm (scaled from `Decimal` representation).
* (can be used by `withdraw_authority` but don't get rewards or fees)
*/
readonly totalPendingStakeScaled: BN;
/** Total pending amount of tokens in the farm */
readonly totalPendingAmount: BN;
/** Slashed amounts from early withdrawal */
readonly slashedAmountCurrent: BN;
readonly slashedAmountCumulative: BN;
readonly slashedAmountSpillAddress: Address;
/** Locking stake */
readonly lockingMode: BN;
readonly lockingStartTimestamp: BN;
readonly lockingDuration: BN;
readonly lockingEarlyWithdrawalPenaltyBps: BN;
readonly depositCapAmount: BN;
readonly scopePrices: Address;
readonly scopeOraclePriceId: BN;
readonly scopeOracleMaxAge: BN;
readonly pendingFarmAdmin: Address;
readonly strategyId: Address;
readonly delegatedRpsAdmin: Address;
readonly vaultId: Address;
readonly secondDelegatedAuthority: Address;
readonly padding: Array<BN>;
static readonly discriminator: Buffer<ArrayBuffer>;
static readonly layout: import("buffer-layout").Layout<FarmState>;
constructor(fields: FarmStateFields);
static fetch(rpc: Rpc<GetAccountInfoApi>, address: Address, programId?: Address): Promise<FarmState | null>;
static fetchMultiple(rpc: Rpc<GetMultipleAccountsApi>, addresses: Address[], programId?: Address): Promise<Array<FarmState | null>>;
static decode(data: Buffer): FarmState;
toJSON(): FarmStateJSON;
static fromJSON(obj: FarmStateJSON): FarmState;
}
//# sourceMappingURL=FarmState.d.ts.map