Skip to content

lang: ignore unnamed structs instead of panic#605

Merged
armaniferrante merged 1 commit into
otter-sec:masterfrom
fanatid:idl-unnamed-structs
Aug 14, 2021
Merged

lang: ignore unnamed structs instead of panic#605
armaniferrante merged 1 commit into
otter-sec:masterfrom
fanatid:idl-unnamed-structs

Conversation

@fanatid

@fanatid fanatid commented Aug 13, 2021

Copy link
Copy Markdown
Contributor

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 otter-sec:master Aug 14, 2021
@fanatid fanatid deleted the idl-unnamed-structs branch August 14, 2021 05:18
@fanatid

fanatid commented Aug 14, 2021

Copy link
Copy Markdown
Contributor Author

Thanks @armaniferrante! 🚀

RadBuilds pushed a commit to RadBuilds/anchor that referenced this pull request Aug 15, 2021
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
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.

2 participants