/** * 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, getU16Decoder, getU16Encoder, getU64Decoder, getU64Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; import { getCargoIdDecoder, getCargoIdEncoder, type CargoId, type CargoIdArgs, } from '.'; export type UpgradeResource = { id: CargoId; /** amount of resource needed */ amount: bigint; /** crew required to process a single unit of the upgrade resource */ crew: number; /** duration to process a single unit of the upgrade resource */ duration: number; }; export type UpgradeResourceArgs = { id: CargoIdArgs; /** amount of resource needed */ amount: number | bigint; /** crew required to process a single unit of the upgrade resource */ crew: number; /** duration to process a single unit of the upgrade resource */ duration: number; }; export function getUpgradeResourceEncoder(): FixedSizeEncoder { return getStructEncoder([ ['id', getCargoIdEncoder()], ['amount', getU64Encoder()], ['crew', getU16Encoder()], ['duration', getU16Encoder()], ]); } export function getUpgradeResourceDecoder(): FixedSizeDecoder { return getStructDecoder([ ['id', getCargoIdDecoder()], ['amount', getU64Decoder()], ['crew', getU16Decoder()], ['duration', getU16Decoder()], ]); } export function getUpgradeResourceCodec(): FixedSizeCodec< UpgradeResourceArgs, UpgradeResource > { return combineCodec(getUpgradeResourceEncoder(), getUpgradeResourceDecoder()); }