display decoded input

pull/1/head
yann300 7 years ago
parent 9ed3b0f412
commit a7746442c8
  1. 28
      src/app/execution/txLogger.js

@ -141,6 +141,7 @@ function renderKnownTransaction (self, data) {
gas: data.tx.gas, gas: data.tx.gas,
hash: data.tx.hash, hash: data.tx.hash,
input: data.tx.input, input: data.tx.input,
'decoded input': data.resolvedData && data.resolvedData.params ? JSON.stringify(value(data.resolvedData.params), null, '\t') : ' - ',
logs: JSON.stringify(data.logs, null, '\t') || '0', logs: JSON.stringify(data.logs, null, '\t') || '0',
val: data.tx.value val: data.tx.value
}) })
@ -217,10 +218,24 @@ function context (self, opts) {
function value (v) { function value (v) {
try { try {
if (v.indexOf && v.indexOf('0x') === 0) { if (v instanceof Array) {
var ret = []
for (var k in v) {
ret.push(value(v[k]))
}
return ret
} else if (BN.isBN(v)) {
return v.toString(10)
} else if (v.indexOf && v.indexOf('0x') === 0) {
return (new BN(v.replace('0x', ''), 16)).toString(10) return (new BN(v.replace('0x', ''), 16)).toString(10)
} else if (typeof v === 'object') {
var retObject = {}
for (var i in v) {
retObject[i] = value(v[i])
}
return retObject
} else { } else {
return v.toString(10) return v
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
@ -290,6 +305,15 @@ function createTable (opts) {
` `
if (opts.input) table.appendChild(input) if (opts.input) table.appendChild(input)
if (opts['decoded input']) {
var inputDecoded = yo`
<tr class="${css.tr}">
<td class="${css.td}"> decoded input </td>
<td class="${css.td}">${opts['decoded input']}</td>
</tr class="${css.tr}">`
table.appendChild(inputDecoded)
}
var logs = yo` var logs = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> logs </td> <td class="${css.td}"> logs </td>

Loading…
Cancel
Save