I had a hip replacement on my left hip 4 years ago. Since April I have had persistent pain in my left leg upper thigh area. The doctor diagnosed the problem as hip tendonitis, he did give a steroid injection back in April and a week later prescribed a weeks worth of some steroid pills. My main problem has been after sitting down then standing up, the pain kicks in. I use one of those forearm crutches to get around. Sometimes the pain eases but it always comes back after sitting down and standing up.
It got worse and worse about 9 weeks ago while I was in the USA, as I didn't have health insurance coverage there, I didn't get any medical assistance there other than my forearm crutch.
When I returned to Thailand and visited the doctor at the hospital where I had my hip replacement, the doctor diagnosed it as calcification hip tendonitis, he didn't know what to say regarding treatment, gave me a steroid injection at the time and he prescribed Norgesic and Celebrex I decided to visit the therapy department at the hospital and I was having ultrasound therapy 3 times a week for a couple weeks. Then they added laser therapy after the ultrasound. That went on for a couple weeks then they upgraded my therapy to shock wave therapy and electric shock therapy, it got a bit better.
I was advised to do some exercises, maybe this will help:
https://www.verywellhealth.com/hip-tendonitis-exercises-5119249
The therapy people advised to more or less do this: RICE therapy (Rest, Ice, Compression, Elevation). They didn't really get into the Compression part. In the local drug stores, you will see all sorts of wraps for ankle pain, elbow pain, wrist pain, back pain, but not much in the hip area. I found this on Walmart online while in the US:
If your problem is in the upper thigh area, you may find that hip wrap will help. I have found that wrap to be really helpful. I use it all day, take it off before bed. I still have a bit of pain when standing up, at least my leg pain is no longer holding me hostage.
As you said, you have pain while sleeping, maybe you should not lay on the side where you had the hip replacement, mine was on the left side, I was advised to sleep on my right side with a comforter between my legs.
Hope this helps!