mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Implement RPC wallet propose.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user