chore: leaderboard - abbreviate large token amounts in position rows#29316
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
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 84240d5. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
No E2E test tags exist for the SocialLeaderboard feature. The changes are isolated to a feature-flagged component with no impact on shared infrastructure, navigation, controllers, confirmations, or any other cross-cutting concerns. The changes are well-covered by the added/updated unit tests. No E2E tags need to be run. Performance Test Selection: |
|




Description
Token quantities in the Trader Profile position rows (216,649,924.26742363 ASTEROID) were rendered with full precision, making list rows noisy and hard to watch. Updated
formatTokenAmountmethod to abbreviate values ≥ 1,000 using K/M/B/T suffixes (reusing the existing pattern in the app) and cap smaller values at 4 decimal places with a < 0.00001 floor, aligning with the market-data display convention already used inAssetOverview.Changelog
CHANGELOG entry: null
Related issues
Fixes:
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 UI formatting change limited to how token quantities are displayed in social leaderboard position rows, with broad unit tests added to catch edge cases.
Overview
Updates
formatTokenAmountused by Social Leaderboard position rows to abbreviate values >= 1,000 withK/M/B/Tsuffixes (vialocalizeLargeNumber), while handling dust/precision for smaller values viaformatAmountWithThresholdand returning0for non-finite inputs.Adjusts the
PositionRowtest expectation for large balances and adds a dedicatedformatters.test.tssuite covering USD, token amount, percent, and trade date formatting (including negative, null/undefined, dust threshold, and seconds-vs-ms timestamps).Reviewed by Cursor Bugbot for commit 7ca4802. Bugbot is set up for automated code reviews on this repo. Configure here.