Description
Hi! Sorry for not following the issue template as it's more of a suggestion.
I am using async web3py and would love to see more things being ported. But from checking some pull requests I see that quite a lot of code gets copied over and over, so there are basically two copies of the same code (for example in the ENS PR). The code can get out of sync quickly. I have an idea on how to solve this, as I maintain my own python library with both sync/async variants myself. Of course it's way simpler, but still.
You could try to create an async-only version, and wrap all the public methods via a special decorator. This is how for example pyrogram library does this. I have ported and improved their implementation here: https://github.com/bitcartcc/universalasync
Ideally, if you have ready async implementations everywhere, you would just @wrap
needed classes and it should all work. In practice I am not yet sure how would it work in a project of that scale.
How it works? Basically it detects the current environment, if it's running from an async function it returns a coroutine directly, otherwise it does it's best to execute a coroutine in a sync environment (there are a few cases: when event loop isn't started, when it's in a different thread, etc). From my automated tests it should handle all cases.
I know it's probably too late to suggest, but worth trying (:
What I miss in eth async implementation is some middlewares ported, especially the retry, filter and cache middlewares