Skip to content

fix: display non ETH native transactions in the native token detail page#28977

Merged
maxime-oe merged 1 commit into
mainfrom
fix/token-detail-transactions-gas-fees-sponsored
May 5, 2026
Merged

fix: display non ETH native transactions in the native token detail page#28977
maxime-oe merged 1 commit into
mainfrom
fix/token-detail-transactions-gas-fees-sponsored

Conversation

@Battambang

@Battambang Battambang commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request refines the transaction filtering logic for native and token assets. It adds comprehensive unit tests for the useTokenTransactions hook. The most important changes are:

Filtering Logic:

  • Updated the filter selection in useTokenTransactions.ts to use an isNativeToken check, ensuring that native tokens (including non-ETH chains) use the correct transaction filter. This prevents token-category transactions from appearing in native token views and vice versa.

Testing:

  • Added a new test suite useTokenTransactions.test.ts that covers various scenarios for native tokens (ETH and non-ETH like MON), ERC20 tokens, cross-chain filtering, and edge cases (such as gas-sponsored native sends and exclusion of unrelated transactions). This ensures robust regression coverage and correct behavior for transaction filtering.

These changes improve both the reliability of the useTokenTransactions hook and confidence in its behavior through targeted unit tests.

Changelog

CHANGELOG entry: add transactions in the token details for gas fees sponsored transactions

Related issues

Fixes: #27247 [Bug]: Gas Sponsored Send and Swap are not displayed on the Activity section of the Token details page

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

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Medium Risk
Changes transaction filtering logic in useTokenTransactions for native vs token assets, which can impact what users see in token detail activity across chains. Risk is mitigated by a new unit test suite covering native/non-native and cross-chain scenarios.

Overview
Fixes useTokenTransactions filter selection to treat any native asset (asset.isNative or asset.isETH) as using the native/ethFilter, instead of keying off symbol/address (which could hide non-ETH native transactions).

Adds a comprehensive useTokenTransactions.test.ts suite that regression-tests native-token vs ERC20 filtering (including gas-sponsored/zero-fee native sends), exclusion of token-category txs from native views, and cross-chain exclusion.

Reviewed by Cursor Bugbot for commit 49c9f74. Bugbot is set up for automated code reviews on this repo. Configure here.

@Battambang Battambang requested a review from a team as a code owner April 17, 2026 14:28
@github-actions

Copy link
Copy Markdown
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.

@metamaskbotv2 metamaskbotv2 Bot added the team-networks Networks team label Apr 17, 2026
@github-actions github-actions Bot added size-M risk-low Low testing needed · Low bug introduction risk labels Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are a targeted bug fix in useTokenTransactions.ts that corrects the filter logic for displaying transactions in the Token Details view.

What changed: The old logic used navSymbol !== 'ETH' && navAddress !== '' to determine which transaction filter to apply. This was broken for non-ETH native tokens (e.g., MON on Monad) because it would incorrectly apply the ERC-20 token filter instead of the native token filter. The fix uses asset.isNative || asset.isETH to properly identify native tokens.

Impact: This affects the transaction history display in the Token Details / Asset Overview screen. The useTokenTransactions hook is consumed by TokenDetails.tsx, which is part of the asset overview flow. Transaction history display is covered by SmokeWalletPlatform (which tests "displaying incoming/outgoing ETH transactions, token transfer details").

Risk level: Low - this is a focused bug fix with accompanying unit tests. No architectural changes, no controller changes, no shared infrastructure changes. The fix is well-scoped and the new test file validates the corrected behavior.

No other tags needed: The change doesn't touch confirmations, swaps, accounts, network management, or any other feature areas covered by other tags.

Performance Test Selection:
This change is a filter logic fix in a hook that determines which transactions to display. It does not affect rendering performance, data loading, list rendering, or any performance-sensitive code paths. No performance tests are warranted.

View GitHub Actions results

@Battambang Battambang marked this pull request as draft April 17, 2026 14:31
@github-actions

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
12 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

Copy link
Copy Markdown

@maxime-oe maxime-oe marked this pull request as ready for review May 5, 2026 13:54
@maxime-oe maxime-oe added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit f3a256d May 5, 2026
123 checks passed
@maxime-oe maxime-oe deleted the fix/token-detail-transactions-gas-fees-sponsored branch May 5, 2026 14:26
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk-low Low testing needed · Low bug introduction risk size-M team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gas Sponsored Send and Swap are not displayed on the Activity section of the Token details page

3 participants