Skip to content

chore(runway): cherry-pick fix: clear gas sponsorship flag for hardware wallet transactions cp-7.77.0#30023

Merged
chloeYue merged 1 commit into
release/7.77.0from
runway-cherry-pick-7.77.0-1778576259
May 12, 2026
Merged

chore(runway): cherry-pick fix: clear gas sponsorship flag for hardware wallet transactions cp-7.77.0#30023
chloeYue merged 1 commit into
release/7.77.0from
runway-cherry-pick-7.77.0-1778576259

Conversation

@runway-github

@runway-github runway-github Bot commented May 12, 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
  • See trace() for usage and
    addToken
    for an example

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.

[fa79ebb](https://github.com/MetaMask/metamask-mobile/commit/fa79ebb833816d908e5f97c3e3fc2ca9557ca02c)

…re wallet transactions cp-7.77.0 (#29262)

<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.

In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->

## **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**

```gherkin
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**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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.

<!-- Generated with the help of the pr-description AI skill -->

<!-- CURSOR_SUMMARY -->
---

> [!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.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
60007da. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@runway-github runway-github Bot requested review from a team as code owners May 12, 2026 08:57
@metamaskbotv2 metamaskbotv2 Bot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label May 12, 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.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - PR targets a release branch (release/*)

All E2E tests pre-selected.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@chloeYue chloeYue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@chloeYue chloeYue enabled auto-merge (squash) May 12, 2026 13:21
@chloeYue chloeYue merged commit 72f15ce into release/7.77.0 May 12, 2026
201 of 203 checks passed
@chloeYue chloeYue deleted the runway-cherry-pick-7.77.0-1778576259 branch May 12, 2026 13:38
@github-actions github-actions Bot locked and limited conversation to collaborators May 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-M team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants