forked from eth-infinitism/trampoline
-
Notifications
You must be signed in to change notification settings - Fork 17
/
hardhat.config.ts
51 lines (46 loc) · 1.25 KB
/
hardhat.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// import '@nomiclabs/hardhat-waffle';
import '@nomiclabs/hardhat-ethers';
import 'hardhat-deploy';
import '@typechain/hardhat';
import { HardhatUserConfig } from 'hardhat/types';
import * as fs from 'fs';
import '@nomiclabs/hardhat-etherscan';
const mnemonicFileName =
process.env.MNEMONIC_FILE ??
`${process.env.HOME}/.secret/testnet-mnemonic.txt`;
let mnemonic = 'test '.repeat(11) + 'junk';
if (fs.existsSync(mnemonicFileName)) {
mnemonic = fs.readFileSync(mnemonicFileName, 'ascii');
}
function getNetwork1(url: string): {
url: string;
accounts: { mnemonic: string };
} {
return {
url,
accounts: { mnemonic },
};
}
function getNetwork(name: string): {
url: string;
accounts: { mnemonic: string };
} {
return getNetwork1(`https://${name}.infura.io/v3/${process.env.INFURA_ID}`);
// return getNetwork1(`wss://${name}.infura.io/ws/v3/${process.env.INFURA_ID}`)
}
const config: HardhatUserConfig = {
defaultNetwork: 'hardhat',
solidity: {
compilers: [{ version: '0.8.12', settings: {} }, { version: '0.5.0' }],
},
typechain: {
outDir: 'src/pages/Account/account-api/typechain-types',
},
networks: {
goerli: getNetwork('goerli'),
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
};
export default config;