From 002dbe2a7cdf6d0ebbf1487d682636662885c583 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 14 Sep 2018 14:48:34 -0400 Subject: [PATCH] Fix for account used in sntcontroller; returning gas price --- gas-relayer/config/config.testnet.js | 2 +- gas-relayer/src/message-processor.js | 11 ++++++++--- gas-relayer/src/strategy/AvailabilityStrategy.js | 3 ++- test-dapp/app/components/status-sntcontroller.js | 2 +- test-dapp/app/components/transfersnt.js | 2 ++ test-dapp/app/index.html | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gas-relayer/config/config.testnet.js b/gas-relayer/config/config.testnet.js index b9890c1..f6ba9ae 100644 --- a/gas-relayer/config/config.testnet.js +++ b/gas-relayer/config/config.testnet.js @@ -1,5 +1,5 @@ module.exports = { - "gasPrice": 20, + "gasPrice": 4000000000, "node": { "local":{ "protocol": "ws", diff --git a/gas-relayer/src/message-processor.js b/gas-relayer/src/message-processor.js index 054952f..557a812 100644 --- a/gas-relayer/src/message-processor.js +++ b/gas-relayer/src/message-processor.js @@ -118,9 +118,14 @@ class MessageProcessor { this.events.emit('exit'); } else { try { - const receipt = await this.web3.eth.sendTransaction(p); - // TODO: parse events - reply("Transaction mined", receipt); + this.web3.eth.sendTransaction(p) + .on('transactionHash', function(hash){ + reply("Transaction broadcasted: " + hash); + }) + .on('receipt', function(receipt){ + reply("Transaction mined", receipt); + }); + } catch(err){ reply("Couldn't mine transaction: " + err.message); // TODO log this? diff --git a/gas-relayer/src/strategy/AvailabilityStrategy.js b/gas-relayer/src/strategy/AvailabilityStrategy.js index eb159e6..7327a2b 100644 --- a/gas-relayer/src/strategy/AvailabilityStrategy.js +++ b/gas-relayer/src/strategy/AvailabilityStrategy.js @@ -24,7 +24,8 @@ class AvailabilityStrategy extends Strategy { message: { message: "Available", address: this.config.node.blockchain.account, - minPrice: minPrice + minAcceptedGasPrice: minPrice, + gasPriceUsed: this.config.gasPrice } }; } diff --git a/test-dapp/app/components/status-sntcontroller.js b/test-dapp/app/components/status-sntcontroller.js index 4cad09a..dfa312d 100644 --- a/test-dapp/app/components/status-sntcontroller.js +++ b/test-dapp/app/components/status-sntcontroller.js @@ -111,7 +111,7 @@ class Status extends Component { web3.eth.getAccounts() .then(accounts => { - SNTController.methods.signNonce(accounts[2]) + SNTController.methods.signNonce(this.props.walletAddress) .call() .then((nonce) => { this.props.nonceUpdateFunction(nonce); diff --git a/test-dapp/app/components/transfersnt.js b/test-dapp/app/components/transfersnt.js index 5881675..d0c5e6e 100644 --- a/test-dapp/app/components/transfersnt.js +++ b/test-dapp/app/components/transfersnt.js @@ -27,6 +27,8 @@ const styles = theme => ({ }); window.TestContract = TestContract; +window.SNTController = SNTController; + class TransferSNT extends Component { constructor(props){ diff --git a/test-dapp/app/index.html b/test-dapp/app/index.html index a1b8f1d..142a9a2 100644 --- a/test-dapp/app/index.html +++ b/test-dapp/app/index.html @@ -12,8 +12,8 @@

Gas Relayer Demos

The following demos are available: