You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(tron): display TRX in unstaking lock period (#27074)
## **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**
```gherkin
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**
<!-- Screenshots to be added after manual testing -->
## **Pre-merge author checklist**
- [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.
## **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](https://cursor.com)
<!-- CURSOR_SUMMARY -->
---
> [!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).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
f482b1a. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
0 commit comments