fix: swap tx fails when smart account upgrade is required#9431
Merged
Conversation
SteP-n-s
approved these changes
Jul 8, 2026
This was referenced Jul 8, 2026
Closed
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
Problem
There has been a spike in swap tx failures with this error:
Gas fee token not found and insufficient native balanceCause
The error happens when STX is enabled, account has not been upgraded, and the user receives a
gasIncluded=7702quote. During the submission flow, passinggasFeeToken,skipInitialGasEstimate, andexcludeNativeTokenForFeeas addTransactionBatch params causescheckGasFeeTokenBeforePublishto throw the error.Solution
Remove the parameters from the batch-strategy so
checkGasFeeTokenBeforePublishreturns earlyRepro steps (extension, Base network)
Expected behavior
The TransactionController should upgrade the account to a smart account and submit the swap transactions in a single contract interaction
References
N/A
Related to
Checklist
Note
Medium Risk
Touches live swap/bridge batch submission and reverses gas-fee batch options added in 72.0.1 for this path only; batch-sell behavior is unchanged but ERC20-fee batch swaps may behave differently.
Overview
Fixes swap submission failures (
Gas fee token not found and insufficient native balance) when smart transactions are on, the account is not yet upgraded, and the quote isgasIncluded7702.The batch strategy (
batch-strategy.ts) no longer derives or forwardsgasFeeToken,skipInitialGasEstimate, orexcludeNativeTokenForFeeintogetAddTransactionBatchParams/addTransactionBatch, so TransactionController’scheckGasFeeTokenBeforePublishcan bail out instead of rejecting the batch. Related FeeType / isNativeAddress logic is removed from that path. Tests and snapshots are updated to match the slimmer batch params; batch-sell still sets those options separately.Reviewed by Cursor Bugbot for commit e407fb9. Bugbot is set up for automated code reviews on this repo. Configure here.