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

[Mobile Account Snaps] Migrate all accounts references to selectors #8482

Closed
owencraston opened this issue Jan 30, 2024 · 1 comment · Fixed by #8664
Closed

[Mobile Account Snaps] Migrate all accounts references to selectors #8482

owencraston opened this issue Jan 30, 2024 · 1 comment · Fixed by #8664
Assignees
Labels
INVALID-ISSUE-TEMPLATE Issue's body doesn't match any issue template. release-7.18.0 Issue or pull request that will be included in release 7.18.0 team-accounts

Comments

@owencraston
Copy link
Contributor

owencraston commented Jan 30, 2024

Currently the account information is derived from the preferences controller. In order to make this migration easier we should first migrate these references into isolated selectors that will serve as the API for accessing account information. These selectors will still use the preference controller as their source of truth.

Here are the newly added selectors on the extension.

References

Here are the relevant PRs on the extension

@metamaskbot metamaskbot added the INVALID-ISSUE-TEMPLATE Issue's body doesn't match any issue template. label Jan 30, 2024
@gantunesr gantunesr transferred this issue from MetaMask/metamask-extension Jan 31, 2024
@gantunesr
Copy link
Member

From a discussion with @owencraston,

  1. Replace all direct calls to the preferences-controller state (selectedAddress or identities) to either a selector or the useAccounts hook depending on the case. This should be also a good opportunity to add unit test in critical parts if they're missing.
  2. Resolve the inconsistency regarding importTime between the data type in the accounts-controller and preferences-controller. The easiest option is to use the preferences-controller data. Important to take into consideration a similar approach as extension of blocking the user of adding duplicated accounts
  3. Change the preference-controller selectors to accounts-controller selectors (selectSelectedAddress or selectIdentities).

Considerations,

@metamaskbot metamaskbot added the release-7.18.0 Issue or pull request that will be included in release 7.18.0 label Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INVALID-ISSUE-TEMPLATE Issue's body doesn't match any issue template. release-7.18.0 Issue or pull request that will be included in release 7.18.0 team-accounts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants