Skip to content

fix: sponsored hardware wallet send max native#29864

Merged
maxime-oe merged 1 commit into
mainfrom
fix/sponsored-hw-send-max-native
May 20, 2026
Merged

fix: sponsored hardware wallet send max native#29864
maxime-oe merged 1 commit into
mainfrom
fix/sponsored-hw-send-max-native

Conversation

@maxime-oe

@maxime-oe maxime-oe commented May 7, 2026

Copy link
Copy Markdown
Contributor

Description

On sponsored networks, the "send max native" feature wrongly tries to send 100% of user's balance on Hardware Wallets despite Gas Sponsorship being disabled for those. This creates an out of gas situation.
The PR restores the legacy behavior of the "max" button for such specific cases (HW + gas sponsorship + send max native).

Changelog

CHANGELOG entry: sponsored hardware wallet send max native

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/NEB-1132?atlOrigin=eyJpIjoiYjFiZWVkNWJlMTI5NDk5NmE4OTA2NTM5NjkzM2RlMzQiLCJwIjoiaiJ9

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]
  1. Use a HW wallet account - ex: QR Code wallet
  2. Go on SEI token page on SEI network
  3. Click on "Send"
  4. Click on the "max" / "100%" button
  5. Continue to Confirmation view. Notice that no error appear and that the tx executes without sponsorship.

Non-reg on regular accounts to check that sending max on SEI still sends the full balance - not Monad because of the 10 MON constraint.

Screenshots/Recordings

Before

Screenshot_2026-05-07-16-09-18-393_io metamask

After

Screenshot_2026-05-07-16-08-45-146_io metamask

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
Changes fee and max-send calculations for gas sponsorship, which can affect how much users attempt to send and what fees are displayed; incorrect logic could reintroduce out-of-gas or under-send behavior on sponsored networks.

Overview
Updates gas sponsorship handling to only apply when the app confirms gasless/sponsorship is actually supported.

In useFeeCalculations, sponsored transactions now show 0 fees only when useIsGaslessSupported().isSupported is true; otherwise normal fee/max-fee computation is used, with tests covering both cases.

In usePercentageAmount, hardware-wallet accounts are treated as not gas-sponsored even on sponsored networks, restoring legacy “send max native” behavior (subtracting estimated gas) to prevent out-of-gas sends; tests add coverage for the HW-sponsored-network scenario.

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

@github-actions github-actions Bot added the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 7, 2026
@metamaskbotv2 metamaskbotv2 Bot added the team-networks Networks team label May 7, 2026
@github-actions

github-actions Bot commented May 7, 2026

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 github-actions Bot added the size-S label May 7, 2026
@maxime-oe maxime-oe marked this pull request as ready for review May 7, 2026 14:15
@maxime-oe maxime-oe requested a review from a team as a code owner May 7, 2026 14:15
@maxime-oe maxime-oe removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 7, 2026

@cursor cursor Bot 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.

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 361be96. Configure here.

Comment thread app/components/Views/confirmations/hooks/gas/useFeeCalculations.ts
@maxime-oe maxime-oe force-pushed the fix/sponsored-hw-send-max-native branch from 2167a71 to 9d8f577 Compare May 18, 2026 12:53
@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:

The PR modifies two confirmation hooks:

  1. useFeeCalculations.ts: Adds useIsGaslessSupported hook integration to gate gas fee sponsorship. Previously, transactionMeta.isGasFeeSponsored alone would trigger zero-fee display. Now requires BOTH isGasFeeSponsored AND isGaslessSupported to be true (isSponsorshipEnabledForTx). This affects estimated fee and max fee calculations in transaction confirmations — directly impacting gasless swap flows and EIP-7702 sponsored transactions.

  2. usePercentageAmount.ts: Adds hardware wallet detection to gas sponsorship logic. Hardware wallet accounts are now excluded from gas sponsorship when calculating max send amounts. This affects the send flow's "max amount" calculation when gas is sponsored on a network.

SmokeConfirmations is selected because:

  • Both hooks are core to the confirmation flow
  • Gas fee display changes affect all transaction confirmations
  • Send amount calculations affect native token send confirmations
  • Gasless/sponsored transaction behavior is tested in SmokeConfirmations

SmokeSwap is selected because:

  • Gasless swaps are a key feature tested in SmokeSwap
  • The useFeeCalculations change directly affects how gasless swap fees are displayed
  • Per tag description: "gasless swaps" are covered by SmokeSwap

No other tags are needed — the changes are scoped to gas fee calculation hooks within the confirmations domain and don't touch browser, accounts, network management, staking, identity, or other areas.

Performance Test Selection:
The changes are to React hooks for gas fee calculations and send amount logic. These are business logic hooks, not UI rendering components, list rendering, or app initialization code. The changes don't affect rendering performance, data loading pipelines, or critical startup flows. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@maxime-oe maxime-oe added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit 00ed9ea May 20, 2026
207 of 213 checks passed
@maxime-oe maxime-oe deleted the fix/sponsored-hw-send-max-native branch May 20, 2026 13:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-S team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants