MetaMask / MetaMask/metamask-extension
[P2] util.js: relocate snap helpers
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Parent Epic:** [#44552 — `util.js` decomposition](https://github.com/MetaMask/metamask-extension/issues/44552)
**Source:** `ui/helpers/utils/util.js`
**Size:** L
---
## Problem
`getSnapName` (fan-out ~20), `getSnapRoute` (UI-coupled via `SNAPS_VIEW_ROUTE`), `getDedupedSnaps`, `getFilteredSnapPermissions`.
## Solution
- `getSnapRoute` → `ui/helpers/utils/snaps.ts` (must stay UI-side — route constant).
- `getSnapName`, `getDedupedSnaps`, `getFilteredSnapPermissions` → `shared/lib/snaps/snaps.ts`.
- Codemod the ~20 `getSnapName` sites (own the largest rewrite here).
## Acceptance Criteria
- [ ] Snap helpers relocated to the named modules; originals deleted; ~20 `getSnapName` sites rewired (codemod). Tests green.
Contributor guide
Research direction
Start with ui/helpers/utils/util.js and compare the named destinations ui/helpers/utils/snaps.ts and shared/lib/snaps/snaps.ts. Trace the approximately 20 getSnapName call sites, then relocate the helpers, rewire those sites with a codemod, and run the test suite to confirm the acceptance criteria are met.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100