Metadata
Metadata of the project
Overview
Subsembly
runtimes expose metadata to make the interaction easier. Each module's own metadata together form one general metadata of a blockchain. Metadata of the module provides all the necessary information about the module.
Module Metadata
Module metadata has five properties, each holding a list of module specific items:
calls
-dispatchable
extrinsic callsstorage items
- list of module specific storage entriesevents
- list of module specific eventsconstants
- list of module specific constantserrors
- list of module specific well-known errors
Metadata Encoding
Subsembly
metadata encoding follows the same rules as Substrate Metadata.
Metadata Generation
One of the preliminary steps of runtime compilation is to generate metadata and dispatcher files. This is achieved by parsing module files and runtime.ts
file to populate metadata of the module.
For example, storage items of each module are located in the beginning of the module file:
Extrinsic calls are parsed from the static functions of the declared modules. The following static function is parsed as an extrinsic call for Balances module.
Static function with a name starting with underscore (_
) is ignored while parsing and considered as internal function.
And constants for each module are declared inside the runtime.ts:
For instance, constants for Timestamp are declared like this:
Last updated