Skip to content

fix: mUSD icon was showing up as the linea icon for merkl claims cp-7.77.0#30192

Merged
shane-t merged 4 commits into
mainfrom
MUSD-798/musd-claim-token-image
May 14, 2026
Merged

fix: mUSD icon was showing up as the linea icon for merkl claims cp-7.77.0#30192
shane-t merged 4 commits into
mainfrom
MUSD-798/musd-claim-token-image

Conversation

@shane-t

@shane-t shane-t commented May 14, 2026

Copy link
Copy Markdown
Member

Description

The claim confirmation bottom sheet was displaying the Linea network icon as the token avatar instead of the mUSD logo.
Root cause: When the TokensController adds mUSD to the user's wallet as part of the claim flow, it does so without an image URL, the token list service hasn't hydrated the logo yet. useTokenAsset was returning the wallet token with no image causing AvatarToken to fall back to NetworkBadgeSource (ie the linea icon).

  • Added an image URL to MUSD_TOKEN in musd.ts as the single source of truth for the mUSD logo
  • In useTokenAsset, use MUSD_TOKEN.image in the no-wallet fallback asset, and also supplement asset.image when the wallet token exists but has no image

Changelog

CHANGELOG entry: fix mUSD icon image fallback

Related issues

Fixes: MUSD-798

Manual testing steps

Feature: my feature name

  Scenario: user views claim confirm screen
    Given the user has some merkl rewards to claim

    When user clicks claim on the menu and looks at the claim confirm screen
    Then they should see the mUSD icon, not two linea icons

Screenshots/Recordings

Before

Simulator Screenshot - iPhone 16e - 2026-05-14 at 16 49 27

After

Simulator Screenshot - iPhone 16e - 2026-05-14 at 16 49 18

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk: small, targeted change to confirmation token asset selection and a constant addition; main risk is unintended icon override for musdClaim if the wallet token has a different image.

Overview
mUSD claim confirmations now reliably display the mUSD token avatar by adding a canonical remote logo URL (MUSD_TOKEN.image) and using it whenever the wallet token is missing an image.

useTokenAsset consolidates musdClaim handling into an early return that merges wallet token data with MUSD_TOKEN defaults (including image) instead of only falling back when the token is absent. Tests are updated to assert the new image field in the fallback asset.

Reviewed by Cursor Bugbot for commit 8cf85d2. Bugbot is set up for automated code reviews on this repo. Configure here.

@metamaskbotv2 metamaskbotv2 Bot added the team-mobile-ux Mobile UX team label May 14, 2026
@github-actions github-actions Bot added pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-S labels May 14, 2026
@shane-t shane-t added team-earn and removed team-mobile-ux Mobile UX team pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. labels May 14, 2026
@shane-t shane-t marked this pull request as ready for review May 14, 2026 15:53
@shane-t shane-t requested review from a team as code owners May 14, 2026 15:53
Comment thread app/components/Views/confirmations/hooks/useTokenAsset.ts
Matt561
Matt561 previously approved these changes May 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeStake, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are narrowly scoped to:

  1. musd.ts constant: Adds a remote image URL to the MUSD_TOKEN constant. This is a purely additive change providing a fallback image URL for mUSD token display.

  2. useTokenAsset.ts hook: Refactors the mUSD claim handling so that the mUSD fallback (including the new image field) is applied whenever isMusdClaim is true — not just when the asset is absent from the wallet. This fixes a display bug where a user who already has mUSD in their wallet might see a missing logo on the confirmation screen.

  3. useTokenAsset.test.ts: Unit test update to verify the image field is now included.

Impact chain:

  • useTokenAsset is consumed by hero-token.tsx and avatar-token-with-network-badge.tsx, both confirmation UI components
  • The fix is gated by isMusdClaim, which is specific to the mUSD lending/claim flow (Earn/Stake)
  • SmokeStake covers lending deposits and withdrawals (mUSD claim is a lending flow)
  • SmokeConfirmations is required per tag dependency rules when selecting SmokeStake, and also directly covers the confirmation UI components affected

No other flows are impacted. No performance implications — this is a minor display/data fix with no rendering overhead changes.

Performance Test Selection:
The changes are a minor data fix (adding an image URL constant and adjusting fallback logic in a hook). There are no rendering performance implications, no list rendering changes, no state management overhead, and no new API calls introduced. Performance tests are not warranted.

View GitHub Actions results

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8cf85d2. Configure here.

name: asset?.name ?? MUSD_TOKEN.name,
decimals: asset?.decimals ?? MUSD_TOKEN.decimals,
address: MUSD_TOKEN_ADDRESS,
image: asset?.image ?? MUSD_TOKEN.image,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullish coalescing misses empty-string image fallback

Medium Severity

The fallback asset?.image ?? MUSD_TOKEN.image uses nullish coalescing (??), which only catches null/undefined. However, the consumer in avatar-token-with-network-badge.tsx uses a truthiness check (image ? { uri: image } : NetworkBadgeSource(…)). Throughout the codebase, tokens without images consistently store image: '' (empty string) — seen in useRemoveToken.test.ts, useTokenPricePercentageChange.test.ts, and others. If the wallet token has image: '', ?? preserves the empty string, the consumer treats it as falsy, and falls back to the network icon — the exact bug this PR aims to fix. Using || instead of ?? would match the consumer's semantics.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8cf85d2. Configure here.

@sonarqubecloud

Copy link
Copy Markdown

@shane-t shane-t added this pull request to the merge queue May 14, 2026
Merged via the queue into main with commit 83b886d May 14, 2026
98 checks passed
@shane-t shane-t deleted the MUSD-798/musd-claim-token-image branch May 14, 2026 18:29
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-S team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants