Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
0c7e1844
Commit
0c7e1844
authored
Dec 29, 2017
by
ninabreznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ask To Confirm Transaction - first draft
parent
defb1c8f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
txRunner.js
src/app/execution/txRunner.js
+15
-12
No files found.
src/app/execution/txRunner.js
View file @
0c7e1844
...
@@ -46,14 +46,20 @@ TxRunner.prototype.execute = function (args, callback) {
...
@@ -46,14 +46,20 @@ TxRunner.prototype.execute = function (args, callback) {
}
}
if
(
args
.
useCall
)
{
if
(
args
.
useCall
)
{
tx
.
gas
=
gasLimit
tx
.
gas
=
gasLimit
modalDialog
(
'Confirm transaction'
,
remixdDialog
(
tx
),
{
label
:
'Confirm'
,
fn
:
()
=>
{
executionContext
.
web3
().
eth
.
call
(
tx
,
function
(
error
,
result
)
{
executionContext
.
web3
().
eth
.
call
(
tx
,
function
(
error
,
result
)
{
callback
(
error
,
{
callback
(
error
,
{
result
:
result
,
result
:
result
,
transactionHash
:
result
.
transactionHash
transactionHash
:
result
.
transactionHash
})
})
})
})
askToConfirmTx
(
tx
)
}}
)
}
else
{
}
else
{
modalDialog
(
'Confirm transaction'
,
remixdDialog
(
tx
),
{
label
:
'Confirm'
,
fn
:
()
=>
{
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
)
...
@@ -84,8 +90,8 @@ TxRunner.prototype.execute = function (args, callback) {
...
@@ -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. `
)
return
callback
(
`Send transaction failed:
${
e
.
message
}
. if you use an injected provider, please check it is properly unlocked. `
)
}
}
})
})
}})
}
}
askToConfirmTx
(
tx
)
}
else
{
}
else
{
try
{
try
{
var
account
=
self
.
vmaccounts
[
from
]
var
account
=
self
.
vmaccounts
[
from
]
...
@@ -168,16 +174,11 @@ function run (self, tx, stamp, callback) {
...
@@ -168,16 +174,11 @@ function run (self, tx, stamp, callback) {
}
}
}
}
function
askToConfirmTx
(
tx
)
{
var
title
=
`Executing transaction on the main network`
function
remixdDialog
(
tx
)
{
var
el
=
yo
`
return
yo
`
<div>
<div>
<div>
You are connected to the main network, which means your transaction will
<div>You are trying to execute transaction on the main network. Please, click confirm to continue!</div>
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>
<div>from:
${
tx
.
from
}
</div>
<div>from:
${
tx
.
from
}
</div>
<div>to:
${
tx
.
from
}
</div>
<div>to:
${
tx
.
from
}
</div>
...
@@ -188,7 +189,9 @@ var title = `Executing transaction on the main network`
...
@@ -188,7 +189,9 @@ var title = `Executing transaction on the main network`
</div>
</div>
</div>
</div>
`
`
modalDialog
(
title
,
el
,
{
label
:
''
},
{
label
:
'Confirm'
})
// PROMPT!
}
}
module
.
exports
=
TxRunner
module
.
exports
=
TxRunner
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment