Skip to content

fix: clear gas sponsorship flag for hardware wallet transactions cp-7.77.0#29262

Merged
dawnseeker8 merged 3 commits into
mainfrom
fix/29241-fix-ledger-paid-by-metamask
May 12, 2026
Merged

fix: clear gas sponsorship flag for hardware wallet transactions cp-7.77.0#29262
dawnseeker8 merged 3 commits into
mainfrom
fix/29241-fix-ledger-paid-by-metamask

Conversation

@dawnseeker8

@dawnseeker8 dawnseeker8 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Description

Hardware wallet (Ledger/QR) transactions on gas-sponsored networks (MON, SEI) incorrectly showed "Paid by MetaMask" in the activity transaction details. The root cause was twofold:

  1. Confirm callback gap: The isGasFeeSponsored override in useTransactionConfirm only ran inside handleSmartTransaction and handleGasless7702, both of which exit early when no selectedGasFeeToken is present — which is always the case for HW wallets since gasless is not supported. The flag was never cleared on the persisted transaction metadata.
  2. Missing UI guard: The activity list TransactionDetails component passed isGasFeeSponsored from stored transaction data without checking if the account is a hardware wallet.

Fix: Moved the isGasFeeSponsored override to the top of onConfirm so it runs unconditionally for every transaction, and added an isHardwareAccount guard in the activity list UI (matching the pattern already used in Bridge TransactionDetails).

Changelog

CHANGELOG entry: Fixed "Paid by MetaMask" incorrectly showing for hardware wallet transactions on gas-sponsored networks

Related issues

Fixes: #29241

Manual testing steps

Feature: Gas sponsorship display for hardware wallets

  Background:
    Given I am logged into MetaMask Mobile
    And I have a Ledger or QR hardware wallet connected

  Scenario: HW wallet send on MON does not show "Paid by MetaMask"
    Given I am connected to the Monad network with a hardware wallet

    When user sends MON to another address
    And user confirms the transaction on the hardware device
    And user navigates to the activity log
    And user selects the completed transaction
    Then the network fee field should show the actual gas fee amount
    And "Paid by MetaMask" should not appear

  Scenario: HW wallet send on SEI does not show "Paid by MetaMask"
    Given I am connected to the Sei network with a hardware wallet

    When user sends SEI to another address
    And user confirms the transaction on the hardware device
    And user navigates to the activity log
    And user selects the completed transaction
    Then the network fee field should show the actual gas fee amount
    And "Paid by MetaMask" should not appear

  Scenario: Non-HW wallet send on sponsored network still shows "Paid by MetaMask"
    Given I am connected to a gas-sponsored network with a software wallet
    And the transaction is eligible for gas sponsorship

    When user sends a transaction
    And user navigates to the activity log
    And user selects the completed transaction
    Then "Paid by MetaMask" should appear in the network fee field

Screenshots/Recordings

Before

N/A

After

N/A

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
Touches transaction confirmation metadata and the activity transaction-details UI; incorrect gating could hide or show sponsorship inappropriately on supported networks, but the change is narrowly scoped and covered by tests.

Overview
Fixes incorrect "Paid by MetaMask" labeling for hardware-wallet transactions by clearing isGasFeeSponsored in useTransactionConfirm whenever gasless isn’t supported, even when no selectedGasFeeToken is present.

Adds a UI guard in TransactionDetails to suppress sponsored-fee display for hardware accounts (based on txParams.from + isHardwareAccount), and extends unit tests to cover both the confirmation override behavior and the hardware-wallet UI suppression.

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

…ponsorship

This update introduces logic to determine if a transaction originates from a hardware wallet, affecting the display of the "Paid by MetaMask" message. The `isGasFeeSponsored` flag is now conditionally set based on whether the transaction is from a hardware wallet, ensuring accurate representation of gas fee sponsorship in transaction details. Additionally, unit tests have been added to verify this behavior for hardware wallets.
@dawnseeker8 dawnseeker8 self-assigned this Apr 23, 2026
@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-be-trade BE Trade team label Apr 23, 2026
@dawnseeker8 dawnseeker8 changed the title fix(confirmations): clear gas sponsorship flag for hardware wallet transactions fix: clear gas sponsorship flag for hardware wallet transactions Apr 23, 2026
@dawnseeker8 dawnseeker8 marked this pull request as ready for review April 28, 2026 11:59
@dawnseeker8 dawnseeker8 requested review from a team as code owners April 28, 2026 11:59
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:

The PR makes two targeted bug fixes related to gas fee sponsorship ("Paid by MetaMask") display:

  1. useTransactionConfirm.ts: Refactored isGasFeeSponsored override logic. Previously, the override was applied inside handleGasless7702 and handleSmartTransaction handlers (only when those paths were taken). Now it's applied unconditionally in onConfirm before branching, ensuring hardware wallets (which skip both handlers) also get the flag cleared. The STX path also no longer gates on !isHardwareWallet since the flag is already cleared upstream.

  2. TransactionDetails/index.js: Added isHardwareAccount check so the "Paid by MetaMask" label is suppressed in the activity/transaction details view for hardware wallet addresses, even if isGasFeeSponsored is true on the transaction object.

SmokeConfirmations: Directly impacted — the confirmation hook useTransactionConfirm is the core of the transaction confirmation flow. Changes to how isGasFeeSponsored is set affect EIP-7702 gasless flows, smart transaction flows, and hardware wallet confirmation paths.

SmokeWalletPlatform: The TransactionDetails component is part of the transaction history/activity list. The "Paid by MetaMask" label display fix affects how completed transactions appear in the wallet activity view.

SmokeAccounts: Hardware wallet accounts (QR-based) are specifically affected by the fix — the change ensures HW wallet transactions don't incorrectly show as gas-sponsored. Tests covering hardware wallet account management and usage should validate this behavior.

No performance impact expected — these are pure logic/display fixes with no rendering loops, list changes, or data loading modifications.

Performance Test Selection:
The changes are targeted bug fixes to gas fee sponsorship logic and a display label check. No performance-sensitive code paths are modified — no list rendering changes, no new data fetching, no state management overhead, no initialization changes. Performance tests are not warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@nikolastoimenovski-consensys

Copy link
Copy Markdown

Tested on Android with HW, works as expected on Sei/Mon on Send, Swap, Swap using dapp, failed Swap, failed Send. Not adding the "qa passed" label until it is tested on iOS.

@owencraston

Copy link
Copy Markdown
Contributor

@dawnseeker8 does this change also fix this bug? #29241

@owencraston

Copy link
Copy Markdown
Contributor

@dawnseeker8 I tested and it does not seem to fix this bug. thats alright, we can perform a follow up fix.

@nikolastoimenovski-consensys

Copy link
Copy Markdown

Adding "qa passed" label. Will test it on iOS after the merge.

@dawnseeker8 dawnseeker8 changed the title fix: clear gas sponsorship flag for hardware wallet transactions fix: clear gas sponsorship flag for hardware wallet transactions cp-7.77.0 May 12, 2026
@dawnseeker8 dawnseeker8 added this pull request to the merge queue May 12, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 12, 2026
@dawnseeker8 dawnseeker8 added this pull request to the merge queue May 12, 2026
Merged via the queue into main with commit fa79ebb May 12, 2026
142 of 144 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/29241-fix-ledger-paid-by-metamask branch May 12, 2026 08:49
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed QA testing has been completed and passed release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-M team-be-trade BE Trade team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Gas sponsorship - "paid by metamask" info is shown on the Send Mon/Sei transaction details

6 participants