@saberhq/sail
Version:
Account caching and batched loading for React-based Solana applications.
36 lines • 1.35 kB
TypeScript
import type { Token } from "@saberhq/token-utils";
import { TokenAmount } from "@saberhq/token-utils";
import type { PublicKey } from "@solana/web3.js";
/**
* A user's associated token account.
*/
export interface AssociatedTokenAccount {
/**
* Account key. If the token is {@link RAW_SOL_MINT}, this will be the user's account.
*/
key: PublicKey;
/**
* Token balance of the account.
*/
balance: TokenAmount;
/**
* Whether or not the token account is initialized.
*/
isInitialized?: boolean;
}
/**
* Loads ATAs owned by the provided owner.
* @param owner
* @param tokens
* @returns
*/
export declare const useATAs: (owner: PublicKey | null | undefined, tokens: readonly (Token | null | undefined)[]) => readonly (AssociatedTokenAccount | null | undefined)[] | null | undefined;
export declare type Tuple<T, N extends number> = N extends N ? number extends N ? T[] : _TupleOf<T, N, []> : never;
export declare type _TupleOf<T, N extends number, R extends unknown[]> = R["length"] extends N ? R : _TupleOf<T, N, [T, ...R]>;
/**
* Loads ATAs owned by a user.
* @param tokens
* @returns
*/
export declare const useUserATAs: <N extends number>(...tokens: Tuple<Token | null | undefined, N>) => Tuple<AssociatedTokenAccount | null | undefined, N>;
//# sourceMappingURL=useUserATAs.d.ts.map