miclockwork_sdk/
lib.rs

1pub use miclockwork_thread_program::errors;
2pub use miclockwork_thread_program::program::ThreadProgram;
3pub use miclockwork_thread_program::ID;
4
5pub mod state {
6    pub use miclockwork_thread_program::state::{
7        ClockData, ExecContext, SerializableAccount, SerializableInstruction, Thread,
8        ThreadAccount, ThreadResponse, ThreadSettings, Trigger, TriggerContext,
9    };
10}
11
12pub mod utils {
13    pub use miclockwork_thread_program::state::PAYER_PUBKEY;
14    pub use miclockwork_thread_program::state::Equality;
15}
16
17pub mod cpi {
18    use anchor_lang::prelude::{CpiContext, Result};
19
20    pub use miclockwork_thread_program::cpi::accounts::{
21        ThreadCreate, ThreadDelete, ThreadPause, ThreadReset, ThreadResume, ThreadUpdate,
22        ThreadWithdraw,
23    };
24
25    pub fn thread_create<'info>(
26        ctx: CpiContext<'_, '_, '_, 'info, ThreadCreate<'info>>,
27        amount: u64,
28        id: Vec<u8>,
29        instructions: Vec<crate::state::SerializableInstruction>,
30        trigger: crate::state::Trigger,
31    ) -> Result<()> {
32        miclockwork_thread_program::cpi::thread_create(ctx, amount, id, instructions, trigger)
33    }
34
35    pub fn thread_delete<'info>(
36        ctx: CpiContext<'_, '_, '_, 'info, ThreadDelete<'info>>,
37    ) -> Result<()> {
38        miclockwork_thread_program::cpi::thread_delete(ctx)
39    }
40
41    pub fn thread_pause<'info>(
42        ctx: CpiContext<'_, '_, '_, 'info, ThreadPause<'info>>,
43    ) -> Result<()> {
44        miclockwork_thread_program::cpi::thread_pause(ctx)
45    }
46
47    pub fn thread_resume<'info>(
48        ctx: CpiContext<'_, '_, '_, 'info, ThreadResume<'info>>,
49    ) -> Result<()> {
50        miclockwork_thread_program::cpi::thread_resume(ctx)
51    }
52
53    pub fn thread_reset<'info>(
54        ctx: CpiContext<'_, '_, '_, 'info, ThreadReset<'info>>,
55    ) -> Result<()> {
56        miclockwork_thread_program::cpi::thread_reset(ctx)
57    }
58
59    pub fn thread_update<'info>(
60        ctx: CpiContext<'_, '_, '_, 'info, ThreadUpdate<'info>>,
61        settings: crate::state::ThreadSettings,
62    ) -> Result<()> {
63        miclockwork_thread_program::cpi::thread_update(ctx, settings)
64    }
65
66    pub fn thread_withdraw<'info>(
67        ctx: CpiContext<'_, '_, '_, 'info, ThreadWithdraw<'info>>,
68        amount: u64,
69    ) -> Result<()> {
70        miclockwork_thread_program::cpi::thread_withdraw(ctx, amount)
71    }
72}