✅ Key fixes: - Bypass problematic SDK subscription that caused 410 Gone errors - Use direct account verification without subscription - Add fallback modes for better reliability - Switch to Helius RPC endpoint for better rate limits - Implement proper error handling and retry logic 🔧 Technical changes: - Enhanced drift-trading.ts with no-subscription approach - Added Drift API endpoints (/api/drift/login, /balance, /positions) - Created DriftAccountStatus and DriftTradingPanel components - Updated Dashboard.tsx to show Drift account status - Added comprehensive test scripts for debugging 📊 Results: - Connection Status: Connected ✅ - Account verification: Working ✅ - Balance retrieval: Working ✅ (21.94 total collateral) - Private key authentication: Working ✅ - User account: 3dG7wayp7b9NBMo92D2qL2sy1curSC4TTmskFpaGDrtA 🌐 RPC improvements: - Using Helius RPC for better reliability - Added fallback RPC options in .env - Eliminated rate limiting issues
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Test the drift trading service directly
|
|
*/
|
|
|
|
require('dotenv').config();
|
|
|
|
async function testDriftService() {
|
|
console.log('🌊 Testing DriftTradingService directly...');
|
|
|
|
try {
|
|
// Import the service
|
|
const { driftTradingService } = require('./lib/drift-trading.ts');
|
|
|
|
console.log('📦 Service imported successfully');
|
|
|
|
// Test login
|
|
console.log('🔐 Testing login...');
|
|
const loginResult = await driftTradingService.login();
|
|
|
|
console.log('Login result:', JSON.stringify(loginResult, null, 2));
|
|
|
|
if (loginResult.isLoggedIn) {
|
|
console.log('✅ Login successful! Testing balance...');
|
|
|
|
try {
|
|
const balance = await driftTradingService.getAccountBalance();
|
|
console.log('💰 Balance:', JSON.stringify(balance, null, 2));
|
|
} catch (e) {
|
|
console.log('⚠️ Balance error:', e.message);
|
|
}
|
|
|
|
try {
|
|
const positions = await driftTradingService.getPositions();
|
|
console.log('📊 Positions:', positions.length);
|
|
} catch (e) {
|
|
console.log('⚠️ Positions error:', e.message);
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ Service test failed:', error.message);
|
|
console.error('Stack:', error.stack);
|
|
}
|
|
}
|
|
|
|
testDriftService().catch(console.error);
|