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

export type MintAndWithdraw = {
  mintRecipient: Address;
  amount: bigint;
  mintToken: Address;
};

export type MintAndWithdrawArgs = {
  mintRecipient: Address;
  amount: number | bigint;
  mintToken: Address;
};

export function getMintAndWithdrawEncoder(): FixedSizeEncoder<MintAndWithdrawArgs> {
  return getStructEncoder([
    ["mintRecipient", getAddressEncoder()],
    ["amount", getU64Encoder()],
    ["mintToken", getAddressEncoder()],
  ]);
}

export function getMintAndWithdrawDecoder(): FixedSizeDecoder<MintAndWithdraw> {
  return getStructDecoder([
    ["mintRecipient", getAddressDecoder()],
    ["amount", getU64Decoder()],
    ["mintToken", getAddressDecoder()],
  ]);
}

export function getMintAndWithdrawCodec(): FixedSizeCodec<
  MintAndWithdrawArgs,
  MintAndWithdraw
> {
  return combineCodec(getMintAndWithdrawEncoder(), getMintAndWithdrawDecoder());
}
