9 unstable releases (4 breaking)

0.5.2 Jan 20, 2022
0.5.1 Dec 17, 2021
0.4.0 Oct 27, 2021
0.3.0 Sep 20, 2021
0.1.0-alpha Sep 27, 2019

#1140 in Development tools

35 downloads per month

MIT license

1.5K SLoC

XDR Codegen


Xdr-codegen is a binary that is used to take the XDR Language Specification and generate source code in various languages. The goal of this is to facilitate the communication of XDR objects across binaries that are written in different languages. Another way to say this is we take .x files and convert them to the appropriate js, go or rust source (protoc for XDR).

Warning: This project was put together to aid us in our development in a short amount of time. There is still more work to be done before xdr-codegen is completely compatible with the XDR Language Specification.


We currently support code generation for 3 languages: javascript, rust and go. The generated code has the following dependencies:

# Javascript generation
cargo run test.x --language js # | eslint --stdin
# Rust generation
cargo run test.x --language rust # | rustfmt
# Go generation
cargo run test.x --language go # | gofmt
# Commonjs generation
cargo run test.x --language commonjs # | eslint --stdin




~109K SLoC