Skip to content

Commit ca34dae

Browse files
chore(runway): cherry-pick fix: mUSD icon was showing up as the linea icon for merkl claims cp-7.77.0 (#30203)
- fix: mUSD icon was showing up as the linea icon for merkl claims cp-7.77.0 (#30192) ## **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** ```gherkin 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** <img width="1170" height="2532" alt="Simulator Screenshot - iPhone 16e - 2026-05-14 at 16 49 27" src="https://github.com/user-attachments/assets/5876db00-3b4e-44bf-ab2e-7fb1d596003e" /> ### **After** <img width="1170" height="2532" alt="Simulator Screenshot - iPhone 16e - 2026-05-14 at 16 49 18" src="https://github.com/user-attachments/assets/21f5e8d2-0861-4b25-aed9-606ebfaa2cf8" /> ## **Pre-merge author checklist** - [X] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I've included tests if applicable - [X] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. #### 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](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93) to import wallets with many accounts and tokens - [ ] I've instrumented key operations with Sentry traces for production performance metrics - See [`trace()`](/app/util/trace.ts) for usage and [`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274) for an example For performance guidelines and tooling, see the [Performance Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers). ## **Pre-merge reviewer checklist** <!-- Reviewer checklist items follow the same semantics as the author checklist: an unchecked box is ambiguous, a checked box means the reviewer consciously assessed that responsibility. See `docs/readme/ready-for-review.md`. --> - [ ] 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. <!-- CURSOR_SUMMARY --> --- > [!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. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8cf85d2. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> [83b886d](83b886d) Co-authored-by: Shane T <muldots@gmail.com>
1 parent 163141b commit ca34dae

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

app/components/UI/Earn/constants/musd.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ export const MUSD_TOKEN = {
1111
name: 'MetaMask USD',
1212
decimals: 6,
1313
imageSource: MusdIcon,
14+
/**
15+
* Remote image URL used when the token is not yet in the user's wallet token list
16+
* and a URI-based image source is needed (e.g. for AvatarToken in confirmation screens).
17+
* The address casing in the path matches the token address on all supported chains.
18+
*/
19+
image:
20+
'https://static.cx.metamask.io/api/v2/tokenIcons/assets/eip155/1/erc20/0xaca92e438df0b2401ff60da7e4337b687a2435da.png',
1421
} as const;
1522

1623
/**

app/components/Views/confirmations/hooks/useTokenAsset.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ describe('useTokenAsset', () => {
161161
name: MUSD_TOKEN.name,
162162
decimals: MUSD_TOKEN.decimals,
163163
address: MUSD_TOKEN_ADDRESS,
164+
image: MUSD_TOKEN.image,
164165
});
165166
});
166167

app/components/Views/confirmations/hooks/useTokenAsset.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,24 @@ export const useTokenAsset = () => {
5252
({ address }) => address.toLowerCase() === tokenAddress,
5353
) as TokenI;
5454

55+
if (isMusdClaim) {
56+
// Handle both "not in wallet" and "in wallet without logo" in one place.
57+
// mUSD can be added to the wallet before the token list service hydrates its
58+
// image URL, so we always fall back to the known logo for this tx type.
59+
return {
60+
asset: {
61+
...asset,
62+
symbol: asset?.symbol ?? MUSD_TOKEN.symbol,
63+
name: asset?.name ?? MUSD_TOKEN.name,
64+
decimals: asset?.decimals ?? MUSD_TOKEN.decimals,
65+
address: MUSD_TOKEN_ADDRESS,
66+
image: asset?.image ?? MUSD_TOKEN.image,
67+
} as Partial<TokenI>,
68+
displayName: asset?.ticker ?? asset?.symbol ?? MUSD_TOKEN.symbol,
69+
};
70+
}
71+
5572
if (!asset) {
56-
// For musdClaim, fall back to known mUSD constants when token isn't in user's wallet
57-
if (isMusdClaim) {
58-
return {
59-
asset: {
60-
symbol: MUSD_TOKEN.symbol,
61-
name: MUSD_TOKEN.name,
62-
decimals: MUSD_TOKEN.decimals,
63-
address: MUSD_TOKEN_ADDRESS,
64-
} as Partial<TokenI>,
65-
displayName: MUSD_TOKEN.symbol,
66-
};
67-
}
6873
return { asset: {}, displayName: strings('token.unknown') };
6974
}
7075

0 commit comments

Comments
 (0)