import { DriftTradingService } from './lib/drift-trading.js'

async function testDirectBalance() {
  console.log('🔍 Testing direct balance retrieval...')
  
  try {
    const driftService = new DriftTradingService()
    
    console.log('🔐 Attempting login...')
    const loginResult = await driftService.login()
    console.log('✅ Login result:', loginResult)
    
    if (loginResult.isLoggedIn && loginResult.userAccountExists) {
      console.log('💰 Getting account balance...')
      const balance = await driftService.getAccountBalance()
      console.log('📊 Balance result:', balance)
      
      console.log('📈 Getting positions...')
      const positions = await driftService.getPositions()
      console.log('📊 Positions result:', positions)
    } else {
      console.log('❌ Login failed or account does not exist')
    }
    
  } catch (error) {
    console.error('❌ Error:', error)
  }
}

testDirectBalance()
  .then(() => console.log('✅ Test completed'))
  .catch(error => console.error('❌ Test failed:', error))
