chore(runway): cherry-pick fix: clear gas sponsorship flag for hardware wallet transactions cp-7.77.0#30023
Merged
Conversation
…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 -->
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. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - PR targets a release branch (release/*) All E2E tests pre-selected. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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:
isGasFeeSponsoredoverride inuseTransactionConfirmonly ran insidehandleSmartTransactionandhandleGasless7702, both of which exit early when noselectedGasFeeTokenis present — which is always the case for HWwallets since gasless is not supported. The flag was never cleared on
the persisted transaction metadata.
TransactionDetailscomponent passed
isGasFeeSponsoredfrom stored transaction datawithout checking if the account is a hardware wallet.
Fix: Moved the
isGasFeeSponsoredoverride to the top ofonConfirmso it runs unconditionally for every transaction, and addedan
isHardwareAccountguard in the activity list UI (matching thepattern 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
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Performance checks (if applicable)
SRPs
to import wallets with many accounts and tokens
performance metrics
trace()for usage andaddTokenfor an example
For performance guidelines and tooling, see the Performance
Guide.
Pre-merge reviewer checklist
app, test code being changed).
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
isGasFeeSponsoredinuseTransactionConfirmwhenever gasless isn’t supported, even when noselectedGasFeeTokenis present.Adds a UI guard in
TransactionDetailsto suppress sponsored-feedisplay for hardware accounts (based on
txParams.from+isHardwareAccount), and extends unit tests to cover both theconfirmation 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.