tendermint-rpc 0.17.0-rc3

tendermint-rpc contains the core types returned by a Tendermint node's RPC endpoint. All networking related features are feature guarded to keep the dependencies small in cases where only the core types are needed.
Documentation

Crate Docs

See the repo root for build status, license, rust version, etc.

tendermint-rpc

A Rust implementation of the core types returned by a Tendermint node's RPC endpoint. These can be used to deserialize JSON-RPC responses.

All networking related features will be feature guarded to keep the dependencies small in cases where only the core types are needed.

Documentation

See documentation on crates.io.

Client

This crate optionally provides access to different types of RPC client functionality and different client transports based on which features you select when using it.

Two features are provided at present:

  • http-client - Provides HttpClient, which is a basic RPC client that interacts with remote Tendermint nodes via JSON-RPC over HTTP. This client does not provide Event subscription functionality. See the Tendermint RPC for more details.
  • websocket-client - Provides WebSocketClient, which currently only provides Event subscription functionality over a WebSocket connection. See the /subscribe endpoint in the Tendermint RPC for more details. This client does not yet provide access to the RPC methods provided by the Client trait (this is planned for a future release).

Mock Clients

Mock clients are included when either of the http-client or websocket-client features are enabled to aid in testing. This includes MockClient, which only implements Client (no subscription functionality), and MockSubscriptionClient, which helps you simulate subscriptions to events being generated by a Tendermint node.

Related

Testing

The RPC types are directly tested through the integration tests. These tests use fixtures taken from running Tendermint nodes to ensure compatibility without needing access to a running node during testing. All of these fixtures were generated manually, and automatic regeneration of the fixtures is on our roadmap.

To run these tests locally:

# From within the rpc crate
cargo test --all-features

The RPC client is also indirectly tested through the Tendermint integration tests, which happens during CI. All of these tests require a running Tendermint node, and are therefore ignored by default. To run these tests locally:

# In one terminal, spin up a Tendermint node
docker pull tendermint/tendermint:latest
docker run -it --rm -v "/tmp/tendermint:/tendermint" \
    tendermint/tendermint init
docker run -it --rm -v "/tmp/tendermint:/tendermint" \
    -p 26657:26657 \
    tendermint/tendermint node --proxy_app=kvstore

# In another terminal, run the ignored Tendermint tests to connect to the node
# running at tcp://127.0.0.1:26657
cd ../tendermint
cargo test --all-features -- --ignored