MetaMask / MetaMask/metamask-extension

[P1] util.js: relocate account / keyring helpers to shared/lib/accounts

Open
#44,563 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

`getAccountByAddress` (fan-out ~21), `sortSelectedInternalAccounts`, `isAbleToExportAccount`, `isAbleToRevealSrp` — account/keyring predicates (`isAbleToRevealSrp` already depends on `shared/lib/accounts`).

## Solution

Move to `shared/lib/accounts/accounts.ts`. Codemod the ~21 `getAccountByAddress` import sites.

## Acceptance Criteria

- [ ] Helpers in `shared/lib/accounts/accounts.ts`; originals deleted; ~21 sites rewired (codemod). Tests green.

Contributor guide

Open the contributing guide

Research direction

Start with ui/helpers/utils/util.js and identify the four account and keyring helpers named in the issue. Move them to shared/lib/accounts/accounts.ts, then codemod the roughly 21 getAccountByAddress import sites and remove the originals. Run the project test suite to confirm all tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
security
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.