hardhat
hardhat copied to clipboard
Error HH108: Cannot connect to the network anvil
I am importing hardhat-anvil, but the additional params (ex: launch
) aren't recognized by typescript. It also is not using the accounts I specify (I've tried accounts: { mnemonic: ... }
as well as the array of private keys).
Stripped-down version of my config:
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-etherscan';
import '@nomiclabs/hardhat-solhint';
import '@nomiclabs/hardhat-waffle';
import '@openzeppelin/hardhat-upgrades';
import '@typechain/hardhat';
import '@foundry-rs/hardhat-anvil';
import 'hardhat-deploy';
import * as dotenv from 'dotenv';
import { HardhatUserConfig } from 'hardhat/config';
const config: HardhatUserConfig = {
networks: {
anvil: {
url: 'http://localhost:8545',
chainId: 1337,
accounts: [process.env.ADMIN_PRIVATE_KEY!],
launch: true,
},
},
};
export default config;
I can get it to connect if I start anvil in a separate terminal, but I still need to be able to deploy from the ADMIN_PRIVATE_KEY
account. Any ideas?