@@ -14,6 +14,7 @@ import {
1414import { calculateUSDPriceRaw , isFrankensteinToken } from 'utils' ;
1515import config from 'config' ;
1616import { isNttToken } from './ntt' ;
17+ import type { Balances } from './wallet/types' ;
1718
1819export const getTokenPreferenceScore = (
1920 token : Token ,
@@ -42,11 +43,11 @@ export const getTokenPreferenceScore = (
4243
4344export const calculateTokenUSDBalance = (
4445 token : Token ,
45- balances : Record < string , { balance : any } > ,
46+ balances : Balances ,
4647 getTokenPrice : ( token : Token ) => number | undefined ,
4748) : number => {
4849 const balance = balances [ tokenKey ( token ) ] ;
49- if ( ! balance || ! balance . balance ) {
50+ if ( ! balance || ! balance . balance || balance . balance . amount === '0' ) {
5051 return 0 ;
5152 }
5253 return calculateUSDPriceRaw ( getTokenPrice , balance . balance , token ) ?? 0 ;
@@ -87,7 +88,7 @@ export const applyTokenSearch = (
8788export const sortTokensByPreference = (
8889 tokens : Token [ ] ,
8990 selectedToken : Token | undefined ,
90- balances : Record < string , { balance : any } > ,
91+ balances : Balances ,
9192 getTokenPrice : ( token : Token ) => number | undefined ,
9293) : Token [ ] => {
9394 return tokens . sort ( ( a , b ) => {
0 commit comments