/** * 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, getI16Decoder, getI16Encoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from '@solana/kit'; /** * One perk-catalogue row, authored on-chain (the on-chain mirror of the reference * `PerkDef`, perks_rs:80-99). `BorshSerialize/Deserialize + TypeToIdl` for the client/IDL * surface (as `CrewTransferInput`, crew_transfer_common_rs:129). */ export type PerkDefInput = { /** stable catalogue id (`PerkSlot.perk_id`; `0` reserved = empty). */ id: number; /** the no-op-default slot family this perk's delta lands on (raw `SlotFamily` byte). */ slotFamily: number; /** the trigger gating the perk (raw `Trigger` byte). */ trigger: number; /** magnitude per tier, as the `i16` q-format the summary stores (master §5.1 fixed-point). */ magPerTier: number; /** the aptitude whose major/anomalous tag gates the offer (raw `Aptitude` byte). */ aptitudeGate: number; /** the rarity floor (raw `Rarity` byte). */ rarityFloor: number; /** optional personality gate: `trait_idx`/`op`/`threshold_q8` (`op == 0xFF` ⇒ none). */ personalityTraitIdx: number; personalityOp: number; personalityThresholdQ8: number; }; export type PerkDefInputArgs = PerkDefInput; export function getPerkDefInputEncoder(): FixedSizeEncoder { return getStructEncoder([ ['id', getU16Encoder()], ['slotFamily', getU8Encoder()], ['trigger', getU8Encoder()], ['magPerTier', getI16Encoder()], ['aptitudeGate', getU8Encoder()], ['rarityFloor', getU8Encoder()], ['personalityTraitIdx', getU8Encoder()], ['personalityOp', getU8Encoder()], ['personalityThresholdQ8', getU8Encoder()], ]); } export function getPerkDefInputDecoder(): FixedSizeDecoder { return getStructDecoder([ ['id', getU16Decoder()], ['slotFamily', getU8Decoder()], ['trigger', getU8Decoder()], ['magPerTier', getI16Decoder()], ['aptitudeGate', getU8Decoder()], ['rarityFloor', getU8Decoder()], ['personalityTraitIdx', getU8Decoder()], ['personalityOp', getU8Decoder()], ['personalityThresholdQ8', getU8Decoder()], ]); } export function getPerkDefInputCodec(): FixedSizeCodec< PerkDefInputArgs, PerkDefInput > { return combineCodec(getPerkDefInputEncoder(), getPerkDefInputDecoder()); }