|
@ -25,7 +25,7 @@ export function btcToBits(btc) { |
|
|
|
|
|
|
|
|
export function btcToFiat(btc, price) { |
|
|
export function btcToFiat(btc, price) { |
|
|
const amount = parseFloat(btc * price).toFixed(2) |
|
|
const amount = parseFloat(btc * price).toFixed(2) |
|
|
return (btc > 0 && amount <= 0) ? '< 0.01' : numberWithCommas(amount) |
|
|
return btc > 0 && amount <= 0 ? '< 0.01' : numberWithCommas(amount) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
////////////////////////////
|
|
@ -76,17 +76,6 @@ export function satoshisToFiat(satoshis, price) { |
|
|
return btcToFiat(satoshisToBtc(satoshis), price) |
|
|
return btcToFiat(satoshisToBtc(satoshis), price) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
////////////////////////////////
|
|
|
|
|
|
// millisatoshis to satoshis //
|
|
|
|
|
|
//////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
export function millisatoshisToSatoshis(millisatoshis) { |
|
|
|
|
|
if (millisatoshis === undefined || millisatoshis === null || millisatoshis === '') return null |
|
|
|
|
|
|
|
|
|
|
|
return Math.round(millisatoshis / 1000) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function renderCurrency(currency) { |
|
|
export function renderCurrency(currency) { |
|
|
switch (currency) { |
|
|
switch (currency) { |
|
|
case 'btc': |
|
|
case 'btc': |
|
@ -156,8 +145,6 @@ export default { |
|
|
satoshisToBits, |
|
|
satoshisToBits, |
|
|
satoshisToFiat, |
|
|
satoshisToFiat, |
|
|
|
|
|
|
|
|
millisatoshisToSatoshis, |
|
|
|
|
|
|
|
|
|
|
|
renderCurrency, |
|
|
renderCurrency, |
|
|
|
|
|
|
|
|
convert |
|
|
convert |
|
|