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