diff --git a/src/app/execution/txLogger.js b/src/app/execution/txLogger.js index 6d4a6b18f8..2275724bca 100644 --- a/src/app/execution/txLogger.js +++ b/src/app/execution/txLogger.js @@ -208,12 +208,38 @@ function renderCall (self, data) {
[call] from:${from}, to:${to}, data:${input}, return:
+
${JSON.stringify(typeConversion.stringify(data.resolvedData.decodedReturnValue), null, '\t')}
` + + var table + function txDetails () { + if (table && table.parentNode) { + tx.removeChild(table) + } else { + table = createTable({ + isCall: data.tx.isCall, + contractAddress: data.tx.contractAddress, + data: data.tx, + from, + to, + gas: data.tx.gas, + hash: data.tx.hash, + input: data.tx.input, + 'decoded input': data.resolvedData && data.resolvedData.params ? JSON.stringify(typeConversion.stringify(data.resolvedData.params), null, '\t') : ' - ', + 'decoded output': data.resolvedData && data.resolvedData.decodedReturnValue ? JSON.stringify(typeConversion.stringify(data.resolvedData.decodedReturnValue), null, '\t') : ' - ', + logs: data.logs, + val: data.tx.value, + transactionCost: data.tx.transactionCost, + executionCost: data.tx.executionCost + }) + tx.appendChild(table) + } + } return tx } @@ -344,11 +370,15 @@ function createTable (opts) { ` if (opts.gas) table.appendChild(gas) + var callWarning = '' + if (opts.isCall) { + callWarning = '(Cost only applies when called by a contract)' + } if (opts.transactionCost) { table.appendChild(yo` transaction cost - ${opts.transactionCost} gas + ${opts.transactionCost} gas ${callWarning} `) } @@ -356,7 +386,7 @@ function createTable (opts) { table.appendChild(yo` execution cost - ${opts.executionCost} gas + ${opts.executionCost} gas ${callWarning} `) } @@ -408,7 +438,7 @@ function createTable (opts) { ` if (opts.logs) table.appendChild(logs) - var val = typeConversion.toInt(opts.val) + var val = opts.val != null ? typeConversion.toInt(opts.val) : 0 val = yo` value