diff --git a/app/api/withdrawals/settings/route.ts b/app/api/withdrawals/settings/route.ts index c9d69e4..93c2df2 100644 --- a/app/api/withdrawals/settings/route.ts +++ b/app/api/withdrawals/settings/route.ts @@ -19,7 +19,7 @@ const DEFAULT_SETTINGS = { MIN_WITHDRAWAL_AMOUNT: 50, // Minimum $50 MIN_ACCOUNT_BALANCE: 500, // Never drop below $500 WITHDRAWAL_DESTINATION: process.env.WALLET_PUBLIC_KEY || '', - LAST_WITHDRAWAL_TIME: null, + LAST_WITHDRAWAL_TIME: null as string | null, TOTAL_WITHDRAWN: 0, } diff --git a/app/api/withdrawals/stats/route.ts b/app/api/withdrawals/stats/route.ts index 285a185..cfd1eca 100644 --- a/app/api/withdrawals/stats/route.ts +++ b/app/api/withdrawals/stats/route.ts @@ -18,7 +18,7 @@ export async function GET() { // Get current Drift balance const driftService = await initializeDriftService() const health = await driftService.getAccountHealth() - const currentBalance = parseFloat(health.freeCollateral) + const currentBalance = health.freeCollateral // Already a number // Calculate total P&L from database const trades = await prisma.trade.findMany({ diff --git a/lib/drift/withdraw.ts b/lib/drift/withdraw.ts index 6604c65..a59c47b 100644 --- a/lib/drift/withdraw.ts +++ b/lib/drift/withdraw.ts @@ -45,7 +45,7 @@ export async function withdrawFromDrift( // Execute withdrawal via Drift SDK // withdraw(amount, marketIndex, associatedTokenAddress, reduceOnly, subAccountId, txParams, updateFuel) - const signature = await driftService.getDriftClient().withdraw( + const signature = await driftService.getClient().withdraw( tokenAmount, usdcMarketIndex, destination, @@ -93,7 +93,7 @@ export async function calculateWithdrawalAmount(): Promise<{ try { const driftService = await initializeDriftService() const health = await driftService.getAccountHealth() - const currentBalance = parseFloat(health.freeCollateral) + const currentBalance = health.freeCollateral // Already a number // Configuration const totalInvested = 546 // From roadmap