@kamino-finance/kliquidity-sdk
Version:
Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol
25 lines (19 loc) • 1.78 kB
text/typescript
/**
* 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, getBooleanDecoder, getBooleanEncoder, getI128Decoder, getI128Encoder, getStructDecoder, getStructEncoder, getU128Decoder, getU128Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from '@solana/kit';
export type Tick = { initialized: boolean; liquidityNet: bigint; liquidityGross: bigint; feeGrowthOutsideA: bigint; feeGrowthOutsideB: bigint; rewardGrowthsOutside: Array<bigint>; };
export type TickArgs = { initialized: boolean; liquidityNet: number | bigint; liquidityGross: number | bigint; feeGrowthOutsideA: number | bigint; feeGrowthOutsideB: number | bigint; rewardGrowthsOutside: Array<number | bigint>; };
export function getTickEncoder(): FixedSizeEncoder<TickArgs> {
return getStructEncoder([['initialized', getBooleanEncoder()], ['liquidityNet', getI128Encoder()], ['liquidityGross', getU128Encoder()], ['feeGrowthOutsideA', getU128Encoder()], ['feeGrowthOutsideB', getU128Encoder()], ['rewardGrowthsOutside', getArrayEncoder(getU128Encoder(), { size: 3 })]]);
}
export function getTickDecoder(): FixedSizeDecoder<Tick> {
return getStructDecoder([['initialized', getBooleanDecoder()], ['liquidityNet', getI128Decoder()], ['liquidityGross', getU128Decoder()], ['feeGrowthOutsideA', getU128Decoder()], ['feeGrowthOutsideB', getU128Decoder()], ['rewardGrowthsOutside', getArrayDecoder(getU128Decoder(), { size: 3 })]]);
}
export function getTickCodec(): FixedSizeCodec<TickArgs, Tick> {
return combineCodec(getTickEncoder(), getTickDecoder());
}