|
|
@ -70,8 +70,12 @@ THE SOFTWARE. |
|
|
|
<code>tx.origin = <span id="txorigin"/></code></p> |
|
|
|
<code>tx.origin = <span id="txorigin"/></code></p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div id="optimizeBox"> |
|
|
|
<div id="optimizeBox"> |
|
|
|
<input id="editorWrap" type="checkbox"><label for="editorWrap">Text Wrap</label> |
|
|
|
<label for="editorWrap"><input id="editorWrap" type="checkbox">Text Wrap</label> |
|
|
|
<input id="optimize" type="checkbox"><label for="optimize">Enable Optimization</label> |
|
|
|
<label for="optimize"><input id="optimize" type="checkbox">Enable Optimization</label> |
|
|
|
|
|
|
|
<span id="executionContext"> |
|
|
|
|
|
|
|
<label for="vm"><input id="vm" type="radio" value="vm" checked name="executionContext">JavaScript VM</label> |
|
|
|
|
|
|
|
<label for="web3"><input id="web3" type="radio" value="web3" name="executionContext">Web3 Provider</label> |
|
|
|
|
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div id="output"></div> |
|
|
|
<div id="output"></div> |
|
|
@ -111,6 +115,25 @@ THE SOFTWARE. |
|
|
|
session.setTabSize(4); |
|
|
|
session.setTabSize(4); |
|
|
|
session.setUseSoftTabs(true); |
|
|
|
session.setUseSoftTabs(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------- execution context ------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $vmToggle = $('#vm'); |
|
|
|
|
|
|
|
var $web3Toggle = $('#web3'); |
|
|
|
|
|
|
|
var executionContext = 'vm'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$vmToggle.on('change', executionContextChange ); |
|
|
|
|
|
|
|
$web3Toggle.on('change', executionContextChange ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function executionContextChange (ev) { |
|
|
|
|
|
|
|
if (ev.target.value == 'web3' && !confirm("Are you sure you want to connect to a local ethereum node.") ) { |
|
|
|
|
|
|
|
$vmToggle.get(0).checked = true; |
|
|
|
|
|
|
|
executionContext = 'vm'; |
|
|
|
|
|
|
|
} else executionContext = ev.target.value; |
|
|
|
|
|
|
|
compile(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------- file selector------------- |
|
|
|
// ----------------- file selector------------- |
|
|
|
|
|
|
|
|
|
|
|
var $filesEl = $('#files'); |
|
|
|
var $filesEl = $('#files'); |
|
|
@ -408,7 +431,7 @@ THE SOFTWARE. |
|
|
|
|
|
|
|
|
|
|
|
var renderError = function(message) { |
|
|
|
var renderError = function(message) { |
|
|
|
var type = errortype(message); |
|
|
|
var type = errortype(message); |
|
|
|
var $error = $('<div class="' + type + '"><pre>' + message + '</pre><div class="close">x</div></div>'); |
|
|
|
var $error = $('<div class="sol ' + type + '"><pre>' + message + '</pre><div class="close">x</div></div>'); |
|
|
|
$('#output').append( $error ); |
|
|
|
$('#output').append( $error ); |
|
|
|
var err = message.match(/^:([0-9]*):([0-9]*)/); |
|
|
|
var err = message.match(/^:([0-9]*):([0-9]*)/); |
|
|
|
if (err && err.length) { |
|
|
|
if (err && err.length) { |
|
|
@ -476,7 +499,7 @@ THE SOFTWARE. |
|
|
|
interface: contract['interface'], |
|
|
|
interface: contract['interface'], |
|
|
|
bytecode: contract.bytecode |
|
|
|
bytecode: contract.bytecode |
|
|
|
}], { |
|
|
|
}], { |
|
|
|
vm: true, |
|
|
|
vm: executionContext === 'vm', |
|
|
|
removable: false, |
|
|
|
removable: false, |
|
|
|
removable_instances: true |
|
|
|
removable_instances: true |
|
|
|
}); |
|
|
|
}); |
|
|
@ -487,7 +510,12 @@ THE SOFTWARE. |
|
|
|
.append(textRow('Web3 deploy', gethDeploy(contractName.toLowerCase(),contract['interface'],contract.bytecode), 'deploy')) |
|
|
|
.append(textRow('Web3 deploy', gethDeploy(contractName.toLowerCase(),contract['interface'],contract.bytecode), 'deploy')) |
|
|
|
.append(textRow('uDApp', combined(contractName,contract['interface'],contract.bytecode), 'deploy')) |
|
|
|
.append(textRow('uDApp', combined(contractName,contract['interface'],contract.bytecode), 'deploy')) |
|
|
|
.append(getDetails(contract, source, contractName)); |
|
|
|
.append(getDetails(contract, source, contractName)); |
|
|
|
$('#txorigin').text('0x' + dapp.address.toString('hex')); |
|
|
|
|
|
|
|
|
|
|
|
if (executionContext == 'vm') $('#txorigin').text('0x' + dapp.address.toString('hex')); |
|
|
|
|
|
|
|
else web3.eth.getAccounts( function(err,accounts) { |
|
|
|
|
|
|
|
$('#txorigin').text(accounts[0]); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$contractOutput.find('.title').click(function(ev){ $(this).closest('.udapp').toggleClass('hide') }); |
|
|
|
$contractOutput.find('.title').click(function(ev){ $(this).closest('.udapp').toggleClass('hide') }); |
|
|
|
$('#output').append( $contractOutput ); |
|
|
|
$('#output').append( $contractOutput ); |
|
|
|
} |
|
|
|
} |
|
|
|