-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: consolidate accounts references to a single source of truth (…
…#8664) ## **Description** 1. What is the reason for the change? The accounts team is working towards the integration of the new [accounts controller](https://github.com/MetaMask/core/tree/main/packages/accounts-controller). This controller will become the source of truth for all things accounts (name address, methods KeyringType etc). In order to make this integration easier we must first centralize the source of truth for accounts. 3. What is the improvement/solution? - Currently account information is being derived from the preferences controller. In this PR I removed direct use of `state.engine.backgroundState.PreferencesController` in favour of the respective redux selectors. I also migrated the Wallet screen to use the `useAccounts` hook which achieves the same result as before but without custom logic. There should be no visible or functional changes to the app. ## **Related issues** Fixes: #8482 ## **Notes for code reviewers** - 🔴 No use of `backgroundState.PreferencesController` `selectedAddress` and `identities` - 🟢 Instead they should all be using the `selectIdentities` and the `selectSelectedAddress` selectors ## **Manual testing steps** There should be no visible changes after this PR 1. create/import a wallet 2. click the 3 dots on the the account selector 3. change the account name 4. add an account 5. open the browser 6. navigate to a dapp: https://uniswap.org/ 7. connect the dapp 8. ensure that the account names are the same as the ones you input previously ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** Creation flow https://github.com/MetaMask/metamask-mobile/assets/22918444/2afefbfa-55d5-446e-b00a-216b8daa2ec8 Import flow https://github.com/MetaMask/metamask-mobile/assets/22918444/f9989e24-439a-4986-acd2-87c8229551a0 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [ ] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] In case it's not yet "ready for review", I've set it to "draft". - [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information
1 parent
b536b96
commit 7ef00e1
Showing
9 changed files
with
139 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.