@ -68,26 +68,26 @@ TxRunner.prototype.execute = function (args, callback) {
} )
} )
} } )
} } )
} else {
} else {
modalDialog ( 'Confirm transaction' , remixdDialog ( tx ) ,
executionContext . web3 ( ) . eth . estimateGas ( tx , function ( err , gasEstimation ) {
{ label : 'Confirm' ,
if ( err ) {
fn : ( ) => {
return callback ( err , gasEstimation )
executionContext . web3 ( ) . eth . estimateGas ( tx , function ( err , gasEstimation ) {
}
if ( err ) {
var blockGasLimit = executionContext . currentblockGasLimit ( )
return callback ( err , gasEstimation )
// NOTE: estimateGas very likely will return a large limit if execution of the code failed
}
// we want to be able to run the code in order to debug and find the cause for the failure
var blockGasLimit = executionContext . currentblockGasLimit ( )
// NOTE: estimateGas very likely will return a large limit if execution of the code failed
// we want to be able to run the code in order to debug and find the cause for the failure
var warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation).'
var warnEstimation = ' An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that\'s also the reason of strong gas estimation).'
if ( gasEstimation > gasLimit ) {
if ( gasEstimation > gasLimit ) {
return callback ( 'Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation )
return callback ( 'Gas required exceeds limit: ' + gasLimit + '. ' + warnEstimation )
}
}
if ( gasEstimation > blockGasLimit ) {
if ( gasEstimation > blockGasLimit ) {
return callback ( 'Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation )
return callback ( 'Gas required exceeds block gas limit: ' + gasLimit + '. ' + warnEstimation )
}
}
tx . gas = gasEstimation
tx . gas = gasEstimation
modalDialog ( 'Confirm transaction' , remixdDialog ( tx ) ,
{ label : 'Confirm' ,
fn : ( ) => {
var sendTransaction = self . personalMode ? executionContext . web3 ( ) . personal . sendTransaction : executionContext . web3 ( ) . eth . sendTransaction
var sendTransaction = self . personalMode ? executionContext . web3 ( ) . personal . sendTransaction : executionContext . web3 ( ) . eth . sendTransaction
try {
try {
sendTransaction ( tx , function ( err , resp ) {
sendTransaction ( tx , function ( err , resp ) {
@ -100,8 +100,8 @@ TxRunner.prototype.execute = function (args, callback) {
} catch ( e ) {
} catch ( e ) {
return callback ( ` Send transaction failed: ${ e . message } . if you use an injected provider, please check it is properly unlocked. ` )
return callback ( ` Send transaction failed: ${ e . message } . if you use an injected provider, please check it is properly unlocked. ` )
}
}
} )
} } )
} } )
} )
}
}
} else {
} else {
try {
try {
@ -188,13 +188,12 @@ function run (self, tx, stamp, callback) {
function remixdDialog ( tx ) {
function remixdDialog ( tx ) {
return yo `
return yo `
< div >
< div >
< div > You are trying to execute transaction on the main network . Please , click confirm to continue ! < / d i v >
< div > You are trying to execute transaction on the main network . Click confirm if you want to continue ! < / d i v >
< div class = $ { css . txInfoBox } >
< div class = $ { css . txInfoBox } >
< div > from : $ { tx . from } < / d i v >
< div > from : $ { tx . from } < / d i v >
< div > to : $ { tx . from } < / d i v >
< div > to : $ { tx . from } < / d i v >
< div > tx value : $ { tx . value } < / d i v >
< div > tx value : $ { tx . value } < / d i v >
< div > gas limit : $ { tx . gasLimit } < / d i v >
< div > gas limit : $ { tx . gas } < / d i v >
< div > gas price : $ { tx . gasEstimation } < / d i v >
< div > data : $ { helper . shortenHexData ( tx . data ) } < / d i v >
< div > data : $ { helper . shortenHexData ( tx . data ) } < / d i v >
< / d i v >
< / d i v >
< / d i v >
< / d i v >