Skip to content

feat: add edit gas from cancel/speed up modal #27194

Merged
vinistevam merged 8 commits into
mainfrom
vs/add-edit-gas-cencel-speedup
Mar 20, 2026
Merged

feat: add edit gas from cancel/speed up modal #27194
vinistevam merged 8 commits into
mainfrom
vs/add-edit-gas-cencel-speedup

Conversation

@vinistevam

@vinistevam vinistevam commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the ability to edit gas (network fee) from the cancel/speed up modal before confirming. Users can tap the network fee row to open the gas fee modal, adjust gas, then confirm cancel or speed up. A new context allows the gas modal to operate on the cancel/speed up transaction instead of only the current approval request.

Changes

Cancel/Speed up modal

  • Edit network fee: When the cancel/speed up modal is open, the network fee row shows an edit icon and is tappable. Tapping opens the existing gas fee modal so the user can change gas before confirming.
  • Seeding bump params: When the modal opens, the transaction is updated with suggested bump params via getBumpParamsForCancelSpeedup and updateTransactionGasFees, so the gas modal shows the recommended values when the user taps edit.
  • Single source of truth: useCancelSpeedupGas now takes txId and reads the transaction from the store. Gas edits from the gas modal (via updateTransactionGasFees) are reflected in the cancel/speed up modal.

Gas fee modal transaction context

  • New context: GasFeeModalTransactionProvider and useGasFeeModalTransaction let the gas modal work with a specific transaction id (e.g. the cancel/speed up tx) instead of only the approval request.
  • Metadata hook: useTransactionMetadataRequest uses the context; when transactionId is set (e.g. from cancel/speed up), it uses that id for transaction metadata instead of the approval request id.

useCancelSpeedupGas refactor

  • API: Input changed from { tx, isCancel } to { txId }. Hook reads the transaction with selectTransactionMetadataById(state, txId).
  • Helper: getBumpParamsForCancelSpeedup(tx, isCancel, gasFeeEstimates) is exported and used to compute bump params when the cancel/speed up modal opens.
  • Display: Hook returns params derived from the transaction in the store so the modal reflects any gas changes made in the gas modal.

Cancel / Speed Up + Edit Gas — Flow (Happy Path)

One-line: Pending Tx → Open modal (seed bump) → [Confirm or Edit gas → Confirm] → Submit.

flowchart TB
  A[Pending Tx] --> B[Open Cancel/Speed Up Modal]
  B --> C[Seed bump params]
  C --> D[Show fee, Edit, Confirm]
  D --> E[Confirm]
  D --> F[Edit]
  F --> G[Gas Modal]
  G --> H[Apply]
  H --> D
  E --> I[Submit speed up/cancel]
Loading

Legend

Step What happens
Seed bump params getBumpParamsForCancelSpeedup + updateTransactionGasFees so modal shows suggested fee
Current params From store via useCancelSpeedupGas(txId); updates when user edits in gas modal
Gas Modal Wrapped in GasFeeModalTransactionProvider(transactionId) so it edits the cancel/speedup tx

Data flow (compact)

  • Modal → store: On open, bump params written to tx via updateTransactionGasFees.
  • Gas modal → store: User changes applied via same util; useCancelSpeedupGas reads tx from store, so fee row updates.
  • Confirm: onConfirm(paramsForController) uses whatever is on the tx (default bump or user-edited).

Changelog

CHANGELOG entry: Added edit gas from cancel/speed up modal: users can tap the network fee row to open the gas fee modal and adjust gas before confirming cancel or speed up

Related issues

Fixes: https://github.com/MetaMask/mobile-planning/issues/2419 https://consensyssoftware.atlassian.net/browse/CONF-1007

Manual testing steps

Scenario: User opens cancel/speed up modal and sees editable network fee
  Given the user has a pending transaction
  And the user opens the cancel or speed up modal for that transaction
  Then the modal shows the current network fee (native and fiat)
  And the network fee row shows an edit icon
  And the network fee row is tappable

Scenario: User edits gas from cancel/speed up modal
  Given the user has a pending transaction
  And the user has opened the cancel or speed up modal
  When the user taps the network fee row (or the edit icon)
  Then the gas fee modal opens
  And the gas fee modal shows the suggested bump values for that transaction
  When the user changes gas (e.g. max fee or priority fee) in the gas modal
  And the user confirms or applies in the gas modal
  Then the gas modal closes
  And the cancel/speed up modal shows the updated network fee
  When the user taps the confirm button in the cancel/speed up modal
  Then the cancel or speed up is submitted with the user-edited gas

Screenshots/Recordings

Screencast.from.2026-03-09.11-22-02.webm

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 transaction gas-fee handling by seeding/updating on-chain fee params and routing the gas modal to a different transaction via new context; mistakes could lead to incorrect fee values being applied to cancel/speed-up submissions.

Overview
Adds an editable network fee flow to the cancel/speed up modal: the network fee row becomes tappable (with an edit icon) and opens the existing GasFeeModal to adjust gas before confirming.

When the modal opens, it now seeds bumped gas params onto the pending tx via getBumpParamsForCancelSpeedup + updateTransactionGasFees, and useCancelSpeedupGas is refactored to take a txId and read current gas fields from the store so UI/confirm uses whatever the gas modal last wrote.

Introduces GasFeeModalTransactionProvider/useGasFeeModalTransaction so gas modal internals can target a specific transaction (not just the approval request), and updates useTransactionMetadataRequest to honor this override. Tests are updated/added to cover the new hook API, bump-param helper, and gas modal dismissal when the parent modal closes.

Written by Cursor Bugbot for commit 3d80379. This will update automatically on new commits. Configure here.

@vinistevam vinistevam added the team-confirmations Push issues to confirmations team label Mar 9, 2026
@github-actions

github-actions Bot commented Mar 9, 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.

@vinistevam vinistevam marked this pull request as ready for review March 9, 2026 14:50
@vinistevam vinistevam requested a review from a team as a code owner March 9, 2026 14:50
@github-actions github-actions Bot added the size-L label Mar 9, 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.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@github-actions github-actions Bot added the risk-high Extensive testing required · High bug introduction risk label Mar 18, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-high Extensive testing required · High bug introduction risk labels Mar 18, 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: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
All changes are scoped to the transaction confirmation system under app/components/Views/confirmations, specifically:

  • CancelSpeedupModal component and its tests
  • gas-fee-modal-transaction context
  • useCancelSpeedupGas hook and related types/tests
  • useTransactionMetadataRequest hook

These directly affect transaction confirmation flows, particularly cancel/speed-up transactions and gas fee handling logic. This falls squarely under the SmokeConfirmations coverage, which includes:

  • Transaction sending and confirmations (native + token)
  • Gas fee customization (EIP-1559 and legacy)
  • Advanced transaction handling flows

Cancel and speed-up flows are part of the confirmation and transaction lifecycle, so SmokeConfirmations is required to validate:

  • Confirmation UI rendering
  • Gas fee modal interactions
  • Transaction metadata handling
  • Proper transaction state transitions after speed-up/cancel

No changes touch swaps, perps, predictions, network management, identity, multi-SRP, snaps, card, or ramps, so no additional tags are required.

No Engine or Controller changes were introduced, and scope is limited to confirmation UI/hooks, so broad cross-feature regression risk is moderate but contained within confirmations.

Performance Test Selection:
Changes are limited to confirmation UI components and hooks for gas handling and metadata retrieval. There are no changes to app launch, onboarding, account lists, asset loading, swaps, predictions, or perps rendering paths. No performance-sensitive list rendering or startup logic was modified, so performance tests are not required.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

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

@vinistevam vinistevam added this pull request to the merge queue Mar 20, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 20, 2026
@vinistevam vinistevam added this pull request to the merge queue Mar 20, 2026
Merged via the queue into main with commit 4400225 Mar 20, 2026
100 checks passed
@vinistevam vinistevam deleted the vs/add-edit-gas-cencel-speedup branch March 20, 2026 10:43
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 20, 2026
@metamaskbot metamaskbot added the release-7.72.0 Issue or pull request that will be included in release 7.72.0 label Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.72.0 Issue or pull request that will be included in release 7.72.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-L team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants