/** * 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 { addDecoderSizePrefix, addEncoderSizePrefix, assertAccountExists, assertAccountsExist, combineCodec, decodeAccount, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getOptionDecoder, getOptionEncoder, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU8Decoder, getU8Encoder, transformEncoder, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type Option, type OptionOrNullable, type ReadonlyUint8Array, } from "@solana/kit"; export const DIRECT_WITHDRAW_INIT_RECEIPT_DISCRIMINATOR = new Uint8Array([ 206, 77, 207, 208, 25, 244, 81, 172, ]); export function getDirectWithdrawInitReceiptDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode( DIRECT_WITHDRAW_INIT_RECEIPT_DISCRIMINATOR, ); } export type DirectWithdrawInitReceipt = { discriminator: ReadonlyUint8Array; /** The vault associated with this strategy. */ vault: Address; /** The strategy address. */ strategy: Address; /** The position value. */ adaptorProgram: Address; /** The instruction discriminator. */ instructionDiscriminator: ReadonlyUint8Array; /** The additional arguments. */ additionalArgs: Option; /** Whether the user args are allowed. */ allowUserArgs: boolean; /** A version number (1 byte). */ version: number; /** The bump for the strategy init receipt. */ bump: number; }; export type DirectWithdrawInitReceiptArgs = { /** The vault associated with this strategy. */ vault: Address; /** The strategy address. */ strategy: Address; /** The position value. */ adaptorProgram: Address; /** The instruction discriminator. */ instructionDiscriminator: ReadonlyUint8Array; /** The additional arguments. */ additionalArgs: OptionOrNullable; /** Whether the user args are allowed. */ allowUserArgs: boolean; /** A version number (1 byte). */ version: number; /** The bump for the strategy init receipt. */ bump: number; }; /** Gets the encoder for {@link DirectWithdrawInitReceiptArgs} account data. */ export function getDirectWithdrawInitReceiptEncoder(): Encoder { return transformEncoder( getStructEncoder([ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["vault", getAddressEncoder()], ["strategy", getAddressEncoder()], ["adaptorProgram", getAddressEncoder()], [ "instructionDiscriminator", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder()), ], [ "additionalArgs", getOptionEncoder( addEncoderSizePrefix(getBytesEncoder(), getU32Encoder()), ), ], ["allowUserArgs", getBooleanEncoder()], ["version", getU8Encoder()], ["bump", getU8Encoder()], ]), (value) => ({ ...value, discriminator: DIRECT_WITHDRAW_INIT_RECEIPT_DISCRIMINATOR, }), ); } /** Gets the decoder for {@link DirectWithdrawInitReceipt} account data. */ export function getDirectWithdrawInitReceiptDecoder(): Decoder { return getStructDecoder([ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["vault", getAddressDecoder()], ["strategy", getAddressDecoder()], ["adaptorProgram", getAddressDecoder()], [ "instructionDiscriminator", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder()), ], [ "additionalArgs", getOptionDecoder( addDecoderSizePrefix(getBytesDecoder(), getU32Decoder()), ), ], ["allowUserArgs", getBooleanDecoder()], ["version", getU8Decoder()], ["bump", getU8Decoder()], ]); } /** Gets the codec for {@link DirectWithdrawInitReceipt} account data. */ export function getDirectWithdrawInitReceiptCodec(): Codec< DirectWithdrawInitReceiptArgs, DirectWithdrawInitReceipt > { return combineCodec( getDirectWithdrawInitReceiptEncoder(), getDirectWithdrawInitReceiptDecoder(), ); } export function decodeDirectWithdrawInitReceipt< TAddress extends string = string, >( encodedAccount: EncodedAccount, ): Account; export function decodeDirectWithdrawInitReceipt< TAddress extends string = string, >( encodedAccount: MaybeEncodedAccount, ): MaybeAccount; export function decodeDirectWithdrawInitReceipt< TAddress extends string = string, >( encodedAccount: EncodedAccount | MaybeEncodedAccount, ): | Account | MaybeAccount { return decodeAccount( encodedAccount as MaybeEncodedAccount, getDirectWithdrawInitReceiptDecoder(), ); } export async function fetchDirectWithdrawInitReceipt< TAddress extends string = string, >( rpc: Parameters[0], address: Address, config?: FetchAccountConfig, ): Promise> { const maybeAccount = await fetchMaybeDirectWithdrawInitReceipt( rpc, address, config, ); assertAccountExists(maybeAccount); return maybeAccount; } export async function fetchMaybeDirectWithdrawInitReceipt< TAddress extends string = string, >( rpc: Parameters[0], address: Address, config?: FetchAccountConfig, ): Promise> { const maybeAccount = await fetchEncodedAccount(rpc, address, config); return decodeDirectWithdrawInitReceipt(maybeAccount); } export async function fetchAllDirectWithdrawInitReceipt( rpc: Parameters[0], addresses: Array
, config?: FetchAccountsConfig, ): Promise[]> { const maybeAccounts = await fetchAllMaybeDirectWithdrawInitReceipt( rpc, addresses, config, ); assertAccountsExist(maybeAccounts); return maybeAccounts; } export async function fetchAllMaybeDirectWithdrawInitReceipt( rpc: Parameters[0], addresses: Array
, config?: FetchAccountsConfig, ): Promise[]> { const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodeDirectWithdrawInitReceipt(maybeAccount), ); }