Support Ethereum units for setting the value on a transaction

pull/1/head
Alex Beregszaszi 9 years ago
parent 00c0d3f2bb
commit 9c274fca4a
  1. 5
      assets/js/app.js
  2. 10
      assets/js/universal-dapp.js
  3. 2
      index.html

@ -672,7 +672,10 @@
vm: executionContext === 'vm',
removable: false,
getAddress: function(){ return $('#txorigin').val(); },
getValue: function(){ return $('#value').val(); },
getValue: function(){
var comp = $('#value').val().split(' ');
return web3.toWei(comp[0], comp.slice(1).join(' '));
},
removable_instances: true,
renderOutputModifier: function(contractName, $contractOutput) {
var contract = data.contracts[contractName];

@ -431,7 +431,15 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
data = '0x' + data;
var gas = self.options.getGas ? self.options.getGas : 1000000;
var value = self.options.getValue ? self.options.getValue() : 0;
var value = 0;
if (self.options.getValue) {
try {
value = self.options.getValue();
} catch (e) {
return cb(e);
}
}
if (!this.vm) {
var tx = {

@ -81,7 +81,7 @@
<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 (Wei)</label>
<label for="value"><input type="text" id="value" value="0"> Value</label>
</div>
</div>
<div id="settingsView">

Loading…
Cancel
Save