/** * 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, getBooleanDecoder, getBooleanEncoder, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from "@solana/kit"; export type PythLazerData = { feedId: number; exponent: number; /** * Tolerance factor for the bid/ask spread check (`ask - bid` against the * price). `0` disables the spread check entirely, in which case the payload * is not required to carry `BestBidPrice`/`BestAskPrice`. */ bidAskSpreadFactor: number; emaEnabled: boolean; emaConfidenceFactor: number; /** Tolerance factor for the native Lazer `Confidence` check; `0` disables it. */ priceConfidenceFactor: number; }; export type PythLazerDataArgs = PythLazerData; export function getPythLazerDataEncoder(): FixedSizeEncoder { return getStructEncoder([ ["feedId", getU16Encoder()], ["exponent", getU8Encoder()], ["bidAskSpreadFactor", getU32Encoder()], ["emaEnabled", getBooleanEncoder()], ["emaConfidenceFactor", getU32Encoder()], ["priceConfidenceFactor", getU32Encoder()], ]); } export function getPythLazerDataDecoder(): FixedSizeDecoder { return getStructDecoder([ ["feedId", getU16Decoder()], ["exponent", getU8Decoder()], ["bidAskSpreadFactor", getU32Decoder()], ["emaEnabled", getBooleanDecoder()], ["emaConfidenceFactor", getU32Decoder()], ["priceConfidenceFactor", getU32Decoder()], ]); } export function getPythLazerDataCodec(): FixedSizeCodec< PythLazerDataArgs, PythLazerData > { return combineCodec(getPythLazerDataEncoder(), getPythLazerDataDecoder()); }