Closed jadbox closed 2 years ago
Optionally: This could be configurable too to allow other network provides other than Polygon to get added by allowing the user to pass in configuration options for the RPC if it needs to be added.
@jadbox Are you asking for this to be built in? You should be able to do this now using the provider that onboard returns
@taylorjdawson While that could be possible, the user is presented with a "change your wallet" to a network they do not have configured in their MetaMask. The ideal useflow is the user should be first prompted to add the network and then get a prompt to change their wallet to it. I've submitted a PR that does attempt to first auto add the Polygon network.
@jadbox Ahh I understand now, I like that idea! I will circle back with the team to discuss. This may be something we wait to add in v2.
@jadbox This is added in v2! So it looks like we won't add it to v1 -- sorry for any inconvenience!
@taylorjdawson Okay thanks for the heads up. When is v2 ready? I guess I'll stick on my fork with this feature until v2 is ready for production.
@taylorjdawson Also are there docs on how to achieve this in v2 I can look at? Or an example? Or a v2 PR for the feature to inspect?
Is your request related to a problem?
Our platform uses the Polygon network and most users have not added Polygon to their Metamask account.
Feature Description
When a user selects Metamask and the client requests network ID 137 or 80001, there's an API that Onboard can call to add the network if it doesn't exist.
Docs to prompt to add network: https://docs.metamask.io/guide/rpc-api.html#wallet-addethereumchain
Related discussion: https://forum.moralis.io/t/automatically-populating-metamask-network-settings/1496
Polygon RPC network settings for Metamask: https://docs.polygon.technology/docs/develop/metamask/config-polygon-on-metamask/
Example code that tells Metamask to connect to a network ID and adds the Network RPC if it doesn't exist for the client:
Alternative Solutions
na
Anything else?
No response