Skip to content

fix: hide gas sponsorship badge for hardware wallets in bridge activity details#28584

Open
dawnseeker8 wants to merge 4 commits intomainfrom
fix/hw-gas-sponsorship
Open

fix: hide gas sponsorship badge for hardware wallets in bridge activity details#28584
dawnseeker8 wants to merge 4 commits intomainfrom
fix/hw-gas-sponsorship

Conversation

@dawnseeker8
Copy link
Copy Markdown
Contributor

@dawnseeker8 dawnseeker8 commented Apr 9, 2026

Description

When a hardware wallet (Ledger/QR) user initiates a swap on MON network and rejects signing on the device, the transaction is marked as failed but the isGasFeeSponsored flag on the transaction metadata is never cleared (the confirm callback that clears it only runs on actual confirmation). The BridgeTransactionDetails component then reads evmTxMeta.isGasFeeSponsored directly and incorrectly displays "Paid by MetaMask" in the gas fee field.

This PR adds an isHardwareAccount check in BridgeTransactionDetails so the "Paid by MetaMask" tag is only shown when the sender is not a hardware wallet. This mirrors the existing pattern used in gas-fee-details-row.tsx where gasless support (which excludes HW wallets) is checked before displaying the sponsored fee badge.

Changelog

CHANGELOG entry: Fixed a bug where "Paid by MetaMask" was incorrectly shown in transaction details for failed hardware wallet swaps on MON network

Related issues

Fixes: #28268

Manual testing steps

Feature: Gas sponsorship badge in bridge/swap activity details

  Scenario: Hardware wallet user views a failed swap on MON network
    Given user has a hardware wallet (Ledger or QR) connected
    And user is on the MON network

    When user initiates a swap and rejects signing on the hardware device
    And user opens the failed transaction in the activity log
    Then the gas fee field should show the actual gas fee amount
    And the "Paid by MetaMask" badge should NOT be displayed

  Scenario: Non-hardware wallet user views a sponsored swap transaction
    Given user has a software wallet connected
    And the transaction has isGasFeeSponsored set to true

    When user opens the transaction in the activity log
    Then the "Paid by MetaMask" badge should be displayed in the gas fee field

Screenshots/Recordings

Before

N/A

After

N/A

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

Low Risk
Low risk UI-logic change that only gates rendering of the gas sponsorship badge based on isHardwareAccount, plus focused unit tests; no transaction processing or persistence behavior is modified.

Overview
Prevents the "Paid by MetaMask" badge from being shown in BridgeTransactionDetails when the sender (txParams.from) is a hardware wallet by adding an isHardwareAccount check before rendering the sponsored-fee tag.

Adds unit tests that mock isHardwareAccount to verify the badge is hidden for sponsored hardware-wallet transactions and still shown for sponsored non-hardware transactions.

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

…ty details

The BridgeTransactionDetails component showed "Paid by MetaMask" for
hardware wallet transactions because it checked only
evmTxMeta.isGasFeeSponsored without verifying hardware wallet status.
When a HW user rejects signing, the flag is never cleared by the
confirm callback. Gate the display with an isHardwareAccount check,
mirroring the existing pattern in gas-fee-details-row.

Fixes #28268
@dawnseeker8 dawnseeker8 self-assigned this Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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-be-trade BE Trade team label Apr 9, 2026
@github-actions github-actions bot added the size-M label Apr 9, 2026
@dawnseeker8 dawnseeker8 marked this pull request as ready for review April 9, 2026 03:56
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner April 9, 2026 03:56
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3cdc719. Configure here.

@github-actions github-actions bot added the risk-low Low testing needed · Low bug introduction risk label Apr 9, 2026
@github-actions github-actions bot added size-S risk-medium Moderate testing recommended · Possible bug introduction risk and removed size-M risk-low Low testing needed · Low bug introduction risk labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 86%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are limited to the Bridge TransactionDetails component and its associated unit test (app/components/UI/Bridge/components/TransactionDetails/TransactionDetails.tsx). This component is part of the Bridge flow within the Trade feature. Bridge flows are explicitly covered under SmokeTrade. Since bridge execution requires on-chain transaction confirmations, SmokeTrade must be paired with SmokeConfirmations per the tag dependency rules.

There are no changes to controllers, Engine, network management, onboarding, identity, or multi-chain provider layers. The modification appears UI-scoped to bridge transaction detail rendering and related logic, so the primary risk is regression in bridge execution and confirmation display rather than broader wallet functionality.

Therefore:

  • SmokeTrade ensures swap/bridge flows, quote handling, and completion verification still work.
  • SmokeConfirmations ensures transaction confirmation UI and execution remain stable as bridge flows depend on them.

No other tags are required based on the impacted scope.

Performance Test Selection:
The changes are localized to a single UI component for displaying bridge transaction details and its unit test. There is no indication of changes to rendering-heavy lists, controllers, startup logic, asset loading, or critical performance paths. Therefore, no dedicated performance tests are required.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 9, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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

@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-medium Moderate testing recommended · Possible bug introduction risk size-S team-be-trade BE Trade team

Projects

Status: Needs dev review

Development

Successfully merging this pull request may close these issues.

[Bug]: HW - Gas sponsorship - "paid by metamask" info is shown on the trx details on a failed MON swap

3 participants