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

export type TokenPairLinked = {
  localToken: Address;
  remoteDomain: number;
  remoteToken: Address;
};

export type TokenPairLinkedArgs = TokenPairLinked;

export function getTokenPairLinkedEncoder(): FixedSizeEncoder<TokenPairLinkedArgs> {
  return getStructEncoder([
    ["localToken", getAddressEncoder()],
    ["remoteDomain", getU32Encoder()],
    ["remoteToken", getAddressEncoder()],
  ]);
}

export function getTokenPairLinkedDecoder(): FixedSizeDecoder<TokenPairLinked> {
  return getStructDecoder([
    ["localToken", getAddressDecoder()],
    ["remoteDomain", getU32Decoder()],
    ["remoteToken", getAddressDecoder()],
  ]);
}

export function getTokenPairLinkedCodec(): FixedSizeCodec<
  TokenPairLinkedArgs,
  TokenPairLinked
> {
  return combineCodec(getTokenPairLinkedEncoder(), getTokenPairLinkedDecoder());
}
