Commit cabe1a2
authored
chore: remove tokensChainsCache from assets selectors, transactions utils, and test fixtures (#28925)
<!--
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**
Removes all usages of the deprecated `tokensChainsCache` field from
`TokenListController` across the codebase.
This includes:
- Deleting `app/selectors/tokenListController.ts` which exposed
`selectTokenList`, `selectERC20TokensByChain`, and
`selectERC20TokensByChainInternal` — all deprecated selectors that read
from `tokensChainsCache`
- Refactoring `selectAsset` and `assetToToken` in `assets-list.ts` to
source `aggregators` directly from the token stored in `allTokens` (via
`TokensController`) instead of looking it up in `tokensChainsCache`
- Removing the early-return shortcut in `isSmartContractAddress` that
checked `tokensChainsCache` before querying the network
- Removing the `TokenListController.tokensChainsCache` mask from the
Sentry state filter
- Cleaning up all test fixtures and mocks that referenced
`tokensChainsCache`
<!--
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: remove tokensChainsCache from assets selectors,
transactions utils, and test fixtures
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-3058
## **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.
#### Performance checks (if applicable)
- [ ] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [ ] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example
For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).
## **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**
> Touches asset-to-token mapping and contract-address detection
behavior; mistakes could cause missing token metadata (e.g.,
`aggregators`) or extra network calls/perf regressions from removing the
cache short-circuit.
>
> **Overview**
> Removes the deprecated `TokenListController` selectors
(`selectTokenList`, `selectERC20TokensByChain`) and updates
callers/tests to no longer mock or depend on them.
>
> Updates `selectAsset` in `assets-list` to stop reading
`TokenListController.tokensChainsCache`; `aggregators` (and `rwaData`)
are now sourced from `TokensController.allTokens`, and related state
fixtures/tests are adjusted accordingly.
>
> Simplifies `isSmartContractAddress` in `util/transactions` by dropping
the mainnet token-cache short-circuit, and cleans up Sentry state
masking to no longer reference `TokenListController.tokensChainsCache`.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
016a367. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 47ee978 commit cabe1a2
9 files changed
Lines changed: 6 additions & 131 deletions
File tree
- app
- components
- UI/AssetOverview/TokenDetails
- Views
- TradeWalletActions
- WalletActions
- selectors
- assets
- util
- sentry
- transactions
Lines changed: 0 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 82 | | |
87 | 83 | | |
88 | 84 | | |
| |||
172 | 168 | | |
173 | 169 | | |
174 | 170 | | |
175 | | - | |
176 | | - | |
177 | 171 | | |
178 | 172 | | |
179 | 173 | | |
| |||
249 | 243 | | |
250 | 244 | | |
251 | 245 | | |
252 | | - | |
253 | | - | |
254 | 246 | | |
255 | 247 | | |
256 | 248 | | |
| |||
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 150 | | |
155 | 151 | | |
156 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 135 | | |
140 | 136 | | |
141 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | 231 | | |
244 | 232 | | |
245 | 233 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
501 | 499 | | |
502 | 500 | | |
503 | 501 | | |
| |||
517 | 515 | | |
518 | 516 | | |
519 | 517 | | |
520 | | - | |
521 | 518 | | |
522 | 519 | | |
523 | 520 | | |
| |||
549 | 546 | | |
550 | 547 | | |
551 | 548 | | |
552 | | - | |
| 549 | + | |
553 | 550 | | |
554 | 551 | | |
555 | 552 | | |
556 | 553 | | |
557 | 554 | | |
558 | 555 | | |
| 556 | + | |
559 | 557 | | |
560 | 558 | | |
561 | | - | |
| 559 | + | |
562 | 560 | | |
563 | 561 | | |
564 | 562 | | |
| |||
568 | 566 | | |
569 | 567 | | |
570 | 568 | | |
571 | | - | |
| 569 | + | |
572 | 570 | | |
573 | 571 | | |
574 | 572 | | |
575 | 573 | | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
| 574 | + | |
580 | 575 | | |
581 | 576 | | |
582 | 577 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | 163 | | |
169 | 164 | | |
170 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
512 | 511 | | |
513 | 512 | | |
514 | 513 | | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | 514 | | |
525 | 515 | | |
526 | 516 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | 178 | | |
188 | 179 | | |
189 | 180 | | |
| |||
2638 | 2629 | | |
2639 | 2630 | | |
2640 | 2631 | | |
2641 | | - | |
2642 | | - | |
2643 | | - | |
2644 | | - | |
2645 | | - | |
2646 | | - | |
2647 | | - | |
2648 | | - | |
2649 | | - | |
2650 | | - | |
2651 | | - | |
2652 | | - | |
2653 | | - | |
2654 | | - | |
2655 | | - | |
2656 | | - | |
2657 | 2632 | | |
2658 | 2633 | | |
2659 | 2634 | | |
2660 | | - | |
2661 | | - | |
2662 | | - | |
2663 | | - | |
2664 | | - | |
2665 | | - | |
2666 | 2635 | | |
2667 | 2636 | | |
2668 | 2637 | | |
| |||
2672 | 2641 | | |
2673 | 2642 | | |
2674 | 2643 | | |
2675 | | - | |
2676 | | - | |
2677 | | - | |
2678 | | - | |
2679 | | - | |
2680 | | - | |
2681 | 2644 | | |
2682 | 2645 | | |
2683 | 2646 | | |
| |||
2688 | 2651 | | |
2689 | 2652 | | |
2690 | 2653 | | |
2691 | | - | |
2692 | | - | |
2693 | | - | |
2694 | | - | |
2695 | 2654 | | |
2696 | 2655 | | |
2697 | 2656 | | |
| |||
0 commit comments