-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore(runway): cherry-pick fix: cp-7.60.0 filter out tron staked tokens from send flow #23028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(runway): cherry-pick fix: cp-7.60.0 filter out tron staked tokens from send flow #23028
Conversation
…ns from send flow (#22979) ## **Description** TRON staked tokens were visible in the send flow. This PR modifies some selectors so that we filter out TRON staked tokens. ## **Changelog** CHANGELOG entry: fix: filter out TRON staked tokens ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1814 ## **Manual testing steps** 1. Go to send flow 2. Filter TRON 3. EXPECTED: TRON staked tokens are not visible ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="316" height="720" alt="image" src="https://github.com/user-attachments/assets/d8a4656b-cf62-49e8-b6c9-1cadfb3eab4d" /> ### **After** https://www.loom.com/share/e5ca32a5434e46ab907d8832ab3af239 ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Exclude Tron staked bandwidth/energy assets from token lists by introducing a filtered assets selector, wiring it into the send tokens hook and sorting selector, with accompanying tests. > > - **Selectors**: > - Add `selectFilteredAssetsBySelectedAccountGroup` to remove Tron resource symbols (`ENERGY`, `BANDWIDTH`, and staked variants) across `TrxScope` networks. > - Update `selectSortedAssetsBySelectedAccountGroup` to consume the filtered selector. > - **Hooks**: > - `useAccountTokens` now uses `selectFilteredAssetsBySelectedAccountGroup` to exclude Tron staked/resource tokens in the send flow. > - **Tests**: > - Add coverage for `selectFilteredAssetsBySelectedAccountGroup` Tron filtering. > - Update `useAccountTokens` tests to use the new selector. > - Minor assertion tweak to `toStrictEqual` for assets shape. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8f9af0e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
|
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. |
| } | ||
| return true; | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Incomplete filtering of Tron staked tokens
The filtering logic only processes Tron chains explicitly listed in TrxScope enum values. Tron staked tokens on custom or unlisted Tron networks would bypass the filter entirely. The code iterates Object.values(TrxScope) instead of checking all chain IDs in assetsByAccountGroup that start with 'tron:', creating a gap where staked tokens on non-enumerated Tron networks remain visible in the send flow.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsFallback: AI analysis did not complete successfully. Running all tests. |
|
|
No release label on PR. Adding release label release-7.60.0 on PR, as PR was cherry-picked in branch 7.60.0. |



Description
TRON staked tokens were visible in the send flow. This PR modifies some
selectors so that we filter out TRON staked tokens.
Changelog
CHANGELOG entry: fix: filter out TRON staked tokens
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1814
Manual testing steps
Screenshots/Recordings
Before
After
https://www.loom.com/share/e5ca32a5434e46ab907d8832ab3af239
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Introduce a filtered assets selector to exclude Tron Energy/Bandwidth (and staked variants) and wire it into send flow and sorting, with comprehensive tests.
selectFilteredAssetsBySelectedAccountGroupto remove Tron resource tokens (ENERGY,BANDWIDTH, staked-for variants) acrossTrxScopenetworks.selectSortedAssetsBySelectedAccountGroupto consume the filtered selector.useAccountTokensto useselectFilteredAssetsBySelectedAccountGroup, ensuring Tron resources are not shown.useAccountTokenstests to mock the new selector; minor expectation tweaks (e.g.,toStrictEqual).Written by Cursor Bugbot for commit 8d1ef59. This will update automatically on new commits. Configure here.
fe2980a