/** * 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 { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, getAddressDecoder, getAddressEncoder, getOptionDecoder, getOptionEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type Option, type OptionOrNullable, type ReadonlyUint8Array, } from "@solana/kit"; import { AccountType, getAccountTypeDecoder, getAccountTypeEncoder, getFeeDecoder, getFeeEncoder, getFutureEpochDecoder, getFutureEpochEncoder, getLockupDecoder, getLockupEncoder, type Fee, type FeeArgs, type FutureEpoch, type FutureEpochArgs, type Lockup, type LockupArgs, } from "../types/index.ts"; export const STAKE_POOL_ACCOUNT_TYPE: AccountType = AccountType.StakePool; export function getStakePoolAccountTypeBytes(): ReadonlyUint8Array { return getAccountTypeEncoder().encode(STAKE_POOL_ACCOUNT_TYPE); } /** Initialized program details. */ export type StakePool = { /** Account type, must be `StakePool` currently */ accountType: AccountType; /** * Manager authority, allows for updating the staker, manager, and fee * account */ manager: Address; /** * Staker authority, allows for adding and removing validators, and * managing stake distribution */ staker: Address; /** * Stake deposit authority * If a depositor pubkey is specified on initialization, then deposits must * be signed by this authority. If no deposit authority is specified, * then the stake pool will default to the result of: * `Pubkey::find_program_address( * &[&stake_pool_address.as_ref(), b"deposit"], * program_id, * )` */ stakeDepositAuthority: Address; /** * Stake withdrawal authority bump seed * for `create_program_address(&[state::StakePool account, "withdrawal"])` */ stakeWithdrawBumpSeed: number; /** Validator stake list storage account */ validatorList: Address; /** Reserve stake account, holds deactivated stake */ reserveStake: Address; /** Pool Mint */ poolMint: Address; /** Manager fee account */ managerFeeAccount: Address; /** Pool token program id */ tokenProgramId: Address; /** * Total stake under management. * Note that if `last_update_epoch` does not match the current epoch then * this field may not be accurate */ totalLamports: bigint; /** * Total supply of pool tokens (should always match the supply in the Pool * Mint) */ poolTokenSupply: bigint; /** Last epoch the `total_lamports` field was updated */ lastUpdateEpoch: bigint; /** Lockup that all stakes in the pool must have */ lockup: Lockup; /** Fee taken as a proportion of rewards each epoch */ epochFee: Fee; /** Fee for next epoch */ nextEpochFee: FutureEpoch; /** Preferred deposit validator vote account pubkey */ preferredDepositValidatorVoteAddress: Option
; /** Preferred withdraw validator vote account pubkey */ preferredWithdrawValidatorVoteAddress: Option; /** Fee assessed on stake deposits */ stakeDepositFee: Fee; /** Fee assessed on withdrawals */ stakeWithdrawalFee: Fee; /** Future stake withdrawal fee, to be set for the following epoch */ nextStakeWithdrawalFee: FutureEpoch; /** * Fees paid out to referrers on referred stake deposits. * Expressed as a percentage (0 - 100) of deposit fees. * i.e. `stake_deposit_fee`% of stake deposited is collected as deposit * fees for every deposit and `stake_referral_fee`% of the collected * stake deposit fees is paid out to the referrer */ stakeReferralFee: number; /** * Toggles whether the `DepositSol` instruction requires a signature from * this `sol_deposit_authority` */ solDepositAuthority: Option; /** Fee assessed on SOL deposits */ solDepositFee: Fee; /** * Fees paid out to referrers on referred SOL deposits. * Expressed as a percentage (0 - 100) of SOL deposit fees. * i.e. `sol_deposit_fee`% of SOL deposited is collected as deposit fees * for every deposit and `sol_referral_fee`% of the collected SOL * deposit fees is paid out to the referrer */ solReferralFee: number; /** * Toggles whether the `WithdrawSol` instruction requires a signature from * the `deposit_authority` */ solWithdrawAuthority: Option; /** Fee assessed on SOL withdrawals */ solWithdrawalFee: Fee; /** Future SOL withdrawal fee, to be set for the following epoch */ nextSolWithdrawalFee: FutureEpoch; /** Last epoch's total pool tokens, used only for APR estimation */ lastEpochPoolTokenSupply: bigint; /** Last epoch's total lamports, used only for APR estimation */ lastEpochTotalLamports: bigint; }; export type StakePoolArgs = { /** * Manager authority, allows for updating the staker, manager, and fee * account */ manager: Address; /** * Staker authority, allows for adding and removing validators, and * managing stake distribution */ staker: Address; /** * Stake deposit authority * If a depositor pubkey is specified on initialization, then deposits must * be signed by this authority. If no deposit authority is specified, * then the stake pool will default to the result of: * `Pubkey::find_program_address( * &[&stake_pool_address.as_ref(), b"deposit"], * program_id, * )` */ stakeDepositAuthority: Address; /** * Stake withdrawal authority bump seed * for `create_program_address(&[state::StakePool account, "withdrawal"])` */ stakeWithdrawBumpSeed: number; /** Validator stake list storage account */ validatorList: Address; /** Reserve stake account, holds deactivated stake */ reserveStake: Address; /** Pool Mint */ poolMint: Address; /** Manager fee account */ managerFeeAccount: Address; /** Pool token program id */ tokenProgramId: Address; /** * Total stake under management. * Note that if `last_update_epoch` does not match the current epoch then * this field may not be accurate */ totalLamports: number | bigint; /** * Total supply of pool tokens (should always match the supply in the Pool * Mint) */ poolTokenSupply: number | bigint; /** Last epoch the `total_lamports` field was updated */ lastUpdateEpoch: number | bigint; /** Lockup that all stakes in the pool must have */ lockup: LockupArgs; /** Fee taken as a proportion of rewards each epoch */ epochFee: FeeArgs; /** Fee for next epoch */ nextEpochFee: FutureEpochArgs; /** Preferred deposit validator vote account pubkey */ preferredDepositValidatorVoteAddress: OptionOrNullable; /** Preferred withdraw validator vote account pubkey */ preferredWithdrawValidatorVoteAddress: OptionOrNullable; /** Fee assessed on stake deposits */ stakeDepositFee: FeeArgs; /** Fee assessed on withdrawals */ stakeWithdrawalFee: FeeArgs; /** Future stake withdrawal fee, to be set for the following epoch */ nextStakeWithdrawalFee: FutureEpochArgs; /** * Fees paid out to referrers on referred stake deposits. * Expressed as a percentage (0 - 100) of deposit fees. * i.e. `stake_deposit_fee`% of stake deposited is collected as deposit * fees for every deposit and `stake_referral_fee`% of the collected * stake deposit fees is paid out to the referrer */ stakeReferralFee: number; /** * Toggles whether the `DepositSol` instruction requires a signature from * this `sol_deposit_authority` */ solDepositAuthority: OptionOrNullable; /** Fee assessed on SOL deposits */ solDepositFee: FeeArgs; /** * Fees paid out to referrers on referred SOL deposits. * Expressed as a percentage (0 - 100) of SOL deposit fees. * i.e. `sol_deposit_fee`% of SOL deposited is collected as deposit fees * for every deposit and `sol_referral_fee`% of the collected SOL * deposit fees is paid out to the referrer */ solReferralFee: number; /** * Toggles whether the `WithdrawSol` instruction requires a signature from * the `deposit_authority` */ solWithdrawAuthority: OptionOrNullable; /** Fee assessed on SOL withdrawals */ solWithdrawalFee: FeeArgs; /** Future SOL withdrawal fee, to be set for the following epoch */ nextSolWithdrawalFee: FutureEpochArgs; /** Last epoch's total pool tokens, used only for APR estimation */ lastEpochPoolTokenSupply: number | bigint; /** Last epoch's total lamports, used only for APR estimation */ lastEpochTotalLamports: number | bigint; }; /** Gets the encoder for {@link StakePoolArgs} account data. */ export function getStakePoolEncoder(): Encoder