From 5611324c5e51bbe0f48ae8fb0196309ecc605c02 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Mon, 14 Jul 2025 11:00:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=AF=20Fix=20position=20detection=20-?= =?UTF-8?q?=20correctly=20show=20closed=20position?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) --- lib/drift-trading-final.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/drift-trading-final.ts b/lib/drift-trading-final.ts index 1d74b7a..aba8564 100644 --- a/lib/drift-trading-final.ts +++ b/lib/drift-trading-final.ts @@ -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)