UNPKG

@macalinao/grill

Version:

Modern Solana development kit for React applications with automatic account batching, caching, and transaction notifications

29 lines 985 B
import { decodeAccount } from "gill"; import { GRILL_HOOK_CLIENT_KEY } from "../constants.js"; /** * Create a query key for the account query * @param address - The address of the account * @returns The query key */ export const createAccountQueryKey = (address) => [GRILL_HOOK_CLIENT_KEY, "account", address]; /** * Fetch and decode an account using the DataLoader * @param address - The address of the account to fetch * @param accountLoader - The DataLoader instance for batching account requests * @param decoder - Optional decoder for the account data * @returns The account data or null if not found */ export async function fetchAndDecodeAccount(address, accountLoader, decoder) { if (!address) { return null; } const account = await accountLoader.load(address); if (!account) { return null; } if (decoder) { return decodeAccount(account, decoder); } return account; } //# sourceMappingURL=account-helpers.js.map