UNPKG

@nosana/kit

Version:

Nosana KIT

59 lines 2.79 kB
/** * 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, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit'; export const SETTINGS_ACCOUNT_DISCRIMINATOR = new Uint8Array([ 63, 89, 203, 155, 76, 237, 115, 58, ]); export function getSettingsAccountDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode(SETTINGS_ACCOUNT_DISCRIMINATOR); } /** Gets the encoder for {@link SettingsAccountArgs} account data. */ export function getSettingsAccountEncoder() { return transformEncoder(getStructEncoder([ ['discriminator', fixEncoderSize(getBytesEncoder(), 8)], ['authority', getAddressEncoder()], ['tokenAccount', getAddressEncoder()], ]), (value) => ({ ...value, discriminator: SETTINGS_ACCOUNT_DISCRIMINATOR })); } /** Gets the decoder for {@link SettingsAccount} account data. */ export function getSettingsAccountDecoder() { return getStructDecoder([ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)], ['authority', getAddressDecoder()], ['tokenAccount', getAddressDecoder()], ]); } /** Gets the codec for {@link SettingsAccount} account data. */ export function getSettingsAccountCodec() { return combineCodec(getSettingsAccountEncoder(), getSettingsAccountDecoder()); } export function decodeSettingsAccount(encodedAccount) { return decodeAccount(encodedAccount, getSettingsAccountDecoder()); } export async function fetchSettingsAccount(rpc, address, config) { const maybeAccount = await fetchMaybeSettingsAccount(rpc, address, config); assertAccountExists(maybeAccount); return maybeAccount; } export async function fetchMaybeSettingsAccount(rpc, address, config) { const maybeAccount = await fetchEncodedAccount(rpc, address, config); return decodeSettingsAccount(maybeAccount); } export async function fetchAllSettingsAccount(rpc, addresses, config) { const maybeAccounts = await fetchAllMaybeSettingsAccount(rpc, addresses, config); assertAccountsExist(maybeAccounts); return maybeAccounts; } export async function fetchAllMaybeSettingsAccount(rpc, addresses, config) { const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config); return maybeAccounts.map((maybeAccount) => decodeSettingsAccount(maybeAccount)); } export function getSettingsAccountSize() { return 72; } //# sourceMappingURL=settingsAccount.js.map