MCPcopy Create free account
hub / github.com/LUX-Core/lux / execute

Method execute

src/cpp-ethereum/eth/AccountManager.cpp:46–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46bool AccountManager::execute(int argc, char** argv)
47{
48 if (string(argv[1]) == "wallet")
49 {
50 if (3 < argc && string(argv[2]) == "import")
51 {
52 if (!openWallet())
53 return false;
54 string file = argv[3];
55 string name = "presale wallet";
56 string pw;
57 try
58 {
59 KeyPair k = m_keyManager->presaleSecret(
60 contentsString(file),
61 [&](bool){ return (pw = getPassword("Enter the passphrase for the presale key: "));}
62 );
63 m_keyManager->import(k.secret(), name, pw, "Same passphrase as used for presale key");
64 cout << " Address: {" << k.address().hex() << "}" << endl;
65 }
66 catch (Exception const& _e)
67 {
68 if (auto err = boost::get_error_info<errinfo_comment>(_e))
69 cout << " Decryption failed: " << *err << endl;
70 else
71 cout << " Decryption failed: Unknown reason." << endl;
72 return false;
73 }
74 }
75 else
76 streamWalletHelp(cout);
77 return true;
78 }
79 else if (string(argv[1]) == "account")
80 {
81 if (argc < 3 || string(argv[2]) == "list")
82 {
83 openWallet();
84 if (m_keyManager->store().keys().empty())
85 cout << "No keys found." << endl;
86 else
87 {
88 vector<u128> bare;
89 AddressHash got;
90 int k = 0;
91 for (auto const& u: m_keyManager->store().keys())
92 {
93 if (Address a = m_keyManager->address(u))
94 {
95 got.insert(a);
96 cout << "Account #" << k << ": {" << a.hex() << "}" << endl;
97 k++;
98 }
99 else
100 bare.push_back(u);
101 }
102 for (auto const& a: m_keyManager->accounts())
103 if (!got.count(a))

Callers 3

mainFunction · 0.45
main.cppFile · 0.45
mainFunction · 0.45

Calls 15

createPasswordFunction · 0.85
ICAPClass · 0.85
presaleSecretMethod · 0.80
hexMethod · 0.80
accountsMethod · 0.80
encodedMethod · 0.80
importKeyMethod · 0.80
importMethod · 0.45
secretMethod · 0.45
addressMethod · 0.45
emptyMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected