miclockwork_thread_program/instructions/
thread_instruction_remove.rs1use {crate::state::*, anchor_lang::prelude::*};
2
3#[derive(Accounts)]
5#[instruction(index: u64)]
6pub struct ThreadInstructionRemove<'info> {
7 #[account()]
9 pub authority: Signer<'info>,
10
11 #[account(
13 mut,
14 seeds = [
15 SEED_THREAD,
16 thread.authority.as_ref(),
17 thread.id.as_slice(),
18 ],
19 bump = thread.bump,
20 has_one = authority
21 )]
22 pub thread: Account<'info, Thread>,
23}
24
25pub fn handler(ctx: Context<ThreadInstructionRemove>, index: u64) -> Result<()> {
26 let thread = &mut ctx.accounts.thread;
28
29 thread.instructions.remove(index as usize);
31
32 Ok(())
33}