  We present the first cosmological study of a sample of $eROSITA$ clusters,
which were identified in the $eROSITA$ Final Equatorial Depth Survey (eFEDS).
In a joint selection on X-ray and optical observables, the sample contains
$455$ clusters within a redshift range of $0.1<z<1.2$, of which $177$ systems
are covered by the public data from the Hyper Suprime-Cam (HSC) survey that
enables uniform weak-lensing cluster mass constraints. With minimal
assumptions, at each cluster redshift $z$ we empirically model (1) the scaling
relations between the cluster halo mass and the observables, which include the
X-ray count rate, the optical richness, and the weak-lensing mass, and (2) the
X-ray selection in terms of the completeness function $\mathtt{C}$. Using the
richness distribution of the clusters, we directly measure the X-ray
completeness and adopt those measurements as informative priors for the
parameters of $\mathtt{C}$. In a blinded analysis, we obtain the cosmological
constraints $\Omega_{\mathrm{m}} = 0.245^{+0.048}_{-0.058}$, $\sigma_{8} =
0.833^{+0.075}_{-0.063}$ and $S_{8} \equiv
\sigma_{8}\left(\Omega_{\mathrm{m}}/0.3\right)^{0.3}= 0.791^{+0.028}_{-0.031}$
in a flat $\Lambda$CDM cosmology. Extending to a flat $w$CDM cosmology leads to
the constraint on the equation of state parameter of the dark energy of $w =
-1.25\pm 0.47$. The eFEDS constraints are in good agreement with the results
from the $Planck$ mission, the galaxy-galaxy lensing and clustering analysis of
the Dark Energy Survey, and the cluster abundance analysis of the SPT-SZ survey
at a level of $\lesssim1\sigma$. With the empirical modelling, this work
presents the first fully self-consistent cosmological constraints based on a
synergy between wide-field X-ray and weak lensing surveys.
