Hi SMarsh404,
I had similar issues to you back for TKR #1 (left) in 2016... and what I learned over much time, is I don't react "properly" to the opioids they gave me; they don't help with pain and I couldn't sleep. That's when I found Bonesmart, in fact: up most nights, napping alot during the days. No fun!
Back then when I finally was taken off Oxy and put on Tramadol and Tylenol, that was the trick. I could sleep again, and the pain was far more dulled.
I wonder if it's the drugs they've given you to take? Do you have notes from last time and is it the same compound? Since I know there are some people some drugs don't work for, maybe it might be a question to ask?
The moderators here also might chime in, too, with any thoughts they have. But if it's the same as you took before, then my guess isn't very helpful, perhaps... I take some things before bed that have helped with sleep this time, and depending on where you are they might be legal, but might not... I do take a turmeric compound, that my doctor (my GP) had suggested might be useful for inflammation, but see who else might chime in with ideas, too...