PatrickAlphaC / hardhat-fund-me-fcc

82 stars 183 forks source link

getContract is not found #48

Closed mehedi-iitdu closed 2 years ago

mehedi-iitdu commented 2 years ago
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"
import { assert, expect } from "chai"
import { network, deployments, ethers } from "hardhat"
import { developmentChains } from "../../helper-hardhat-config"
import { FundMe, MockV3Aggregator } from "../../typechain-types"

describe("FundMe", function () {
  let fundMe: FundMe
  let mockV3Aggregator: MockV3Aggregator
  let deployer: SignerWithAddress
  beforeEach(async () => {
    if (!developmentChains.includes(network.name)) {
      throw "You need to be on a development chain to run tests"
    }
    const accounts = await ethers.getSigners()
    deployer = accounts[0]
    await deployments.fixture(["all"])
    fundMe = await ethers.getContract("FundMe")
    mockV3Aggregator = await ethers.getContract("MockV3Aggregator")
  })

if you import ethers like this in typescript, getContract function is not available there anymore. What else we can do? @PatrickAlphaC

PatrickAlphaC commented 2 years ago

It should be... make sure that your hardhat.config.js has everything you need like require("@nomiclabs/hardhat-waffle") and you've installed hardhat-deploy.