mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-21 22:42:21 +01:00
REF
This commit is contained in:
parent
4aa9c47fda
commit
e0a469ad03
2 changed files with 10 additions and 15 deletions
17
currency.js
17
currency.js
|
@ -93,21 +93,10 @@ function satoshiToLocalCurrency(satoshi) {
|
|||
}
|
||||
|
||||
function BTCToLocalCurrency(bitcoin) {
|
||||
if (!lang[STRUCT[preferredFiatCurrency.storageKey]]) return bitcoin;
|
||||
let sat = new BigNumber(bitcoin);
|
||||
sat = sat.multipliedBy(100000000).toNumber();
|
||||
|
||||
let b = new BigNumber(bitcoin);
|
||||
b = b
|
||||
.multipliedBy(1)
|
||||
.multipliedBy(lang[STRUCT[preferredFiatCurrency.storageKey]])
|
||||
.toString(10);
|
||||
b = parseFloat(b).toFixed(2);
|
||||
|
||||
const formatter = new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency: preferredFiatCurrency.formatterValue,
|
||||
minimumFractionDigits: 2,
|
||||
});
|
||||
return formatter.format(b);
|
||||
return satoshiToLocalCurrency(sat);
|
||||
}
|
||||
|
||||
function satoshiToBTC(satoshi) {
|
||||
|
|
|
@ -78,7 +78,7 @@ function removeTrailingZeros(value) {
|
|||
/**
|
||||
*
|
||||
* @param balance {Number} Float amount of bitcoins
|
||||
* @param unit {String} Value from models/bitcoinUnits.js
|
||||
* @param toUnit {String} Value from models/bitcoinUnits.js
|
||||
* @returns {string}
|
||||
*/
|
||||
strings.formatBalance = (balance, toUnit) => {
|
||||
|
@ -95,6 +95,12 @@ strings.formatBalance = (balance, toUnit) => {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param balance {Integer} Satoshis
|
||||
* @param toUnit {String} Value from models/bitcoinUnits.js
|
||||
* @returns {string}
|
||||
*/
|
||||
strings.formatBalanceWithoutSuffix = (balance, toUnit) => {
|
||||
if (toUnit === undefined) {
|
||||
return balance;
|
||||
|
|
Loading…
Add table
Reference in a new issue