metaplex-foundation / shank

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

feat: parsing custom types #4

Closed thlorenz closed 2 years ago

thlorenz commented 2 years ago

Parses types like the below into custom types (defined) and includes them in the IDL.

#[derive(BorshSerialize)]
pub struct OneCustomType {
    pub field: u8,
}

NOTE: that only serializable types (detected via Borsh derives) are considered types to include.

Additionally if a struct includes another Shank attribute, i.e. ShankAccount it is not considered a custom type as in that case it is already an account, instruction, etc.