BDLedger APIs
Go to file
2020-04-07 19:43:59 +08:00
bdware/bdledger/api Adjust go_package option 2020-04-07 19:43:59 +08:00
google/protobuf Update proto files and scripts 2018-09-07 13:22:25 +08:00
scripts Upgrade to https://blog.golang.org/protobuf-apiv2 2020-04-07 19:29:14 +08:00
.gitignore Remove VsCode settings 2020-04-05 11:47:53 +08:00
docs.md contract proto 2020-03-31 21:19:44 +08:00
README.md Upgrade to https://blog.golang.org/protobuf-apiv2 2020-04-07 19:29:14 +08:00
test.md change go_package path 2020-01-08 10:04:41 +08:00

BDLedger gRPC API

Generating gRPC code in languages

Installling tools

Download the Protocol Buffers compiler (protoc-3.11.4-*) for your platform and add protoc to PATH environment variable

For generating Go code:

GIT_TAG="v1.4.0-rc.4"
go get -d -u github.com/golang/protobuf/protoc-gen-go
git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG
go install github.com/golang/protobuf/protoc-gen-go

(Update to google.golang.org/protobuf when https://github.com/grpc/grpc-go/pull/3435 resolves)

For generating Java code: From bdledger-sdk-java run gradle generateProto

For generating Node.js code:

npm install -g grpc-tools 

For generating TypeScript definitions, also run:

npm install -g protoc-gen-ts

For frontend JavaScript:

git clone https://github.com/grpc/grpc-web
cd grpc-web
sudo make install-plugin

References:

TODO: Look into protobuf.js for Nodes.js and frontend TODO: Look into Kroto+ for Kotlin

Generating code

Run

./scripts/gen [go] [nodejs] [ts]