mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-30 12:18:09 +00:00
dont round fiat rate when calculating total balance
This commit is contained in:
parent
89fa7d3177
commit
e54f2066ea
@ -6,6 +6,7 @@ import { Icon, Tooltip, colors, icons as ICONS } from 'trezor-ui-components';
|
|||||||
import { FormattedMessage, FormattedNumber } from 'react-intl';
|
import { FormattedMessage, FormattedNumber } from 'react-intl';
|
||||||
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
|
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
|
||||||
import type { Network, State as ReducersState } from 'flowtype';
|
import type { Network, State as ReducersState } from 'flowtype';
|
||||||
|
import { toFiatCurrency } from 'utils/fiatConverter';
|
||||||
import l10nMessages from '../../../components/Balance/index.messages';
|
import l10nMessages from '../../../components/Balance/index.messages';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -129,13 +130,11 @@ class AccountBalance extends PureComponent<Props, State> {
|
|||||||
render() {
|
render() {
|
||||||
const { network, localCurrency } = this.props;
|
const { network, localCurrency } = this.props;
|
||||||
const fiatRates = this.props.fiat.find(f => f.network === network.shortcut);
|
const fiatRates = this.props.fiat.find(f => f.network === network.shortcut);
|
||||||
let accountBalance = '';
|
|
||||||
let fiatRateValue = '';
|
let fiatRateValue = '';
|
||||||
let fiat = '';
|
let fiat = '';
|
||||||
if (fiatRates) {
|
if (fiatRates) {
|
||||||
accountBalance = new BigNumber(this.props.balance);
|
|
||||||
fiatRateValue = new BigNumber(fiatRates.rates[localCurrency]).toFixed(2);
|
fiatRateValue = new BigNumber(fiatRates.rates[localCurrency]).toFixed(2);
|
||||||
fiat = accountBalance.times(fiatRateValue).toFixed(2);
|
fiat = toFiatCurrency(this.props.balance, localCurrency, fiatRates);
|
||||||
}
|
}
|
||||||
|
|
||||||
const NoRatesTooltip = (
|
const NoRatesTooltip = (
|
||||||
|
Loading…
Reference in New Issue
Block a user