Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
issues importing ethers.getcontractfactory

I am running a function that is supposed to mint an NFT from the browser. I am able to execute the script from within node.js CLI . When I try to do it from the browser I get:

Uncaught (in promise) TypeError: ethers.getContractFactory is not a function

Here is how I am importing it currently:

import { ethers } from "https://cdn-cors.ethers.io/lib/ethers-5.5.4.esm.min.js";

As I understand, "getContractFactory" is actually a hardhat helper. How should I import it? I am not using a compiler like webpack since I had issues with it.

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As you mentioned getContractFactory() is a helper function which hardhat added to the ethers object and is only available in your hardhat environment. The function is used to actually deploy a new contract.

What you want to use in the browser is probably ethers.Contract() to "import" an already deployed contract for interacting with it.

const mintingContract = new ethers.Contract(
                    nftContractAddress,
                    ABI,
                    signer)
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!