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

Function process

cli/src/processor/mod.rs:26–135  ·  view source on GitHub ↗
(matches: &ArgMatches)

Source from the content-addressed store, hash-verified

24};
25
26pub fn process(matches: &ArgMatches) -> Result<(), CliError> {
27 // Parse command and config
28 let command = CliCommand::try_from(matches)?;
29
30 match command {
31 // Set solana config if using localnet command
32 CliCommand::Localnet { .. } => {
33 // TODO Verify the Solana CLI version is compatable with this build.
34 set_solana_config().map_err(|err| CliError::FailedLocalnet(err.to_string()))?
35 }
36 _ => {}
37 }
38
39 let mut config = CliConfig::load();
40
41 // Build the RPC client
42 let payer = read_keypair_file(&config.keypair_path)
43 .map_err(|_| CliError::KeypairNotFound(config.keypair_path.clone()))?;
44
45 let client = Client::new(payer, config.json_rpc_url.clone());
46
47 // Process the command
48 match command {
49 CliCommand::ConfigGet => config::get(&client),
50 CliCommand::ConfigSet {
51 admin,
52 epoch_thread,
53 hasher_thread,
54 } => config::set(&client, admin, epoch_thread, hasher_thread),
55 CliCommand::Crontab { schedule } => crontab::get(&client, schedule),
56 CliCommand::DelegationCreate { worker_id } => delegation::create(&client, worker_id),
57 CliCommand::DelegationDeposit {
58 amount,
59 delegation_id,
60 worker_id,
61 } => delegation::deposit(&client, amount, delegation_id, worker_id),
62 CliCommand::DelegationGet {
63 delegation_id,
64 worker_id,
65 } => delegation::get(&client, delegation_id, worker_id),
66 CliCommand::DelegationWithdraw {
67 amount,
68 delegation_id,
69 worker_id,
70 } => delegation::withdraw(&client, amount, delegation_id, worker_id),
71 CliCommand::ExplorerGetThread { id, address } => {
72 let pubkey = parse_pubkey_from_id_or_address(client.payer_pubkey(), id, address)?;
73 explorer::thread_url(pubkey, config)
74 }
75 CliCommand::Initialize { mint } => initialize::initialize(&client, mint),
76 CliCommand::Localnet {
77 clone_addresses,
78 network_url,
79 program_infos,
80 force_init,
81 solana_archive,
82 clockwork_archive,
83 dev,

Callers 1

mainFunction · 0.85

Calls 15

set_solana_configFunction · 0.85
setFunction · 0.85
depositFunction · 0.85
withdrawFunction · 0.85
thread_urlFunction · 0.85
startFunction · 0.85
approveFunction · 0.85
revokeFunction · 0.85
crate_infoFunction · 0.85
deleteFunction · 0.85
pauseFunction · 0.85

Tested by

no test coverage detected