@@ -69,7 +69,9 @@ export const useAccountTotalCrossChainFiatBalance = (
69
69
}
70
70
return null ;
71
71
} )
72
- . filter ( ( balance ) => balance !== null ) ;
72
+ . filter (
73
+ ( balance ) : balance is FormattedTokensWithBalances => balance !== null ,
74
+ ) ;
73
75
} , [ formattedTokensWithBalancesPerChain , enabledNetworksByNamespace ] ) ;
74
76
75
77
const tokenFiatBalancesCrossChains = useMemo (
@@ -86,23 +88,25 @@ export const useAccountTotalCrossChainFiatBalance = (
86
88
. nativeCurrency ;
87
89
const conversionRate =
88
90
currencyRates ?. [ matchedChainSymbol ] ?. conversionRate ;
89
- const tokenFiatBalances = tokensWithBalances . map ( ( token ) => {
90
- const tokenExchangeRate =
91
- mergedCrossChainRates ?. [ singleChainTokenBalances . chainId ] ?. [
92
- toChecksumAddress ( token . address )
93
- ] ;
94
- const totalFiatValue = getTokenFiatAmount (
95
- tokenExchangeRate ,
96
- conversionRate ,
97
- currentCurrency ,
98
- token . string ,
99
- token . symbol ,
100
- false ,
101
- false ,
102
- ) ;
91
+ const tokenFiatBalances = tokensWithBalances . map (
92
+ ( token : TokenWithBalance ) => {
93
+ const tokenExchangeRate =
94
+ mergedCrossChainRates ?. [ singleChainTokenBalances . chainId ] ?. [
95
+ toChecksumAddress ( token . address )
96
+ ] ;
97
+ const totalFiatValue = getTokenFiatAmount (
98
+ tokenExchangeRate ,
99
+ conversionRate ,
100
+ currentCurrency ,
101
+ token . string ,
102
+ token . symbol ,
103
+ false ,
104
+ false ,
105
+ ) ;
103
106
104
- return totalFiatValue ;
105
- } ) ;
107
+ return totalFiatValue ;
108
+ } ,
109
+ ) ;
106
110
107
111
const balanceCached =
108
112
crossChainCachedBalances ?. [ singleChainTokenBalances . chainId ] ?. [
@@ -121,7 +125,7 @@ export const useAccountTotalCrossChainFiatBalance = (
121
125
} ;
122
126
} ) ,
123
127
[
124
- formattedTokensWithBalancesPerChain ,
128
+ filteredBalances ,
125
129
allNetworks ,
126
130
currencyRates ,
127
131
mergedCrossChainRates ,
@@ -136,7 +140,7 @@ export const useAccountTotalCrossChainFiatBalance = (
136
140
tokenFiatBalancesCrossChains . reduce ( ( accumulator , currentValue ) => {
137
141
const tmpCurrentValueFiatBalances : string [ ] =
138
142
currentValue . tokenFiatBalances . filter (
139
- ( value ) : value is string => value !== undefined ,
143
+ ( value : string | undefined ) : value is string => value !== undefined ,
140
144
) ;
141
145
const totalFiatBalance = sumDecimals (
142
146
currentValue . nativeFiatValue ,
0 commit comments