question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Changing a users network to the supported network

See original GitHub issue

I can’t quite figure out how to change the user network to the supported network as it appears using this library I can’t access window.ethereum.

change meaning add the required network to use my website to their metamask. Any help would be appreciated thanks!

Is there a recommended way to do this ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

4reactions
dobbobalina2commented, Nov 29, 2021

I solved the issue. This is how you would do it.

 useEffect(() => {
     if(active == true ) {

  if (chainId != 80001) {
    library.provider.request({
      method: 'wallet_addEthereumChain',
      params: [
        {
          chainId: '0x13881',
          chainName: 'Mumbai testnet',
          nativeCurrency: {
            name: 'matic',
            symbol: 'matic',
            decimals: 18,
          },
          rpcUrls: [
            ' https://polygon-rpc.com ',
            'https://rpc-mainnet.matic.network',
            'https://rpc-mainnet.maticvigil.com',
          ],
          blockExplorerUrls: ['https://polygonscan.com/'],
        },
      ],
    })
  }
} 

}, [active ])`

1reaction
jhirncommented, Feb 1, 2022

0.6.3 was the version when this worked for me. Haven’t updated the site lately as it was finished.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can a user change network adapter properties without ...
Hello,. I have a user who needs to change his laptop IP address manually in order to access some equipment he is responsible...
Read more >
Changing your Network Location Type using Group Policy Editor
Navigate to Local Computer Policy > Windows Settings > Security Settings > Network List Manager Policies and double-click the Network that you'd like...
Read more >
Allow network users to log in to your Mac - Apple Support
Turn on “Allow network users to log in at login window,” then click Options. Do one of the following: Select “All network users,”...
Read more >
Can a System Administrator modify an user's Network ID?
2. Navigate to Organization>User Administration>Users>Referenced User. Here, the user has the ability to modify or remove their Network ID. Once the changes ......
Read more >
Transition to a named user subscription - Autodesk
How admins convert from a multi-user or network to named users managed in Autodesk ... Use the Autodesk licensing support tool to update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found