Kind Registry
Kind registration and management.
Functions
register
Registers a new kind with the specified parameters.
function register(ElementType[] memory stateSpec, bytes32 code, bytes32 data, uint64[] memory relSpec)
external
returns (uint64);
Parameters
Name | Type | Description |
---|---|---|
stateSpec | ElementType[] | Specification of the elements that define the object's state. |
code | bytes32 | The material hash of the kind's code. |
data | bytes32 | The material hash of the kind's data. |
relSpec | uint64[] | List of relations supported by this kind. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint64 | The ID of the newly registered kind. |
update
Updates the code, data of an existing kind.
function update(uint64 id, bytes32 code, bytes32 data) external returns (Meta memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind to be updated. |
code | bytes32 | The new material hash representing the kind's code. A zero value indicates no change. |
data | bytes32 | The new material hash representing the kind's data. A zero value indicates no change. |
Returns
Name | Type | Description |
---|---|---|
<none> | Meta | The updated metadata for the kind. |
update
Updates the code, data, and relations of an existing kind.
function update(uint64 id, bytes32 code, bytes32 data, uint64[] memory relSpec) external returns (Meta memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind to update. |
code | bytes32 | The new material hash representing the kind's code. A zero value indicates no change. |
data | bytes32 | The new material hash representing the kind's data. A zero value indicates no change. |
relSpec | uint64[] | The updated list of relations for the kind. |
Returns
Name | Type | Description |
---|---|---|
<none> | Meta | The updated metadata of the kind. |
upgrade
Upgrades a kind's kind and/or set to a newer revision.
function upgrade(uint64 id, uint32 kindRev, uint32 setRev) external returns (Meta memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind to upgrade. |
kindRev | uint32 | The newer revision of the kind's kind object (0 indicates no upgrade). |
setRev | uint32 | The newer revision of the kind's set object (0 indicates no upgrade). |
Returns
Name | Type | Description |
---|---|---|
<none> | Meta | The metadata of the kind after the upgrade. |
touch
Increases the revision of the kind without any state changes.
function touch(uint64 id) external returns (Meta memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind to touch. |
Returns
Name | Type | Description |
---|---|---|
<none> | Meta | The updated metadata of the kind. |
transfer
Transfers ownership of a kind to another address.
function transfer(uint64 id, address to) external;
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind to transfer. |
to | address | The address of the new owner. |
ownerOf
Returns the owner of a kind.
function ownerOf(uint64 id) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the owner. |
stateSpecAt
Retrieves the state specification of a kind at a given revision.
function stateSpecAt(uint64 id, uint32 rev) external view returns (ElementType[] memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
rev | uint32 | The specific revision number. A zero value returns the latest revision. |
Returns
Name | Type | Description |
---|---|---|
<none> | ElementType[] | The state specification of the kind. |
codeAt
Retrieves the code hash of a kind at a given revision.
function codeAt(uint64 id, uint32 rev) external view returns (bytes32);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
rev | uint32 | The specific revision number. A zero value returns the latest revision. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32 | The code hash of the kind. |
relSpecAt
Retrieves the relations supported by a kind at a given revision.
function relSpecAt(uint64 id, uint32 rev) external view returns (uint64[] memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
rev | uint32 | The specific revision number. A zero value returns the latest revision. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint64[] | The supported relations. |
metaAt
Returns the metadata of a kind at a specific revision.
function metaAt(uint64 id, uint32 rev) external view returns (Meta memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
rev | uint32 | The revision number. A zero value returns the latest revision. |
Returns
Name | Type | Description |
---|---|---|
<none> | Meta | The metadata of the kind. |
stateAt
Retrieves the elements of a kind at a specific revision.
function stateAt(uint64 id, uint32 rev) external view returns (bytes32[] memory);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
rev | uint32 | The revision number. A zero value returns the latest revision. |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32[] | The elements of the kind at the specified revision. |
revAt
Checks if a revision of a kind is valid.
function revAt(uint64 id, uint32 rev) external view returns (uint32);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The unique identifier of the kind. |
rev | uint32 | The specific revision to check, with zero indicating the latest revision. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint32 | The revision number requested. A zero return value means the revision is invalid. |
Events
KindRegistered
Emitted when a new kind is registered in the registry.
event KindRegistered(
uint64 id, Meta meta, ElementType[] stateSpec, bytes32 code, bytes32 data, uint64[] relSpec, address owner
);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the newly registered kind. |
meta | Meta | Metadata of the registered kind. |
stateSpec | ElementType[] | The element specification of objects belonging to this kind. |
code | bytes32 | The material hash of the kind's code. |
data | bytes32 | The material hash of the kind's data. |
relSpec | uint64[] | List of relations supported by this kind. |
owner | address | The address that owns the registered kind. |
KindUpdated
Emitted when a kind is updated.
event KindUpdated(uint64 id, Meta meta, uint64[] relSpec, bytes32 code, bytes32 data);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the updated kind. |
meta | Meta | Updated metadata of the kind. |
relSpec | uint64[] | Updated list of relations associated with the kind. |
code | bytes32 | Updated material hash of the kind's code. |
data | bytes32 | Updated material hash of the kind's data. |
KindUpgraded
Emitted when a kind is upgraded.
event KindUpgraded(uint64 id, Meta meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the upgraded kind. |
meta | Meta | Updated metadata of the upgraded kind. |
KindTouched
Emitted when a kind's revision is bumped without state change.
event KindTouched(uint64 id, Meta meta);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind. |
meta | Meta | Metadata of the touched kind. |
KindTransferred
Emitted when ownership of a kind is transferred.
event KindTransferred(uint64 id, address from, address to);
Parameters
Name | Type | Description |
---|---|---|
id | uint64 | The ID of the kind being transferred. |
from | address | The current owner of the kind. |
to | address | The new owner of the kind. |