If so, there is a formal contract.....but take a close look at the terms of the contract especially when it comes to right of cancellation by either party.
Did the bank formally tell you they want to walk away, or did they merely tell you they won't do as you asked? The bank doesn't have to agree to any requests for repairs, replacement. Generally, foreclosed homes are sold as is which is likely in the terms of your contract as well.
If you have a realtor representing you, your first step is to direct these questions to your realtor.