Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add useSafeChainsListValidation and useMultiRpcMigration to PreferencesController #4732

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

salimtb
Copy link
Contributor

@salimtb salimtb commented Sep 25, 2024

Certainly! Here's the PR description in markdown format:


Explanation

Current state:
The PreferencesController does not include support for two new features related to network validation and multi-RPC migration behavior. Specifically, there is no existing functionality to:

  1. Enable or disable the use of a safe chains list for network validation (useSafeChainsListValidation).
  2. Control the display of the multi-RPC migration modal (useMultiRpcMigration).

Solution:
This PR adds two new properties to the PreferencesController state:

  • useSafeChainsListValidation: Allows enabling or disabling validation of networks against the safe chains list (chainid.network).
  • useMultiRpcMigration: Controls whether the multi-RPC migration modal is displayed.

Along with these additions, corresponding setter methods (setUseSafeChainsListValidation and setUseMultiRpcMigration) have been implemented. These methods allow for toggling the state of the new properties.

Additional details:

  • Test cases have been added to ensure that the new properties are correctly updated in the state when their respective setter methods are invoked.
  • The default values for these properties have been set to true to maintain expected functionality for users.

There were no additional package updates or dependency changes required in this PR.

References

  • No specific issues or pull requests tied to this change.

Changelog

@metamask/preferences-controller

  • ADDED: Added useSafeChainsListValidation property to the PreferencesController state, allowing users to enable or disable safe chains list validation.
  • ADDED: Added useMultiRpcMigration property to the PreferencesController state, controlling the display of the multi-RPC migration modal.
  • ADDED: Implemented setUseSafeChainsListValidation method to toggle the useSafeChainsListValidation property.
  • ADDED: Implemented setUseMultiRpcMigration method to toggle the useMultiRpcMigration property.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes (N/A)

@salimtb salimtb force-pushed the salim/add-use-multi-rpc-preference branch from 9ec7355 to 8cce274 Compare September 25, 2024 14:08
@salimtb salimtb force-pushed the salim/add-use-multi-rpc-preference branch from 8cce274 to 9285d4e Compare October 9, 2024 13:32
@salimtb salimtb marked this pull request as ready for review October 9, 2024 13:33
@salimtb salimtb requested a review from a team as a code owner October 9, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant