/** * 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, getMapDecoder, getMapEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU64Decoder, getU64Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getCargoIdDecoder, getCargoIdEncoder, type CargoId, type CargoIdArgs, } from '.'; /** * Implements a container for multiple cargo types and their quantities. * * CargoPod is an unsized type that manages a collection of different cargo types * and their respective amounts. It tracks the total storage cost of all contained * cargo and provides operations for adding and removing cargo while maintaining * proper accounting of amounts and costs. * * # System Context * CargoPod is a central component of the cargo management system, allowing players * and game entities to store and manage collections of different cargo types. * It automatically handles storage cost accounting when cargo is added or removed. */ export type CargoPod = { /** The sequence identifier of this CargoPod account */ seqId: number; /** The total storage cost of all cargo in this pod */ storageCost: bigint; /** A map of cargo type IDs to their respective quantities */ amounts: Map; }; export type CargoPodArgs = { /** The sequence identifier of this CargoPod account */ seqId: number; /** The total storage cost of all cargo in this pod */ storageCost: number | bigint; /** A map of cargo type IDs to their respective quantities */ amounts: Map; }; export function getCargoPodEncoder(): Encoder { return getStructEncoder([ ['seqId', getU16Encoder()], ['storageCost', getU64Encoder()], ['amounts', getMapEncoder(getCargoIdEncoder(), getU64Encoder())], ]); } export function getCargoPodDecoder(): Decoder { return getStructDecoder([ ['seqId', getU16Decoder()], ['storageCost', getU64Decoder()], ['amounts', getMapDecoder(getCargoIdDecoder(), getU64Decoder())], ]); } export function getCargoPodCodec(): Codec { return combineCodec(getCargoPodEncoder(), getCargoPodDecoder()); }