Untitled
I am developing a Solana copy trading sniper bot in TypeScript to integrate with an existing wallet monitoring dashboard: PROJECT CONTEXT: - Location: C:\Users\diana\OneDrive\Documents\SolanaProjects\wallet-dashboard\sniper-bot - Integration Type: Direct integration with existing dashboard - Technology Stack: TypeScript backend - Network: Solana blockchain with SPL tokens - RPC Provider: QuickNode JSON-RPC endpoints I am developing a Solana copy trading sniper bot in TypeScript with the following specifications: ENVIRONMENT: - Network: Solana Blockchain - Token Type: SPL Tokens - RPC Provider: QuickNode JSON-RPC endpoints - DEX Integration: Jupiter - Project Structure: Following established backend TypeScript structure CORE FUNCTIONALITY: 1. Mode Toggle: Real Trading Mode: - Enables live trading with real assets - Connects to DEX (Jupiter) for actual swaps - Uses real wallet balance for fund verification - Executes real blockchain transactions Paper Trading Mode: - Simulates trades without actual execution - Tracks theoretical positions and balances - Uses mock wallet balance - Records trades for analysis 2. Essential Monitoring: Transaction Detection: - WebSocket connection to track target wallets - Real-time transaction monitoring - Instant notification of new transactions - Parse transaction data for trade details Token Identification: - Extract token mint addresses - Verify token exists on Solana - Check token program association - Identify token decimals and metadata Buy/Sell Detection: - Parse transaction instructions - Identify swap instructions - Determine trade direction (buy/sell) - Extract trade amounts and tokens 3. Basic Verification: Fund Check: - Real Mode: Verify SOL balance - Paper Mode: Check simulated balance - Validate against min/max trade sizes - Check portfolio allocation limits Token Tradability: - Verify token exists on Jupiter - Check liquidity availability - Verify not on blacklist - Confirm trade route exists Slippage Check: - Calculate potential slippage - Compare against 8% maximum - Check price impact - Verify trade viable 4. Quick Execution: Real Mode: - Create swap transaction: * Build Jupiter swap instruction * Set token accounts * Apply slippage tolerance * Set gas priority - Execute trade: * Send transaction * Get transaction signature * Monitor for confirmation * Update balances - Verify success: * Check transaction status * Confirm token receipt * Update portfolio * Log trade details Paper Mode: - Record simulated trade: * Log entry price * Calculate token amounts * Apply theoretical slippage * Time stamp entry - Track position: * Update paper portfolio * Calculate theoretical P/L * Track position size * Monitor token price 5. Error Recovery: Failed Trades: - Transaction timeout handling - Failed transaction recovery - Balance verification retry - State reconciliation Network Issues: - Connection loss handling - WebSocket reconnection - RPC failover - State recovery Interrupted Operations: - Transaction status check - Position reconciliation - Balance confirmation - Log incomplete trades CONFIGURABLE PARAMETERS: Position Parameters: Max trade size: [Configurable] SOL Min trade size: [Configurable] SOL Max portfolio allocation: [Configurable]% Paper trading balance: [Configurable] SOL Safety Limits: Max slippage: 8% Min SOL reserve: [Configurable] SOL Max concurrent trades: [Configurable] REQUIRED CONNECTIONS: - QuickNode RPC endpoint - WebSocket for transaction monitoring - DEX interface connection - Price feed integration - Wallet integration (read/execute permissions) INTEGRATION REQUIREMENTS: 1. Dashboard Integration: - Connect with existing wallet monitoring system - Utilize existing RPC connections if available - Extend current transaction monitoring - Integrate with existing UI components 2. Data Flow: - Share wallet monitoring data - Unified transaction tracking - Combined performance metrics - Integrated error handling 3. System Requirements: - Maintain existing dashboard performance - Reuse existing connections where possible - Extend current logging system - Share authentication/authorization Additional technical requirements: 1. Utilize @solana/web3.js for blockchain interactions 2. Implement @project-serum/serum for DEX integration 3. Use @solana/spl-token for token operations 4. Include error handling for network issues 5. Implement comprehensive logging system Project location: C:\Users\diana\OneDrive\Documents\SolanaProjects\wallet-dashboard\sniper-bot Could you please: 1. Confirm the existing dashboard structure 2. Indicate which file we should start with 3. Specify any existing utilities/helpers we should utilize 4. Note any specific integration constraints This will help ensure we build the sniper bot in a way that seamlessly integrates with our current system. DO NOT CODE ANYTHING, but respond with critical feedback and answer those questions. THEN ask me how I want you to behave as we work together on this project.
Leave a Comment