move execute fn

pull/3094/head
yann300 7 years ago
parent 99fc5ab2f2
commit a200314d57
  1. 28
      src/app/execution/txRunner.js

@ -44,6 +44,20 @@ TxRunner.prototype.rawRun = function (args, cb) {
} }
TxRunner.prototype.execute = function (args, callback) { TxRunner.prototype.execute = function (args, callback) {
function execute () {
var sendTransaction = self.personalMode ? executionContext.web3().personal.sendTransaction : executionContext.web3().eth.sendTransaction
try {
sendTransaction(tx, function (err, resp) {
if (err) {
return callback(err, resp)
}
tryTillResponse(resp, callback)
})
} catch (e) {
return callback(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
}
}
var self = this var self = this
var from = args.from var from = args.from
var to = args.to var to = args.to
@ -72,20 +86,6 @@ TxRunner.prototype.execute = function (args, callback) {
}) })
}) })
} else { } else {
function execute () {
var sendTransaction = self.personalMode ? executionContext.web3().personal.sendTransaction : executionContext.web3().eth.sendTransaction
try {
sendTransaction(tx, function (err, resp) {
if (err) {
return callback(err, resp)
}
tryTillResponse(resp, callback)
})
} catch (e) {
return callback(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
}
}
executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) { executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) {
if (err) { if (err) {
return callback(err, gasEstimation) return callback(err, gasEstimation)

Loading…
Cancel
Save