coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.61k stars 1.32k forks source link

Add COption to idl #1381

Open armaniferrante opened 2 years ago

dtmrc commented 2 years ago

👍

tanmaymunjal commented 1 year ago

Looking into it, It seems that COption currently does not have the traits BorshSerialize/BorshDeserialization defined by default, hence COption does not even seem to work by default in anchor right now without first deriving these traits.

I think one thing that might be done is to define a custom struct enclosing COption(as we can not by default implement traits from structs from other crates) and define Borsh Serialization/De-serialization traits for them.

Another thing we can try is to try to understand why COption does not implement these traits out of the box and if we can't find anything, raise an issue on Solana GitHub to make sure it's derived out of the box with solana_program