diff --git a/app/components/UI/Stake/hooks/useBalance.test.tsx b/app/components/UI/Stake/hooks/useBalance.test.tsx index 33bf7cc79030..da155ce94d34 100644 --- a/app/components/UI/Stake/hooks/useBalance.test.tsx +++ b/app/components/UI/Stake/hooks/useBalance.test.tsx @@ -76,7 +76,7 @@ describe('useBalance', () => { expect(result.current.balanceFiatNumber).toBe(39506172511.6); // Fiat number balance expect(result.current.stakedBalanceWei).toBe('5791332670714232000'); // No staked assets expect(result.current.formattedStakedBalanceETH).toBe('5.79133 ETH'); // Formatted ETH balance - expect(result.current.stakedBalanceFiatNumber).toBe(18532.26454); // Staked balance in fiat number + expect(result.current.stakedBalanceFiatNumber).toBe(18532.26455); // Staked balance in fiat number expect(result.current.formattedStakedBalanceFiat).toBe('$18532.26'); // }); diff --git a/app/util/number/index.js b/app/util/number/index.js index 1f4062444e17..67f4a41849a6 100644 --- a/app/util/number/index.js +++ b/app/util/number/index.js @@ -568,7 +568,7 @@ export function weiToFiatNumber(wei, conversionRate, decimalsToShow = 5) { return undefined; } const eth = new BigNumber(fromWei(wei), 10); - const value = parseFloat(eth.multipliedBy(new BigNumber(conversionRate, 10)).toPrecision(decimalsToShow)); + const value = parseFloat(eth.multipliedBy(new BigNumber(conversionRate, 10)).decimalPlaces(decimalsToShow).toString()); return value; }