/** * 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 { getBuildingDefinitionDecoder, getBuildingDefinitionEncoder, getBuildingIdDecoder, getBuildingIdEncoder, type BuildingDefinition, type BuildingDefinitionArgs, type BuildingId, type BuildingIdArgs, } from '.'; export type BuildingDefinitions = { seqId: number; buildings: { /** 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 BuildingDefinitionsArgs = { seqId: number; buildings: { /** 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 getBuildingDefinitionsEncoder(): Encoder { return getStructEncoder([ ['seqId', getU32Encoder()], [ 'buildings', getStructEncoder([ ['unsizedLen', getU32Encoder()], [ 'offsetList', getArrayEncoder( getStructEncoder([ ['offset', getU32Encoder()], ['key', getBuildingIdEncoder()], ]), ), ], ['unsizedList', getArrayEncoder(getBuildingDefinitionEncoder())], ]), ], ]); } export function getBuildingDefinitionsDecoder(): Decoder { return getStructDecoder([ ['seqId', getU32Decoder()], [ 'buildings', getStructDecoder([ ['unsizedLen', getU32Decoder()], [ 'offsetList', getArrayDecoder( getStructDecoder([ ['offset', getU32Decoder()], ['key', getBuildingIdDecoder()], ]), ), ], ['unsizedList', getArrayDecoder(getBuildingDefinitionDecoder())], ]), ], ]); } export function getBuildingDefinitionsCodec(): Codec< BuildingDefinitionsArgs, BuildingDefinitions > { return combineCodec( getBuildingDefinitionsEncoder(), getBuildingDefinitionsDecoder(), ); }