I’m having cramps in my legs when I sleep too. Best solution is to drink more water, eat less salty and oily food and I do wear compression socks to sleep every night. Hope this helps :)
Drink loads of water. I drink lemon water Everyday. Slices of lemon added In my water.