Update parsing of event logs to assume up-to-date RPC API spec.

This commit is contained in:
Fang 2018-04-18 00:29:25 +02:00
parent 4ed365a263
commit 7e74cd3bb7
2 changed files with 16 additions and 12 deletions

View File

@ -146,21 +146,23 @@
?> ?=(%s -.j)
(hex-to-num p.j)
::
++ parse-eth-get-filter-changes-res
++ parse-event-logs
(ar:dejs:format parse-event-log)
::
++ parse-event-log
=, dejs:format
|= j=json
=- ((ar -) j)
|= cha=json
^- filter-change
=- ((ot -) cha)
:~ =- [type+(cu - so)]
|= m=@t
?. =(m 'mined') ~
=- `((ot -) cha) ::TODO not sure if elegant or hacky.
|= log=json
^- event-log
=- ((ot -) log)
:~ =- ['logIndex'^(cu - (mu so))]
|= li=(unit @t)
?~ li ~
=- `((ot -) log) ::TODO not sure if elegant or hacky.
:~ 'logIndex'^(cu hex-to-num so)
'transactionIndex'^(cu hex-to-num so)
'blockHash'^(cu hex-to-num so)
'transactionHash'^(cu hex-to-num so)
'blockNumber'^(cu hex-to-num so)
'blockHash'^(cu hex-to-num so)
==
::
address+(cu hex-to-num so)

View File

@ -48,12 +48,14 @@
==
::
++ filter-change
++ event-log
$: :: null for pending logs
$= mined %- unit
$: log-index=@ud
transaction-index=@ud
block-hash=@ux
transaction-hash=@ux
block-number=@ud
block-hash=@ux
==
::
address=@ux