feat: display a warning when gas sponsorship failed#39284
Merged
Julink-eth merged 27 commits intomainfrom Feb 4, 2026
Merged
Conversation
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
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (3 files, +321 -0)
|
ui/pages/confirmations/hooks/alerts/transactions/useGasSponsorshipWarningAlerts.test.ts
Outdated
Show resolved
Hide resolved
ui/pages/confirmations/hooks/alerts/transactions/useGasSponsorshipWarningAlerts.test.ts
Show resolved
Hide resolved
Contributor
Builds ready [513723d]
UI Startup Metrics (1269 ± 111 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
4 tasks
github-merge-queue bot
pushed a commit
to MetaMask/core
that referenced
this pull request
Jan 26, 2026
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Sentinel API often returns the real failure reason in callTrace.error, not the top‑level error. Without exposing this, the UI can’t show chain‑specific warnings (e.g., Monad’s reserve balance rule for sponsored transaction). This PR allows to extract call‑trace errors into simulationData.callTraceErrors and make call‑trace fields optional to match the API. The clients can display chain‑specific explanations instead of generic “reverted”. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> Related Extension PR: MetaMask/metamask-extension#39284 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [x] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds visibility into simulation failures and aligns types with API responses. > > - Extracts errors from `callTrace` (including nested calls) and returns them in `simulationData.callTraceErrors`; propagates in both success and error paths > - Relaxes `SimulationResponseCallTrace` fields (`calls`, `logs`) to be optional/nullable; adds optional `error` > - Refactors balance change parsing to use a cached `transactionResponse` and include `callTraceErrors`; updates tests accordingly > - Updates `SimulationData` type and changelog > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 73af06e. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net>
ui/pages/confirmations/hooks/alerts/transactions/useGasSponsorshipWarningAlerts.ts
Outdated
Show resolved
Hide resolved
Contributor
Builds ready [8acdef6]
UI Startup Metrics (1337 ± 121 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Contributor
Builds ready [367e4e3]
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Contributor
Builds ready [9f22492]
UI Startup Metrics (1350 ± 89 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
ui/pages/confirmations/hooks/alerts/transactions/useGasSponsorshipWarningAlerts.ts
Outdated
Show resolved
Hide resolved
Contributor
Builds ready [2a7a9ff]
UI Startup Metrics (1376 ± 86 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
…he mobile implementation
Contributor
Builds ready [ccbc054]
UI Startup Metrics (1395 ± 98 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
OGPoyraz
approved these changes
Feb 4, 2026
pedronfigueiredo
approved these changes
Feb 4, 2026
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
Context
Gas sponsorship on certain networks (like Monad) has reserve balance requirements. When a transaction simulation fails due to reserve balance violations, users currently don't receive clear feedback about why sponsorship isn't available.
Problem
Users on networks with gas sponsorship reserve requirements (e.g., Monad requires 10 MON minimum) don't see any warning when their transaction can't be sponsored due to insufficient reserve balance.
Solution
Added a new useGasSponsorshipWarningAlerts hook that:
Checks simulationData.callTraceErrors for known sponsorship failure patterns
Uses a configurable rules system (GAS_SPONSORSHIP_WARNING_RULES) to match chain-specific error patterns
Displays a Severity.Warning alert on the EstimatedFee row when sponsorship fails due to reserve balance violations
Currently configured for Monad (10 MON minimum reserve requirement)
Related Core PR : MetaMask/core#7641
Changelog
CHANGELOG entry: Added a warning message when gas sponsorship is unavailable due to reserve balance requirements.
Related issues
Fixes:
Manual testing steps
Pre-requisite:
Use the dev sentinel API in:
const BASE_URL = 'https://tx-sentinel-{0}.dev-api.cx.metamask.io/';const BASE_URL = 'https://tx-sentinel-{0}.dev-api.cx.metamask.io/';Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds new confirmation alert logic driven by simulation
callTraceErrorsand chain-specific rules; risk is moderate because it changes user-facing warnings and depends on simulation error strings and gasless-support detection.Overview
Displays a new warning alert on the confirmation screen when gas sponsorship is unavailable due to reserve-balance requirements.
Adds
useGasSponsorshipWarningAlerts, which matches chain-specificsimulationData.callTraceErrorspatterns (initially forCHAIN_IDS.MONAD) and injects anEstimatedFeewarning when gasless is supported but the tx is not sponsored.Introduces new i18n strings for the alert reason and message (with min balance + native currency placeholders), adds unit tests + Jest console baseline, and bumps
@metamask/transaction-controllerto^62.11.0.Written by Cursor Bugbot for commit ccbc054. This will update automatically on new commits. Configure here.