The useWalletBalance hook fetches the current balance of the selected wallet, supporting both Para-managed wallets and external wallets.

Import

import { useWalletBalance } from "@getpara/react-sdk@alpha";

Usage

function WalletBalance() {
  const { data: balance, isLoading, error } = useWalletBalance();

  if (isLoading) return <div>Loading balance...</div>;
  if (error) return <div>Error loading balance</div>;

  if (!balance) {
    return <div>No balance available</div>;
  }

  return (
    <div>
      <p>Balance: {balance} ETH</p>
    </div>
  );
}