Merge pull request #556 from trezor/fix/balance-rounding

Fix/dont round fiat rate when calculating total balance
pull/569/head
Vladimir Volek 5 years ago committed by GitHub
commit 419bb5c3f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,6 +6,7 @@ import { Icon, Tooltip, colors, icons as ICONS } from 'trezor-ui-components';
import { FormattedMessage, FormattedNumber } from 'react-intl';
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
import type { Network, State as ReducersState } from 'flowtype';
import { toFiatCurrency } from 'utils/fiatConverter';
import l10nMessages from '../../../components/Balance/index.messages';
type Props = {
@ -129,13 +130,11 @@ class AccountBalance extends PureComponent<Props, State> {
render() {
const { network, localCurrency } = this.props;
const fiatRates = this.props.fiat.find(f => f.network === network.shortcut);
let accountBalance = '';
let fiatRateValue = '';
let fiat = '';
if (fiatRates) {
accountBalance = new BigNumber(this.props.balance);
fiatRateValue = new BigNumber(fiatRates.rates[localCurrency]).toFixed(2);
fiat = accountBalance.times(fiatRateValue).toFixed(2);
fiat = toFiatCurrency(this.props.balance, localCurrency, fiatRates);
}
const NoRatesTooltip = (

Loading…
Cancel
Save