From 9121cfd567665fab1ff4f66f5cb08398357e76da Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 7 Mar 2013 03:39:17 -0800 Subject: [PATCH] Change RPCs to use account instead of ident. --- src/cpp/ripple/RPCHandler.cpp | 10 +++++----- src/js/remote.js | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 28b54a3220..412853584c 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -559,7 +559,7 @@ Json::Value RPCHandler::accountFromString(Ledger::ref lrLedger, RippleAddress& n } // { -// ident : , +// account: , // account_index : // optional // strict: // true, only allow public keys and addresses. false, default. // ledger_hash : @@ -573,10 +573,10 @@ Json::Value RPCHandler::doAccountInfo(Json::Value jvRequest) if (!lpLedger) return jvResult; - if (!jvRequest.isMember("ident")) + if (!jvRequest.isMember("account") && !jvRequest.isMember("ident")) return rpcError(rpcINVALID_PARAMS); - std::string strIdent = jvRequest["ident"].asString(); + std::string strIdent = jvRequest.isMember("account") ? jvRequest["account"].asString() : jvRequest["ident"].asString(); bool bIndex; int iIndex = jvRequest.isMember("account_index") ? jvRequest["account_index"].asUInt() : 0; bool bStrict = jvRequest.isMember("strict") && jvRequest["strict"].asBool(); @@ -742,10 +742,10 @@ Json::Value RPCHandler::doNicknameInfo(Json::Value params) // XXX This would be better if it took the ledger. Json::Value RPCHandler::doOwnerInfo(Json::Value jvRequest) { - if (!jvRequest.isMember("ident")) + if (!jvRequest.isMember("account") && !jvRequest.isMember("ident")) return rpcError(rpcINVALID_PARAMS); - std::string strIdent = jvRequest["ident"].asString(); + std::string strIdent = jvRequest.isMember("account") ? jvRequest["account"].asString() : jvRequest["ident"].asString(); bool bIndex; int iIndex = jvRequest.isMember("account_index") ? jvRequest["account_index"].asUInt() : 0; RippleAddress raAccount; diff --git a/src/js/remote.js b/src/js/remote.js index 75622411ab..2ce9d15dae 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -890,7 +890,8 @@ Remote.prototype.request_tx = function (hash) { Remote.prototype.request_account_info = function (accountID) { var request = new Request(this, 'account_info'); - request.message.ident = UInt160.json_rewrite(accountID); + request.message.ident = UInt160.json_rewrite(accountID); // DEPRECATED + request.message.account = UInt160.json_rewrite(accountID); return request; };