1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-keygen synced 2026-06-18 04:00:03 +02:00

cli/src/cli_key_search_result: Add prefix parameter to constructor.

This commit is contained in:
Henrik Hautakoski 2021-05-06 16:45:59 +02:00
parent 554cfd5884
commit 52e255850a
2 changed files with 9 additions and 4 deletions

View file

@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <string>
#include <iostream>
#include <libeosio/WIF.hpp>
#include <eoskeygen/core/dictionary.hpp>
@ -37,8 +38,9 @@ static size_t highlight(console::Color color, const std::string& str, size_t pos
return len;
}
CliKeySearchResult::CliKeySearchResult(const Dictionary& dict) :
m_dict (dict)
CliKeySearchResult::CliKeySearchResult(const Dictionary& dict, const std::string& prefix) :
m_dict (dict),
m_prefix (prefix)
{
}
@ -50,7 +52,7 @@ void CliKeySearchResult::onResult(const struct libeosio::ec_keypair* key, const
std::cout << "----" << std::endl;
std::cout << "Found: " << pub.substr(result.pos, result.len) << std::endl;
std::cout << "Public: EOS";
std::cout << "Public: " << m_prefix.substr(0, 3);
for(size_t i = 3; i < pub.length(); ) {
if (i == result.pos) {

View file

@ -24,6 +24,7 @@
#ifndef EOSIOKEYGEN_KEY_SEARCH_HELPERS_H
#define EOSIOKEYGEN_KEY_SEARCH_HELPERS_H
#include <string>
#include <libeosio/types.hpp>
#include <eoskeygen/core/string.hpp>
#include <eoskeygen/key_search.hpp>
@ -36,13 +37,15 @@ class Dictionary;
class CliKeySearchResult : public IKeySearchResult
{
public:
CliKeySearchResult(const Dictionary& dict);
CliKeySearchResult(const Dictionary& dict, const std::string& prefix);
virtual void onResult(const struct libeosio::ec_keypair* key, const struct KeySearch::result& result);
protected :
const Dictionary& m_dict;
std::string m_prefix;
};
} // namespace eoskeygen