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 nice error message when a sync Web3 instance is used with an async provider and vice versa #3460

Closed
kclowes opened this issue Aug 22, 2024 · 0 comments · Fixed by #3490
Closed
Assignees

Comments

@kclowes
Copy link
Collaborator

kclowes commented Aug 22, 2024

What feature should we add?

When a web3 instance is instantiated with the AsyncWeb3 class and a sync provider a TypeError gets raised:

>>> from web3 import AsyncWeb3, HTTPProvider
>>> w3 = AsyncWeb3(HTTPProvider(...))
>>> await w3.is_connected()
TypeError: object bool can't be used in 'await' expression

When a provider gets passed in, we should check to make sure it's passed to an async web3 instance if it's an async provider or a sync web3 instance if a sync provider gets passed.

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.

2 participants