15bool ParseHDKeypath(
const std::string& keypath_str, std::vector<uint32_t>& keypath)
17 std::stringstream ss(keypath_str);
20 while (std::getline(ss, item,
'/')) {
21 if (item.compare(
"m") == 0) {
30 size_t pos = item.find(
'\'');
31 if (pos != std::string::npos) {
33 if (pos != item.size() - 1) {
37 item = item.substr(0, item.size() - 1);
41 const auto number{ToIntegral<uint32_t>(item)};
47 keypath.push_back(path);
58 if (i >> 31)
ret += apostrophe ?
'\'' :
'h';
63std::string
WriteHDKeypath(
const std::vector<uint32_t>& keypath,
bool apostrophe)
bool ParseHDKeypath(const std::string &keypath_str, std::vector< uint32_t > &keypath)
Parse an HD keypaths like "m/7/0'/2000".
std::string FormatHDKeypath(const std::vector< uint32_t > &path, bool apostrophe)
std::string WriteHDKeypath(const std::vector< uint32_t > &keypath, bool apostrophe)
Write HD keypaths as strings.