daml_grpc/data/command/
command_types.rs

1use crate::data::command::create::DamlCreateCommand;
2use crate::data::command::exercise::DamlExerciseCommand;
3use crate::data::command::exercise_by_key::DamlExerciseByKeyCommand;
4use crate::data::command::DamlCreateAndExerciseCommand;
5use crate::grpc_protobuf::com::daml::ledger::api::v1::Command;
6
7/// A Daml ledger command.
8#[derive(Debug, Eq, PartialEq, Clone)]
9pub enum DamlCommand {
10    Create(DamlCreateCommand),
11    Exercise(DamlExerciseCommand),
12    ExerciseByKeyCommand(DamlExerciseByKeyCommand),
13    CreateAndExercise(DamlCreateAndExerciseCommand),
14}
15
16impl From<DamlCommand> for Command {
17    fn from(daml_command: DamlCommand) -> Self {
18        Command {
19            command: Some(match daml_command {
20                DamlCommand::Create(c) => c.into(),
21                DamlCommand::Exercise(c) => c.into(),
22                DamlCommand::ExerciseByKeyCommand(c) => c.into(),
23                DamlCommand::CreateAndExercise(c) => c.into(),
24            }),
25        }
26    }
27}