Donald Trump has signed a deal aimed at ending the war with Iran.