Skip to content

Commit

Permalink
Display only free balance (#1537)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitayutanov authored Apr 25, 2024
1 parent 126932c commit 89abc39
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions idea/frontend/src/features/wallet/ui/balance/balance.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useAccount, useApi, useBalance, useBalanceFormat } from '@gear-js/react-hooks';
import { useAccountDeriveBalancesAll, useApi, useBalanceFormat } from '@gear-js/react-hooks';
import cx from 'clsx';

import headerStyles from '@/widgets/header/ui/Header.module.scss';
Expand All @@ -7,11 +7,10 @@ import styles from './balance.module.scss';

const Balance = () => {
const { isApiReady } = useApi();
const { account } = useAccount();
const { balance } = useBalance(account?.address);
const balances = useAccountDeriveBalancesAll();
const { getFormattedBalance } = useBalanceFormat();

const formattedBalance = isApiReady && balance ? getFormattedBalance(balance) : undefined;
const formattedBalance = isApiReady && balances ? getFormattedBalance(balances.freeBalance) : undefined;

return formattedBalance ? (
<section className={styles.balanceSection}>
Expand Down

0 comments on commit 89abc39

Please sign in to comment.