diff --git a/assets/js/universal-dapp.js b/assets/js/universal-dapp.js index e8fdcab6f4..dcd05d38a2 100644 --- a/assets/js/universal-dapp.js +++ b/assets/js/universal-dapp.js @@ -22,7 +22,7 @@ function UniversalDApp (contracts, options) { } else { var host = options.host || "localhost"; var port = options.port || "8545"; - var rpc_url = 'http://' + host + ':' + port; + var rpc_url = options.getWeb3endpoint ? options.getWeb3endpoint() : ('http://' + host + ':' + port); web3.setProvider( new web3.providers.HttpProvider( rpc_url ) ); } @@ -296,7 +296,8 @@ UniversalDApp.prototype.getCallButton = function(args) { } tryTillResponse( result, function(err, result) { - if (isConstructor) { + if (err) replaceOutput($result, $('').text(err).addClass('error')); + else if (isConstructor) { $result.html(''); args.appendFunctions(result.contractAddress); } else { diff --git a/index.html b/index.html index 37b09eab94..5397d1fc74 100644 --- a/index.html +++ b/index.html @@ -97,13 +97,18 @@
-
@@ -222,12 +227,18 @@ var $vmToggle = $('#vm'); var $web3Toggle = $('#web3'); + var $web3endpoint = $('#web3Endpoint'); var executionContext = 'vm'; $vmToggle.get(0).checked = true; $vmToggle.on('change', executionContextChange ); $web3Toggle.on('change', executionContextChange ); + $web3endpoint.on('change', function(){ + var endpoint = $('#web3Endpoint').val(); + web3.setProvider( new web3.providers.HttpProvider( endpoint ) ); + compile(); + }); function executionContextChange (ev) { if (ev.target.value == 'web3' && !confirm("Are you sure you want to connect to a local ethereum node?") ) { @@ -452,11 +463,12 @@ // ----------------- toggle right hand panel ----------------- - var toggledRHP = false; + var hidingRHP = false; $('.toggleRHP').click(function(){ - toggledRHP = !toggledRHP; - setEditorSize( toggledRHP ? 0 : window.localStorage[EDITOR_SIZE_CACHE_KEY] ); - $('.toggleRHP').toggleClass('toggled', toggledRHP) + hidingRHP = !hidingRHP; + setEditorSize( hidingRHP ? 0 : window.localStorage[EDITOR_SIZE_CACHE_KEY] ); + $('.toggleRHP').toggleClass('hiding', hidingRHP); + if (!hidingRHP) compile(); }); @@ -488,7 +500,6 @@ var previousInput = ''; var sourceAnnotations = []; var compile = function() { - editor.getSession().clearAnnotations(); sourceAnnotations = []; editor.getSession().removeMarker(errMarkerId); @@ -519,7 +530,7 @@ }); } - if (noFatalErrors) renderContracts(data, editor.getValue()); + if (noFatalErrors && !hidingRHP) renderContracts(data, editor.getValue()); }; var compileTimeout = null;