/** * 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, getArrayDecoder, getArrayEncoder, getMapDecoder, getMapEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type Address, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getCargoIdDecoder, getCargoIdEncoder, getNameDecoder, getNameEncoder, getResearchTagDecoder, getResearchTagEncoder, getShipIdDecoder, getShipIdEncoder, getShipStatsDecoder, getShipStatsEncoder, getSizeClassDecoder, getSizeClassEncoder, type CargoId, type CargoIdArgs, type Name, type NameArgs, type ResearchTag, type ResearchTagArgs, type ShipId, type ShipIdArgs, type ShipStats, type ShipStatsArgs, type SizeClass, type SizeClassArgs, } from '.'; /** The definitions of a ship in the game. */ export type Ship = { /** The id of this ship in the `ShipDefinitions` map */ id: ShipId; /** The name of this `Ship` */ name: Name; /** The mint associated with this ship */ mint: Address; /** The ship's size class */ sizeClass: SizeClass; /** The ship's stats */ stats: ShipStats; /** The research requirements needed to use this ship */ researchRequirements: Array; /** The ship components required to use this ship */ componentRequirements: Map; }; export type ShipArgs = { /** The id of this ship in the `ShipDefinitions` map */ id: ShipIdArgs; /** The name of this `Ship` */ name: NameArgs; /** The mint associated with this ship */ mint: Address; /** The ship's size class */ sizeClass: SizeClassArgs; /** The ship's stats */ stats: ShipStatsArgs; /** The research requirements needed to use this ship */ researchRequirements: Array; /** The ship components required to use this ship */ componentRequirements: Map; }; export function getShipEncoder(): Encoder { return getStructEncoder([ ['id', getShipIdEncoder()], ['name', getNameEncoder()], ['mint', getAddressEncoder()], ['sizeClass', getSizeClassEncoder()], ['stats', getShipStatsEncoder()], ['researchRequirements', getArrayEncoder(getResearchTagEncoder())], [ 'componentRequirements', getMapEncoder(getCargoIdEncoder(), getU64Encoder()), ], ]); } export function getShipDecoder(): Decoder { return getStructDecoder([ ['id', getShipIdDecoder()], ['name', getNameDecoder()], ['mint', getAddressDecoder()], ['sizeClass', getSizeClassDecoder()], ['stats', getShipStatsDecoder()], ['researchRequirements', getArrayDecoder(getResearchTagDecoder())], [ 'componentRequirements', getMapDecoder(getCargoIdDecoder(), getU64Decoder()), ], ]); } export function getShipCodec(): Codec { return combineCodec(getShipEncoder(), getShipDecoder()); }