Skip to content

Commit 9eb4a15

Browse files
committed
fix: fix linter
1 parent 93d127b commit 9eb4a15

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

ui/components/app/wallet-overview/aggregated-percentage-overview-cross-chains.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ export const AggregatedPercentageOverviewCrossChains = () => {
113113
const amountChangeCrossChains =
114114
totalCrossChainBalance - crossChainTotalBalance1dAgo;
115115
const percentageChangeCrossChains =
116-
(amountChangeCrossChains / crossChainTotalBalance1dAgo) * 100 || 0;
116+
crossChainTotalBalance1dAgo === 0
117+
? 0
118+
: (amountChangeCrossChains / crossChainTotalBalance1dAgo) * 100;
117119

118120
const formattedPercentChangeCrossChains = formatValue(
119121
amountChangeCrossChains === 0 ? 0 : percentageChangeCrossChains,

ui/hooks/useAccountTotalCrossChainFiatBalance.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export const useAccountTotalCrossChainFiatBalance = (
6969
}
7070
return null;
7171
})
72-
.filter((balance) => balance !== null);
72+
.filter(
73+
(balance): balance is FormattedTokensWithBalances => balance !== null,
74+
);
7375
}, [formattedTokensWithBalancesPerChain, enabledNetworksByNamespace]);
7476

7577
const tokenFiatBalancesCrossChains = useMemo(
@@ -86,23 +88,25 @@ export const useAccountTotalCrossChainFiatBalance = (
8688
.nativeCurrency;
8789
const conversionRate =
8890
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+
);
103106

104-
return totalFiatValue;
105-
});
107+
return totalFiatValue;
108+
},
109+
);
106110

107111
const balanceCached =
108112
crossChainCachedBalances?.[singleChainTokenBalances.chainId]?.[
@@ -121,7 +125,7 @@ export const useAccountTotalCrossChainFiatBalance = (
121125
};
122126
}),
123127
[
124-
formattedTokensWithBalancesPerChain,
128+
filteredBalances,
125129
allNetworks,
126130
currencyRates,
127131
mergedCrossChainRates,
@@ -136,7 +140,7 @@ export const useAccountTotalCrossChainFiatBalance = (
136140
tokenFiatBalancesCrossChains.reduce((accumulator, currentValue) => {
137141
const tmpCurrentValueFiatBalances: string[] =
138142
currentValue.tokenFiatBalances.filter(
139-
(value): value is string => value !== undefined,
143+
(value: string | undefined): value is string => value !== undefined,
140144
);
141145
const totalFiatBalance = sumDecimals(
142146
currentValue.nativeFiatValue,

0 commit comments

Comments
 (0)