MetaMask / MetaMask/metamask-extension

[P1] selectors: extract legacy token / market-data / detection selectors

Open
#44,575 2 comments 0 reactions 0 assignees View on GitHub
exalate-duplicate INVALID-ISSUE-TEMPLATE mig-epic-71-child ta-triaged team-extension-platform
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

**Parent Epic:** [#44566 — `selectors.js` decomposition](https://github.com/MetaMask/metamask-extension/issues/44566)
**Source:** `ui/selectors/selectors.js`
**Size:** L

---

## Problem

~26 legacy EVM token selectors, many `@deprecated` in favor of `assets.ts` (`getSelectedAccountTokensAcrossChains`, `getNativeTokenCachedBalanceByChainIdSelector`, `getTokenNetworkFilter`, `getIsTokenNetworkFilterEqualCurrentNetwork`, …) plus live ones (`getTokenList`, `getTokensMarketData`, `getNativeCurrencyImage`, token-scan/security-scan). Overlaps existing `token-scan.ts`.

## Solution

Create `ui/selectors/tokens.ts` (after network + preferences). **Triage `@deprecated` entries — delete-vs-fold-into-`assets.ts` rather than moving blindly.** Route token-scan selectors to the existing `token-scan.ts`. Also absorb the small currency/fiat rate cluster (`getUSDConversionRate*`, `getCurrencyRates`, `getShouldShowFiat`) here.

## Acceptance Criteria

- [ ] `tokens.ts` with live selectors; `@deprecated` entries triaged (deleted or folded into `assets.ts`); imports repointed directly to the module (no barrel). Tests green.

Contributor guide

Open the contributing guide

Research direction

Start in ui/selectors/selectors.js and inventory the legacy, live, currency/fiat, and token-scan selectors described there. Compare assets.ts and the existing token-scan.ts before deciding which deprecated entries are deleted, folded, or routed. Done means ui/selectors/tokens.ts contains the retained selectors, imports point directly to it, and the tests are green.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.