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

Function parse_instruction_file

cli/src/parser.rs:299–308  ·  view source on GitHub ↗
(
    arg: &str,
    matches: &ArgMatches,
)

Source from the content-addressed store, hash-verified

297}
298
299fn parse_instruction_file(
300 arg: &str,
301 matches: &ArgMatches,
302) -> Result<SerializableInstruction, CliError> {
303 let filepath = parse_string(arg, matches)?;
304 let text = fs::read_to_string(filepath).map_err(|_err| CliError::BadParameter(arg.into()))?;
305 let ix: JsonInstructionData =
306 serde_json::from_str(text.as_str()).expect("JSON was not well-formatted");
307 SerializableInstruction::try_from(&ix)
308}
309
310fn parse_keypair_file(arg: &str, matches: &ArgMatches) -> Result<Keypair, CliError> {
311 Ok(read_keypair_file(parse_string(arg, matches)?)

Callers 1

parse_thread_commandFunction · 0.85

Calls 1

parse_stringFunction · 0.85

Tested by

no test coverage detected