/** * 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, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; import { getCargoIdDecoder, getCargoIdEncoder, type CargoId, type CargoIdArgs, } from '.'; /** * Represents a single type of cargo with its amount. * * SingleCargo provides a simple structure for tracking a specific cargo type and its quantity. * It supports basic cargo operations like adding and removing cargo, as well as calculating * the storage cost based on the cargo type definition. * * # System Context * This structure is used in contexts where a single cargo type needs to be tracked, * particularly for individual cargo transfers and storage cost calculations. */ export type SingleCargo = { /** The unique identifier of this cargo type */ cargoId: CargoId; /** The quantity of this cargo type */ amount: bigint; }; export type SingleCargoArgs = { /** The unique identifier of this cargo type */ cargoId: CargoIdArgs; /** The quantity of this cargo type */ amount: number | bigint; }; export function getSingleCargoEncoder(): FixedSizeEncoder { return getStructEncoder([ ['cargoId', getCargoIdEncoder()], ['amount', getU64Encoder()], ]); } export function getSingleCargoDecoder(): FixedSizeDecoder { return getStructDecoder([ ['cargoId', getCargoIdDecoder()], ['amount', getU64Decoder()], ]); } export function getSingleCargoCodec(): FixedSizeCodec< SingleCargoArgs, SingleCargo > { return combineCodec(getSingleCargoEncoder(), getSingleCargoDecoder()); }