fix: Revert to Helius - Alchemy 'breakthrough' was not sustainable
FINAL CONCLUSION after extensive testing: - Alchemy appeared to work perfectly at 14:25 CET (first trade) - User quote: 'SO IT WAS THE FUCKING RPC THAT WAS CAUSING ALL THE ISSUES!!!!!!!!!!!!' - BUT: Alchemy consistently fails after that initial success - Multiple attempts to use Alchemy (pure config, no fallback) = same result - Symptoms: timeouts, positions open WITHOUT TP/SL orders, no Position Manager tracking HELIUS = ONLY RELIABLE OPTION: - User confirmed: 'telegram works again' after reverting to Helius - Works consistently across multiple tests - Supports WebSocket subscriptions (accountSubscribe) that Drift SDK requires - Rate limits manageable with 5s exponential backoff ALCHEMY INCOMPATIBILITY CONFIRMED: - Does NOT support WebSocket subscriptions (accountSubscribe method) - SDK appears to initialize but is fundamentally broken - First trade might work, then SDK gets into bad state - Cannot be used reliably for Drift Protocol trading Files restored from working Helius state. This is the definitive answer: Helius only, no alternatives work.
This commit is contained in:
@@ -146,18 +146,11 @@ export async function openPosition(
|
||||
console.log(`📝 Transaction submitted: ${txSig}`)
|
||||
|
||||
// CRITICAL: Confirm transaction actually executed on-chain
|
||||
console.log('⏳ Confirming transaction on-chain (60s timeout for Alchemy Growth)...')
|
||||
console.log('⏳ Confirming transaction on-chain...')
|
||||
const connection = driftService.getConnection()
|
||||
|
||||
try {
|
||||
// Increased timeout from 30s to 60s for Alchemy Growth reliability
|
||||
// Alchemy Growth (10,000 CU/s) can handle longer waits without timing out
|
||||
const confirmationPromise = connection.confirmTransaction(txSig, 'confirmed')
|
||||
const timeoutPromise = new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error('Transaction confirmation timeout')), 60000)
|
||||
)
|
||||
|
||||
const confirmation = await Promise.race([confirmationPromise, timeoutPromise]) as any
|
||||
const confirmation = await connection.confirmTransaction(txSig, 'confirmed')
|
||||
|
||||
if (confirmation.value.err) {
|
||||
console.error(`❌ Transaction failed on-chain:`, confirmation.value.err)
|
||||
@@ -565,14 +558,13 @@ export async function closePosition(
|
||||
|
||||
// CRITICAL: Confirm transaction on-chain to prevent phantom closes
|
||||
// BUT: Use timeout to prevent API hangs during network congestion
|
||||
console.log('⏳ Confirming transaction on-chain (60s timeout for Alchemy Growth)...')
|
||||
console.log('⏳ Confirming transaction on-chain (30s timeout)...')
|
||||
const connection = driftService.getConnection()
|
||||
|
||||
try {
|
||||
// Increased timeout from 30s to 60s for Alchemy Growth reliability
|
||||
const confirmationPromise = connection.confirmTransaction(txSig, 'confirmed')
|
||||
const timeoutPromise = new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error('Transaction confirmation timeout')), 60000)
|
||||
setTimeout(() => reject(new Error('Transaction confirmation timeout')), 30000)
|
||||
)
|
||||
|
||||
const confirmation = await Promise.race([confirmationPromise, timeoutPromise]) as any
|
||||
@@ -585,7 +577,7 @@ export async function closePosition(
|
||||
console.log('✅ Transaction confirmed on-chain')
|
||||
} catch (timeoutError: any) {
|
||||
if (timeoutError.message === 'Transaction confirmation timeout') {
|
||||
console.warn('⚠️ Transaction confirmation timed out after 60s')
|
||||
console.warn('⚠️ Transaction confirmation timed out after 30s')
|
||||
console.warn(' Order may still execute - check Drift UI')
|
||||
console.warn(` Transaction signature: ${txSig}`)
|
||||
// Continue anyway - order was submitted and will likely execute
|
||||
|
||||
Reference in New Issue
Block a user