/** * 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, getU16Decoder, getU16Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; /** * Regenerating pilot XP budget (AP-style). Pilot XP from movement draws from * this budget, which refills continuously in real time — independent of any * player action, so a lapsed player loses nothing and a scripted fleet cannot * out-earn the regen rate no matter how many actions it performs. * * The final eight bytes preserve the legacy `available: u64` wire slot as * `available: u16` followed by a Q0.48 fractional carry. Legacy values were * bounded to 360, so existing account bytes decode directly with a zero carry. */ export type PilotXpBudget = { /** * Timestamp regen has been accounted up to. Remainder seconds toward the * next XP stay unconsumed, so frequent small accruals lose nothing. */ lastAccrualTime: bigint; /** Whole Pilot XP currently available to earn. */ available: number; /** * Fractional Pilot XP accumulated across movement settlements, encoded as * an unsigned Q0.48 little-endian value. */ fractionalCarry: Array; }; export type PilotXpBudgetArgs = { /** * Timestamp regen has been accounted up to. Remainder seconds toward the * next XP stay unconsumed, so frequent small accruals lose nothing. */ lastAccrualTime: number | bigint; /** Whole Pilot XP currently available to earn. */ available: number; /** * Fractional Pilot XP accumulated across movement settlements, encoded as * an unsigned Q0.48 little-endian value. */ fractionalCarry: Array; }; export function getPilotXpBudgetEncoder(): FixedSizeEncoder { return getStructEncoder([ ['lastAccrualTime', getI64Encoder()], ['available', getU16Encoder()], ['fractionalCarry', getArrayEncoder(getU8Encoder(), { size: 6 })], ]); } export function getPilotXpBudgetDecoder(): FixedSizeDecoder { return getStructDecoder([ ['lastAccrualTime', getI64Decoder()], ['available', getU16Decoder()], ['fractionalCarry', getArrayDecoder(getU8Decoder(), { size: 6 })], ]); } export function getPilotXpBudgetCodec(): FixedSizeCodec< PilotXpBudgetArgs, PilotXpBudget > { return combineCodec(getPilotXpBudgetEncoder(), getPilotXpBudgetDecoder()); }