I'm sure you did lots wrong (we all do in relationships), but ultimately, even if you did everything correct, addiction is a serious mental illness so trying to figure out what you did wrong is like trying to figuring out why you don't have the power to turn a dog into a cat.
Your mind will race with these thoughts for many many weeks and then slowly you will have these moments of clarity or an epiphany and you will say "Ahhh now I get it"
Hard to get it now, cause you're in pain and the clouds are still thick.