I would like to write an application that interacts with the DAML ledger but as of the SDK 0.11.3 the only documented bindings are for Java and JavaScript.
Is there a way to use the Ledger API from other languages?
I would like to write an application that interacts with the DAML ledger but as of the SDK 0.11.3 the only documented bindings are for Java and JavaScript.
Is there a way to use the Ledger API from other languages?
The Ledger API is a set of services exposed through gRPC, which uses Protocol Buffers as its own interface definition language.
The bindings documented as part of the SDK build on top of the code generated from gRPC to offer more features and a more idiomatic API.
You can still use gRPC directly to generate the code necessary to interact with the Ledger API. As of gRPC 1.15.1, supported languages (and/or platforms) include:
The following are the first steps common to all languages to create an example project. If you already have a project and would like to add bindings in a language for which bindings are not available, skip to step 4.
Create a new directory for your project and cd
into it
mkdir daml-project && cd daml-project
Create a directory for your DAML models and put a model into it. For now an empty model will do (you can put a model of your choosing at a later time).
mkdir daml && echo -e "daml 1.2\nmodule Empty where" > daml/Empty.daml
Create a project descriptor (da.yaml
file) with the following contents:
project:
sdk-version: 0.11.3
name: daml-project
source: daml/Empty.daml
version: 2
Run the following command to add the Ledger API gRPC service definitions to your project:
da add ledger-api-protos
At this point the directory protobuf
should have been added to your project. You can use these files to generate bindings to the Ledger API in one of the languages supported by gRPC.
The procedure on how to generate the code for your target language is described by the gRPC official documentation.