From 2b471006661ee21f7df8698a5c17f074ed95f5d7 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 2 May 2024 12:23:58 -0500 Subject: [PATCH] feat: Add Blast mainnet and sepolia --- README.md | 3 ++- ape_infura/__init__.py | 5 ++++- ape_infura/provider.py | 4 ++-- setup.py | 7 ++++--- tests/conftest.py | 8 +++++--- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 062b611..de86164 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ This plugin supports the following ecosystems: - Polygon - Arbitrum - Optimism -- Linea +- Blast +- ~~Linea~~ (awaiting ape-linea update) ## Dependencies diff --git a/ape_infura/__init__.py b/ape_infura/__init__.py index 5db73a8..e5f74fa 100644 --- a/ape_infura/__init__.py +++ b/ape_infura/__init__.py @@ -17,9 +17,12 @@ ], "polygon": [ "mainnet", - "mumbai", "amoy", ], + "blast": [ + "mainnet", + "sepolia", + ], # TODO: Comment out after ape-linea supports 0.7 # "linea": [ # "mainnet", diff --git a/ape_infura/provider.py b/ape_infura/provider.py index c270405..5c0a917 100644 --- a/ape_infura/provider.py +++ b/ape_infura/provider.py @@ -79,12 +79,12 @@ def connect(self): self._web3 = Web3(HTTPProvider(self.uri)) # Any chain that *began* as PoA needs the middleware for pre-merge blocks - ethereum_sepolia = 11155111 optimism = (10, 420) polygon = (137, 80001, 80002) linea = (59144, 59140) + blast = (11155111, 168587773) - if self._web3.eth.chain_id in (ethereum_sepolia, *optimism, *polygon, *linea): + if self._web3.eth.chain_id in (*optimism, *polygon, *linea, *blast): self._web3.middleware_onion.inject(geth_poa_middleware, layer=0) self._web3.eth.set_gas_price_strategy(rpc_gas_price_strategy) diff --git a/setup.py b/setup.py index 8726985..ce9c666 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,10 @@ "pytest-xdist", # Multi-process runner "pytest-cov", # Coverage analyzer plugin "hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer - "ape-arbitrum", - "ape-optimism", - "ape-polygon", + "ape-arbitrum", # For integration testing + "ape-blast", # For integration testing + "ape-optimism", # For integration testing + "ape-polygon", # For integration testing # "ape-linea", # TODO: Comment out after supports 0.7 "websocket-client", # Used for web socket integration testing ], diff --git a/tests/conftest.py b/tests/conftest.py index ca8f003..bdd2149 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,9 +19,11 @@ def networks(): return ape.networks -@pytest.fixture(params=[(name, net) for name, values in NETWORKS.items() for net in values]) +# NOTE: Using a `str` as param for better pytest test-case name generation. +@pytest.fixture(params=[f"{e}:{n}" for e, values in NETWORKS.items() for n in values]) def provider(networks, request): - ecosystem_cls = networks.get_ecosystem(request.param[0]) - network_cls = ecosystem_cls.get_network(request.param[1]) + ecosystem, network = request.param.split(":") + ecosystem_cls = networks.get_ecosystem(ecosystem) + network_cls = ecosystem_cls.get_network(network) with network_cls.use_provider("infura") as provider: yield provider