Skip to main content
function useBalance(options): UseBalanceResult;
Fetch and cache token balance data with automatic metadata enrichment Supports SOL and SPL tokens. Auto-refetches on mount and dependencies change.

Parameters

ParameterTypeDescription
optionsUseBalanceOptionsBalance fetching configuration

Returns

UseBalanceResult Balance data with loading and error states

Example

import { useBalance } from '@sqds/grid-react';

function WalletBalance() {
  const { balance, isLoading, error } = useBalance({ symbol: 'USDC' });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return <div>{balance?.amountDecimal} {balance?.symbol}</div>;
}