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
db51a55f
Commit
db51a55f
authored
Mar 13, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract modal dialog from txRunner
parent
84d81001
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
txRunner.js
src/app/execution/txRunner.js
+16
-15
universal-dapp.js
src/universal-dapp.js
+3
-0
No files found.
src/app/execution/txRunner.js
View file @
db51a55f
...
...
@@ -4,7 +4,6 @@ var EthJSBlock = require('ethereumjs-block')
var
ethJSUtil
=
require
(
'ethereumjs-util'
)
var
BN
=
ethJSUtil
.
BN
var
executionContext
=
require
(
'../../execution-context'
)
var
modal
=
require
(
'../ui/modal-dialog-custom'
)
function
TxRunner
(
vmaccounts
,
api
)
{
this
.
_api
=
api
...
...
@@ -19,25 +18,27 @@ function TxRunner (vmaccounts, api) {
this
.
queusTxs
=
[]
}
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
confirmationCb
,
gasEstimationForceSend
,
cb
)
{
run
(
this
,
args
,
Date
.
now
(),
confirmationCb
,
gasEstimationForceSend
,
cb
)
TxRunner
.
prototype
.
rawRun
=
function
(
args
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
cb
)
{
run
(
this
,
args
,
Date
.
now
(),
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
cb
)
}
function
executeTx
(
tx
,
gasPrice
,
api
,
callback
)
{
function
executeTx
(
tx
,
gasPrice
,
api
,
promptCb
,
callback
)
{
if
(
gasPrice
)
tx
.
gasPrice
=
executionContext
.
web3
().
toHex
(
gasPrice
)
if
(
api
.
personalMode
())
{
modal
.
promptPassphrase
(
null
,
'Personal mode is enabled. Please provide passphrase of account '
+
tx
.
from
,
''
,
(
value
)
=>
{
sendTransaction
(
executionContext
.
web3
().
personal
.
sendTransaction
,
tx
,
value
,
callback
)
},
()
=>
{
return
callback
(
'Canceled by user.'
)
})
promptCb
(
(
value
)
=>
{
sendTransaction
(
executionContext
.
web3
().
personal
.
sendTransaction
,
tx
,
value
,
callback
)
},
()
=>
{
return
callback
(
'Canceled by user.'
)
}
)
}
else
{
sendTransaction
(
executionContext
.
web3
().
eth
.
sendTransaction
,
tx
,
null
,
callback
)
}
}
TxRunner
.
prototype
.
execute
=
function
(
args
,
confirmationCb
,
gasEstimationForceSend
,
callback
)
{
TxRunner
.
prototype
.
execute
=
function
(
args
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
{
var
self
=
this
var
data
=
args
.
data
...
...
@@ -46,7 +47,7 @@ TxRunner.prototype.execute = function (args, confirmationCb, gasEstimationForceS
}
if
(
!
executionContext
.
isVM
())
{
self
.
runInNode
(
args
.
from
,
args
.
to
,
data
,
args
.
value
,
args
.
gasLimit
,
args
.
useCall
,
confirmationCb
,
gasEstimationForceSend
,
callback
)
self
.
runInNode
(
args
.
from
,
args
.
to
,
data
,
args
.
value
,
args
.
gasLimit
,
args
.
useCall
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
}
else
{
try
{
self
.
runInVm
(
args
.
from
,
args
.
to
,
data
,
args
.
value
,
args
.
gasLimit
,
args
.
useCall
,
callback
)
...
...
@@ -104,7 +105,7 @@ TxRunner.prototype.runInVm = function (from, to, data, value, gasLimit, useCall,
})
}
TxRunner
.
prototype
.
runInNode
=
function
(
from
,
to
,
data
,
value
,
gasLimit
,
useCall
,
confirmCb
,
gasEstimationForceSend
,
callback
)
{
TxRunner
.
prototype
.
runInNode
=
function
(
from
,
to
,
data
,
value
,
gasLimit
,
useCall
,
confirmCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
{
const
self
=
this
var
tx
=
{
from
:
from
,
to
:
to
,
data
:
data
,
value
:
value
}
...
...
@@ -186,12 +187,12 @@ function sendTransaction (sendTx, tx, pass, callback) {
}
}
function
run
(
self
,
tx
,
stamp
,
confirmationCb
,
gasEstimationForceSend
,
callback
)
{
function
run
(
self
,
tx
,
stamp
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
{
if
(
!
self
.
runAsync
&&
Object
.
keys
(
self
.
pendingTxs
).
length
)
{
self
.
queusTxs
.
push
({
tx
,
stamp
,
callback
})
}
else
{
self
.
pendingTxs
[
stamp
]
=
tx
self
.
execute
(
tx
,
confirmationCb
,
gasEstimationForceSend
,
(
error
,
result
)
=>
{
self
.
execute
(
tx
,
confirmationCb
,
gasEstimationForceSend
,
promptCb
,
(
error
,
result
)
=>
{
delete
self
.
pendingTxs
[
stamp
]
callback
(
error
,
result
)
if
(
self
.
queusTxs
.
length
)
{
...
...
src/universal-dapp.js
View file @
db51a55f
...
...
@@ -330,6 +330,9 @@ UniversalDApp.prototype.runTx = function (args, cb) {
continueTxExecution
()
}
},
function
(
okCb
,
cancelCb
)
{
modalCustom
.
promptPassphrase
(
null
,
'Personal mode is enabled. Please provide passphrase of account '
+
tx
.
from
,
''
,
okCb
,
cancelCb
)
},
function
(
error
,
result
)
{
let
eventName
=
(
tx
.
useCall
?
'callExecuted'
:
'transactionExecuted'
)
self
.
event
.
trigger
(
eventName
,
[
error
,
tx
.
from
,
tx
.
to
,
tx
.
data
,
tx
.
useCall
,
result
,
timestamp
,
payLoad
])
...
...
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