MCPcopy Create free account
hub / github.com/clockwork-xyz/clockwork / create

Function create

cli/src/processor/thread.rs:24–50  ·  view source on GitHub ↗
(
    client: &Client,
    id: String,
    instructions: Vec<SerializableInstruction>,
    trigger: Trigger,
)

Source from the content-addressed store, hash-verified

22}
23
24pub fn create(
25 client: &Client,
26 id: String,
27 instructions: Vec<SerializableInstruction>,
28 trigger: Trigger,
29) -> Result<(), CliError> {
30 let thread_pubkey = Thread::pubkey(client.payer_pubkey(), id.clone().into_bytes());
31 let ix = Instruction {
32 program_id: clockwork_thread_program::ID,
33 accounts: clockwork_thread_program::accounts::ThreadCreate {
34 authority: client.payer_pubkey(),
35 payer: client.payer_pubkey(),
36 system_program: system_program::ID,
37 thread: thread_pubkey
38 }.to_account_metas(Some(false)),
39 data: clockwork_thread_program::instruction::ThreadCreate {
40 amount: 0,
41 id: id.into_bytes(),
42 instructions,
43 trigger,
44 }
45 .data(),
46 };
47 client.send_and_confirm(&[ix], &[client.payer()]).unwrap();
48 get(client, thread_pubkey)?;
49 Ok(())
50}
51
52pub fn delete(client: &Client, id: String) -> Result<(), CliError> {
53 let thread_pubkey = Thread::pubkey(client.payer_pubkey(), id.into_bytes());

Callers 3

processFunction · 0.70
register_workerFunction · 0.70
download_fileFunction · 0.50

Calls 4

payer_pubkeyMethod · 0.80
send_and_confirmMethod · 0.80
payerMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected