/** * 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, getU16Decoder, getU16Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from "@solana/kit"; export type ConditionalData = { condition: number; toleranceBps: number; /** * Extension-prone source list is stored last so future versioned layouts can * add more sources without shifting earlier scalar fields. */ sources: Array; }; export type ConditionalDataArgs = ConditionalData; export function getConditionalDataEncoder(): FixedSizeEncoder { return getStructEncoder([ ["condition", getU8Encoder()], ["toleranceBps", getU16Encoder()], ["sources", getArrayEncoder(getU16Encoder(), { size: 3 })], ]); } export function getConditionalDataDecoder(): FixedSizeDecoder { return getStructDecoder([ ["condition", getU8Decoder()], ["toleranceBps", getU16Decoder()], ["sources", getArrayDecoder(getU16Decoder(), { size: 3 })], ]); } export function getConditionalDataCodec(): FixedSizeCodec< ConditionalDataArgs, ConditionalData > { return combineCodec(getConditionalDataEncoder(), getConditionalDataDecoder()); }