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

@ -6623,6 +6623,14 @@
"resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz", "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz",
"integrity": "sha1-StCAk21EPCVhrtnyGX7//iX05QY=" "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": { "nwsapi": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.4.tgz", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.4.tgz",

Loading…
Cancel
Save