mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-28 15:05:53 +00:00
Refactor RPC tx.
This commit is contained in:
@@ -257,6 +257,15 @@ Json::Value RPCParser::parseSubmit(const Json::Value& jvParams)
|
||||
return rpcError(rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
// tx <transaction_id>
|
||||
Json::Value RPCParser::parseTx(const Json::Value& jvParams)
|
||||
{
|
||||
Json::Value jvRequest;
|
||||
|
||||
jvRequest["transaction"] = jvParams[0u].asString();
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
// unl_add <domain>|<node_public> [<comment>]
|
||||
Json::Value RPCParser::parseUnlAdd(const Json::Value& jvParams)
|
||||
{
|
||||
@@ -387,15 +396,15 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
|
||||
// { "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 },
|
||||
// { "profile", &RPCParser::parseProfile, 1, 9 },
|
||||
{ "ripple_lines_get", &RPCParser::parseRippleLinesGet, 1, 2 },
|
||||
// { "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 },
|
||||
// { "tx", &RPCParser::parseTx, 1, 1, true, false, optNone },
|
||||
// { "tx_history", &RPCParser::parseTxHistory, 1, 1, false, false, optNone },
|
||||
{ "tx", &RPCParser::parseTx, 1, 1 },
|
||||
// { "tx_history", &RPCParser::parseTxHistory, 1, 1 },
|
||||
//
|
||||
{ "unl_add", &RPCParser::parseUnlAdd, 1, 2 },
|
||||
{ "unl_delete", &RPCParser::parseUnlDelete, 1, 1 },
|
||||
|
||||
@@ -25,6 +25,7 @@ protected:
|
||||
Json::Value parseOwnerInfo(const Json::Value& jvParams);
|
||||
Json::Value parseRippleLinesGet(const Json::Value& jvParams);
|
||||
Json::Value parseSubmit(const Json::Value& jvParams);
|
||||
Json::Value parseTx(const Json::Value& jvParams);
|
||||
Json::Value parseUnlAdd(const Json::Value& jvParams);
|
||||
Json::Value parseUnlDelete(const Json::Value& jvParams);
|
||||
Json::Value parseValidationCreate(const Json::Value& jvParams);
|
||||
|
||||
@@ -514,7 +514,7 @@ Json::Value RPCHandler::doProfile(Json::Value params)
|
||||
|
||||
boost::posix_time::ptime ptStart(boost::posix_time::microsec_clock::local_time());
|
||||
|
||||
for(unsigned int n=0; n<iCount; n++)
|
||||
for(unsigned int n=0; n<iCount; n++)
|
||||
{
|
||||
RippleAddress naMasterGeneratorA;
|
||||
RippleAddress naAccountPublicA;
|
||||
@@ -1102,21 +1102,17 @@ Json::Value RPCHandler::doTxHistory(Json::Value params)
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::doTx(Json::Value params)
|
||||
// {
|
||||
// transaction: <hex>
|
||||
// }
|
||||
Json::Value RPCHandler::doTx(Json::Value jvRequest)
|
||||
{
|
||||
// tx <txID>
|
||||
// tx <account>
|
||||
std::string strTransaction = jvRequest["transaction"].asString();
|
||||
|
||||
std::string param1, param2;
|
||||
if (!extractString(param1, params, 0))
|
||||
{
|
||||
return rpcError(rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
if (Transaction::isHexTxID(param1))
|
||||
if (Transaction::isHexTxID(strTransaction))
|
||||
{ // transaction by ID
|
||||
Json::Value ret;
|
||||
uint256 txid(param1);
|
||||
uint256 txid(strTransaction);
|
||||
|
||||
Transaction::pointer txn = theApp->getMasterTransaction().fetch(txid, true);
|
||||
|
||||
@@ -2211,8 +2207,8 @@ Json::Value RPCHandler::doCommand(Json::Value& jvParams, int iRole)
|
||||
// Request-response methods
|
||||
{ "accept_ledger", &RPCHandler::doAcceptLedger, -1, -1, true, false, optCurrent },
|
||||
{ "account_info", &RPCHandler::doAccountInfo, -1, -1, false, false, optCurrent },
|
||||
{ "account_tx", &RPCHandler::doAccountTransactions, -1, -1, false, false, optNetwork },
|
||||
{ "connect", &RPCHandler::doConnect, 1, 2, true, false, optNone },
|
||||
{ "account_tx", &RPCHandler::doAccountTransactions,-1, -1, false, false, optNetwork },
|
||||
{ "connect", &RPCHandler::doConnect, -1, -1, true, false, optNone },
|
||||
{ "get_counts", &RPCHandler::doGetCounts, -1, -1, true, false, optNone },
|
||||
{ "ledger", &RPCHandler::doLedger, -1, -1, false, false, optNetwork },
|
||||
{ "ledger_accept", &RPCHandler::doLedgerAccept, -1, -1, true, false, optCurrent },
|
||||
@@ -2225,14 +2221,14 @@ Json::Value RPCHandler::doCommand(Json::Value& jvParams, int iRole)
|
||||
// { "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 },
|
||||
// { "profile", &RPCHandler::doProfile, -1, -1, false, false, optCurrent },
|
||||
{ "ripple_lines_get", &RPCHandler::doRippleLinesGet, -1, -1, false, false, optCurrent },
|
||||
{ "ripple_path_find", &RPCHandler::doRipplePathFind, -1, -1, false, false, optCurrent },
|
||||
{ "submit", &RPCHandler::doSubmit, -1, -1, false, false, optCurrent },
|
||||
{ "submit", &RPCHandler::doSubmit, -1, -1, false, false, optCurrent },
|
||||
{ "server_info", &RPCHandler::doServerInfo, -1, -1, true, false, optNone },
|
||||
{ "stop", &RPCHandler::doStop, -1, -1, true, false, optNone },
|
||||
{ "transaction_entry", &RPCHandler::doTransactionEntry, -1, -1, false, false, optCurrent },
|
||||
{ "tx", &RPCHandler::doTx, 1, 1, true, false, optNone },
|
||||
{ "transaction_entry", &RPCHandler::doTransactionEntry, -1, -1, false, false, optCurrent },
|
||||
{ "tx", &RPCHandler::doTx, -1, -1, true, false, optNone },
|
||||
{ "tx_history", &RPCHandler::doTxHistory, 1, 1, false, false, optNone },
|
||||
|
||||
{ "unl_add", &RPCHandler::doUnlAdd, -1, -1, true, false, optNone },
|
||||
|
||||
Reference in New Issue
Block a user