mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
Fixes for balance
This commit is contained in:
parent
90c56dde8e
commit
b617bc844b
@ -1048,7 +1048,7 @@ export class WalletsCarousel extends Component {
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
{loc.formatBalance(item.getBalance(), BitcoinUnit.BTC, item.getPreferredBalanceUnit())}
|
||||
{loc.formatBalance(Number(item.getBalance()), BitcoinUnit.BTC, item.getPreferredBalanceUnit())}
|
||||
</Text>
|
||||
<Text style={{ backgroundColor: 'transparent' }} />
|
||||
<Text
|
||||
|
15
loc/index.js
15
loc/index.js
@ -71,6 +71,7 @@ strings.transactionTimeToReadable = function(time) {
|
||||
*/
|
||||
strings.formatBalance = (balance, fromUnit, toUnit) => {
|
||||
if (toUnit === undefined) {
|
||||
balance = Number(balance);
|
||||
return balance + ' ' + BitcoinUnit.BTC;
|
||||
}
|
||||
if (fromUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
@ -81,23 +82,23 @@ strings.formatBalance = (balance, fromUnit, toUnit) => {
|
||||
);
|
||||
}
|
||||
if (toUnit === BitcoinUnit.BTC) {
|
||||
balance = Number(balance);
|
||||
return BTCUnits(balance, fromUnit)
|
||||
.to(BitcoinUnit.BTC)
|
||||
.format();
|
||||
} else if (toUnit === BitcoinUnit.SATS) {
|
||||
balance = Number(balance);
|
||||
return BTCUnits(balance, BitcoinUnit.BTC)
|
||||
.to(BitcoinUnit.SATS)
|
||||
.format();
|
||||
} else if (toUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
return currency.satoshiToLocalCurrency(
|
||||
BTCUnits(balance, BitcoinUnit.BTC)
|
||||
.to(BitcoinUnit.SATS)
|
||||
.value(),
|
||||
);
|
||||
const satoshis = BTCUnits(balance, BitcoinUnit.BTC).to(BitcoinUnit.SATS).value();
|
||||
return currency.satoshiToLocalCurrency(satoshis);
|
||||
}
|
||||
};
|
||||
|
||||
strings.formatBalanceWithoutSuffix = (balance, fromUnit, toUnit) => {
|
||||
balance = Number(balance);
|
||||
if (toUnit === undefined) {
|
||||
return balance;
|
||||
}
|
||||
@ -112,9 +113,9 @@ strings.formatBalanceWithoutSuffix = (balance, fromUnit, toUnit) => {
|
||||
.to(BitcoinUnit.BTC)
|
||||
.toString();
|
||||
} else if (toUnit === BitcoinUnit.SATS) {
|
||||
return BTCUnits(balance, fromUnit)
|
||||
return String(BTCUnits(balance, fromUnit)
|
||||
.to(BitcoinUnit.SATS)
|
||||
.toString();
|
||||
.format()).replace(' satoshis','');
|
||||
} else if (toUnit === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
return currency.satoshiToLocalCurrency(BTCUnits(balance, fromUnit).to(BitcoinUnit.SATS));
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ export default class SendDetails extends Component {
|
||||
super(props);
|
||||
console.log('props.navigation.state.params=', props.navigation.state.params);
|
||||
let address;
|
||||
let memo;
|
||||
if (props.navigation.state.params) address = props.navigation.state.params.address;
|
||||
if (props.navigation.state.params) memo = props.navigation.state.params.memo;
|
||||
let fromAddress;
|
||||
@ -67,11 +68,12 @@ export default class SendDetails extends Component {
|
||||
|
||||
this.state = {
|
||||
isFeeSelectionModalVisible: false,
|
||||
fromAddress: fromAddress,
|
||||
fromWallet: fromWallet,
|
||||
fromSecret: fromSecret,
|
||||
fromAddress,
|
||||
fromWallet,
|
||||
fromSecret,
|
||||
isLoading: true,
|
||||
address: address,
|
||||
address,
|
||||
memo,
|
||||
fee: 1,
|
||||
networkTransactionFees: new NetworkTransactionFee(1, 1, 1),
|
||||
feeSliderValue: 1,
|
||||
|
@ -234,7 +234,7 @@ export default class WalletTransactions extends Component {
|
||||
>
|
||||
{loc
|
||||
.formatBalance(
|
||||
this.state.wallet.getBalance(),
|
||||
Number(this.state.wallet.getBalance()),
|
||||
this.state.walletPreviousPreferredUnit,
|
||||
this.state.wallet.getPreferredBalanceUnit(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user