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
f37b3736
Commit
f37b3736
authored
Jun 12, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use tx and receipt when resolving / listening
parent
e6268175
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
txListener.js
remix-lib/src/execution/txListener.js
+15
-18
No files found.
remix-lib/src/execution/txListener.js
View file @
f37b3736
...
@@ -52,7 +52,7 @@ class TxListener {
...
@@ -52,7 +52,7 @@ class TxListener {
}
}
addExecutionCosts
(
txResult
,
call
)
addExecutionCosts
(
txResult
,
call
)
this
.
_resolveTx
(
call
,
(
error
,
resolvedData
)
=>
{
this
.
_resolveTx
(
call
,
call
,
(
error
,
resolvedData
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
this
.
event
.
trigger
(
'newCall'
,
[
call
])
this
.
event
.
trigger
(
'newCall'
,
[
call
])
}
}
...
@@ -200,14 +200,14 @@ class TxListener {
...
@@ -200,14 +200,14 @@ class TxListener {
_resolve
(
transactions
,
callback
)
{
_resolve
(
transactions
,
callback
)
{
async
.
each
(
transactions
,
(
tx
,
cb
)
=>
{
async
.
each
(
transactions
,
(
tx
,
cb
)
=>
{
executionContext
.
web3
().
eth
.
getTransactionReceipt
(
tx
.
hash
,
(
error
,
receipt
)
=>
{
this
.
_api
.
resolveReceipt
(
tx
,
(
error
,
receipt
)
=>
{
if
(
error
)
return
cb
(
error
)
if
(
error
)
return
cb
(
error
)
this
.
_resolveTx
(
receipt
,
(
error
,
resolvedData
)
=>
{
this
.
_resolveTx
(
tx
,
receipt
,
(
error
,
resolvedData
)
=>
{
if
(
error
)
cb
(
error
)
if
(
error
)
cb
(
error
)
if
(
resolvedData
)
{
if
(
resolvedData
)
{
this
.
event
.
trigger
(
'txResolved'
,
[
receipt
,
resolvedData
])
this
.
event
.
trigger
(
'txResolved'
,
[
tx
,
receipt
,
resolvedData
])
}
}
this
.
event
.
trigger
(
'newTransaction'
,
[
receipt
])
this
.
event
.
trigger
(
'newTransaction'
,
[
tx
,
receipt
])
cb
()
cb
()
})
})
})
})
...
@@ -216,10 +216,11 @@ class TxListener {
...
@@ -216,10 +216,11 @@ class TxListener {
})
})
}
}
_resolveTx
(
tx
,
cb
)
{
_resolveTx
(
tx
,
receipt
,
cb
)
{
var
contracts
=
this
.
_api
.
contracts
()
var
contracts
=
this
.
_api
.
contracts
()
if
(
!
contracts
)
return
cb
()
if
(
!
contracts
)
return
cb
()
var
contractName
var
contractName
var
fun
if
(
!
tx
.
to
||
tx
.
to
===
'0x0'
)
{
// testrpc returns 0x0 in that case
if
(
!
tx
.
to
||
tx
.
to
===
'0x0'
)
{
// testrpc returns 0x0 in that case
// contract creation / resolve using the creation bytes code
// contract creation / resolve using the creation bytes code
// if web3: we have to call getTransactionReceipt to get the created address
// if web3: we have to call getTransactionReceipt to get the created address
...
@@ -227,17 +228,13 @@ class TxListener {
...
@@ -227,17 +228,13 @@ class TxListener {
var
code
=
tx
.
input
var
code
=
tx
.
input
contractName
=
this
.
_tryResolveContract
(
code
,
contracts
,
true
)
contractName
=
this
.
_tryResolveContract
(
code
,
contracts
,
true
)
if
(
contractName
)
{
if
(
contractName
)
{
this
.
_api
.
resolveReceipt
(
tx
,
(
error
,
receipt
)
=>
{
var
address
=
receipt
.
contractAddress
if
(
error
)
return
cb
(
error
)
this
.
_resolvedContracts
[
address
]
=
contractName
var
address
=
receipt
.
contractAddress
fun
=
this
.
_resolveFunction
(
contractName
,
contracts
,
tx
,
true
)
this
.
_resolvedContracts
[
address
]
=
contractName
if
(
this
.
_resolvedTransactions
[
tx
.
hash
])
{
var
fun
=
this
.
_resolveFunction
(
contractName
,
contracts
,
tx
,
true
)
this
.
_resolvedTransactions
[
tx
.
hash
].
contractAddress
=
address
if
(
this
.
_resolvedTransactions
[
tx
.
hash
])
{
}
this
.
_resolvedTransactions
[
tx
.
hash
].
contractAddress
=
address
return
cb
(
null
,
{
to
:
null
,
contractName
:
contractName
,
function
:
fun
,
creationAddress
:
address
})
}
return
cb
(
null
,
{
to
:
null
,
contractName
:
contractName
,
function
:
fun
,
creationAddress
:
address
})
})
return
}
}
return
cb
()
return
cb
()
}
else
{
}
else
{
...
@@ -259,7 +256,7 @@ class TxListener {
...
@@ -259,7 +256,7 @@ class TxListener {
return
return
}
}
if
(
contractName
)
{
if
(
contractName
)
{
var
fun
=
this
.
_resolveFunction
(
contractName
,
contracts
,
tx
,
false
)
fun
=
this
.
_resolveFunction
(
contractName
,
contracts
,
tx
,
false
)
return
cb
(
null
,
{
to
:
tx
.
to
,
contractName
:
contractName
,
function
:
fun
})
return
cb
(
null
,
{
to
:
tx
.
to
,
contractName
:
contractName
,
function
:
fun
})
}
}
return
cb
()
return
cb
()
...
...
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