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

174
Visualizações
Metamask / web3 authenticating user

I am working with web3.js. I have installed metamask in my chrome browser. I have fetched the wallet address but when I have used new web3(window.ethereum); got an error like (index):365 Uncaught (in promise) TypeError: web3 is not a constructor. my code is :-

$(document).ready(function () {             
        
    const ethereumButton = document.querySelector('.enableEthereumButton');
    const showAccount = document.querySelector('.ethereumwalletaddress');
    const showErrorAccount = document.querySelector('.walletErrorMessage');
    
    ethereumButton.addEventListener('click', () => {
      
        if (typeof window.ethereum !== 'undefined') {
            getAccount();  
        }else{window.open("https://metamask.io/download/",'_blank');}     
    });

    async function getAccount() {        
        accounts =  await window.ethereum.send('eth_requestAccounts');     
        console.log(accounts['result']['0']);
        window.web3 = new web3(window.ethereum);
        var accounts = await web3.eth.getAccounts();
        signature = await web3.eth.personal.sign(message, account);
     }
 })       

what can I do to resolve this ?

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