Summary
Validate and normalise wallet addresses before they are used in API calls, admin role assignment, member lookup, and mock store keys.
Current Behaviour
Admin role assignment accepts any non-empty string, and the API client interpolates wallet addresses directly into paths. Mock mode stores addresses exactly as entered, so mixed-case or malformed values can create inconsistent member records.
Expected Behaviour
The frontend should reject malformed wallet addresses, normalise valid addresses consistently, and encode addresses safely before sending requests.
Suggested Implementation
Add shared address utilities using viem helpers where suitable. Apply them in the admin role assignment form, LiveAccessApi, MockAccessApi, Gated, and dashboard queries.
Files or Areas Likely Affected
lib/api/live.ts
lib/api/mock.ts
lib/api/types.ts
lib/utils.ts
app/admin/members/page.tsx
components/gated.tsx
components/admin-guard.tsx
Acceptance Criteria
Additional Notes
Assumption: address normalisation should not break checksum addresses. Use viem utilities if they are already available through project dependencies.
Summary
Validate and normalise wallet addresses before they are used in API calls, admin role assignment, member lookup, and mock store keys.
Current Behaviour
Admin role assignment accepts any non-empty string, and the API client interpolates wallet addresses directly into paths. Mock mode stores addresses exactly as entered, so mixed-case or malformed values can create inconsistent member records.
Expected Behaviour
The frontend should reject malformed wallet addresses, normalise valid addresses consistently, and encode addresses safely before sending requests.
Suggested Implementation
Add shared address utilities using
viemhelpers where suitable. Apply them in the admin role assignment form,LiveAccessApi,MockAccessApi,Gated, and dashboard queries.Files or Areas Likely Affected
lib/api/live.tslib/api/mock.tslib/api/types.tslib/utils.tsapp/admin/members/page.tsxcomponents/gated.tsxcomponents/admin-guard.tsxAcceptance Criteria
Additional Notes
Assumption: address normalisation should not break checksum addresses. Use
viemutilities if they are already available through project dependencies.