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

99
Visualizações
Metamask does not select my Ganache network

I have a local ganache running and I have a select field in my application where a network can be selected. Once a network is selected I'm running this code to switch to that network in metamask:

await ethereum.request({
  method: 'wallet_switchEthereumChain',
  params: [{ chainId: selectedChainId }],
});

I have added my ganache instance as network to metamask with the following information:

  • Name: Ganache Local
  • RPC URL: HTTP://127.0.0.1:7545 (this is what ganache shows me)
  • Chain ID: 1337

Now when I select my ganache network in my application, metamask always tries to switch to the network "Localhost 8545". I think because it has the same chain id. Thats why I have deleted the "Localhost 8545" network to only have one network with the chain id 1337, but if I try it again metamask still chooses the "Localhost 8545" network, even if it does not exist anymore:

enter image description here

And if I confirm then no network switch is applied and I'm getting no error or something else.

Any idea how I can switch to my ganache network programmatically to test my application with ganache?

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