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: ignore unnamed structs instead of panic #605

Merged
merged 1 commit into from
Aug 14, 2021

Conversation

fanatid
Copy link
Contributor

@fanatid fanatid commented Aug 13, 2021

Motivation: I wanted safer math in the project in which I working on and added unnamed structs for this, like:

#[derive(Debug, Default, Clone, Copy, PartialEq, PartialOrd, AnchorDeserialize, AnchorSerialize)]
pub struct TokenAmount(u64);

but I can't use IDL right now because anything except named structs causes panic.

It would be cool to support unnamed structs (like arrays or maybe we can add attributes to struct and use it as an object in JS), but this will require much more effort. With this simple change idl parse does not fail at least and can be used in JS with small IDL patching =\

@armaniferrante armaniferrante merged commit a76662f into coral-xyz:master Aug 14, 2021
@fanatid fanatid deleted the idl-unnamed-structs branch August 14, 2021 05:18
@fanatid
Copy link
Contributor Author

fanatid commented Aug 14, 2021

Thanks @armaniferrante! 🚀

WrRaThY pushed a commit to WrRaThY/anchor that referenced this pull request Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants