codama-idl / codama

Generate clients, CLIs, documentation and more from your Solana programs
MIT License
73 stars 16 forks source link

Use any TypeNode for Account data #66

Open lorisleiva opened 3 months ago

lorisleiva commented 3 months ago

This is a proposal that needs further discussion before implementing.


Currently, the data of an AccountNode must be a StructAccountNode meaning its top-level data-structure must include named fields.

Technically, since data is just data, we could imagine an AccountNode with a simple BooleanTypeNode as data.

The issue with this approach is some other nodes such as the FieldDiscriminatorNode points to a field on the account and therefore expects the data to be a struct with named fields.