Keep your pipes leak-free!
Polymer is a library for generating Rust types from a CIP-57 blueprint schema.
CIP-57 is largely implemented. There are some minor quality of life improvements that could be made, however. Example, rationals are currently not recognized as a special case, and so the user will need to manually convert them to num_rational.
Currently, Option types from Aiken are converted to AikenOption<T>, which needs to be converted to Option<T> manually.
// Define a module to contain the generated types
mod my_module {
polymer::blueprint!("static/plutus.json");
}
// Use the generated types elsewhere in your code
use my_module::root::*;
let my_datum = MyDatum { field: 10 };
// Encoding works with `minicbor`
let encoded = hex::encode(minicbor::to_vec(my_datum).unwrap());
// Yay, we have some CBOR!