fix(gasless): use quote gas fees for Max native swap with STX off#7306
Merged
Conversation
micaelae
previously approved these changes
Dec 3, 2025
micaelae
approved these changes
Dec 3, 2025
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.
Fix MAX native token swap failing with "insufficient gas" when STX is off
Problem
When performing a MAX native token swap (e.g., MAX ETH → USDC on Base) with:
gasIncluded: truein the quotegasIncluded7702: falseThe transaction failed with "insufficient gas" error.
Root cause: The quote provides pre-calculated gas fees in
feeData.txFee(because the gas cost is included in the swap amount), but the single transaction path was re-estimating gas instead of using the quote's values. This re-estimation fails for MAX swaps because it doesn't account for the gas already deducted from the swap value.Solution
Updated
#handleEvmTransactionand#calculateGasFeesinbridge-status-controller.tsto accept and use the quote'stxFeewhengasIncluded: true:txFeefrom the quote when calling#handleEvmTransactionforgasIncludedcases#calculateGasFeeswhentxFeeis providedChanges
bridge-status-controller.ts:#handleEvmTransactionnow accepts optionaltxFeeparameter#calculateGasFeesuses providedtxFee(converted to hex) instead of estimating when availabletxFeewhengasIncluded: truein thesubmitTxflowTests Added
should use quote txFee when gasIncluded is true and STX is off (Max native token swap)should estimate gas when gasIncluded is false and STX is offshould use batch path when gasIncluded7702 is true regardless of STX settingReferences
Checklist
Note
Use quote-provided txFee for gas-included EVM swaps (non-STX) to prevent insufficient gas on MAX native swaps; add tests and update changelog.
txFeein#handleEvmTransactionand pass it fromsubmitTxwhenquote.gasIncludedis true.#calculateGasFees, use quotetxFee(convert decimal strings to hex) instead of estimating; otherwise continue estimating.gasIncluded7702is true regardless of STX.txFee(gasIncluded true, STX off), estimating when gasIncluded is false, and forcing batch path withgasIncluded7702.Written by Cursor Bugbot for commit c1849c7. This will update automatically on new commits. Configure here.