Inspiration

No inspiration, it is a new idea.

What it does

Fully asynchronous client for XRPL written in idiomatic Rust.

By fully asynchronous, I mean:

  • Single async call not only for JsonRpcApi to receive the result of the call, but also single async call to WebSocketApi to receive the result of the call.
  • Multipage answers (with "marker") are single asynchronous stream.

How we built it

With extensive using of Rust async and type conversion.

Challenges we ran into

  • What should multipage iterator return?
  • What Rust types use for requests and for responses?
  • How to store and control stored "id"s of requests for WebSocket API?
  • Serialization/deserialization, especially working around this misdesign with returned errors.
  • Which errors to return? (particularly, from deserializers)
  • How to write the binary serializer?

Accomplishments that we're proud of

  • Fully asynchronous.
  • The same API for JSON RPC and for WebSocket.
  • Work around of Deserialize broken API.
  • Zero-overhead code generation using Rust macro for binary serialization.
  • Clean API (for example, when there are two mutually exclusive options, I use an enum, not two Options), full Clippy compliance.

What we learned

  • Rust macros and their usage for code generation from a JSON file.
  • How to produce stream from iterators.
  • How to do complex JSON (de)serialization in Rust.

What's next for Rust XRPL client

  • Complete coverage of XRPL API (all API methods, generating private keys and converting them to public keys, etc.)

Built With

  • async-trait
  • derive-more
  • rust
  • serde
Share this project:

Updates