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

export type ReleaseFundsEvent = {
  eventDiscriminator: number;
  instanceSeed: Address;
  operator: Address;
  amount: bigint;
  user: Address;
  mint: Address;
  newWithdrawalRoot: Array<number>;
};

export type ReleaseFundsEventArgs = {
  eventDiscriminator: number;
  instanceSeed: Address;
  operator: Address;
  amount: number | bigint;
  user: Address;
  mint: Address;
  newWithdrawalRoot: Array<number>;
};

export function getReleaseFundsEventEncoder(): FixedSizeEncoder<ReleaseFundsEventArgs> {
  return getStructEncoder([
    ["eventDiscriminator", getU8Encoder()],
    ["instanceSeed", getAddressEncoder()],
    ["operator", getAddressEncoder()],
    ["amount", getU64Encoder()],
    ["user", getAddressEncoder()],
    ["mint", getAddressEncoder()],
    ["newWithdrawalRoot", getArrayEncoder(getU8Encoder(), { size: 32 })],
  ]);
}

export function getReleaseFundsEventDecoder(): FixedSizeDecoder<ReleaseFundsEvent> {
  return getStructDecoder([
    ["eventDiscriminator", getU8Decoder()],
    ["instanceSeed", getAddressDecoder()],
    ["operator", getAddressDecoder()],
    ["amount", getU64Decoder()],
    ["user", getAddressDecoder()],
    ["mint", getAddressDecoder()],
    ["newWithdrawalRoot", getArrayDecoder(getU8Decoder(), { size: 32 })],
  ]);
}

export function getReleaseFundsEventCodec(): FixedSizeCodec<
  ReleaseFundsEventArgs,
  ReleaseFundsEvent
> {
  return combineCodec(
    getReleaseFundsEventEncoder(),
    getReleaseFundsEventDecoder(),
  );
}
