Problem
frontend/src/app/api/faucet/route.ts, api/register-kyc/route.ts, and api/relay-withdraw/route.ts each independently define and validate their own request/response shapes, with no shared schema layer connecting the server-side validation to the frontend callers that construct these requests.
Why it matters
Without a single source of truth for these shapes, a server-side field rename or validation change can silently desync from frontend callers, surfacing only at runtime — exactly the kind of gap that produces confusing errors instead of the friendly ones tracked in #29/#15.
Scope
- New
frontend/src/lib/schemas/ directory with zod schemas for each of the three routes' request/response shapes.
frontend/src/app/api/faucet/route.ts, api/register-kyc/route.ts, api/relay-withdraw/route.ts: validate incoming requests against the shared schema.
- Frontend callers (in
deposit/page.tsx, withdraw/page.tsx, compliance/page.tsx, or a shared lib/api-client.ts): use the same schemas to type outgoing requests and parse responses.
- Tests confirming schema validation rejects malformed input for each route.
Acceptance criteria
- Request/response shapes for all three API routes are defined once and imported by both server and client code, with no duplicated shape definitions.
Problem
frontend/src/app/api/faucet/route.ts,api/register-kyc/route.ts, andapi/relay-withdraw/route.tseach independently define and validate their own request/response shapes, with no shared schema layer connecting the server-side validation to the frontend callers that construct these requests.Why it matters
Without a single source of truth for these shapes, a server-side field rename or validation change can silently desync from frontend callers, surfacing only at runtime — exactly the kind of gap that produces confusing errors instead of the friendly ones tracked in #29/#15.
Scope
frontend/src/lib/schemas/directory with zod schemas for each of the three routes' request/response shapes.frontend/src/app/api/faucet/route.ts,api/register-kyc/route.ts,api/relay-withdraw/route.ts: validate incoming requests against the shared schema.deposit/page.tsx,withdraw/page.tsx,compliance/page.tsx, or a sharedlib/api-client.ts): use the same schemas to type outgoing requests and parse responses.Acceptance criteria