mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 04:25:51 +00:00
Add RPC json.
This commit is contained in:
@@ -328,6 +328,25 @@ Json::Value RPCParser::parseGetCounts(const Json::Value& jvParams)
|
|||||||
return jvRequest;
|
return jvRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// json <command> <json>
|
||||||
|
Json::Value RPCParser::parseJson(const Json::Value& jvParams)
|
||||||
|
{
|
||||||
|
Json::Reader reader;
|
||||||
|
Json::Value jvRequest;
|
||||||
|
|
||||||
|
cLog(lsTRACE) << "RPC method: " << jvParams[0u];
|
||||||
|
cLog(lsTRACE) << "RPC json: " << jvParams[1u];
|
||||||
|
|
||||||
|
if (reader.parse(jvParams[1u].asString(), jvRequest))
|
||||||
|
{
|
||||||
|
jvRequest["method"] = jvParams[0u];
|
||||||
|
|
||||||
|
return jvRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rpcError(rpcINVALID_PARAMS);
|
||||||
|
}
|
||||||
|
|
||||||
// ledger [id|index|current|closed|validated] [full]
|
// ledger [id|index|current|closed|validated] [full]
|
||||||
Json::Value RPCParser::parseLedger(const Json::Value& jvParams)
|
Json::Value RPCParser::parseLedger(const Json::Value& jvParams)
|
||||||
{
|
{
|
||||||
@@ -631,6 +650,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
|
|||||||
{ "connect", &RPCParser::parseConnect, 1, 2 },
|
{ "connect", &RPCParser::parseConnect, 1, 2 },
|
||||||
{ "consensus_info", &RPCParser::parseAsIs, 0, 0 },
|
{ "consensus_info", &RPCParser::parseAsIs, 0, 0 },
|
||||||
{ "get_counts", &RPCParser::parseGetCounts, 0, 1 },
|
{ "get_counts", &RPCParser::parseGetCounts, 0, 1 },
|
||||||
|
{ "json", &RPCParser::parseJson, 2, 2 },
|
||||||
{ "ledger", &RPCParser::parseLedger, 0, 2 },
|
{ "ledger", &RPCParser::parseLedger, 0, 2 },
|
||||||
{ "ledger_accept", &RPCParser::parseAsIs, 0, 0 },
|
{ "ledger_accept", &RPCParser::parseAsIs, 0, 0 },
|
||||||
{ "ledger_closed", &RPCParser::parseAsIs, 0, 0 },
|
{ "ledger_closed", &RPCParser::parseAsIs, 0, 0 },
|
||||||
|
|||||||
@@ -23,9 +23,10 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
Json::Value parseEvented(const Json::Value& jvParams);
|
Json::Value parseEvented(const Json::Value& jvParams);
|
||||||
Json::Value parseGetCounts(const Json::Value& jvParams);
|
Json::Value parseGetCounts(const Json::Value& jvParams);
|
||||||
|
Json::Value parseInternal(const Json::Value& jvParams);
|
||||||
|
Json::Value parseJson(const Json::Value& jvParams);
|
||||||
Json::Value parseLedger(const Json::Value& jvParams);
|
Json::Value parseLedger(const Json::Value& jvParams);
|
||||||
Json::Value parseLedgerId(const Json::Value& jvParams);
|
Json::Value parseLedgerId(const Json::Value& jvParams);
|
||||||
Json::Value parseInternal(const Json::Value& jvParams);
|
|
||||||
#if ENABLE_INSECURE
|
#if ENABLE_INSECURE
|
||||||
Json::Value parseLogin(const Json::Value& jvParams);
|
Json::Value parseLogin(const Json::Value& jvParams);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ void printHelp(const po::options_description& desc)
|
|||||||
cerr << " data_store <key> <value>" << endl;
|
cerr << " data_store <key> <value>" << endl;
|
||||||
#endif
|
#endif
|
||||||
cerr << " get_counts" << endl;
|
cerr << " get_counts" << endl;
|
||||||
|
cerr << " json <method> <json>" << endl;
|
||||||
cerr << " ledger [<id>|current|closed|validated] [full]" << endl;
|
cerr << " ledger [<id>|current|closed|validated] [full]" << endl;
|
||||||
cerr << " ledger_accept" << endl;
|
cerr << " ledger_accept" << endl;
|
||||||
cerr << " ledger_closed" << endl;
|
cerr << " ledger_closed" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user