I shared the same experience. Try doing ankle stretch exercises before bedtime. Also, when I had cramps in the middle of the night, curling up on the side of the cramps plus bending and straightening that leg repeatedly seemed to stop the cramp more quickly. Sometimes food high in magnesium may help too. It's really painful so I hope you feel better soon!
I faced this too on most nights. I read that its good to do some leg stretches, ankle rotations, massaging ur legs etc. Heard compression leggings helps, but not too sure cus i dun have it so didnt try.