Kinds
A Kind is a meta-object that defines the structure, appearance, and interactions of a type of objects.
Kind Object
Metadata
The metadata of a kind contains essential information about its type and versioning. Every kind is minted from the Set of Kinds, with a kind of the Kind of Kind.
Field | Value | Description |
---|---|---|
traits | 0 | Reserved flags |
rev | 1 | Current revision number (initially set to 1 ) |
krev | kindOfKind.metadata.rev | Revision of the Kind of Kind |
srev | setOfKind.metadata.rev | Revision of the Set of Kind |
kind | kindOfKind.id | ID of the Kind of Kind |
set | setOfKind.id | ID of the Set of Kind |
Elements
Each kind has 6 elements, defined by the Kind of Kind. These elements serve as the core structure for both object typing and asset computation.
Index | Element | Type | Mutable | Description |
---|---|---|---|---|
0 | data | Matter | Yes | Hash of a bundle with committed matters and infos |
1 | code | Matter | Yes | Hash of the kind contract |
2 | skel | Info | No | Declares the element types for objects of this kind |
3 | rels[0] | Info | Yes | Supported relations (part 1) |
4 | rels[1] | Info | Yes | Supported relations (part 2) |
Kind Contract
A Kind Contract is a Matter
written in code form. It defines how an object’s assets are computed from its elements — enabling programmable logic for rendering, validation, or transformation.
Kind contracts are currently written in AssemblyScript, compiled to WebAssembly using kind-as
. A Rust-based compiler is planned for future support.
Elements
The fields of the contract class define the elements of the object. These can be accessed during kind contract execution:
Facets
The methods exposed by the kind contract are called facet functions. Each facet function defines how a specific object asset is computed:
Each output is called a facet image, and it can be accessed using a facet selector — a unique identifier used to dispatch to the correct function.
Kind Registry
Operation | Description |
---|---|
register_kind | Registers a new kind into the registry. |
update_kind | Updates the mutable elements of an existing kind. |
upgrade_kind | Applies a new revision of kind or set to the kind object. |