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

export type DepositForBurn = {
  nonce: bigint;
  burnToken: Address;
  amount: bigint;
  depositor: Address;
  mintRecipient: Address;
  destinationDomain: number;
  destinationTokenMessenger: Address;
  destinationCaller: Address;
};

export type DepositForBurnArgs = {
  nonce: number | bigint;
  burnToken: Address;
  amount: number | bigint;
  depositor: Address;
  mintRecipient: Address;
  destinationDomain: number;
  destinationTokenMessenger: Address;
  destinationCaller: Address;
};

export function getDepositForBurnEncoder(): FixedSizeEncoder<DepositForBurnArgs> {
  return getStructEncoder([
    ["nonce", getU64Encoder()],
    ["burnToken", getAddressEncoder()],
    ["amount", getU64Encoder()],
    ["depositor", getAddressEncoder()],
    ["mintRecipient", getAddressEncoder()],
    ["destinationDomain", getU32Encoder()],
    ["destinationTokenMessenger", getAddressEncoder()],
    ["destinationCaller", getAddressEncoder()],
  ]);
}

export function getDepositForBurnDecoder(): FixedSizeDecoder<DepositForBurn> {
  return getStructDecoder([
    ["nonce", getU64Decoder()],
    ["burnToken", getAddressDecoder()],
    ["amount", getU64Decoder()],
    ["depositor", getAddressDecoder()],
    ["mintRecipient", getAddressDecoder()],
    ["destinationDomain", getU32Decoder()],
    ["destinationTokenMessenger", getAddressDecoder()],
    ["destinationCaller", getAddressDecoder()],
  ]);
}

export function getDepositForBurnCodec(): FixedSizeCodec<
  DepositForBurnArgs,
  DepositForBurn
> {
  return combineCodec(getDepositForBurnEncoder(), getDepositForBurnDecoder());
}
