Skip to content

Reject malformed custom slippage input#104

Open
vku2018 wants to merge 1 commit into
Nodus-protocol:mainfrom
vku2018:grantfox-57-strict-slippage-input
Open

Reject malformed custom slippage input#104
vku2018 wants to merge 1 commit into
Nodus-protocol:mainfrom
vku2018:grantfox-57-strict-slippage-input

Conversation

@vku2018

@vku2018 vku2018 commented Jul 3, 2026

Copy link
Copy Markdown

Summary

  • replace partial parseFloat handling with a strict decimal parser for custom slippage input
  • reject malformed values such as 1abc, 1,5, 0.5%, exponent notation, zero, and values above 50 without calling onChange
  • show an invalid state for rejected custom values while preserving normal decimal entry with inputMode="decimal"
  • add focused component coverage for invalid and valid custom slippage values

Why

parseFloat accepts partial numeric prefixes, so malformed values can silently apply a different slippage than the text the user entered. This keeps displayed input and applied slippage aligned.

Closes #57.

Validation

  • npm run test -- __tests__/components/SlippageSelector.test.tsx
  • npm test -- --runInBand (26 tests passed)
  • npm run lint -- components/SlippageSelector.tsx __tests__/components/SlippageSelector.test.tsx
  • npm run typecheck
  • git diff --check

@vku2018 vku2018 requested a review from Jaydbrown as a code owner July 3, 2026 18:28
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