Skip to content
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

Add type support for ethers v5 queryFilter #303

Closed
zemse opened this issue Nov 17, 2020 · 2 comments · Fixed by #321
Closed

Add type support for ethers v5 queryFilter #303

zemse opened this issue Nov 17, 2020 · 2 comments · Fixed by #321

Comments

@zemse
Copy link
Contributor

zemse commented Nov 17, 2020

event Transfer(address sender, address receiver, uint256 value);
const filter = contractInst.filters.Transfer(); // TransferFilter

const logs = await contractInst.queryFilter(filter) // Overloaded for each filter

logs[0].args // before `any`, but after this feature it should be `{sender: string, receiver: string, value: BigNumber}`

I'll give this a shot while doing my next project starting probably end of this month or next month.

@quezak
Copy link
Contributor

quezak commented Nov 17, 2020

Sounds like a good idea. You'll probably have to add a special EventFilter subtype for each event. Or make it a generic type based on the event param types, so then the new function would simply be like queryFilter<PT>(TypedEventFilter<PT>): Promise<Array<TypedEvent<PT>>>. Or another approach is it makes the resulting code easier to use 👍

@Siegrift
Copy link

@zemse Shouldn't this be closed?

@zemse zemse closed this as completed Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants