Closed mcmire closed 1 year ago
We decided that while completing this task is necessary to finish the multi-chain network project, it isn't necessary to complete the particular epic that we are working, which is to merge the two network controllers together. So we are going to deprioritize this for now.
The work described here comprises a combination of #969 and #1045. That is to say, adding CRUD methods to be able to manage the network list is necessary to complete #969. Past this, keeping track of which network is connected to may in fact not be necessary. After all, one could ask, what does it mean to be "connected" to a network? If it means whether or not a block tracker is actively polling for a network, we may or may not remove this functionality in the future so that's not a guaranteed way to know. We are still thinking that through. For now, however, we can close this ticket as it overlaps with other tickets.
The list here will be roughly equivalent to the list that is kept currently in PreferencesController for now (but bringing the terminology up to date). In the future we will extend the implementation so that we can maintain a set of connected networks along with the provider objects for those networks, so our design should be future-looking.
Each network should have its own id, which we can expose to the UI for updating/deleting networks or switching networks.
We need new CRUD methods in NetworkController so that consumers can work with the list. We also want a way to keep track of which network is current.
Keep in mind that NetworkController already has methods for working with the network. These are badly named. The new methods we add should be the methods we wanted to add. In future releases we will eventually change the existing API to use the new API, then deprecate it, then remove it, but for now the new methods will live alongside the old ones.