Skip to content

Commit 3c10759

Browse files
committed
feat: Add ScheduleCommitFinalize to program-api only
1 parent a4eaa27 commit 3c10759

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

magicblock-magic-program-api/src/args.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ pub enum MagicBaseIntentArgs {
8585
BaseActions(Vec<BaseActionArgs>),
8686
Commit(CommitTypeArgs),
8787
CommitAndUndelegate(CommitAndUndelegateArgs),
88+
CommitFinalize(CommitTypeArgs),
89+
CommitFinalizeAndUndelegate(CommitAndUndelegateArgs),
8890
}
8991

9092
#[derive(Clone, Default, Serialize, Deserialize, Debug, PartialEq, Eq)]
9193
pub struct MagicIntentBundleArgs {
9294
pub commit: Option<CommitTypeArgs>,
9395
pub commit_and_undelegate: Option<CommitAndUndelegateArgs>,
96+
pub commit_finalize: Option<CommitTypeArgs>,
97+
pub commit_finalize_and_undelegate: Option<CommitAndUndelegateArgs>,
9498
pub standalone_actions: Vec<BaseActionArgs>,
9599
}
96100

@@ -105,6 +109,12 @@ impl From<MagicBaseIntentArgs> for MagicIntentBundleArgs {
105109
MagicBaseIntentArgs::CommitAndUndelegate(value) => {
106110
this.commit_and_undelegate = Some(value)
107111
}
112+
MagicBaseIntentArgs::CommitFinalize(value) => {
113+
this.commit_finalize = Some(value)
114+
}
115+
MagicBaseIntentArgs::CommitFinalizeAndUndelegate(value) => {
116+
this.commit_finalize_and_undelegate = Some(value)
117+
}
108118
}
109119

110120
this

magicblock-magic-program-api/src/instruction.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@ pub enum MagicBlockInstruction {
178178
/// - **1.** `[WRITE]` Ephemeral account to close
179179
/// - **2.** `[WRITE]` Vault account (source of rent refund)
180180
CloseEphemeralAccount,
181+
182+
/// Schedules the accounts provided at end of accounts Vec to be committed and finalized in a
183+
/// single DLP instruction.
184+
/// It should be invoked from the program whose PDA accounts are to be
185+
/// committed.
186+
///
187+
/// This is the first part of scheduling a commit.
188+
/// A second transaction [MagicBlockInstruction::AcceptScheduleCommits] has to run in order
189+
/// to finish scheduling the commit.
190+
///
191+
/// # Account references
192+
/// - **0.** `[WRITE, SIGNER]` Payer requesting the commit to be scheduled
193+
/// - **1.** `[WRITE]` Magic Context Account containing to which we store
194+
/// the scheduled commits
195+
/// - **2..n** `[]` Accounts to be committed
196+
ScheduleCommitFinalize { request_undelegation: bool },
181197
}
182198

183199
impl MagicBlockInstruction {

0 commit comments

Comments
 (0)