antegen_thread_program/instructions/thread_memo.rs
1use anchor_lang::prelude::*;
2
3use crate::state::Signal;
4
5/// Accounts for thread_memo - simple memo functionality for thread testing.
6/// Only called via CPI from thread_exec, so authorization is verified by signer.
7/// The thread signs via invoke_signed in thread_exec.
8#[derive(Accounts)]
9pub struct ThreadMemo<'info> {
10 /// The thread account that signs this instruction via CPI
11 pub signer: Signer<'info>,
12}
13
14pub fn thread_memo(
15 _ctx: Context<ThreadMemo>,
16 memo: String,
17 signal: Option<Signal>,
18) -> Result<Signal> {
19 msg!("Thread memo: {}", memo);
20
21 if signal.is_some() {
22 let response: Signal = signal.unwrap();
23 return Ok(response);
24 }
25
26 Ok(Signal::None)
27}