We explore the mechanism that can explain the production of lepton asymmetry and two types of sterile neutrino dark matter. The first type involves heavy sterile dark matter produced directly by the decay of Q-balls which are formed by first-order phase transition in the early universe; the second consists of keV sterile neutrino dark matter, produced resonantly with the aid of lepton asymmetry from Q-ball decay. Besides, gravitational waves from cosmic strings generated during the phase transition process could be detected at future interferometers.