Parameters for tokens fetching
Optional
account?: `0x${string}`Account address for balance fetching (defaults to connected wallet)
Optional
chainId?: numberSpecific chain ID to filter tokens (defaults to all supported chains)
Optional
withBalance?: booleanWhether to fetch token balances
Token data and loading state
// Fetch all tokens with balances for connected wallet
const { tokens, tokensByChainId, isLoadingBalances } = useTokens();
// Fetch tokens for specific chain without balances
const { tokens } = useTokens({
chainId: 1,
withBalance: false
});
// Fetch balances for specific account
const { tokens } = useTokens({
account: '0x123...'
});
Custom hook for fetching and managing tokens data with price and balances.
Combines token list data with real-time price and balance information from LI.FI SDK. Features include: