evmchains 0.0.9__py3-none-any.whl → 0.0.11__py3-none-any.whl

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/__init__.py CHANGED
@@ -1,8 +1,13 @@
1
+ import os
1
2
  import random
3
+ import re
4
+ from typing import List
2
5
 
3
6
  from evmchains.chains import PUBLIC_CHAIN_META
4
7
  from evmchains.types import Chain
5
8
 
9
+ ENV_VAR_REGEX = re.compile(r"\$\{([A-Za-z0-9_]+)\}")
10
+
6
11
 
7
12
  def get_chain_meta(ecosystem: str, network: str) -> Chain:
8
13
  """Return a Chain instance with metadata for an EVM chain"""
@@ -15,10 +20,31 @@ def get_chain_meta(ecosystem: str, network: str) -> Chain:
15
20
  return Chain(**PUBLIC_CHAIN_META[ecosystem][network])
16
21
 
17
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
+
18
44
  def get_random_rpc(ecosystem: str, network: str) -> str:
19
45
  """Return a random RPC endpoint for an ecosystem:network pair"""
20
- chain = get_chain_meta(ecosystem, network)
21
- return random.choice(chain.rpc)
46
+ rpcs = get_rpcs(ecosystem, network)
47
+ return random.choice(rpcs)
22
48
 
23
49
 
24
- __all__ = ["PUBLIC_CHAIN_META", "Chain", "get_chain_meta"]
50
+ __all__ = ["PUBLIC_CHAIN_META", "Chain", "get_chain_meta", "get_random_rpc", "get_rpcs"]
evmchains/_meta.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.0.9'
16
- __version_tuple__ = version_tuple = (0, 0, 9)
15
+ __version__ = version = '0.0.11'
16
+ __version_tuple__ = version_tuple = (0, 0, 11)
evmchains/chains.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by scripts/update.py
2
- # 2024-05-30 20:30:00.884580
2
+ # 2024-07-03 20:26:21.491217
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,
@@ -652,6 +653,78 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
652
653
  "slip44": 700,
653
654
  },
654
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
+ },
655
728
  "optimism": {
656
729
  "mainnet": {
657
730
  "chain": "ETH",
@@ -861,6 +934,31 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
861
934
  "shortName": "maticmum",
862
935
  "slip44": 1,
863
936
  },
937
+ "amoy": {
938
+ "chain": "Polygon",
939
+ "chainId": 80002,
940
+ "ens": None,
941
+ "explorers": [
942
+ {
943
+ "name": "polygonamoy",
944
+ "standard": "EIP3091",
945
+ "url": "https://www.oklink.com/amoy",
946
+ }
947
+ ],
948
+ "faucets": ["https://faucet.polygon.technology/"],
949
+ "features": None,
950
+ "icon": "polygon",
951
+ "infoURL": "https://polygon.technology/",
952
+ "name": "Amoy",
953
+ "nativeCurrency": {"decimals": 18, "name": "MATIC", "symbol": "MATIC"},
954
+ "networkId": 80002,
955
+ "rpc": [
956
+ "https://rpc-amoy.polygon.technology",
957
+ "https://polygon-amoy-bor-rpc.publicnode.com",
958
+ ],
959
+ "shortName": "polygonamoy",
960
+ "slip44": 1,
961
+ },
864
962
  },
865
963
  "polygon-zkevm": {
866
964
  "mainnet": {
@@ -911,78 +1009,28 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
911
1009
  "shortName": "testnet-zkEVM-mango",
912
1010
  "slip44": 1,
913
1011
  },
914
- },
915
- "linea": {
916
- "mainnet": {
917
- "chain": "ETH",
918
- "chainId": 59144,
1012
+ "cardona": {
1013
+ "chain": "Polygon",
1014
+ "chainId": 2442,
919
1015
  "ens": None,
920
1016
  "explorers": [
921
1017
  {
922
- "icon": "linea",
923
- "name": "Etherscan",
924
- "standard": "EIP3091",
925
- "url": "https://lineascan.build",
926
- },
927
- {
928
- "icon": "linea",
929
- "name": "Blockscout",
930
- "standard": "EIP3091",
931
- "url": "https://explorer.linea.build",
932
- },
933
- {
934
- "icon": "linea",
935
- "name": "L2scan",
1018
+ "name": "polygonscan",
936
1019
  "standard": "EIP3091",
937
- "url": "https://linea.l2scan.co",
938
- },
1020
+ "url": "https://cardona-zkevm.polygonscan.com",
1021
+ }
939
1022
  ],
940
1023
  "faucets": [],
941
1024
  "features": None,
942
- "icon": "linea",
943
- "infoURL": "https://linea.build",
944
- "name": "Linea",
945
- "nativeCurrency": {"decimals": 18, "name": "Linea Ether", "symbol": "ETH"},
946
- "networkId": 59144,
947
- "rpc": [
948
- "https://rpc.linea.build",
949
- "https://linea-mainnet.infura.io/v3/${INFURA_API_KEY}",
950
- ],
951
- "shortName": "linea",
1025
+ "icon": "zkevm",
1026
+ "infoURL": "https://polygon.technology/polygon-zkevm",
1027
+ "name": "Polygon zkEVM Cardona Testnet",
1028
+ "nativeCurrency": {"decimals": 18, "name": "Ether", "symbol": "ETH"},
1029
+ "networkId": 2442,
1030
+ "rpc": ["https://rpc.cardona.zkevm-rpc.com"],
1031
+ "shortName": "zkevm-testnet-cardona",
952
1032
  "slip44": None,
953
1033
  },
954
- "sepolia": {
955
- "chain": "ETH",
956
- "chainId": 59141,
957
- "ens": None,
958
- "explorers": [
959
- {
960
- "icon": "linea",
961
- "name": "Etherscan",
962
- "standard": "EIP3091",
963
- "url": "https://sepolia.lineascan.build",
964
- },
965
- {
966
- "icon": "linea",
967
- "name": "Blockscout",
968
- "standard": "EIP3091",
969
- "url": "https://explorer.sepolia.linea.build",
970
- },
971
- ],
972
- "faucets": [],
973
- "features": None,
974
- "icon": "linea",
975
- "infoURL": "https://linea.build",
976
- "name": "Linea Sepolia",
977
- "nativeCurrency": {"decimals": 18, "name": "Linea Ether", "symbol": "ETH"},
978
- "networkId": 59141,
979
- "rpc": [
980
- "https://rpc.sepolia.linea.build",
981
- "https://linea-sepolia.infura.io/v3/${INFURA_API_KEY}",
982
- ],
983
- "shortName": "linea-sepolia",
984
- "slip44": 1,
985
- },
986
1034
  },
987
1035
  "rootstock": {
988
1036
  "mainnet": {
@@ -1047,4 +1095,54 @@ PUBLIC_CHAIN_META: Dict[str, Dict[str, Dict[str, Any]]] = {
1047
1095
  "slip44": 1,
1048
1096
  },
1049
1097
  },
1098
+ "shibarium": {
1099
+ "mainnet": {
1100
+ "chain": "Shibarium",
1101
+ "chainId": 109,
1102
+ "ens": None,
1103
+ "explorers": [
1104
+ {
1105
+ "name": "shibariumscan",
1106
+ "standard": "none",
1107
+ "url": "https://www.shibariumscan.io",
1108
+ }
1109
+ ],
1110
+ "faucets": [],
1111
+ "features": None,
1112
+ "icon": "shibarium",
1113
+ "infoURL": "https://shibariumecosystem.com",
1114
+ "name": "Shibarium",
1115
+ "nativeCurrency": {
1116
+ "decimals": 18,
1117
+ "name": "BONE Shibarium",
1118
+ "symbol": "BONE",
1119
+ },
1120
+ "networkId": 109,
1121
+ "rpc": ["https://www.shibrpc.com"],
1122
+ "shortName": "shibariumecosystem",
1123
+ "slip44": None,
1124
+ },
1125
+ "puppynet": {
1126
+ "chain": "Puppynet Shibarium",
1127
+ "chainId": 157,
1128
+ "ens": None,
1129
+ "explorers": [
1130
+ {
1131
+ "name": "puppyscan",
1132
+ "standard": "none",
1133
+ "url": "https://puppyscan.shib.io",
1134
+ }
1135
+ ],
1136
+ "faucets": ["https://beta.shibariumtech.com/faucet"],
1137
+ "features": None,
1138
+ "icon": "shibarium",
1139
+ "infoURL": "https://shibariumecosystem.com",
1140
+ "name": "Puppynet Shibarium",
1141
+ "nativeCurrency": {"decimals": 18, "name": "BONE", "symbol": "BONE"},
1142
+ "networkId": 157,
1143
+ "rpc": ["https://puppynet.shibrpc.com"],
1144
+ "shortName": "puppynet",
1145
+ "slip44": None,
1146
+ },
1147
+ },
1050
1148
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: evmchains
3
- Version: 0.0.9
3
+ Version: 0.0.11
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 soure data: https://github.com/ethereum-lists/chains
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.11.
248
+ - [python3](https://www.python.org/downloads) version 3.8 up to 3.12.
248
249
 
249
250
  ## Installation
250
251
 
@@ -0,0 +1,10 @@
1
+ evmchains/__init__.py,sha256=xoRq5QxDP8bhHXPae0HVSH9pK0uPZu6go4Tr2Kc3G_M,1510
2
+ evmchains/_meta.py,sha256=Ht_kK4WoZp7blBjGQJ5CR8Vli99GsMsH_I96HrAX0WE,413
3
+ evmchains/chains.py,sha256=WyQA34ByOlZqJM6swGS6KuXq9ZlU9PMevLP2bkvwixU,40049
4
+ evmchains/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ evmchains/types.py,sha256=oJV6vvbQpckiKP2TTUG-RQRe66i3cGT2M-ZkaMu1Om4,474
6
+ evmchains-0.0.11.dist-info/LICENSE,sha256=wKVouzimXmZeaCj3f48Vua0vk91U4vjrrt2Ax0u3qBs,11342
7
+ evmchains-0.0.11.dist-info/METADATA,sha256=jJirQoTi523u3farIDawKPTLfCgsaO6pwV6r73-GulM,15816
8
+ evmchains-0.0.11.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
9
+ evmchains-0.0.11.dist-info/top_level.txt,sha256=qwbaOucZ5qXfj0eTHrIujLTezgtcInyR_U-Ef2P4oic,10
10
+ evmchains-0.0.11.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- evmchains/__init__.py,sha256=JeDA-PJx5d2C2GLR4kuDdtrE_jag9AlM6EvKBwI3mxI,743
2
- evmchains/_meta.py,sha256=VUKDhsDLOPKj9zNw_322lJTB3k9JKH6BOu4nkEc42KY,411
3
- evmchains/chains.py,sha256=1dK-xR83G4tqo-drIAxL3l_e_vPGcEQg1KI3ulfvRW4,36656
4
- evmchains/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- evmchains/types.py,sha256=oJV6vvbQpckiKP2TTUG-RQRe66i3cGT2M-ZkaMu1Om4,474
6
- evmchains-0.0.9.dist-info/LICENSE,sha256=wKVouzimXmZeaCj3f48Vua0vk91U4vjrrt2Ax0u3qBs,11342
7
- evmchains-0.0.9.dist-info/METADATA,sha256=zPp2WTVDdIL2QW3sajLhkn2_yJlf_JzOIUL2uy6HMfk,15761
8
- evmchains-0.0.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
- evmchains-0.0.9.dist-info/top_level.txt,sha256=qwbaOucZ5qXfj0eTHrIujLTezgtcInyR_U-Ef2P4oic,10
10
- evmchains-0.0.9.dist-info/RECORD,,