You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using an async node and set the gas price strategy to the default fast_gas_price_strategy. This yields a TypeError: 'coroutine' object is not subscriptable.
File "[....]/Executor.py", line 92, in [....]
tx = await my_contract.functions.my_function().build_transaction(parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[....]/.venv/lib/python3.12/site-packages/web3/contract/async_contract.py", line 360, in build_transaction
return await async_build_transaction_for_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[....]/.venv/lib/python3.12/site-packages/web3/contract/utils.py", line 444, in async_build_transaction_for_function
return await async_fill_transaction_defaults(async_w3, prepared_transaction)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[....]/.venv/lib/python3.12/site-packages/web3/_utils/async_transactions.py", line 115, in async_fill_transaction_defaults
strategy_based_gas_price = async_w3.eth.generate_gas_price(transaction)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[....]/.venv/lib/python3.12/site-packages/web3/eth/base_eth.py", line 88, in generate_gas_price
return self._gas_price_strategy(self.w3, transaction_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "[....]/.venv/lib/python3.12/site-packages/web3/gas_strategies/time_based.py", line 220, in time_based_gas_price_strategy
if w3.eth.get_block("latest")["number"] == 0:
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
TypeError: 'coroutine' object is not subscriptable
Fill this section in if you know how this could or should be fixed
Change time_based_gas_price_strategy to check if w3 node is async or not.
web3 Version
6.20.0
Python Version
3.12.3
Operating System
ubuntu 24
Output from pip freeze
No response
The text was updated successfully, but these errors were encountered:
Seeing as a lot of layer 2 transactions still rely on gasPrice, I think this is a simple enough task still relevant to Ethereum. It's hard to measure how much use these older middleware are getting, and Ethereum moving to EIP-1559 fees sort of put the async-ing of these to the side. I'd review a PR for this if it was submitted though, otherwise I think it'll have to wait a bit until we are freed up with other tasks. Thanks for submitting.
What happened?
I'm using an async node and set the gas price strategy to the default
fast_gas_price_strategy
. This yields aTypeError: 'coroutine' object is not subscriptable
.Code that produced the error
Full error output
Fill this section in if you know how this could or should be fixed
Change
time_based_gas_price_strategy
to check if w3 node is async or not.web3 Version
6.20.0
Python Version
3.12.3
Operating System
ubuntu 24
Output from
pip freeze
No response
The text was updated successfully, but these errors were encountered: