core icon indicating copy to clipboard operation
core copied to clipboard

Remove providerConfig from NetworkController

Open mcmire opened this issue 1 year ago • 0 comments

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 onNetworkDidChange so that it may take the full NetworkController state instead of simply an object with a providerConfig property (#4254)

@metamask/network-controller

Removed

  • BREAKING: Remove providerConfig property from state along with ProviderConfig type and NetworkController:getProviderConfig messenger action (#4254)
    • To obtain an equivalent configuration object, access the currently selected network via state.selectedNetworkClientId, pass this to the NetworkController:getNetworkClientId messenger action, and then access the configuration property on the network client.
  • Update networksMetadata state 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

mcmire avatar May 03 '24 23:05 mcmire