7
7
8
8
PINATA_IPFS_URL = "https://api.pinata.cloud/pinning/pinFileToIPFS"
9
9
10
- DEFAULT_API_KEY = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC "
10
+ DEFAULT_API_KEY = "39a3c037d7a88e6692c6681bccfd1f1cf36370324c4051a83acd0edcffb20708 "
11
11
12
+ def get_rpc_url (network : str ) -> str :
13
+ return f"https://{ network } .rpc.thirdweb.com/{ DEFAULT_API_KEY } "
12
14
13
15
def get_provider_for_network (network : str ) -> Web3 :
14
16
"""
@@ -17,19 +19,25 @@ def get_provider_for_network(network: str) -> Web3:
17
19
18
20
rpc_url = ""
19
21
if network == "mainnet" or network == "ethereum" :
20
- rpc_url = f"https://eth-mainnet.g.alchemy.com/v2/{ DEFAULT_API_KEY } "
21
- elif network == "rinkeby" :
22
- rpc_url = f"https://eth-rinkeby.g.alchemy.com/v2/{ DEFAULT_API_KEY } "
22
+ rpc_url = get_rpc_url ("ethereum" )
23
23
elif network == "goerli" :
24
- rpc_url = f"https://eth- goerli.g.alchemy.com/v2/ { DEFAULT_API_KEY } "
24
+ rpc_url = get_rpc_url ( " goerli" )
25
25
elif network == "polygon" :
26
- rpc_url = f"https:// polygon-mainnet.g.alchemy.com/v2/ { DEFAULT_API_KEY } "
26
+ rpc_url = get_rpc_url ( " polygon" )
27
27
elif network == "mumbai" :
28
- rpc_url = f"https://polygon-mumbai.g.alchemy.com/v2/{ DEFAULT_API_KEY } "
28
+ rpc_url = get_rpc_url ("mumbai" )
29
+ elif network == "optimism" :
30
+ rpc_url = getRpcUrl ("optimism" );
31
+ elif network == "optimism-goerli" :
32
+ rpc_url = getRpcUrl ("optimism-goerli" );
33
+ elif network == "arbitrum" :
34
+ rpc_url = getRpcUrl ("arbitrum" );
35
+ elif network == "arbitrum-goerli" :
36
+ rpc_url = getRpcUrl ("arbitrum-goerli" );
29
37
elif network == "fantom" :
30
- rpc_url = "rpc.ftm.tools"
38
+ rpc_url = get_rpc_url ( "fantom" )
31
39
elif network == "avalanche" :
32
- rpc_url = "https://rpc.ankr.com/ avalanche"
40
+ rpc_url = get_rpc_url ( " avalanche")
33
41
else :
34
42
if network .startswith ("http" ):
35
43
rpc_url = network
0 commit comments