Skip to content

Commit

Permalink
Allow typechain to be run without env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Sep 14, 2024
1 parent e95ed8d commit aaeb657
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions packages/evm/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ import "./tasks/accounts";
dotenv.config();

const { INFURA_KEY, MNEMONIC, ETHERSCAN_API_KEY } = process.env;
if (!INFURA_KEY || !MNEMONIC || !ETHERSCAN_API_KEY) {
console.error(
"Please set the INFURA_KEY, MNEMONIC, and ETHERSCAN_API_KEY environment variables",
);
process.exit(1);

if (!process.env.TYPECHAIN) { // NOTE: enabling typechain compilation without ENV vars
if (!INFURA_KEY || !MNEMONIC || !ETHERSCAN_API_KEY) {
console.error(
"Please set the INFURA_KEY, MNEMONIC, and ETHERSCAN_API_KEY environment variables",
);
process.exit(1);
}
}
const mnemonic: string = MNEMONIC;
const infuraApiKey: string = INFURA_KEY;

const mnemonic: string = MNEMONIC || "";
const infuraApiKey: string = INFURA_KEY || "";

const chainIds = {
"arbitrum-mainnet": 42161,
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"task:deployLock": "hardhat task:deployLock",
"task:withdraw": "hardhat task:withdraw",
"test": "hardhat test",
"typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true hardhat typechain"
"typechain": "cross-env TS_NODE_TRANSPILE_ONLY=true TYPECHAIN=1 hardhat typechain"
},
"dependencies": {}
}

0 comments on commit aaeb657

Please sign in to comment.