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

'AsyncEth' object has no attribute 'filter' #2573

Closed
magniff opened this issue Jul 14, 2022 · 3 comments · Fixed by #2744
Closed

'AsyncEth' object has no attribute 'filter' #2573

magniff opened this issue Jul 14, 2022 · 3 comments · Fixed by #2744

Comments

@magniff
Copy link

magniff commented Jul 14, 2022

  • Version: 6.0.0b4
  • Python: 3.10
  • OS: linux
aiohttp==3.7.4.post0
async-timeout==3.0.1
attrs==21.2.0
autopep8==1.6.0
base58==2.1.0
bitarray==1.2.2
certifi==2021.10.8
chardet==4.0.0
charset-normalizer==2.0.7
cytoolz==0.11.0
eth-abi==3.0.0
eth-account==0.6.1
eth-hash==0.3.2
eth-keyfile==0.6.0
eth-keys==0.4.0
eth-rlp==0.3.0
eth-typing==3.1.0
eth-utils==2.0.0
hexbytes==0.2.2
idna==3.3
importlib-resources==5.8.0
iniconfig==1.1.1
ipfshttpclient==0.8.0a2
jsonschema==4.7.2
lru-dict==1.1.7
multiaddr==0.0.9
multidict==5.2.0
netaddr==0.8.0
packaging==21.2
parsimonious==0.8.1
pluggy==1.0.0
protobuf==3.19.0
psutil==5.9.0
py==1.10.0
pycodestyle==2.8.0
pycryptodome==3.11.0
pyparsing==2.4.7
pyrsistent==0.18.0
pytest==6.2.5
pytest-asyncio==0.18.3
requests==2.26.0
rlp==2.0.1
six==1.16.0
toml==0.10.2
toolz==0.11.1
typing-extensions==3.10.0.2
urllib3==1.26.7
varint==1.0.2
web3==6.0.0b4
websockets==10.3
yarl==1.7.0
zipp==3.8.1

What was wrong?

It looks like AsyncEth module is incapable of log filtration, while Eth counterpart is. Here's the code, which fails with

>       async for event in game_created_builder.deploy(w3).get_all_entries():

tests/test_check.py:33: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <web3._utils.events.EventFilterBuilder object at 0x7f9080c8aa70>, w3 = <web3.main.Web3 object at 0x7f9080c8a140>

    def deploy(self, w3: "Web3") -> "LogFilter":
        if not isinstance(w3, web3.Web3):
            raise ValueError(f"Invalid web3 argument: got: {w3!r}")
    
        for arg in AttributeDict.values(self.args):
            arg._immutable = True
        self._immutable = True
    
>       log_filter = cast("LogFilter", w3.eth.filter(self.filter_params))
E       AttributeError: 'AsyncEth' object has no attribute 'filter'

/usr/local/lib/python3.10/site-packages/web3/_utils/events.py:419: AttributeError
@kclowes
Copy link
Collaborator

kclowes commented Jul 14, 2022

Async filters have not yet been implemented, so this behavior is expected for now. Here is the list of supported methods/middlewares: https://web3py.readthedocs.io/en/stable/providers.html#supported-methods. It's high on our list, but feel free to open a PR if you need it faster than we can get to it :)

@ak8g18
Copy link

ak8g18 commented Feb 27, 2023

hi, do you guys plan to asyncify "contracts" at any point. I'm trying to do so but having much trouble myself

@kclowes
Copy link
Collaborator

kclowes commented Feb 27, 2023

@ak8g18 Contracts are async-ified as of v6-beta.3. Filters have been async-ified too as of v6-beta.9.

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