How to get user's custom networks

Hi, community, just as the title said, i want to retrieve all user’s customized networks and display different page depends on user’s networks. Is there any API or method? Or should it be a feature which may be added in the future?

Sorry for the misunderstand. What I mean is I want to retrieve the networks in user’s MetaMask via some MetaMask API or methods, so that I can show the correct answer to the user. Or let’s say I want to know whether the User’s MetaMask is added a custom network or not, which api or method(such as eth_chainId) I should use in Javascript.

Is this so you can prompt the user to switch to the correct network?

What do you need the user’s custom networks for?

Yes, exactly.

I want to get all users’ custom network to filter the network that he did not added, or I can guide him/her to add some networks if he/she haven’t added any other networks except the default network, i.e ethereum mainnet.

wallet_addEthereumChain and wallet_switchEthereumChain is likely what you are looking for.

Here is more information on the MetaMask docs:


Thanks a lot, i’ve just went my deadends, using wallet_addEthereumChain and wallet_switchEthereumChain is the what exactly what I want.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.