diff --git a/src/universal-dapp.js b/src/universal-dapp.js index fb87686c8c..e65d00b604 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -313,12 +313,18 @@ UniversalDApp.prototype.getCallButton = function(args) { return $('
').html('' + returnName + ': ' + JSON.stringify( result, null, 2 ) ); }; - var getGasUsedOutput = function (result) { + var getGasUsedOutput = function (result, vmResult) { var $gasUsed = $('
'); var caveat = lookupOnly ? '(caveat)' : ''; if (result.gasUsed) { var gas = result.gasUsed.toString(10); - $gasUsed.html('Cost: ' + gas + ' gas. ' + caveat ); + $gasUsed.html('Transaction cost: ' + gas + ' gas. ' + caveat ); + } + if (vmResult.gasUsed) { + var $callGasUsed = $('
'); + var gas = vmResult.gasUsed.toString(10); + $callGasUsed.append('Execution cost: ' + gas + ' gas.' ); + $gasUsed.append($callGasUsed); } return $gasUsed; }; @@ -409,12 +415,12 @@ UniversalDApp.prototype.getCallButton = function(args) { } else if (self.options.vm && result.vm.return === undefined) { replaceOutput($result, $('').text('Exception during execution.').addClass('error')); } else if (self.options.vm && isConstructor) { - replaceOutput($result, getGasUsedOutput(result)); + replaceOutput($result, getGasUsedOutput(result, result.vm)); args.appendFunctions(result.createdAddress); } else if (self.options.vm){ var outputObj = '0x' + result.vm.return.toString('hex'); clearOutput($result); - $result.append(getReturnOutput(outputObj)).append(getGasUsedOutput(result)); + $result.append(getReturnOutput(outputObj)).append(getGasUsedOutput(result, result.vm)); // Only decode if there supposed to be fields if (args.abi.outputs.length > 0) {