Fetches the native token balance for the connected account on a specific chain.
import { useNativeBalance } from "@hemilabs/react-hooks/useNativeBalance";| Parameter | Type | Required | Description |
|---|---|---|---|
| chainId | number |
Yes | Chain ID |
Returns the result from wagmi's useBalance hook.
import { useNativeBalance } from "@hemilabs/react-hooks/useNativeBalance";
function Balance() {
const { data: balance } = useNativeBalance(1);
return (
<span>
Balance: {balance?.formatted} {balance?.symbol}
</span>
);
}