/** * 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, getArrayDecoder, getArrayEncoder, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; /** One track's live settlement state. */ export type XpBudgetTrack = { /** Whole XP currently available to earn. */ bank: bigint; /** * Timestamp regen has been accounted up to. Clock regression is ignored * (`now.saturating_sub(last_settled)` floors at zero). */ lastSettled: bigint; /** * Rational-regen numerator modulo `regen_denominator`, so sub-unit * elapsed time is never lost across settlements. */ regenRemainder: bigint; /** Unsigned Q0.48 fractional award carry (6 LE bytes). */ fractionalCarry: Array; }; export type XpBudgetTrackArgs = { /** Whole XP currently available to earn. */ bank: number | bigint; /** * Timestamp regen has been accounted up to. Clock regression is ignored * (`now.saturating_sub(last_settled)` floors at zero). */ lastSettled: number | bigint; /** * Rational-regen numerator modulo `regen_denominator`, so sub-unit * elapsed time is never lost across settlements. */ regenRemainder: number | bigint; /** Unsigned Q0.48 fractional award carry (6 LE bytes). */ fractionalCarry: Array; }; export function getXpBudgetTrackEncoder(): FixedSizeEncoder { return getStructEncoder([ ['bank', getU64Encoder()], ['lastSettled', getI64Encoder()], ['regenRemainder', getU64Encoder()], ['fractionalCarry', getArrayEncoder(getU8Encoder(), { size: 6 })], ]); } export function getXpBudgetTrackDecoder(): FixedSizeDecoder { return getStructDecoder([ ['bank', getU64Decoder()], ['lastSettled', getI64Decoder()], ['regenRemainder', getU64Decoder()], ['fractionalCarry', getArrayDecoder(getU8Decoder(), { size: 6 })], ]); } export function getXpBudgetTrackCodec(): FixedSizeCodec< XpBudgetTrackArgs, XpBudgetTrack > { return combineCodec(getXpBudgetTrackEncoder(), getXpBudgetTrackDecoder()); }