Commit 9d483dd
authored
fix: Checksum EVM addresses in the address list (#38539)
## **Description**
1. What is the reason for the change?
The EVM address on the address list page was not checksummed while it
was on on the home page. This is important for users so that their
addresses match what they see in the ecosystem.
2. What is the improvement/solution?
Call the following formatting function.
```ts
/**
* Normalize an address to a "safer" representation. The address might be returned as-is, if
* there's no normalizer available.
*
* @param address - An address to normalize.
* @returns The "safer" normalized address.
*/
export function normalizeSafeAddress(address: string): string {
// NOTE: We assume that the overhead over checking the address format
// at runtime is small
return isEthAddress(address) ? toChecksumHexAddress(address) : address;
}
```
[](https://codespaces.new/MetaMask/metamask-extension/pull/38539?quickstart=1)
## **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-1325
## **Manual testing steps**
1. Create/impor a wallet
2. hover address list via the network icons below the account name
3. notice the address for ETH
4. click view all
5. you will be taken to the address list
6. verify that the addresses for the EVm networks are checksummed
7. verify that copying the address results in a checksummed address
8. verify that the qr code is checksummed
9. verify that the non evm addresses are NOT checksummed
## **Screenshots/Recordings**
### **Before**
<img width="405" height="625" alt="Screenshot 2025-12-03 at 11 54 18 PM"
src="https://github.com/user-attachments/assets/815cf104-55d5-4922-83cc-a0ed521874a6"
/>
<img width="413" height="624" alt="Screenshot 2025-12-03 at 11 54 24 PM"
src="https://github.com/user-attachments/assets/d597d6a3-a3dc-4968-8e7d-8b18dc9c6db4"
/>
### **After**
<img width="425" height="633" alt="Screenshot 2025-12-03 at 8 10 56 PM"
src="https://github.com/user-attachments/assets/2f5dccf2-3c78-41c2-a9aa-e0ee150e7516"
/>
<img width="414" height="621" alt="Screenshot 2025-12-03 at 8 10 48 PM"
src="https://github.com/user-attachments/assets/152123c8-3691-4add-8616-1b8e7cdef993"
/>
<img width="447" height="630" alt="Screenshot 2025-12-03 at 8 11 24 PM"
src="https://github.com/user-attachments/assets/b213f18d-315b-418d-aa05-03c0c392ccd6"
/>
https://github.com/user-attachments/assets/9cef5a93-4e0f-4de9-880a-744eaaa3465a
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/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 for display, copy, and search in the
multichain address list while preserving non‑EVM formats, with
accompanying tests.
>
> - **UI**
> - Use `normalizeSafeAddress` to provide a normalized `address` for
`MultichainAddressRow` and for copy actions.
> - Search now matches against `normalizedAddress` in addition to
network name.
> - Memoize `normalizedAddress` per item and render list using the
normalized values.
> - Generalize `sortByPriorityNetworks` with a generic type.
> - **Tests**
> - Add tests verifying EVM addresses are checksummed for display/copy
and searchable by checksummed form.
> - Confirm non‑EVM addresses (e.g., Bitcoin) remain unchanged.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
221ffd6. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent a729e80 commit 9d483dd
File tree
2 files changed
+168
-13
lines changed- ui/components/multichain-accounts/multichain-address-rows-list
2 files changed
+168
-13
lines changedLines changed: 148 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
581 | 729 | | |
Lines changed: 20 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
85 | 87 | | |
86 | 88 | | |
87 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | | - | |
| 99 | + | |
90 | 100 | | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
94 | | - | |
| 104 | + | |
95 | 105 | | |
96 | 106 | | |
97 | | - | |
| 107 | + | |
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
102 | 112 | | |
103 | 113 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 114 | + | |
109 | 115 | | |
110 | 116 | | |
111 | 117 | | |
| |||
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
127 | 134 | | |
128 | | - | |
| 135 | + | |
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
136 | | - | |
| 143 | + | |
137 | 144 | | |
138 | 145 | | |
139 | 146 | | |
| |||
0 commit comments