clockwork_thread_program_v1/
lib.rs

1use anchor_lang::solana_program::entrypoint::ProgramResult;
2
3clockwork_anchor_gen::generate_cpi_interface!(idl_path = "idl.json");
4
5anchor_lang::prelude::declare_id!("3XXuUFfweXBwFgFfYaejLvZE4cGZiHgKiGfMtdxNzYmv");
6
7pub const SEED_THREAD: &[u8] = b"thread";
8
9impl Thread {
10    /// Derive the pubkey of a thread account.
11    pub fn pubkey(authority: Pubkey, id: String) -> Pubkey {
12        Pubkey::find_program_address(
13            &[SEED_THREAD, authority.as_ref(), id.as_bytes()],
14            &crate::ID,
15        )
16        .0
17    }
18}
19
20impl PartialEq for Thread {
21    fn eq(&self, other: &Self) -> bool {
22        self.authority.eq(&other.authority) && self.id.eq(&other.id)
23    }
24}