Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- std::cout << "TurtleCoin v" << PROJECT_VERSION << " Simplewallet" << std::endl;
- Action action = getAction();
- auto wallet = init();
- std::cout << "3" << std::endl;
- std::shared_ptr<WalletInfo> walletInfo(nullptr);
- if (action == Generate)
- {
- walletInfo = generateWallet(wallet);
- }
- else if (action == Open)
- {
- walletInfo = openWallet(wallet);
- }
- else if (action == Import)
- {
- walletInfo = importWallet(wallet);
- }
- else if (action == SeedImport)
- {
- walletInfo = mnemonicImportWallet(wallet);
- }
- welcomeMsg();
- inputLoop(walletInfo);
- std::cout << "Bye." << std::endl;
- }
- std::shared_ptr<CryptoNote::WalletGreen> init()
- {
- /* We need to pass in a logger, but we don't want to print out all the
- crap to the console that walletgreen does. So, we just never init this
- properly and it just gets logged to the void. */
- Logging::LoggerManager logManager;
- Logging::ConsoleLogger consoleLogger;
- /* Actually right now we have it enabled for debugging. But we'll disable
- it later.
- >10 years later still enabled */
- logManager.setMaxLevel(Logging::INFO);
- logManager.addLogger(consoleLogger);
- Logging::LoggerRef logger(logManager, "simplewallet");
- CryptoNote::Currency currency = CryptoNote::CurrencyBuilder(logManager).currency();
- /* Hard coded for now. Arguments might come later. This lets us talk
- to good old turtlecoind. */
- CryptoNote::NodeRpcProxy node("localhost", 11898, logger.getLogger());
- /* Wow c++ great syntax you've got here LMAO */
- std::promise<std::error_code> errorPromise;
- std::future<std::error_code> error = errorPromise.get_future();
- auto callback = [&errorPromise](std::error_code e) {errorPromise.set_value(e); };
- node.init(callback);
- if (error.get())
- {
- throw("Shit's fucking fucked big time mate");
- }
- /* I actually have no idea what the fuck this does */
- System::Dispatcher dispatcher;
- std::cout << "1" << std::endl;
- auto walletPtr = std::make_shared<CryptoNote::WalletGreen>(dispatcher, currency, node, logger.getLogger());
- std::cout << "2" << std::endl;
- return walletPtr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement