Comprehensive blockchain data fetching and management for Solana assets, tokens, NFTs, and market information
The Data Module is your central hub for fetching, processing, and managing on-chain and off-chain data related to Solana assets. It provides seamless integration with multiple data sources including Helius, Birdeye, and CoinGecko.
Fetch token metadata, balances, prices, and historical price data from multiple sources
Retrieve user portfolio assets including NFTs and compressed NFTs (cNFTs)
Access comprehensive market data from CoinGecko including OHLC and market details
Fetch and process user swap transaction history with enriched metadata
Environment Variables
Configure your API keys in .env.local
:
Import Module
Import the hooks and services you need:
Start Fetching
Use the hooks in your components to fetch data
tokenService.ts
- Core token data operations
tokenService.ts
- Core token data operations
coingeckoService.ts
- Market data from CoinGecko
tokenDetailsService.ts
- Comprehensive token information
swapTransactions.ts
- Transaction history
Fetches all fungible tokens in a user’s wallet with portfolio data.
Returns:
tokens
- Array of user’s tokensloading
- Loading stateerror
- Error message if anyrefetch
- Function to refresh dataComprehensive token information for detail views.
Parameters:
tokenAddress
- Token mint addressvisible
- Whether to actively fetch dataReturns:
priceHistory
- Historical price datametadata
- Token metadatatokenOverview
- Overview informationloading
- Loading statesselectedTimeframe
- Current timeframehandleTimeframeChange
- Timeframe selectorAccess CoinGecko market data with caching.
Debounced token search with pagination.
Primary Use: RPC calls, transaction history, asset fetching
Primary Use: Token prices, security analysis, market data
Primary Use: Market information, coin listings
API Rate Limits: Be mindful of rate limits when making frequent requests. The module includes retry logic but respect provider limits.
Caching: The module implements intelligent caching for CoinGecko data and token metadata to reduce API calls.
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.