User Balances
Learn how to monitor user balances for tokens supported by Aave v4.
User balances provide a comprehensive view of a user's token holdings across different chains, aggregated by token type with supply and borrow APY information.
User Balance Data Structure
User balance data provides information about a user's token holdings, including:
Globally unique identifier: for each balance entry
Token identification: name, symbol, icon, decimals
Balance amounts: individual balances per network, total amounts
Yield information: highest and lowest supply/borrow APY for each token
Fiat valuations: converted amounts in selected currency
- TypeScript
- GraphQL
The following TypeScript interfaces illustrate the core UserBalance type:
Fetching User Balances
- React
- TypeScript
- GraphQL
Use the useUserBalances hook to fetch user token balances.
See below some examples of how to use the hook.
Sort balances by name or balance value.
Include tokens with zero balances in the results.
Include Zero Balances
const { data } = useUserBalances({ user: evmAddress("0x456…"), filter: { // your filter criteria }, includeZeroBalances: true,});Specify a different currency for displaying fiat amounts.
Custom Currency
import { evmAddress, Currency } from "@aave/react";
// …
const { data, loading, error } = useUserBalances({ user: evmAddress("0x456…"), filter: { // your filter criteria }, currency: Currency.Eur,});