Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

277
Visualizações
How can we convert an Ethereum address (string) to Solidity's address type in Javascript in order to pass it to a contract function as an argument?

I have a function in a Solidity smart contract like this:

function mint (address _recipient, string _name) public onlyOwner {

 uint256 newItemId = _tokenIds.current();
_safemint(_recipient, newItemId);

// etc

}

I try to pass from the front-end

 import { ethers } from "ethers";
  let tmpdata = ethers.utils.getAddress("0x6f...etc"); //
    
    let nftTxn = await connectedContract.mintNFT(tmpdata, "some string");
    await nftTxn.wait();

I copy paste the addresses to make sure they are correct, but this throws an error everytime. And I think it doesn't work because we'd need an address type as first argument right? I can't find out how to achieve that, anyone can help and point me in the right direction here?

console gives me

data: "0x08c379a00000000000000......etc" message: "execution reverted: ERC721: mint to to zero address

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda