metamask-mobile
metamask-mobile copied to clipboard
feat: remove `selectIdentities` in favour of `selectInternalAccounts`
Description
- What is the reason for the change?
In an effort to make MetaMask multi chain we are migrating from an address based accounts to account id based account. In https://github.com/MetaMask/metamask-mobile/pull/8759 previous PR we integrated the accounts controller which stores metadata like the account name, address and supported methods. This pr migrates all the use of
selectIdentitiesto use the accounts controller as the source of truth for all accounts information (address, name etc). - What is the improvement/solution?
- find all use of
selectIdentitiesand replace it withselectInternalAccountsand/orselectSelectedInternalAccountChecksummedAddress - These selectors are already in use in
mainand are defined here. - tests for these utils can be found here.
- This PR is currently blocked by the feat: remove selectSelectedAddress in favour of selectSelectedInternalAccount #9070. Once this is shipped I will change the base branch back to
main
Related issues
Fixes: https://github.com/MetaMask/accounts-planning/issues/410
Q.A/Review check list
- QA builds
- [ ] Verify that there is no use of
selectIdentitiesin the app - [ ] Verify that no functions are expecting
identitiesas params
Manual testing steps
Fresh install
- Launch wallet
- create a new account
- once on the wallet view, add a new account
- create a custom name for your account(s)
- swipe away the app and re open
- login
- the selected account should be same one that was previously selected
- all addresses should be in checksum format
- connect the portfolio dapp via the portfolio button on the home screen.
- Click connect on the portfolio dapp
- The first address in the address picker should be match the selected address on the wallet view and be in checksum format
Upgrade path
- Use an existing wallet that has multiple accounts created/imported
- Ideally change the names of your accounts so that they have custom names
- "upgrade" your wallet to this branch
- the selected account should be the same as it was on the previous branch
- all of the account data should remain the same (names and balances)
Screenshots/Recordings
After
https://github.com/MetaMask/metamask-mobile/assets/22918444/c5df59e1-05e6-43de-9efd-9a479aa342f7
Pre-merge author checklist
- [ ] I’ve followed MetaMask Coding Standards.
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
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.
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 6764d975d8438a0ea00634ad48e45feb19c6b29e Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/77d961a3-c226-43e1-a38b-ac2e942e1dbd
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 724a5b10dba9131396782ef3505a289a22780282 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/2992d66b-6e94-4338-b502-32d29bd6401f
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 3f28c089a264895b34080ee5ee97aa7bdb89620a Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bf8c78c1-1770-4ef8-87da-299bc096eb69
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 7bfe5fab053931b2eaa330ee8240304014511e86 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/0088a067-fbbd-4878-ba24-463fb61eb898
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Codecov Report
Attention: Patch coverage is 37.30159% with 79 lines in your changes missing coverage. Please review.
Project coverage is 49.45%. Comparing base (
b013c71) to head (a31347f). Report is 122 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #9724 +/- ##
==========================================
+ Coverage 47.24% 49.45% +2.20%
==========================================
Files 1370 1427 +57
Lines 33304 34463 +1159
Branches 3586 3862 +276
==========================================
+ Hits 15736 17044 +1308
+ Misses 16607 16344 -263
- Partials 961 1075 +114
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: a31347f1fb29371d05728acd12e44e669fd962ba Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/bd8ff0ba-b5cf-47b2-8593-244087d0a803
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: af08eedbb93bcee885163c1ddc9958a2ad549383 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/9921e69a-843e-4280-bc71-3c0214b55b1d
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 04657794093cd22f68f38fbff3b8bc2e01fa486d Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1fe7e4a6-28b9-412b-8b51-2487e21bf3e0
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 4484e21a019a660b037ab2dfda2676bf0c0a103b Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a4261079-ec0e-4550-9f59-759af80abae0
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 4168770d545b02cfd407e4290e1c6dbc674ce538 Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/acc28e20-07f4-4122-8382-0df79a81358b
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 35a51ea6abd61e6b085d5944e97325079200af0f Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/801d67c1-5e00-4954-b906-1ffa178e7a3e
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: a69c626c574828e1eef13579b05719437411445f Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d0297667-73d8-4fc1-b3e2-d2537299936d
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
| Package | New capabilities | Transitives | Size | Publisher |
|---|---|---|---|---|
| npm/[email protected] | None | 0 |
33.5 kB | google-wombot |
🚮 Removed packages: npm/[email protected]
Bitrise
🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄
Commit hash: 6dc6089bf17d3d915e1c828b6a788a227b259dfa Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f587c2d3-4655-484d-94af-0449d7f03a17
[!NOTE]
- This comment will auto-update when build completes
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌
Commit hash: 59282fae3a9eaa948eaf8e347bd3a3672254b1ba Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/92362b8b-8c1b-4f9f-baee-8fa4be4f456a
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Bitrise
✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅
Commit hash: 263856bdeac793469ca7edd8041ff4620d39a2be Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/cd931912-b532-4bed-89fb-786ed6c249e1
[!NOTE]
- You can kick off another
pr_smoke_e2e_pipelineon Bitrise by removing and re-applying theRun Smoke E2Elabel on the pull request
Quality Gate passed
Issues
10 New issues
0 Accepted issues
Measures
0 Security Hotspots
52.1% Coverage on New Code
0.0% Duplication on New Code
These three issues could potentially be fixed by this PR:
- https://github.com/MetaMask/metamask-mobile/issues/10161
- https://github.com/MetaMask/metamask-mobile/issues/10155
- https://github.com/MetaMask/metamask-mobile/issues/10079
Accounts Tested:
- 3 HD accounts (1 has ENS)
- 2 imported accounts (1 has ENS)
- 4 QR accounts (1 has ENS and another has custom name)
- 1 Ledger account (has ENS)
Devices tested:
- Samsung a515f running Android 12 with security 1/1/2024
- Pixel 5a running Android 14 with security Apr 5, 2024
- iPhone 13 mini running iOS 15.6.1
- iPhone Xs running iOS 17.5.1
Hardware wallets tested:
- LNX running 2.2.3 with Eth App 1.10.4
- Keystone v3 with fw1.5.2
Successful tests:
- Migration from QA build of v7.24.3 to QA build of commit 263856bdeac793469ca7edd8041ff4620d39a2be
- Accounts and Names persisted
- Adding accounts
- HD
- Imported
- Ledger
- QR
- Remove account/Forget device
- Ledger
- QR
- Imported
- Send and confirm screens in send flow
- Imported and HD accounts display the ENS name in both the account list and send flows when they are the sender
- Dapp connect accounts shows correct names
- Lock/unlock
Observations:
ALL 4 OBSERVATIONS BELOW CAN BE REPRODUCED IN PRODUCTION AND ARE NOT INTRODUCED HERE
~1. Send Flow: 4:42 in recording below~ Reported in production issue 10257
Send toandConfirmscreens do not display the ENS name of the recipient address, even when it is shown in the account list.- EDIT: I can confirm that I can reproduce this on a production build of v7.24.4
~2. ENS Names on Hardware Addresses: 4:25 in recording below~ Reported in production under 10256
- Ledger and QR accounts that resolve to an ENS address do not have their account names updated in the account list. - I can confirm that I can reproduce this on a QA build of v7.24.3
~3. ENS Name Mismatch (Related to Issue 2): 4:25 in recording below~
- For Ledger or QR accounts, if the address resolves to an ENS name and is the sender, the ENS name is shown in the
Send toandConfirmscreens, causing a mismatch with the account list where the account name is not updated. - EDIT: I can confirm that I can reproduce this on a production build of v7.24.4
~4. ENS Resolution Delay: 5:33 in recording below~ Reported in production under 10258
- When switching between accounts with ENS names, the non-ENS account name is sometimes displayed before the ENS name is resolved. This may be a production issue that I am just noticing today.
- EDIT: I can confirm that I can reproduce this on a production build of v7.24.4
Recording:
https://www.loom.com/share/75e854462d3748ceb065d83d860b15db?sid=cba2e632-bd39-4475-8df5-7d4b2b4beb1b
@plasmacorral I went back to version 7.21.0 which was long before any accounts controller changes were added and noticed that the ens resolution in the send flow has been broken for some time.
https://github.com/MetaMask/metamask-mobile/assets/22918444/c9349672-7202-4d12-9d31-3fc8103eb287
Tests regarding [Bug] Hardware wallet account name not reflecting on signing transaction screen #10079
- I have confirmed that this PR addresses this bug
Steps: Connect QR/Ledger device on Metamask Mobile Go to test dapp Connect using hd wallet Personal sign using hd wallet Verify the sign transaction page displays Expected: Hardware wallet account name to reflect with account list from homepage Actual: Hardware wallet account name to reflect with account list from homepage
Before:
https://github.com/MetaMask/metamask-mobile/assets/22918444/db4aec6b-3d01-4542-9487-4bfdccf1aa54
After:
https://github.com/MetaMask/metamask-mobile/assets/22918444/a7c44417-8816-464a-8d4c-e11db1168c36
cc @vivek-consensys
These three issues could potentially be fixed by this PR:
These issues are resolved in this PR, and my observations above were also able to be reproduced in production v7.24.3 and 7.24.4.
Missing release label release-7.26.1 on PR. Adding release label release-7.26.1 on PR and removing other release labels(release-7.27.1), as PR was cherry-picked in branch 7.26.1.