diff --git a/assets/js/app.js b/assets/js/app.js index a301a5e8bc..7b7eb75598 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -672,6 +672,10 @@ vm: executionContext === 'vm', removable: false, getAddress: function(){ return $('#txorigin').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]; diff --git a/assets/js/universal-dapp.js b/assets/js/universal-dapp.js index 13d6263717..beba5064a3 100644 --- a/assets/js/universal-dapp.js +++ b/assets/js/universal-dapp.js @@ -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 = { @@ -459,7 +467,7 @@ UniversalDApp.prototype.runTx = function( data, args, cb) { gasPrice: 1, gasLimit: 3000000000, //plenty to: to, - value: value, + value: new this.BN(value, 10), data: new Buffer(data.slice(2), 'hex') }); tx.sign(account.privateKey); diff --git a/index.html b/index.html index 3a6c15da6b..c5adc79b45 100644 --- a/index.html +++ b/index.html @@ -80,8 +80,8 @@
-
- +
+