/** * 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, getArrayDecoder, getArrayEncoder, getStructDecoder, getStructEncoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getCargoIdDecoder, getCargoIdEncoder, getResearchTagDecoder, getResearchTagEncoder, type CargoId, type CargoIdArgs, type ResearchTag, type ResearchTagArgs, } from '.'; import { getU16F16Decoder, getU16F16Encoder, type U16F16, type U16F16Args, } from '../../fixed/codecs'; export type ScanLootEntry = { /** The cargo type to output. */ output: CargoId; /** Amount of tokens output, multiplied by the fleet's scan power. */ outputAmount: bigint; /** All results past this threshold are added to the pool. */ threshold: U16F16; /** The higher this value, the more likely it is to be selected from the pool. */ rollWeight: U16F16; /** Multiplied by scan power */ xpValue: U16F16; /** Number of populated entries in research_requirements. */ researchRequirementCount: number; /** All listed research tags must be present for this loot entry to roll. */ researchRequirements: Array; }; export type ScanLootEntryArgs = { /** The cargo type to output. */ output: CargoIdArgs; /** Amount of tokens output, multiplied by the fleet's scan power. */ outputAmount: number | bigint; /** All results past this threshold are added to the pool. */ threshold: U16F16Args; /** The higher this value, the more likely it is to be selected from the pool. */ rollWeight: U16F16Args; /** Multiplied by scan power */ xpValue: U16F16Args; /** Number of populated entries in research_requirements. */ researchRequirementCount: number; /** All listed research tags must be present for this loot entry to roll. */ researchRequirements: Array; }; export function getScanLootEntryEncoder(): Encoder { return getStructEncoder([ ['output', getCargoIdEncoder()], ['outputAmount', getU64Encoder()], ['threshold', getU16F16Encoder()], ['rollWeight', getU16F16Encoder()], ['xpValue', getU16F16Encoder()], ['researchRequirementCount', getU8Encoder()], [ 'researchRequirements', getArrayEncoder(getResearchTagEncoder(), { size: 4 }), ], ]); } export function getScanLootEntryDecoder(): Decoder { return getStructDecoder([ ['output', getCargoIdDecoder()], ['outputAmount', getU64Decoder()], ['threshold', getU16F16Decoder()], ['rollWeight', getU16F16Decoder()], ['xpValue', getU16F16Decoder()], ['researchRequirementCount', getU8Decoder()], [ 'researchRequirements', getArrayDecoder(getResearchTagDecoder(), { size: 4 }), ], ]); } export function getScanLootEntryCodec(): Codec< ScanLootEntryArgs, ScanLootEntry > { return combineCodec(getScanLootEntryEncoder(), getScanLootEntryDecoder()); }