fix: mUSD icon was showing up as the linea icon for merkl claims cp-7.77.0#30192
Conversation
…/metamask-mobile into MUSD-798/musd-claim-token-image
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Impact chain:
No other flows are impacted. No performance implications — this is a minor display/data fix with no rendering overhead changes. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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, |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 8cf85d2. Configure here.
|





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.
useTokenAssetwas returning the wallet token with no image causingAvatarTokento fall back toNetworkBadgeSource(ie the linea icon).MUSD_TOKENinmusd.tsas the single source of truth for the mUSD logouseTokenAsset, use MUSD_TOKEN.image in the no-wallet fallback asset, and also supplement asset.image when the wallet token exists but has no imageChangelog
CHANGELOG entry: fix mUSD icon image fallback
Related issues
Fixes: MUSD-798
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Low risk: small, targeted change to confirmation token asset selection and a constant addition; main risk is unintended icon override for
musdClaimif 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 animage.useTokenAssetconsolidatesmusdClaimhandling into an early return that merges wallet token data withMUSD_TOKENdefaults (includingimage) instead of only falling back when the token is absent. Tests are updated to assert the newimagefield in the fallback asset.Reviewed by Cursor Bugbot for commit 8cf85d2. Bugbot is set up for automated code reviews on this repo. Configure here.