8 #include "scale/scale.hpp" 16 outcome::result<void>
Call::init(
const jsonrpc::Request::Parameters ¶ms) {
17 if (params.size() > 3 or params.size() < 2) {
18 throw jsonrpc::InvalidParametersFault(
"Incorrect number of params");
20 auto ¶m0 = params[0];
22 if (param0.IsString() and not param0.IsNil()) {
25 throw jsonrpc::InvalidParametersFault(
26 "Parameter '[method]' must be a string");
29 auto ¶m1 = params[1];
30 if (param1.IsString() and not param1.IsNil()) {
32 if (encoded_args.has_value()) {
35 throw jsonrpc::InvalidParametersFault(
36 "Parameter '[data]' must be a hex-encoded string");
39 throw jsonrpc::InvalidParametersFault(
40 "Parameter '[data]' must be a hex-encoded string");
43 if (params.size() == 2) {
44 return outcome::success();
47 auto ¶m2 = params[2];
49 if (not param2.IsString()) {
50 throw jsonrpc::InvalidParametersFault(
51 "Parameter '[at]' must be a hex string representation of an encoded " 52 "optional byte sequence");
58 return outcome::success();
std::shared_ptr< StateApi > api_
Call(Call const &)=delete
outcome::result< void > init(const jsonrpc::Request::Parameters ¶ms)
outcome::result< std::vector< uint8_t > > unhexWith0x(std::string_view hex_with_prefix)
Unhex hex-string with 0x in the begining.
SLBuffer< std::numeric_limits< size_t >::max()> Buffer
std::optional< primitives::BlockHash > at_
static outcome::result< Blob< size_ > > fromSpan(const gsl::span< const uint8_t > &span)
outcome::result< common::Buffer > execute()