Parcourir la source

merge: pull request #43 from DakshMiglani/main

refactor: simplify hardhat config infuraApiKey & mnemonic
Paul Razvan Berg il y a 4 ans
Parent
commit
1d26bf6694
1 fichiers modifiés avec 4 ajouts et 8 suppressions
  1. 4 8
      hardhat.config.ts

+ 4 - 8
hardhat.config.ts

@@ -25,18 +25,14 @@ const chainIds = {
 };
 
 // Ensure that we have all the environment variables we need.
-let mnemonic: string;
-if (!process.env.MNEMONIC) {
+const mnemonic = process.env.MNEMONIC;
+if (!mnemonic) {
   throw new Error("Please set your MNEMONIC in a .env file");
-} else {
-  mnemonic = process.env.MNEMONIC;
 }
 
-let infuraApiKey: string;
-if (!process.env.INFURA_API_KEY) {
+const infuraApiKey = process.env.INFURA_API_KEY;
+if (!infuraApiKey) {
   throw new Error("Please set your INFURA_API_KEY in a .env file");
-} else {
-  infuraApiKey = process.env.INFURA_API_KEY;
 }
 
 function createTestnetConfig(network: keyof typeof chainIds): NetworkUserConfig {