Skip to content

fix: tempo useHasInsufficientBalance return false non-7702#28817

Merged
maxime-oe merged 1 commit intomainfrom
feat/tempo-no-7702-fallback
Apr 16, 2026
Merged

fix: tempo useHasInsufficientBalance return false non-7702#28817
maxime-oe merged 1 commit intomainfrom
feat/tempo-no-7702-fallback

Conversation

@maxime-oe
Copy link
Copy Markdown
Contributor

@maxime-oe maxime-oe commented Apr 14, 2026

Description

When signing a tx on Tempo:

  • Before the recent Tempo changes, MetaMask assumed that the native token supply was unlimited (RPC returning a balance of ``424242424242...`, which resulted in a degraded - but working in the right conditions - transaction UX.
  • Now that we’ve defined “no native token for Tempo,” native balance is always seen as 0, since we using a 7702 gasless flow, this has only positive impact on UX.
  • However, since Hardware Wallets aren't supported in our gasless flow, we make those fallback to "normal transactions", which is a problem because MetaMask now sees the native balance as always 0 throwing an error.

The issue is that some hardware wallet users may have already interacted with Tempo before the recent changes. On the current Extension release, those users may not be able to transact on Tempo anymore, making it a regression.

This PR introduces a quick fix, strictly scoped to Hardware Wallets on Tempo chains so it doesn't affect other flows. It modifies useHasInsufficientBalance hook to override balance checks on Tempo, and instead do:

  • If gasless/7702 flow, assume no native balance.
  • If "normal flow" (forced when using a Hardware Wallet), assume unlimited balance (retro-compatibility with how it was before).

Changelog

CHANGELOG entry: useHasInsufficientBalance to skip native balance checks on Tempo

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]

Use Tempo on Mobile, using an Hardware Wallet.
Transactions should be optimistic, showing an estimate of pathUSD gas fees, regardless of user pathUSD balance.

Screenshots/Recordings

Before

After

Pre-merge author checklist

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 the insufficient-balance gating logic used to block transactions; although scoped to Tempo chain IDs, a mistake could incorrectly allow/deny sends on those networks or affect related confirmation alerts.

Overview
Adjusts useHasInsufficientBalance to special-case Tempo mainnet/testnet (0x1079, 0xa5bf) so native-balance insufficiency is driven solely by excludeNativeTokenForFee (treating legacy/non-gasless flows as having sufficient native balance).

Adds unit coverage for the new Tempo behavior, and bumps mobile build numbers to 4519 across Android (versionCode), iOS (CURRENT_PROJECT_VERSION), and Bitrise (VERSION_NUMBER/FLASK_VERSION_NUMBER).

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

@maxime-oe maxime-oe marked this pull request as ready for review April 14, 2026 15:06
@maxime-oe maxime-oe requested a review from a team as a code owner April 14, 2026 15:06
@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.

@metamaskbot metamaskbot added the team-networks Networks team label Apr 14, 2026
@maxime-oe maxime-oe force-pushed the feat/tempo-no-7702-fallback branch from 128a4d3 to 1a71acc Compare April 15, 2026 11:04
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Apr 15, 2026
@metamaskbot metamaskbot requested a review from a team as a code owner April 16, 2026 10:09
@maxime-oe maxime-oe force-pushed the feat/tempo-no-7702-fallback branch from d9eecab to 1a71acc Compare April 16, 2026 10:14
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
The changes modify useHasInsufficientBalance.ts, a hook used in the confirmation flow to determine if a user has insufficient balance for a transaction. The change adds special handling for Tempo chain IDs (0x1079 and 0xa5bf) which are EIP-7702 chains with no native asset - for these chains, the insufficient balance check is now driven by the excludeNativeTokenForFee flag rather than balance comparison. This is a targeted fix for hardware wallet compatibility with the 7702 gasless flow.

The hook is consumed by:

  1. useInsufficientBalanceAlert.ts - generates balance alerts in confirmations
  2. useAutomaticGasFeeTokenSelect.ts - handles gas fee token selection

This directly impacts the confirmation UI for EIP-7702 transactions. SmokeConfirmations explicitly covers "advanced EIP-7702 account abstraction features like batch transactions and gas fee token payments" and "gas fee customization" - making it the most relevant tag. The change is scoped to specific chain IDs and doesn't affect standard EVM confirmation flows, so the risk is medium rather than high. No other feature areas (accounts, identity, network, trade, etc.) are affected by this change.

Performance Test Selection:
The change is a logic fix in a hook that determines insufficient balance state. It does not affect rendering performance, data loading, list rendering, or any UI animation. No performance tests are warranted.

View GitHub Actions results

@maxime-oe
Copy link
Copy Markdown
Contributor Author

force-pushed to get rid of unsollicited metamaskbot commit (version bump)

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
11 value mismatches detected (expected — fixture represents an existing user).
View details

@maxime-oe maxime-oe added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit 8afc798 Apr 16, 2026
338 of 342 checks passed
@maxime-oe maxime-oe deleted the feat/tempo-no-7702-fallback branch April 16, 2026 12:39
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 16, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.74.0 Issue or pull request that will be included in release 7.74.0 label Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.74.0 Issue or pull request that will be included in release 7.74.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-S team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants