evmchains 0.0.8__tar.gz → 0.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {evmchains-0.0.8 → evmchains-0.0.10}/.github/workflows/test.yaml +1 -1
- {evmchains-0.0.8 → evmchains-0.0.10}/PKG-INFO +4 -3
- {evmchains-0.0.8 → evmchains-0.0.10}/README.md +2 -2
- evmchains-0.0.10/evmchains/__init__.py +50 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains/_meta.py +2 -2
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains/chains.py +167 -73
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains.egg-info/PKG-INFO +4 -3
- {evmchains-0.0.8 → evmchains-0.0.10}/pyproject.toml +1 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/scripts/update.py +9 -4
- evmchains-0.0.10/tests/test_func.py +88 -0
- evmchains-0.0.8/evmchains/__init__.py +0 -24
- evmchains-0.0.8/tests/test_func.py +0 -28
- {evmchains-0.0.8 → evmchains-0.0.10}/.github/workflows/release.yaml +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/.gitignore +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/CONTRIBUTING.md +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/LICENSE +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains/py.typed +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains/types.py +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains.egg-info/SOURCES.txt +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains.egg-info/dependency_links.txt +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains.egg-info/requires.txt +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/evmchains.egg-info/top_level.txt +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/setup.cfg +0 -0
- {evmchains-0.0.8 → evmchains-0.0.10}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: evmchains
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.10
|
|
4
4
|
Summary: Packaged metadata on Ethereum Virtual Machine (EVM) chains
|
|
5
5
|
License: Apache License
|
|
6
6
|
Version 2.0, January 2004
|
|
@@ -213,6 +213,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
213
213
|
Classifier: Natural Language :: English
|
|
214
214
|
Classifier: Operating System :: MacOS
|
|
215
215
|
Classifier: Operating System :: POSIX
|
|
216
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
216
217
|
Classifier: Programming Language :: Python :: 3
|
|
217
218
|
Classifier: Programming Language :: Python :: 3.8
|
|
218
219
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -238,13 +239,13 @@ Requires-Dist: types-requests>=2.31.0.20240106; extra == "dev"
|
|
|
238
239
|
|
|
239
240
|
Provides general metadata on EVM-compatible chains organized by Ape-style ecosystem and network.
|
|
240
241
|
|
|
241
|
-
Original
|
|
242
|
+
Original source data: https://github.com/ethereum-lists/chains
|
|
242
243
|
|
|
243
244
|
## Quick Start
|
|
244
245
|
|
|
245
246
|
## Dependencies
|
|
246
247
|
|
|
247
|
-
- [python3](https://www.python.org/downloads) version 3.8 up to 3.
|
|
248
|
+
- [python3](https://www.python.org/downloads) version 3.8 up to 3.12.
|
|
248
249
|
|
|
249
250
|
## Installation
|
|
250
251
|
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Provides general metadata on EVM-compatible chains organized by Ape-style ecosystem and network.
|
|
4
4
|
|
|
5
|
-
Original
|
|
5
|
+
Original source data: https://github.com/ethereum-lists/chains
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
9
9
|
## Dependencies
|
|
10
10
|
|
|
11
|
-
- [python3](https://www.python.org/downloads) version 3.8 up to 3.
|
|
11
|
+
- [python3](https://www.python.org/downloads) version 3.8 up to 3.12.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import random
|
|
3
|
+
import re
|
|
4
|
+
from typing import List
|
|
5
|
+
|
|
6
|
+
from evmchains.chains import PUBLIC_CHAIN_META
|
|
7
|
+
from evmchains.types import Chain
|
|
8
|
+
|
|
9
|
+
ENV_VAR_REGEX = re.compile(r"\$\{([A-Za-z0-9_]+)\}")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_chain_meta(ecosystem: str, network: str) -> Chain:
|
|
13
|
+
"""Return a Chain instance with metadata for an EVM chain"""
|
|
14
|
+
if (
|
|
15
|
+
ecosystem not in PUBLIC_CHAIN_META
|
|
16
|
+
or network not in PUBLIC_CHAIN_META[ecosystem]
|
|
17
|
+
):
|
|
18
|
+
raise KeyError(f"Unknown ecosystem:network: {ecosystem}:{network}")
|
|
19
|
+
|
|
20
|
+
return Chain(**PUBLIC_CHAIN_META[ecosystem][network])
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def get_rpcs(ecosystem: str, network: str) -> List[str]:
|
|
24
|
+
"""Get a list of valid RPC endpoints for an ecosystem:network pair"""
|
|
25
|
+
rpcs = []
|
|
26
|
+
|
|
27
|
+
chain = get_chain_meta(ecosystem, network)
|
|
28
|
+
|
|
29
|
+
for rpc in chain.rpc:
|
|
30
|
+
# Look for env var replacements in the endpoint URL
|
|
31
|
+
match = ENV_VAR_REGEX.search(rpc)
|
|
32
|
+
if match:
|
|
33
|
+
to_replace = match.group(0)
|
|
34
|
+
env_var = match.group(1)
|
|
35
|
+
# Include them only if the env var is available
|
|
36
|
+
if env_var in os.environ:
|
|
37
|
+
rpcs.append(rpc.replace(to_replace, os.environ[env_var]))
|
|
38
|
+
else:
|
|
39
|
+
rpcs.append(rpc)
|
|
40
|
+
|
|
41
|
+
return rpcs
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def get_random_rpc(ecosystem: str, network: str) -> str:
|
|
45
|
+
"""Return a random RPC endpoint for an ecosystem:network pair"""
|
|
46
|
+
rpcs = get_rpcs(ecosystem, network)
|
|
47
|
+
return random.choice(rpcs)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
__all__ = ["PUBLIC_CHAIN_META", "Chain", "get_chain_meta", "get_random_rpc", "get_rpcs"]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by scripts/update.py
|
|
2
|
-
# 2024-
|
|
2
|
+
# 2024-06-14 15:00:06.554669
|
|
3
3
|
# Do not edit this file directly.
|
|
4
4
|
from typing import Any, Dict
|
|
5
5
|
|
|
@@ -253,6 +253,7 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
|
253
253
|
"https://blast.din.dev/rpc",
|
|
254
254
|
"https://blastl2-mainnet.public.blastapi.io",
|
|
255
255
|
"https://blast.blockpi.network/v1/rpc/public",
|
|
256
|
+
"https://blast-rpc.publicnode.com",
|
|
256
257
|
],
|
|
257
258
|
"shortName": "blastmainnet",
|
|
258
259
|
"slip44": None,
|
|
@@ -452,6 +453,49 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
|
452
453
|
"shortName": "gor",
|
|
453
454
|
"slip44": 1,
|
|
454
455
|
},
|
|
456
|
+
"holesky": {
|
|
457
|
+
"chain": "ETH",
|
|
458
|
+
"chainId": 17000,
|
|
459
|
+
"ens": None,
|
|
460
|
+
"explorers": [
|
|
461
|
+
{
|
|
462
|
+
"icon": "ethereum",
|
|
463
|
+
"name": "Holesky Explorer",
|
|
464
|
+
"standard": "EIP3091",
|
|
465
|
+
"url": "https://holesky.beaconcha.in",
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"icon": "ethereum",
|
|
469
|
+
"name": "otterscan-holesky",
|
|
470
|
+
"standard": "EIP3091",
|
|
471
|
+
"url": "https://holesky.otterscan.io",
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"icon": "ethereum",
|
|
475
|
+
"name": "Holesky Etherscan",
|
|
476
|
+
"standard": "EIP3091",
|
|
477
|
+
"url": "https://holesky.etherscan.io",
|
|
478
|
+
},
|
|
479
|
+
],
|
|
480
|
+
"faucets": [
|
|
481
|
+
"https://faucet.holesky.ethpandaops.io",
|
|
482
|
+
"https://holesky-faucet.pk910.de",
|
|
483
|
+
],
|
|
484
|
+
"features": None,
|
|
485
|
+
"icon": "ethereum",
|
|
486
|
+
"infoURL": "https://holesky.ethpandaops.io",
|
|
487
|
+
"name": "Holesky",
|
|
488
|
+
"nativeCurrency": {"decimals": 18, "name": "Testnet ETH", "symbol": "ETH"},
|
|
489
|
+
"networkId": 17000,
|
|
490
|
+
"rpc": [
|
|
491
|
+
"https://rpc.holesky.ethpandaops.io",
|
|
492
|
+
"https://ethereum-holesky-rpc.publicnode.com",
|
|
493
|
+
"https://holesky.drpc.org",
|
|
494
|
+
"https://rpc-holesky.rockx.com",
|
|
495
|
+
],
|
|
496
|
+
"shortName": "holesky",
|
|
497
|
+
"slip44": 1,
|
|
498
|
+
},
|
|
455
499
|
"sepolia": {
|
|
456
500
|
"chain": "ETH",
|
|
457
501
|
"chainId": 11155111,
|
|
@@ -609,6 +653,78 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
|
609
653
|
"slip44": 700,
|
|
610
654
|
},
|
|
611
655
|
},
|
|
656
|
+
"linea": {
|
|
657
|
+
"mainnet": {
|
|
658
|
+
"chain": "ETH",
|
|
659
|
+
"chainId": 59144,
|
|
660
|
+
"ens": None,
|
|
661
|
+
"explorers": [
|
|
662
|
+
{
|
|
663
|
+
"icon": "linea",
|
|
664
|
+
"name": "Etherscan",
|
|
665
|
+
"standard": "EIP3091",
|
|
666
|
+
"url": "https://lineascan.build",
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"icon": "linea",
|
|
670
|
+
"name": "Blockscout",
|
|
671
|
+
"standard": "EIP3091",
|
|
672
|
+
"url": "https://explorer.linea.build",
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"icon": "linea",
|
|
676
|
+
"name": "L2scan",
|
|
677
|
+
"standard": "EIP3091",
|
|
678
|
+
"url": "https://linea.l2scan.co",
|
|
679
|
+
},
|
|
680
|
+
],
|
|
681
|
+
"faucets": [],
|
|
682
|
+
"features": None,
|
|
683
|
+
"icon": "linea",
|
|
684
|
+
"infoURL": "https://linea.build",
|
|
685
|
+
"name": "Linea",
|
|
686
|
+
"nativeCurrency": {"decimals": 18, "name": "Linea Ether", "symbol": "ETH"},
|
|
687
|
+
"networkId": 59144,
|
|
688
|
+
"rpc": [
|
|
689
|
+
"https://rpc.linea.build",
|
|
690
|
+
"https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}",
|
|
691
|
+
],
|
|
692
|
+
"shortName": "linea",
|
|
693
|
+
"slip44": None,
|
|
694
|
+
},
|
|
695
|
+
"sepolia": {
|
|
696
|
+
"chain": "ETH",
|
|
697
|
+
"chainId": 59141,
|
|
698
|
+
"ens": None,
|
|
699
|
+
"explorers": [
|
|
700
|
+
{
|
|
701
|
+
"icon": "linea",
|
|
702
|
+
"name": "Etherscan",
|
|
703
|
+
"standard": "EIP3091",
|
|
704
|
+
"url": "https://sepolia.lineascan.build",
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"icon": "linea",
|
|
708
|
+
"name": "Blockscout",
|
|
709
|
+
"standard": "EIP3091",
|
|
710
|
+
"url": "https://explorer.sepolia.linea.build",
|
|
711
|
+
},
|
|
712
|
+
],
|
|
713
|
+
"faucets": [],
|
|
714
|
+
"features": None,
|
|
715
|
+
"icon": "linea",
|
|
716
|
+
"infoURL": "https://linea.build",
|
|
717
|
+
"name": "Linea Sepolia",
|
|
718
|
+
"nativeCurrency": {"decimals": 18, "name": "Linea Ether", "symbol": "ETH"},
|
|
719
|
+
"networkId": 59141,
|
|
720
|
+
"rpc": [
|
|
721
|
+
"https://rpc.sepolia.linea.build",
|
|
722
|
+
"https://linea-sepolia.infura.io/v3/${INFURA_API_KEY}",
|
|
723
|
+
],
|
|
724
|
+
"shortName": "linea-sepolia",
|
|
725
|
+
"slip44": 1,
|
|
726
|
+
},
|
|
727
|
+
},
|
|
612
728
|
"optimism": {
|
|
613
729
|
"mainnet": {
|
|
614
730
|
"chain": "ETH",
|
|
@@ -869,78 +985,6 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
|
869
985
|
"slip44": 1,
|
|
870
986
|
},
|
|
871
987
|
},
|
|
872
|
-
"linea": {
|
|
873
|
-
"mainnet": {
|
|
874
|
-
"chain": "ETH",
|
|
875
|
-
"chainId": 59144,
|
|
876
|
-
"ens": None,
|
|
877
|
-
"explorers": [
|
|
878
|
-
{
|
|
879
|
-
"icon": "linea",
|
|
880
|
-
"name": "Etherscan",
|
|
881
|
-
"standard": "EIP3091",
|
|
882
|
-
"url": "https://lineascan.build",
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
"icon": "linea",
|
|
886
|
-
"name": "Blockscout",
|
|
887
|
-
"standard": "EIP3091",
|
|
888
|
-
"url": "https://explorer.linea.build",
|
|
889
|
-
},
|
|
890
|
-
{
|
|
891
|
-
"icon": "linea",
|
|
892
|
-
"name": "L2scan",
|
|
893
|
-
"standard": "EIP3091",
|
|
894
|
-
"url": "https://linea.l2scan.co",
|
|
895
|
-
},
|
|
896
|
-
],
|
|
897
|
-
"faucets": [],
|
|
898
|
-
"features": None,
|
|
899
|
-
"icon": "linea",
|
|
900
|
-
"infoURL": "https://linea.build",
|
|
901
|
-
"name": "Linea",
|
|
902
|
-
"nativeCurrency": {"decimals": 18, "name": "Linea Ether", "symbol": "ETH"},
|
|
903
|
-
"networkId": 59144,
|
|
904
|
-
"rpc": [
|
|
905
|
-
"https://rpc.linea.build",
|
|
906
|
-
"https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}",
|
|
907
|
-
],
|
|
908
|
-
"shortName": "linea",
|
|
909
|
-
"slip44": None,
|
|
910
|
-
},
|
|
911
|
-
"sepolia": {
|
|
912
|
-
"chain": "ETH",
|
|
913
|
-
"chainId": 59141,
|
|
914
|
-
"ens": None,
|
|
915
|
-
"explorers": [
|
|
916
|
-
{
|
|
917
|
-
"icon": "linea",
|
|
918
|
-
"name": "Etherscan",
|
|
919
|
-
"standard": "EIP3091",
|
|
920
|
-
"url": "https://sepolia.lineascan.build",
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
"icon": "linea",
|
|
924
|
-
"name": "Blockscout",
|
|
925
|
-
"standard": "EIP3091",
|
|
926
|
-
"url": "https://explorer.sepolia.linea.build",
|
|
927
|
-
},
|
|
928
|
-
],
|
|
929
|
-
"faucets": [],
|
|
930
|
-
"features": None,
|
|
931
|
-
"icon": "linea",
|
|
932
|
-
"infoURL": "https://linea.build",
|
|
933
|
-
"name": "Linea Sepolia",
|
|
934
|
-
"nativeCurrency": {"decimals": 18, "name": "Linea Ether", "symbol": "ETH"},
|
|
935
|
-
"networkId": 59141,
|
|
936
|
-
"rpc": [
|
|
937
|
-
"https://rpc.sepolia.linea.build",
|
|
938
|
-
"https://linea-sepolia.infura.io/v3/${INFURA_API_KEY}",
|
|
939
|
-
],
|
|
940
|
-
"shortName": "linea-sepolia",
|
|
941
|
-
"slip44": 1,
|
|
942
|
-
},
|
|
943
|
-
},
|
|
944
988
|
"rootstock": {
|
|
945
989
|
"mainnet": {
|
|
946
990
|
"chain": "Rootstock",
|
|
@@ -1004,4 +1048,54 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
|
1004
1048
|
"slip44": 1,
|
|
1005
1049
|
},
|
|
1006
1050
|
},
|
|
1051
|
+
"shibarium": {
|
|
1052
|
+
"mainnet": {
|
|
1053
|
+
"chain": "Shibarium",
|
|
1054
|
+
"chainId": 109,
|
|
1055
|
+
"ens": None,
|
|
1056
|
+
"explorers": [
|
|
1057
|
+
{
|
|
1058
|
+
"name": "shibariumscan",
|
|
1059
|
+
"standard": "none",
|
|
1060
|
+
"url": "https://www.shibariumscan.io",
|
|
1061
|
+
}
|
|
1062
|
+
],
|
|
1063
|
+
"faucets": [],
|
|
1064
|
+
"features": None,
|
|
1065
|
+
"icon": "shibarium",
|
|
1066
|
+
"infoURL": "https://shibariumecosystem.com",
|
|
1067
|
+
"name": "Shibarium",
|
|
1068
|
+
"nativeCurrency": {
|
|
1069
|
+
"decimals": 18,
|
|
1070
|
+
"name": "BONE Shibarium",
|
|
1071
|
+
"symbol": "BONE",
|
|
1072
|
+
},
|
|
1073
|
+
"networkId": 109,
|
|
1074
|
+
"rpc": ["https://www.shibrpc.com"],
|
|
1075
|
+
"shortName": "shibariumecosystem",
|
|
1076
|
+
"slip44": None,
|
|
1077
|
+
},
|
|
1078
|
+
"puppynet": {
|
|
1079
|
+
"chain": "Puppynet Shibarium",
|
|
1080
|
+
"chainId": 157,
|
|
1081
|
+
"ens": None,
|
|
1082
|
+
"explorers": [
|
|
1083
|
+
{
|
|
1084
|
+
"name": "puppyscan",
|
|
1085
|
+
"standard": "none",
|
|
1086
|
+
"url": "https://puppyscan.shib.io",
|
|
1087
|
+
}
|
|
1088
|
+
],
|
|
1089
|
+
"faucets": ["https://beta.shibariumtech.com/faucet"],
|
|
1090
|
+
"features": None,
|
|
1091
|
+
"icon": "shibarium",
|
|
1092
|
+
"infoURL": "https://shibariumecosystem.com",
|
|
1093
|
+
"name": "Puppynet Shibarium",
|
|
1094
|
+
"nativeCurrency": {"decimals": 18, "name": "BONE", "symbol": "BONE"},
|
|
1095
|
+
"networkId": 157,
|
|
1096
|
+
"rpc": ["https://puppynet.shibrpc.com"],
|
|
1097
|
+
"shortName": "puppynet",
|
|
1098
|
+
"slip44": None,
|
|
1099
|
+
},
|
|
1100
|
+
},
|
|
1007
1101
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: evmchains
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.10
|
|
4
4
|
Summary: Packaged metadata on Ethereum Virtual Machine (EVM) chains
|
|
5
5
|
License: Apache License
|
|
6
6
|
Version 2.0, January 2004
|
|
@@ -213,6 +213,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
213
213
|
Classifier: Natural Language :: English
|
|
214
214
|
Classifier: Operating System :: MacOS
|
|
215
215
|
Classifier: Operating System :: POSIX
|
|
216
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
216
217
|
Classifier: Programming Language :: Python :: 3
|
|
217
218
|
Classifier: Programming Language :: Python :: 3.8
|
|
218
219
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -238,13 +239,13 @@ Requires-Dist: types-requests>=2.31.0.20240106; extra == "dev"
|
|
|
238
239
|
|
|
239
240
|
Provides general metadata on EVM-compatible chains organized by Ape-style ecosystem and network.
|
|
240
241
|
|
|
241
|
-
Original
|
|
242
|
+
Original source data: https://github.com/ethereum-lists/chains
|
|
242
243
|
|
|
243
244
|
## Quick Start
|
|
244
245
|
|
|
245
246
|
## Dependencies
|
|
246
247
|
|
|
247
|
-
- [python3](https://www.python.org/downloads) version 3.8 up to 3.
|
|
248
|
+
- [python3](https://www.python.org/downloads) version 3.8 up to 3.12.
|
|
248
249
|
|
|
249
250
|
## Installation
|
|
250
251
|
|
|
@@ -18,6 +18,7 @@ classifiers = [
|
|
|
18
18
|
"Natural Language :: English",
|
|
19
19
|
"Operating System :: MacOS",
|
|
20
20
|
"Operating System :: POSIX",
|
|
21
|
+
"Operating System :: Microsoft :: Windows",
|
|
21
22
|
"Programming Language :: Python :: 3",
|
|
22
23
|
"Programming Language :: Python :: 3.8",
|
|
23
24
|
"Programming Language :: Python :: 3.9",
|
|
@@ -46,6 +46,7 @@ CHAIN_IDS = {
|
|
|
46
46
|
"ethereum": {
|
|
47
47
|
"mainnet": 1,
|
|
48
48
|
"goerli": 5,
|
|
49
|
+
"holesky": 17000,
|
|
49
50
|
"sepolia": 11155111,
|
|
50
51
|
},
|
|
51
52
|
"fantom": {
|
|
@@ -55,6 +56,10 @@ CHAIN_IDS = {
|
|
|
55
56
|
"gnosis": {
|
|
56
57
|
"mainnet": 100,
|
|
57
58
|
},
|
|
59
|
+
"linea": {
|
|
60
|
+
"mainnet": 59144,
|
|
61
|
+
"sepolia": 59141,
|
|
62
|
+
},
|
|
58
63
|
"optimism": {
|
|
59
64
|
"mainnet": 10,
|
|
60
65
|
"goerli": 420,
|
|
@@ -72,14 +77,14 @@ CHAIN_IDS = {
|
|
|
72
77
|
"mainnet": 1101,
|
|
73
78
|
"testnet": 1442,
|
|
74
79
|
},
|
|
75
|
-
"linea": {
|
|
76
|
-
"mainnet": 59144,
|
|
77
|
-
"sepolia": 59141,
|
|
78
|
-
},
|
|
79
80
|
"rootstock": {
|
|
80
81
|
"mainnet": 30,
|
|
81
82
|
"testnet": 31,
|
|
82
83
|
},
|
|
84
|
+
"shibarium": {
|
|
85
|
+
"mainnet": 109,
|
|
86
|
+
"puppynet": 157,
|
|
87
|
+
}
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
pp = PrettyPrinter(indent=4)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from contextlib import contextmanager
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from evmchains import PUBLIC_CHAIN_META, Chain, get_chain_meta, get_rpcs
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.fixture()
|
|
10
|
+
def env():
|
|
11
|
+
@contextmanager
|
|
12
|
+
def inner(environ=dict(), unset=list()):
|
|
13
|
+
old_environ = os.environ.copy()
|
|
14
|
+
os.environ.update(environ)
|
|
15
|
+
for key in unset:
|
|
16
|
+
try:
|
|
17
|
+
del os.environ[key]
|
|
18
|
+
except KeyError:
|
|
19
|
+
pass
|
|
20
|
+
yield
|
|
21
|
+
os.environ = old_environ
|
|
22
|
+
|
|
23
|
+
return inner
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_chain_structure():
|
|
27
|
+
assert "ethereum" in PUBLIC_CHAIN_META
|
|
28
|
+
assert "mainnet" in PUBLIC_CHAIN_META["ethereum"]
|
|
29
|
+
|
|
30
|
+
chain = PUBLIC_CHAIN_META["ethereum"]["mainnet"]
|
|
31
|
+
assert isinstance(chain, dict)
|
|
32
|
+
assert len(chain["rpc"]) > 0
|
|
33
|
+
assert chain["chainId"] == 1
|
|
34
|
+
assert chain["networkId"] == 1
|
|
35
|
+
assert chain["shortName"] == "eth"
|
|
36
|
+
assert chain["name"] == "Ethereum Mainnet"
|
|
37
|
+
assert chain["nativeCurrency"]["symbol"] == "ETH"
|
|
38
|
+
assert len(chain["explorers"]) > 0
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_get_chain_meta():
|
|
42
|
+
chain = get_chain_meta("arbitrum", "mainnet")
|
|
43
|
+
assert isinstance(chain, Chain)
|
|
44
|
+
assert len(chain.rpc) > 0
|
|
45
|
+
assert chain.chainId == 42161
|
|
46
|
+
assert chain.networkId == 42161
|
|
47
|
+
assert chain.shortName == "arb1"
|
|
48
|
+
assert chain.name == "Arbitrum One"
|
|
49
|
+
assert chain.nativeCurrency["symbol"] == "ETH"
|
|
50
|
+
assert len(chain.explorers) > 0
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_get_rpcs_alchemy(env):
|
|
54
|
+
alchemy_key = "alchemistsayswhat"
|
|
55
|
+
expected_rpc = f"https://arb-mainnet.g.alchemy.com/v2/{alchemy_key}"
|
|
56
|
+
|
|
57
|
+
def find_rpc(rpcs, expected):
|
|
58
|
+
for rpc in rpcs:
|
|
59
|
+
if rpc == expected:
|
|
60
|
+
return True
|
|
61
|
+
return False
|
|
62
|
+
|
|
63
|
+
with env({"ALCHEMY_API_KEY": alchemy_key}, unset=["INFURA_API_KEY"]):
|
|
64
|
+
rpcs = get_rpcs("arbitrum", "mainnet")
|
|
65
|
+
assert isinstance(rpcs, list)
|
|
66
|
+
assert len(rpcs) > 0
|
|
67
|
+
assert find_rpc(rpcs, expected_rpc)
|
|
68
|
+
# Ensure the infura endpoint was also filtered out
|
|
69
|
+
assert len([rpc for rpc in rpcs if "infura" in rpc]) == 0
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_get_rpcs_infura(env):
|
|
73
|
+
infura_key = "infuraaaaaa"
|
|
74
|
+
expected_rpc = f"https://arbitrum-mainnet.infura.io/v3/{infura_key}"
|
|
75
|
+
|
|
76
|
+
def find_rpc(rpcs, expected):
|
|
77
|
+
for rpc in rpcs:
|
|
78
|
+
if rpc == expected:
|
|
79
|
+
return True
|
|
80
|
+
return False
|
|
81
|
+
|
|
82
|
+
with env({"INFURA_API_KEY": infura_key}, unset=["ALCHEMY_API_KEY"]):
|
|
83
|
+
rpcs = get_rpcs("arbitrum", "mainnet")
|
|
84
|
+
assert isinstance(rpcs, list)
|
|
85
|
+
assert len(rpcs) > 0
|
|
86
|
+
assert find_rpc(rpcs, expected_rpc)
|
|
87
|
+
# Ensure the alchemy endpoint was also filtered out
|
|
88
|
+
assert len([rpc for rpc in rpcs if "alchemy" in rpc]) == 0
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import random
|
|
2
|
-
|
|
3
|
-
from evmchains.chains import PUBLIC_CHAIN_META
|
|
4
|
-
from evmchains.types import Chain
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def get_chain_meta(ecosystem: str, network: str) -> Chain:
|
|
8
|
-
"""Return a Chain instance with metadata for an EVM chain"""
|
|
9
|
-
if (
|
|
10
|
-
ecosystem not in PUBLIC_CHAIN_META
|
|
11
|
-
or network not in PUBLIC_CHAIN_META[ecosystem]
|
|
12
|
-
):
|
|
13
|
-
raise KeyError(f"Unknown ecosystem:network: {ecosystem}:{network}")
|
|
14
|
-
|
|
15
|
-
return Chain(**PUBLIC_CHAIN_META[ecosystem][network])
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def get_random_rpc(ecosystem: str, network: str) -> str:
|
|
19
|
-
"""Return a random RPC endpoint for an ecosystem:network pair"""
|
|
20
|
-
chain = get_chain_meta(ecosystem, network)
|
|
21
|
-
return random.choice(chain.rpc)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
__all__ = ["PUBLIC_CHAIN_META", "Chain", "get_chain_meta"]
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
from evmchains import PUBLIC_CHAIN_META, Chain, get_chain_meta
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def test_chain_structure():
|
|
5
|
-
assert "ethereum" in PUBLIC_CHAIN_META
|
|
6
|
-
assert "mainnet" in PUBLIC_CHAIN_META["ethereum"]
|
|
7
|
-
|
|
8
|
-
chain = PUBLIC_CHAIN_META["ethereum"]["mainnet"]
|
|
9
|
-
assert isinstance(chain, dict)
|
|
10
|
-
assert len(chain["rpc"]) > 0
|
|
11
|
-
assert chain["chainId"] == 1
|
|
12
|
-
assert chain["networkId"] == 1
|
|
13
|
-
assert chain["shortName"] == "eth"
|
|
14
|
-
assert chain["name"] == "Ethereum Mainnet"
|
|
15
|
-
assert chain["nativeCurrency"]["symbol"] == "ETH"
|
|
16
|
-
assert len(chain["explorers"]) > 0
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def test_get_chain_meta():
|
|
20
|
-
chain = get_chain_meta("arbitrum", "mainnet")
|
|
21
|
-
assert isinstance(chain, Chain)
|
|
22
|
-
assert len(chain.rpc) > 0
|
|
23
|
-
assert chain.chainId == 42161
|
|
24
|
-
assert chain.networkId == 42161
|
|
25
|
-
assert chain.shortName == "arb1"
|
|
26
|
-
assert chain.name == "Arbitrum One"
|
|
27
|
-
assert chain.nativeCurrency["symbol"] == "ETH"
|
|
28
|
-
assert len(chain.explorers) > 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|