@kamino-finance/farms-sdk
Version:
188 lines • 8.35 kB
TypeScript
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
import { type RewardInfo, type RewardInfoArgs, type TokenInfo, type TokenInfoArgs } from "../types";
export declare const FARM_STATE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
export declare function getFarmStateDiscriminatorBytes(): ReadonlyUint8Array;
export type FarmState = {
discriminator: ReadonlyUint8Array;
farmAdmin: Address;
globalConfig: Address;
token: TokenInfo;
rewardInfos: Array<RewardInfo>;
numRewardTokens: bigint;
/** Data used to calculate the rewards of the user */
numUsers: bigint;
/**
* 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: bigint;
farmVault: Address;
farmVaultsAuthority: Address;
farmVaultsAuthorityBump: bigint;
/**
* 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;
/** If set to 1, indicates that the "reward user once" feature is enabled */
isRewardUserOnceEnabled: number;
isHarvestingPermissionless: number;
padding0: ReadonlyUint8Array;
/**
* 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: bigint;
/**
* 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: bigint;
/** Total pending amount of tokens in the farm */
totalPendingAmount: bigint;
/** Slashed amounts from early withdrawal */
slashedAmountCurrent: bigint;
slashedAmountCumulative: bigint;
slashedAmountSpillAddress: Address;
/** Locking stake */
lockingMode: bigint;
lockingStartTimestamp: bigint;
lockingDuration: bigint;
lockingEarlyWithdrawalPenaltyBps: bigint;
depositCapAmount: bigint;
scopePrices: Address;
scopeOraclePriceId: bigint;
scopeOracleMaxAge: bigint;
pendingFarmAdmin: Address;
strategyId: Address;
delegatedRpsAdmin: Address;
vaultId: Address;
secondDelegatedAuthority: Address;
padding: Array<bigint>;
};
export type FarmStateArgs = {
farmAdmin: Address;
globalConfig: Address;
token: TokenInfoArgs;
rewardInfos: Array<RewardInfoArgs>;
numRewardTokens: number | bigint;
/** Data used to calculate the rewards of the user */
numUsers: number | bigint;
/**
* 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: number | bigint;
farmVault: Address;
farmVaultsAuthority: Address;
farmVaultsAuthorityBump: number | bigint;
/**
* 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;
/** If set to 1, indicates that the "reward user once" feature is enabled */
isRewardUserOnceEnabled: number;
isHarvestingPermissionless: number;
padding0: ReadonlyUint8Array;
/**
* 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: number | bigint;
/**
* 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: number | bigint;
/** Total pending amount of tokens in the farm */
totalPendingAmount: number | bigint;
/** Slashed amounts from early withdrawal */
slashedAmountCurrent: number | bigint;
slashedAmountCumulative: number | bigint;
slashedAmountSpillAddress: Address;
/** Locking stake */
lockingMode: number | bigint;
lockingStartTimestamp: number | bigint;
lockingDuration: number | bigint;
lockingEarlyWithdrawalPenaltyBps: number | bigint;
depositCapAmount: number | bigint;
scopePrices: Address;
scopeOraclePriceId: number | bigint;
scopeOracleMaxAge: number | bigint;
pendingFarmAdmin: Address;
strategyId: Address;
delegatedRpsAdmin: Address;
vaultId: Address;
secondDelegatedAuthority: Address;
padding: Array<number | bigint>;
};
/** Gets the encoder for {@link FarmStateArgs} account data. */
export declare function getFarmStateEncoder(): FixedSizeEncoder<FarmStateArgs>;
/** Gets the decoder for {@link FarmState} account data. */
export declare function getFarmStateDecoder(): FixedSizeDecoder<FarmState>;
/** Gets the codec for {@link FarmState} account data. */
export declare function getFarmStateCodec(): FixedSizeCodec<FarmStateArgs, FarmState>;
export declare function decodeFarmState<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<FarmState, TAddress>;
export declare function decodeFarmState<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<FarmState, TAddress>;
export declare function fetchFarmState<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<FarmState, TAddress>>;
export declare function fetchMaybeFarmState<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<FarmState, TAddress>>;
export declare function fetchAllFarmState(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<FarmState>[]>;
export declare function fetchAllMaybeFarmState(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<FarmState>[]>;
export declare function getFarmStateSize(): number;
//# sourceMappingURL=farmState.d.ts.map