mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 21:15:58 +00:00
Helper functions.
This commit is contained in:
17
Wallet.cpp
17
Wallet.cpp
@@ -294,6 +294,23 @@ CKey::pointer LocalAccount::getPrivateKey()
|
|||||||
return la->getPrivKey();
|
return la->getPrivKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wallet::getFamilies(std::vector<uint160>& familyIDs)
|
||||||
|
{
|
||||||
|
familyIDs.reserve(families.size());
|
||||||
|
for(std::map<uint160, LocalAccountFamily::pointer>::iterator fit=families.begin(); fit!=families.end(); ++fit)
|
||||||
|
familyIDs.push_back(fit->first);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Wallet::getFamilyInfo(const uint160& family, std::string& name, std::string& comment)
|
||||||
|
{
|
||||||
|
std::map<uint160, LocalAccountFamily::pointer>::iterator fit=families.find(family);
|
||||||
|
if(fit==families.end()) return false;
|
||||||
|
assert(fit->second->getFamily()==family);
|
||||||
|
name=fit->second->getShortName();
|
||||||
|
comment=fit->second->getComment();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Wallet::load()
|
void Wallet::load()
|
||||||
{
|
{
|
||||||
std::string sql("SELECT * FROM LocalAcctFamilies");
|
std::string sql("SELECT * FROM LocalAcctFamilies");
|
||||||
|
|||||||
4
Wallet.h
4
Wallet.h
@@ -94,6 +94,7 @@ public:
|
|||||||
|
|
||||||
std::string getPubKeyHex() const; // The text name of the public key
|
std::string getPubKeyHex() const; // The text name of the public key
|
||||||
std::string getShortName() const { return mName; }
|
std::string getShortName() const { return mName; }
|
||||||
|
std::string getComment() const { return mComment; }
|
||||||
|
|
||||||
static std::string getSQLFields();
|
static std::string getSQLFields();
|
||||||
std::string getSQL() const;
|
std::string getSQL() const;
|
||||||
@@ -154,6 +155,8 @@ public:
|
|||||||
|
|
||||||
void delFamily(const uint160& familyName);
|
void delFamily(const uint160& familyName);
|
||||||
|
|
||||||
|
void getFamilies(std::vector<uint160>& familyIDs);
|
||||||
|
|
||||||
uint160 unlock(const uint256& passPhrase);
|
uint160 unlock(const uint256& passPhrase);
|
||||||
bool lock(const uint160& familyName);
|
bool lock(const uint160& familyName);
|
||||||
|
|
||||||
@@ -163,6 +166,7 @@ public:
|
|||||||
LocalAccount::pointer getLocalAccount(const uint160& acctID);
|
LocalAccount::pointer getLocalAccount(const uint160& acctID);
|
||||||
std::string getPubKeyHex(const uint160& famBase);
|
std::string getPubKeyHex(const uint160& famBase);
|
||||||
std::string getShortName(const uint160& famBase);
|
std::string getShortName(const uint160& famBase);
|
||||||
|
bool getFamilyInfo(const uint160& family, std::string& name, std::string& comment);
|
||||||
|
|
||||||
static bool unitTest();
|
static bool unitTest();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user