/** * 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, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; /** * One equipped gear reference. **Sentinel, not `Option`**: `gear_id == 0` means * "empty slot" (contract-change request #1 — `Option` is not a Star Frame `Pod`, * so it can never be a field of the Pod `CrewRecord`; the reference-impl models the * same sentinel, record_rs:284-302). * * Byte-exact to `layout.GearRefPod` (record_rs:496-506): * `gear_id(2) + tier(1) + _pad(1) + durability(2) + _pad2(2) = 8 B`. */ export type GearRef = { /** On-chain gear definition id. `0` ⇒ empty slot (the sentinel). */ gearId: number; /** Gear tier (recipe tier; `gear_rs` owns recipe/sink semantics). */ tier: number; /** Padding to keep the byte image identical to `layout.GearRefPod._pad`. */ pad: number; /** Remaining durability (sink-eroded; faucet-ledgered in `gear_rs`). */ durability: number; /** Padding to pad the record to the 8-byte slot (`layout.GearRefPod._pad2`). */ pad2: Array; }; export type GearRefArgs = GearRef; export function getGearRefEncoder(): FixedSizeEncoder { return getStructEncoder([ ['gearId', getU16Encoder()], ['tier', getU8Encoder()], ['pad', getU8Encoder()], ['durability', getU16Encoder()], ['pad2', getArrayEncoder(getU8Encoder(), { size: 2 })], ]); } export function getGearRefDecoder(): FixedSizeDecoder { return getStructDecoder([ ['gearId', getU16Decoder()], ['tier', getU8Decoder()], ['pad', getU8Decoder()], ['durability', getU16Decoder()], ['pad2', getArrayDecoder(getU8Decoder(), { size: 2 })], ]); } export function getGearRefCodec(): FixedSizeCodec { return combineCodec(getGearRefEncoder(), getGearRefDecoder()); }