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

Function update

cli/src/processor/thread.rs:119–153  ·  view source on GitHub ↗
(
    client: &Client,
    id: String,
    rate_limit: Option<u64>,
    schedule: Option<String>,
)

Source from the content-addressed store, hash-verified

117}
118
119pub fn update(
120 client: &Client,
121 id: String,
122 rate_limit: Option<u64>,
123 schedule: Option<String>,
124) -> Result<(), CliError> {
125 let thread_pubkey = Thread::pubkey(client.payer_pubkey(), id.into_bytes());
126 let trigger = if let Some(schedule) = schedule {
127 Some(Trigger::Cron {
128 schedule,
129 skippable: true,
130 })
131 } else {
132 None
133 };
134 let settings = ThreadSettings {
135 fee: None,
136 instructions: None,
137 name: None,
138 rate_limit,
139 trigger,
140 };
141 let ix = Instruction {
142 program_id: clockwork_thread_program::ID,
143 accounts: clockwork_thread_program::accounts::ThreadUpdate {
144 authority: client.payer_pubkey(),
145 system_program: system_program::ID,
146 thread: thread_pubkey
147 }.to_account_metas(Some(false)),
148 data: clockwork_thread_program::instruction::ThreadUpdate { settings }.data(),
149 };
150 client.send_and_confirm(&[ix], &[client.payer()]).unwrap();
151 get(client, thread_pubkey)?;
152 Ok(())
153}
154
155pub fn parse_pubkey_from_id_or_address(
156 authority: Pubkey,

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected