change hexToInt => toInt

pull/1/head
yann300 7 years ago
parent adcf81d344
commit c062cde48d
  1. 8
      src/app/execution/txLogger.js
  2. 7
      src/lib/typeConversion.js

@ -263,13 +263,13 @@ function context (self, opts) {
var block = data.tx.blockNumber || ''
var i = data.tx.transactionIndex
if (executionContext.getProvider() === 'vm') {
return yo`<span><span class=${css.tx}>[vm]</span> from:${from}, to:${to}, value:${typeConversion.hexToInt(val)} wei, data:${input}, ${logs} logs, hash:${hash}</span>`
return yo`<span><span class=${css.tx}>[vm]</span> from:${from}, to:${to}, value:${typeConversion.toInt(val)} wei, data:${input}, ${logs} logs, hash:${hash}</span>`
} else if (executionContext.getProvider() !== 'vm' && data.resolvedData) {
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.hexToInt(val)} wei, ${logs} logs, data:${input}, hash:${hash}</span>`
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.toInt(val)} wei, ${logs} logs, data:${input}, hash:${hash}</span>`
} else {
to = helper.shortenHexData(to)
hash = helper.shortenHexData(data.tx.blockHash)
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.hexToInt(val)} wei</span>`
return yo`<span><span class='${css.tx}'>[block:${block} txIndex:${i}]</span> from:${from}, to:${to}, value:${typeConversion.toInt(val)} wei</span>`
}
}
@ -367,7 +367,7 @@ function createTable (opts) {
`
if (opts.logs) table.appendChild(logs)
var val = typeConversion.hexToInt(opts.val)
var val = typeConversion.toInt(opts.val)
val = yo`
<tr class="${css.tr}">
<td class="${css.td}"> value </td>

@ -3,8 +3,13 @@ var ethJSUtil = require('ethereumjs-util')
var BN = ethJSUtil.BN
module.exports = {
hexToInt: (h) => {
toInt: (h) => {
if (h.indexOf && h.indexOf('0x') === 0) {
return (new BN(h.replace('0x', ''), 16)).toString(10)
} else if (h.constructor && h.constructor.name === 'BigNumber' || BN.isBN(h)) {
return h.toString(10)
}
return h
},
stringify: stringify
}

Loading…
Cancel
Save