@kamino-finance/farms-sdk
Version:
127 lines • 6.25 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";
export declare const USER_STATE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
export declare function getUserStateDiscriminatorBytes(): ReadonlyUint8Array;
export type UserState = {
discriminator: ReadonlyUint8Array;
userId: bigint;
farmState: Address;
owner: Address;
/** Indicate if this user state is part of a delegated farm */
isFarmDelegated: number;
padding0: ReadonlyUint8Array;
/**
* Rewards tally used for computation of gained rewards
* (scaled from `Decimal` representation).
*/
rewardsTallyScaled: Array<bigint>;
/** Number of reward tokens ready for claim */
rewardsIssuedUnclaimed: Array<bigint>;
lastClaimTs: Array<bigint>;
/**
* User stake deposited and usable, generating rewards and fees.
* (scaled from `Decimal` representation).
*/
activeStakeScaled: bigint;
/**
* User stake deposited but not usable and not generating rewards yet.
* (scaled from `Decimal` representation).
*/
pendingDepositStakeScaled: bigint;
/**
* After this timestamp, pending user stake can be moved to user stake
* Initialized to now() + delayed user stake period
*/
pendingDepositStakeTs: bigint;
/**
* User deposits unstaked, pending for withdrawal, not usable and not generating rewards.
* (scaled from `Decimal` representation).
*/
pendingWithdrawalUnstakeScaled: bigint;
/** After this timestamp, user can withdraw their deposit. */
pendingWithdrawalUnstakeTs: bigint;
/** User bump used for account address validation */
bump: bigint;
/** Delegatee used for initialisation - useful to check against */
delegatee: Address;
lastStakeTs: bigint;
/**
* Cumulative rewards issued to the user - ONLY used for stats/analytics
* DO NOT USE IN ANY CALCULATIONS
* Old userStates will have this field populated only from the point of release
* not reflecting any historical data before this was released
*/
rewardsIssuedCumulative: Array<bigint>;
padding1: Array<bigint>;
};
export type UserStateArgs = {
userId: number | bigint;
farmState: Address;
owner: Address;
/** Indicate if this user state is part of a delegated farm */
isFarmDelegated: number;
padding0: ReadonlyUint8Array;
/**
* Rewards tally used for computation of gained rewards
* (scaled from `Decimal` representation).
*/
rewardsTallyScaled: Array<number | bigint>;
/** Number of reward tokens ready for claim */
rewardsIssuedUnclaimed: Array<number | bigint>;
lastClaimTs: Array<number | bigint>;
/**
* User stake deposited and usable, generating rewards and fees.
* (scaled from `Decimal` representation).
*/
activeStakeScaled: number | bigint;
/**
* User stake deposited but not usable and not generating rewards yet.
* (scaled from `Decimal` representation).
*/
pendingDepositStakeScaled: number | bigint;
/**
* After this timestamp, pending user stake can be moved to user stake
* Initialized to now() + delayed user stake period
*/
pendingDepositStakeTs: number | bigint;
/**
* User deposits unstaked, pending for withdrawal, not usable and not generating rewards.
* (scaled from `Decimal` representation).
*/
pendingWithdrawalUnstakeScaled: number | bigint;
/** After this timestamp, user can withdraw their deposit. */
pendingWithdrawalUnstakeTs: number | bigint;
/** User bump used for account address validation */
bump: number | bigint;
/** Delegatee used for initialisation - useful to check against */
delegatee: Address;
lastStakeTs: number | bigint;
/**
* Cumulative rewards issued to the user - ONLY used for stats/analytics
* DO NOT USE IN ANY CALCULATIONS
* Old userStates will have this field populated only from the point of release
* not reflecting any historical data before this was released
*/
rewardsIssuedCumulative: Array<number | bigint>;
padding1: Array<number | bigint>;
};
/** Gets the encoder for {@link UserStateArgs} account data. */
export declare function getUserStateEncoder(): FixedSizeEncoder<UserStateArgs>;
/** Gets the decoder for {@link UserState} account data. */
export declare function getUserStateDecoder(): FixedSizeDecoder<UserState>;
/** Gets the codec for {@link UserState} account data. */
export declare function getUserStateCodec(): FixedSizeCodec<UserStateArgs, UserState>;
export declare function decodeUserState<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<UserState, TAddress>;
export declare function decodeUserState<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<UserState, TAddress>;
export declare function fetchUserState<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<UserState, TAddress>>;
export declare function fetchMaybeUserState<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<UserState, TAddress>>;
export declare function fetchAllUserState(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<UserState>[]>;
export declare function fetchAllMaybeUserState(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<UserState>[]>;
export declare function getUserStateSize(): number;
//# sourceMappingURL=userState.d.ts.map