Skip to content

Conversation

@fly-1-1
Copy link

@fly-1-1 fly-1-1 commented Nov 3, 2025

Description

This PR fixes currency display issues in transaction display hooks by ensuring the use of chainId-based native currency instead of relying solely on account-based currency.

Problem:
In multi-chain scenarios, the current transaction display logic only relies on account information to determine native currency, which can lead to incorrect currency symbols and conversion rates being displayed on different chains.

Solution:

  • Introduce effectiveNativeCurrency logic in the useCurrencyDisplay hook to prioritize chainId-based native currency
  • Properly pass chainId parameters to related currency display hooks in useTransactionDisplayData
  • Ensure conversion rate calculations are also based on the correct chainId

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed transaction display to use correct chain-specific native currency symbols and conversion rates

Related issues

Fixes:

Manual testing steps

  1. Switch to different blockchain networks (e.g., Ethereum Mainnet, Polygon, etc.)
  2. Initiate a transaction or view transaction history
  3. Verify that the currency symbols displayed in transaction details correspond to the current chain's native currency
  4. Check that conversion rates use the correct chain's rates
  5. Verify currency display consistency in transaction lists and transaction detail pages

Before

image

After

image

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

Ensure currency symbols and conversion rates are resolved by transaction chainId across currency/token display hooks.

  • Hooks: chain-aware currency resolution
    • ui/hooks/useCurrencyDisplay.js:
      • Add effectiveNativeCurrency using chainId (fallback to account native currency).
      • Determine isNativeCurrency with chainId-aware checks.
      • Use chainId-scoped currencyRates to derive effectiveConversionRate.
      • Apply effectiveNativeCurrency/effectiveConversionRate in conversions and ETH display; update memo deps.
    • ui/hooks/useTokenFiatAmount.js:
      • Use chainId-specific market data and tokenConversionRate from currencyRates + networkConfigurationsByChainId.
      • Include formatted in memo deps.
    • ui/hooks/useTransactionDisplayData.js:
      • Derive txChainId and pass to useTokenFiatAmount, useUserPreferencedCurrency (PRIMARY/SECONDARY), and useCurrencyDisplay.
  • Result: Transaction and token displays use correct chain-native symbols and fiat rates.

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 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.

@metamaskbot metamaskbot added external-contributor INVALID-PR-TEMPLATE PR's body doesn't match template labels Nov 3, 2025
@fly-1-1
Copy link
Author

fly-1-1 commented Nov 3, 2025

I have read the CLA Document and I hereby sign the CLA

@fly-1-1 fly-1-1 closed this Nov 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

external-contributor INVALID-PR-TEMPLATE PR's body doesn't match template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants