The Solana Wallet Analysis tool is a comprehensive web application that provides in-depth analysis of Solana blockchain wallets. It combines real-time blockchain data, historical analysis, and AI-powered insights to give users a complete view of wallet activity and portfolio composition.
- Real-time wallet balance tracking
- Historical transaction analysis
- Token portfolio visualization
- AI-powered trading pattern analysis
- Interactive data visualizations
- Multi-provider data reliability
- Responsive and modern UI
- Node.js (v16 or higher)
- npm or yarn package manager
- Git for version control
- Required API Keys:
- Solana RPC endpoint (Alchemy API key)
- Moralis API key for token data
- OpenAI API key (optional for AI analysis)
- Gemini API key (optional for AI analysis)
- Clone the repository:
git clone https://github.com/skynette/solana-wallet-analyzer.git
cd solana-wallet-analyzer
- Install dependencies:
npm install
# or
yarn install
- Set up environment variables in
.env.local
:
NEXT_PUBLIC_ALCHEMY_API_KEY=your_alchemy_key
NEXT_PUBLIC_MORALIS_API_KEY=your_moralis_key
OPENAI_API_KEY=your_openai_key
GEMINI_API_KEY=your_gemini_key
- Start the development server:
npm run dev
# or
yarn dev
- Build for production:
npm run build
# or
yarn build
The application is built using Next.js 13+ with the App Router, featuring a modern, component-based architecture that emphasizes:
-
Server-Side Components
- Optimized data fetching
- Improved SEO capabilities
- Reduced client-side JavaScript
-
Client-Side Interactivity
- Real-time updates
- Responsive UI components
- Seamless user experience
-
Data Layer
- Multiple data providers
- Fallback mechanisms
- Caching strategies
- Next.js 13+ (React framework)
- Tailwind CSS (Styling)
- Framer Motion (Animations)
- Recharts (Data visualization)
- shadcn/ui (UI components)
- Next.js API Routes
- Solana Web3.js
- Moralis SDK
- AI Integration (Gemini & OpenAI)
- Vercel (Recommended deployment)
- Edge Functions support
- API Route handlers
- WalletSearch Page (
src/app/wallet/[address]/page.tsx
)
'use client';
import { useParams } from 'next/navigation';
// ... component code
- Handles dynamic routing
- Manages URL parameters
- Controls layout structure
- WalletSearch Component
interface WalletSearchProps {
initialAddress?: string;
}
// ... component implementation
- Core functionality wrapper
- State management
- Data fetching orchestration
- Balance Card
- Displays current SOL balance
- Shows value in USD
- Animated updates
- Line Chart
- Historical balance tracking
- Interactive tooltips
- Time-based filtering
- Pie Chart
- Token distribution
- Interactive segments
- Percentage calculations
- Transaction Table
- Paginated transaction history
- Sortable columns
- Transaction details
- Initial Load
graph TD
A[User Input] --> B[Address Validation]
B --> C[Parallel Data Fetch]
C --> D[Solana RPC]
C --> E[Moralis API]
D --> F[Data Processing]
E --> F
F --> G[State Update]
G --> H[UI Render]
- Analysis Process
graph TD
A[Transaction Data] --> B[Data Formatting]
B --> C[AI Analysis Pipeline]
C --> D[Gemini Analysis]
C --> E[OpenAI Backup]
C --> F[Fallback Analysis]
D --> G[Result Processing]
E --> G
F --> G
G --> H[UI Update]
POST /api/analyze
Request Body:
{
transactions: Transaction[];
tokens: Token[];
address: string;
}
Response:
{
analysis: {
text: string;
metrics?: {
riskScore: number;
tradingFrequency: string;
portfolioDiversity: string;
};
}
}
GET /api/tokens/:address
Response:
{
tokens: {
mint: string;
amount: number;
decimals: number;
price?: number;
name?: string;
symbol?: string;
}[];
}
All API endpoints follow a consistent error response format:
{
error: string;
code?: string;
details?: unknown;
}
import WalletSearch from '@/components/WalletSearch';
// Usage
<WalletSearch initialAddress="optional-address" />
Props:
initialAddress?: string
- Optional initial wallet address
State:
address: string
- Current wallet addressbalance: number | null
- Current SOL balancetransactions: Transaction[]
- Transaction historytokens: Token[]
- Token holdingsloading: boolean
- Loading stateerror: string | null
- Error state
import BalanceCard from '@/components/balanceCard';
// Usage
<BalanceCard SOLBalance={balance} />
Props:
SOLBalance: number
- SOL balance to display
import TransactionTable from '@/components/transactions/transaction-table';
// Usage
<TransactionTable
transactions={transactions}
address={address}
/>
Props:
transactions: Transaction[]
- Array of transactionsaddress: string
- Wallet address
- Fork the repository
- Create a new branch:
git checkout -b feature/your-feature-name
- Enable pre-commit hooks:
npm run prepare
# or
yarn prepare
- TypeScript
- Strict type checking enabled
- Interface over type where possible
- Proper error handling
- Comprehensive type definitions
- React Best Practices
- Functional components
- Custom hooks for logic separation
- Proper use of useEffect and dependencies
- Memoization where appropriate
- Testing
- Jest for unit tests
- React Testing Library for component tests
- E2E tests with Cypress
- Update documentation
- Add/update tests
- Ensure CI passes
- Request review from maintainers
- Focus on:
- Type safety
- Performance
- Security
- Code clarity
- Test coverage
- Connect your repository to Vercel
- Configure environment variables
- Deploy with:
vercel --prod
- Build the application:
npm run build
# or
yarn build
- Start the production server:
npm start
# or
yarn start
Required environment variables:
# Required
NEXT_PUBLIC_ALCHEMY_API_KEY=
NEXT_PUBLIC_MORALIS_API_KEY=
# Optional (for AI features)
OPENAI_API_KEY=
GEMINI_API_KEY=
- Performance Monitoring
- Vercel Analytics
- Custom metric tracking
- Error logging
- Updates and Maintenance
- Regular dependency updates
- Security patches
- Performance optimizations
- API Key Protection
- Use environment variables
- Implement rate limiting
- Add request validation
- Data Safety
- No private key handling
- Public data only
- Secure API endpoints
This completes the comprehensive documentation for the Solana Wallet Analysis tool. For additional support or questions, please open an issue in the repository.