/** * 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, getU8Decoder, getU8Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; /** * One crew member's assignment: a 33-byte Pod value `{ tag: u8, target: OptionalKeyFor }`. * * Byte-exact to the reference-impl `layout.CrewStatusPod` (record_rs:486-494): * `tag(1) + target(32) = 33`. `OptionalKeyFor` is `#[repr(transparent)]` over a * `Pubkey` (32 B), `Align1` + `Pod`, with a `NONE` sentinel of all-zero bytes * (ref star_frame/star_frame/src/data_types/optional_key_for_rs:22-48,159-173) — so the * whole struct is `Align1` Pod with no padding, List-able inside `CrewRecord`. * * `tag` is stored raw (see module note); use `Self.tag`/`Self.set_tag` for the * typed `CrewStatusTag` view. `target` is meaningful only when `tag == OnFleet`; * it is `OptionalKeyFor::::NONE` in every other state. */ export type CrewStatus = { /** * Raw `CrewStatusTag` discriminant. Kept as `u8` to preserve `CrewRecord`'s * `Pod`-ness (a `Pod` struct cannot contain a non-`Pod` enum field). */ tag: number; /** * The assigned `Fleet`, or `OptionalKeyFor::NONE` (all-zero) when not `OnFleet`. * `Fleet` is `#[unsized_type(program_account, seeds = FleetSeeds)]` (`?Sized`); * `OptionalKeyFor` supports unsized targets * (ref sage/src/state/hangar/fleet/mod_rs:56-57). */ target: Address; }; export type CrewStatusArgs = CrewStatus; export function getCrewStatusEncoder(): FixedSizeEncoder { return getStructEncoder([ ['tag', getU8Encoder()], ['target', getAddressEncoder()], ]); } export function getCrewStatusDecoder(): FixedSizeDecoder { return getStructDecoder([ ['tag', getU8Decoder()], ['target', getAddressDecoder()], ]); } export function getCrewStatusCodec(): FixedSizeCodec< CrewStatusArgs, CrewStatus > { return combineCodec(getCrewStatusEncoder(), getCrewStatusDecoder()); }