/** * 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, getI64Decoder, getI64Encoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, type Codec, type Decoder, type Encoder, } from '@solana/kit'; import { getCraftingHabDefinitionDecoder, getCraftingHabDefinitionEncoder, getCraftingHabDefinitionIdDecoder, getCraftingHabDefinitionIdEncoder, type CraftingHabDefinition, type CraftingHabDefinitionArgs, type CraftingHabDefinitionId, type CraftingHabDefinitionIdArgs, } from '.'; /** Crafting hab definitions container */ export type CraftingHabDefinitions = { seqId: number; /** The amount of time a crafting hab is immune to eviction after its rent runs out. */ evictionGracePeriod: bigint; /** Time taken for crafting habs to respawn when a starbase is destroyed */ respawnTime: bigint; craftingHabs: { /** 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: CraftingHabDefinitionId }>; /** The list of byte offsets for the start of each element in the unsized list */ unsizedList: Array; }; }; export type CraftingHabDefinitionsArgs = { seqId: number; /** The amount of time a crafting hab is immune to eviction after its rent runs out. */ evictionGracePeriod: number | bigint; /** Time taken for crafting habs to respawn when a starbase is destroyed */ respawnTime: number | bigint; craftingHabs: { /** 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: CraftingHabDefinitionIdArgs }>; /** The list of byte offsets for the start of each element in the unsized list */ unsizedList: Array; }; }; export function getCraftingHabDefinitionsEncoder(): Encoder { return getStructEncoder([ ['seqId', getU32Encoder()], ['evictionGracePeriod', getI64Encoder()], ['respawnTime', getI64Encoder()], [ 'craftingHabs', getStructEncoder([ ['unsizedLen', getU32Encoder()], [ 'offsetList', getArrayEncoder( getStructEncoder([ ['offset', getU32Encoder()], ['key', getCraftingHabDefinitionIdEncoder()], ]), ), ], ['unsizedList', getArrayEncoder(getCraftingHabDefinitionEncoder())], ]), ], ]); } export function getCraftingHabDefinitionsDecoder(): Decoder { return getStructDecoder([ ['seqId', getU32Decoder()], ['evictionGracePeriod', getI64Decoder()], ['respawnTime', getI64Decoder()], [ 'craftingHabs', getStructDecoder([ ['unsizedLen', getU32Decoder()], [ 'offsetList', getArrayDecoder( getStructDecoder([ ['offset', getU32Decoder()], ['key', getCraftingHabDefinitionIdDecoder()], ]), ), ], ['unsizedList', getArrayDecoder(getCraftingHabDefinitionDecoder())], ]), ], ]); } export function getCraftingHabDefinitionsCodec(): Codec< CraftingHabDefinitionsArgs, CraftingHabDefinitions > { return combineCodec( getCraftingHabDefinitionsEncoder(), getCraftingHabDefinitionsDecoder(), ); }