wiring txorigin into select dropdown

pull/1/head
d11e9 9 years ago
parent b4c0f0561b
commit 79d210b303
  1. 1
      assets/css/browser-solidity.css
  2. 37
      index.html

@ -142,7 +142,6 @@ body {
padding: 1em; padding: 1em;
} }
#header #optionViews > div { #header #optionViews > div {
margin-top: 1em;
display: none; display: none;
} }
#header #optionViews.txView #txView { display: block; } #header #optionViews.txView #txView { display: block; }

@ -74,12 +74,10 @@ THE SOFTWARE.
</div> </div>
<div id="optionViews" class="txView"> <div id="optionViews" class="txView">
<div id="txView"> <div id="txView">
<code class="origin">tx.origin: <span id="txorigin"/></code> <select name="origin" id="txorigin"></select>
<select name="" id=""> <label for="gas"><input type="number" id="gas"> Gas</label>
<option value="">Acc</option> <label for="gasPrice"><input type="number" id="gasPrice"> Gas Price</label>
</select> <label for="value"><input type="number" id="value"> Value</label>
<input type="text" class="gas">
<input type="text" class="value">
</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>
@ -649,17 +647,22 @@ THE SOFTWARE.
}}); }});
var $contractOutput = dapp.render(); var $contractOutput = dapp.render();
if (executionContext === 'vm')
$('#txorigin').text('0x' + dapp.address.toString('hex')); $txOrigin = $('#txorigin');
else if (executionContext === 'vm') {
web3.eth.getAccounts(function(err, accounts) { $txOrigin.empty();
if (err) var addr = '0x' + dapp.address.toString('hex');
renderError(err.message); $txOrigin.val(addr);
if (accounts && accounts[0]) $txOrigin.append($('<option />').val(addr).text(addr));
$('#txorigin').text(accounts[0]); } else web3.eth.getAccounts(function(err, accounts) {
else if (err)
$('#txorigin').text('unknown'); renderError(err.message);
}); if (accounts && accounts[0]){
$txOrigin.empty();
for( var a in accounts) { $txOrigin.append($('<option />').val(accounts[a]).text(accounts[a])); }
$txOrigin.val(accounts[0]);
} else $txOrigin.val('unknown');
});
$contractOutput.find('.title').click(function(ev){ $(this).closest('.contract').toggleClass('hide'); }); $contractOutput.find('.title').click(function(ev){ $(this).closest('.contract').toggleClass('hide'); });
$('#output').append( $contractOutput ); $('#output').append( $contractOutput );

Loading…
Cancel
Save