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

When using"Contract.decode_function_input" , TypeError: 'NoneType' object is not iterable #3426

Closed
HasaTan opened this issue Jul 1, 2024 · 0 comments

Comments

@HasaTan
Copy link

HasaTan commented Jul 1, 2024

What happened?

I am learning by following https://web3py.readthedocs.io/en/v6.20.0/web3.contract.html#web3.contract.Contract.decode_function_input

my code is as follows:

from hexbytes import HexBytes
from web3 import Web3,contract,EthereumTesterProvider
from web3.contract import Contract

    w3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/xxxxxxx'))
    transaction = w3.eth.get_transaction('0xf32e5a06a8e2929a6b0ae0d5caa423e51340e5fefa1a03def91979f01d063ed5')
    TX_input=transaction.input
    aa=contract.Contract.decode_function_input(TX_input)
    print(aa)

but it may be something wrong:

Traceback (most recent call last):
  File "", line 35, in <module>
    main()
  File "", line 24, in main
    aa=contract.Contract.decode_function_input(TX_input)
  File "", line 31, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "", line 825, in decode_function_input
    func = self.get_function_by_selector(data[:4])
  File "", line 31, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "", line 814, in get_function_by_selector
    fns = self.find_functions_by_identifier(
  File "", line 31, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "", line 546, in find_functions_by_identifier
    find_functions_by_identifier(
  File "", line 245, in find_functions_by_identifier
    fns_abi = filter_by_type("function", contract_abi)
  File "", line 103, in filter_by_type
    return [abi for abi in contract_abi if abi["type"] == _type]
TypeError: 'NoneType' object is not iterable

Code that produced the error

No response

Full error output

No response

Fill this section in if you know how this could or should be fixed

No response

web3 Version

6.20.0

Python Version

3.9

Operating System

win 11

Output from pip freeze

No response

@HasaTan HasaTan closed this as completed Jul 1, 2024
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

No branches or pull requests

1 participant