Core Functionalities
Token Data
Fetch token metadata, balances, prices, and historical price data from multiple sources
NFT & Portfolio Assets
Retrieve user portfolio assets including NFTs and compressed NFTs (cNFTs)
Market Information
Access comprehensive market data from CoinGecko including OHLC and market details
Transaction History
Fetch and process user swap transaction history with enriched metadata
Installation & Setup
1
Environment Variables
Configure your API keys in
.env.local:2
Import Module
Import the hooks and services you need:
3
Start Fetching
Use the hooks in your components to fetch data
Module Architecture
Core Services
- Token Service
- CoinGecko Service
- Token Details Service
- Swap Transactions
tokenService.ts - Core token data operationsEssential Hooks
useFetchTokens()
Fetches all fungible tokens in a user’s wallet with portfolio data.tokens- Array of user’s tokensloading- Loading stateerror- Error message if anyrefetch- Function to refresh data
useTokenDetails()
Comprehensive token information for detail views.tokenAddress- Token mint addressvisible- Whether to actively fetch data
priceHistory- Historical price datametadata- Token metadatatokenOverview- Overview informationloading- Loading statesselectedTimeframe- Current timeframehandleTimeframeChange- Timeframe selector
useCoingecko()
Access CoinGecko market data with caching.useTokenSearch()
Debounced token search with pagination.Quick Start Example
Utility Functions
object
object
object
Data Sources Integration
Helius
Primary Use: RPC calls, transaction history, asset fetching
- Enhanced Solana RPC
- Transaction parsing
- Asset metadata
Birdeye
Primary Use: Token prices, security analysis, market data
- Real-time prices
- Security scoring
- Trade data
- Price history
CoinGecko
Primary Use: Market information, coin listings
- Coin directories
- Market cap data
- OHLC data
- Global statistics
Advanced Usage Patterns
Custom Data Fetching
Batch Data Operations
Real-time Price Updates
Error Handling
Performance Optimization
Integration with Other Modules
With Wallet Providers
With Swap Module
Troubleshooting
object
API Reference
For detailed API documentation, see:The Data Module serves as the foundation for all blockchain data needs in your Solana application, providing reliable, cached, and efficiently formatted data from multiple sources.