1
0
Fork 0
forked from lthn/blockchain

added address field to get_seed_phrase_info

This commit is contained in:
cryptozoidberg 2024-04-27 23:26:32 +04:00
parent db4b841f57
commit d718d876fc
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
2 changed files with 26 additions and 5 deletions

View file

@ -38,21 +38,40 @@ namespace tools
result.hash_sum_matched = false;
result.syntax_correct = acc.restore_from_tracking_seed(seed_phrase);
if (result.syntax_correct)
{
result.tracking = true;
result.address = acc.get_public_address_str();
}
}
else
{
result.syntax_correct = currency::account_base::is_seed_password_protected(seed_phrase, result.require_password);
if (result.syntax_correct && result.require_password)
if (result.syntax_correct )
{
if (seed_password.size())
if (result.require_password)
{
currency::account_base acc;
result.hash_sum_matched = acc.restore_from_seed_phrase(seed_phrase, seed_password);
if (seed_password.size())
{
currency::account_base acc;
result.hash_sum_matched = acc.restore_from_seed_phrase(seed_phrase, seed_password);
if (result.hash_sum_matched)
{
result.address = acc.get_public_address_str();
}
}
else
{
result.hash_sum_matched = false;
}
}
else
{
result.hash_sum_matched = false;
currency::account_base acc;
result.syntax_correct = acc.restore_from_seed_phrase(seed_phrase, "");
if (result.syntax_correct)
{
result.address = acc.get_public_address_str();
}
}
}
}

View file

@ -381,12 +381,14 @@ namespace wallet_public
bool require_password;
bool hash_sum_matched;
bool tracking;
std::string address;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(syntax_correct) DOC_DSCR("Indicates whether the syntax is correct.") DOC_EXMP(true) DOC_END
KV_SERIALIZE(require_password) DOC_DSCR("Indicates whether a password is required.") DOC_EXMP(true) DOC_END
KV_SERIALIZE(hash_sum_matched) DOC_DSCR("Indicates whether the hash sum matches.") DOC_EXMP(true) DOC_END
KV_SERIALIZE(tracking) DOC_DSCR("Indicates whether tracking is enabled.") DOC_EXMP(false) DOC_END
KV_SERIALIZE(address) DOC_DSCR("Return address of the seed phrase.") DOC_EXMP("ZxDNaMeZjwCjnHuU5gUNyrP1pM3U5vckbakzzV6dEHyDYeCpW8XGLBFTshcaY8LkG9RQn7FsQx8w2JeJzJwPwuDm2NfixPAXf") DOC_END
END_KV_SERIALIZE_MAP()
};