Metadata
Metadata of the project
Last updated
Was this helpful?
Metadata of the project
Last updated
Was this helpful?
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 has five properties, each holding a list of module specific items:
calls
- dispatchable
extrinsic calls
storage items
- list of module specific storage entries
events
- list of module specific events
constants
- list of module specific constants
errors
- list of module specific well-known errors
Subsembly
metadata encoding follows the same rules as .
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: