8 #include "scale/scale.hpp" 13 const jsonrpc::Request::Parameters ¶ms) {
16 if (params.size() > 3 or params.size() < 2) {
17 throw jsonrpc::InvalidParametersFault(
"Incorrect number of params");
20 auto ¶m0 = params[0];
22 if (not param0.IsString() or param0.IsNil()) {
23 throw jsonrpc::InvalidParametersFault(
24 "Parameter '[child_storage_key]' must be a hex string");
30 auto ¶m1 = params[1];
32 if (not param1.IsString() and not param1.IsNil()) {
33 throw jsonrpc::InvalidParametersFault(
34 "Parameter '[prefix]' must be a hex string");
39 }
else if (param1.IsString()) {
43 throw jsonrpc::InvalidParametersFault(
44 "Parameter '[prefix]' must be a hex string");
47 if (params.size() == 2) {
48 return outcome::success();
52 if (not params[2].IsString()) {
53 throw jsonrpc::InvalidParametersFault(
54 "Parameter '[at]' must be a hex string representation of an encoded " 55 "optional byte sequence");
61 return outcome::success();
std::shared_ptr< ChildStateApi > api_
common::Buffer child_storage_key_
outcome::result< std::vector< uint8_t > > unhexWith0x(std::string_view hex_with_prefix)
Unhex hex-string with 0x in the begining.
std::optional< common::Buffer > prefix_
SLBuffer< std::numeric_limits< size_t >::max()> Buffer
outcome::result< void > init(const jsonrpc::Request::Parameters ¶ms)
static outcome::result< Blob< size_ > > fromSpan(const gsl::span< const uint8_t > &span)
std::optional< primitives::BlockHash > at_
outcome::result< std::vector< common::Buffer > > execute()