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
8cd76ce2
Commit
8cd76ce2
authored
Sep 12, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TxListener to trigger callExecuted
parent
4ef065b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
5 deletions
+33
-5
txListener.js
src/app/execution/txListener.js
+29
-3
run-tab.js
src/app/tabs/run-tab.js
+1
-1
universal-dapp.js
src/universal-dapp.js
+3
-1
No files found.
src/app/execution/txListener.js
View file @
8cd76ce2
...
@@ -20,6 +20,7 @@ class TxListener {
...
@@ -20,6 +20,7 @@ class TxListener {
this
.
event
=
new
EventManager
()
this
.
event
=
new
EventManager
()
this
.
_api
=
opt
.
api
this
.
_api
=
opt
.
api
this
.
_resolvedTransactions
=
{}
this
.
_resolvedTransactions
=
{}
this
.
_resolvedCalls
=
{}
this
.
_resolvedContracts
=
{}
this
.
_resolvedContracts
=
{}
this
.
_isListening
=
false
this
.
_isListening
=
false
this
.
_listenOnNetwork
=
false
this
.
_listenOnNetwork
=
false
...
@@ -31,7 +32,33 @@ class TxListener {
...
@@ -31,7 +32,33 @@ class TxListener {
this
.
startListening
()
this
.
startListening
()
}
}
})
})
opt
.
event
.
udapp
.
register
(
'transactionExecuted'
,
(
error
,
to
,
data
,
lookupOnly
,
txResult
)
=>
{
opt
.
event
.
udapp
.
register
(
'callExecuted'
,
(
error
,
from
,
to
,
data
,
lookupOnly
,
txResult
)
=>
{
if
(
error
)
return
// we go for that case if
// in VM mode
// in web3 mode && listen remix txs only
if
(
!
this
.
_isListening
)
return
// we don't listen
if
(
this
.
_loopId
&&
executionContext
.
getProvider
()
!==
'vm'
)
return
// we seems to already listen on a "web3" network
var
call
=
{
from
:
from
,
to
:
to
,
input
:
data
,
hash
:
txResult
.
transactionHash
?
txResult
.
transactionHash
:
'call'
+
from
+
to
+
data
,
isCall
:
true
,
output
:
txResult
.
result
,
returnValue
:
executionContext
.
isVM
()
?
txResult
.
result
.
vm
.
return
:
ethJSUtil
.
toBuffer
(
txResult
.
result
),
envMode
:
executionContext
.
getProvider
()
}
this
.
_resolveTx
(
call
,
(
error
,
resolvedData
)
=>
{
if
(
!
error
)
{
this
.
event
.
trigger
(
'newCall'
,
[
call
])
}
})
})
opt
.
event
.
udapp
.
register
(
'transactionExecuted'
,
(
error
,
from
,
to
,
data
,
lookupOnly
,
txResult
)
=>
{
if
(
error
)
return
if
(
error
)
return
if
(
lookupOnly
)
return
if
(
lookupOnly
)
return
// we go for that case if
// we go for that case if
...
@@ -42,7 +69,7 @@ class TxListener {
...
@@ -42,7 +69,7 @@ class TxListener {
executionContext
.
web3
().
eth
.
getTransaction
(
txResult
.
transactionHash
,
(
error
,
tx
)
=>
{
executionContext
.
web3
().
eth
.
getTransaction
(
txResult
.
transactionHash
,
(
error
,
tx
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
if
(
error
)
return
console
.
log
(
error
)
if
(
txResult
&&
txResult
.
result
&&
txResult
.
result
.
vm
)
tx
.
returnValue
=
txResult
.
result
.
vm
.
return
if
(
txResult
&&
txResult
.
result
&&
txResult
.
result
.
vm
)
tx
.
returnValue
=
txResult
.
result
.
vm
.
return
tx
.
envMode
=
executionContext
.
getProvider
()
this
.
_resolve
([
tx
],
()
=>
{
this
.
_resolve
([
tx
],
()
=>
{
})
})
})
})
...
@@ -174,7 +201,6 @@ class TxListener {
...
@@ -174,7 +201,6 @@ class TxListener {
}
}
_resolveTx
(
tx
,
cb
)
{
_resolveTx
(
tx
,
cb
)
{
console
.
log
(
tx
)
var
contracts
=
this
.
_api
.
contracts
()
var
contracts
=
this
.
_api
.
contracts
()
if
(
!
contracts
)
return
cb
()
if
(
!
contracts
)
return
cb
()
var
contractName
var
contractName
...
...
src/app/tabs/run-tab.js
View file @
8cd76ce2
...
@@ -411,7 +411,7 @@ function settings (appAPI, appEvents) {
...
@@ -411,7 +411,7 @@ function settings (appAPI, appEvents) {
`
`
// EVENTS
// EVENTS
appEvents
.
udapp
.
register
(
'transactionExecuted'
,
(
error
,
to
,
data
,
lookupOnly
,
txResult
)
=>
{
appEvents
.
udapp
.
register
(
'transactionExecuted'
,
(
error
,
from
,
to
,
data
,
lookupOnly
,
txResult
)
=>
{
if
(
error
)
return
if
(
error
)
return
if
(
!
lookupOnly
)
el
.
querySelector
(
'#value'
).
value
=
'0'
if
(
!
lookupOnly
)
el
.
querySelector
(
'#value'
).
value
=
'0'
})
})
...
...
src/universal-dapp.js
View file @
8cd76ce2
...
@@ -468,7 +468,9 @@ UniversalDApp.prototype.runTx = function (args, cb) {
...
@@ -468,7 +468,9 @@ UniversalDApp.prototype.runTx = function (args, cb) {
function
(
callback
)
{
function
(
callback
)
{
self
.
txRunner
.
rawRun
(
tx
,
function
(
error
,
result
)
{
self
.
txRunner
.
rawRun
(
tx
,
function
(
error
,
result
)
{
if
(
!
args
.
useCall
)
{
if
(
!
args
.
useCall
)
{
self
.
event
.
trigger
(
'transactionExecuted'
,
[
error
,
args
.
to
,
args
.
data
,
false
,
result
])
self
.
event
.
trigger
(
'transactionExecuted'
,
[
error
,
args
.
from
,
args
.
to
,
args
.
data
,
false
,
result
])
}
else
{
self
.
event
.
trigger
(
'callExecuted'
,
[
error
,
args
.
from
,
args
.
to
,
args
.
data
,
true
,
result
])
}
}
if
(
error
)
{
if
(
error
)
{
if
(
typeof
(
error
)
!==
'string'
)
{
if
(
typeof
(
error
)
!==
'string'
)
{
...
...
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