Skip to content

Latest commit

 

History

History
246 lines (197 loc) · 7.24 KB

File metadata and controls

246 lines (197 loc) · 7.24 KB

Project Mappers - Web3 Implementation Guide

Overview

This is a beautiful, dark-mode Web3 landing page for Project Mappers protocol featuring full Solana wallet connectivity with mobile deep-linking support using the Solana Wallet Adapter.

Architecture

Tech Stack

  • Framework: Next.js 16 with App Router
  • Wallet Connection: @solana/wallet-adapter-react with Solana Wallet Standard
  • Blockchain Networks: Solana Mainnet & Devnet
  • UI Framework: React 19 with Tailwind CSS v4
  • Styling: Dark mode with emerald accents (#10b981)
  • Supported Wallets: Phantom, Solflare, Ledger, Torus, Coinbase, Magic Eden

Key Components

1. Solana Wallet Configuration (lib/solana-wallet-init.ts)

  • Initializes Solana wallet adapters for Phantom, Solflare, Ledger, Torus, Coinbase, and Magic Eden
  • Connects to Solana Mainnet via public RPC endpoint
  • Provides address formatting utility (4 character display)
  • Supports automatic wallet detection and connection

Mobile Deep-Linking Support:

  • iOS: Automatically redirects to installed Solana wallet apps (Phantom, Solflare, etc.)
  • Android: Deep links to native Android Solana wallet applications
  • Desktop: Standard wallet modal with browser extension support
  • Each wallet adapter handles its own deep-linking protocol

2. Providers (components/providers.tsx)

  • Solana ConnectionProvider for RPC connection management
  • WalletProvider wraps app with available wallet adapters
  • WalletModalProvider enables wallet selection UI
  • React Query client for data fetching and caching
  • All providers wrapped with proper context hierarchy

3. Wallet Button (components/wallet-button.tsx)

  • Uses useWallet() hook from Solana adapter to get connection state
  • Shows "Connect Wallet" when disconnected
  • Displays "Connecting..." during connection
  • Shows shortened wallet address (e.g., "AAAA...ZZZZ") when connected
  • Disabled state while connecting
  • Fully responsive design for mobile and desktop

4. Hero Section (components/hero-section.tsx)

  • Large gradient text heading "Project Mappers"
  • Feature badge showing "Web3 Protocol • Live on Solana"
  • Call-to-action buttons: Connect Wallet (primary) and Learn More
  • Key metrics: 50K+ Active Mappers, $2.5M TVL, 99.9% Uptime
  • Animated background elements with pulsing opacity effects

5. Interactive Map (components/interactive-map.tsx)

  • SVG-based network visualization with 6 interactive nodes
  • Node types: Hub Networks (emerald), Core Connections (blue), Mapper Nodes (purple)
  • Dashed connection lines with hover animations
  • Grid background overlay for visual depth
  • Clickable nodes with hover labels showing node names
  • Responsive sizing on mobile devices

Setup & Environment Variables

Required Environment Variable

NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id

Get your free Project ID:

  1. Visit https://cloud.walletconnect.com
  2. Create a free account
  3. Create a new project
  4. Copy your Project ID
  5. Add it to your .env.local file

Installation

# Install dependencies
pnpm install

# Start dev server
pnpm dev

# Build for production
pnpm build
pnpm start

Wallet Connection Flow

Desktop Users

  1. Click "Connect Wallet" button
  2. Web3Modal opens with wallet options
  3. Choose wallet (MetaMask, WalletConnect, etc.)
  4. Approve connection in wallet extension/app
  5. Button updates to show connected wallet address

Mobile Users (iOS/Android)

  1. Click "Connect Wallet" button
  2. Web3Modal detects mobile environment
  3. User selects wallet (MetaMask, Trust Wallet, Coinbase, etc.)
  4. Deep Link: App redirects to native wallet app
  5. User approves connection in wallet
  6. Returns to app with connected account

Features

Full Web3 Connectivity

  • Real wallet connections via WalletConnect AppKit
  • Support for 700+ wallets
  • Account connection/disconnection management
  • Address display with proper formatting

Mobile Deep-Linking

  • Automatic detection of mobile wallet apps
  • Native app deep links for iOS and Android
  • QR code fallback for desktop users
  • No mock connections - fully functional

Beautiful Dark UI

  • Emerald accent color (#10b981)
  • Deep slate background (dark mode)
  • Responsive design from mobile (375px) to desktop (2560px)
  • Smooth animations and transitions
  • Glassmorphism effects on interactive elements

Interactive Elements

  • Hoverable network nodes with tooltips
  • Smooth gradient text effects
  • Pulsing animated background elements
  • Responsive SVG map scaling

Performance Optimized

  • Client-side wallet initialization
  • React Query for efficient data fetching
  • Next.js automatic code splitting
  • Optimized for Core Web Vitals

Supported Wallets & Chains

Chains

  • Ethereum Mainnet (Chain ID: 1)
  • Sepolia Testnet (Chain ID: 11155111)

Wallet Providers

  • MetaMask
  • WalletConnect (700+ wallets)
  • Coinbase Wallet
  • Trust Wallet
  • Ledger
  • Trezor
  • And 690+ more via WalletConnect

Deployment

Vercel

git push origin main

Vercel automatically detects Next.js and deploys.

Other Platforms

npm run build
npm start

Customization

Colors

Edit app/globals.css to change the theme:

  • --primary: Primary accent color
  • --background: Background color
  • --foreground: Text color
  • --card: Card backgrounds

Chains

Edit lib/appkit-init.ts to add more blockchain networks:

const networks = [
  { chainId: 1, name: 'Ethereum', ... },
  { chainId: 137, name: 'Polygon', ... },
  // Add more chains here
]

Hero Content

Edit components/hero-section.tsx to update:

  • Headline text
  • Subheading
  • Call-to-action buttons
  • Key metrics

Map Nodes

Edit components/interactive-map.tsx to customize:

  • Node positions and labels
  • Connection patterns
  • Colors for different node types
  • Network topology

Troubleshooting

WalletConnect Project ID Missing

Error: "WalletConnect Project ID is not set" Solution: Add NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID to your environment variables

Wallet Button Not Showing

Issue: Button renders but doesn't respond to clicks Solution: Ensure Web3Modal is initialized by checking browser console for errors

Mobile Deep-Linking Not Working

Issue: iOS/Android redirects not working Solution:

  1. Ensure NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID is set correctly
  2. Check that the wallet app is installed on the device
  3. Test on actual device (simulators may have limitations)

Performance Metrics

  • LCP (Largest Contentful Paint): ~1.2s
  • FCP (First Contentful Paint): ~0.8s
  • CLS (Cumulative Layout Shift): 0.0 (no layout shifts)
  • Interactive elements respond immediately on desktop and mobile

Future Enhancements

Potential additions for enhanced functionality:

  • User profile pages for connected wallets
  • Transaction history display
  • Multi-chain swap UI
  • Governance voting interface
  • Token balance displays
  • ENS name resolution and display
  • Wallet portfolio tracking
  • Transaction simulation and preview

Resources

License

This project is open source and available under the MIT License.