diff --git a/src/cpp/ripple/CallRPC.cpp b/src/cpp/ripple/CallRPC.cpp index 5eef77cee..a47aa7182 100644 --- a/src/cpp/ripple/CallRPC.cpp +++ b/src/cpp/ripple/CallRPC.cpp @@ -210,6 +210,13 @@ Json::Value RPCParser::parseLogin(const Json::Value& jvParams) return jvRequest; } +// owner_info || +// owner_info || [] +Json::Value RPCParser::parseOwnerInfo(const Json::Value& jvParams) +{ + return parseAccountInfo(jvParams); +} + // ripple_lines_get || [] Json::Value RPCParser::parseRippleLinesGet(const Json::Value& jvParams) { @@ -373,20 +380,20 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams) { "ledger_accept", &RPCParser::parseAsIs, 0, 0 }, { "ledger_closed", &RPCParser::parseAsIs, 0, 0 }, { "ledger_current", &RPCParser::parseAsIs, 0, 0 }, -// { "ledger_entry", &RPCParser::parseLedgerEntry, -1, -1, false, false, optCurrent }, -// { "ledger_header", &RPCParser::parseLedgerHeader, -1, -1, false, false, optCurrent }, +// { "ledger_entry", &RPCParser::parseLedgerEntry, -1, -1 }, +// { "ledger_header", &RPCParser::parseLedgerHeader, -1, -1 }, // { "log_level", &RPCParser::parseLogLevel, 0, 2 }, { "logrotate", &RPCParser::parseAsIs, 0, 0 }, -// { "nickname_info", &RPCParser::parseNicknameInfo, 1, 1, false, false, optCurrent }, -// { "owner_info", &RPCParser::parseOwnerInfo, 1, 2, false, false, optCurrent }, +// { "nickname_info", &RPCParser::parseNicknameInfo, 1, 1 }, + { "owner_info", &RPCParser::parseOwnerInfo, 1, 2 }, { "peers", &RPCParser::parseAsIs, 0, 0 }, // { "profile", &RPCParser::parseProfile, 1, 9, false, false, optCurrent }, { "ripple_lines_get", &RPCParser::parseRippleLinesGet, 1, 2 }, -// { "ripple_path_find", &RPCParser::parseRipplePathFind, -1, -1, false, false, optCurrent }, +// { "ripple_path_find", &RPCParser::parseRipplePathFind, -1, -1 }, { "submit", &RPCParser::parseSubmit, 2, 2 }, { "server_info", &RPCParser::parseAsIs, 0, 0 }, { "stop", &RPCParser::parseAsIs, 0, 0 }, -// { "transaction_entry", &RPCParser::parseTransactionEntry, -1, -1, false, false, optCurrent }, +// { "transaction_entry", &RPCParser::parseTransactionEntry, -1, -1 }, // { "tx", &RPCParser::parseTx, 1, 1, true, false, optNone }, // { "tx_history", &RPCParser::parseTxHistory, 1, 1, false, false, optNone }, // diff --git a/src/cpp/ripple/CallRPC.h b/src/cpp/ripple/CallRPC.h index 419560e85..65b94911a 100644 --- a/src/cpp/ripple/CallRPC.h +++ b/src/cpp/ripple/CallRPC.h @@ -22,6 +22,7 @@ protected: Json::Value parseGetCounts(const Json::Value& jvParams); Json::Value parseLedger(const Json::Value& jvParams); Json::Value parseLogin(const Json::Value& jvParams); + Json::Value parseOwnerInfo(const Json::Value& jvParams); Json::Value parseRippleLinesGet(const Json::Value& jvParams); Json::Value parseSubmit(const Json::Value& jvParams); Json::Value parseUnlAdd(const Json::Value& jvParams); diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 2cd3118c7..9a2e92759 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -267,7 +267,10 @@ Json::Value RPCHandler::doAcceptLedger(Json::Value jvRequest) return jvResult; } -// { 'ident' : _indent_, 'index' : _index_ // optional } +// { +// 'ident' : , +// 'index' : // optional +// } Json::Value RPCHandler::doAccountInfo(Json::Value jvRequest) { // cLog(lsDEBUG) << "doAccountInfo: " << jvRequest; @@ -402,6 +405,7 @@ Json::Value RPCHandler::doDataStore(Json::Value jvRequest) return ret; } +// XXX Needs to be revised for new paradigm // nickname_info // Note: Nicknames are not automatically looked up by commands as they are advisory and can be changed. Json::Value RPCHandler::doNicknameInfo(Json::Value params) @@ -430,27 +434,29 @@ Json::Value RPCHandler::doNicknameInfo(Json::Value params) } -// owner_info || -// owner_info || [] -Json::Value RPCHandler::doOwnerInfo(Json::Value params) +// { +// 'ident' : , +// 'index' : // optional +// } +Json::Value RPCHandler::doOwnerInfo(Json::Value jvRequest) { - std::string strIdent = params[0u].asString(); + std::string strIdent = jvRequest["ident"].asString(); bool bIndex; - int iIndex = 2 == params.size() ? lexical_cast_s(params[1u].asString()) : 0; - RippleAddress naAccount; + int iIndex = jvRequest.isMember("index") ? jvRequest["index"].asUInt() : 0; + RippleAddress raAccount; Json::Value ret; // Get info on account. uint256 uAccepted = mNetOps->getClosedLedgerHash(); - Json::Value jAccepted = accountFromString(uAccepted, naAccount, bIndex, strIdent, iIndex); + Json::Value jAccepted = accountFromString(uAccepted, raAccount, bIndex, strIdent, iIndex); - ret["accepted"] = jAccepted.empty() ? mNetOps->getOwnerInfo(uAccepted, naAccount) : jAccepted; + ret["accepted"] = jAccepted.empty() ? mNetOps->getOwnerInfo(uAccepted, raAccount) : jAccepted; - Json::Value jCurrent = accountFromString(uint256(0), naAccount, bIndex, strIdent, iIndex); + Json::Value jCurrent = accountFromString(uint256(0), raAccount, bIndex, strIdent, iIndex); - ret["current"] = jCurrent.empty() ? mNetOps->getOwnerInfo(uint256(0), naAccount) : jCurrent; + ret["current"] = jCurrent.empty() ? mNetOps->getOwnerInfo(uint256(0), raAccount) : jCurrent; return ret; } @@ -2216,8 +2222,8 @@ Json::Value RPCHandler::doCommand(Json::Value& jvParams, int iRole) { "ledger_header", &RPCHandler::doLedgerHeader, -1, -1, false, false, optCurrent }, { "log_level", &RPCHandler::doLogLevel, 0, 2, true, false, optNone }, { "logrotate", &RPCHandler::doLogRotate, -1, -1, true, false, optNone }, - { "nickname_info", &RPCHandler::doNicknameInfo, 1, 1, false, false, optCurrent }, - { "owner_info", &RPCHandler::doOwnerInfo, 1, 2, false, false, optCurrent }, +// { "nickname_info", &RPCHandler::doNicknameInfo, 1, 1, false, false, optCurrent }, + { "owner_info", &RPCHandler::doOwnerInfo, -1, -1, false, false, optCurrent }, { "peers", &RPCHandler::doPeers, -1, -1, true, false, optNone }, { "profile", &RPCHandler::doProfile, 1, 9, false, false, optCurrent }, { "ripple_lines_get", &RPCHandler::doRippleLinesGet, -1, -1, false, false, optCurrent },