ChainSafe / dappeteer

[DEPRECATED]🏌🏼‍E2E testing for dApps using Puppeteer + MetaMask
Other
490 stars 152 forks source link

How to add a new network that is not already listed? #307

Open vivek-consensys opened 1 year ago

vivek-consensys commented 1 year ago

Is your feature request related to a problem? Please describe. I would like to add a new network when setting up Metamask

Describe the solution you'd like I would like to add an additional step in adding a network in the metamask extension, where you will have to include:- Network name, RPC URL, Chain ID, Currency Symbol and block explorer URL

Describe alternatives you've considered There is not much alternatives you can try, metaMask.acceptAddNetwork only works when there is a prompt within metamask.

Vxatz commented 1 year ago

Seems like there had previously been a .addNetwork() method, but for some reason, it was deprecated.

Is there an alternative?

vivek-consensys commented 1 year ago

@Vxatz there doesn't seem to be an alternative from the API documentation

BeroBurny commented 1 year ago

Seems like there had previously been a .addNetwork() method, but for some reason, it was deprecated.

Historically we have a lot of issues with adding a network over a MetaMask UI, and this feature is actually not so important for dapp dev as he needs to use EIP-3085 for better UX

Is there an alternative?

For an alternative, you can reference this test https://github.com/ChainSafe/dappeteer/blob/a41e6dd1c7be42273173a1dc1869819841f44c6d/test/basic.spec.ts#L133-L138

that simple usage evaluation with EIP-3085 https://github.com/ChainSafe/dappeteer/blob/a41e6dd1c7be42273173a1dc1869819841f44c6d/test/testPageFunctions/addNetwork.ts#L1-L27