metaplex-foundation / shank

Extracts IDL from Solana Rust contracts
https://docs.rs/crate/shank_macro/latest
118 stars 23 forks source link

feat: support custom enum types #6

Closed thlorenz closed 2 years ago

thlorenz commented 2 years ago

This adds support for custom enum types like the below:

#[derive(BorshSerialize)]
pub enum Color {
    Red(u8),
    Green(u8),
    Blue(u8),
    White,
}

The approach mainly follows integration of custom struct types and consists of lots of mappings starting from the ParsedEnum to CustomEnum to finally an IdlType. Those are then concatentated with the IdlTypes derived from custom structs.