77
88PINATA_IPFS_URL = "https://api.pinata.cloud/pinning/pinFileToIPFS"
99
10- DEFAULT_API_KEY = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC "
10+ DEFAULT_API_KEY = "39a3c037d7a88e6692c6681bccfd1f1cf36370324c4051a83acd0edcffb20708 "
1111
12+ def get_rpc_url (network : str ) -> str :
13+ return f"https://{ network } .rpc.thirdweb.com/{ DEFAULT_API_KEY } "
1214
1315def get_provider_for_network (network : str ) -> Web3 :
1416 """
@@ -17,19 +19,25 @@ def get_provider_for_network(network: str) -> Web3:
1719
1820 rpc_url = ""
1921 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" )
2323 elif network == "goerli" :
24- rpc_url = f"https://eth- goerli.g.alchemy.com/v2/ { DEFAULT_API_KEY } "
24+ rpc_url = get_rpc_url ( " goerli" )
2525 elif network == "polygon" :
26- rpc_url = f"https:// polygon-mainnet.g.alchemy.com/v2/ { DEFAULT_API_KEY } "
26+ rpc_url = get_rpc_url ( " polygon" )
2727 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" );
2937 elif network == "fantom" :
30- rpc_url = "rpc.ftm.tools"
38+ rpc_url = get_rpc_url ( "fantom" )
3139 elif network == "avalanche" :
32- rpc_url = "https://rpc.ankr.com/ avalanche"
40+ rpc_url = get_rpc_url ( " avalanche")
3341 else :
3442 if network .startswith ("http" ):
3543 rpc_url = network
0 commit comments