Attorney represents a criminal client accused of murder. The client does not testify at trial. While the criminal case is proceeding, Attorney can sign a contract agreeing to write a book about the case when it is over, provided he discloses nothing confidential. While the criminal case is proceeding, Client can sign a media contract. Separately and independently he can promise to pay Attorney from any proceeds if and when they are received.
None are ethical.
All are ethical. You have a criminal practice. Your current client, Jim, has been charged with the murder of a 12 year old boy. Jim confesses to you that he killed two girls last month and tells you where the bodies are. Ask the judge if you can withdraw from the case.