referrerpolicy=no-referrer-when-downgrade

Trait sp_genesis_builder::GenesisBuilder

source ·
pub trait GenesisBuilder<Block: BlockT>: Core<Block> {
    // Provided methods
    fn build_state(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        json: Vec<u8>,
    ) -> Result<Result, ApiError> { ... }
    fn get_preset(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        id: &Option<PresetId>,
    ) -> Result<Option<Vec<u8>>, ApiError> { ... }
    fn preset_names(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<Vec<PresetId>, ApiError> { ... }
}
Expand description

API to interact with RuntimeGenesisConfig for the runtime

Provided Methods§

source

fn build_state( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, json: Vec<u8>, ) -> Result<Result, ApiError>

Build RuntimeGenesisConfig from a JSON blob not using any defaults and store it in the storage.

In the case of a FRAME-based runtime, this function deserializes the full RuntimeGenesisConfig 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.

Please note that provided JSON blob must contain all RuntimeGenesisConfig fields, no defaults will be used.

source

fn get_preset( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, id: &Option<PresetId>, ) -> Result<Option<Vec<u8>>, ApiError>

Returns a JSON blob representation of the built-in RuntimeGenesisConfig identified by id.

If id is None the function should return JSON blob representation of the default RuntimeGenesisConfig struct of the runtime. Implementation must provide default RuntimeGenesisConfig.

Otherwise function returns a JSON representation of the built-in, named RuntimeGenesisConfig preset identified by id, or None if such preset does not exist. Returned Vec<u8> contains bytes of JSON blob (patch) which comprises a list of (potentially nested) key-value pairs that are intended for customizing the default runtime genesis config. The patch shall be merged (rfc7386) with the JSON representation of the default RuntimeGenesisConfig to create a comprehensive genesis config that can be used in build_state method.

source

fn preset_names( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Vec<PresetId>, ApiError>

Returns a list of identifiers for available builtin RuntimeGenesisConfig presets.

The presets from the list can be queried with GenesisBuilder::get_preset method. If no named presets are provided by the runtime the list is empty.

Trait Implementations§

source§

impl<Block: BlockT> RuntimeApiInfo for dyn GenesisBuilder<Block>

source§

const ID: [u8; 8] = _

The identifier of the runtime api.
source§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§