Commit defb1c8f authored by ninabreznik's avatar ninabreznik

Add first draft for askToConfirmTx modal dialog

parent 968f2bba
...@@ -4,6 +4,8 @@ var EthJSBlock = require('ethereumjs-block') ...@@ -4,6 +4,8 @@ var EthJSBlock = require('ethereumjs-block')
var ethJSUtil = require('ethereumjs-util') var ethJSUtil = require('ethereumjs-util')
var BN = ethJSUtil.BN var BN = ethJSUtil.BN
var executionContext = require('../../execution-context') var executionContext = require('../../execution-context')
var yo = require('yo-yo')
var modalDialog = require('../ui/modaldialog')
function TxRunner (vmaccounts, opts) { function TxRunner (vmaccounts, opts) {
this.personalMode = opts.personalMode this.personalMode = opts.personalMode
...@@ -50,6 +52,7 @@ TxRunner.prototype.execute = function (args, callback) { ...@@ -50,6 +52,7 @@ TxRunner.prototype.execute = function (args, callback) {
transactionHash: result.transactionHash transactionHash: result.transactionHash
}) })
}) })
askToConfirmTx(tx)
} else { } else {
executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) { executionContext.web3().eth.estimateGas(tx, function (err, gasEstimation) {
if (err) { if (err) {
...@@ -82,6 +85,7 @@ TxRunner.prototype.execute = function (args, callback) { ...@@ -82,6 +85,7 @@ TxRunner.prototype.execute = function (args, callback) {
} }
}) })
} }
askToConfirmTx(tx)
} else { } else {
try { try {
var account = self.vmaccounts[from] var account = self.vmaccounts[from]
...@@ -164,4 +168,27 @@ function run (self, tx, stamp, callback) { ...@@ -164,4 +168,27 @@ function run (self, tx, stamp, callback) {
} }
} }
function askToConfirmTx (tx) {
var title = `Executing transaction on the main network`
var el = yo`
<div>
<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>
<div>from: ${tx.from}</div>
<div>to: ${tx.from}</div>
<div>tx value: ${tx.value}</div>
<div>gas limit: ${tx.gasLimit}</div>
<div>gas price: ${tx.gasEstimation}</div>
<div>data: ${tx.data}</div>
</div>
</div>
`
modalDialog(title, el, {label: ''}, {label: 'Confirm'}) // PROMPT!
}
module.exports = TxRunner 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