I see what is happening. The problem is not in your code, but in metamask portfolio settings.
Metamask allows you to take over the behavior of Esverral Thingsbute, encouraging standard network tone. On the other hand, this seems that, in your case, you are trying to define the standard network as Etherum (Mainnet) uses a script or a javascription.
Unfortunately, Metamask does not provide a dirct to the Ethereum network tone indicator. The default connection is determined by the ballet configuration settings and not by a pop -up requetion.
That said, here are some possible works:
: Make you accidentally connecting to a different network than Saule.
Connect
event and check if it is connected to Etherrum (the mainnet). Otherwise, you can configure it to Ethereum:`JavaScript
Connecttoetherum function () {
if (! window.etereum ||! window.etherum.connect) {
window.etherum = new web3.providers.httpprovider ('htps: //mainnet.infura.io/your_project_id');
console.log ('connected to Ethereum mainnet');
} other {
// You have already connected to Ethereum, you are good!
}
}
window.etherum.on ('connect', contacttoetherum);
Replac your_project_id_id
Wyth your ID of the project infures acting.
Ether.js
library: If you are a reactive or webpack -based application, here is an example:`JavaScript
Import Eteres of 'Eters';
window.ethers.defaultnetwork = 'mainnet';
NOTE: This requires you to install the Ether.js' library and import it in your code.
JavaScript
window.etherum = null;
However, remember to remove all connections from your character’s Ethereum.
I hope one of these is what you solve your problem!