MetaMask / MetaMask/metamask-extension

[P2] util.js: relocate asset-image helper to asset-utils (dedupe)

Open
#44,558 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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:** M

---

## Problem

`getAssetImageURL` (fan-out ~5) is a near-duplicate of `getAssetImageUrl` (lowercase) already in `shared/lib/asset-utils.ts`. This is a dedupe, not just a move — the util.js version has the IPFS try/catch + `logErrorWithMessage` fallback.

## Solution

Reconcile the two into one exported helper in `shared/lib/asset-utils.ts` (preserve the IPFS fallback); rewire the ~5 call sites of the util.js version; delete it.

## Acceptance Criteria

- [ ] Single reconciled helper in `asset-utils.ts`; util.js version deleted; call sites rewired; IPFS-fallback behavior preserved. Tests green.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ui/helpers/utils/util.js and shared/lib/asset-utils.ts, comparing the two asset-image helpers and tracing the roughly five call sites of the util.js version. Reconcile them in asset-utils.ts while preserving the IPFS fallback, remove the old helper, and run the relevant tests to confirm all tests are green.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.