use current provider for gas price

pull/5370/head
Iuri Matias 5 years ago
parent 03ddf082bf
commit f1da60d86f
  1. 2
      src/blockchain/blockchain.js
  2. 4
      src/blockchain/providers/injected.js
  3. 4
      src/blockchain/providers/node.js
  4. 4
      src/blockchain/providers/vm.js

@ -132,7 +132,7 @@ class Blockchain {
} }
determineGasPrice (cb) { determineGasPrice (cb) {
this.executionContext.web3().eth.getGasPrice((error, gasPrice) => { this.getCurrentProvider().getGasPrice((error, gasPrice) => {
const warnMessage = ' Please fix this issue before sending any transaction. ' const warnMessage = ' Please fix this issue before sending any transaction. '
if (error) { if (error) {
return cb('Unable to retrieve the current network gas price.' + warnMessage + error) return cb('Unable to retrieve the current network gas price.' + warnMessage + error)

@ -30,6 +30,10 @@ class InjectedProvider {
}) })
} }
getGasPrice (cb) {
this.executionContext.web3().eth.getGasPrice(cb)
}
signMessage (message, account, _passphrase, cb) { signMessage (message, account, _passphrase, cb) {
const hashedMsg = Web3.utils.sha3(message) const hashedMsg = Web3.utils.sha3(message)
try { try {

@ -38,6 +38,10 @@ class NodeProvider {
}) })
} }
getGasPrice (cb) {
this.executionContext.web3().eth.getGasPrice(cb)
}
signMessage (message, account, passphrase, cb) { signMessage (message, account, passphrase, cb) {
const hashedMsg = Web3.utils.sha3(message) const hashedMsg = Web3.utils.sha3(message)
try { try {

@ -72,6 +72,10 @@ class VMProvider {
}) })
} }
getGasPrice (cb) {
this.executionContext.web3().eth.getGasPrice(cb)
}
signMessage (message, account, _passphrase, cb) { signMessage (message, account, _passphrase, cb) {
const personalMsg = ethJSUtil.hashPersonalMessage(Buffer.from(message)) const personalMsg = ethJSUtil.hashPersonalMessage(Buffer.from(message))
const privKey = this.providers.vm.accounts[account].privateKey const privKey = this.providers.vm.accounts[account].privateKey

Loading…
Cancel
Save