Skip to content

Add wallet address validation and normalisation #10

Description

@Lakes41

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

  • Invalid wallet addresses are rejected before admin role assignment
  • Valid addresses are normalised consistently in mock and live mode
  • Dynamic address path segments are URL-encoded
  • User-facing validation messages are shown in the admin form
  • Existing mock mode demo behaviour remains usable

Additional Notes

Assumption: address normalisation should not break checksum addresses. Use viem utilities if they are already available through project dependencies.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions