Skip to content

chore: filter out Tron staking special assets#26360

Merged
ulissesferreira merged 1 commit into
mainfrom
cursor/tron-additional-assets-34a0
Mar 6, 2026
Merged

chore: filter out Tron staking special assets#26360
ulissesferreira merged 1 commit into
mainfrom
cursor/tron-additional-assets-34a0

Conversation

@ulissesferreira
Copy link
Copy Markdown
Contributor

@ulissesferreira ulissesferreira commented Feb 20, 2026

Description

As part of Tron's staking experience improvements we will be sending more special assets from the Snap to the Extension. These special assets are not tradeable tokens and should be filtered out from selectors like we already do for Staked TRX for example.

This PR:

  • Adds the new special assets that should be ignored by the selectors
  • Renames the variables that deal with this logic to be more inclusive of assets that are not resources (only Energy and Bandwidth are resources)

Changelog

CHANGELOG entry: null

Related issues

Closes: NEB-582, NEB-584, NEB-586

Manual testing steps

All existing Tron functionality should remain unchanged

Screenshots/Recordings

As you can see, the new assets being loaded from the preview build of MetaMask/snap-tron-wallet#226 are not being shown here.

Before

n/a

After

n/a

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards.
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR

Note

Medium Risk
Changes token/asset filtering for Tron by excluding additional Snap-provided “special assets” from sorted asset lists and unified multichain token lists, which could inadvertently hide tokens if symbols collide or filtering is misapplied. Scope is contained to Tron selectors/utilities and related UI consumers, with broad test updates.

Overview
Introduces a broader Tron “special assets” concept (resources + staking lifecycle assets) and filters these virtual tokens out of user-facing asset/token lists.

Renames and expands the Tron selector from selectTronResourcesBySelectedAccountGroup to selectTronSpecialAssetsBySelectedAccountGroup (and TronResourcesMap to TronSpecialAssetsMap), adding mappings for trxReadyForWithdrawal, trxStakingRewards, and trxInLockPeriod while preserving totalStakedTrx computation.

Centralizes special-asset detection in core/Multichain/utils via isTronSpecialAsset and reuses it in selectSortedAssetsBySelectedAccountGroup, selectAccountTokensAcrossChainsUnified, and Bridge isTradableToken; updates related Earn/TokenDetails/AssetOverview hooks and tests accordingly.

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

@cursor
Copy link
Copy Markdown
Contributor

cursor Bot commented Feb 20, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@metamaskbot metamaskbot added the team-networks Networks team label Feb 20, 2026
@ulissesferreira ulissesferreira changed the title Tron additional assets Support Tron's staking lifecycle assets Feb 20, 2026
@ulissesferreira ulissesferreira changed the title Support Tron's staking lifecycle assets feat: support Tron's staking lifecycle assets Feb 20, 2026
@ulissesferreira ulissesferreira changed the title feat: support Tron's staking lifecycle assets feat: support Tron's complete staking lifecycle assets Feb 20, 2026
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Feb 20, 2026
@github-actions github-actions Bot added size-L and removed size-M labels Feb 20, 2026
@cursor cursor Bot force-pushed the cursor/tron-additional-assets-34a0 branch 2 times, most recently from fb394aa to 5e00ccb Compare March 2, 2026 17:37
@ulissesferreira ulissesferreira changed the title feat: support Tron's complete staking lifecycle assets chore: filter out Tron staking special assets Mar 3, 2026
@ulissesferreira ulissesferreira force-pushed the cursor/tron-additional-assets-34a0 branch 2 times, most recently from 494bf95 to 37534d4 Compare March 3, 2026 15:27
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 3, 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.

@ulissesferreira ulissesferreira force-pushed the cursor/tron-additional-assets-34a0 branch 11 times, most recently from fc35db3 to ca1b934 Compare March 4, 2026 12:05
@ulissesferreira ulissesferreira marked this pull request as ready for review March 4, 2026 12:06
@ulissesferreira ulissesferreira requested review from a team as code owners March 4, 2026 12:06
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/Earn/components/EarnBalance/EarnBalance.test.tsx
@ulissesferreira ulissesferreira force-pushed the cursor/tron-additional-assets-34a0 branch from ca1b934 to 1607599 Compare March 4, 2026 12:36
@ulissesferreira ulissesferreira force-pushed the cursor/tron-additional-assets-34a0 branch from 1607599 to 893e98a Compare March 4, 2026 13:05
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeNetworkExpansion
  • Selected Performance tags: @PerformanceAssetLoading
  • Risk Level: medium
  • AI Confidence: 75%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a refactoring that renames Tron resource constants to "Tron special assets" and adds three new special asset types (TRX_READY_FOR_WITHDRAWAL, TRX_STAKING_REWARDS, TRX_IN_LOCK_PERIOD) that should be filtered out from user-facing asset lists.

Key Changes:

  1. Core Multichain constants/utils: Renamed TRON_RESOURCE to TRON_SPECIAL_ASSET_SYMBOLS, added new asset types, and created isTronSpecialAsset() utility function
  2. Asset selectors: Updated selectSortedAssetsBySelectedAccountGroup and selectTronSpecialAssetsBySelectedAccountGroup to filter out the new special assets
  3. Bridge/Swap: Updated isTradableToken to use the new utility function for filtering non-tradable Tron assets
  4. Earn components: Updated to use renamed selectors for Tron staking/unstaking flows

Tag Selection Rationale:

  • SmokeTrade: The isTradableToken function used in Bridge/Swap token selection is modified. This ensures Tron special assets are properly filtered from swap/bridge token lists.
  • SmokeNetworkExpansion: Tron is a non-EVM chain, and these changes affect how Tron assets are handled in the multi-chain architecture.

Not Selected:

  • SmokeConfirmations: The only Tron-related test is skipped, and the changes don't directly affect confirmation flows
  • SmokeAccounts: No account management changes
  • Other tags: Changes are Tron-specific and don't affect other features

The changes are primarily internal refactoring with consistent behavior - the filtering logic is being consolidated and extended to cover more Tron special asset types.

Performance Test Selection:
The changes modify selectSortedAssetsBySelectedAccountGroup selector which is used for asset list rendering. A new filter operation is added to filter out Tron special assets. While this is a minor change (adding a filter call), it affects the asset loading path which could have marginal performance implications. Running @PerformanceAssetLoading will verify that asset list rendering performance is not degraded by the additional filtering logic.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 4, 2026

ulissesferreira added a commit to MetaMask/snap-tron-wallet that referenced this pull request Mar 5, 2026
## Explanation

Tweak the symbols to match both
MetaMask/metamask-extension#40540 and
MetaMask/metamask-mobile#26360

## References

n/a

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
- [x] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
@ulissesferreira ulissesferreira added this pull request to the merge queue Mar 6, 2026
Merged via the queue into main with commit c3d9fe3 Mar 6, 2026
202 of 204 checks passed
@ulissesferreira ulissesferreira deleted the cursor/tron-additional-assets-34a0 branch March 6, 2026 10:35
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 6, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-L team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants