/** * 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, getMapDecoder, getMapEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, type Address, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getCargoCategoryIdDecoder, getCargoCategoryIdEncoder, getCargoIdDecoder, getCargoIdEncoder, getCargoTypeDecoder, getCargoTypeEncoder, getNameDecoder, getNameEncoder, type CargoCategoryId, type CargoCategoryIdArgs, type CargoId, type CargoIdArgs, type CargoType, type CargoTypeArgs, type Name, type NameArgs, } from '.'; export type CargoDefinitions = { /** The sequence id of this `CargoDefinitions` account. */ seqId: number; /** The `CargoDefinitionsCache` for this `CargoDefinitions` */ cache: Address; /** A map of cargo types */ cargoTypes: Map; /** A map of mint addresses to cargo types */ mintToId: Map; /** A set of cargo category ids */ cargoCategoryIds: Map; }; export type CargoDefinitionsArgs = { /** The sequence id of this `CargoDefinitions` account. */ seqId: number; /** The `CargoDefinitionsCache` for this `CargoDefinitions` */ cache: Address; /** A map of cargo types */ cargoTypes: Map; /** A map of mint addresses to cargo types */ mintToId: Map; /** A set of cargo category ids */ cargoCategoryIds: Map; }; export function getCargoDefinitionsEncoder(): Encoder { return getStructEncoder([ ['seqId', getU16Encoder()], ['cache', getAddressEncoder()], ['cargoTypes', getMapEncoder(getCargoIdEncoder(), getCargoTypeEncoder())], ['mintToId', getMapEncoder(getAddressEncoder(), getCargoIdEncoder())], [ 'cargoCategoryIds', getMapEncoder(getCargoCategoryIdEncoder(), getNameEncoder()), ], ]); } export function getCargoDefinitionsDecoder(): Decoder { return getStructDecoder([ ['seqId', getU16Decoder()], ['cache', getAddressDecoder()], ['cargoTypes', getMapDecoder(getCargoIdDecoder(), getCargoTypeDecoder())], ['mintToId', getMapDecoder(getAddressDecoder(), getCargoIdDecoder())], [ 'cargoCategoryIds', getMapDecoder(getCargoCategoryIdDecoder(), getNameDecoder()), ], ]); } export function getCargoDefinitionsCodec(): Codec< CargoDefinitionsArgs, CargoDefinitions > { return combineCodec( getCargoDefinitionsEncoder(), getCargoDefinitionsDecoder(), ); }