referrerpolicy=no-referrer-when-downgrade

Trait polkadot_sdk_frame::runtime::apis::GenesisBuilder

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

API to interact with RuntimeGenesisConfig for the runtime

Provided Methods§

fn build_state( &self, __runtime_api_at_param__: <Block as Block>::Hash, json: Vec<u8>, ) -> Result<Result<(), RuntimeString>, 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.

fn get_preset( &self, __runtime_api_at_param__: <Block as Block>::Hash, id: &Option<RuntimeString>, ) -> 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.

fn preset_names( &self, __runtime_api_at_param__: <Block as Block>::Hash, ) -> Result<Vec<RuntimeString>, 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§

§

impl<Block> RuntimeApiInfo for dyn GenesisBuilder<Block>
where Block: Block,

§

const ID: [u8; 8] = _

The identifier of the runtime api.
§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§