diff --git a/src/RPCServer.cpp b/src/RPCServer.cpp index f6bc477ab..9ea2d9805 100644 --- a/src/RPCServer.cpp +++ b/src/RPCServer.cpp @@ -597,13 +597,39 @@ Json::Value RPCServer::doValidatorCreate(Json::Value& params) { Json::Value obj(Json::objectValue); - obj["validation_public_key"] = nodePublicKey.humanNodePublic().c_str(); - obj["validation_seed"] = familySeed.humanFamilySeed().c_str(); - obj["validation_key"] = familySeed.humanFamilySeed1751().c_str(); + obj["validation_public_key"] = nodePublicKey.humanNodePublic(); + obj["validation_seed"] = familySeed.humanFamilySeed(); + obj["validation_key"] = familySeed.humanFamilySeed1751(); return obj; } +// wallet_propose +Json::Value RPCServer::doWalletPropose(Json::Value& params) { + if(params.size()) + { + return "invalid params"; + } + else + { + NewcoinAddress naSeed; + NewcoinAddress naGenerator; + NewcoinAddress naAccount; + + naSeed.setFamilySeedRandom(); + naGenerator.setFamilyGenerator(naSeed); + naAccount.setAccountPublic(naGenerator, 0); + + Json::Value obj(Json::objectValue); + + obj["master_seed"] = naSeed.humanFamilySeed(); + obj["master_key"] = naSeed.humanFamilySeed1751(); + obj["account_id"] = naAccount.humanAccountID(); + + return obj; + } +} + void RPCServer::validatorsResponse(const boost::system::error_code& err, std::string strResponse) { std::cerr << "Fetch '" VALIDATORS_FILE_NAME "' complete." << std::endl; @@ -740,6 +766,8 @@ Json::Value RPCServer::doCommand(const std::string& command, Json::Value& params if(command=="validation_create") return doValidatorCreate(params); + if(command=="wallet_propose") return doWalletPropose(params); + if(command=="createfamily") return doCreateFamily(params); if(command=="familyinfo") return doFamilyInfo(params); if(command=="accountinfo") return doAccountInfo(params); diff --git a/src/RPCServer.h b/src/RPCServer.h index 0942b1978..14290113a 100644 --- a/src/RPCServer.h +++ b/src/RPCServer.h @@ -56,6 +56,8 @@ class RPCServer : public boost::enable_shared_from_this Json::Value doValidatorCreate(Json::Value& params); + Json::Value doWalletPropose(Json::Value& params); + // Parses a string account name into a local or remote NewcoinAddress. NewcoinAddress parseAccount(const std::string& account); void validatorsResponse(const boost::system::error_code& err, std::string strResponse);