/** * 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 Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getU18F14Decoder, getU18F14Encoder, getU26F6Decoder, getU26F6Encoder, type U18F14, type U18F14Args, type U26F6, type U26F6Args, } from '../../fixed/codecs'; /** A ship's cargo stats */ export type CargoStats = { /** the capacity of the ship's cargo hold */ cargoCapacity: bigint; /** the capacity of the ship's fuel tank */ fuelCapacity: bigint; /** the capacity of the ship's ammo bank */ ammoCapacity: bigint; /** the amount of ammo consumed per second by the ship when doing non-combat activities e.g. mining */ ammoConsumptionRate: U18F14; /** the amount of food consumed per second by the ship when doing non-combat activities e.g. mining */ foodConsumptionRate: U18F14; /** the amount of resources that can be mined by a ship per second */ miningRate: U18F14; /** the amount of cargo that the ship can load/unload per second */ loadRate: U26F6; }; export type CargoStatsArgs = { /** the capacity of the ship's cargo hold */ cargoCapacity: number | bigint; /** the capacity of the ship's fuel tank */ fuelCapacity: number | bigint; /** the capacity of the ship's ammo bank */ ammoCapacity: number | bigint; /** the amount of ammo consumed per second by the ship when doing non-combat activities e.g. mining */ ammoConsumptionRate: U18F14Args; /** the amount of food consumed per second by the ship when doing non-combat activities e.g. mining */ foodConsumptionRate: U18F14Args; /** the amount of resources that can be mined by a ship per second */ miningRate: U18F14Args; /** the amount of cargo that the ship can load/unload per second */ loadRate: U26F6Args; }; export function getCargoStatsEncoder(): Encoder { return getStructEncoder([ ['cargoCapacity', getU64Encoder()], ['fuelCapacity', getU64Encoder()], ['ammoCapacity', getU64Encoder()], ['ammoConsumptionRate', getU18F14Encoder()], ['foodConsumptionRate', getU18F14Encoder()], ['miningRate', getU18F14Encoder()], ['loadRate', getU26F6Encoder()], ]); } export function getCargoStatsDecoder(): Decoder { return getStructDecoder([ ['cargoCapacity', getU64Decoder()], ['fuelCapacity', getU64Decoder()], ['ammoCapacity', getU64Decoder()], ['ammoConsumptionRate', getU18F14Decoder()], ['foodConsumptionRate', getU18F14Decoder()], ['miningRate', getU18F14Decoder()], ['loadRate', getU26F6Decoder()], ]); } export function getCargoStatsCodec(): Codec { return combineCodec(getCargoStatsEncoder(), getCargoStatsDecoder()); }