Skip to content

fix: swap tx fails when smart account upgrade is required#9431

Merged
micaelae merged 3 commits into
mainfrom
swaps-fix-gas-fee-token-not-found
Jul 8, 2026
Merged

fix: swap tx fails when smart account upgrade is required#9431
micaelae merged 3 commits into
mainfrom
swaps-fix-gas-fee-token-not-found

Conversation

@micaelae

@micaelae micaelae commented Jul 8, 2026

Copy link
Copy Markdown
Member

Explanation

Problem

There has been a spike in swap tx failures with this error: Gas fee token not found and insufficient native balance

Cause

The error happens when STX is enabled, account has not been upgraded, and the user receives a gasIncluded=7702 quote. During the submission flow, passing gasFeeToken, skipInitialGasEstimate, and excludeNativeTokenForFee as addTransactionBatch params causes checkGasFeeTokenBeforePublish to throw the error.

Solution

Remove the parameters from the batch-strategy so checkGasFeeTokenBeforePublish returns early

Repro steps (extension, Base network)

  1. if running extension locally, set the BRIDGE_API_BASE_URL to the prod bridge-api
  2. enable smart transactions
  3. disable smart account for Base
  4. not sure if this matters but I have < $.02 of ETH in the account
  5. try to get a swap gasIncluded7702 quote for which the txFee is an ERC20 token (i.e, base:USDC to base:USDT)
  6. submit the trade and the error appears in the console
  7. no transactions are published on-chain, account does not get upgraded

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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

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 is gasIncluded7702.

The batch strategy (batch-strategy.ts) no longer derives or forwards gasFeeToken, skipInitialGasEstimate, or excludeNativeTokenForFee into getAddTransactionBatchParams / addTransactionBatch, so TransactionController’s checkGasFeeTokenBeforePublish can 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.

@micaelae micaelae marked this pull request as ready for review July 8, 2026 17:23
@micaelae micaelae requested review from a team as code owners July 8, 2026 17:23
@micaelae micaelae enabled auto-merge July 8, 2026 17:23
@micaelae micaelae temporarily deployed to default-branch July 8, 2026 17:24 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants