Documentation
Hooks
useAccountBalance

useAccountBalance

Hook for getting balance info of connected account. Including both wallet and email account.

import { BigNumber } from "ethers";
 
type UseAccountBalanceResult = {
	balance: null | {
		decimals: number;
		formatted: string;
		symbol: string;
		value: BigNumber;
	};
	isLoading: boolean;
};
 
function useAccountBalance(): UseAccountBalanceResult;
💡

In order to get only email or wallet balance info, you can use the useEmailAccountBalance or useWalletAccountBalance Hook, respectively.

Usage

import { useAccountBalance } from "@crossbell/connect-kit";
 
function App() {
	const { balance, isLoading } = useAccountBalance();
 
	return <div>{balance ? balance.formatted : "No Balance Info"}</div>;
}