Commit e0192b56 authored by yann300's avatar yann300

move execute fn

parent 92e955c5
......@@ -44,6 +44,20 @@ TxRunner.prototype.rawRun = function (args, cb) {
}
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 from = args.from
var to = args.to
......@@ -72,20 +86,6 @@ TxRunner.prototype.execute = function (args, callback) {
})
})
} 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) {
if (err) {
return callback(err, gasEstimation)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment