diff --git a/.env.example b/.env.example index a041c5d..dc12235 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ ETHERSCAN_API_KEY= SEPOLIA_URL=https://eth-sepolia.alchemyapi.io/v2/ PRIVATE_KEY= +RPC_PROVIDER=http://: diff --git a/hardhat.config.ts b/hardhat.config.ts index ed6662b..2e1d9e8 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -12,7 +12,8 @@ import "hardhat-gas-reporter"; import "solidity-docgen"; dotenv.config(); -const { SEPOLIA_URL, PRIVATE_KEY, ETHERSCAN_API_KEY } = process.env; +const { SEPOLIA_URL, PRIVATE_KEY, ETHERSCAN_API_KEY, RPC_PROVIDER } = + process.env; const getNetworkConfig = (): NetworksUserConfig | undefined => { if (SEPOLIA_URL && PRIVATE_KEY) { @@ -34,8 +35,14 @@ const getNetworkConfig = (): NetworksUserConfig | undefined => { url: "http://localhost:8545", }, }; + } else { + const LOCALHOST_PROVIDER = RPC_PROVIDER || "http://localhost:8545"; + return { + localhost_integration: { + url: LOCALHOST_PROVIDER, + }, + }; } - return undefined; }; // You need to export an object to set up your config