@0xsequence/connect
Version:
Connect package for Sequence Web SDK
39 lines • 1.29 kB
TypeScript
import { type IntentResponseAccountList } from '@0xsequence/waas';
interface UseListAccountsResult {
/** The accounts data if available */
data?: IntentResponseAccountList;
/** Whether the query is currently loading */
isLoading: boolean;
/** Any error that occurred during the query */
error: Error | null;
/** Function to manually refetch the accounts */
refetch: () => Promise<void>;
}
/**
* Hook to list all accounts associated with the current WaaS session.
* Uses React Query for proper async state management.
*
* @returns {UseListAccountsResult} Object containing the accounts data, loading state, error state, and refetch function
*
* @example
* ```tsx
* function AccountsList() {
* const { data, isLoading, error, refetch } = useListAccounts()
*
* if (isLoading) return <div>Loading accounts...</div>
* if (error) return <div>Error: {error.message}</div>
*
* return (
* <div>
* <button onClick={() => refetch()}>Refresh Accounts</button>
* {data?.accounts.map(account => (
* <div key={account.id}>{account.address}</div>
* ))}
* </div>
* )
* }
* ```
*/
export declare const useListAccounts: () => UseListAccountsResult;
export {};
//# sourceMappingURL=useListAccounts.d.ts.map