/** * 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, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; import { getRegionIdDecoder, getRegionIdEncoder, type RegionId, type RegionIdArgs, } from '.'; export type CreateFactionArgs = { /** Capability bitset ([`crate::state::FactionCapabilityFlags`]). Admin-masked via `validate_flag_grant`. */ capabilityFlags: number; /** Content-addressed off-chain lore hash (SHA-256 of the canonical content file). */ nameHash: Array; /** Off-chain manifest hash (cosmetics / blueprint catalog / dialogue). */ contentUriHash: Array; /** Homeland region (`0` = none). */ homeRegion: RegionId; /** Max simultaneous Allied edges (diplomacy cap, enforced in P3). */ maxAllies: number; }; export type CreateFactionArgsArgs = { /** Capability bitset ([`crate::state::FactionCapabilityFlags`]). Admin-masked via `validate_flag_grant`. */ capabilityFlags: number; /** Content-addressed off-chain lore hash (SHA-256 of the canonical content file). */ nameHash: Array; /** Off-chain manifest hash (cosmetics / blueprint catalog / dialogue). */ contentUriHash: Array; /** Homeland region (`0` = none). */ homeRegion: RegionIdArgs; /** Max simultaneous Allied edges (diplomacy cap, enforced in P3). */ maxAllies: number; }; export function getCreateFactionArgsEncoder(): FixedSizeEncoder { return getStructEncoder([ ['capabilityFlags', getU32Encoder()], ['nameHash', getArrayEncoder(getU8Encoder(), { size: 32 })], ['contentUriHash', getArrayEncoder(getU8Encoder(), { size: 32 })], ['homeRegion', getRegionIdEncoder()], ['maxAllies', getU8Encoder()], ]); } export function getCreateFactionArgsDecoder(): FixedSizeDecoder { return getStructDecoder([ ['capabilityFlags', getU32Decoder()], ['nameHash', getArrayDecoder(getU8Decoder(), { size: 32 })], ['contentUriHash', getArrayDecoder(getU8Decoder(), { size: 32 })], ['homeRegion', getRegionIdDecoder()], ['maxAllies', getU8Decoder()], ]); } export function getCreateFactionArgsCodec(): FixedSizeCodec< CreateFactionArgsArgs, CreateFactionArgs > { return combineCodec( getCreateFactionArgsEncoder(), getCreateFactionArgsDecoder(), ); }