Skip to content

Conversation

@runway-github
Copy link
Contributor

@runway-github runway-github bot commented Nov 20, 2025

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

Before

image

After

https://www.loom.com/share/e5ca32a5434e46ab907d8832ab3af239

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

Introduce a filtered assets selector to exclude Tron Energy/Bandwidth (and staked variants) and wire it into send flow and sorting, with comprehensive tests.

  • Selectors:
    • Add selectFilteredAssetsBySelectedAccountGroup to remove Tron resource tokens (ENERGY, BANDWIDTH, staked-for variants) across TrxScope networks.
    • Switch selectSortedAssetsBySelectedAccountGroup to consume the filtered selector.
  • Send Flow:
    • Update useAccountTokens to use selectFilteredAssetsBySelectedAccountGroup, ensuring Tron resources are not shown.
  • Tests:
    • Add tests validating Tron resource filtering for all Tron scopes.
    • Update useAccountTokens tests 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

…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 -->
@runway-github runway-github bot requested review from a team as code owners November 20, 2025 12:28
@github-actions
Copy link
Contributor

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-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Nov 20, 2025
}
return true;
});
});
Copy link

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.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeCore, SmokeConfirmationsRedesigned, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeWalletPlatform, SmokeWalletUX, SmokeAssets, SmokeSwaps, SmokeStake, SmokeCard, SmokeNotifications, SmokeRewards, SmokePerps, SmokeRamps, SmokeMultiChainPermissions, SmokeAnalytics, SmokeMultiChainAPI, SmokePredictions
  • Risk Level: high
  • AI Confidence: %
click to see 🤖 AI reasoning details

Fallback: AI analysis did not complete successfully. Running all tests.

View GitHub Actions results

@sonarqubecloud
Copy link

@joaoloureirop joaoloureirop merged commit 408c528 into release/7.60.0 Nov 21, 2025
175 of 217 checks passed
@joaoloureirop joaoloureirop deleted the runway-cherry-pick-7.60.0-1763641696 branch November 21, 2025 10:54
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2025
@metamaskbot metamaskbot added the release-7.60.0 Issue or pull request that will be included in release 7.60.0 label Nov 21, 2025
@metamaskbot
Copy link
Collaborator

No release label on PR. Adding release label release-7.60.0 on PR, as PR was cherry-picked in branch 7.60.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.60.0 Issue or pull request that will be included in release 7.60.0 size-M team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants