Quick Access
Magic Actions Example
Explore reference implementation on GitHub
1) Create action instruction
The instructionupdate_leaderboard runs on the base layer immediately after the commit lands. The #[action] attribute on its accounts context marks it as callable from a post-commit action.
2) Build the commit instruction with the action
The commit instructioncommit_and_update_leaderboard runs on the ER. It uses MagicIntentBundleBuilder to schedule both the commit and the post-commit action onto magic_context — both are applied together when the ER transaction is sealed back to the base layer.
Execute multiple actions
You can commit multiple accounts and chain several actions in one call. Actions execute sequentially in the order they’re passed toadd_post_commit_actions.

