@oasisprotocol/client
v1.1.0
Published
Users of this package, see [this getting started guide](docs/getting-started.md).
Downloads
2,700
Keywords
Readme
An oasis-core SDK for TypeScript
Users of this package, see this getting started guide.
Philosophy
Prioritize exposing an unopinionated binding to
oasis-node
's gRPC
services.
Mostly leave the protocol and formats be, and don't create too much abstraction over it.
Aim to create a library that will take less work to maintain when oasis-core changes.
The target audience is developers who are already familiar with oasis-core.
Inventory of what's here
- A layer over
grpc-web
to hook up CBOR-based message serialization. - Method definitions and wrappers to represent the node's gRPC methods.
- A heuristic to convert structures from CBOR maps to JavaScript objects.
- Type definitions for structures.
- Helpers for operating on a few kinds of data.
- Constants.
- JSDoc copied from Godoc.
- Wrappers for consensus transactions.
Design notes
- There is no conversion layer between deserialized messages and further object model.
- Non-structure types, e.g. specialized byte arrays such as
Quantity
andPublicKey
don't have dedicated names in the type system. - Types are only interfaces (where possible), and helpers are standalone functions.
Caveats
oasis-node
's gRPC interface is not desigend to be secure against untrusted clients. We suggest using this SDK with an additional access control component.- Native gRPC is not accessible over the web. The
grpc-web
project suggests setting up an Envoy proxy to allow browsers to connect. - Empty structures are deserialized into an empty
Map
, due to a limitation in the heuristic that converts structures to objets. - Go prefers to use
nil
instead of some empty values and to serialize them asnull
or missing structure fields. This behavior is not modeled in this library's type system.