ISSUE-CU06-003: Implement UI-Contract for Claiming Prizes
✨ Issue Request
Implement the complete user interface for the prize claiming functionality (CU-06), allowing players to visualize their tickets with assigned prizes and execute the claim transaction from the frontend in an intuitive and secure manner.
📌 Description
This issue focuses exclusively on the frontend implementation for use case CU-06 "Claim Prize". The smart contract functionality must be implemented previously (see SL-CU06-001).
We need to implement:
-
Prize Claiming Page (/claim-prizes)
- Display user's ticket list with assigned prizes
- Filter only tickets with
prize_assigned = true and claimed = false
- Responsive and modern design
-
UI Components
- Ticket cards with detailed information
- "Claim prize" button with dynamic states
- Success/error notifications
- Loading states during transactions
-
Starknet Integration
- Connection with wallet (Argent/Braavos)
- Execute
ClaimPrize transaction
- Automatic UI update after claiming
- Contract error handling
-
Custom Hooks
- Hook to get claimable tickets
- Hook to execute claim
- Hook to verify transaction status
🛠️ Steps to Reproduce (if applicable)
Current context:
- No prize claiming page exists in frontend
- Users cannot visualize their assigned prizes
- No integration with contract's
ClaimPrize function
- No reusable components to display tickets with prizes
🖼️ Screenshots (if applicable)
Not applicable - new functionality to implement.
Suggested design references:
- Existing profile page for style consistency
- Dashboard with ticket cards
- Scaffold-Stark components for common patterns
🎯 Expected Behavior
The implementation must meet the following requirements:
Main Page (/claim-prizes):
- 🔹 Display title "Claim Prizes"
- 🔹 Verify wallet connection (show message if not connected)
- 🔹 Get all finalized draws with
distribution_done = true
- 🔹 For each draw, get user's tickets with prizes
- 🔹 Display list of claimable ticket cards
- 🔹 Show message if no prizes available
- 🔹 Loading skeleton while loading data
- 🔹 Responsive design (mobile, tablet, desktop)
ClaimPrizeCard Component:
- 🔹 Display draw ID and date
- 🔹 Display ticket numbers (e.g., "5 - 12 - 23 - 34 - 40")
- 🔹 Display prize amount in STRKP with formatting
- 🔹 Display match level (1-4 matches)
- 🔹 "Claim" button with states:
- Enabled: Prize available
- Disabled: Already claimed or no prize
- Loading: Transaction in progress
- 🔹 Status badge (Available / Claimed)
- 🔹 Attractive design with theme colors
Wallet Integration:
- 🔹 Detect connected wallet
- 🔹 Get user address
- 🔹 Execute
ClaimPrize transaction on click
- 🔹 Show wallet confirmation modal
- 🔹 Wait for transaction confirmation
- 🔹 Automatically update UI after confirming
Notifications and UX:
- 🔹 Success toast with block explorer link
- 🔹 Error toast with descriptive message
- 🔹 Loading spinner in button during transaction
- 🔹 Disable button after claiming
- 🔹 Clear visual feedback at each step
- 🔹 Contract error handling (translate Cairo errors)
Navigation:
- 🔹 Add link in main menu
- 🔹 Badge with number of available prizes (optional)
- 🔹 Accessible route:
/claim-prizes or /profile/claim-prizes
🚀 Suggested Solution / Feature Request
File Structure
packages/nextjs/
├── app/
│ └── claim-prizes/
│ └── page.tsx # Main page
├── components/
│ └── claim-prizes/
│ ├── ClaimPrizeCard.tsx # Individual card
│ ├── ClaimPrizesList.tsx # Card list
│ └── EmptyClaimState.tsx # Empty state
└── hooks/
└── scaffold-stark/
├── useClaimablePrizes.ts # Hook to get prizes
└── useClaimPrize.ts # Hook to claim
Implementation
[Same code examples as Spanish version above]
📌 Additional Notes
Issue Dependencies:
- SL-CU06-001: Contract's
ClaimPrize function must be implemented
- Deployed Contract: Must be in
deployedContracts.ts
- Wallet: User must have connected wallet (Argent/Braavos)
UX Considerations:
- Loading States: Show skeletons while loading
- Error Handling: Translate technical errors to friendly messages
- Visual Feedback: Clear success/error confirmations
- Responsiveness: Functional on mobile, tablet and desktop
- Accessibility: Use semantic HTML and ARIA labels
Internationalization:
- Consider adding translations (i18n)
- Support Spanish and English
- Format numbers according to locale
Performance:
- Paginate prize list if many
- Lazy loading of heavy components
- Optimize re-renders with React.memo
Testing (Manual):
- ✅ Connect wallet and verify prizes load
- ✅ Click "Claim" and sign transaction
- ✅ Verify success notification
- ✅ Verify button disables after claiming
- ✅ Verify responsive on mobile
- ✅ Test with wallet without prizes (empty state)
- ✅ Test errors (no funds, already claimed, etc.)
⚠️ Before Applying
Please read this guide: Contributor Guidelines
Definition of Done:
ISSUE-CU06-003: Implement UI-Contract for Claiming Prizes
✨ Issue Request
Implement the complete user interface for the prize claiming functionality (CU-06), allowing players to visualize their tickets with assigned prizes and execute the claim transaction from the frontend in an intuitive and secure manner.
📌 Description
This issue focuses exclusively on the frontend implementation for use case CU-06 "Claim Prize". The smart contract functionality must be implemented previously (see SL-CU06-001).
We need to implement:
Prize Claiming Page (
/claim-prizes)prize_assigned = trueandclaimed = falseUI Components
Starknet Integration
ClaimPrizetransactionCustom Hooks
🛠️ Steps to Reproduce (if applicable)
Current context:
ClaimPrizefunction🖼️ Screenshots (if applicable)
Not applicable - new functionality to implement.
Suggested design references:
🎯 Expected Behavior
The implementation must meet the following requirements:
Main Page (
/claim-prizes):distribution_done = trueClaimPrizeCard Component:
Wallet Integration:
ClaimPrizetransaction on clickNotifications and UX:
Navigation:
/claim-prizesor/profile/claim-prizes🚀 Suggested Solution / Feature Request
File Structure
Implementation
[Same code examples as Spanish version above]
📌 Additional Notes
Issue Dependencies:
ClaimPrizefunction must be implementeddeployedContracts.tsUX Considerations:
Internationalization:
Performance:
Testing (Manual):
Please read this guide: Contributor Guidelines
Definition of Done:
/claim-prizescreated and functionalClaimPrizeCard,ClaimPrizesList,EmptyClaimStateimplementeduseClaimablePrizesworking correctlyClaimPrizeexecuting correctlyyarn formatyarn build