Hi!
When trying to test the fund function from the fundMe contract I get the following error:
1) FundMe
fund
fails if you don't send enough ETH:
Error: Invalid Chai property: revertedWith
at Object.proxyGetter [as get] (node_modules/chai/lib/chai/utils/proxify.js:78:17)
at Context.<anonymous> (test/unit/FundMe.test.js:24:46)
error Command failed with exit code 1.
After some googling I read that now it's recommended to use
require("@nomicfoundation/hardhat-chai-matchers")
instead of
require("@nomiclabs/hardhat-waffle")
But if I do that I get an error saying that ether doesn't have a function "getContract()"
require("@nomiclabs/hardhat-waffle")
require("hardhat-gas-reporter")
require("@nomiclabs/hardhat-etherscan")
require("dotenv").config()
require("solidity-coverage")
require("hardhat-deploy")
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || ""
const SEPOLIA_RPC_URL =
process.env.SEPOLIA_RPC_URL ||
"https://eth-sepolia.g.alchemy.com/v2/YOUR-API-KEY"
const PRIVATE_KEY =
process.env.PRIVATE_KEY ||
"0x11ee3108a03081fe260ecdc106554d09d9d1209bcafd46942b10e02943effc4a"
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || ""
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 31337,
// gasPrice: 130000000000,
},
sepolia: {
url: SEPOLIA_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 11155111,
blockConfirmations: 6,
},
},
solidity: {
compilers: [
{
version: "0.8.8",
},
{
version: "0.6.6",
},
],
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
// customChains: [], // uncomment this line if you are getting a TypeError: customChains is not iterable
},
gasReporter: {
enabled: false,
currency: "USD",
outputFile: "gas-report.txt",
noColors: true,
coinmarketcap: COINMARKETCAP_API_KEY,
},
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
1: 0, // similarly on mainnet it will take the first account as deployer. Note though that depending on how hardhat network are configured, the account 0 on one network can be different than on another
},
},
mocha: {
timeout: 500000,
},
}
Hi! When trying to test the fund function from the fundMe contract I get the following error:
After some googling I read that now it's recommended to use
require("@nomicfoundation/hardhat-chai-matchers")
instead ofrequire("@nomiclabs/hardhat-waffle")
But if I do that I get an error saying that ether doesn't have a function "getContract()"this is my
package.json
and this my
hardhat.config.js