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

feat: support web3.py dependencies #89

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions ape_alchemy/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,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 @@ -134,7 +138,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
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@
url="https://github.com/ApeWorX/ape-alchemy",
include_package_data=True,
install_requires=[
"eth-ape>=0.8.1,<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
"web3", # Use same version as eth-ape
"requests",
"eth-ape>=0.8.21,<0.9",
"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",
antazoey marked this conversation as resolved.
Show resolved Hide resolved
"evmchains>=0.1.3,<0.2", # Dependent on networks (not imports)
],
python_requires=">=3.9,<4",
extras_require=extras_require,
Expand Down
Loading