Commit 0c7e1844 authored by ninabreznik's avatar ninabreznik

Ask To Confirm Transaction - first draft

parent defb1c8f
......@@ -46,14 +46,20 @@ TxRunner.prototype.execute = function (args, callback) {
}
if (args.useCall) {
tx.gas = gasLimit
modalDialog('Confirm transaction', remixdDialog(tx),
{ label: 'Confirm',
fn: () => {
executionContext.web3().eth.call(tx, function (error, result) {
callback(error, {
result: result,
transactionHash: result.transactionHash
})
})
askToConfirmTx(tx)
}})
} else {
modalDialog('Confirm transaction', remixdDialog(tx),
{ label: 'Confirm',
fn: () => {
executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) {
if (err) {
return callback(err, gasEstimation)
......@@ -84,8 +90,8 @@ TxRunner.prototype.execute = function (args, callback) {
return callback(`Send transaction failed: ${e.message} . if you use an injected provider, please check it is properly unlocked. `)
}
})
}})
}
askToConfirmTx(tx)
} else {
try {
var account = self.vmaccounts[from]
......@@ -168,16 +174,11 @@ function run (self, tx, stamp, callback) {
}
}
function askToConfirmTx (tx) {
var title = `Executing transaction on the main network`
var el = yo`
<div>
function remixdDialog (tx) {
return yo`
<div>
You are connected to the main network, which means your transaction will
be performed using real currency. Check out the details of the transaction you want
to run and click confirm if you are sure you want to continue with its
exectution on the main network.
</div>
<div>You are trying to execute transaction on the main network. Please, click confirm to continue!</div>
<div>
<div>from: ${tx.from}</div>
<div>to: ${tx.from}</div>
......@@ -188,7 +189,9 @@ var title = `Executing transaction on the main network`
</div>
</div>
`
modalDialog(title, el, {label: ''}, {label: 'Confirm'}) // PROMPT!
}
module.exports = TxRunner
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