/** * 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 { assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, getU8Decoder, getU8Encoder, transformEncoder, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array, } from "@solana/kit"; export const CLAIM_FEE_OPERATOR_DISCRIMINATOR: ReadonlyUint8Array = new Uint8Array([166, 48, 134, 86, 34, 200, 188, 150]); export function getClaimFeeOperatorDiscriminatorBytes(): ReadonlyUint8Array { return fixEncoderSize(getBytesEncoder(), 8).encode( CLAIM_FEE_OPERATOR_DISCRIMINATOR, ); } export type ClaimFeeOperator = { discriminator: ReadonlyUint8Array; /** operator */ operator: Address; /** Reserve */ padding: Array; }; export type ClaimFeeOperatorArgs = { /** operator */ operator: Address; /** Reserve */ padding: Array; }; /** Gets the encoder for {@link ClaimFeeOperatorArgs} account data. */ export function getClaimFeeOperatorEncoder(): FixedSizeEncoder { return transformEncoder( getStructEncoder([ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["operator", getAddressEncoder()], ["padding", getArrayEncoder(getU8Encoder(), { size: 128 })], ]), (value) => ({ ...value, discriminator: CLAIM_FEE_OPERATOR_DISCRIMINATOR }), ); } /** Gets the decoder for {@link ClaimFeeOperator} account data. */ export function getClaimFeeOperatorDecoder(): FixedSizeDecoder { return getStructDecoder([ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["operator", getAddressDecoder()], ["padding", getArrayDecoder(getU8Decoder(), { size: 128 })], ]); } /** Gets the codec for {@link ClaimFeeOperator} account data. */ export function getClaimFeeOperatorCodec(): FixedSizeCodec< ClaimFeeOperatorArgs, ClaimFeeOperator > { return combineCodec( getClaimFeeOperatorEncoder(), getClaimFeeOperatorDecoder(), ); } export function decodeClaimFeeOperator( encodedAccount: EncodedAccount, ): Account; export function decodeClaimFeeOperator( encodedAccount: MaybeEncodedAccount, ): MaybeAccount; export function decodeClaimFeeOperator( encodedAccount: EncodedAccount | MaybeEncodedAccount, ): | Account | MaybeAccount { return decodeAccount( encodedAccount as MaybeEncodedAccount, getClaimFeeOperatorDecoder(), ); } export async function fetchClaimFeeOperator( rpc: Parameters[0], address: Address, config?: FetchAccountConfig, ): Promise> { const maybeAccount = await fetchMaybeClaimFeeOperator(rpc, address, config); assertAccountExists(maybeAccount); return maybeAccount; } export async function fetchMaybeClaimFeeOperator< TAddress extends string = string, >( rpc: Parameters[0], address: Address, config?: FetchAccountConfig, ): Promise> { const maybeAccount = await fetchEncodedAccount(rpc, address, config); return decodeClaimFeeOperator(maybeAccount); } export async function fetchAllClaimFeeOperator( rpc: Parameters[0], addresses: Array
, config?: FetchAccountsConfig, ): Promise[]> { const maybeAccounts = await fetchAllMaybeClaimFeeOperator( rpc, addresses, config, ); assertAccountsExist(maybeAccounts); return maybeAccounts; } export async function fetchAllMaybeClaimFeeOperator( rpc: Parameters[0], addresses: Array
, config?: FetchAccountsConfig, ): Promise[]> { const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodeClaimFeeOperator(maybeAccount), ); }