fix: wait for approval confirmation before swap on mobile HW#8268
Open
fix: wait for approval confirmation before swap on mobile HW#8268
Conversation
…swap on mobile HW
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
QA on MetaMask Mobile saw approve + swap (two on-chain txs) fail on Monad when using a hardware wallet: the swap step could run before the approval was confirmed, so gas estimation / simulation failed (allowance not set yet).
Problem
On Mobile + HW, approve → swap could run the swap before the approval was confirmed, so gas estimation failed (e.g. Monad).
Fix
If Mobile + HW and an approval tx exists, wait for that tx to confirm before submitting the swap; otherwise unchanged.
Mobile PR (see PR#27615)
Yarn patch on @metamask/bridge-status-controller@68.1.0 so QA can verify and cherry pick happen before a core release bumps the dependency.
References
Related to MetaMask/metamask-mobile#27615
Checklist
Note
Medium Risk
Changes EVM non-batch submission sequencing by blocking on approval confirmation for mobile hardware wallets, which could affect transaction timing and error handling in the submission path. Scope is limited and covered by updated unit tests/snapshots.
Overview
Ensures mobile hardware-wallet non-batch EVM flows don’t submit the swap/bridge transaction until the preceding ERC-20 approval tx is confirmed, preventing gas estimation/simulation from running before on-chain allowance is set.
Updates unit tests and snapshots to assert the new
waitForTxConfirmationbehavior (instead ofhandleMobileHardwareWalletDelay) and documents the fix in the package changelog.Written by Cursor Bugbot for commit 3b78762. This will update automatically on new commits. Configure here.