Feature: Implement FCFS (Single Claim) Bounty Flow
Overview
The documentation describes 4 bounty claiming models, but the frontend only partially implements the Application model. The FCFS (First-Come-First-Served) / Single Claim model — where the first contributor to click "Claim" gets exclusive rights — is completely missing from the UI.
This maps directly to the claim_bounty() and approve_fcfs() methods on the Bounty Registry smart contract.
Depends on: #139 (TypeScript contract bindings)
Goals
- Allow contributors to instantly claim FCFS bounties with one click
- Spend 1 Spark Credit on claim (via Reputation Registry contract)
- Lock bounty to the claiming contributor's wallet
- Show "Already Claimed" state to other users
- Enable bounty creator to approve completed FCFS work
Contract Methods Used
BountyRegistry.claim_bounty(contributor: Address, bounty_id: u64)
→ Spends 1 SparkCredit from Reputation Registry
→ Locks escrow pool and defines release slot
BountyRegistry.approve_fcfs(creator: Address, bounty_id: u64, points: u32)
→ Releases escrow to contributor
→ Awards 1 credit + reputation points
Implementation Details
1. FCFS Claim Button
Modify: app/bounty/[bountyId]/page.tsx
- Show "Claim Bounty" button for FCFS-type bounties with status
Open
- On click:
- Check user has ≥1 Spark Credit (read
get_credits())
- Build unsigned
claim_bounty transaction
- Prompt passkey signing
- Submit signed transaction
- Optimistically update UI to "Claimed" state
- Show "Already Claimed by @user" when bounty is
InProgress
2. FCFS Approval Flow
Modify: app/bounty/[bountyId]/page.tsx
- For bounty creator, when bounty is
InReview:
- Show submission details
- "Approve & Release Payment" button
- Calls
approve_fcfs(creator, bounty_id, points)
- Triggers escrow release
3. Anti-Squatting Display
- Show countdown timer for auto-release (7 days no milestone, 3 days no response)
- Show abandonment warning to claimant
- Creator override: "Unclaim" button with justification
4. Create Hook
Create: hooks/use-claim-bounty.ts
- Wraps
claim_bounty contract call
- Handles transaction building, signing, submission
- Invalidates bounty query cache on success
Files Affected
Modified
app/bounty/[bountyId]/page.tsx
components/bounty/bounty-card.tsx (show "Claimed" badge)
Created
hooks/use-claim-bounty.ts
components/bounty/fcfs-claim-button.tsx
components/bounty/fcfs-approval-panel.tsx
Acceptance Criteria
Feature: Implement FCFS (Single Claim) Bounty Flow
Overview
The documentation describes 4 bounty claiming models, but the frontend only partially implements the Application model. The FCFS (First-Come-First-Served) / Single Claim model — where the first contributor to click "Claim" gets exclusive rights — is completely missing from the UI.
This maps directly to the
claim_bounty()andapprove_fcfs()methods on the Bounty Registry smart contract.Depends on: #139 (TypeScript contract bindings)
Goals
Contract Methods Used
Implementation Details
1. FCFS Claim Button
Modify:
app/bounty/[bountyId]/page.tsxOpenget_credits())claim_bountytransactionInProgress2. FCFS Approval Flow
Modify:
app/bounty/[bountyId]/page.tsxInReview:approve_fcfs(creator, bounty_id, points)3. Anti-Squatting Display
4. Create Hook
Create:
hooks/use-claim-bounty.tsclaim_bountycontract callFiles Affected
Modified
app/bounty/[bountyId]/page.tsxcomponents/bounty/bounty-card.tsx(show "Claimed" badge)Created
hooks/use-claim-bounty.tscomponents/bounty/fcfs-claim-button.tsxcomponents/bounty/fcfs-approval-panel.tsxAcceptance Criteria