Commit 73f97de
fix: match Quick Buy token icon and chain badge styles to homepage token list (TSA-647) (MetaMask#31459)
## **Description**
<!-- mms-check: type=text required=true -->
The Quick Buy sheet rendered its token icon + chain badge differently
from the rest of the app: the network badge was the fixed-size,
square-cornered `BadgeNetwork` from the design system package, oversized
relative to the token avatar, and token artwork resolution missed the
homepage's checksummed-address CDN fallback (so tokens like CAKE showed
different artwork than the homepage token list).
Fix — reuse the homepage Token list pattern (`TokenListItem` /
`AssetLogo`) via a new shared `QuickBuyTokenIcon` component:
- Fully round design-system `AvatarToken`, wrapped in the
component-library `BadgeWrapper`/`Badge` (variant `Network`, circular,
scaled to half the avatar, bottom-right) — exactly what `TokenListItem`
uses.
- Same data sources: `getNetworkImageSource` for the badge; token image
→ `getBridgeTokenImageSource` (keeps natives working via SLIP-44 asset
ids) → `getFallbackAssetImageUrls` (lowercased + checksummed CDN
variants), cycled by the shared `useSmartImageFallback` hook.
- Adopted in the "Pay with / Receive" footer pill (size Sm) and the
token-select rows (size Md); removed the now-dead `BadgeNetwork`
plumbing.
Note: one expected `@typescript-eslint/no-deprecated` warning for the
component-library `Badge` — the homepage `TokenListItem` carries the
identical unsuppressed warning; matching it is intentional.
Jira: [TSA-647](https://consensyssoftware.atlassian.net/browse/TSA-647)
## **Changelog**
<!-- mms-check: type=changelog required=true -->
CHANGELOG entry: Fixed token icon and network badge styling in the Quick
Buy sheet to match the wallet token list
## **Related issues**
<!-- mms-check: type=issue-link required=true -->
Fixes: [TSA-647](https://consensyssoftware.atlassian.net/browse/TSA-647)
## **Manual testing steps**
<!-- mms-check: type=manual-testing required=true -->
```gherkin
Feature: Quick Buy token icon and chain badge styles
Scenario: user compares Quick Buy icons with the homepage token list
Given the user holds CAKE on BNB Chain
When the user opens the Quick Buy sheet and the "Pay with" picker
Then the token icon is fully round with the same artwork as the homepage token list
And the network badge is circular, smaller than the token icon, anchored bottom-right
```
## **Screenshots/Recordings**
<!-- mms-check: type=screenshot required=true -->
### **Before**
NA
### **After**
Tokens view:
<img width="436" height="87" alt="Screenshot 2026-06-11 at 16 50 47"
src="https://github.com/user-attachments/assets/20168d22-81a5-4564-9bd2-55a2b4b053f7"
/>
Quickbuy view:
<img width="439" height="423" alt="Screenshot 2026-06-12 at 16 53 02"
src="https://github.com/user-attachments/assets/8f88c9b4-9162-462c-8592-bc4b2fdf6176"
/>
<img width="418" height="383" alt="Screenshot 2026-06-11 at 16 51 51"
src="https://github.com/user-attachments/assets/6f739090-579e-41ca-976e-941f1fc7c2b1"
/>
## **Pre-merge author checklist**
<!-- mms-check: type=checklist required=true -->
- [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)
- [x] I've tested on Android
- Ideally on a mid-range device; emulator is acceptable
- [x] 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
- [x] 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**
- [ ] 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.
<!-- Generated with the help of the pr-description AI skill -->
[TSA-647]:
https://consensyssoftware.atlassian.net/browse/TSA-647?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Scoped UI and image-resolution changes in Quick Buy plus a small,
tested adjustment to the shared image-fallback hook; no auth, payments,
or data-path changes.
>
> **Overview**
> Aligns **Quick Buy** token icons and chain badges with the homepage
token list (TSA-647) by introducing **`QuickBuyTokenIcon`**, used in the
pay-with footer pill and pay-with rows instead of design-system
`BadgeNetwork` + ad hoc `AvatarToken` wiring.
>
> The shared component uses component-library **`BadgeWrapper`/`Badge`
(Network)** for the circular bottom-right chain badge, and resolves
artwork like **`AssetLogo`**: token image → bridge/native source →
**`getFallbackAssetImageUrls`** (including checksummed CDN), with
**`useSmartImageFallback`** cycling on load errors.
>
> **`useSmartImageFallback`** now **resets the fallback index when the
`sources` array changes**, so switching tokens after image errors does
not stick on a stale fallback index; coverage is added in hook and
component tests.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
ad88e1f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Xavier Brochard <xavier-brochard@users.noreply.github.com>
Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>1 parent 2f327cd commit 73f97de
6 files changed
Lines changed: 270 additions & 65 deletions
File tree
- app/components
- UI/Assets/components/AssetLogo
- Views/SocialLeaderboard/TraderPositionView/components/QuickBuy/components
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
138 | 188 | | |
139 | 189 | | |
140 | 190 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
Lines changed: 5 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
22 | 18 | | |
23 | 19 | | |
24 | 20 | | |
25 | 21 | | |
26 | | - | |
27 | | - | |
| 22 | + | |
28 | 23 | | |
29 | 24 | | |
30 | 25 | | |
| |||
41 | 36 | | |
42 | 37 | | |
43 | 38 | | |
44 | | - | |
45 | 39 | | |
46 | 40 | | |
47 | 41 | | |
| |||
51 | 45 | | |
52 | 46 | | |
53 | 47 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | 48 | | |
65 | 49 | | |
66 | 50 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | 51 | | |
72 | 52 | | |
73 | 53 | | |
| |||
106 | 86 | | |
107 | 87 | | |
108 | 88 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
127 | 93 | | |
128 | 94 | | |
129 | 95 | | |
| |||
Lines changed: 2 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | 3 | | |
8 | 4 | | |
9 | 5 | | |
| |||
17 | 13 | | |
18 | 14 | | |
19 | 15 | | |
20 | | - | |
21 | 16 | | |
22 | | - | |
23 | 17 | | |
| 18 | + | |
24 | 19 | | |
25 | 20 | | |
26 | 21 | | |
| |||
51 | 46 | | |
52 | 47 | | |
53 | 48 | | |
54 | | - | |
55 | 49 | | |
56 | 50 | | |
57 | 51 | | |
| |||
71 | 65 | | |
72 | 66 | | |
73 | 67 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 68 | + | |
92 | 69 | | |
93 | 70 | | |
94 | 71 | | |
| |||
Lines changed: 104 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments