import { useAccountDeriveBalancesAll, useApi, useBalanceFormat } from '@gear-js/react-hooks'; import cx from 'clsx'; import headerStyles from '@/widgets/header/ui/Header.module.scss'; import styles from './balance.module.scss'; const Balance = () => { const { isApiReady } = useApi(); const balances = useAccountDeriveBalancesAll(); const { getFormattedBalance } = useBalanceFormat(); const formattedBalance = isApiReady && balances ? getFormattedBalance(balances.freeBalance) : undefined; return formattedBalance ? (

Balance:

{formattedBalance.value} {formattedBalance.unit}

) : null; }; export { Balance };