/** * 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, getMapDecoder, getMapEncoder, getSetDecoder, getSetEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getCharacterModifierDecoder, getCharacterModifierEncoder, getResearchNodeIdDecoder, getResearchNodeIdEncoder, type CharacterModifier, type CharacterModifierArgs, type ResearchNodeId, type ResearchNodeIdArgs, } from '.'; export type CharacterModifiers = { seqId: number; /** * When nodes are updated the seq_id changes and unupdated_count is set to the len of unlocked_nodes. * * Then loop through each unlocked node by list index in the set (starting with len - unupdated_count) * and modify the modifier. */ unupdatedCount: number; /** Set of unlocked nodes */ unlockedNodes: Set; /** Per-node unlock level. Missing entries for legacy/unrepeatable nodes are treated as level 1 when unlocked. */ nodeLevels: Map; modifiers: CharacterModifier; }; export type CharacterModifiersArgs = { seqId: number; /** * When nodes are updated the seq_id changes and unupdated_count is set to the len of unlocked_nodes. * * Then loop through each unlocked node by list index in the set (starting with len - unupdated_count) * and modify the modifier. */ unupdatedCount: number; /** Set of unlocked nodes */ unlockedNodes: Set; /** Per-node unlock level. Missing entries for legacy/unrepeatable nodes are treated as level 1 when unlocked. */ nodeLevels: Map; modifiers: CharacterModifierArgs; }; export function getCharacterModifiersEncoder(): Encoder { return getStructEncoder([ ['seqId', getU32Encoder()], ['unupdatedCount', getU16Encoder()], ['unlockedNodes', getSetEncoder(getResearchNodeIdEncoder())], ['nodeLevels', getMapEncoder(getResearchNodeIdEncoder(), getU32Encoder())], ['modifiers', getCharacterModifierEncoder()], ]); } export function getCharacterModifiersDecoder(): Decoder { return getStructDecoder([ ['seqId', getU32Decoder()], ['unupdatedCount', getU16Decoder()], ['unlockedNodes', getSetDecoder(getResearchNodeIdDecoder())], ['nodeLevels', getMapDecoder(getResearchNodeIdDecoder(), getU32Decoder())], ['modifiers', getCharacterModifierDecoder()], ]); } export function getCharacterModifiersCodec(): Codec< CharacterModifiersArgs, CharacterModifiers > { return combineCodec( getCharacterModifiersEncoder(), getCharacterModifiersDecoder(), ); }