Implement RPC wallet propose.

This commit is contained in:
Arthur Britto
2012-05-12 20:52:38 -07:00
parent e0cb27f1c1
commit 608ca11085
2 changed files with 33 additions and 3 deletions

View File

@@ -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);

View File

@@ -56,6 +56,8 @@ class RPCServer : public boost::enable_shared_from_this<RPCServer>
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);