Open carver opened 6 years ago
We already have an API that works like this:
my_contract.events.MyEvent().createFilter(...)
While I think the my_contract.parse_unknown_event
would probably be a good addition, it looks a bit cumbersome compared to the above API. Wouldn't something like this be better:
my_contract.create_event_filter(...)
Another possibility would be to have a helper function that could take N number of events as arguments. Maybe something like this:
create_event_filter(
events=[my_contract.events.MyEvent(), my_contract.events.AnotherEvent()],
fromBlock=123,
...
)
or
compose_events(
my_contract.events.MyEvent(),
my_contract.events.AnotherEvent()
).createFilter(...)
Just my thoughts :) .
I think I think the idea of working with Event
objects most.
event_a = c.events.EventA()
event_b = c.events.EventB()
event_ab = event_a | event_b
event_ab.create_filter()
Easy to accomplish by overloading the binary |
operator on our event object.
What was wrong?
There isn't a great solution for this right now.
How can it be fixed?
Maybe something like:
This is just a first stab at an API. I thought about putting it under
my_contract.events.parse_unknown()
, but then it would conflict with an event namedparse_unknown
.