Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda