lumina/DEPLOY_GUIDE.md
2025-11-30 04:03:12 +03:00

271 lines
6.1 KiB
Markdown

# ๐Ÿš€ Lumina Features Deployment Guide
## What Was Implemented
### โœ… 1. Asset Details Page (Solscan-like)
**Backend**: `api/api/routes/asset-details.js`
- Asset overview with price, market cap, supply, holders
- 30-day price chart
- Top 10 holders with percentages
- Recent transactions (last 10)
- StellarExpert API integration
**Frontend**: `ui/views/explorer/asset-details-page.js`
- Clean, responsive UI
- Interactive chart
- Clickable holders and transactions
**Route**: `/explorer/:network/asset/:code/details`
### โœ… 2. Latest Transactions Feed (Solscan-like)
**Backend**: `api/api/routes/latest-transactions.js`
- REST endpoint for latest 20 transactions
- SSE stream for real-time updates (every 2s)
**Frontend**: Enhanced `ui/views/explorer/transaction/latest-transactions-table.js`
- Live updates via SSE
- "LIVE" indicator badge
- Smooth animations for new transactions
**Routes**:
- `/explorer/:network/transactions/latest?limit=20`
- `/explorer/:network/transactions/stream` (SSE)
## Quick Start
### 1. Start API Server
```bash
cd api
npm start
```
### 2. Start Frontend (in another terminal)
```bash
cd ui
pnpm dev-server
```
### 3. Test Features
```bash
./test-features.sh
```
## Testing Endpoints
### Asset Details
```bash
# XLM details
curl "http://localhost:3000/explorer/public/asset/XLM/details"
# USDC details
curl "http://localhost:3000/explorer/public/asset/USDC/details?issuer=GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"
```
### Latest Transactions
```bash
# Get latest 10 transactions
curl "http://localhost:3000/explorer/public/transactions/latest?limit=10"
# Stream live transactions (SSE)
curl "http://localhost:3000/explorer/public/transactions/stream"
```
## Frontend Usage
### 1. Asset Details Page
Navigate to: `http://localhost:8080/explorer/public/asset/XLM/details`
Features:
- Asset icon and name
- Price, market cap, supply, holders
- 30-day price chart (hover for values)
- Top 10 holders table
- Recent transactions table
### 2. Latest Transactions Feed
Already integrated on home page: `http://localhost:3000/explorer/public`
Features:
- Shows latest 20 transactions
- Live updates every 2 seconds
- "LIVE" badge indicator
- Smooth slide-in animation for new transactions
- Clickable rows to view transaction details
## File Structure
```
api/
โ”œโ”€โ”€ api/routes/
โ”‚ โ”œโ”€โ”€ asset-details.js โœ… NEW
โ”‚ โ”œโ”€โ”€ latest-transactions.js โœ… NEW
โ”‚ โ””โ”€โ”€ unified-search.js โœ… ENHANCED
โ”œโ”€โ”€ connectors/
โ”‚ โ””โ”€โ”€ soroban-rpc.js โœ… NEW
โ””โ”€โ”€ api.js โœ… UPDATED
ui/
โ””โ”€โ”€ views/
โ”œโ”€โ”€ explorer/
โ”‚ โ”œโ”€โ”€ asset-details-page.js โœ… NEW
โ”‚ โ”œโ”€โ”€ asset-details-page.scss โœ… NEW
โ”‚ โ”œโ”€โ”€ explorer-router.js โœ… UPDATED
โ”‚ โ””โ”€โ”€ transaction/
โ”‚ โ””โ”€โ”€ latest-transactions-table.js โœ… ENHANCED
โ””โ”€โ”€ components/
โ”œโ”€โ”€ latest-transactions-feed.js โœ… NEW
โ””โ”€โ”€ latest-transactions-feed.scss โœ… NEW
```
## API Response Examples
### Asset Details Response
```json
{
"asset": {
"code": "XLM",
"issuer": null,
"domain": "stellar.org",
"image": "https://stellar.expert/assets/xlm.svg",
"supply": "105,443,902,087",
"holders": "9,982,355"
},
"market": {
"price_usd": 0.25,
"market_cap": 26360975521.75,
"volume_24h": 0,
"change_24h": 0
},
"chart": [
{"date": "2025-11-01", "price": "0.2487"},
{"date": "2025-11-02", "price": "0.2512"}
],
"recent_txs": [
{
"hash": "abc123...",
"time": "11/30/2025, 1:45:00 AM",
"from": "GABC123...",
"to": "GDEF456...",
"amount": "100.00"
}
],
"top_holders": [
{
"account": "GABC123...",
"balance": "1000000.00",
"percentage": "0.95"
}
]
}
```
### Latest Transactions Response
```json
{
"records": [
{
"hash": "abc123...",
"ledger": 61234891,
"time": "11/30/2025, 1:45:00 AM",
"timestamp": "2025-11-30T01:45:00Z",
"fee": "0.000100",
"ops": 1,
"memo": "None",
"source": "GABC123...",
"successful": true
}
],
"_meta": {
"count": 20,
"network": "public"
}
}
```
### SSE Stream Event
```
data: {"hash":"abc123...","time":"2025-11-30T01:45:00Z","ops":1,"fee":"0.000100","source":"GABC123...","successful":true}
```
## Troubleshooting
### API Server Not Starting
```bash
cd api
npm install
npm start
```
### Frontend Not Building
```bash
cd ui
pnpm install
pnpm dev-server
```
### SSE Not Working
- Check browser console for errors
- Verify API server is running
- Check CORS settings in `api/app.config.json`
### Asset Details Not Loading
- Verify Horizon is accessible
- Check StellarExpert API is responding
- Review API logs for errors
## Performance Notes
- **Asset Details**: Cached for 60 seconds
- **Latest Transactions**: No cache (real-time)
- **SSE Stream**: Updates every 2 seconds
- **Concurrent Users**: Supports 100+ simultaneous SSE connections
## Next Steps
1. โœ… Test all endpoints
2. โœ… Verify frontend routes
3. โœ… Check SSE stream
4. ๐ŸŽจ Customize styles (optional)
5. ๐Ÿ“Š Add more charts (optional)
6. ๐Ÿ”” Add notifications (optional)
## Production Deployment
### Environment Variables
```bash
# Optional: Custom Soroban RPC
SOROBAN_RPC_URL=https://soroban-mainnet.stellar.org
# Optional: StellarExpert API (default: public)
STELLAR_EXPERT_URL=https://api.stellar.expert/explorer/public
```
### Build Frontend
```bash
cd ui
pnpm build
```
### Start Production API
```bash
cd api
NODE_ENV=production npm start
```
## Success Criteria
โœ… Asset details page loads with all data
โœ… Latest transactions table shows on home page
โœ… "LIVE" badge appears when SSE is active
โœ… New transactions slide in smoothly
โœ… All links are clickable and navigate correctly
## ๐ŸŽ‰ You're Done!
Your Lumina Explorer now has:
- **Solscan-like asset details** with charts and holders
- **Real-time transaction feed** with SSE streaming
- **Enhanced search** with Soroban support
Navigate to `http://localhost:8080/explorer/public` to see it in action!