import { NextResponse } from 'next/server' import { bitqueryService } from '../../../lib/bitquery-service' export async function GET() { try { console.log('📊 Fetching market data...') // Check if Bitquery service is configured if (!bitqueryService.isConfigured()) { return NextResponse.json( { success: false, error: 'Bitquery service not configured' }, { status: 503 } ) } // Get token prices for popular cryptocurrencies const symbols = ['SOL', 'BTC', 'ETH', 'AVAX', 'ADA'] const prices = await bitqueryService.getTokenPrices(symbols) // Get service status const status = await bitqueryService.getServiceStatus() return NextResponse.json({ success: true, data: { prices, status, lastUpdated: Date.now() }, timestamp: Date.now() }) } catch (error) { console.error('❌ Market data API error:', error) return NextResponse.json( { success: false, error: 'Failed to fetch market data', message: error.message }, { status: 500 } ) } }