metaplex-foundation / shank

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

Update idl output #53

Closed febo closed 1 year ago

febo commented 1 year ago

This PR improves the IDL output of shank:

  1. The desc IDL field is renamed to docs.
  2. The optional field is renamed to isOptional.

These changes make shank generated IDL closer to Anchor format. Additionally, it renames the default_optional_accounts tag to legacy_optional_accounts_strategy. With this change, the default behaviour is to replace missing optional accounts with the program id, unless the legacy_optional_accounts_strategy attribute is used.

Finally, it includes a new attribute on the account annotation: optional_signer. This can be use instead of signer to indicate that the account is an optional signer. When optional_signer is given, isSigner will be set to false on the IDL and a new isOptionalSigner attribute will be set to true.