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

333
Visualizações
How to inform the user an account isn't active after disconnecting the currently active account in MetaMask?

Scenario...

  • User has connected two accounts to our DAPP via MetaMask.
  • User disconnects the currently active account.
  • User still has their other connected account but it isn't active in MetaMask.

In our DAPP we're listening for changes like this.

useEffect(() => {
  if (!window.ethereum) return;

  const onAccountsChange = (connectedAddresses) => {
    props.setActiveAddress(connectedAddresses[0]);
  };

  window.ethereum.on('accountsChanged', onAccountsChange);

  return () => {
    window.ethereum.off('accountsChanged', onAccountsChange);
  };
}, []);

This works great for switching accounts, but in the scenario above, it will setActiveAddress to the other connected account even though it isn't actually active in MetaMask.

dapp

In our DAPP we'd like to tell the user "Please open MetaMask and activate " to remove a small layer of possible confusion.

Is this possible?

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