You're lucky the truck didn't burn to the ground!
You need to replace the cables and that battery(s) is likely junk. Getting hot enough to melt a post is hot enough to melt the internal plates and short them out.
Did the starter stick on and overheat or what?