daml_grpc/data/command/
create.rs1use crate::data::identifier::DamlIdentifier;
2use crate::data::value::DamlRecord;
3use crate::grpc_protobuf::com::daml::ledger::api::v1::command::Command;
4use crate::grpc_protobuf::com::daml::ledger::api::v1::CreateCommand;
5
6#[derive(Debug, Eq, PartialEq, Clone)]
8pub struct DamlCreateCommand {
9 template_id: DamlIdentifier,
10 create_arguments: DamlRecord,
11}
12
13impl DamlCreateCommand {
15 pub fn new(template_id: impl Into<DamlIdentifier>, create_arguments: impl Into<DamlRecord>) -> Self {
16 Self {
17 template_id: template_id.into(),
18 create_arguments: create_arguments.into(),
19 }
20 }
21
22 pub const fn template_id(&self) -> &DamlIdentifier {
24 &self.template_id
25 }
26
27 pub const fn create_arguments(&self) -> &DamlRecord {
29 &self.create_arguments
30 }
31}
32
33impl From<DamlCreateCommand> for Command {
34 fn from(daml_create_command: DamlCreateCommand) -> Self {
35 Command::Create(CreateCommand {
36 template_id: Some(daml_create_command.template_id.into()),
37 create_arguments: Some(daml_create_command.create_arguments.into()),
38 })
39 }
40}