Skip to content

Conversation

@runway-github
Copy link
Contributor

@runway-github runway-github bot commented Dec 19, 2025

Description

Staking and unstaking methods connected to the tron-snap:

Screen.Recording.2025-11-19.at.17.51.52.mov

Screenshot 2025-11-19 at 17 54 46
Example:
https://tronscan.org/address/TGXFnQBLAdbdkupHUGSpeBfbxB72hkMsh2#/transaction/85bfd85b620e6a8fc5966458cbfcf3a9757454917f78c36b675e223b68564499

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

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

Adds TRON staking and unstaking flows powered by the Tron Wallet Snap, including UI (stake/unstake, preview, validation), token list inclusion, and selector/util updates for non‑EVM assets.

  • TRON staking/unstaking integration:
    • New hooks useTronStake and useTronUnstake handling validation, confirmation, resource type, and preview via tron-staking-snap.
    • New utils tron-staking-snap (Snap requests) and tron (token building, staked totals, navigation results).
    • New UI TronStakePreview and updated ResourceToggle usage.
  • Earn screens updates:
    • EarnInputView and EarnWithdrawInputView: branch TRON flows (direct confirm, keypad validation, simplified labels), preview rendering, and button disable logic.
    • EarnTokenSelector: choose earnToken vs outputToken based on action.
  • Token list/navigation:
    • EarnTokenList: include native TRX (even with zero balance when enabled); navigate without EVM network switch; sorting updated for TRX.
    • TronStakingButtons: derive base TRX for staking and navigate accordingly.
  • Selectors and data:
    • Extend earn selectors for non‑EVM (TRX) balances/APR, pair lookups use getDecimalChainId.
    • Add selectAccountTokensAcrossChainsUnified and enhance multichain selectors to surface non‑EVM tokens (filter TRON resource assets, non‑mainnet TRON).
  • Utilities/locale:
    • Add normalizeToDotDecimal; constants for TronResourceType.
    • New locale strings for TRON staking/fees.
  • Tests: Comprehensive new/updated tests for hooks, utils, components, and selectors; minor snapshot/expect fixes.

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

5fd9eb9

…22522)

<!--
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**

Staking and unstaking methods connected to the tron-snap:


https://github.com/user-attachments/assets/a7f66644-1a44-4035-9e06-64c2ff71322f

<img width="1323" height="45" alt="Screenshot 2025-11-19 at 17 54 46"
src="https://github.com/user-attachments/assets/9ebe514b-2333-4b0a-ab12-969c48aa22bd"
/>
Example:
https://tronscan.org/address/TGXFnQBLAdbdkupHUGSpeBfbxB72hkMsh2#/transaction/85bfd85b620e6a8fc5966458cbfcf3a9757454917f78c36b675e223b68564499

## **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: null

## **Related issues**

Fixes:

## **Manual testing steps**

```gherkin
Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]
```

## **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**

- [ ] 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).
- [ ] 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](https://jsdoc.app/) format
if applicable
- [ ] 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]
> Integrates TRON staking and unstaking via Snap, updating Earn flows,
lists, and selectors to support TRX with new validation, previews, and
navigation.
> 
> - **TRON staking/unstaking integration**:
> - Add `useTronStake` and `useTronUnstake` hooks for
validation/confirmation via `tron-staking-snap`.
> - New utils: `tron-staking-snap` (Snap RPCs), `tron`
(navigation/result handling, token builder, staked total).
>   - Add `TronStakePreview` UI for fee preview; reuse `ResourceToggle`.
> - **Earn Input/Withdraw flows** (`EarnInputView.tsx`,
`EarnWithdrawInputView.tsx`):
> - Wire TRX validation on keypad input; confirm flows call Snap and
navigate to success/error sheets.
> - Show Tron-specific UI (resource toggle, fee preview) and simplified
button labels; adjust disabled/loading states.
> - Limit gas-cost warning to `isETH` only; debounce validation handler.
> - **Token list and selection**:
> - `EarnTokenList`: include TRX native in deposit list (even with zero
balance when enabled); navigate without EVM network switch; sorting
updated.
> - `EarnTokenSelector`: render output token for withdraw; earn token
for stake.
> - **Selectors and data plumbing**:
> - Support non-EVM (TRX) balances/tokens in earn selectors; default TRX
pooled-staking APR to `0`.
> - Add unified multichain token selector including non-EVM; filter Tron
resource/testnet assets; use `getDecimalChainId`.
> - **Utilities/constants/i18n**:
> - Add `normalizeToDotDecimal`; `TronResourceType` constant; new TRON
strings (fee, success/error copy).
> - **Tests**: Extensive new/updated tests for views, hooks, lists,
buttons, selectors, and utils; snapshot updates.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0989d7f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@runway-github runway-github bot requested a review from a team as a code owner December 19, 2025 18:15
@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 Dec 19, 2025
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeStake, SmokeMultiChainAPI, SmokeNetworkAbstractions, SmokeAssets, SmokeWalletPlatform
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

This PR introduces Tron staking functionality with significant changes to multichain infrastructure and earn/staking features. The changes are well-contained but touch critical areas:

  1. SmokeStake (MUST RUN): Primary tag for this PR as it introduces new Tron staking/unstaking features, modifies stake buttons, and updates the entire earn input/withdrawal flow. The stake test suite should validate the new functionality.

  2. SmokeMultiChainAPI (HIGH PRIORITY): Critical file changed in app/core/Multichain/constants.ts adding TronResourceType enum. The multichain selector changes add unified token selection across EVM and non-EVM chains, which is a core multichain API concern.

  3. SmokeNetworkAbstractions (HIGH PRIORITY): The changes introduce support for non-EVM chains (Tron specifically) with new balance handling, token selection logic, and resource management. This affects the network abstraction layer significantly.

  4. SmokeAssets (RECOMMENDED): Significant updates to token selectors (selectEarnTokens, selectAccountTokensAcrossChainsUnified) that affect how tokens are displayed and their balances calculated across chains. The earn token list and token selector components were modified.

  5. SmokeWalletPlatform (RECOMMENDED): Changes to core wallet selectors and account selection logic, particularly the unified token selector that merges EVM and non-EVM tokens. This could affect core wallet account and token management flows.

NOT selecting:

  • SmokeCore: While Engine is imported, no core Engine changes were made, only usage of Snap utilities
  • SmokeWalletUX: UI changes are specific to staking, not general UX
  • SmokeNetworkExpansion: No new network configuration changes, just utilizing existing Tron support
  • Other tags: Not directly related to the changes

The changes are focused on Tron staking but touch critical multichain infrastructure. Running these 5 tags provides comprehensive coverage of the impacted areas while remaining efficient.

View GitHub Actions results

@joaoloureirop joaoloureirop merged commit 6f59628 into release/7.61.3 Dec 19, 2025
67 of 68 checks passed
@joaoloureirop joaoloureirop deleted the runway-cherry-pick-7.61.3-1766168072 branch December 19, 2025 18:38
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2025
@metamaskbot metamaskbot added the release-7.61.3 Issue or pull request that will be included in release 7.61.3 label Dec 19, 2025
@metamaskbot
Copy link
Collaborator

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

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

Labels

release-7.61.3 Issue or pull request that will be included in release 7.61.3 size-XL 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