  In this paper, we prove a Hardy--Moser--Trudinger inequality in the unit ball
$\mathbb B^n$ in $\mathbb R^n$ which improves both the classical singular
Moser--Trudinger inequality and the classical Hardy inequality at the same
time. More precisely, we show that for any $\beta \in [0,n)$ there exists a
constant $C>0$ depending only on $n$ and $\beta$ such that \[ \sup_{u\in
W^{1,n}_0(\mathbb B^n), \mathcal H(u) \leq 1}\int_{\mathbb B^n}
e^{(1-\frac\beta n)\alpha_n |u|^{\frac n{n-1}}} |x|^{-\beta} dx \leq C \] where
$\alpha_n = n \omega_{n-1}^{\frac1{n-1}}$ with $\omega_{n-1}$ being the surface
area of the unit sphere $S^{n-1} = \partial \mathbb B^n$, and \[ \mathcal H(u)
= \int_{\mathbb B^n} |\nabla u|^n dx -\left(\frac{2(n-1)}n\right)^n
\int_{\mathbb B^n} \frac{|u|^n}{(1-|x|^2)^n} dx. \] This extends an inequality
of Wang and Ye in dimension two to higher dimensions and to the singular case
as well. The proof is based on the method of transplantation of Green's
functions and without using the blow-up analysis method. As a consequence, we
obtain a singular Moser--Trudinger inequality in the hyperbolic spaces which
confirms affirmatively a conjecture by Mancini, Sandeep and Tintarev
\cite[Conjecture $5.2$]{MST}. We also propose an inequality which extends the
singular Hardy--Moser--Trudinger inequality to any bounded convex domain in
$\mathbb R^n$ which is analogue of the conjecture of Wang and Ye in higher
dimensions.
