diff --git a/ape_alchemy/provider.py b/ape_alchemy/provider.py index be2e1ad..a70d1c3 100644 --- a/ape_alchemy/provider.py +++ b/ape_alchemy/provider.py @@ -13,8 +13,12 @@ from web3.exceptions import ContractLogicError as Web3ContractLogicError from web3.exceptions import ExtraDataLengthError from web3.gas_strategies.rpc import rpc_gas_price_strategy -from web3.middleware import geth_poa_middleware -from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware + +try: + from web3.middleware import ExtraDataToPOAMiddleware # type: ignore +except ImportError: + from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware # type: ignore + from web3.middleware.validation import MAX_EXTRADATA_LENGTH from web3.types import RPCEndpoint @@ -174,7 +178,7 @@ def connect(self): polygon_amoy = 80002 if self._web3.eth.chain_id in (base, optimism, polygon, polygon_amoy): - self._web3.middleware_onion.inject(geth_poa_middleware, layer=0) + self._web3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0) is_poa = True self._web3.eth.set_gas_price_strategy(rpc_gas_price_strategy) diff --git a/setup.py b/setup.py index eadc0e4..396537c 100644 --- a/setup.py +++ b/setup.py @@ -75,12 +75,12 @@ include_package_data=True, install_requires=[ "eth-ape>=0.8.21,<0.9", - "eth-pydantic-types", # Use same version as eth-ape - "ethpm-types", # Use same version as eth-ape - "evm-trace", # Use same version as eth-ape + "eth-pydantic-types>=0.1.3,<0.2", + "ethpm-types>=0.6.19,<0.7", + "evm-trace>=0.2.3,<0.3", + "web3>=6.20.1,<8", + "requests>=2.28.1,<3", "evmchains>=0.1.3,<0.2", # Dependent on networks (not imports) - "web3", # Use same version as eth-ape - "requests", ], python_requires=">=3.9,<4", extras_require=extras_require,