-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Swaps tron integration #21294
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
feat: Swaps tron integration #21294
Conversation
|
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. |
georgewrmarshall
left a comment
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.
Approving lint fix on component library file to unblock on behalf of @MetaMask/design-system-engineers
| ### `color` | ||
|
|
||
| Optional prop to configure the color of the BottomSheetOverlay. | ||
|
|
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.
Looks like a linting fix? If you revert this file you will no longer need CO review from @MetaMask/design-system-engineers
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.
Looks like I can't revert this, actually. These cahnges are being forced by the pre-commit hook.
app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx
Outdated
Show resolved
Hide resolved
…ut-non-tradable-assets
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **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. <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Remove non-tradable assets from asset picker ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-3419 ## **Manual testing steps** ```gherkin - 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** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **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] > 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. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 38c4cfc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
6f64970
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21294 +/- ##
==========================================
- Coverage 77.91% 77.91% -0.01%
==========================================
Files 3852 3853 +1
Lines 98566 98653 +87
Branches 19374 19403 +29
==========================================
+ Hits 76801 76866 +65
- Misses 16501 16517 +16
- Partials 5264 5270 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Pull Request is not mergeable



Description
Adds the Tron network to swaps/bridge.
Changelog
CHANGELOG entry: added Tron network support in swaps
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds Tron support to swaps and bridge, filters non‑tradable Tron tokens, updates fee/status handling, defaults, and dependencies.
TrxScope.Mainnetin swaps (isSwapsAllowed) and bridge (ALLOWED_BRIDGE_CHAIN_IDS, network name map).USDTTRC20) indefault-swap-dest-tokens.tsand BIP44 pairs.isTradableTokenutility to exclude Tron resource tokens (Energy,Bandwidth,Max Bandwidth).useTokensnow filters non‑tradable tokens, normalizes non‑EVM addresses, and improves deduping/exclusions.TransactionDetails: safer multichain fee sum (handles partially fungible fees) and unified status selection.@metamask/bridge-controllerand@metamask/bridge-status-controllerto^60.1.0;@metamask/tron-wallet-snapto^1.7.x(lockfile updated).Written by Cursor Bugbot for commit b88a55b. This will update automatically on new commits. Configure here.