revert: Remove Alchemy fallback causing crashes

- getFallbackConnection() code was causing execute endpoint to crash
- Reverting to Helius-only configuration
- Need to investigate root cause before re-adding fallback
This commit is contained in:
mindesbunister
2025-11-14 20:10:21 +01:00
parent 6445a135a8
commit db0961d04e
2 changed files with 5 additions and 27 deletions

View File

@@ -470,13 +470,6 @@ export class DriftService {
return this.connection return this.connection
} }
/**
* Get fallback connection (Alchemy for trade execution)
*/
getFallbackConnection(): Connection | null {
return this.fallbackConnection || null
}
/** /**
* Get user instance * Get user instance
*/ */

View File

@@ -146,16 +146,8 @@ export async function openPosition(
console.log(`📝 Transaction submitted: ${txSig}`) console.log(`📝 Transaction submitted: ${txSig}`)
// CRITICAL: Confirm transaction actually executed on-chain // CRITICAL: Confirm transaction actually executed on-chain
// Use Alchemy (fallback RPC) for confirmation - higher throughput console.log('⏳ Confirming transaction on-chain...')
console.log('⏳ Confirming transaction on-chain (using Alchemy for high throughput)...') const connection = driftService.getConnection()
const alchemyConnection = driftService.getFallbackConnection()
const connection = alchemyConnection || driftService.getConnection()
if (alchemyConnection) {
console.log('✅ Using Alchemy RPC for transaction confirmation')
} else {
console.log('⚠️ No fallback RPC available, using primary RPC')
}
try { try {
const confirmation = await connection.confirmTransaction(txSig, 'confirmed') const confirmation = await connection.confirmTransaction(txSig, 'confirmed')
@@ -565,16 +557,9 @@ export async function closePosition(
console.log(`✅ Close order placed! Transaction: ${txSig}`) console.log(`✅ Close order placed! Transaction: ${txSig}`)
// CRITICAL: Confirm transaction on-chain to prevent phantom closes // CRITICAL: Confirm transaction on-chain to prevent phantom closes
// Use Alchemy (fallback RPC) for confirmation - higher throughput // BUT: Use timeout to prevent API hangs during network congestion
console.log('⏳ Confirming transaction on-chain (using Alchemy, 30s timeout)...') console.log('⏳ Confirming transaction on-chain (30s timeout)...')
const alchemyConnection = driftService.getFallbackConnection() const connection = driftService.getConnection()
const connection = alchemyConnection || driftService.getConnection()
if (alchemyConnection) {
console.log('✅ Using Alchemy RPC for transaction confirmation')
} else {
console.log('⚠️ No fallback RPC available, using primary RPC')
}
try { try {
const confirmationPromise = connection.confirmTransaction(txSig, 'confirmed') const confirmationPromise = connection.confirmTransaction(txSig, 'confirmed')