Skip to content

feat(tron): display TRX in unstaking lock period#27074

Merged
ulissesferreira merged 1 commit into
mainfrom
NEB-577-tron-unstaking-banner-ui
Mar 9, 2026
Merged

feat(tron): display TRX in unstaking lock period#27074
ulissesferreira merged 1 commit into
mainfrom
NEB-577-tron-unstaking-banner-ui

Conversation

@ulissesferreira
Copy link
Copy Markdown
Contributor

@ulissesferreira ulissesferreira commented Mar 5, 2026

Description

Display TRX that is currently in the 14-day unstaking lock period on the token details view.

Adds:

  • TronUnstakingBanner component showing "Unstaking X TRX in progress. It takes 14 days for unstaking." with Info severity
  • createTronDerivedAsset.ts utility with createInLockPeriodTrxAsset and createStakingRewardsTrxAsset helpers
  • Staking rewards Balance row rendered conditionally when staking rewards data is available
  • Derives inLockPeriodTrxAsset and stakingRewardsTrxAsset from the Tron special assets selector in useTokenBalance
  • Uses Text from @metamask/design-system-react-native (not deprecated component-library)

Changelog

CHANGELOG entry: Added a banner to display TRX in the 14-day unstaking lock period on the token details view

Related issues

Refs: NEB-577

Manual testing steps

Feature: TRX unstaking lock period display

  Scenario: user views TRX token details with TRX in lock period
    Given user has TRX that is in the 14-day unstaking lock period

    When user navigates to the TRX token details view
    Then an info banner is displayed showing "Unstaking X TRX in progress. It takes 14 days for unstaking."

  Scenario: user views TRX token details without TRX in lock period
    Given user has no TRX in the unstaking lock period

    When user navigates to the TRX token details view
    Then no unstaking banner is displayed

Screenshots/Recordings

Before

N/A - new feature

After

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.

Made with Cursor


Note

Medium Risk
Touches the shared formatWithThreshold utility and useTokenBalance, which can affect balance formatting across the app if unexpected NaN/parsing cases occur. UI changes are otherwise gated to Tron-native TRX and only render when a positive lock-period balance is present.

Overview
Displays a new Tron-native TRX unstaking in progress info banner on the token details screen when trxInLockPeriod from selectTronSpecialAssetsBySelectedAccountGroup is a positive value.

Extends useTokenBalance to derive and locale-format inLockPeriodBalance (and threads it through TokenDetails/AssetOverviewContent), adds a dedicated TronUnstakingBanner component + tests, and hardens formatWithThreshold to return an empty string for NaN (with a new unit test).

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

@ulissesferreira ulissesferreira self-assigned this Mar 5, 2026
@ulissesferreira ulissesferreira changed the base branch from main to cursor/tron-additional-assets-34a0 March 5, 2026 17:54
@ulissesferreira ulissesferreira marked this pull request as ready for review March 5, 2026 17:54
@ulissesferreira ulissesferreira requested review from a team as code owners March 5, 2026 17:54
@ulissesferreira ulissesferreira marked this pull request as draft March 5, 2026 17:55
@ulissesferreira ulissesferreira changed the title feat(tron): display TRX in unstaking lock period (NEB-577) feat(tron): display TRX in unstaking lock period Mar 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 5, 2026

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.

@metamaskbot metamaskbot added the team-networks Networks team label Mar 5, 2026
@github-actions github-actions Bot added the size-L label Mar 5, 2026
@ulissesferreira ulissesferreira force-pushed the NEB-577-tron-unstaking-banner-ui branch from 0115ea0 to c27848c Compare March 6, 2026 03:03
@github-actions github-actions Bot added size-M and removed size-L labels Mar 6, 2026
@ulissesferreira ulissesferreira force-pushed the NEB-577-tron-unstaking-banner-ui branch 3 times, most recently from c9e7d2c to 3a1a94e Compare March 6, 2026 04:33
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 60
Missing keys 0
Type mismatches 0
Value mismatches 7 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@ulissesferreira ulissesferreira marked this pull request as ready for review March 6, 2026 04:55
shane-t
shane-t previously approved these changes Mar 6, 2026
@ulissesferreira ulissesferreira changed the base branch from cursor/tron-additional-assets-34a0 to main March 6, 2026 10:22
@ulissesferreira ulissesferreira dismissed stale reviews from shane-t and Prithpal-Sooriya March 6, 2026 10:22

The base branch was changed.

@ulissesferreira ulissesferreira requested a review from a team as a code owner March 6, 2026 10:22
@ulissesferreira ulissesferreira force-pushed the NEB-577-tron-unstaking-banner-ui branch from 3a1a94e to 1c811e5 Compare March 6, 2026 10:44
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread app/components/UI/TokenDetails/hooks/useTokenBalance.ts
@ulissesferreira ulissesferreira force-pushed the NEB-577-tron-unstaking-banner-ui branch 2 times, most recently from 2185794 to 7c89ded Compare March 6, 2026 11:07
Add TronUnstakingBanner component to show TRX that is currently in the
14-day unstaking lock period. Also display staking rewards as a Balance
row. Both are derived from the Tron special assets selector and rendered
conditionally on the token details view.

Made-with: Cursor
@ulissesferreira ulissesferreira force-pushed the NEB-577-tron-unstaking-banner-ui branch from 7c89ded to f482b1a Compare March 6, 2026 11:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes in this PR are focused on adding a Tron unstaking banner feature:

  1. New TronUnstakingBanner component - A UI component that displays when TRX is in the unstaking/lock period
  2. useTokenBalance hook update - Added inLockPeriodBalance to track TRX in lock period
  3. TokenDetails and AssetOverviewContent updates - Pass and render the new banner
  4. formatWithThreshold utility fix - Added defensive NaN check
  5. Localization update - Added new string for the banner

Key observations:

  • All Tron-specific changes are wrapped in ///: BEGIN:ONLY_INCLUDE_IF(tron) conditional compilation, meaning they only affect Tron builds
  • There are NO E2E tests for Tron functionality in the test suite (verified by searching for "tron" and "TRX" in test files)
  • The only TRX reference in tests is in a performance test for import-wallet
  • The formatWithThreshold utility change is a defensive fix (adding NaN check) that prevents errors rather than changing behavior
  • The PR includes comprehensive unit tests for all new functionality

Since there are no E2E tests that cover Tron functionality, and the changes are behind a feature flag, no E2E test tags need to be selected.

Performance Test Selection:
The changes are Tron-specific UI additions (unstaking banner) that are behind a feature flag. The formatWithThreshold utility change is a defensive NaN check that doesn't affect performance. The changes don't impact app startup, login, account list rendering, swap flows, or any other performance-critical paths. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 6, 2026

@ulissesferreira ulissesferreira added this pull request to the merge queue Mar 9, 2026
Merged via the queue into main with commit 78688b1 Mar 9, 2026
62 checks passed
@ulissesferreira ulissesferreira deleted the NEB-577-tron-unstaking-banner-ui branch March 9, 2026 11:21
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-M team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants