/** * 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 { combineCodec, getAddressDecoder, getAddressEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from "@solana/kit"; import { getPodStakeStatusDecoder, getPodStakeStatusEncoder, type PodStakeStatus, type PodStakeStatusArgs, } from "./index.ts"; /** * Information about a validator in the pool * NOTE: ORDER IS VERY IMPORTANT HERE, PLEASE DO NOT RE-ORDER THE FIELDS UNLESS * THERE'S AN EXTREMELY GOOD REASON. * To save on BPF instructions, the serialized bytes are reinterpreted with a * `bytemuck` transmute, which means that this structure cannot have any * undeclared alignment-padding in its representation. */ export type ValidatorStakeInfo = { /** * Amount of lamports on the validator stake account, including rent * Note that if `last_update_epoch` does not match the current epoch then * this field may not be accurate */ activeStakeLamports: bigint; /** * Amount of transient stake delegated to this validator * Note that if `last_update_epoch` does not match the current epoch then * this field may not be accurate */ transientStakeLamports: bigint; /** Last epoch the active and transient stake lamports fields were updated */ lastUpdateEpoch: bigint; /** * Transient account seed suffix, used to derive the transient stake * account address */ transientSeedSuffix: bigint; /** Unused space, initially meant to specify the end of seed suffixes */ unused: number; /** Validator account seed suffix */ validatorSeedSuffix: number; /** Status of the validator stake account */ status: PodStakeStatus; /** Validator vote account address */ voteAccountAddress: Address; }; export type ValidatorStakeInfoArgs = { /** * Amount of lamports on the validator stake account, including rent * Note that if `last_update_epoch` does not match the current epoch then * this field may not be accurate */ activeStakeLamports: number | bigint; /** * Amount of transient stake delegated to this validator * Note that if `last_update_epoch` does not match the current epoch then * this field may not be accurate */ transientStakeLamports: number | bigint; /** Last epoch the active and transient stake lamports fields were updated */ lastUpdateEpoch: number | bigint; /** * Transient account seed suffix, used to derive the transient stake * account address */ transientSeedSuffix: number | bigint; /** Unused space, initially meant to specify the end of seed suffixes */ unused: number; /** Validator account seed suffix */ validatorSeedSuffix: number; /** Status of the validator stake account */ status: PodStakeStatusArgs; /** Validator vote account address */ voteAccountAddress: Address; }; export function getValidatorStakeInfoEncoder(): FixedSizeEncoder { return getStructEncoder([ ["activeStakeLamports", getU64Encoder()], ["transientStakeLamports", getU64Encoder()], ["lastUpdateEpoch", getU64Encoder()], ["transientSeedSuffix", getU64Encoder()], ["unused", getU32Encoder()], ["validatorSeedSuffix", getU32Encoder()], ["status", getPodStakeStatusEncoder()], ["voteAccountAddress", getAddressEncoder()], ]); } export function getValidatorStakeInfoDecoder(): FixedSizeDecoder { return getStructDecoder([ ["activeStakeLamports", getU64Decoder()], ["transientStakeLamports", getU64Decoder()], ["lastUpdateEpoch", getU64Decoder()], ["transientSeedSuffix", getU64Decoder()], ["unused", getU32Decoder()], ["validatorSeedSuffix", getU32Decoder()], ["status", getPodStakeStatusDecoder()], ["voteAccountAddress", getAddressDecoder()], ]); } export function getValidatorStakeInfoCodec(): FixedSizeCodec< ValidatorStakeInfoArgs, ValidatorStakeInfo > { return combineCodec( getValidatorStakeInfoEncoder(), getValidatorStakeInfoDecoder(), ); }