Skip to content

fix: add missing type #2348

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

Closed
wants to merge 3 commits into from
Closed

Conversation

ChristianCoenen
Copy link

@ChristianCoenen ChristianCoenen commented Feb 17, 2022

What was wrong?

I encountered a typing warning when initializing the eth module with an AsyncEth instance.

How was it fixed?

Adding an additional type to the eth definition of a Web3 instance. Alternatively, one could also create async_eth: AsyncEth, but I think this breaks existing code where web3.eth.xxx is used.

Another alternative would be to use BaseEth. Please let me know if you prefer this approach.

Todo:

Cute Animal Picture

(https://www.pinterest.com/pin/443252788328237881/)

@ChristianCoenen
Copy link
Author

Seeing why the CI fails, I realized that it might actually be necessary to introduce async_eth: AsyncEth, but this would require quite some changes, right? What do you think is the best approach to solve this?

@kclowes
Copy link
Collaborator

kclowes commented Feb 23, 2022

Thanks for the PR. We haven't figured out the best way to handle this yet. We'd like to keep the API the same, so that if you use an AsyncProvider, you still can do a w3.eth.whatever (rather than a w3.async_eth.whatever), but that doesn't jive with mypy. We've been ignoring async types for now, which isn't ideal. The issue is being tracked in #2013 . BaseEth might be the way to type this, but I think we'll have to wait until all of the methods have been ported over. We're open to solutions though if you have ideas!

@ChristianCoenen
Copy link
Author

Thank you very much! I will keep an eye on #2013 and participate in the discussion if I have a good idea :-)

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 this pull request may close these issues.

2 participants