Repository navigation
Commit 387f2ac
fix(assets): place the token ticker under the token name (#47552)
## **Description**
The token details header used the ticker as its title.
[ASSETS-4256](https://consensyssoftware.atlassian.net/browse/ASSETS-4256)
settles the layout as the token name on the title line, with the ticker
directly beneath it. This mirrors the mobile change in
[MetaMask/metamask-mobile#38497](MetaMask/metamask-mobile#38497).
What changed:
- The header title is the token name, falling back to the symbol when
the name is missing.
- The ticker is shown on the subtitle line in the title color when it
differs from the name. Comparison trims whitespace and is
case-sensitive, so `Pepe` / `PEPE` shows both.
- The contract address sits on the same line as the ticker. EVM
addresses render as `0x..` plus the last four characters. Other
addresses render as the first and last four characters. The copy control
is unchanged.
- A long ticker ellipsizes, and the address stays fully visible on that
line.
- When the name and ticker match (for example `ETH`), the ticker line is
omitted so the symbol is not repeated.
Only presentation changes. Data, copy behavior, and badges are
unchanged.
## **Changelog**
CHANGELOG entry: Showed the token ticker under the token name on the
token details page
## **Related issues**
Fixes:
Refs: https://consensyssoftware.atlassian.net/browse/ASSETS-4256
## **Manual testing steps**
```gherkin
Feature: token details header identity
Scenario: token name and ticker differ
Given a token whose name is Pepe and whose ticker is PEPE
When the user opens that token on the token details page
Then the header title is Pepe
And PEPE is shown on the line directly under the name
And the contract address is shown on that same line as 0x..XXXX
And tapping the address copies the full contract address
Scenario: token name and ticker match
Given a token whose name and ticker are both ETH
When the user opens that token on the token details page
Then the header shows ETH once
And no second ticker line is shown
Scenario: long ticker
Given a token with a long ticker
When the user opens that token on the token details page
Then the ticker is truncated with an ellipsis
And the contract address and copy control remain fully visible
```
## **Screenshots/Recordings**
Captured from a running test build, opened through asset deeplinks.
### **Before**
The previous header used the ticker as the title and a longer address
truncation.
### **After**
The title is the token name. The ticker sits on the line beneath it, in
the title color, next to the compact address. When the metadata name is
the ticker itself, that second ticker is omitted.
<details>
<summary>Token details header screenshots (ERC-20, Solana, Tron,
native)</summary>
**Chainlink**: title Chainlink Token, ticker LINK, address `0x..86CA`

**Uniswap**: title Uniswap, ticker UNI, address `0x..F984`

**Pepe**: title Pepe, ticker PEPE, address `0x..1933`

**USDC**: title USDC, address `0x..eB48` (name matches ticker, so no
second ticker line)

**Solana Bonk**: title Bonk, ticker BONK, address `DezX..B263`

**Tron Tether**: title Tether, ticker USDT, address `TR7N..Lj6t`

**Native ETH**: title Ethereum, ticker ETH, no address

**Native SOL**: title SOL, no address (name matches ticker)

**Native TRX**: title TRON, ticker TRX, no address

</details>
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **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.
[ASSETS-4256]:
https://consensyssoftware.atlassian.net/browse/ASSETS-4256?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Presentation-only changes on the asset details header; copy behavior
and asset data paths are unchanged aside from display-name selection.
>
> **Overview**
> The token details header no longer uses the ticker as the main title.
It now shows the **token name** (from metadata via new
`resolveTokenDisplayName`, with symbol fallback) and, when the symbol
differs from that title (case-sensitive, trimmed), a **subtitle row**
with the ticker plus the contract copy control on one line.
>
> **Contract addresses** switch from `shortenAddress` to a compact
format: EVM as `0x..` + last four characters; Solana/Tron-style as first
four + `..` + last four. Long tickers ellipsize while the address stays
fully visible; duplicate name/ticker (e.g. ETH) drops the extra ticker
line. The avatar badge is vertically centered against the name block.
>
> `AssetPage`, `native-asset`, and `token-asset` pass `name` through;
copy-on-click still uses the full address. Tests cover header layout,
address formatting, and name resolution.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0629cd1. 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: Cursor <cursoragent@cursor.com>1 parent 1752c4c commit 387f2ac
8 files changed
Lines changed: 365 additions & 47 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 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 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 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 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
43 | 212 | | |
44 | 213 | | |
45 | 214 | | |
46 | | - | |
| 215 | + | |
47 | 216 | | |
48 | | - | |
| 217 | + | |
| 218 | + | |
49 | 219 | | |
| 220 | + | |
| 221 | + | |
50 | 222 | | |
51 | 223 | | |
52 | 224 | | |
| |||
75 | 247 | | |
76 | 248 | | |
77 | 249 | | |
78 | | - | |
| 250 | + | |
79 | 251 | | |
80 | 252 | | |
81 | 253 | | |
82 | | - | |
| 254 | + | |
83 | 255 | | |
84 | 256 | | |
85 | 257 | | |
| |||
0 commit comments