Add contract address to .env:
NEXT_PUBLIC_CONTRACT_ADDRESS=0x...
Purpose: Submit new image for analysis
Used in: Upload flow (components/upload-dialog.tsx)
Parameters:
id, originalUrl, leaderboardUrl, analysisUrl, defense, name, location
Returns: Transaction hash + receipt Flow: User uploads → generate UUID → call method → redirect to waiting page
Purpose: Fetch submissions by category (leaderboard)
Used in: Category pages (lib/hooks/use-category-data.js)
Parameters:
category: string, startIndex: number, count: number
Expected Return:
{
records: Array[{
id, url, consensus_output, defense, caller_address, ...
}],
has_more: boolean,
returned_count: number,
start_index: number,
total_count: number
}Purpose: Fetch single submission by ID
Used in: Submission detail pages (app/s/[id]/page.tsx)
Parameters:
category: string, id: string
Expected Return: Single record object (same structure as records array item)
Purpose: Fetch user's submissions
Used in: Profile page (app/profile/page.tsx)
Parameters:
userAddress: string, startIndex: number, count: number
Expected Return: Same structure as get_analysis_by_category
- GenLayer Returns: Map objects with BigInt values
- Frontend Converts: Maps → Objects, BigInt → Numbers (see
lib/genlayer/genlayer.js) - consensus_output: JSON string containing
{ category, score, reasoning, has_match } - Pagination: Uses
has_more+returned_countfor Load More functionality
- Verify contract methods exist with exact names
- Check parameter order matches function calls
- Test return data structure (especially pagination metadata)
- Verify
consensus_outputJSON format - Test upload flow: UUID generation → contract call → waiting page polling
- Test all read methods return expected data types (no Map/BigInt issues)