From 9b65a27bc53591574581277f67e5573f9431a884 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 26 Jul 2016 10:00:17 +0200 Subject: [PATCH] remix version number --- package.json | 2 +- src/universal-dapp.js | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index a1a9522fd0..ade61f4107 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "webworkify": "^1.2.1", "yo-yo": "^1.2.2", "yo-yoify": "^3.3.0", - "ethereum-remix": "0.0.2-alpha.0.0.4" + "ethereum-remix": "0.0.2-alpha.0.0.7" }, "repository": { "type": "git", diff --git a/src/universal-dapp.js b/src/universal-dapp.js index b57f894bc5..044512495a 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -19,7 +19,6 @@ function UniversalDApp (contracts, options, transactionDebugger) { self.web3 = options.web3; self.transactionDebugger = transactionDebugger; transactionDebugger.addProvider('EXTERNAL', self.web3); - transactionDebugger.switchProvider('EXTERNAL') if (options.mode === 'vm') { // FIXME: use `options.vm` or `self.vm` consistently options.vm = true; @@ -28,7 +27,6 @@ function UniversalDApp (contracts, options, transactionDebugger) { self.vm = new EthJSVM(null, null, { activatePrecompiles: true, enableHomestead: true }); transactionDebugger.addProvider('VM', self.vm); - transactionDebugger.switchProvider('VM') self.addAccount('3cd7232cd6f3fc66a57a6bedc1a8ed6c228fff0a327e169c2bcc5e869ed49511'); self.addAccount('2ac6c190b09897cd8987869cc7b918cfea07ee82038d492abce033c75c1b1d0c'); } else if (options.mode !== 'web3') { @@ -365,6 +363,16 @@ UniversalDApp.prototype.getCallButton = function (args) { return $debugTx; }; + var getDebugCall = function (result) { + var $debugTx = $('
'); + var $button = $(''); + $button.click(function () { + self.transactionDebugger.debug(result); + }); + $debugTx.append($button); + return $debugTx; + }; + var getGasUsedOutput = function (result, vmResult) { var $gasUsed = $('
'); var caveat = lookupOnly ? '(caveat)' : ''; @@ -517,7 +525,11 @@ UniversalDApp.prototype.getCallButton = function (args) { if (decoded) { $result.append(decoded); } - $result.append(getDebugTransaction(result)); + if (args.abi.constant) { + $result.append(getDebugCall(result)); + } else { + $result.append(getDebugTransaction(result)); + } } else if (args.abi.constant && !isConstructor) { clearOutput($result); $result.append(getReturnOutput(result)).append(getGasUsedOutput({})); @@ -654,6 +666,7 @@ UniversalDApp.prototype.runTx = function (data, args, cb) { var tx; if (!self.vm) { + self.transactionDebugger.switchProvider('EXTERNAL'); tx = { from: self.options.getAddress ? self.options.getAddress() : self.web3.eth.accounts[0], to: to, @@ -686,6 +699,7 @@ UniversalDApp.prototype.runTx = function (data, args, cb) { } } else { try { + self.transactionDebugger.switchProvider('VM'); var address = self.options.getAddress ? self.options.getAddress() : self.getAccounts()[0]; var account = self.accounts[address]; tx = new EthJSTX({