import React, { useState } from 'react'; import { Num, useToast } from '../components/ui/index'; interface Props { balance: { sol: number; usdt: number }; onSent: () => void; } export default function SendPage({ balance, onSent }: Props) { const [token, setToken] = useState<'SOL' | 'USDT'>('SOL'); const [to, setTo] = useState(''); const [amount, setAmount] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const [success, setSuccess] = useState(null); const [step, setStep] = useState<'form' | 'confirm' | 'done'>('form'); const [risk, setRisk] = useState(null); const { addToast } = useToast(); const max = token === 'SOL' ? balance.sol : balance.usdt; const amt = parseFloat(amount) || 0; const review = async () => { setError(''); if (!to.trim()) return setError('Recipient address required'); if (!/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(to.trim())) return setError('Invalid Solana address'); if (!amt || amt <= 0) return setError('Enter a valid amount'); if (amt > max) return setError(`Insufficient balance. Max: ${max.toFixed(token === 'SOL' ? 4 : 2)} ${token}`); // AI risk assessment before showing confirmation if (window.solvox) { try { const r = await window.solvox.ai.assessRisk({ amount: amt, token, to: to.trim() }); if (r.success) setRisk(r.risk); } catch {} } setStep('confirm'); }; const send = async () => { setLoading(true); setError(''); try { const r = window.solvox ? await window.solvox.ai.executeConfirmed({ token, amount: amt, to: to.trim() }) : { success: true, signature: 'dev_' + Date.now(), explorer: '#' }; if (r.success) { setSuccess(r); setStep('done'); onSent(); addToast({ type: 'success', title: `${amount} ${token} sent` }); } else { setError(r.error || 'Transaction failed'); setStep('form'); } } catch (e: any) { setError(e.message); setStep('form'); } setLoading(false); }; const reset = () => { setTo(''); setAmount(''); setError(''); setSuccess(null); setRisk(null); setStep('form'); }; return (

Send {token}

Balance: {token}

{step === 'form' && (
{/* Token */}
{(['SOL', 'USDT'] as const).map(t => ( ))}
{/* Recipient */}
setTo(e.target.value)} placeholder="Solana address" className="input-field font-mono text-body-sm" />
{/* Amount */}
setAmount(e.target.value)} placeholder="0.00" step="any" className="input-field number-mono text-title-lg text-center" />
{[25, 50, 75, 100].map(p => ( ))}
{error &&
{error}
}
)} {step === 'confirm' && (
Confirm transaction
{amount} {token}
To{to.slice(0, 10)}…{to.slice(-6)}
Fee~0.000005 SOL
NetworkDEVNET
{/* AI Risk Assessment */} {risk && (
AI RISK: {risk.level.toUpperCase()} {risk.score}/100
{risk.factors?.length > 0 &&
    {risk.factors.map((f: string, i: number) =>
  • · {f}
  • )}
} {risk.recommendation &&
{risk.recommendation}
}
Analyzed by @qvac/llm-llamacpp + @qvac/embed-llamacpp
)} {error &&
{error}
}
)} {step === 'done' && success && (
Sent

{amount} {token} sent successfully

{success.signature}
View on Solscan →
)}
); }