A Next.js application that displays the leaderboard for Potion Traders on Solana, built for the Potion Competition.
- Frontend: Next.js, TailwindCSS, Tanstack Table, Radix UI, Shadcn UI
- Backend: MongoDB, Upstash, Pusher
- Integrations: Helius, Twitter API
- Wallet: Custom-styled Solana Wallet Adapter
- Displays trader rankings with filterable columns
- Live trading feed powered by Helius webhooks and Pusher
- Twitter follower count integration
- Simplified PnL calculations
- Actions per trader:
- Copy wallet address
- View profile
- Displays trader statistics and trade history
- PnL visualization with sharing capabilities
- Twitter account linking
- Wallet connection support
/learn- Educational resources/prizes- Competition rewards information
- Returns trader data with enhanced information:
- Live Twitter follower counts (via Raspberry Pi hosted service)
- Simplified PnL calculations
- Fetches single trader data using wallet address
- Handles two scenarios:
- Existing trader: Displays stats and trade history
- New user: Guides through wallet and Twitter connection
Twitter authentication flow:
- User initiates auth via connect button
- Redirects to Twitter for approval
- Callback saves user profile and wallet address to MongoDB
- Completes authentication flow
Handles live trading feed data:
- Receives Helius webhook data
- Forwards to Pusher
- Updates frontend via LiveTrader component
- Clone the repository
- Set up environment variables:
cp .env.example .env # Fill in required variables - Install dependencies:
npm install
- Start development server:
npm run dev
Required variables (add to .env):
NEXT_PUBLIC_API_URL: http://localhost:3000NEXT_PUBLIC_SOLANA_RPC_URL:NEXT_PUBLIC_PUSHER_KEY:NEXT_PUBLIC_PUSHER_CLUSTER:NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID:
HELIUS_KEY:
TWITTER_API_KEY:TWITTER_API_SECRET:TWITTER_CLIENT_ID:TWITTER_CLIENT_SECRET:
MONGODB_URI:
UPSTASH_REDIS_REST_URL:UPSTASH_REDIS_REST_TOKEN:
PUSHER_APP_ID:PUSHER_KEY:PUSHER_SECRET:PUSHER_CLUSTER:
The demo is deployed on Vercel and can be accessed at https://potionleaderboard.xyz/