changes requested

pull/594/head
mulili 6 years ago
parent 5dc9f9693b
commit 276d80d48f
  1. 9
      apps/block_scout_web/assets/js/lib/smart_contract/wei_ether_converter.js
  2. 8
      apps/block_scout_web/assets/package-lock.json

@ -1,5 +1,6 @@
import $ from 'jquery'
import { BigNumber } from 'bignumber.js'
import numeral from 'numeral'
const weiToEtherConverter = (element, event) => {
const weiUnit = new BigNumber('1000000000000000000')
@ -12,13 +13,13 @@ const weiToEtherConverter = (element, event) => {
if (event.target.checked) {
$conversionTextWei.hide()
$conversionTextEth.show()
unitVal = unitVal.dividedBy(weiUnit)
$conversionUnit.html(String(unitVal > 0 ? unitVal : unitVal.toFixed(3)))
unitVal = unitVal.dividedBy(weiUnit).toNumber()
$conversionUnit.html(String(unitVal > 0 ? numeral(unitVal).format('0,0') : numeral(unitVal).format('0.0[00000]')))
} else {
$conversionTextWei.show()
$conversionTextEth.hide()
unitVal = unitVal.multipliedBy(weiUnit)
$conversionUnit.html(unitVal)
unitVal = unitVal.multipliedBy(weiUnit).toNumber()
$conversionUnit.html(String(numeral(unitVal).format('0,0')))
}
}

@ -6623,6 +6623,14 @@
"resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz",
"integrity": "sha1-StCAk21EPCVhrtnyGX7//iX05QY="
},
"numeral-es6": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/numeral-es6/-/numeral-es6-1.0.0.tgz",
"integrity": "sha1-xzqgKkvcp6CZ2pm2b03Kw5mkhk4=",
"requires": {
"numeral": "*"
}
},
"nwsapi": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.4.tgz",

Loading…
Cancel
Save