You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solita generates a BeetArgsStruct that exposes a type's attributes using beet types. We could also include the information of how many bytes the struct would take at most. This would help to create custom serialization/deserialization patterns. This could be either an autogenerated function or the facility to query beet with the attributes of the generated type.
The text was updated successfully, but these errors were encountered:
Would it make sense to annotate the Rust struct with the max size? Even when we use strings and arrays in programs, we know what would be the max size since we need to allocate the account space. Then solita could get the information from the annotation and be able to determine the size of the data type.
Yes that is an option. So combining these ideas we could do the following:
for fixed size structs provide a maxSize getter which just returns byteSize (since it is constant)
for structs annotated with a #[derive(ShankType(max_size=<size>)] shank would pick that up and include this info in the IDL + solita generates a getter that just returns that <size>
for non-fixed size structs without an annotation the getter will throw an Error alerting the user that they need to annotate the struct to get a maxSize provided
For the second option we need to extend shank and the types with a maxSize need to derive a ShankType(maxSize=x) (right now they just need to be BorshSerialize/BorshDeserialize.
Solita generates a
BeetArgsStruct
that exposes a type's attributes usingbeet
types. We could also include the information of how many bytes the struct would take at most. This would help to create custom serialization/deserialization patterns. This could be either an autogenerated function or the facility to querybeet
with the attributes of the generated type.The text was updated successfully, but these errors were encountered: