Skip to content

fix: hide gas sponsorship banner for hardware wallets cp-7.77.0#29898

Merged
dawnseeker8 merged 10 commits into
mainfrom
fix/29870-hw-gas-sponsorship-swap
May 13, 2026
Merged

fix: hide gas sponsorship banner for hardware wallets cp-7.77.0#29898
dawnseeker8 merged 10 commits into
mainfrom
fix/29870-hw-gas-sponsorship-swap

Conversation

@dawnseeker8
Copy link
Copy Markdown
Contributor

@dawnseeker8 dawnseeker8 commented May 8, 2026

Prevent swap quote sponsorship UI from rendering for hardware wallets, including sponsored-quote and insufficient-balance fallback paths, to align MON/SEI behavior with hardware wallet constraints.

Description

This PR has done following change to fix #29870

  • hide the gas sponsorship banner in bridge/swap quote details when the source account is a hardware wallet
  • keep existing sponsorship behavior for non-hardware wallets, including same-chain insufficient-balance fallback logic
  • add regression tests covering hardware-wallet paths where sponsorship previously rendered incorrectly

Changelog

CHANGELOG entry: Prevent swap quote sponsorship UI from rendering for hardware wallets

Related issues

Fixes:

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
Moderate risk because it changes gating logic for gas sponsorship/gasless support based on hardware-wallet detection and adjusts E2E mocking URLs/network flags, which could affect transaction/confirmation flows if misclassified.

Overview
Prevents gas sponsorship UI/eligibility from applying to hardware wallets by gating useShouldRenderGasSponsoredBanner behind useIsHardwareWalletForBridge, covering both sponsored-quote and insufficient-balance fallback paths.

Adds regression coverage ensuring useIsGaslessSupported reports isSupported: false for hardware-wallet senders (both Smart Transactions and EIP-7702 relay paths).

Stabilizes gasless/EIP-7702 E2E mocks by normalizing Sentinel localhost URLs (no trailing slash), adding a 1337 network entry with relay flags, and aligning the sponsored simulation request body/ignore-fields and assertions in gas-fee-tokens-eip-7702-sponsored.spec.ts.

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

Prevent swap quote sponsorship UI from rendering for hardware wallets, including sponsored-quote and insufficient-balance fallback paths, to align MON/SEI behavior with hardware wallet constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner May 8, 2026 08:24
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 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.

@nikolastoimenovski-consensys
Copy link
Copy Markdown

Tested locally on Android with HW, works as expected, the gas sponsorship label doesn't appear for Sei/Mon network on swap or bridge, no matter which amount is entered.

@dawnseeker8 dawnseeker8 changed the title fix(bridge): hide gas sponsorship banner for hardware wallets fix: hide gas sponsorship banner for hardware wallets May 12, 2026
@nikolastoimenovski-consensys
Copy link
Copy Markdown

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

@nikolastoimenovski-consensys nikolastoimenovski-consensys added the QA Passed QA testing has been completed and passed label May 12, 2026
@dawnseeker8 dawnseeker8 changed the title fix: hide gas sponsorship banner for hardware wallets fix: hide gas sponsorship banner for hardware wallets cp-7.77.0 May 12, 2026
GeorgeGkas
GeorgeGkas previously approved these changes May 12, 2026
@dawnseeker8 dawnseeker8 enabled auto-merge May 12, 2026 08:31
dawnseeker8 and others added 4 commits May 12, 2026 18:00
…assertions

- Added a new network configuration for the Localhost (chainID: 1337) in `tx-sentinel-networks-map.ts` to support EIP-7702 relay and gasless confirmation tests.
- Updated the gas fee assertions in `gas-fee-tokens-eip-7702-sponsored.spec.ts` to check for the visibility of the Gas Fees Details component and improved timeout settings for better test reliability.
- Added tests to `useIsGaslessSupported` to handle scenarios where the sender is a hardware wallet, ensuring correct behavior when smart transactions are enabled.
- Updated `gas-fee-tokens-eip-7702-sponsored.spec.ts` to use a dynamic localhost sentinel URL for improved test reliability and consistency across environments.
- Refactored mock requests to align with the new URL structure and added additional fields to the simulation request body for better test coverage.
@dawnseeker8 dawnseeker8 requested a review from a team as a code owner May 13, 2026 08:08
@github-actions github-actions Bot added size-M and removed size-S labels May 13, 2026
Copy link
Copy Markdown
Contributor

@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 1 potential issue.

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 6826b0a. Configure here.

Comment thread tests/smoke/confirmations/transactions/gas-fee-tokens-eip-7702-sponsored.spec.ts Outdated
Avoid double-slash paths when interpolating base into /network and
/smart-transactions/... so mockttp url.includes matching succeeds.
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:

Changes Analysis:

  1. tests/api-mocking/mock-responses/simulations.ts (CRITICAL): Removes trailing slashes from LOCALHOST_SENTINEL_URL. This mock is imported by 11 E2E spec files, all under tests/smoke/confirmations/ — directly affecting SmokeConfirmations tests (contract interactions, token approvals, transfers, EIP-7702 flows).

  2. tests/api-mocking/mock-responses/transaction-relay-mocks.ts (CRITICAL): Same trailing slash URL fix. Used by gas-fee-tokens-eip-7702-sponsored.spec.ts and gas-fee-tokens-eip-7702.spec.ts — both SmokeConfirmations tests.

  3. tests/api-mocking/mock-responses/tx-sentinel-networks-map.ts (CRITICAL): Adds localhost chain 1337 entry to the sentinel networks map. This file is consumed by defaults/index.ts (global default mocks used by all tests) and polymarket-mocks.ts. The addition is specifically required for EIP-7702 relay + gasless confirmation E2E tests (SmokeConfirmations).

  4. tests/smoke/confirmations/transactions/gas-fee-tokens-eip-7702-sponsored.spec.ts (CRITICAL): Direct SmokeConfirmations E2E test. Changes fix URL matching (no trailing slash), add sendBundle: true to mock, add GET /network mock, improve simulation request body matching with SIMULATION_SPONSORED_IGNORE_FIELDS, and add better assertions with explicit timeouts for gas fee rows and MetaMask-sponsored network fee display.

  5. app/components/UI/Bridge/hooks/useShouldRenderGasSponsoredBanner/index.ts: Logic change — gas-sponsored banner is now suppressed for hardware wallet accounts (!isHardwareWallet guard added). This affects the Bridge/Swap UI where gas sponsorship banners are shown, warranting SmokeSwap coverage.

  6. app/components/UI/Bridge/hooks/useShouldRenderGasSponsoredBanner/index.test.ts: Unit test additions for the hardware wallet guard — no direct E2E impact.

  7. app/components/Views/confirmations/hooks/gas/useIsGaslessSupported.test.ts: Unit test additions verifying gasless support is disabled for hardware wallets — no direct E2E impact but validates the confirmation gasless logic.

Tag Selection Rationale:

  • SmokeConfirmations: Primary target — EIP-7702 sponsored gas test directly changed, simulation mocks and relay mocks used by many confirmation tests updated (URL fixes), sentinel networks map updated for localhost relay support.
  • SmokeSwap: Bridge gas-sponsored banner logic changed (hardware wallet exclusion). Per tag description, when selecting SmokeSwap, also select SmokeConfirmations (already included).

No other tags are warranted — changes are scoped to confirmations/EIP-7702 gasless flows and bridge gas-sponsored banner logic.

Performance Test Selection:
No performance-sensitive changes detected. The changes are: (1) E2E test infrastructure fixes (URL normalization, mock data additions), (2) a logic guard in a React hook to suppress a UI banner for hardware wallets, and (3) unit test additions. None of these affect rendering performance, data loading pipelines, app startup, or critical user flow timing in ways that would warrant performance test execution.

View GitHub Actions results

@dawnseeker8 dawnseeker8 requested a review from GeorgeGkas May 13, 2026 08:52
@sonarqubecloud
Copy link
Copy Markdown

@dawnseeker8 dawnseeker8 added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit 289ea6b May 13, 2026
100 checks passed
@dawnseeker8 dawnseeker8 deleted the fix/29870-hw-gas-sponsorship-swap branch May 13, 2026 10:01
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 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 13, 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 - Gas sponsorship label is shown on swap if more than max amount is entered on Mon/Sei

5 participants