MetaMask / MetaMask/metamask-extension
[P1] util.js: relocate account / keyring helpers to shared/lib/accounts
- 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
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