Skip to content

Fall back to from quotes for fixed to amounts - #6317

Open
j0ntz wants to merge 4 commits into
developfrom
jon/swap-to-quote-fallback
Open

j0ntz wants to merge 4 commits into
developfrom
jon/swap-to-quote-fallback

Conversation

@j0ntz

@j0ntz j0ntz commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Asana task

Some providers cannot price an exact receive amount (Swapter, MoonPay Trade, SwapKit v3 and Velodrome all reject to quotes). 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 to request as a from request of the same fiat value. This follows the Houdini Swap & Send behavior in the Send scene.

to quote result from retry result What the user sees
Quotes not run No change
SwapCurrencyError or empty Quotes Toast, then the quote. Amount moves to the send side
SwapCurrencyError or empty Limit, funds or other error Toast, then that error against the new send amount
SwapCurrencyError or empty SwapCurrencyError or empty The original error. Amounts stay as typed

The 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 from SwapInput). 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:

  • Core's pickBestError ranks permission and limit errors above SwapCurrencyError. If another provider returns one of those, the direction limit stays hidden and no fallback runs.
  • 0x Gasless throws a plain Error. A request where it is the only enabled provider gets no fallback.
  • Requotes from the confirmation scene get no fallback.
  • SendScene2 is unchanged. Its inline conversion duplicates the new convertNativeBetweenAssets helper.

Tested on an iOS simulator with Swapter forced as the only quoting provider (local-only corePlugins.ts edit, 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?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Test evidence

a860d05
Fall 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

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.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-01T08:28:28.445961Z
We couldn’t complete this review. Comment @codex review to try again.
c8f829a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

j0ntz added 3 commits November 1, 2026 15:40
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
j0ntz force-pushed the jon/swap-to-quote-fallback branch from c8f829a to a860d05 Compare November 1, 2026 23:53
@cursor

cursor Bot commented Nov 1, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot 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.

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.

1 participant