Hooks
useListAccounts
Hook to list all accounts associated with the current WaaS session
Import
Usage
Return Type: UseListAccountsResult
The hook returns an object with the following properties:
Properties
data
IntentResponseAccountList | undefined
The list of accounts if the query was successful. Contains an array of account objects with properties like id
and address
.
isLoading
boolean
Whether the query is currently in progress. Useful for showing loading states.
error
Error | null
Any error that occurred during the query. Will be null
if no error occurred.
refetch
() => Promise<void>
Function to manually trigger a refresh of the accounts list.
Features
- Automatic Data Fetching: Automatically fetches accounts when WaaS connection is available
- Caching: Results are cached for 1 minute to prevent unnecessary refetches
- Error Handling: Proper error handling for missing WaaS connector or initialization issues
- Type Safety: Full TypeScript support for all returned data
- React Query Integration: Uses React Query for efficient state management and caching
Was this page helpful?