@@ -11,7 +11,7 @@ import {
1111 toHexadecimal ,
1212} from '../../util/number' ;
1313import {
14- selectChainId ,
14+ selectEvmChainId ,
1515 selectNetworkConfigurations ,
1616} from '../../selectors/networkController' ;
1717import { selectTokenMarketPriceData } from '../../selectors/tokenRatesController' ;
@@ -21,6 +21,7 @@ import {
2121} from '../../selectors/currencyRateController' ;
2222import { isTestNet } from '../../util/networks' ;
2323import { selectShowFiatInTestnets } from '../../selectors/settings' ;
24+ import { selectSelectedNonEvmNetworkChainId } from '../../selectors/multichainNetworkController' ;
2425interface AllTokens {
2526 [ chainId : string ] : {
2627 [ tokenAddress : string ] : Token [ ] ;
@@ -89,9 +90,9 @@ export const useGetFormattedTokensPerChain = (
8990} => {
9091 const stableAccounts = useStableReference ( accounts ) ;
9192 const stableAllChainIDs = useStableReference ( allChainIDs ) ;
93+ const currentEvmChainID = useSelector ( selectEvmChainId ) ;
94+ const currentSolChainID = useSelector ( selectSelectedNonEvmNetworkChainId ) ;
9295
93- // TODO: [SOLANA] Revisit this before shipping, `selectAllTokenBalances` selector needs to most likely be replaced by a non evm supported version
94- const currentChainId = useSelector ( selectChainId ) ;
9596 const importedTokens : AllTokens = useSelector ( selectAllTokens ) ;
9697 const allNetworks : Record <
9798 string ,
@@ -110,17 +111,16 @@ export const useGetFormattedTokensPerChain = (
110111 const showFiatOnTestnets = useSelector ( selectShowFiatInTestnets ) ;
111112
112113 return useMemo ( ( ) => {
113- //If the current network is a testnet, UI should display 0 unless conversions are enabled
114114 const validAccounts =
115115 stableAccounts . length > 0 &&
116116 stableAccounts . every ( ( item ) => item !== undefined ) ;
117- if ( ! validAccounts || ( isTestNet ( currentChainId ) && ! showFiatOnTestnets ) ) {
117+ if ( ! validAccounts ) {
118118 return { } ;
119119 }
120120
121121 const networksToFormat = shouldAggregateAcrossChains
122122 ? stableAllChainIDs
123- : [ currentChainId ] ;
123+ : [ currentEvmChainID , currentSolChainID ] ;
124124
125125 function getTokenFiatBalances ( {
126126 tokens,
@@ -183,6 +183,10 @@ export const useGetFormattedTokensPerChain = (
183183 if ( ! allNetworks [ singleChain ] ) {
184184 continue ;
185185 }
186+ // Skip if should not show fiat on testnets
187+ if ( isTestNet ( singleChain ) && ! showFiatOnTestnets ) {
188+ continue ;
189+ }
186190
187191 const tokens : Token [ ] =
188192 importedTokens ?. [ singleChain ] ?. [ account ?. address ] ?? [ ] ;
@@ -212,7 +216,8 @@ export const useGetFormattedTokensPerChain = (
212216 stableAccounts ,
213217 stableAllChainIDs ,
214218 allNetworks ,
215- currentChainId ,
219+ currentEvmChainID ,
220+ currentSolChainID ,
216221 currentCurrency ,
217222 currentTokenBalances ,
218223 currencyRates ,
0 commit comments