MetaMask / core

This monorepo is a collection of packages used across multiple MetaMask clients
MIT License
287 stars 178 forks source link

Consolidate Infura and custom network clients #1279

Open Gudahtt opened 1 year ago

Gudahtt commented 1 year ago

Today we have two types of networks in the network controller: built-in Infura networks, and networks that we keep track of with the networkConfigurations state ("RPC" type networks). We also have two separate kinds of network clients with different middleware for each type of network and different network configuration objects. This leads to much unnecessary complexity.

We should only ever have to use one function to create a network client, and it should take the same shape for the network configuration, whether the network is an Infura network or custom network. This would greatly simplify the network controller API, and it would allow easier customization of which networks are built-in.

To achieve this, it is worth it to review the list of features that Infura network clients have over custom network clients:

Ideally, if we can enable these features for all networks, not just Infura ones, that would be ideal. However, if we need a way to customize a network client, then we should add new options to the network client configuration object which would allow for turning on select features.

desi commented 4 months ago

The changes here were off the top of head. This need more investigation into what might actually be needed. Additional refinement should happen.