Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang/syn: use rustdoc to search for IDL type definitions #674

Closed
lithdew opened this issue Sep 3, 2021 · 2 comments
Closed

lang/syn: use rustdoc to search for IDL type definitions #674

lithdew opened this issue Sep 3, 2021 · 2 comments
Labels
idl related to the IDL, either program or client side

Comments

@lithdew
Copy link

lithdew commented Sep 3, 2021

A limitation right now is that IDL type definitions are only generated for structs that live in the top-level of a Solana program.

It is possible to circumvent this limitation by having the Anchor CLI 1) run 'cargo doc' on a Solana program, and 2) recursively walk through the generated HTML documentation to generate IDL type definitions off of structs that are referenced in the program's fields/declarations/instructions which derive BorshSerialize/BorshDeserialize.

The only workaround right now for this is to duplicate the definitions of structs from imported crates and transmute the memory of instantiated versions of the duplicate structs when they need to be passed to external functions.

There is an option for 'cargo doc' as well to output JSON, though it requires Rust nightly which would not be ideal.

@billythedummy
Copy link
Contributor

Think this is related: #1972

@acheroncrypto acheroncrypto mentioned this issue Feb 25, 2024
@acheroncrypto acheroncrypto added the idl related to the IDL, either program or client side label Mar 10, 2024
@acheroncrypto
Copy link
Collaborator

Added in #2824 (not with rustdoc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

3 participants