aergoio / aergo

aergo blockchain kernel
http://docs.aergo.io
MIT License
214 stars 45 forks source link

Subscribe to events without contract #295

Open kroggen opened 1 year ago

kroggen commented 1 year ago

Currently it is only possible to subscribe to events informing a single contract address for filter

But in some cases we are interested in many contracts, or not any specifically, but in some type of event

For these cases we could allow the subscription to events using only the event name as the filter

This allows the subscription to a type of event, regardless of which contract will emit it

This can be applied to ListEvents and ListEventStream

kroggen commented 1 year ago

This differs from #150 which would return all events from the blocks and thus probably use too much resources

kroggen commented 1 year ago

It will be common to have apps needing to listen to many different contracts, or to many different events. So the engine could allow both:

It is better to allow these external apps to subscribe to many different sources on the same connection than to have them create many different separate connections. The later would use more resources.

The limits can be: