From 00c0d3f2bb022769cbf5cae9b60237c25936de27 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 12 Apr 2016 15:02:16 +0100 Subject: [PATCH] Support passing value with a transaction --- assets/js/app.js | 1 + assets/js/universal-dapp.js | 4 ++-- index.html | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/js/app.js b/assets/js/app.js index a301a5e8bc..7fde21b504 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -672,6 +672,7 @@ vm: executionContext === 'vm', removable: false, getAddress: function(){ return $('#txorigin').val(); }, + getValue: function(){ return $('#value').val(); }, 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..63af85b9a7 100644 --- a/assets/js/universal-dapp.js +++ b/assets/js/universal-dapp.js @@ -431,7 +431,7 @@ 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 = self.options.getValue ? self.options.getValue() : 0; if (!this.vm) { var tx = { @@ -459,7 +459,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 41fbc94f78..72d4a4ccfe 100644 --- a/index.html +++ b/index.html @@ -80,8 +80,8 @@
-
- +
+