fix: quote request should not be sent of amount of token requested by the user is 0#8554
fix: quote request should not be sent of amount of token requested by the user is 0#8554
Conversation
| } | ||
|
|
||
| log('Updating quotes', { transactionId }); | ||
|
|
There was a problem hiding this comment.
On money account page token / accountOverride can be updated few times. We need to ensure that quotes is not refetched unless user enters a non-zero token amount. Thus this change is made.
Another approach could be to change methods setTransactionConfig, 'setPaymentToken' to not refresh quote is amount of token requested is zero.
| tokens, | ||
| } = transactionData; | ||
|
|
||
| const hasNonZeroTokenAmount = |
There was a problem hiding this comment.
We already have this logic in source-amounts.ts, so this was working previously, so is this a unique issue for account override somehow?
There was a problem hiding this comment.
When we update transactionConfig - like update accountOverride, it triggers updating payToken and getting new quote. So this was happening frequently on money account pages.
Also, money account transaction I found was request 0 value for required token and a small value for another token with token.skipIfBalance true. I guess it was for gas fees.
There was a problem hiding this comment.
But we only generate quote requests for any source amounts we have, and the logic in calculatePostQuoteSourceAmounts should already skip tokens if its skipIfBalance or if the amount is zero?
So we need to debug why that existing logic isn't working.
There was a problem hiding this comment.
Yep, let me debug existing code.
There was a problem hiding this comment.
I found that we are updating source amount here:
But despite zero amount we send request to api.
I think we can simplify code added in this PR to just check if all sourceAmounts are '0' we do not send request.
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 29ae3c9. Configure here.

Explanation
Money account page updated transaction a few times, this change ensure that we get quote only of token amount requested is not 0.
References
Fixes https://consensyssoftware.atlassian.net/browse/CONF-1241
Checklist
Note
Medium Risk
Changes required-token detection logic used to drive quoting/payment flows; consumers that relied on the synthetic gas-fee token may see different quote requests and balance checks.
Overview
parseRequiredTokensno longer synthesizes/returns a native “gas fee required token”; whenrequiredAssetsare absent it now only returns a required token for detected ERC-20transferdata (otherwise[]).This removes the
getGasFeeTokencode path (and related BigNumber/native-token helpers), updates unit tests to drop gas-fee expectations and assert empty results for invalid transfer data, and documents the behavioral change in the changelog.Reviewed by Cursor Bugbot for commit 3f2496d. Bugbot is set up for automated code reviews on this repo. Configure here.