Skip to content

Commit

Permalink
feat: support web3.py dependencies (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Dec 5, 2024
1 parent b148078 commit 082dd69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions ape_alchemy/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 082dd69

Please sign in to comment.