Skip to content

chore: correct token price formatting in wallet token list cp-7.69.1 cp-7.70.0#27485

Merged
juanmigdr merged 1 commit into
mainfrom
chore/remove-bold-and-add-commas-list-item-v2
Mar 16, 2026
Merged

chore: correct token price formatting in wallet token list cp-7.69.1 cp-7.70.0#27485
juanmigdr merged 1 commit into
mainfrom
chore/remove-bold-and-add-commas-list-item-v2

Conversation

@juanmigdr

@juanmigdr juanmigdr commented Mar 16, 2026

Copy link
Copy Markdown
Member

Description

Two visual bugs were affecting the token price display in the wallet token list (TokenListItemV2) and the explore/trending page.

Bug 1 — Missing thousand-separator commas
The token price in the second row of each list item (e.g. $2283.65 for ETH) was formatted with addCurrencySymbol, which constructs the string via a plain .toString() call and never applies locale-aware number formatting. This meant that prices ≥ $1,000 rendered without commas (e.g. $2283.65 instead of $2,283.65).

Fixed by switching to formatPriceWithSubscriptNotation, the same formatter already used on the asset-overview/price chart page, which uses Intl.NumberFormat('en-US', …) and produces properly comma-separated output.

Bug 2 — Too many decimal places for large prices
formatPriceWithSubscriptNotation was configured with maximumFractionDigits: 4 unconditionally, so a price like $2,285.013 (3 significant decimal digits within the allowed 2–4 range) rendered incorrectly. This also affected the explore/trending token row.

Fixed by scoping maximumFractionDigits to the magnitude of the price: 2 decimals for values ≥ 1, 4 decimals for values < 1 (where extra precision matters, e.g. $0.1446). Subscript notation for very small values is unaffected.

Bug 3 — Unintentional bold weight on fiat balance
The fiat balance text variant was BodyMDBold instead of BodyMDMedium, making the balance appear heavier than intended.

The full description has been saved to .agent/chore-remove-bold-and-add-commas-list-item-v2.PR-desc.md.

Changelog

CHANGELOG entry: fixed token prices in the wallet list displaying without thousand-separator commas and with too many decimal places

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-2909 & https://consensyssoftware.atlassian.net/browse/ASSETS-2921

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

image image

After

Look at the title and the USD amount. As you can see it is not bold anymore:

image

Look at the decimals in Ethereum on Mainnet:

image

Pre-merge author checklist

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

Medium Risk
Adjusts a shared price formatter and switches wallet token list rendering to it, which could change how fiat prices appear across multiple screens. Risk is limited to display/formatting (no transaction or balance calculations).

Overview
Fixes token price display in the wallet token list by replacing addCurrencySymbol with formatPriceWithSubscriptNotation, restoring locale-aware formatting (e.g., thousand separators) and consistent currency symbol/suffix handling.

Updates formatPriceWithSubscriptNotation to cap decimals at 2 for values >= 1 while keeping up to 4 decimals (and subscript notation) for smaller values, and adds unit tests to cover the new truncation behavior. Also tweaks the fiat balance text style in TokenListItemV2 from bold to a medium weight.

Written by Cursor Bugbot for commit 18f74fe. This will update automatically on new commits. Configure here.

@juanmigdr juanmigdr requested review from a team as code owners March 16, 2026 13:55
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
This PR changes price formatting logic and reuses it in a core wallet UI component:

  1. Predict formatting logic change (formatPriceWithSubscriptNotation):
  • Behavioral change: For values >= 1, prices are now limited to exactly 2 decimal places instead of up to 4.
  • This directly affects the Predict (Polymarket) UI where market prices and balances are displayed.
  • Covered by SmokePredictions (market lists, position lifecycle, balance sync, activities).
  1. TokenListItemV2 change (wallet token list row):
  • Replaces addCurrencySymbol with formatPriceWithSubscriptNotation for token fiat price display.
  • Token list is part of the core Wallet screen and impacts asset display formatting across networks.
  • Token list rendering and fiat display are validated under SmokeWalletPlatform (transaction history, privacy mode, core wallet UI behavior).
  • Even though this is mostly a visual/formatting change, incorrect formatting could break UI assertions or cause unexpected string mismatches in E2E tests.

No controller, Engine, network, confirmations, or transaction flow logic was changed. No dApp permissions, swaps, perps, or multi-chain session logic affected.

Therefore:

  • SmokePredictions is required due to direct changes in Predict price formatting utilities.
  • SmokeWalletPlatform is required due to wallet token list fiat price formatting change.
  • No need to select SmokeConfirmations, SmokeTrade, SmokeNetwork*, etc., as no transaction or network logic was modified.

Risk is medium because changes affect widely visible wallet UI (token list) and Predict price rendering, but are limited to formatting logic and a presentational component.

Performance Test Selection:
The change only modifies number formatting logic (Intl.NumberFormat maxFractionDigits condition) and a text style variant (BodyMDBold -> BodyMDMedium). No structural UI changes, no new lists, no additional data fetching, no controller/state changes. Performance impact is negligible and does not warrant running performance test suites.

View GitHub Actions results

@juanmigdr juanmigdr enabled auto-merge March 16, 2026 14:01
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
16 value mismatches detected (expected — fixture represents an existing user).
View details

@juanmigdr juanmigdr changed the title chore: correct token price formatting in wallet token list chore: correct token price formatting in wallet token list cp-7.69.0 cp7.70.0 Mar 16, 2026
@juanmigdr juanmigdr changed the title chore: correct token price formatting in wallet token list cp-7.69.0 cp7.70.0 chore: correct token price formatting in wallet token list cp-7.69.1 cp7.70.0 Mar 16, 2026
@juanmigdr juanmigdr changed the title chore: correct token price formatting in wallet token list cp-7.69.1 cp7.70.0 chore: correct token price formatting in wallet token list cp-7.69.1 cp-7.70.0 Mar 16, 2026
@juanmigdr juanmigdr added this pull request to the merge queue Mar 16, 2026
Merged via the queue into main with commit af384ae Mar 16, 2026
202 of 207 checks passed
@juanmigdr juanmigdr deleted the chore/remove-bold-and-add-commas-list-item-v2 branch March 16, 2026 19:27
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 16, 2026
@metamaskbot metamaskbot added the release-7.71.0 Issue or pull request that will be included in release 7.71.0 label Mar 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.71.0 Issue or pull request that will be included in release 7.71.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants