...
[Option / Result / Vec / typle : basically we are interested in only inner values of the container
Code Block language bash [ { "type": "Option", "item_type": { "type" : "bool" } }, { "type": "Result", "item_type": { "type": "int", "mode": "CompactFourByte" } }, { "type": "Vec", "item_type": { "type": "bool" } }, { "type": "tuple", "items": [ { "type": "int", "mode": "CompactFourByte" }, { "type": "Option", "item_type": { "type" : "bool" } } ] } ]
3. Custom containers
- Structures: in structures declare definitions inline for built-in types and declare a reference for custom types
Code Block language bash { "type": "struct", "name": "Foo", "codec": "SCALE", //possible values SCALE or JSON "properties": [ { "name": "enabled", "definition": { "type": "bool" } }, { "name": "id", "definition": { "type": "struct", //reference to other struct "struct_name": "Id" } }, { "name": "counter", "definition": { "type": "int", "mode": "FixedWidth" } } ] }
- Enums: similar to Structures but also every variant of enum has a discriminator that used in Scale. By default based on 0, but can be overriden by attributes
Alternatives
Present at least two alternatives to the solution you suggested
Concerns
Write down all the things that worry you or other stakeholders
Assumptions
Document any assumption that you made
Risks
...
Additional Information
- Scale codec description in Substrate docs [https://substrate.dev/docs/en/knowledgebase/advanced/codec]
- Scale codec Github page [https://github.com/paritytech/parity-scale-codec]