Commit 9c274fca authored by Alex Beregszaszi's avatar Alex Beregszaszi

Support Ethereum units for setting the value on a transaction

parent 00c0d3f2
...@@ -672,7 +672,10 @@ ...@@ -672,7 +672,10 @@
vm: executionContext === 'vm', vm: executionContext === 'vm',
removable: false, removable: false,
getAddress: function(){ return $('#txorigin').val(); }, 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, removable_instances: true,
renderOutputModifier: function(contractName, $contractOutput) { renderOutputModifier: function(contractName, $contractOutput) {
var contract = data.contracts[contractName]; var contract = data.contracts[contractName];
......
...@@ -431,7 +431,15 @@ UniversalDApp.prototype.runTx = function( data, args, cb) { ...@@ -431,7 +431,15 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
data = '0x' + data; data = '0x' + data;
var gas = self.options.getGas ? self.options.getGas : 1000000; 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) { if (!this.vm) {
var tx = { var tx = {
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<label for="gasPrice"><input type="number" id="gasPrice" value="0"> Gas Price</label> <label for="gasPrice"><input type="number" id="gasPrice" value="0"> Gas Price</label>
</div> </div>
<div class="row"> <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> </div>
<div id="settingsView"> <div id="settingsView">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment