mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Refactor RPC wallet_propose.
This commit is contained in:
@@ -239,6 +239,17 @@ Json::Value RPCParser::parseWalletAccounts(const Json::Value& jvParams)
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
// wallet_propose [<passphrase>]
|
||||
// <passphrase> is only for testing. Master seeds should only be generated randomly.
|
||||
Json::Value RPCParser::parseWalletPropose(const Json::Value& jvParams)
|
||||
{
|
||||
Json::Value jvRequest;
|
||||
|
||||
jvRequest["passphrase"] = jvParams[0u].asString();
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
//
|
||||
// parseCommand
|
||||
//
|
||||
@@ -300,7 +311,7 @@ Json::Value RPCParser::parseCommand(std::string strMethod, Json::Value jvParams)
|
||||
// { "validation_seed", &RPCParser::doValidationSeed, 0, 1, false, false, optNone },
|
||||
|
||||
{ "wallet_accounts", &RPCParser::parseWalletAccounts, 1, 1 },
|
||||
// { "wallet_propose", &RPCParser::doWalletPropose, 0, 1, false, false, optNone },
|
||||
{ "wallet_propose", &RPCParser::parseWalletPropose, 0, 1 },
|
||||
// { "wallet_seed", &RPCParser::doWalletSeed, 0, 1, false, false, optNone },
|
||||
//
|
||||
// { "login", &RPCParser::doLogin, 2, 2, true, false, optNone },
|
||||
|
||||
@@ -11,17 +11,18 @@ class RPCParser
|
||||
protected:
|
||||
typedef Json::Value (RPCParser::*parseFuncPtr)(const Json::Value &jvParams);
|
||||
|
||||
Json::Value parseAsIs(const Json::Value& jvParams);
|
||||
Json::Value parseAccountInfo(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);
|
||||
Json::Value parseEvented(const Json::Value& jvParams);
|
||||
Json::Value parseLedger(const Json::Value& jvParams);
|
||||
Json::Value parseWalletAccounts(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);
|
||||
Json::Value parseUnlDelete(const Json::Value& jvParams);
|
||||
Json::Value parseWalletAccounts(const Json::Value& jvParams);
|
||||
Json::Value parseWalletPropose(const Json::Value& jvParams);
|
||||
|
||||
public:
|
||||
Json::Value parseCommand(std::string strMethod, Json::Value jvParams);
|
||||
|
||||
@@ -1372,20 +1372,21 @@ Json::Value RPCHandler::doLogRotate(Json::Value)
|
||||
return Log::rotateLog();
|
||||
}
|
||||
|
||||
// wallet_propose [<passphrase>]
|
||||
// <passphrase> is only for testing. Master seeds should only be generated randomly.
|
||||
Json::Value RPCHandler::doWalletPropose(Json::Value params)
|
||||
// {
|
||||
// passphrase: <string>
|
||||
// }
|
||||
Json::Value RPCHandler::doWalletPropose(Json::Value jvRequest)
|
||||
{
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naAccount;
|
||||
|
||||
if (params.empty())
|
||||
if (jvRequest.isMember("passphrase"))
|
||||
{
|
||||
naSeed.setSeedRandom();
|
||||
naSeed = RippleAddress::createSeedGeneric(jvRequest["passphrase"].asString());
|
||||
}
|
||||
else
|
||||
{
|
||||
naSeed = RippleAddress::createSeedGeneric(params[0u].asString());
|
||||
naSeed.setSeedRandom();
|
||||
}
|
||||
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naSeed);
|
||||
@@ -2219,7 +2220,7 @@ Json::Value RPCHandler::doCommand(Json::Value& jvParams, int iRole)
|
||||
{ "validation_seed", &RPCHandler::doValidationSeed, 0, 1, false, false, optNone },
|
||||
|
||||
{ "wallet_accounts", &RPCHandler::doWalletAccounts, -1, -1, false, false, optCurrent },
|
||||
{ "wallet_propose", &RPCHandler::doWalletPropose, 0, 1, false, false, optNone },
|
||||
{ "wallet_propose", &RPCHandler::doWalletPropose, -1, -1, false, false, optNone },
|
||||
{ "wallet_seed", &RPCHandler::doWalletSeed, 0, 1, false, false, optNone },
|
||||
|
||||
{ "login", &RPCHandler::doLogin, 2, 2, true, false, optNone },
|
||||
|
||||
Reference in New Issue
Block a user