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

165
Views
Getting an ENS error when interacting with a Smart Contract using ethers library

I everyone, I'm trying to call a function called 'safeMint' on an ERC721 contract deployed on Rinkeby testnet but I'm getting this error:

Error: resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.5.0)

This is the code I'm using to call the function

const mintNFT = async () => {
        const {ethereum} = window;
        if(isMetaMaskInstalled) {
            try {
                const abi = require('../contracts/Animals.json').abi;
                console.log(abi);
                const accounts = await ethereum.request({ method: 'eth_accounts' });
    
                setAccount(accounts[0]);
                
                const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
                const signer = web3Provider.getSigner();
                
                const contractWrite = new ethers.Contract('0x53Ea14980c8326E93a9F72889171c1e03d4aD6Ce', abi, signer);
            
                let trx = await contractWrite.safeMint(account, props.cidOfJsonInIpfs);
                console.log(trx);
            } catch(err) {
                console.log(err);
            }
            
        }
    }

I've tried to print the parameters passed but they seem to be right, what am I doing wrong?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I solved it with the following code

   const mintNFT = async () => {
        const {ethereum} = window;
        if(isMetaMaskInstalled) {
            try {
                const abi = require('../contracts/Animals.json').abi;
                console.log(abi);
                const accounts = await ethereum.request({ method: 'eth_accounts' });
    
                
                const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
                const signer = web3Provider.getSigner(accounts[0]);
                console.log(signer._address)
                
                const contractWrite = new ethers.Contract('0x53Ea14980c8326E93a9F72889171c1e03d4aD6Ce', abi, signer);
                let trx = await contractWrite.safeMint(accounts[0], `https://gateway.pinata.cloud/ipfs/${props.cidOfFile}`);
                let receipt = await trx.wait();
                console.log(receipt);
            } catch(err) {
                console.log(err);
            }
            
        }

What I was missing: I was using setState function to set the 'account' state variable with the first account of metamask, instead, I started using account[0] directly and it worked! I will accept this as solution in 2 days

about 4 years ago · Juan Pablo Isaza 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!