Commit 1123796
authored
fix: Format addresses in address list (#23703)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
1. What is the reason for the change?
- EVM addresses should always be checksummed. Non evm addresses should
not.
- Our addresses were formatted correctly on the list view but not in the
QR modal
- This fix ensures that all the addresses being rendered on that screen
have the proper formatting
2. What is the improvement/solution?
- call toFormattedAddress before passing it as a prop.
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Fixed bug where the EVM addresses were not checksummed
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/MUL-1327
## **Manual testing steps**
1. create or import a wallet
2. con the home page click the receive button
3. it should open the address list
4. then, look at your EVM addresses and ensure that the shortened
versions are checksummed
5. copy the address and ensure that the address is checksummed
6. click on the QR modal and ensure that the address is checksummed
7. scan the qr code and verify that the address is checksummed
8. look at your Bitcoin address, it should not be checksummed.
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<img width="250" height="600" alt="Simulator Screenshot - iPhone 16 Plus
- 2025-12-04 at 16 42 28"
src="https://github.com/user-attachments/assets/33e47a72-9f11-42a3-9efd-3a3fea271953"
/>
<img width="250" height="600" alt="Simulator Screenshot - iPhone 16 Plus
- 2025-12-04 at 16 42 12"
src="https://github.com/user-attachments/assets/c9162dfe-b619-44e4-9fa4-8dd86f935e70"
/>
### **After**
<img width="250" height="600" alt="Simulator Screenshot - iPhone 16 Plus
- 2025-12-04 at 16 33 52"
src="https://github.com/user-attachments/assets/a2feb119-0a07-4010-a220-95b70bcbaf5c"
/>
<img width="250" height="600" alt="Simulator Screenshot - iPhone 16 Plus
- 2025-12-04 at 16 33 48"
src="https://github.com/user-attachments/assets/4ea253ae-9953-4f77-a623-7ec739aa286d"
/>
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] 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](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.
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Checksums EVM addresses (leaves non‑EVM raw) across address list/QR
and selectors, and switches PrivateKeyList to store private keys by
account id; adds tests.
>
> - **Address formatting**
> - Use `toFormattedAddress` in `MultichainAddressRowsList.utils` when
creating `NetworkAddressItem`.
> - Format addresses in selector
`selectInternalAccountListSpreadByScopesByGroupId` before mapping items.
> - Pass formatted address to QR navigation in `AddressList.test.tsx`.
> - **Private keys**
> - Store exported private keys by `account.id` instead of
`account.address` in `PrivateKeyList.tsx` and update copy callback
usage.
> - **Tests**
> - Add assertions for checksummed EVM addresses and unmodified non‑EVM
addresses in `MultichainAddressRowsList.utils.test.ts`.
> - Update QR expectation to use formatted address in
`AddressList.test.tsx`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c35634f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 15146aa commit 1123796
File tree
5 files changed
+33
-6
lines changed- app
- component-library/components-temp/MultichainAccounts/MultichainAddressRowsList
- components/Views/MultichainAccounts
- AddressList
- PrivateKeyList
- selectors/multichainAccounts
5 files changed
+33
-6
lines changedLines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
245 | 266 | | |
246 | 267 | | |
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
211 | | - | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
289 | 290 | | |
290 | 291 | | |
291 | 292 | | |
| 293 | + | |
| 294 | + | |
292 | 295 | | |
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
296 | 299 | | |
297 | | - | |
| 300 | + | |
298 | 301 | | |
299 | 302 | | |
300 | 303 | | |
| |||
0 commit comments