Skip to content

Add helper for formatting buy quantity input with bounds#409

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
TheDEV111:issue-400-buy-qty-helper
Jun 1, 2026
Merged

Add helper for formatting buy quantity input with bounds#409
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
TheDEV111:issue-400-buy-qty-helper

Conversation

@TheDEV111
Copy link
Copy Markdown
Contributor

Closes #400.

Summary of Changes:

  • Centralized Bounds: Added BUY_QUANTITY_BOUNDS constant to src/constants/fees.ts (min: 1, max: 100).
  • Clamping Helper: Created clampBuyQuantity in src/utils/buyQuantity.ts to robustly clamp inputs and handle float rounding (since keys are discrete whole assets).
  • TradeDialog Integration: Hooked clampBuyQuantity into the onBlur event of the trade quantity input in src/components/common/TradeDialog.tsx.
  • User Alerts: Rendered an adjustment/warning note under the input to clearly show when clamping or rounding was applied. The note is cleared immediately as soon as the user changes the input value (onChange).
  • Full Test Coverage:
    • Wrote comprehensive unit tests in src/utils/__tests__/buyQuantity.test.ts (7/7 passing).
    • Wrote integration tests in src/components/common/__tests__/TradeDialog.buyQuantity.test.tsx (5/5 passing).

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@TheDEV111 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093 Chucks1093 merged commit 89ad244 into accesslayerorg:main Jun 1, 2026
1 check passed
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.

Add helper for formatting buy quantity input with min and max bounds

2 participants