antegen_thread_program/instructions/
thread_toggle.rs1use {crate::*, anchor_lang::prelude::*};
2
3#[derive(Accounts)]
5pub struct ThreadToggle<'info> {
6 #[account()]
8 pub authority: Signer<'info>,
9
10 #[account(
12 mut,
13 has_one = authority,
14 seeds = [
15 SEED_THREAD,
16 thread.authority.as_ref(),
17 thread.id.as_slice(),
18 ],
19 bump = thread.bump,
20 )]
21 pub thread: Account<'info, Thread>,
22}
23
24pub fn thread_toggle(ctx: Context<ThreadToggle>) -> Result<()> {
25 let thread = &mut ctx.accounts.thread;
26
27 thread.paused = !thread.paused;
29
30 Ok(())
31}