Trait sp_genesis_builder::GenesisBuilder
source · pub trait GenesisBuilder<Block: BlockT>: Core<Block> {
// Provided methods
fn create_default_config(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash
) -> Result<Vec<u8>, ApiError> { ... }
fn build_config(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
json: Vec<u8>
) -> Result<Result, ApiError> { ... }
}
Expand description
API to interact with GenesisConfig for the runtime
Provided Methods§
sourcefn create_default_config(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash
) -> Result<Vec<u8>, ApiError>
fn create_default_config( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<Vec<u8>, ApiError>
Creates the default GenesisConfig
and returns it as a JSON blob.
This function instantiates the default GenesisConfig
struct for the runtime and serializes it into a JSON
blob. It returns a Vec<u8>
containing the JSON representation of the default GenesisConfig
.
sourcefn build_config(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
json: Vec<u8>
) -> Result<Result, ApiError>
fn build_config( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, json: Vec<u8> ) -> Result<Result, ApiError>
Build GenesisConfig
from a JSON blob not using any defaults and store it in the storage.
This function deserializes the full GenesisConfig
from the given JSON blob and puts it into the storage.
If the provided JSON blob is incorrect or incomplete or the deserialization fails, an error is returned.
It is recommended to log any errors encountered during the process.
Please note that provided json blob must contain all GenesisConfig
fields, no defaults will be used.