In #Cadence, there are 4 phases to a transaction:
1. "Prepare"
2. "Pre"
3. "Execute"
4. "Post"
What are the differences between them?
👇🧵
1. The prepare phase
This is the first part of the transaction to get run.
⚠️It is also the only place you have access to the signer's `AuthAccount`, a type that allows you to have full access to an account.
It is best practice to only use the prepare phase for things that require the `AuthAccount` type, like borrowing a reference to a user's NFT Collection.
You can think of the prepare phase as the "setup" of a transaction.
2. The pre phase
Run after the prepare phase, the "pre" phase is used to assert a condition before execution.
3. The execute phase
This is the main part of the transaction, where all of your actions go.
🔥For example, let's burn an NFT.
4. The post phase
Run after the execute phase, and similar to the pre phase, the "post" phase is used to assert a condition after execution.
🗒️ To learn more about transaction architecture, see here: developers.flow.com/cadence/langua…
Follow me for some more #Cadence tips :)
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.