@@ -37,7 +37,7 @@ type AllAccountsProps = {
37
37
} ;
38
38
39
39
const AccountItem = ( { account, hideAmounts } : { account : accountApi . IAccount , hideAmounts : boolean } ) => {
40
- const [ balance , setBalance ] = useState < string > ( '' ) ;
40
+ const [ balance , setBalance ] = useState < accountApi . TAmountWithConversions > ( ) ;
41
41
const mounted = useMountedRef ( ) ;
42
42
43
43
useEffect ( ( ) => {
@@ -48,14 +48,10 @@ const AccountItem = ({ account, hideAmounts }: { account: accountApi.IAccount, h
48
48
return ;
49
49
}
50
50
if ( ! balance . success ) {
51
+ setBalance ( undefined ) ;
51
52
return ;
52
53
}
53
- const balanceData = balance . balance ;
54
- if ( balanceData . hasAvailable ) {
55
- setBalance ( balanceData . available . amount ) ;
56
- } else {
57
- setBalance ( '0' ) ;
58
- }
54
+ setBalance ( balance . balance . available ) ;
59
55
} catch ( error ) {
60
56
console . error ( 'Failed to fetch balance for account' , account . code , error ) ;
61
57
}
@@ -75,10 +71,10 @@ const AccountItem = ({ account, hideAmounts }: { account: accountApi.IAccount, h
75
71
76
72
< div className = { styles . accountBalanceContainer } >
77
73
< div className = { styles . accountBalance } >
78
- { balance ? ( hideAmounts ? '***' : balance ) : '...' }
74
+ { balance ? ( hideAmounts ? '***' : balance . amount ) : '...' }
79
75
</ div >
80
76
< div className = { styles . coinUnit } >
81
- { balance ? account . coinUnit : '' }
77
+ { balance ? balance . unit : '' }
82
78
</ div >
83
79
</ div >
84
80
< div className = { styles . chevron } >
0 commit comments