Skip to main content

Crate daml_grpc

Crate daml_grpc 

Source
Expand description

Daml ledger GRPC API.

This library provides a client for the Daml ledger GRPC API.

§Example

The following example demonstrates creating a DamlGrpcClient using the DamlGrpcClientBuilder, then creating a DamlSimpleExecutor using the DamlSimpleExecutorBuilder and finally creating and submitting a DamlCreateCommand to the ledger:

let client = DamlGrpcClientBuilder::uri("http://localhost:8082").connect().await?;
let executor = DamlSimpleExecutorBuilder::new(&client).act_as("Alice").build()?;
let template_id = DamlIdentifier::new("...", "Fuji.PingPong", "Ping");
let record = DamlRecord::new(vec![], None::<DamlIdentifier>);
let command = DamlCreateCommand::new(template_id, record);
let create_event = executor.execute_create(command).await?;

Note that Daml commands such as DamlCreateCommand can be automatically generated for existing Daml templates using the various functions and macros provided in the daml-codegen crate.

Note also that the daml_value macro is provided to simplify the construction of DamlRecord and DamlValue types.

Modules§

data
Daml API domain objects (i.e. values, commands, events).
grpc_protobuf
Raw prost-generated Ledger API v2 protobuf bindings.
nat
Nat types for specifying Daml Numeric types.
primitive_types
Daml primitive data types.
serialize
Serialize & Deserialize Daml types.
service
Daml GRPC API services (i.e. command & transaction services).

Structs§

DamlCommandFactory
Factory for assembling DamlCommands payloads from a fixed set of submission parameters (workflow id, user id, act-as parties, dedup period, …) and a variable list of DamlCommands.
DamlGrpcClient
Daml v2 ledger client connection. A thin handle around a tonic Channel that hands out per-service clients on demand. Cheap to hold — service factories clone the channel rather than opening new ones.
DamlGrpcClientBuilder
Construct a DamlGrpcClient.
DamlSimpleExecutor
A simple async Daml command executor.
DamlSimpleExecutorBuilder
Construct a DamlSimpleExecutor.

Traits§

CommandExecutor
An async failable Daml command executor.