I know Epsom salts are recommended, but very slowly to help relieve some of the pressure. I am not good with treatments so I will leave you to one of the experts.
You say this happened over the course of a few days?
the sooner you treat the better. often the bloating is caused by internal organs shutting down allowing fluid to build up in the body cavity. Often by the time you see such advanced swelling it's too late to treat.
internal bacterial infection, viruses, and poor water quality are a few of the possible causes.
dropsy is not very contagious but if the fish dies try to remove it quickly from the tank.