Skip to content

SolarRepublic/cosmos-grpc

Repository files navigation

Cosmos gRPC

Generates ultralight, tree-shakable TypeScript APIs from the .proto files of any blockchain built using the Cosmos-SDK. Intended for use in a Web environment.

Generated code is strongly-typed, self-contained, and dependency-free.

The generated module includes:

  • gRPC REST clients compatible with Cosmos REST endpoints (via gRPC-gateway)
  • Protobuf message encoders & decoders, including for strongly-typed google.protobuf.Any interfaces
  • Positional destructors for the JSON serialization of messages (e.g., those returned by gRPC-gateway)

Some goals for this project include:

  • adding Amino transcoders

Motivation

Other generated clients use protoc plugins that end up producing extremely bloated code with many unused functions, hefty classes, and poor tree-shakability, leading to large bundles. Part of the reason is due to how those protoc plugins map Messages to classes, support a variety of transports, and import bulky dependencies for encoding/decoding.

This project implements its own ultralight protobuf encoder & decoder, exports every operation as its own ESM function (for optimal tree-shaking), and focusses solely on Cosmos-SDK's gRPC-gateway REST endpoints for transport.

Using in a project

yarn add @solar-republic/cosmos-grpc

Contributing

yarn install
yarn build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published