Feature: Implement Spark Credits UI
Overview
Spark Credits are application credits that prevent spam while ensuring quality contributors always have opportunities. Each FCFS bounty claim costs 1 Spark Credit. The Reputation Registry contract manages credits, but the frontend has no UI for viewing or spending them.
Depends on: #139 (TypeScript contract bindings)
Goals
- Display user's current Spark Credit balance
- Show credit cost before claiming bounties
- Warn when credits are low
- Display credit earning/spending history
Contract Methods Used
ReputationRegistry.get_credits(user: Address) → u64
ReputationRegistry.spend_credit(caller, user) → bool
(called automatically by claim_bounty)
ReputationRegistry.award_credits(caller, user, amount)
(called automatically on bounty completion)
Implementation Details
1. Credit Balance Widget
Create: components/reputation/credit-balance.tsx
- Show current Spark Credit count in navbar or profile sidebar
- Icon + number (e.g., ⚡ 5)
- Tooltip explaining what credits are for
2. Credit Gate on Claim
Modify: hooks/use-claim-bounty.ts (from #140)
- Before claim: check
get_credits(user) ≥ 1
- If insufficient: show "Not enough Spark Credits" with guidance
- Show credit cost in claim confirmation dialog
3. Credit History
Create: components/reputation/credit-history.tsx
- List of credit events: earned (bounty completion) and spent (claims)
- Date, amount, source bounty
- Running balance
4. Earning Explainer
Create: components/reputation/credit-explainer.tsx
- How to earn credits (complete bounties, win competitions)
- Credit costs per action
- Tips for managing credits
Files Affected
Created
hooks/use-spark-credits.ts
components/reputation/credit-balance.tsx
components/reputation/credit-history.tsx
components/reputation/credit-explainer.tsx
Modified
components/global-navbar.tsx (add credit balance)
app/profile/[username]/page.tsx (add credit section)
Acceptance Criteria
Feature: Implement Spark Credits UI
Overview
Spark Credits are application credits that prevent spam while ensuring quality contributors always have opportunities. Each FCFS bounty claim costs 1 Spark Credit. The Reputation Registry contract manages credits, but the frontend has no UI for viewing or spending them.
Depends on: #139 (TypeScript contract bindings)
Goals
Contract Methods Used
Implementation Details
1. Credit Balance Widget
Create:
components/reputation/credit-balance.tsx2. Credit Gate on Claim
Modify:
hooks/use-claim-bounty.ts(from #140)get_credits(user)≥ 13. Credit History
Create:
components/reputation/credit-history.tsx4. Earning Explainer
Create:
components/reputation/credit-explainer.tsxFiles Affected
Created
hooks/use-spark-credits.tscomponents/reputation/credit-balance.tsxcomponents/reputation/credit-history.tsxcomponents/reputation/credit-explainer.tsxModified
components/global-navbar.tsx(add credit balance)app/profile/[username]/page.tsx(add credit section)Acceptance Criteria