metaplex-foundation / shank

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

feat: rendering IDL for accounts #1

Closed thlorenz closed 2 years ago

thlorenz commented 2 years ago

This PR includes everything to parse out Account structs and then render IDL for them.

TypesParse

Rust types are parsed out for each struct field and then converted to the narrower IdlType. Pubkey is treated specially when encountered as a CustomType.

File Discovery

Files with Rust code to be parsed are discovered even if they are referenced in the crate.

Attributes

The #[derive(ShankAccount)] attr was introduced (derive in order to allow to add Rust impls later).