Bug: MAX button formats value with commas — HTML number input can't parse #90

Closed
opened 2026-03-31 08:42:20 +00:00 by Brouie · 3 comments
Brouie commented 2026-03-31 08:42:20 +00:00 (Migrated from gitlab.com)

clicking MAX on the amount field sets the value to '1,000,000.00' (with commas). HTML input type=number can't parse comma-formatted values, so the field displays 0.0 and the transfer form sends the wrong amount.

console warning:
The specified value "1,000,000.00" cannot be parsed, or is out of range.

seen on LocalTerra->Solana Localnet with 1M TKNA balance. MAX should set the raw numeric value without locale formatting (e.g. 1000000.00 not 1,000,000.00).

commit 74b5f3e, laptop Vite workflow.

clicking MAX on the amount field sets the value to '1,000,000.00' (with commas). HTML input type=number can't parse comma-formatted values, so the field displays 0.0 and the transfer form sends the wrong amount. console warning: The specified value "1,000,000.00" cannot be parsed, or is out of range. seen on LocalTerra->Solana Localnet with 1M TKNA balance. MAX should set the raw numeric value without locale formatting (e.g. 1000000.00 not 1,000,000.00). commit 74b5f3e, laptop Vite workflow.
PlasticDigits commented 2026-04-01 01:48:59 +00:00 (Migrated from gitlab.com)

mentioned in commit 86bef9f613

mentioned in commit 86bef9f6134144220f8d5a5e3d8f44d01499e0c6
PlasticDigits commented 2026-04-01 01:49:06 +00:00 (Migrated from gitlab.com)

Fix pushed

Cause: handleMax used formatAmount(), which calls toLocaleString('en-US', …) and adds thousands separators. <input type="number"> rejects strings like 1,000,000.00, so the field fell back to empty / wrong values.

Change: Added formatAmountForNumberInput() (same rounding rules, useGrouping: false) and use it in TransferForm when setting the amount from MAX.

Commit: 86bef9f on feat/solana-integration.

@Brouie could you review when you have a chance?

## Fix pushed **Cause:** `handleMax` used `formatAmount()`, which calls `toLocaleString('en-US', …)` and adds thousands separators. `<input type="number">` rejects strings like `1,000,000.00`, so the field fell back to empty / wrong values. **Change:** Added `formatAmountForNumberInput()` (same rounding rules, `useGrouping: false`) and use it in `TransferForm` when setting the amount from MAX. Commit: `86bef9f` on `feat/solana-integration`. @Brouie could you review when you have a chance?
Brouie commented 2026-04-01 04:35:07 +00:00 (Migrated from gitlab.com)

partial fix -- MAX no longer inserts commas (LUNC fills as 500000.00). but tokens with 18 decimals (TKNA) still crash on MAX because the scaled amount becomes 5e+23 scientific notation, hitting the same BigInt crash as #95. #90 comma fix is verified, the remaining crash is tracked in #95.

partial fix -- MAX no longer inserts commas (LUNC fills as 500000.00). but tokens with 18 decimals (TKNA) still crash on MAX because the scaled amount becomes 5e+23 scientific notation, hitting the same BigInt crash as #95. #90 comma fix is verified, the remaining crash is tracked in #95.
Brouie (Migrated from gitlab.com) closed this issue 2026-04-01 04:37:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-bridge-monorepo#90
No description provided.