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

Function parse_delegation_command

cli/src/parser.rs:115–138  ·  view source on GitHub ↗
(matches: &ArgMatches)

Source from the content-addressed store, hash-verified

113}
114
115fn parse_delegation_command(matches: &ArgMatches) -> Result<CliCommand, CliError> {
116 match matches.subcommand() {
117 Some(("create", matches)) => Ok(CliCommand::DelegationCreate {
118 worker_id: parse_u64("worker_id", matches)?,
119 }),
120 Some(("deposit", matches)) => Ok(CliCommand::DelegationDeposit {
121 amount: parse_u64("amount", matches)?,
122 delegation_id: parse_u64("delegation_id", matches)?,
123 worker_id: parse_u64("worker_id", matches)?,
124 }),
125 Some(("get", matches)) => Ok(CliCommand::DelegationGet {
126 delegation_id: parse_u64("delegation_id", matches)?,
127 worker_id: parse_u64("worker_id", matches)?,
128 }),
129 Some(("withdraw", matches)) => Ok(CliCommand::DelegationWithdraw {
130 amount: parse_u64("amount", matches)?,
131 delegation_id: parse_u64("delegation_id", matches)?,
132 worker_id: parse_u64("worker_id", matches)?,
133 }),
134 _ => Err(CliError::CommandNotRecognized(
135 matches.subcommand().unwrap().0.into(),
136 )),
137 }
138}
139
140fn parse_explorer_command(matches: &ArgMatches) -> Result<CliCommand, CliError> {
141 match matches.subcommand() {

Callers 1

try_fromMethod · 0.85

Calls 1

parse_u64Function · 0.85

Tested by

no test coverage detected