pull/1/head
d11e9 9 years ago
parent 79d210b303
commit 2c66706000
  1. 25
      assets/css/browser-solidity.css
  2. 9
      assets/js/universal-dapp.js
  3. 38
      index.html

@ -139,16 +139,25 @@ body {
#header #optionViews { #header #optionViews {
clear: both; clear: both;
overflow: auto; overflow: auto;
padding: 1em;
} }
#header #optionViews > div { #header #optionViews > div {
display: none; display: none;
padding: 0.4em;
} }
#header #optionViews.txView #txView { display: block; } #header #optionViews.txView #txView { display: block; }
#header #optionViews.settingsView #settingsView { display: block; } #header #optionViews.settingsView #settingsView { display: block; }
#header #optionViews.publishView #publishView { display: block; } #header #optionViews.publishView #publishView { display: block; }
#header #optionViews.envView #envView { display: block; } #header #optionViews.envView #envView { display: block; }
#header #optionViews.txView input,
#header #optionViews.txView select {
max-width: 13em;
padding: 0.3em;
box-sizing: border-box;
border: 1px solid rgba( 0,0,0,0.3 );
border-radius: 3px;
}
#header .info { #header .info {
font-family: monospace; font-family: monospace;
min-height: 6em; min-height: 6em;
@ -172,29 +181,15 @@ body {
#header .origin, #header .origin,
#header #executionContext { #header #executionContext {
display: block; display: block;
margin-top: 0.5em;
word-wrap: break-word; word-wrap: break-word;
} }
#header #executionContext{ margin-top: 0; }
#header #versionSelector { #header #versionSelector {
border: 0 none; border: 0 none;
font-family: monospace; font-family: monospace;
background-color: transparent; background-color: transparent;
} }
.col1 { .col1 {
width: 30%; width: 30%;
float: left; float: left;

@ -382,6 +382,9 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
var to = args.address; var to = args.address;
var constant = args.abi.constant; var constant = args.abi.constant;
var isConstructor = args.bytecode !== undefined; var isConstructor = args.bytecode !== undefined;
var gas = self.options.getGas ? self.options.getGas : 1000000;
var value = self.options.getValue ? self.options.getValue : 0;
if (!this.vm) { if (!this.vm) {
if (constant && !isConstructor) { if (constant && !isConstructor) {
@ -389,10 +392,11 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
func[args.abi.name].call( cb ); func[args.abi.name].call( cb );
} else { } else {
var tx = { var tx = {
from: web3.eth.accounts[0], from: self.options.getAddress ? self.options.getAddress() : web3.eth.accounts[0],
to: to, to: to,
data: data, data: data,
gas: 1000000 gas: gas,
value: value
}; };
web3.eth.estimateGas( tx, function(err, resp){ web3.eth.estimateGas( tx, function(err, resp){
tx.gas = resp; tx.gas = resp;
@ -409,6 +413,7 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
gasPrice: '01', gasPrice: '01',
gasLimit: '3000000000', //plenty gasLimit: '3000000000', //plenty
to: to, to: to,
value: value,
data: data data: data
}); });
tx.sign(new Buffer(this.secretKey, 'hex')); tx.sign(new Buffer(this.secretKey, 'hex'));

@ -64,7 +64,7 @@ THE SOFTWARE.
<div id="righthand-panel"> <div id="righthand-panel">
<div id="header"> <div id="header">
<div id="menu"> <div id="menu">
<img id="solIcon" title="Solidity realtime compiler and runtime" src="assets/img/sol.gif"> <img id="solIcon" title="Solidity realtime compiler and runtime" src="assets/img/sol.gif" alt="Solidity realtime compiler and runtime">
<ul id="options"> <ul id="options">
<li class="txView active"><i class="fa fa-send"></i></li> <li class="txView active"><i class="fa fa-send"></i></li>
<li class="envView"><i class="fa fa-tachometer"></i></li> <li class="envView"><i class="fa fa-tachometer"></i></li>
@ -74,10 +74,18 @@ THE SOFTWARE.
</div> </div>
<div id="optionViews" class="txView"> <div id="optionViews" class="txView">
<div id="txView"> <div id="txView">
<select name="origin" id="txorigin"></select> <div class="row">
<label for="gas"><input type="number" id="gas"> Gas</label> <label for="txorigin"><select name="txorigin" id="txorigin"></select> Transaction origin</label>
<label for="gasPrice"><input type="number" id="gasPrice"> Gas Price</label> </div>
<label for="value"><input type="number" id="value"> Value</label> <div class="row">
<label for="gas"><input type="number" id="gas" value="0"> Gas</label>
</div>
<div class="row">
<label for="gasPrice"><input type="number" id="gasPrice" value="0"> Gas Price</label>
</div>
<div class="row">
<label for="value"><input type="number" id="value" value="0"> Value</label>
</div>
</div> </div>
<div id="settingsView"> <div id="settingsView">
<div class="version">Solidity version: <span id="version">(loading)</span> <br/>Change to: <select id="versionSelector"></select></div> <div class="version">Solidity version: <span id="version">(loading)</span> <br/>Change to: <select id="versionSelector"></select></div>
@ -85,9 +93,8 @@ THE SOFTWARE.
<label for="optimize"><input id="optimize" type="checkbox">Enable Optimization</label> <label for="optimize"><input id="optimize" type="checkbox">Enable Optimization</label>
</div> </div>
<div id="publishView"> <div id="publishView">
<p><button id="gist" title="Publish all files as public gist on github.com"><i class="fa fa-github"></i> Publish gist</button> Publish all open files to an anonymous github gist.</p> <p>Publish all open files to an anonymous github gist.</p>
<button id="gist" title="Publish all files as public gist on github.com"><i class="fa fa-github"></i> Publish Gist</button>
<p>Publish to ipfs ...</p>
</div> </div>
<div id="envView"> <div id="envView">
<span id="executionContext"> <span id="executionContext">
@ -188,13 +195,17 @@ THE SOFTWARE.
// ----------------- tabbed menu ------------------- // ----------------- tabbed menu -------------------
$('#options li').click(function(){ $('#options li').click(function(ev){
var $el = $(this); var $el = $(this);
var cls = /[a-z]+View/.exec( $el.get(0).className )[0]; var cls = /[a-z]+View/.exec( $el.get(0).className )[0];
$el.parent().find('li').removeClass('active'); if (!$el.hasClass('active')) {
$el.addClass('active'); $el.parent().find('li').removeClass('active');
$('#optionViews').attr('class', '').addClass(cls); $('#optionViews').attr('class', '').addClass(cls);
console.log(cls) $el.addClass('active');
} else {
$el.removeClass('active');
$('#optionViews').removeClass(cls);
}
}); });
// ----------------- execution context ------------- // ----------------- execution context -------------
@ -635,6 +646,7 @@ THE SOFTWARE.
var dapp = new UniversalDApp(udappContracts, { var dapp = new UniversalDApp(udappContracts, {
vm: executionContext === 'vm', vm: executionContext === 'vm',
removable: false, removable: false,
getAddress: function(){ return $('txorigin').val(); },
removable_instances: true, removable_instances: true,
renderOutputModifier: function(contractName, $contractOutput) { renderOutputModifier: function(contractName, $contractOutput) {
var contract = data.contracts[contractName]; var contract = data.contracts[contractName];

Loading…
Cancel
Save