FIX: correct satoshi display

This commit is contained in:
Overtorment 2018-12-24 18:12:27 +00:00
parent e0a469ad03
commit e18396b124
4 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,5 @@
import 'intl';
import 'intl/locale-data/jsonp/en';
import React from 'react';
import './shim.js';
import App from './App';

View File

@ -106,15 +106,11 @@ strings.formatBalanceWithoutSuffix = (balance, toUnit) => {
return balance;
}
if (balance !== 0) {
if (toUnit === BitcoinUnit.BTC || toUnit === undefined) {
if (toUnit === BitcoinUnit.BTC) {
const value = new BigNumber(balance).dividedBy(100000000).toFixed(8);
return removeTrailingZeros(value);
} else if (toUnit === BitcoinUnit.SATS) {
const value = new BigNumber(balance)
.multipliedBy(0.0001)
.toString()
.replace('.', '');
return parseFloat(value).toLocaleString();
return balance;
} else if (toUnit === BitcoinUnit.LOCAL_CURRENCY) {
return currency.satoshiToLocalCurrency(balance);
}

5
package-lock.json generated
View File

@ -5791,6 +5791,11 @@
}
}
},
"intl": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/intl/-/intl-1.2.5.tgz",
"integrity": "sha1-giRKIZDE5Bn4Nx9ao02qNCDiq94="
},
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",

View File

@ -52,6 +52,7 @@
"eslint-plugin-standard": "^4.0.0",
"events": "^1.1.1",
"frisbee": "^1.6.4",
"intl": "^1.2.5",
"isaac": "0.0.5",
"mocha": "^5.2.0",
"node-libs-react-native": "^1.0.1",