Difficulty: Intermediate
Type: UI/UX, feature
Background
Forms inside the application (like custom token imports or profile setup) validate inputs manually using basic if/else logic.
Problem
Manual validation is prone to edge cases, messy component code, and inconsistent error messaging. Incorrect inputs can occasionally slip through to smart contract execution, costing users wasted gas.
Expected outcome
The application adopts a schema validation library (Zod) integrated with react-hook-form to ensure completely robust, type-safe validation before any form submission is processed.
Suggested implementation
- Install
zod and @hookform/resolvers.
- Define strict schemas for forms (e.g., ensuring string lengths, regex matching valid EVM addresses).
- Wire the schemas into the existing form components and map the resulting error messages directly to the UI input fields.
Acceptance criteria
Likely affected files/directories
src/components/Forms/ImportTokenForm.tsx
src/schemas/token.ts
Requirements
- Schema errors must be written in clear, user-friendly language (not raw regex failures).
Difficulty: Intermediate
Type: UI/UX, feature
Background
Forms inside the application (like custom token imports or profile setup) validate inputs manually using basic
if/elselogic.Problem
Manual validation is prone to edge cases, messy component code, and inconsistent error messaging. Incorrect inputs can occasionally slip through to smart contract execution, costing users wasted gas.
Expected outcome
The application adopts a schema validation library (
Zod) integrated withreact-hook-formto ensure completely robust, type-safe validation before any form submission is processed.Suggested implementation
zodand@hookform/resolvers.Acceptance criteria
Likely affected files/directories
src/components/Forms/ImportTokenForm.tsxsrc/schemas/token.tsRequirements