Skip to content

Conversation

@Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Nov 19, 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

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.

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

@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners November 19, 2025 23:30
@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.

@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAssets, SmokeConfirmationsRedesigned, SmokeNetworkExpansion
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

The changes introduce a new filtering mechanism for Tron resource assets in the asset selection system. Here's the impact analysis:

What Changed:

  1. Created a new selector selectFilteredAssetsBySelectedAccountGroup that filters out Tron resource symbols (BANDWIDTH, ENERGY, etc.) from asset lists
  2. Updated confirmation flows (useAccountTokens hook) to use the filtered selector
  3. Updated sorted asset selector to also use the filtered version
  4. All changes include comprehensive test updates

Impact Areas:

  1. Asset Display (SmokeAssets): The primary impact is on how assets are displayed across the wallet - token lists, asset selection, and account balances will no longer show Tron resource tokens in certain contexts
  2. Confirmation Flows (SmokeConfirmationsRedesigned): Send confirmation flows are directly affected as they use useAccountTokens hook which now uses the filtered selector - this changes what assets are available for sending
  3. Tron/Multi-chain (SmokeNetworkExpansion): This is specifically about Tron network resources, part of the new network expansion features

Risk Assessment - Medium:

  • Not touching core controllers or Engine (would be high risk)
  • Changes selector logic that affects multiple UI components
  • Tron is a newer integration, so may have limited E2E coverage but still needs validation
  • The filtered resources should not be sendable anyway, so this is more of a UI cleanup
  • Comprehensive unit tests included, but E2E validation recommended for:
    • Asset list display with Tron accounts
    • Send flows with Tron assets
    • Multi-chain asset switching

Why Not Selected:

  • SmokeWalletPlatform: While assets are wallet-related, this is more specific to asset display filtering
  • SmokeMultiChainAPI: Not API-level changes, UI/selector level
  • Other tags: Not relevant to asset display and Tron functionality

View GitHub Actions results

Copy link

@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.

Bug: selectAsset uses unfiltered assets selector

The selectAsset selector uses selectAssetsBySelectedAccountGroup instead of selectFilteredAssetsBySelectedAccountGroup, bypassing the TRON staked token filtering. This means components using selectAsset to look up specific assets can still retrieve TRON staked tokens that should be filtered out from the send flow, defeating the purpose of this PR.

app/selectors/assets/assets-list.ts#L307-L308

(
_state: RootState,

Fix in Cursor Fix in Web


@sonarqubecloud
Copy link

@Prithpal-Sooriya Prithpal-Sooriya added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit fe2980a Nov 20, 2025
136 of 142 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the ASSETS-1814/filter-tron-staking-tokens branch November 20, 2025 12:24
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2025
@metamaskbot metamaskbot added the release-7.61.0 Issue or pull request that will be included in release 7.61.0 label Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.61.0 Issue or pull request that will be included in release 7.61.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants