Real forms need field-level validation before allowing submission — e.g. checking that a recipient address is well-formed and an amount is a positive number not exceeding the balance.
function validateSend(address: string, amount: string, balance: number) {
const errors: Record<string, string> = {};
if (!/^0x[a-fA-F0-9]{40}$/.test(address)) errors.address = "Invalid address";
const n = Number(amount);
if (!Number.isFinite(n) || n <= 0) errors.amount = "Enter a positive amount";
else if (n > balance) errors.amount = "Insufficient balance";
return errors;
}Surfacing errors per-field (not just a single generic message) helps users fix mistakes faster, especially in a wallet UI where a wrong address could mean lost funds.