diff --git a/class/legacy-wallet.js b/class/legacy-wallet.js index 892ab5b46..bbfa8af7c 100644 --- a/class/legacy-wallet.js +++ b/class/legacy-wallet.js @@ -97,8 +97,11 @@ export class LegacyWallet extends AbstractWallet { throw new Error('Could not fetch UTXO from API' + response.err); } - this.balance = json.final_balance / 100000000; - this.unconfirmed_balance = json.unconfirmed_balance / 100000000; + this.balance = new BigNumber(json.final_balance); + this.balance = this.balance.div(100000000).toString() * 1; + this.unconfirmed_balance = new BigNumber(json.unconfirmed_balance); + this.unconfirmed_balance = + this.unconfirmed_balance.div(100000000).toString() * 1; this._lastBalanceFetch = +new Date(); } catch (err) { console.warn(err); diff --git a/loc/index.js b/loc/index.js index 6d091ba30..1f4c43dda 100644 --- a/loc/index.js +++ b/loc/index.js @@ -2,6 +2,7 @@ import LocalizedStrings from 'react-localization'; import { AsyncStorage } from 'react-native'; import { Util } from 'expo'; import { AppStorage } from '../class'; +let BigNumber = require('bignumber.js'); let strings; // first-time loading sequence @@ -65,7 +66,8 @@ strings.transactionTimeToReadable = function(time) { strings.formatBalance = function(balance) { if (balance < 0.1 && balance !== 0) { - return balance * 1000 + ' mBTC'; + let b = new BigNumber(balance); + return b.mul(1000).toString() + ' mBTC'; } return balance + ' BTC'; };