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

export type DepositEvent = {
  eventDiscriminator: number;
  instanceSeed: Address;
  user: Address;
  amount: bigint;
  recipient: Address;
  mint: Address;
};

export type DepositEventArgs = {
  eventDiscriminator: number;
  instanceSeed: Address;
  user: Address;
  amount: number | bigint;
  recipient: Address;
  mint: Address;
};

export function getDepositEventEncoder(): FixedSizeEncoder<DepositEventArgs> {
  return getStructEncoder([
    ["eventDiscriminator", getU8Encoder()],
    ["instanceSeed", getAddressEncoder()],
    ["user", getAddressEncoder()],
    ["amount", getU64Encoder()],
    ["recipient", getAddressEncoder()],
    ["mint", getAddressEncoder()],
  ]);
}

export function getDepositEventDecoder(): FixedSizeDecoder<DepositEvent> {
  return getStructDecoder([
    ["eventDiscriminator", getU8Decoder()],
    ["instanceSeed", getAddressDecoder()],
    ["user", getAddressDecoder()],
    ["amount", getU64Decoder()],
    ["recipient", getAddressDecoder()],
    ["mint", getAddressDecoder()],
  ]);
}

export function getDepositEventCodec(): FixedSizeCodec<
  DepositEventArgs,
  DepositEvent
> {
  return combineCodec(getDepositEventEncoder(), getDepositEventDecoder());
}
