Skip to content

Commit

Permalink
add option to provide the RPC URL for a localhost network deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
stubbsta committed Mar 20, 2024
1 parent a01daa8 commit 8790db0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ETHERSCAN_API_KEY=<YOUR_ETHERSCAN_KEY>
SEPOLIA_URL=https://eth-sepolia.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
PRIVATE_KEY=<YOUR_PRIVATE_KEY>
RPC_PROVIDER=http://<RPC_IP>:<RPC_PORT>
9 changes: 8 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -34,6 +35,12 @@ const getNetworkConfig = (): NetworksUserConfig | undefined => {
url: "http://localhost:8545",
},
};
} else if (RPC_PROVIDER) {
return {
localhost_integration: {
url: RPC_PROVIDER,
},
};
}
return undefined;
};
Expand Down

0 comments on commit 8790db0

Please sign in to comment.