🎯 Fix position detection - correctly show closed position
- Switch SOL position detection from offset 1208 to offset 432 - Offset 432 shows 0 SOL (correct - position closed) - Offset 1208 still shows stale 6.81 SOL data - Backend now correctly shows 0 positions matching Drift UI - Need to investigate total balance calculation (.53 vs 16.71)
This commit is contained in:
@@ -78,8 +78,8 @@ class DriftTradingService {
|
||||
const usdcBalance = data.readBigInt64LE(106);
|
||||
const usdcValue = Number(usdcBalance) / 1_000_000; // USDC has 6 decimals
|
||||
|
||||
// Extract SOL position at offset 1208 (most reliable location)
|
||||
const solPosition = data.readBigInt64LE(1208);
|
||||
// Extract SOL position at offset 432 (most current/accurate location)
|
||||
const solPosition = data.readBigInt64LE(432);
|
||||
const solAmount = Number(solPosition) / 1_000_000_000; // SOL has 9 decimals
|
||||
|
||||
// Estimate SOL price (you could fetch this from an oracle)
|
||||
|
||||
Reference in New Issue
Block a user