Skip to main content

antegen_thread_program/instructions/
thread_delete.rs

1use crate::{errors::AntegenThreadError, state::ThreadConfig, *};
2use anchor_lang::prelude::*;
3
4/// Force delete a thread - admin only, skips all checks.
5/// Used for cleaning up stuck/broken threads.
6#[derive(Accounts)]
7pub struct ThreadDelete<'info> {
8    /// The config admin (must sign)
9    #[account(
10        mut,
11        constraint = admin.key() == config.admin @ AntegenThreadError::InvalidConfigAdmin,
12    )]
13    pub admin: Signer<'info>,
14
15    /// The config account
16    #[account(
17        seeds = [SEED_CONFIG],
18        bump = config.bump,
19    )]
20    pub config: Account<'info, ThreadConfig>,
21
22    /// The thread to delete
23    #[account(
24        mut,
25        close = admin,
26    )]
27    pub thread: Account<'info, Thread>,
28}
29
30pub fn thread_delete(_ctx: Context<ThreadDelete>) -> Result<()> {
31    msg!("Deleting thread (admin)");
32    Ok(())
33}