updated RPC urls

This commit is contained in:
hueso 2025-08-02 16:20:47 -03:00
parent 538258a709
commit e57428525b

View File

@ -14,14 +14,6 @@ if (!mnemonic) {
throw new Error("Please set your MNEMONIC in a .env file"); throw new Error("Please set your MNEMONIC in a .env file");
} }
const infuraApiKey: string | undefined =
process.env.INFURA_API_KEY;
if (!infuraApiKey) {
throw new Error(
"Please set your INFURA_API_KEY in a .env file",
);
}
const alchemyApiKey: string | undefined = const alchemyApiKey: string | undefined =
process.env.ALCHEMY_API_KEY; process.env.ALCHEMY_API_KEY;
if (!alchemyApiKey) { if (!alchemyApiKey) {
@ -34,36 +26,16 @@ const chainIds = {
// "{INSERT_NAME}": {INSERT_ID}, // "{INSERT_NAME}": {INSERT_ID},
hardhat: 31337, hardhat: 31337,
mainnet: 1, mainnet: 1,
sepolia: 11155111, "eth-sepolia": 11155111,
goerli: 5,
"polygon-mumbai": 80001, "polygon-mumbai": 80001,
rootstock:30, rootstock:30,
rsktestnet:31, "rootstock-testnet":31,
}; };
function getChainConfig( function getChainConfig(
chain: keyof typeof chainIds, chain: keyof typeof chainIds,
): NetworkUserConfig { ): NetworkUserConfig {
let jsonRpcUrl: string; let jsonRpcUrl = "https://" + chain + ".g.alchemy.com/v2/" + alchemyApiKey;
switch (chain) {
case "polygon-mumbai":
jsonRpcUrl =
"https://polygon-mumbai.g.alchemy.com/v2/" +
alchemyApiKey;
break;
case "rsktestnet":
jsonRpcUrl = "https://public-node.testnet.rsk.co/";
break;
case "rootstock":
jsonRpcUrl = "https://public-node.rsk.co/";
break;
case "sepolia":
jsonRpcUrl = "https://rpc.sepolia.online";
break
default:
jsonRpcUrl =
"https://" + chain + ".infura.io/v3/" + infuraApiKey;
}
return { return {
// Comment out for default hardhat account settings // Comment out for default hardhat account settings
accounts: { accounts: {
@ -112,11 +84,10 @@ const config: HardhatUserConfig = {
}, },
// network: getChainConfig("{INSERT_NAME}"), // network: getChainConfig("{INSERT_NAME}"),
mainnet: getChainConfig("mainnet"), mainnet: getChainConfig("mainnet"),
goerli: getChainConfig("goerli"), sepolia: getChainConfig("eth-sepolia"),
sepolia: getChainConfig("sepolia"), mumbai: getChainConfig("polygon-mumbai"),
"polygon-mumbai": getChainConfig("polygon-mumbai"),
rootstock: getChainConfig("rootstock"), rootstock: getChainConfig("rootstock"),
rsktestnet: getChainConfig("rsktestnet"), rsktestnet: getChainConfig("rootstock-testnet"),
}, },
paths: { paths: {
artifacts: "./artifacts", artifacts: "./artifacts",