Skip to content

Conversation

@zone-live
Copy link
Contributor

@zone-live zone-live commented Dec 4, 2025

Description

Fixes incorrect fiat values for Tron (non-EVM chains) in stake/unstake input views by using multichain asset rates instead of EVM-based conversion rates. It uses uses selectMultichainAssetsRates to get the correct token to fiat rate for the non-EVM chains.

Screenshot 2025-12-04 at 10 58 37 Screenshot 2025-12-04 at 10 59 45 Screenshot 2025-12-04 at 11 00 05 Screenshot 2025-12-04 at 11 23 35

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 multichain (non‑EVM) fiat conversion support to Earn input/withdraw flows via a new hook and updates analytics to correctly format chain IDs.

  • Earn input/withdraw flows (multichain support):
    • Introduce useMultichainInputHandlers to compute fiat/token amounts and toggle values for non‑EVM chains using selectMultichainAssetsRates and isNonEvmChainId.
    • Integrate the hook into useEarnInput and useEarnWithdrawInput; preserve typed fiat, clear on mode changes/quick amounts/max, and compute balance values with multichain rates.
    • Refine over‑maximum checks and ETH gas‑loading behavior to avoid flicker; add clearNonEvmTypedFiatValue and use in handleMax.
  • Analytics:
    • Add formatChainIdForAnalytics util and use it in currency switch events in EarnInputView and EarnWithdrawInputView.
  • Input handling:
    • Improve keypad NaN handling for initial period/digit input in useInput.
  • Tests:
    • Add comprehensive tests for non‑EVM flows (useMultichainInputHandlers.test, expanded earn input/withdraw tests) and update mocks for multichain rates.
  • Localization:
    • Tweak TRON bandwidth description copy in en.json.

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

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 github-actions bot added the size-L label Dec 4, 2025
@zone-live zone-live marked this pull request as ready for review December 4, 2025 13:50
@zone-live zone-live requested a review from a team as a code owner December 4, 2025 13:50
@github-actions github-actions bot added size-XL and removed size-L labels Dec 4, 2025
@MetaMask MetaMask deleted a comment from codecov-commenter Dec 5, 2025
@zone-live zone-live requested a review from Matt561 December 5, 2025 11:37
@MetaMask MetaMask deleted a comment from codecov-commenter Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeStake
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

The changes are specifically focused on the Earn/Staking functionality:

  1. New multichain input handlers (useMultichainInputHandlers.ts) - Adds non-EVM chain support (Tron, Solana) for the Earn input views, handling fiat conversion using multichain asset rates.

  2. Modified stake input hooks - Both useEarnInput.ts and useEarnWithdrawInput.ts now integrate the multichain handlers to support non-EVM chains.

  3. Input validation fix - Minor fix in useInput.ts for keypad change validation.

  4. Analytics formatting - New utility formatChainIdForAnalytics ensures proper chain ID formatting for analytics tracking.

  5. View updates - EarnInputView.tsx and EarnWithdrawInputView.tsx use the new analytics formatter.

  6. Locale update - Minor text change in TRX staking description.

All changes are well-contained within the Earn/Staking module with comprehensive unit tests. The risk is medium because:

  • The changes affect input handling which is critical for transaction amounts
  • Multiple components are modified but they are all related
  • Good unit test coverage reduces risk
  • No changes to core infrastructure or controllers

The SmokeStake tag is the most appropriate for these Earn/Staking related changes. While the existing stake E2E test uses SmokeTrade, the actual feature area is staking.

View GitHub Actions results

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 5, 2025

@zone-live zone-live added this pull request to the merge queue Dec 9, 2025
Merged via the queue into main with commit 84125c3 Dec 9, 2025
158 of 161 checks passed
@zone-live zone-live deleted the NWNT-766-support-fiat-values branch December 9, 2025 18:56
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2025
@metamaskbot metamaskbot added the release-7.62.0 Issue or pull request that will be included in release 7.62.0 label Dec 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.62.0 Issue or pull request that will be included in release 7.62.0 size-XL team-new-networks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants