@saberhq/sail
Version:
Account caching and batched loading for React-based Solana applications.
60 lines • 2.37 kB
TypeScript
import type { Network } from "@saberhq/solana-contrib";
import { Token } from "@saberhq/token-utils";
import { PublicKey } from "@solana/web3.js";
import type { UseQueryOptions } from "react-query";
import type { FetchKeysFn } from "..";
import type { BatchedParsedAccountQueryKeys } from "../parsers";
/**
* Loads multiple tokens from the Certified Token List.
* @param mint
* @returns
*/
export declare const useCertifiedTokens: (mints: (string | null | undefined)[]) => import("react-query").UseQueryResult<Token | null | undefined, unknown>[];
/**
* Loads a token from the Certified Token List.
* @param mint
* @returns
*/
export declare const useCertifiedToken: (mint: string | null | undefined) => import("react-query").UseQueryResult<Token | null | undefined, unknown>;
/**
* Constructs a query to load a token from the Certified Token List, or from the blockchain if
* it cannot be found.
*
* @returns Token query
*/
export declare const makeBatchedTokensQuery: ({ network, addresses, fetchKeys, }: {
network: Network;
addresses: BatchedParsedAccountQueryKeys;
fetchKeys: FetchKeysFn;
}) => UseQueryOptions<readonly (Token | null | undefined)[] | null | undefined>;
/**
* Constructs a query to load a token from the Certified Token List, or from the blockchain if
* it cannot be found.
*
* @returns Token query
*/
export declare const makeTokenQuery: ({ network, address, fetchKeys, }: {
network: Network;
address: PublicKey | null | undefined;
fetchKeys: FetchKeysFn;
}) => UseQueryOptions<Token | null | undefined>;
/**
* Uses and loads a series of mints as {@link Token}s.
* @param mints
* @returns
*/
export declare const useTokens: (mints?: (PublicKey | null | undefined)[]) => import("react-query").UseQueryResult<Token | null | undefined, unknown>[];
/**
* Uses and loads a series of mints as {@link Token}s using a batched call.
* @param mints
* @returns
*/
export declare const useBatchedTokens: (mints: BatchedParsedAccountQueryKeys) => import("react-query").UseQueryResult<readonly (Token | null | undefined)[] | null | undefined, unknown>;
/**
* Uses and loads a single token.
*
* @param mint
* @returns
*/
export declare const useToken: (mintRaw?: PublicKey | string | null) => import("react-query").UseQueryResult<Token | null | undefined, unknown>;
//# sourceMappingURL=useToken.d.ts.map