UNPKG

@saberhq/sail

Version:

Account caching and batched loading for React-based Solana applications.

30 lines (24 loc) 727 B
import type { AccountInfo, KeyedAccountInfo, PublicKey } from "@solana/web3.js"; import type { SailAccountLoadError } from "./errors/errors"; /** * Account id + info. * This is null if the account could not be found, or undefined * if the data is still loading. */ export type AccountDatum = KeyedAccountInfo | null | undefined; /** * Result of the fetching of an account. */ export interface AccountFetchResult { data: KeyedAccountInfo | null; error?: SailAccountLoadError; } /** * Parsed account with additional info. */ export type ParsedAccountInfo<T> = { accountId: PublicKey; accountInfo: AccountInfo<T>; raw: Buffer; }; export type ParsedAccountDatum<T> = ParsedAccountInfo<T> | undefined | null;