MetaMask / MetaMask/metamask-extension

[P2] util.js: relocate snap helpers

Open
#44,562 0 comments 0 reactions 0 assignees View on GitHub
for-migration INVALID-ISSUE-TEMPLATE mig-epic-70-child team-extension-platform
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.