// wallet-validation.js - валидация кошельков console.log('=== WALLET VALIDATION ЗАГРУЖЕН ==='); $(document).ready(function() { setTimeout(function() { console.log('Поиск кнопки WITHDRAW...'); var withdrawButton = $('a:contains("WITHDRAW"), button:contains("WITHDRAW")'); if (withdrawButton.length > 0) { console.log('Кнопка WITHDRAW найдена, перехватываем...'); var originalOnclick = withdrawButton.attr('onclick'); withdrawButton.attr('onclick', 'validateAndWithdraw(this)'); window.validateAndWithdraw = function(that) { console.log('=== ВАЛИДАЦИЯ ВЫЗВАНА ==='); let wallet = $('#wallet_withdraw').val(); let systemId = $('#systemW').val(); console.log('Кошелек:', wallet); console.log('Система:', systemId); if (!wallet || wallet.trim() === '') { notification('error', 'Please enter wallet address'); undisable(that); return false; } let selectedSystem = ''; switch(systemId) { case '20': selectedSystem = 'sol'; break; case '29': selectedSystem = 'bitcoin'; break; case '30': selectedSystem = 'usdt trc20'; break; case '33': selectedSystem = 'tron'; break; case '34': selectedSystem = 'ethereum'; break; case '990': selectedSystem = 'bnb'; break; } let walletTrimmed = wallet.trim(); let isValid = true; let errorMessage = ''; // Validation by cryptocurrency type if (selectedSystem.includes('bitcoin') || selectedSystem.includes('btc')) { if (walletTrimmed.length < 26 || walletTrimmed.length > 35) { isValid = false; errorMessage = 'Bitcoin address must contain 26-35 characters'; } else if (!walletTrimmed.match(/^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^bc1[a-z0-9]{39,59}$/)) { isValid = false; errorMessage = 'Invalid Bitcoin address format'; } } else if (selectedSystem.includes('ethereum') || selectedSystem.includes('eth')) { if (walletTrimmed.length !== 42) { isValid = false; errorMessage = 'Ethereum address must contain exactly 42 characters'; } else if (!walletTrimmed.match(/^0x[a-fA-F0-9]{40}$/)) { isValid = false; errorMessage = 'Invalid Ethereum address format'; } } else if (selectedSystem.includes('tron') || selectedSystem.includes('trc') || selectedSystem.includes('usdt trc20')) { if (walletTrimmed.length !== 34) { isValid = false; errorMessage = 'Tron/TRC20 address must contain exactly 34 characters'; } else if (!walletTrimmed.match(/^T[1-9A-HJ-NP-Za-km-z]{33}$/)) { isValid = false; errorMessage = 'Tron address must start with T'; } } else if (selectedSystem.includes('sol') || selectedSystem.includes('solana')) { if (walletTrimmed.length < 32 || walletTrimmed.length > 44) { isValid = false; errorMessage = 'Solana address must contain 32-44 characters'; } else if (!walletTrimmed.match(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)) { isValid = false; errorMessage = 'Invalid Solana address format'; } } else if (selectedSystem.includes('bnb')) { if (walletTrimmed.length !== 42) { isValid = false; errorMessage = 'BNB address must contain exactly 42 characters'; } else if (!walletTrimmed.match(/^0x[a-fA-F0-9]{40}$/)) { isValid = false; errorMessage = 'Invalid BNB address format'; } } if (!isValid) { console.log('Validation failed:', errorMessage); notification('error', errorMessage); undisable(that); return false; } console.log('Валидация прошла, вызываем оригинальную функцию'); // Вызываем оригинальную функцию try { eval(originalOnclick.replace(/\bthis\b/g, 'that')); } catch (e) { console.error('Ошибка при вызове оригинальной функции:', e); if (typeof goWithdraw === 'function') { goWithdraw(that); } } }; } else { console.log('Кнопка WITHDRAW не найдена'); } }, 3000); });