Skip to content

Commit

Permalink
feat: Add Blast mainnet and sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
sreyemnayr authored and antazoey committed May 2, 2024
1 parent ab3183b commit 2b47100
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ This plugin supports the following ecosystems:
- Polygon
- Arbitrum
- Optimism
- Linea
- Blast
- ~~Linea~~ (awaiting ape-linea update)

## Dependencies

Expand Down
5 changes: 4 additions & 1 deletion ape_infura/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
],
"polygon": [
"mainnet",
"mumbai",
"amoy",
],
"blast": [
"mainnet",
"sepolia",
],
# TODO: Comment out after ape-linea supports 0.7
# "linea": [
# "mainnet",
Expand Down
4 changes: 2 additions & 2 deletions ape_infura/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
],
Expand Down
8 changes: 5 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2b47100

Please sign in to comment.