Repository navigation
Conversation
Converts a native amount between two assets through their exchange rates. A swap uses this to restate an amount on the other side at the same value.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The swap cards round a fiat-entered amount down to the decimals that still matter at the rate. The rule moves to a shared helper so other code can produce the same amount a typed fiat value does.
When no provider can price an exact receive amount, retry as a send amount of the same value. If that routes, show a toast and move the amount to the send side. If it does not, the pair is unsupported: the original error stands and the amounts stay as typed.
j0ntz
force-pushed
the
jon/swap-to-quote-fallback
branch
from
November 1, 2026 23:53
c8f829a to
a860d05
Compare
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
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.
Description
Asana task
Some providers cannot price an exact receive amount (Swapter, MoonPay Trade, SwapKit v3 and Velodrome all reject
toquotes). When every enabled provider rejected the direction, the user saw a "no provider" error on a pair that has a route.The swap processing scene now retries a failed
torequest as afromrequest of the same fiat value. This follows the Houdini Swap & Send behavior in the Send scene.toquote resultfromretry resultSwapCurrencyErroror emptySwapCurrencyErroror emptySwapCurrencyErroror emptySwapCurrencyErroror emptyThe last row is the unsupported pair case, which keeps it distinct from a quote-direction limit. The toast fires only after the retry result is known.
The switched send amount is rounded with the same precision rule as a typed fiat amount (
roundToFiatPrecision, extracted fromSwapInput). The unrounded conversion carried 17 significant digits on 18-decimal assets. Houdini returns its deposit amount as a JS double, which can round such a value up by 1 or 2 wei, and the plugin then rejects the quote as a deposit above the requested amount. QA hit this on 2 of 4 tries with Stealth Swap on. The send card now takes the rounded native amount directly, and the request, the scene state and the card all agree.Known limits:
pickBestErrorranks permission and limit errors aboveSwapCurrencyError. If another provider returns one of those, the direction limit stays hidden and no fallback runs.Error. A request where it is the only enabled provider gets no fallback.SendScene2is unchanged. Its inline conversion duplicates the newconvertNativeBetweenAssetshelper.Tested on an iOS simulator with Swapter forced as the only quoting provider (local-only
corePlugins.tsedit, not committed). The swap ran to the success scene: 42 USD entered on the receive side became 42.008 USDC (Arc) to 0.0167411 ETH. An unsupported pair (USDC on Arc to BNB on opBNB) showed Exchange Error with no toast and unchanged amounts. The keyboard covered the error body, and its text was not read on screen. Those drives predate the rounding fix.The rounding fix was retested on ETH to Sonic with Stealth Swap on and no provider forcing: 6 of 6 receive amounts (37, 39, 40, 41, 42.5 and 44 USD) showed the toast and a Houdini quote, stopping before the slider. Going back left the rounded amount on the send card with Stealth Swap still on.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Requirements
If you have made any visual changes to the GUI. Make sure you have:
Test evidence
a860d05Fall back to from quotes for fixed to amounts
2026-11-01
1. receive amount entered
4. requote from send side
5. swap success
6. unsupported pair keeps amounts
5. qa1 c4 40usd toast houdini quote
6. qa2 c4 42usd toast houdini quote
7. qa3 c4 back send card holds amount stealth on
8. qa4 c4 37usd toast houdini quote