/** * 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, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; import { getCargoCategoryIdDecoder, getCargoCategoryIdEncoder, getCargoFlagsDecoder, getCargoFlagsEncoder, getCargoIdDecoder, getCargoIdEncoder, getNameDecoder, getNameEncoder, type CargoCategoryId, type CargoCategoryIdArgs, type CargoFlags, type CargoFlagsArgs, type CargoId, type CargoIdArgs, type Name, type NameArgs, } from '.'; /** * Represents a specific cargo type with its properties and constraints. * * # System Context * This structure underpins the cargo system by defining the characteristics * and constraints of each cargo type in the game economy. */ export type CargoType = { /** The id of this cargo type */ id: CargoId; /** The name of this cargo type */ name: Name; /** The mint associated with this cargo type */ mint: Address; /** The storage cost of this cargo type */ storageCost: number; /** The category id of this cargo type */ category: CargoCategoryId; /** The duration of a withdrawal epoch in seconds, if `0` withdrawals are disabled */ withdrawEpochDuration: number; /** The max withdrawable amount each epoch */ circuitBreaker: bigint; /** XP modifier applied to actions which produce this cargo type */ xpModifier: number; /** Flags applicable to this cargo type */ flags: CargoFlags; }; export type CargoTypeArgs = { /** The id of this cargo type */ id: CargoIdArgs; /** The name of this cargo type */ name: NameArgs; /** The mint associated with this cargo type */ mint: Address; /** The storage cost of this cargo type */ storageCost: number; /** The category id of this cargo type */ category: CargoCategoryIdArgs; /** The duration of a withdrawal epoch in seconds, if `0` withdrawals are disabled */ withdrawEpochDuration: number; /** The max withdrawable amount each epoch */ circuitBreaker: number | bigint; /** XP modifier applied to actions which produce this cargo type */ xpModifier: number; /** Flags applicable to this cargo type */ flags: CargoFlagsArgs; }; export function getCargoTypeEncoder(): FixedSizeEncoder { return getStructEncoder([ ['id', getCargoIdEncoder()], ['name', getNameEncoder()], ['mint', getAddressEncoder()], ['storageCost', getU32Encoder()], ['category', getCargoCategoryIdEncoder()], ['withdrawEpochDuration', getU32Encoder()], ['circuitBreaker', getU64Encoder()], ['xpModifier', getU32Encoder()], ['flags', getCargoFlagsEncoder()], ]); } export function getCargoTypeDecoder(): FixedSizeDecoder { return getStructDecoder([ ['id', getCargoIdDecoder()], ['name', getNameDecoder()], ['mint', getAddressDecoder()], ['storageCost', getU32Decoder()], ['category', getCargoCategoryIdDecoder()], ['withdrawEpochDuration', getU32Decoder()], ['circuitBreaker', getU64Decoder()], ['xpModifier', getU32Decoder()], ['flags', getCargoFlagsDecoder()], ]); } export function getCargoTypeCodec(): FixedSizeCodec { return combineCodec(getCargoTypeEncoder(), getCargoTypeDecoder()); }