/**
 * 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,
  getStructDecoder,
  getStructEncoder,
  getU64Decoder,
  getU64Encoder,
  type FixedSizeCodec,
  type FixedSizeDecoder,
  type FixedSizeEncoder,
} from "@solana/kit";

export type Price = { value: bigint; exp: bigint };

export type PriceArgs = { value: number | bigint; exp: number | bigint };

export function getPriceEncoder(): FixedSizeEncoder<PriceArgs> {
  return getStructEncoder([
    ["value", getU64Encoder()],
    ["exp", getU64Encoder()],
  ]);
}

export function getPriceDecoder(): FixedSizeDecoder<Price> {
  return getStructDecoder([
    ["value", getU64Decoder()],
    ["exp", getU64Decoder()],
  ]);
}

export function getPriceCodec(): FixedSizeCodec<PriceArgs, Price> {
  return combineCodec(getPriceEncoder(), getPriceDecoder());
}
