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
20e3ca65
Commit
20e3ca65
authored
Sep 15, 2017
by
yann300
Committed by
GitHub
Sep 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #794 from ethereum/ide
support indexed event
parents
03b29253
735ea0d6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
eventsDecoder.js
src/app/execution/eventsDecoder.js
+31
-8
txLogger.js
src/app/execution/txLogger.js
+6
-2
No files found.
src/app/execution/eventsDecoder.js
View file @
20e3ca65
...
...
@@ -50,26 +50,49 @@ class EventsDecoder {
_decodeEvents
(
tx
,
logs
,
contractName
,
compiledContracts
,
cb
)
{
var
eventABI
=
this
.
_eventABI
(
contractName
,
compiledContracts
)
// FIXME: support indexed events
var
events
=
[]
for
(
var
i
in
logs
)
{
// [address, topics, mem]
var
log
=
logs
[
i
]
var
abi
=
eventABI
[
log
.
topics
[
0
].
replace
(
'0x'
,
''
)]
if
(
abi
)
{
var
event
var
decoded
try
{
var
abi
=
eventABI
[
log
.
topics
[
0
].
replace
(
'0x'
,
''
)]
var
decoded
=
new
Array
(
abi
.
inputs
.
length
)
event
=
abi
.
event
var
types
=
abi
.
inputs
.
map
(
function
(
item
)
{
return
item
.
type
var
indexed
=
1
var
nonindexed
=
[]
// decode indexed param
abi
.
inputs
.
map
(
function
(
item
,
index
)
{
if
(
item
.
indexed
)
{
var
encodedData
=
log
.
topics
[
indexed
].
replace
(
'0x'
,
''
)
try
{
decoded
[
index
]
=
ethJSABI
.
rawDecode
([
item
.
type
],
new
Buffer
(
encodedData
,
'hex'
))[
0
]
}
catch
(
e
)
{
decoded
[
index
]
=
encodedData
}
indexed
++
}
else
{
nonindexed
.
push
(
item
.
type
)
}
})
// decode non indexed param
nonindexed
=
ethJSABI
.
rawDecode
(
nonindexed
,
new
Buffer
(
log
.
data
.
replace
(
'0x'
,
''
),
'hex'
))
// ordering
var
j
=
0
abi
.
inputs
.
map
(
function
(
item
,
index
)
{
if
(
!
item
.
indexed
)
{
decoded
[
index
]
=
nonindexed
[
j
]
j
++
}
})
decoded
=
ethJSABI
.
rawDecode
(
types
,
new
Buffer
(
log
.
data
.
replace
(
'0x'
,
''
),
'hex'
))
decoded
=
ethJSABI
.
stringify
(
types
,
decoded
)
}
catch
(
e
)
{
decoded
=
log
.
data
}
events
.
push
({
event
:
event
,
args
:
decoded
})
}
else
{
events
.
push
({
data
:
log
.
data
,
topics
:
log
.
topics
})
}
}
cb
(
null
,
{
decoded
:
events
,
raw
:
logs
})
}
...
...
src/app/execution/txLogger.js
View file @
20e3ca65
...
...
@@ -381,12 +381,16 @@ function createTable (opts) {
table
.
appendChild
(
outputDecoded
)
}
var
stringified
=
' - '
if
(
opts
.
logs
.
decoded
)
{
stringified
=
value
(
opts
.
logs
.
decoded
)
}
var
logs
=
yo
`
<tr class="
${
css
.
tr
}
">
<td class="
${
css
.
td
}
"> logs </td>
<td class="
${
css
.
td
}
">
<i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
JSON
.
stringify
(
opts
.
logs
.
decoded
||
[]
,
null
,
'
\
t'
))
}
} title='Copy Logs to clipboard'></i>
<i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
JSON
.
stringify
(
opts
.
logs
.
raw
||
'0'
))
}
} title='Copy Raw Logs to clipboard'></i>
${
JSON
.
stringify
(
opts
.
logs
.
decoded
||
[]
,
null
,
'
\
t'
)}
</td>
<i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
JSON
.
stringify
(
stringified
,
null
,
'
\
t'
))
}
} title='Copy Logs to clipboard'></i>
<i class="fa fa-clipboard
${
css
.
clipboardCopy
}
" aria-hidden="true" onclick=
${
function
()
{
copy
(
JSON
.
stringify
(
opts
.
logs
.
raw
||
'0'
))
}
} title='Copy Raw Logs to clipboard'></i>
${
JSON
.
stringify
(
stringified
,
null
,
'
\
t'
)}
</td>
</tr class="
${
css
.
tr
}
">
`
if
(
opts
.
logs
)
table
.
appendChild
(
logs
)
...
...
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