mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 13:35:54 +00:00
Add support for RPC random.
This commit is contained in:
@@ -394,6 +394,8 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
|
||||
// - To modify the method, provide a new method in the request.
|
||||
{ "accept_ledger", &RPCParser::parseAsIs, 0, 0 },
|
||||
{ "account_info", &RPCParser::parseAccountInfo, 1, 2 },
|
||||
{ "account_lines", &RPCParser::parseAccountItems, 1, 2 },
|
||||
{ "account_offers", &RPCParser::parseAccountItems, 1, 2 },
|
||||
{ "account_tx", &RPCParser::parseAccountTransactions, 2, 3 },
|
||||
{ "connect", &RPCParser::parseConnect, 1, 2 },
|
||||
{ "get_counts", &RPCParser::parseGetCounts, 0, 1 },
|
||||
@@ -409,8 +411,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
|
||||
{ "owner_info", &RPCParser::parseOwnerInfo, 1, 2 },
|
||||
{ "peers", &RPCParser::parseAsIs, 0, 0 },
|
||||
// { "profile", &RPCParser::parseProfile, 1, 9 },
|
||||
{ "account_lines", &RPCParser::parseAccountItems, 1, 2 },
|
||||
{ "account_offers", &RPCParser::parseAccountItems, 1, 2 },
|
||||
{ "random", &RPCParser::parseAsIs, 0, 0 },
|
||||
// { "ripple_path_find", &RPCParser::parseRipplePathFind, -1, -1 },
|
||||
{ "submit", &RPCParser::parseSubmit, 2, 2 },
|
||||
{ "server_info", &RPCParser::parseAsIs, 0, 0 },
|
||||
|
||||
@@ -12,6 +12,7 @@ protected:
|
||||
typedef Json::Value (RPCParser::*parseFuncPtr)(const Json::Value &jvParams);
|
||||
|
||||
Json::Value parseAccountInfo(const Json::Value& jvParams);
|
||||
Json::Value parseAccountItems(const Json::Value& jvParams);
|
||||
Json::Value parseAccountTransactions(const Json::Value& jvParams);
|
||||
Json::Value parseAsIs(const Json::Value& jvParams);
|
||||
Json::Value parseConnect(const Json::Value& jvParams);
|
||||
@@ -23,7 +24,7 @@ protected:
|
||||
Json::Value parseLedger(const Json::Value& jvParams);
|
||||
Json::Value parseLogin(const Json::Value& jvParams);
|
||||
Json::Value parseOwnerInfo(const Json::Value& jvParams);
|
||||
Json::Value parseAccountItems(const Json::Value& jvParams);
|
||||
Json::Value parseRandom(const Json::Value& jvParams);
|
||||
Json::Value parseSubmit(const Json::Value& jvParams);
|
||||
Json::Value parseTx(const Json::Value& jvParams);
|
||||
Json::Value parseTxHistory(const Json::Value& jvParams);
|
||||
|
||||
@@ -689,6 +689,23 @@ Json::Value RPCHandler::doAccountOffers(Json::Value jvRequest)
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
// Result:
|
||||
// {
|
||||
// random: <uint160>
|
||||
// }
|
||||
Json::Value RPCHandler::doRandom(Json::Value jvRequest)
|
||||
{
|
||||
uint160 uRandom;
|
||||
|
||||
RAND_bytes(uRandom.begin(), uRandom.size());
|
||||
|
||||
Json::Value jvResult;
|
||||
|
||||
jvResult["random"] = uRandom.ToString();
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// - Add support for specifying non-endpoint issuer.
|
||||
// - Return fully expanded path with proof.
|
||||
@@ -2262,6 +2279,8 @@ Json::Value RPCHandler::doCommand(Json::Value& jvRequest, int iRole)
|
||||
// Request-response methods
|
||||
{ "accept_ledger", &RPCHandler::doAcceptLedger, true, false, optCurrent },
|
||||
{ "account_info", &RPCHandler::doAccountInfo, false, false, optCurrent },
|
||||
{ "account_lines", &RPCHandler::doAccountLines, false, false, optCurrent },
|
||||
{ "account_offers", &RPCHandler::doAccountOffers, false, false, optCurrent },
|
||||
{ "account_tx", &RPCHandler::doAccountTransactions, false, false, optNetwork },
|
||||
{ "connect", &RPCHandler::doConnect, true, false, optNone },
|
||||
{ "get_counts", &RPCHandler::doGetCounts, true, false, optNone },
|
||||
@@ -2277,8 +2296,7 @@ Json::Value RPCHandler::doCommand(Json::Value& jvRequest, int iRole)
|
||||
{ "owner_info", &RPCHandler::doOwnerInfo, false, false, optCurrent },
|
||||
{ "peers", &RPCHandler::doPeers, true, false, optNone },
|
||||
// { "profile", &RPCHandler::doProfile, false, false, optCurrent },
|
||||
{ "account_lines", &RPCHandler::doAccountLines, false, false, optCurrent },
|
||||
{ "account_offers", &RPCHandler::doAccountOffers, false, false, optCurrent },
|
||||
{ "random", &RPCHandler::doRandom, false, false, optNone },
|
||||
{ "ripple_path_find", &RPCHandler::doRipplePathFind, false, false, optCurrent },
|
||||
{ "submit", &RPCHandler::doSubmit, false, false, optCurrent },
|
||||
{ "server_info", &RPCHandler::doServerInfo, true, false, optNone },
|
||||
|
||||
@@ -38,6 +38,8 @@ class RPCHandler
|
||||
Json::Value doAcceptLedger(Json::Value jvRequest);
|
||||
|
||||
Json::Value doAccountInfo(Json::Value params);
|
||||
Json::Value doAccountLines(Json::Value params);
|
||||
Json::Value doAccountOffers(Json::Value params);
|
||||
Json::Value doAccountTransactions(Json::Value params);
|
||||
Json::Value doConnect(Json::Value params);
|
||||
Json::Value doDataDelete(Json::Value params);
|
||||
@@ -45,27 +47,21 @@ class RPCHandler
|
||||
Json::Value doDataStore(Json::Value params);
|
||||
Json::Value doGetCounts(Json::Value params);
|
||||
Json::Value doLedger(Json::Value params);
|
||||
Json::Value doLogLevel(Json::Value params);
|
||||
Json::Value doLogRotate(Json::Value params);
|
||||
Json::Value doNicknameInfo(Json::Value params);
|
||||
|
||||
Json::Value doOwnerInfo(Json::Value params);
|
||||
|
||||
Json::Value doProfile(Json::Value params);
|
||||
Json::Value doPeers(Json::Value params);
|
||||
|
||||
Json::Value doAccountLines(Json::Value params);
|
||||
Json::Value doAccountOffers(Json::Value params);
|
||||
Json::Value doProfile(Json::Value params);
|
||||
Json::Value doRandom(Json::Value jvRequest);
|
||||
Json::Value doRipplePathFind(Json::Value jvRequest);
|
||||
Json::Value doServerInfo(Json::Value params);
|
||||
Json::Value doSessionClose(Json::Value params);
|
||||
Json::Value doSessionOpen(Json::Value params);
|
||||
Json::Value doLogLevel(Json::Value params);
|
||||
Json::Value doStop(Json::Value params);
|
||||
Json::Value doSubmit(Json::Value params);
|
||||
Json::Value doTx(Json::Value params);
|
||||
Json::Value doTxHistory(Json::Value params);
|
||||
|
||||
|
||||
Json::Value doUnlAdd(Json::Value params);
|
||||
Json::Value doUnlDelete(Json::Value params);
|
||||
Json::Value doUnlFetch(Json::Value params);
|
||||
|
||||
Reference in New Issue
Block a user