/** * 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, getU32Decoder, getU32Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getBuildingIdDecoder, getBuildingIdEncoder, getHabBuildingDefinitionDecoder, getHabBuildingDefinitionEncoder, type BuildingId, type BuildingIdArgs, type HabBuildingDefinition, type HabBuildingDefinitionArgs, } from '.'; export type HabBuildingDefinitions = { seqId: number; habBuildingDefinitions: { /** The total size of the unsized bytes in the list */ unsizedLen: number; /** The list of items containing offsets, and potentially extra metadata, for the start of each element in the unsized list */ offsetList: Array<{ offset: number; key: BuildingId }>; /** The list of byte offsets for the start of each element in the unsized list */ unsizedList: Array; }; }; export type HabBuildingDefinitionsArgs = { seqId: number; habBuildingDefinitions: { /** The total size of the unsized bytes in the list */ unsizedLen: number; /** The list of items containing offsets, and potentially extra metadata, for the start of each element in the unsized list */ offsetList: Array<{ offset: number; key: BuildingIdArgs }>; /** The list of byte offsets for the start of each element in the unsized list */ unsizedList: Array; }; }; export function getHabBuildingDefinitionsEncoder(): Encoder { return getStructEncoder([ ['seqId', getU32Encoder()], [ 'habBuildingDefinitions', getStructEncoder([ ['unsizedLen', getU32Encoder()], [ 'offsetList', getArrayEncoder( getStructEncoder([ ['offset', getU32Encoder()], ['key', getBuildingIdEncoder()], ]), ), ], ['unsizedList', getArrayEncoder(getHabBuildingDefinitionEncoder())], ]), ], ]); } export function getHabBuildingDefinitionsDecoder(): Decoder { return getStructDecoder([ ['seqId', getU32Decoder()], [ 'habBuildingDefinitions', getStructDecoder([ ['unsizedLen', getU32Decoder()], [ 'offsetList', getArrayDecoder( getStructDecoder([ ['offset', getU32Decoder()], ['key', getBuildingIdDecoder()], ]), ), ], ['unsizedList', getArrayDecoder(getHabBuildingDefinitionDecoder())], ]), ], ]); } export function getHabBuildingDefinitionsCodec(): Codec< HabBuildingDefinitionsArgs, HabBuildingDefinitions > { return combineCodec( getHabBuildingDefinitionsEncoder(), getHabBuildingDefinitionsDecoder(), ); }