-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement eth_getLogs #830
feat: implement eth_getLogs #830
Conversation
} else if input.type.isArray { | ||
// filtering with tuples or arrays not supported | ||
return [] |
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.
Suggestion: move it up and potentially combine into a guard statement with input.indexed
.
guard input.indexed, !input.type.isArray else { return [] }
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
I figured it out. If we have a event with 3 fields like
event TestEvent(string indexed f1, int[] indexed f2, int32 indexed f3);
When we want to build a filter to query this event with first and third fields, we have to pass nil
to second field, and the topicFilter will be like
[
'0x07c9b1ca6e62a19a2af4d11a151945afc7d47c89c716a74973b49572c1a715f4',
'0xab036729af8b8f9b610af4e11b14fa30c348f40c2c230cce92ef6ef37726fee7',
null,
'0x0000000000000000000000000000000000000000000000000000000000000064'
]
If combine input.indexed
and input.type.isArray
together, we can only build a filter with first one field.
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.
lgtm!
Summary of Changes
implement eth.getLogs to query events from evm,
Consult:
https://github.com/ethers-io/ethers.js/blob/32915634bef5b81c6d9998f4e9ad812ffe721954/src.ts/abi/interface.ts#L1007
fix:
EventFilterParameters.encode()
,Topic
can not encode as a single stringTest Data or Screenshots
By submitting this pull request, you are confirming the following:
develop
branch.