-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
From a documentation and use perspective, is the API (where 25 indicates the limit) -
or
|
Hmm, currently it's the first option (additional parameter), I guess the latter one is much better though. |
Fixed the API, eth_getLogs({ from: 'earliest', limit: 10 }) // returns 10 last logs
let filterId = eth_newFilter({
from: 'earliest',
to: 'latest',
limit: 25
})
eth_getFilterChanges(filterId) // returns changes, but at most 25 last logs
eth_getFilterLogs(filterId) // returns logs matching filter, but at most 25 last logs |
@@ -59,7 +65,8 @@ impl Clone for Filter { | |||
from_block: self.from_block.clone(), | |||
to_block: self.to_block.clone(), | |||
address: self.address.clone(), | |||
topics: topics[..].to_vec() | |||
topics: topics[..].to_vec(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
side note: seems that topics only has four members -- why bother allocating a Vec at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it can contain up to 4 entries - but that's true, we could substitute this with array of 4 Option
. I will prepare a separate PR.
Similar to #2073
This time it allows to specify optional limit parameter to
newFilter
and then subsequent calls togetFilterLogs
orgetFilterChanges
will return limited number of logs.