/** * 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, getU64Decoder, getU64Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from "@solana/kit"; export type PnlAndFee = { hasProfit: boolean; pnlDelta: bigint; openPositionFeeUsd: bigint; closePositionFeeUsd: bigint; fundingFeeUsd: bigint; liquidationPrice: bigint; }; export type PnlAndFeeArgs = { hasProfit: boolean; pnlDelta: number | bigint; openPositionFeeUsd: number | bigint; closePositionFeeUsd: number | bigint; fundingFeeUsd: number | bigint; liquidationPrice: number | bigint; }; export function getPnlAndFeeEncoder(): FixedSizeEncoder { return getStructEncoder([ ["hasProfit", getBooleanEncoder()], ["pnlDelta", getU64Encoder()], ["openPositionFeeUsd", getU64Encoder()], ["closePositionFeeUsd", getU64Encoder()], ["fundingFeeUsd", getU64Encoder()], ["liquidationPrice", getU64Encoder()], ]); } export function getPnlAndFeeDecoder(): FixedSizeDecoder { return getStructDecoder([ ["hasProfit", getBooleanDecoder()], ["pnlDelta", getU64Decoder()], ["openPositionFeeUsd", getU64Decoder()], ["closePositionFeeUsd", getU64Decoder()], ["fundingFeeUsd", getU64Decoder()], ["liquidationPrice", getU64Decoder()], ]); } export function getPnlAndFeeCodec(): FixedSizeCodec { return combineCodec(getPnlAndFeeEncoder(), getPnlAndFeeDecoder()); }