stellar-rust-sdk
stellar-rust-sdk copied to clipboard
Stellar XDR Types
They have a set of XDR types here: https://github.com/stellar/stellar-core/blob/master/src/xdr/Stellar-types.x
We should model them in rust as best as possible and demonstrate the ability to pack and unpack them. The stellar go library has some tests around all xdr here:
https://github.com/stellar/go/tree/master/xdr
I wish they had tests in the core library for it was well ☹️ They also appear to duplicate the xdr files into every repo that they are used in, likely because they use xdrgen.
Can build some XDR here: https://www.stellar.org/laboratory/#txbuilder?network=test
Can confirm we use https://github.com/stellar/xdrgen.
This is awesome. I just learned today that parts of stellar are built in rust and was curious to know if you all had put something like this together already 👍
@robertDurst What does that mean? Can it generate rust code?
@correlator nope, none of our codebase is rust -- at least not until I get good enough to push for change 😁
@kbacha so I talked to one of our devs and this is what we use for xdrgen for various languages -- js, go, and a couple others. This is different than Rust's XDRGEN because that XDRGEN isn't adapted or built for specific encodings or definitions for xdr within the stellar codebase.
I just got the lowdown from one of our devs on how to get started adding rust support https://github.com/stellar/xdrgen and am going to take this on.
That's awesome! That's the missing piece and I wasn't getting any feedback on the rust library.
Let me know how I can help, I'm actually coming from a ruby background so working in that library looks pretty easy.
Awesome! I skimmed the code and it looks quite doable -- while I have never written any ruby, this is quite easy to read.
Happy to collaborate, the goal here is to ultimately send a PR here for rust support!
Going to give this a go myself this weekend.
Work is being done on this branch https://github.com/kbacha/xdrgen/tree/rust
Exciting!
FYI, I have created a crate with generated rust code from the Stellar XDR. I had to hand-modify the XDR input files to get around issues in xdrgen with unnamed unions and structs. I must admit that I have not done in-depth testing, but I have verified the code does decode a CreateAccount transaction correctly. Feel free to comment on the project.
@thorhs Excellent! I'll take a look in a few weeks. I've been on parental leave caring for my new child.