Commit 3cc9298
authored
chore: remove usage of tokensChainsCache in token details page (#28533)
<!--
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**
Stops using the token list cache (`tokensChainsCache`) on the token
details section of the asset overview. Market data now comes from token
rates only, and contract decimals and aggregator labels come from the
asset itself, so token details no longer depend on merging token list
metadata with market data. The old `selectEvmTokenMarketData` selector
was removed and tests were updated accordingly.
<!--
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?
-->
## **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: Stopped using the token list cache for asset overview
token details; decimals, aggregators, and market data now come from the
asset and token rates
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3027
## **Manual testing steps**
```gherkin
Feature: my feature name
Scenario: user [verb for user action]
Given [describe expected initial app state]
When user [verb for user action]
Then [describe expected outcome]
```
## **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 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]
> **Medium Risk**
> Moderate risk because it changes how token details/market data are
sourced and displayed, which could affect what appears on the asset
overview for tokens with missing/incorrect asset fields. No
auth/security-sensitive logic involved.
>
> **Overview**
> Updates the asset overview `TokenDetails` flow to **stop merging
token-list metadata with market data**: EVM market data is now read
directly from `selectTokenMarketData` (or fetched via the spot-prices
API when not cached), and token decimals/aggregator labels come from the
`asset` itself.
>
> Removes the `selectEvmTokenMarketData` selector and simplifies
`getTokenDetails` to no longer accept metadata, adjusting the
`TokenDetailsList` render condition to rely on
`contractAddress`/`decimals` presence. Related unit tests are updated to
mock `selectTokenMarketData` and validate the new behavior.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b75296f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent ad0f41c commit 3cc9298
5 files changed
Lines changed: 40 additions & 156 deletions
File tree
- app
- components/UI/AssetOverview
- TokenDetails
- utils
- selectors/multichain
Lines changed: 14 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
165 | 158 | | |
166 | 159 | | |
167 | 160 | | |
| |||
242 | 235 | | |
243 | 236 | | |
244 | 237 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | 238 | | |
257 | 239 | | |
258 | 240 | | |
| |||
301 | 283 | | |
302 | 284 | | |
303 | 285 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
314 | 290 | | |
315 | 291 | | |
316 | 292 | | |
| |||
408 | 384 | | |
409 | 385 | | |
410 | 386 | | |
411 | | - | |
| 387 | + | |
412 | 388 | | |
413 | 389 | | |
414 | 390 | | |
| |||
436 | 412 | | |
437 | 413 | | |
438 | 414 | | |
439 | | - | |
| 415 | + | |
440 | 416 | | |
441 | 417 | | |
442 | 418 | | |
| |||
457 | 433 | | |
458 | 434 | | |
459 | 435 | | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
465 | 439 | | |
466 | 440 | | |
467 | 441 | | |
| |||
483 | 457 | | |
484 | 458 | | |
485 | 459 | | |
486 | | - | |
| 460 | + | |
487 | 461 | | |
488 | 462 | | |
489 | 463 | | |
| |||
Lines changed: 11 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 62 | | |
68 | 63 | | |
69 | 64 | | |
| |||
96 | 91 | | |
97 | 92 | | |
98 | 93 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
104 | 98 | | |
105 | | - | |
| 99 | + | |
106 | 100 | | |
107 | 101 | | |
108 | 102 | | |
109 | | - | |
110 | 103 | | |
111 | 104 | | |
112 | 105 | | |
| |||
116 | 109 | | |
117 | 110 | | |
118 | 111 | | |
119 | | - | |
120 | 112 | | |
121 | | - | |
122 | 113 | | |
123 | | - | |
| 114 | + | |
124 | 115 | | |
125 | 116 | | |
126 | 117 | | |
| |||
181 | 172 | | |
182 | 173 | | |
183 | 174 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 175 | + | |
| 176 | + | |
192 | 177 | | |
193 | 178 | | |
194 | 179 | | |
| |||
231 | 216 | | |
232 | 217 | | |
233 | 218 | | |
234 | | - | |
| 219 | + | |
235 | 220 | | |
236 | 221 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 222 | + | |
241 | 223 | | |
242 | 224 | | |
243 | 225 | | |
| |||
Lines changed: 12 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
| |||
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
54 | | - | |
55 | 49 | | |
56 | 50 | | |
57 | 51 | | |
| |||
75 | 69 | | |
76 | 70 | | |
77 | 71 | | |
78 | | - | |
79 | 72 | | |
80 | 73 | | |
81 | 74 | | |
| |||
95 | 88 | | |
96 | 89 | | |
97 | 90 | | |
98 | | - | |
99 | 91 | | |
100 | 92 | | |
101 | 93 | | |
| |||
106 | 98 | | |
107 | 99 | | |
108 | 100 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 101 | + | |
115 | 102 | | |
116 | 103 | | |
117 | 104 | | |
| |||
141 | 128 | | |
142 | 129 | | |
143 | 130 | | |
144 | | - | |
145 | 131 | | |
146 | 132 | | |
147 | 133 | | |
| |||
179 | 165 | | |
180 | 166 | | |
181 | 167 | | |
182 | | - | |
183 | 168 | | |
184 | 169 | | |
185 | 170 | | |
| |||
215 | 200 | | |
216 | 201 | | |
217 | 202 | | |
218 | | - | |
219 | 203 | | |
220 | 204 | | |
221 | 205 | | |
| |||
226 | 210 | | |
227 | 211 | | |
228 | 212 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 213 | + | |
| 214 | + | |
235 | 215 | | |
236 | 216 | | |
237 | 217 | | |
238 | 218 | | |
239 | 219 | | |
240 | 220 | | |
241 | | - | |
242 | 221 | | |
243 | 222 | | |
244 | 223 | | |
245 | 224 | | |
246 | 225 | | |
247 | | - | |
| 226 | + | |
248 | 227 | | |
249 | 228 | | |
250 | 229 | | |
251 | | - | |
252 | | - | |
253 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
254 | 234 | | |
255 | 235 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 236 | + | |
262 | 237 | | |
263 | 238 | | |
264 | 239 | | |
| |||
267 | 242 | | |
268 | 243 | | |
269 | 244 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 245 | + | |
| 246 | + | |
282 | 247 | | |
283 | 248 | | |
284 | 249 | | |
285 | 250 | | |
286 | | - | |
| 251 | + | |
287 | 252 | | |
288 | 253 | | |
289 | 254 | | |
| |||
308 | 273 | | |
309 | 274 | | |
310 | 275 | | |
311 | | - | |
312 | 276 | | |
313 | 277 | | |
314 | 278 | | |
| |||
337 | 301 | | |
338 | 302 | | |
339 | 303 | | |
340 | | - | |
341 | 304 | | |
342 | 305 | | |
343 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
0 commit comments