Make ripple_path_find work for command line.

This commit is contained in:
Arthur Britto
2013-01-13 21:11:37 -08:00
parent 87ecbdf653
commit a12a566139
3 changed files with 30 additions and 15 deletions

View File

@@ -270,6 +270,20 @@ Json::Value RPCParser::parseAccountItems(const Json::Value& jvParams)
return jvRequest; return jvRequest;
} }
// ripple_path_find json
Json::Value RPCParser::parseRipplePathFind(const Json::Value& jvParams)
{
Json::Value txJSON;
Json::Reader reader;
cLog(lsTRACE) << "RPC json:" << jvParams[0u];
if (reader.parse(jvParams[0u].asString(), txJSON))
{
return txJSON;
}
return rpcError(rpcINVALID_PARAMS);
}
// submit any transaction to the network // submit any transaction to the network
// submit private_key json // submit private_key json
@@ -444,7 +458,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
{ "peers", &RPCParser::parseAsIs, 0, 0 }, { "peers", &RPCParser::parseAsIs, 0, 0 },
// { "profile", &RPCParser::parseProfile, 1, 9 }, // { "profile", &RPCParser::parseProfile, 1, 9 },
{ "random", &RPCParser::parseAsIs, 0, 0 }, { "random", &RPCParser::parseAsIs, 0, 0 },
// { "ripple_path_find", &RPCParser::parseRipplePathFind, -1, -1 }, { "ripple_path_find", &RPCParser::parseRipplePathFind, 1, 1 },
{ "submit", &RPCParser::parseSubmit, 2, 2 }, { "submit", &RPCParser::parseSubmit, 2, 2 },
{ "server_info", &RPCParser::parseAsIs, 0, 0 }, { "server_info", &RPCParser::parseAsIs, 0, 0 },
{ "stop", &RPCParser::parseAsIs, 0, 0 }, { "stop", &RPCParser::parseAsIs, 0, 0 },

View File

@@ -29,6 +29,7 @@ protected:
Json::Value parseLogLevel(const Json::Value& jvParams); Json::Value parseLogLevel(const Json::Value& jvParams);
Json::Value parseOwnerInfo(const Json::Value& jvParams); Json::Value parseOwnerInfo(const Json::Value& jvParams);
Json::Value parseRandom(const Json::Value& jvParams); Json::Value parseRandom(const Json::Value& jvParams);
Json::Value parseRipplePathFind(const Json::Value& jvParams);
Json::Value parseSubmit(const Json::Value& jvParams); Json::Value parseSubmit(const Json::Value& jvParams);
Json::Value parseTx(const Json::Value& jvParams); Json::Value parseTx(const Json::Value& jvParams);
Json::Value parseTxHistory(const Json::Value& jvParams); Json::Value parseTxHistory(const Json::Value& jvParams);

View File

@@ -725,23 +725,23 @@ Json::Value RPCHandler::doRipplePathFind(Json::Value jvRequest)
RippleAddress raDst; RippleAddress raDst;
STAmount saDstAmount; STAmount saDstAmount;
if ( if (!jvRequest.isMember("source_account"))
// Parse raSrc.
!jvRequest.isMember("source_account")
|| !jvRequest["source_account"].isString()
|| !raSrc.setAccountID(jvRequest["source_account"].asString()))
{ {
cLog(lsINFO) << "Bad source_account."; jvResult = rpcError(rpcSRC_ACT_MISSING);
jvResult = rpcError(rpcINVALID_PARAMS);
} }
else if ( else if (!jvRequest["source_account"].isString()
// Parse raDst. || !raSrc.setAccountID(jvRequest["source_account"].asString()))
!jvRequest.isMember("destination_account")
|| !jvRequest["destination_account"].isString()
|| !raDst.setAccountID(jvRequest["destination_account"].asString()))
{ {
cLog(lsINFO) << "Bad destination_account."; jvResult = rpcError(rpcSRC_ACT_MALFORMED);
jvResult = rpcError(rpcINVALID_PARAMS); }
else if (!jvRequest.isMember("destination_account"))
{
jvResult = rpcError(rpcDST_ACT_MISSING);
}
else if (!jvRequest["destination_account"].isString()
|| !raDst.setAccountID(jvRequest["destination_account"].asString()))
{
jvResult = rpcError(rpcDST_ACT_MALFORMED);
} }
else if ( else if (
// Parse saDstAmount. // Parse saDstAmount.