From dcbe6a5204a6962a3af9ea90db5e61caface12fd Mon Sep 17 00:00:00 2001 From: kclowes Date: Thu, 8 Sep 2022 13:29:12 -0600 Subject: [PATCH 1/2] Add Sepolia testnet --- ethpm/constants.py | 1 + newsfragments/2639.feature.rst | 1 + tests/ethpm/_utils/test_chain_utils.py | 1 + web3/auto/infura/endpoints.py | 1 + web3/auto/infura/sepolia.py | 15 +++++++++++++++ 5 files changed, 19 insertions(+) create mode 100644 newsfragments/2639.feature.rst create mode 100644 web3/auto/infura/sepolia.py diff --git a/ethpm/constants.py b/ethpm/constants.py index c895c4a591..c6818e5210 100644 --- a/ethpm/constants.py +++ b/ethpm/constants.py @@ -15,4 +15,5 @@ 3: "ropsten", 4: "rinkeby", 5: "goerli", + 11155111: "sepolia", } diff --git a/newsfragments/2639.feature.rst b/newsfragments/2639.feature.rst new file mode 100644 index 0000000000..f839021314 --- /dev/null +++ b/newsfragments/2639.feature.rst @@ -0,0 +1 @@ +Add Sepolia auto provider diff --git a/tests/ethpm/_utils/test_chain_utils.py b/tests/ethpm/_utils/test_chain_utils.py index 92c2b00e52..096d8a51a1 100644 --- a/tests/ethpm/_utils/test_chain_utils.py +++ b/tests/ethpm/_utils/test_chain_utils.py @@ -49,6 +49,7 @@ def test_parse_BIP122_uri(value, expected_resource_type): (3, True), (4, True), (5, True), + (11155111, True), (2, False), ("1", False), ({}, False), diff --git a/web3/auto/infura/endpoints.py b/web3/auto/infura/endpoints.py index 55258f9a57..fa7ecb5df8 100644 --- a/web3/auto/infura/endpoints.py +++ b/web3/auto/infura/endpoints.py @@ -20,6 +20,7 @@ INFURA_ROPSTEN_DOMAIN = "ropsten.infura.io" INFURA_GOERLI_DOMAIN = "goerli.infura.io" INFURA_RINKEBY_DOMAIN = "rinkeby.infura.io" +INFURA_SEPOLIA_DOMAIN = "sepolia.infura.io" WEBSOCKET_SCHEME = "wss" HTTP_SCHEME = "https" diff --git a/web3/auto/infura/sepolia.py b/web3/auto/infura/sepolia.py new file mode 100644 index 0000000000..d7f128800c --- /dev/null +++ b/web3/auto/infura/sepolia.py @@ -0,0 +1,15 @@ +from web3 import Web3 +from web3.providers.auto import ( + load_provider_from_uri, +) + +from .endpoints import ( + INFURA_SEPOLIA_DOMAIN, + build_http_headers, + build_infura_url, +) + +_headers = build_http_headers() +_infura_url = build_infura_url(INFURA_SEPOLIA_DOMAIN) + +w3 = Web3(load_provider_from_uri(_infura_url, _headers)) From 5957671fe20a8fefde134cfab19d04be8de46773 Mon Sep 17 00:00:00 2001 From: kclowes Date: Wed, 14 Sep 2022 11:12:14 -0600 Subject: [PATCH 2/2] Add Sepolia to ethpm validation error message --- ethpm/validation/uri.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethpm/validation/uri.py b/ethpm/validation/uri.py index f162e81d1c..89f13ecc7d 100644 --- a/ethpm/validation/uri.py +++ b/ethpm/validation/uri.py @@ -103,7 +103,7 @@ def validate_registry_uri_authority(auth: str) -> None: if not is_supported_chain_id(to_int(text=chain_id)): raise EthPMValidationError( f"Chain ID: {chain_id} is not supported. Supported chain ids include: " - "1 (mainnet), 3 (ropsten), 4 (rinkeby), and 5 (goerli)" + "1 (mainnet), 3 (ropsten), 4 (rinkeby), 5 (goerli), and 11155111 (sepolia)." "Please try again with a valid registry URI." )