Skip to content

Conversation

samholmes
Copy link
Contributor

@samholmes samholmes commented Oct 17, 2025

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)

Note

Prevents zero-amount Simplex quotes, improves max-amount quote selection with big-number comparison, and safely renders exchange-rate text (with new i18n).

  • Ramps UI (src/components/scenes/RampCreateScene.tsx):
    • Max flow: replace float parsing loop with biggystring.gt reduction to pick largest supported crypto/fiat amount.
    • Exchange rate text: delegate null/zero handling to util; remove local null guard.
  • Utils (src/plugins/ramps/utils/getRateFromRampQuoteResult.ts):
    • Accept quote | undefined; return empty when undefined.
    • Guard division-by-zero: show lstrings.trade_option_invalid_quote_zero_crypto when cryptoAmount === '0'.
  • Simplex Plugin (src/plugins/ramps/simplex/simplexRampPlugin.ts):
    • Treat zero fiat/crypto amount quotes as underLimit and reject early.
  • i18n:
    • Add trade_option_invalid_quote_zero_crypto to en_US.ts and strings/enUS.json.

Written by Cursor Bugbot for commit fbf6956. This will update automatically on new commits. Configure here.


cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

The previous implementation didn't check if `sortedQuotes[i]` was
nullish and static types didn't complain.

The solution is to use a reducer which is properly guarded by
the existing sortedQuotes.length check.
For some reason some quotes were returning with zero amounts.
This patches to at least not crash.
For some reason, FTM asset is not properly receiving an error from
Simplex's API when the amount is below the minimum, but instead the API
response is giving zero amounts for both crypto and fiat amounts.

We'll treat these as a below minimum errors, because increasing the
request amount to $50 or above fixes this for FTM.
const bAmount = lastUsedInput === 'crypto' ? b.cryptoAmount : b.fiatAmount
return gt(bAmount, aAmount) ? b : a
})
return picked
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Invalid Numeric Strings Crash gt() Function

The maxQuoteForMaxFlow calculation's reduce function now passes cryptoAmount or fiatAmount strings directly to gt(). This removes the defensive handling that previously converted undefined, NaN, or malformed numeric strings to 0, potentially causing gt() to throw errors or crash with invalid input.

Fix in Cursor Fix in Web

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