Let’s say I have an on-chain program with two instructions Ix_1 and Ix_2. Now in my front-end app, while interacting with the on-chain program (through the anchor typescript library), I want to chain the two transactions together
Ix = {Ix_1,Ix_2}
and I want to preserve atomicity. What I mean is that I want to make sure that the entire transaction Ix only goes through if and only if both Ix_1 and Ix_2 are successful, so if Ix_2 fails, I want Ix_1 to fail as well. Is there a way to make sure of that?
Anchor has kind of abstracted away the concept of an instruction with the auto-generated typescript bindings, so I don’t know exactly how to do it in Anchor, but hopefully that gives you a little bit of a hint!
You might be able to reach out on the Serum or Solana Discords to see if anybody else has ideas.