11 : api_(
std::move(api)) {
12 BOOST_ASSERT(
api_ !=
nullptr);
16 const jsonrpc::Request::Parameters ¶ms) {
17 if (params.size() > 1) {
18 throw jsonrpc::InvalidParametersFault(
"Incorrect number of params");
21 auto const no_args = params.empty();
22 auto const have_nil_arg = (!no_args && params[0].IsNil());
23 auto const have_str_arg = (!no_args && params[0].IsString());
25 if (no_args || have_nil_arg) {
27 }
else if (have_str_arg) {
28 auto &&at_str = params[0].AsString();
33 throw jsonrpc::InvalidParametersFault(
34 "Parameter 'at' must be a hex string");
37 return outcome::success();
42 return api_->getRuntimeVersion(
at_);
outcome::result< primitives::Version > execute()
outcome::result< std::vector< uint8_t > > unhexWith0x(std::string_view hex_with_prefix)
Unhex hex-string with 0x in the begining.
GetRuntimeVersion(const GetRuntimeVersion &)=delete
std::shared_ptr< StateApi > api_
static outcome::result< Blob< size_ > > fromSpan(const gsl::span< const uint8_t > &span)
std::optional< primitives::BlockHash > at_
outcome::result< void > init(jsonrpc::Request::Parameters const ¶ms)