/**
 * 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 TokensBridged = {
  amountToReturn: bigint;
  chainId: bigint;
  leafId: number;
  l2TokenAddress: Address;
  caller: Address;
};

export type TokensBridgedArgs = {
  amountToReturn: number | bigint;
  chainId: number | bigint;
  leafId: number;
  l2TokenAddress: Address;
  caller: Address;
};

export function getTokensBridgedEncoder(): FixedSizeEncoder<TokensBridgedArgs> {
  return getStructEncoder([
    ["amountToReturn", getU64Encoder()],
    ["chainId", getU64Encoder()],
    ["leafId", getU32Encoder()],
    ["l2TokenAddress", getAddressEncoder()],
    ["caller", getAddressEncoder()],
  ]);
}

export function getTokensBridgedDecoder(): FixedSizeDecoder<TokensBridged> {
  return getStructDecoder([
    ["amountToReturn", getU64Decoder()],
    ["chainId", getU64Decoder()],
    ["leafId", getU32Decoder()],
    ["l2TokenAddress", getAddressDecoder()],
    ["caller", getAddressDecoder()],
  ]);
}

export function getTokensBridgedCodec(): FixedSizeCodec<
  TokensBridgedArgs,
  TokensBridged
> {
  return combineCodec(getTokensBridgedEncoder(), getTokensBridgedDecoder());
}
