/**
 * 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 ClaimedRelayerRefund = {
  l2TokenAddress: Address;
  claimAmount: bigint;
  refundAddress: Address;
};

export type ClaimedRelayerRefundArgs = {
  l2TokenAddress: Address;
  claimAmount: number | bigint;
  refundAddress: Address;
};

export function getClaimedRelayerRefundEncoder(): FixedSizeEncoder<ClaimedRelayerRefundArgs> {
  return getStructEncoder([
    ["l2TokenAddress", getAddressEncoder()],
    ["claimAmount", getU64Encoder()],
    ["refundAddress", getAddressEncoder()],
  ]);
}

export function getClaimedRelayerRefundDecoder(): FixedSizeDecoder<ClaimedRelayerRefund> {
  return getStructDecoder([
    ["l2TokenAddress", getAddressDecoder()],
    ["claimAmount", getU64Decoder()],
    ["refundAddress", getAddressDecoder()],
  ]);
}

export function getClaimedRelayerRefundCodec(): FixedSizeCodec<
  ClaimedRelayerRefundArgs,
  ClaimedRelayerRefund
> {
  return combineCodec(
    getClaimedRelayerRefundEncoder(),
    getClaimedRelayerRefundDecoder(),
  );
}
