Skip to content

sgns::runtime::binaryen::RuntimeApi

base class for all runtime apis

#include <runtime_api.hpp>

Inherited by sgns::runtime::binaryen::BlockBuilderImpl, sgns::runtime::binaryen::CoreImpl, sgns::runtime::binaryen::FinalityApiImpl, sgns::runtime::binaryen::MetadataImpl, sgns::runtime::binaryen::OffchainWorkerImpl, sgns::runtime::binaryen::ParachainHostImpl, sgns::runtime::binaryen::ProductionApiImpl, sgns::runtime::binaryen::TaggedTransactionQueueImpl

Public Types

Name
enum class CallPersistency

Public Functions

Name
RuntimeApi(std::shared_ptr< WasmProvider > wasm_provider, std::shared_ptr< RuntimeManager > runtime_manager)

Protected Functions

Name
template <typename R ,typename... Args>
outcome::result< R >
executeAt(std::string_view name, const base::Hash256 & state_root, CallPersistency persistency, Args &&... args)
executes wasm export method returning non-void result
template <typename R ,typename... Args>
outcome::result< R >
execute(std::string_view name, CallPersistency persistency, Args &&... args)
executes wasm export method returning non-void result

Public Types Documentation

enum CallPersistency

Enumerator Value Description
PERSISTENT
EPHEMERAL

Public Functions Documentation

function RuntimeApi

inline RuntimeApi(
    std::shared_ptr< WasmProvider > wasm_provider,
    std::shared_ptr< RuntimeManager > runtime_manager
)

Protected Functions Documentation

function executeAt

template <typename R ,
typename... Args>
inline outcome::result< R > executeAt(
    std::string_view name,
    const base::Hash256 & state_root,
    CallPersistency persistency,
    Args &&... args
)

executes wasm export method returning non-void result

Parameters:

  • name - export method name
  • state_root - a hash of the state root to which the state will be reset before executing the export method
  • persistency - PERSISTENT if changes made by the method should persist in the state, EPHEMERAL if they can be discraded
  • args - export method arguments

Template Parameters:

  • R result type including void
  • Args arguments types list

Return: a parsed result or an error

function execute

template <typename R ,
typename... Args>
inline outcome::result< R > execute(
    std::string_view name,
    CallPersistency persistency,
    Args &&... args
)

executes wasm export method returning non-void result

Parameters:

  • name - export method name
  • persistency - PERSISTENT if changes made by the method should persist in the state, EPHEMERAL if they can be discraded
  • args - export method arguments

Template Parameters:

  • R result type including void
  • Args arguments types list

Return: a parsed result or an error


Updated on 2026-03-04 at 13:10:43 -0800