bug: Amount field accepts non-numeric input — fails on-chain #10

Closed
opened 2026-03-12 04:49:55 +00:00 by Brouie · 11 comments
Brouie commented 2026-03-12 04:49:55 +00:00 (Migrated from gitlab.com)

Description

Swap amount field accepts alphabetic/text input. Submitting text causes on-chain parse error instead of being caught client-side.

Error

Error parsing into type cw20_mintable::msg::ExecuteMsg: invalid Uint128 'afafaf' - invalid digit found in string

Expected

Input field should only accept numeric values. Non-numeric characters should be rejected on input or validated before TX submission.

Steps to Reproduce

  1. Connect wallet
  2. Select any pair
  3. Type letters (e.g. 'afafaf') in amount field
  4. Click Swap
  5. TX submits and fails on-chain

Impact

Bad UX — input validation should happen client-side, not on-chain.

## Description Swap amount field accepts alphabetic/text input. Submitting text causes on-chain parse error instead of being caught client-side. ## Error `Error parsing into type cw20_mintable::msg::ExecuteMsg: invalid Uint128 'afafaf' - invalid digit found in string` ## Expected Input field should only accept numeric values. Non-numeric characters should be rejected on input or validated before TX submission. ## Steps to Reproduce 1. Connect wallet 2. Select any pair 3. Type letters (e.g. 'afafaf') in amount field 4. Click Swap 5. TX submits and fails on-chain ## Impact Bad UX — input validation should happen client-side, not on-chain.
PlasticDigits commented 2026-03-12 07:04:18 +00:00 (Migrated from gitlab.com)

Fix implemented in commit 9b210da:

  • Input filtering: The swap amount field now only accepts numeric characters (digits and optional decimal point). Non-numeric input is rejected on keypress via regex /^\d*\.?\d*$/.
  • Button validation: Added isNaN(parseFloat(inputAmount)) to the Swap button disabled logic so invalid amounts cannot trigger a TX.

This prevents the on-chain parse error when text like 'afafaf' is entered. Please verify @Brouie — leaving this open until you confirm.

Fix implemented in commit 9b210da: - **Input filtering**: The swap amount field now only accepts numeric characters (digits and optional decimal point). Non-numeric input is rejected on keypress via regex `/^\d*\.?\d*$/`. - **Button validation**: Added `isNaN(parseFloat(inputAmount))` to the Swap button disabled logic so invalid amounts cannot trigger a TX. This prevents the on-chain parse error when text like 'afafaf' is entered. Please verify @Brouie — leaving this open until you confirm.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-03-12 11:49:17 +00:00
Brouie commented 2026-03-13 01:56:37 +00:00 (Migrated from gitlab.com)

Verified fixed — amount field now rejects non-numeric input.

Verified fixed — amount field now rejects non-numeric input.
Brouie commented 2026-03-13 02:02:26 +00:00 (Migrated from gitlab.com)

mentioned in issue #1

mentioned in issue #1
Brouie commented 2026-03-13 04:22:43 +00:00 (Migrated from gitlab.com)

mentioned in issue #18

mentioned in issue #18
Brouie commented 2026-04-23 03:47:32 +00:00 (Migrated from gitlab.com)

mentioned in issue #114

mentioned in issue #114
Brouie commented 2026-04-24 00:48:53 +00:00 (Migrated from gitlab.com)

mentioned in issue #112

mentioned in issue #112
Brouie commented 2026-04-24 00:53:39 +00:00 (Migrated from gitlab.com)

mentioned in issue #110

mentioned in issue #110
Brouie commented 2026-04-24 02:56:49 +00:00 (Migrated from gitlab.com)

mentioned in issue #111

mentioned in issue #111
Brouie commented 2026-04-24 02:58:41 +00:00 (Migrated from gitlab.com)

mentioned in issue #113

mentioned in issue #113
Brouie commented 2026-05-05 23:55:34 +00:00 (Migrated from gitlab.com)

mentioned in issue #133

mentioned in issue #133
PlasticDigits commented 2026-05-25 02:11:50 +00:00 (Migrated from gitlab.com)

mentioned in issue #148

mentioned in issue #148
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-dex-terraclassic#10
No description provided.