I really really doubt your potassium is high. Have you had blood tests recently? That’s a pretty common test to run, so you can just look back at recent tests.
@jca mentioned magnesium, which also is good in combo with vitamin D for muscles. You can buy magnesium spray also and it is absorbed fairly well through the skin, if you have a particular area that is cramping or sore. Just be careful not to spray too much because of how well it is absorbed. Magnesium, like potassium, affects heart rhythm.
If you get foot and leg cramps remember to flex your foot as soon as it’s happening to stop it. You can train yourself to do this in the middle of the night. Make sure your sheets are loose enough that you can freely move your feet.
Let us know if you go to get some blood tests. Bring a banana and eat it 30 minutes before (or whatever time it usually starts happening) the blood draw so you can see what happens.
You want at minimum:
CMP
CBC
B12
D
magnesium
It’s very possible your doctor regularly tests you for most of those already.
If you have any thyroid indications that would also be adding TSH, T4free and total T3. Those include dry skin, dry hair, excessive loss of hair, sleep changes both can’t sleep and needing too much sleep. You didn’t mention any of that, I only mention it because muscle problems are seen in thyroid patients, but I personally believe vitamin D is more often the most common culprit.
I’m not a doctor.