MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / GetKeyPrefixArray

Function GetKeyPrefixArray

src/rpc/rpcsubmittx.cpp:50–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48using std::chrono::microseconds;
49
50Array GetKeyPrefixArray(const Value &jsonValue) {
51 auto valueType = jsonValue.type();
52
53 if (valueType == json_spirit::array_type) {
54 return jsonValue.get_array();
55 } else if (valueType == json_spirit::str_type) {
56 json_spirit::Value newObj;
57 try {
58 json_spirit::read_string_or_throw(jsonValue.get_str(), newObj);
59 } catch (json_spirit::Error_position &e) {
60 throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Parse json of key prefix array error! line[%d:%d] %s",
61 e.line_, e.column_, e.reason_));
62 }
63 auto newObjType = newObj.type();
64 if (newObjType == json_spirit::obj_type || newObjType == json_spirit::array_type) {
65 return newObj.get_array();
66 }
67 }
68 throw JSONRPCError(RPC_INVALID_PARAMETER, "The contract action args type must be object or array,"
69 " or string of object or array");
70}
71
72Array GetKeyPrefixArray(const Array &params, uint32_t index) {
73 return (params.size() > index) ? GetKeyPrefixArray(params[index]) : Array();

Callers 1

wasm_gettableFunction · 0.85

Calls 4

read_string_or_throwFunction · 0.85
JSONRPCErrorFunction · 0.85
typeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected