core
core copied to clipboard
Remove providerConfig from NetworkController
Explanation
Historically, the providerConfig property in NetworkController has been used to track the currently selected network as well as provide access to information about that network. The selected network is now tracked via selectedNetworkClientId, and information about that network can be retrieved by looking at the networkConfigurations property or the configuration property on the NetworkClient interface. This means that we no longer need providerConfig and we can remove this redundant state.
References
Fixes #4185.
Changelog
@metamask/assets-controllers
Changed
-
BREAKING: The messenger for NftController must allow
NetworkController:getNetworkClientById(#4254)
@metamask/ens-controller
Changed
-
BREAKING: The messenger for NftController must allow
NetworkController:getNetworkClientById(#4254) - Update listener argument to
onNetworkDidChangeso that it may take the full NetworkController state instead of simply an object with aproviderConfigproperty (#4254)
@metamask/network-controller
Removed
-
BREAKING: Remove
providerConfigproperty from state along withProviderConfigtype andNetworkController:getProviderConfigmessenger action (#4254)- To obtain an equivalent configuration object, access the currently selected network via
state.selectedNetworkClientId, pass this to theNetworkController:getNetworkClientIdmessenger action, and then access theconfigurationproperty on the network client.
- To obtain an equivalent configuration object, access the currently selected network via
- Update
networksMetadatastate property so that the keys in the object will only ever contain network client IDs and not RPC URLs (#4254)
Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
- [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate