UNPKG

@saberhq/sail

Version:

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

28 lines 1.78 kB
import type { Network } from "@saberhq/solana-contrib"; import type { ProgramAccount } from "@saberhq/token-utils"; import type { PublicKey } from "@solana/web3.js"; import type { UseQueryOptions, UseQueryResult } from "react-query"; import type { FetchKeysFn } from ".."; import type { ProgramAccountParser } from "./programAccounts"; /** * Result of a parsed account query. */ export declare type BatchParsedAccountQueryResult<T> = UseQueryResult<BatchedParsedAccountQueryData<T>>; /** * Data resulting from a batch query. */ export declare type BatchedParsedAccountQueryKeys = readonly (PublicKey | null | undefined)[] | null | undefined; /** * Data resulting from a batch query. */ export declare type BatchedParsedAccountQueryData<T> = readonly (ProgramAccount<T> | null | undefined)[] | null | undefined; export declare const makeBatchedParsedAccountQuery: <T>(keys: BatchedParsedAccountQueryKeys, network: Network, fetchKeys: FetchKeysFn, parser: ProgramAccountParser<T>, options?: Omit<UseQueryOptions<BatchedParsedAccountQueryData<T>, unknown, BatchedParsedAccountQueryData<T>, import("react-query").QueryKey>, "queryKey" | "queryFn">) => UseQueryOptions<BatchedParsedAccountQueryData<T>, unknown, BatchedParsedAccountQueryData<T>, import("react-query").QueryKey>; /** * Parses accounts with the given parser, fetching them in batch. * * @param keys * @param parser * @returns */ export declare const useBatchedParsedAccounts: <T>(keys: BatchedParsedAccountQueryKeys, parser: ProgramAccountParser<T>, options?: Omit<UseQueryOptions<BatchedParsedAccountQueryData<T>, unknown, BatchedParsedAccountQueryData<T>, import("react-query").QueryKey>, "queryKey" | "queryFn">) => BatchParsedAccountQueryResult<T>; //# sourceMappingURL=useBatchedParsedAccounts.d.ts.map