Commit 9d2b478
authored
fix: checksum EVM token addresses used throughout the bridge experience (#38971)
<!--
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**
Changes
- Updates the `toAssetId` util to **checksum EVM assetIds** and
**transform Tron assets correctly**
- Explicitly checksums addresses (if needed) before passing them to the
bridge-controller
- Removes unused bridge-status utils
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
[](https://codespaces.new/MetaMask/metamask-extension/pull/38971?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: fix: toAssetId util should checksum EVM assetIds and
support Tron tokens
## **Related issues**
Fixes:
## **Manual testing steps**
1. Source and dest fiat values should be correct for evm and non-evm
tokens
2. Block explorer link in dest input should link to correct URL
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **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]
> - **Asset ID + image handling**: Updates `toAssetId` to accept
hex/CAIP chain IDs, checksum EVM addresses, and generate Solana `token:`
and Tron `trc20:` asset IDs; `getAssetImageUrl` now lowercases EVM paths
while preserving non‑EVM case and builds URLs from CAIP asset IDs.
> - **Metadata fetch**: Refactors
`fetchAssetMetadata`/`fetchAssetMetadataForAssetIds` to use new
`toAssetId` and `getAssetImageUrl`, normalize chain IDs, and return
non‑EVM addresses via CAIP references; adds `isEvmChainId` and
`isTronResource` helpers.
> - **Bridge integration**: Reworks selectors/utils to build assetIds
with `toAssetId(fromToken.address, fromChain.chainId)`, generate images
via CDN, and format quote params with CAIP references; updates tests/e2e
to expect checksummed ERC20 assetIds/addresses and new image URLs.
> - **Constants + cleanup**: Fixes Tron common token address format in
`BRIDGE_CHAINID_COMMON_TOKEN_PAIR`; removes unused bridge-status metrics
utils and related types.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9e831bf. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent a41914f commit 9d2b478
File tree
20 files changed
+150
-235
lines changed- app/scripts/lib/bridge-status
- test/e2e/tests/metrics
- ui
- ducks
- bridge-status
- bridge
- hooks/bridge
- __snapshots__
- pages/bridge
- __snapshots__
- prepare
- __snapshots__
- quotes
20 files changed
+150
-235
lines changedThis file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
| 207 | + | |
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | | - | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
38 | 48 | | |
39 | | - | |
40 | | - | |
| 49 | + | |
| 50 | + | |
41 | 51 | | |
42 | | - | |
43 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
44 | 61 | | |
45 | 62 | | |
46 | | - | |
| 63 | + | |
| 64 | + | |
47 | 65 | | |
48 | | - | |
| 66 | + | |
49 | 67 | | |
50 | 68 | | |
51 | 69 | | |
| |||
62 | 80 | | |
63 | 81 | | |
64 | 82 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 83 | + | |
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
73 | 90 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
78 | 94 | | |
79 | 95 | | |
80 | 96 | | |
| |||
98 | 114 | | |
99 | 115 | | |
100 | 116 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 117 | + | |
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
| |||
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
126 | | - | |
| 138 | + | |
127 | 139 | | |
128 | 140 | | |
129 | 141 | | |
130 | | - | |
| 142 | + | |
131 | 143 | | |
132 | 144 | | |
133 | 145 | | |
| |||
137 | 149 | | |
138 | 150 | | |
139 | 151 | | |
140 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
141 | 155 | | |
142 | 156 | | |
143 | 157 | | |
144 | | - | |
| 158 | + | |
145 | 159 | | |
146 | 160 | | |
147 | 161 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
157 | | - | |
| 158 | + | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| |||
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | | - | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | | - | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
| 286 | + | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
| |||
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
303 | | - | |
| 304 | + | |
| 305 | + | |
304 | 306 | | |
305 | 307 | | |
306 | 308 | | |
| |||
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
352 | | - | |
| 354 | + | |
353 | 355 | | |
354 | 356 | | |
355 | 357 | | |
| |||
443 | 445 | | |
444 | 446 | | |
445 | 447 | | |
446 | | - | |
| 448 | + | |
| 449 | + | |
447 | 450 | | |
448 | 451 | | |
449 | 452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 606 | + | |
610 | 607 | | |
611 | 608 | | |
612 | 609 | | |
| |||
0 commit comments