diff --git a/src/app/execution/txLogger.js b/src/app/execution/txLogger.js index 96749d3db9..c048a7f238 100644 --- a/src/app/execution/txLogger.js +++ b/src/app/execution/txLogger.js @@ -19,7 +19,7 @@ var css = csjs` align-items: baseline; justify-content: space-between; } - .txBlock, .txVM { + .tx { color: ${styles.colors.violet}; width: 45%; } @@ -112,16 +112,10 @@ function log (self, tx, api) { function renderKnownTransaction (self, data) { var from = data.tx.from - var to = '' - - if (data.tx.blockHash) { - to = data.tx.to - } else if (data.tx.hash) { // call (constructor of function call) - if (data.resolvedData.fn === '(constructor)') { - to = data.resolvedData.contractName + '.' + data.resolvedData.fn - } else { - to = data.resolvedData.to - } + var to = data.resolvedData.contractName + '.' + data.resolvedData.fn + if (data.resolvedData.to) { + to = to + data.resolvedData.to + var shortTo = to + helper.shortenHexData(data.resolvedData.to) } function debug () { @@ -130,7 +124,7 @@ function renderKnownTransaction (self, data) { var tx = yo`
- ${context(self, data)} + ${context(self, {from, to: shortTo, data})}
@@ -150,7 +144,7 @@ function renderKnownTransaction (self, data) { from, to, gas: data.tx.gas, - hash: data.tx.has, + hash: data.tx.hash, input: data.tx.input, logs: JSON.stringify(data.logs) || '0', val: data.tx.value @@ -171,7 +165,7 @@ function renderUnknownTransaction (self, data) { var tx = yo`
- ${context(self, data)} + ${context(self, {from, to, data})}
@@ -197,22 +191,25 @@ function renderEmptyBlock (self, data) { return yo`block ${data.block.number} - O transactions` } -function context (self, data) { - var from = helper.shortenHexData(data.tx.from) - var to = '' +function context (self, opts) { + var data = opts.data || '' + var from = opts.from ? helper.shortenHexData(opts.from) : '' + var to = opts.to || '' + var val = data.tx.value + var type = opts.type || '' + var hash = data.tx.hash ? helper.shortenHexData(data.tx.hash) : '' + var input = data.tx.input ? helper.shortenHexData(data.tx.input) : '' + var logs = data.logs ? data.logs.length : 0 if (executionContext.getProvider() === 'vm') { - if (data.resolvedData.to) { - to = `${data.resolvedData.contractName}.${data.resolvedData.fn} ${helper.shortenHexData(data.resolvedData.to)}` - } else { - to = `${data.resolvedData.contractName}.${data.resolvedData.fn}` - } - return yo`[vm] from: ${from}, to:${to}, value:${data.tx.value} wei` + return yo`[vm] from:${from}, to:${to}, value:${value(val)} wei, data:${input}, ${logs} logs, hash:${hash}` + } else if (executionContext.getProvider() !== 'web3' && data.resolvedData) { + return yo`[web3] from:${from}, to:${to}, value:${value(val)} wei, data:${input}, ${logs} logs, hash:${hash}` } else { - var hash = helper.shortenHexData(data.tx.blockHash) - var block = data.tx.blockNumber - var i = data.tx.transactionIndex - var val = data.tx.value - return yo`[block:${block} txIndex:${i}] from:${from}, to:${hash}, value:${value(val)} wei` + to = helper.shortenHexData(to) + hash = helper.shortenHexData(data.tx.blockHash) + var block = data.tx.blockNumber + var i = data.tx.transactionIndex + return yo`[block:${block} txIndex:${i}] from:${from}, to:${hash}, value:${value(val)} wei` } } @@ -235,6 +232,7 @@ module.exports = TxLogger function createTable (opts) { var table = yo`
` + var contractAddress = yo` contractAddress @@ -242,14 +240,7 @@ function createTable (opts) { ` if (opts.contractAddress) table.appendChild(contractAddress) - var data = helper.shortenHexData(opts.input) - data = yo` - - data - ${data} - - ` - if (opts.data) table.appendChild(data) + var from = yo` from @@ -257,6 +248,7 @@ function createTable (opts) { ` if (opts.from) table.appendChild(from) + var to = yo` to @@ -264,6 +256,7 @@ function createTable (opts) { ` if (opts.to) table.appendChild(to) + var gas = yo` gas @@ -271,6 +264,7 @@ function createTable (opts) { ` if (opts.gas) table.appendChild(gas) + var hash = yo` hash @@ -278,14 +272,15 @@ function createTable (opts) { ` if (opts.hash) table.appendChild(hash) - var input = helper.shortenHexData(opts.input) - input = yo` + + var input = yo` input - ${input} + ${opts.input} ` if (opts.input) table.appendChild(input) + var logs = yo` logs @@ -293,6 +288,7 @@ function createTable (opts) { ` if (opts.logs) table.appendChild(logs) + var val = value(opts.val) val = yo` @@ -301,5 +297,6 @@ function createTable (opts) { ` if (opts.val) table.appendChild(val) + return table } diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 9e09bb03c5..1e8e82944b 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -300,7 +300,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) { var args = createButtonInput.value txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), (error, data) => { if (!error) { - appAPI.logMessage('[WEB3] transaction added ...') + appAPI.logMessage('Transaction added ...') txExecution.createContract(data, appAPI.udapp(), (error, txResult) => { if (!error) { var isVM = executionContext.isVM() diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 51618438aa..06feb38cb1 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -309,7 +309,7 @@ UniversalDApp.prototype.getCallButton = function (args) { if (!error) { txExecution.callFunction(args.address, data, args.funABI, self, (error, txResult) => { if (!error) { - self._api.logMessage('[WEB3] UDApp transaction added ...') + self._api.logMessage('UDApp transaction added ...') var isVM = executionContext.isVM() if (isVM) { var vmError = txExecution.checkVMError(txResult)