Skip to content

Conversation

@GeorgeGkas
Copy link
Contributor

@GeorgeGkas GeorgeGkas commented Nov 11, 2025

Description

Tron Snap currently treats 'energy' and 'bandwidth' as assets, which causes them to appear in asset lists, including the Swaps asset pickers. Since these are not tradeable assets, we need to implement filtering on the asset pickers to exclude them from the UI. We ensure that 'energy' and 'bandwidth' are not displayed in asset pickers where tradeable assets are expected.

Changelog

CHANGELOG entry: Remove non-tradable assets from asset picker

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3419

Manual testing steps

- Ensure `Energy`, `Bandwidth` and `Max bandwidth` tokens are not rendered in asset picker.
- Ensure that all tokens excepts the one mentioned above are still there.

Screenshots/Recordings

Before

After

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

Filters Tron resource tokens (Energy, Bandwidth, Max Bandwidth) from bridge token lists and adds comprehensive tests, including non-EVM address normalization and edge cases.

  • Bridge Utils:
    • Add isTradableToken utility to exclude Tron resource tokens (Energy, Bandwidth, Max Bandwidth) on TrxScope.Mainnet.
  • Hook (useTokens):
    • Filter non-tradable tokens via isTradableToken when building tokensWithoutBalance, allTokens, and tokensToRender.
  • Tests:
    • Expand useTokens.test.ts to cover:
      • Non-EVM address normalization via formatAddressToAssetId and error on empty normalization.
      • Filtering of Tron non-tradable tokens across tokensWithBalance, topTokens, and remainingTokens.
      • Deduplication/combination logic and handling of undefined/null arrays and exclusions.
    • Add unit tests for isTradableToken with Tron and non-Tron scenarios.

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

@GeorgeGkas GeorgeGkas requested a review from a team as a code owner November 11, 2025 08:57
@GeorgeGkas GeorgeGkas added the team-swaps-and-bridge Swaps and Bridge team label Nov 11, 2025
@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.

@GeorgeGkas GeorgeGkas requested a review from bfullam November 11, 2025 17:05
@github-actions github-actions bot added size-L and removed size-M labels Nov 12, 2025
@sonarqubecloud
Copy link

@bfullam bfullam merged commit 6f64970 into swaps-tron-integration Nov 12, 2025
145 of 147 checks passed
@bfullam bfullam deleted the swaps-3419-filter-out-non-tradable-assets branch November 12, 2025 13:13
@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-L team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants