This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
Expose LogMeta
type and add more fields, and expose FilterBlockOption
#294
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The types
LogMeta
andFilterBlockOption
are not public, and I believe they should be. Also, theLogMeta
is rather terse, and could use more metadata.Solution
I've exported the two types and added more fields to
LogsMeta
.However, there's one important consideration on adding more fields. The procedure that maps the type
Log
intoLogMeta
heavily usesexpect
on Option types. This behavior follows what was previously there, just extended to the new fields. If we look at the json-rpc API, it says these fields are onlynull
when the block is pending. In other words, this is at least as safe it was previously, and it is probably safe. One possible alternative is implementingTryFrom
, instead ofFrom
. But maybe this can be done in another PR.Cheers!