Hooks
useGetTokenBalancesSummary
Hook for fetching summarized token balances across multiple chains
Import
Usage
Return Type: UseQueryResult<TokenBalance[]>
The hook returns all properties from React Query’s UseQueryResult
with token balance data. Here’s the detailed structure:
Properties
data
TokenBalance[] | undefined
Array of token balance objects containing:
contractType
: Type of the token contract (NATIVE, ERC20, ERC721, ERC1155)contractAddress
: Address of the token contractaccountAddress
: Address of the account holding the tokensbalance
: Token balance as a string (in base units)chainId
: Chain ID where the token existsblockHash
: Hash of the block where balance was last updatedblockNumber
: Block number where balance was last updateduniqueCollectibles
: Number of unique collectiblesisSummary
: Whether the balance is a summarycontractInfo
: Basic token contract information including name, symbol, decimals, and logo URL
isLoading
boolean
Loading state for the data fetch.
isError
boolean
Error state indicating if the query failed.
error
Error | null
Any error that occurred during data fetching.
Parameters
The hook accepts two parameters:
args: GetTokenBalancesSummaryArgs
Parameter | Type | Description |
---|---|---|
chainIds | number[] | Array of chain IDs to fetch balances from |
filter.accountAddresses | string[] | Array of account addresses to fetch balances for |
filter.contractWhitelist | string[] | (Optional) Array of contract addresses to include |
filter.contractBlacklist | string[] | (Optional) Array of contract addresses to exclude |
filter.omitNativeBalances | boolean | (Optional) If true, excludes native token balances |
filter.contractStatus | ContractVerificationStatus | (Optional) Filter for contract verification status |
options: BalanceHookOptions
Parameter | Type | Description |
---|---|---|
disabled | boolean | (Optional) Disable the query from automatically running |
retry | boolean | (Optional) Whether to retry failed queries |
hideCollectibles | boolean | (Optional) If true, filters out ERC721 and ERC1155 tokens |
Was this page helpful?