Merge pull request #530

0198306 Stop displaying internal commands for --help (luigi1111)
189d516 simplewallet help & error cleanup (luigi1111)
This commit is contained in:
Riccardo Spagni 2015-12-13 21:52:27 +02:00
commit 281c1c1639
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -80,18 +80,18 @@ namespace
{
const command_line::arg_descriptor<std::string> arg_wallet_file = {"wallet-file", sw::tr("Use wallet <arg>"), ""};
const command_line::arg_descriptor<std::string> arg_generate_new_wallet = {"generate-new-wallet", sw::tr("Generate new wallet and save it to <arg> or <address>.wallet by default"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_view_key = {"generate-from-view-key", sw::tr("Generate wallet from (address:viewkey:filename) and save it to <filename>"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_view_key = {"generate-from-view-key", sw::tr("Generate incoming-only wallet from (address:viewkey:filename) and save it to <filename>"), ""};
const command_line::arg_descriptor<std::string> arg_daemon_address = {"daemon-address", sw::tr("Use daemon instance at <host>:<port>"), ""};
const command_line::arg_descriptor<std::string> arg_daemon_host = {"daemon-host", sw::tr("Use daemon instance at host <arg> instead of localhost"), ""};
const command_line::arg_descriptor<std::string> arg_password = {"password", sw::tr("Wallet password"), "", true};
const command_line::arg_descriptor<std::string> arg_electrum_seed = {"electrum-seed", sw::tr("Specify electrum seed for wallet recovery/creation"), ""};
const command_line::arg_descriptor<bool> arg_restore_deterministic_wallet = {"restore-deterministic-wallet", sw::tr("Recover wallet using electrum-style mnemonic"), false};
const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", sw::tr("creates non-deterministic view and spend keys"), false};
const command_line::arg_descriptor<int> arg_daemon_port = {"daemon-port", sw::tr("Use daemon instance at port <arg> instead of 8081"), 0};
const command_line::arg_descriptor<std::string> arg_electrum_seed = {"electrum-seed", sw::tr("Specify Electrum seed for wallet recovery/creation"), ""};
const command_line::arg_descriptor<bool> arg_restore_deterministic_wallet = {"restore-deterministic-wallet", sw::tr("Recover wallet using Electrum-style mnemonic seed"), false};
const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", sw::tr("Create non-deterministic view and spend keys"), false};
const command_line::arg_descriptor<int> arg_daemon_port = {"daemon-port", sw::tr("Use daemon instance at port <arg> instead of 18081"), 0};
const command_line::arg_descriptor<uint32_t> arg_log_level = {"log-level", "", LOG_LEVEL_0};
const command_line::arg_descriptor<std::string> arg_log_file = {"log-file", sw::tr("Specify log file"), ""};
const command_line::arg_descriptor<bool> arg_testnet = {"testnet", sw::tr("Used to deploy test nets. The daemon must be launched with --testnet flag"), false};
const command_line::arg_descriptor<bool> arg_restricted = {"restricted-rpc", sw::tr("Restricts RPC to view only commands"), false};
const command_line::arg_descriptor<bool> arg_testnet = {"testnet", sw::tr("For testnet. Daemon must also be launched with --testnet flag"), false};
const command_line::arg_descriptor<bool> arg_restricted = {"restricted-rpc", sw::tr("Restricts RPC to view-only commands"), false};
const command_line::arg_descriptor<bool> arg_trusted_daemon = {"trusted-daemon", sw::tr("Enable commands which rely on a trusted daemon"), false};
const command_line::arg_descriptor< std::vector<std::string> > arg_command = {"command", ""};
@ -103,7 +103,7 @@ namespace
{
if (status == CORE_RPC_STATUS_BUSY)
{
err = sw::tr("daemon is busy. Please try later");
err = sw::tr("daemon is busy. Please try again later.");
}
else if (status != CORE_RPC_STATUS_OK)
{
@ -112,7 +112,7 @@ namespace
}
else
{
err = sw::tr("possible lost connection to daemon");
err = sw::tr("possibly lost connection to daemon");
}
return err;
}
@ -246,7 +246,7 @@ bool simple_wallet::seed(const std::vector<std::string> &args/* = std::vector<st
if (m_wallet->watch_only())
{
fail_msg_writer() << tr("This wallet is watch-only and cannot have a seed.");
fail_msg_writer() << tr("wallet is watch-only and has no seed");
return true;
}
if (m_wallet->is_deterministic())
@ -266,7 +266,7 @@ bool simple_wallet::seed(const std::vector<std::string> &args/* = std::vector<st
}
else
{
fail_msg_writer() << tr("The wallet is non-deterministic. Cannot display seed.");
fail_msg_writer() << tr("wallet is non-deterministic and has no seed");
}
return true;
}
@ -276,12 +276,12 @@ bool simple_wallet::seed_set_language(const std::vector<std::string> &args/* = s
bool success = false;
if (m_wallet->watch_only())
{
fail_msg_writer() << tr("This wallet is watch-only and doesn't have a seed.");
fail_msg_writer() << tr("wallet is watch-only and has no seed");
return true;
}
if (!m_wallet->is_deterministic())
{
fail_msg_writer() << tr("This wallet is non-deterministic and doesn't have a seed.");
fail_msg_writer() << tr("wallet is non-deterministic and has no seed");
return true;
}
tools::password_container pwd_container;
@ -311,7 +311,7 @@ bool simple_wallet::set_always_confirm_transfers(const std::vector<std::string>
bool success = false;
if (m_wallet->watch_only())
{
fail_msg_writer() << tr("This wallet is watch-only and cannot transfer.");
fail_msg_writer() << tr("wallet is watch-only and cannot transfer");
return true;
}
tools::password_container pwd_container;
@ -340,7 +340,7 @@ bool simple_wallet::set_store_tx_info(const std::vector<std::string> &args/* = s
bool success = false;
if (m_wallet->watch_only())
{
fail_msg_writer() << tr("This wallet is watch-only and cannot transfer.");
fail_msg_writer() << tr("wallet is watch-only and cannot transfer");
return true;
}
tools::password_container pwd_container;
@ -369,20 +369,20 @@ bool simple_wallet::set_default_mixin(const std::vector<std::string> &args/* = s
bool success = false;
if (m_wallet->watch_only())
{
fail_msg_writer() << tr("This wallet is watch-only and cannot transfer.");
fail_msg_writer() << tr("wallet is watch-only and cannot transfer");
return true;
}
try
{
if (strchr(args[1].c_str(), '-'))
{
fail_msg_writer() << tr("Error: mixin must be an integer greater or equal to 2");
fail_msg_writer() << tr("mixin must be an integer >= 2");
return true;
}
uint32_t mixin = boost::lexical_cast<uint32_t>(args[1]);
if (mixin < 2 && mixin != 0)
{
fail_msg_writer() << tr("Error: mixin must be an integer greater or equal to 2");
fail_msg_writer() << tr("mixin must be an integer >= 2");
return true;
}
if (mixin == 0)
@ -410,12 +410,12 @@ bool simple_wallet::set_default_mixin(const std::vector<std::string> &args/* = s
}
catch(const boost::bad_lexical_cast &)
{
fail_msg_writer() << tr("Error: mixin must be an integer greater or equal to 2");
fail_msg_writer() << tr("mixin must be an integer >= 2");
return true;
}
catch(...)
{
fail_msg_writer() << tr("Error changing default mixin");
fail_msg_writer() << tr("could not change default mixin");
return true;
}
}
@ -478,7 +478,7 @@ static bool parse_refresh_type(const std::string &s, tools::wallet2::RefreshType
return true;
}
}
fail_msg_writer() << tr("Failed to parse refresh type");
fail_msg_writer() << tr("failed to parse refresh type");
return false;
}
@ -530,27 +530,27 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("start_mining", boost::bind(&simple_wallet::start_mining, this, _1), tr("start_mining [<number_of_threads>] - Start mining in daemon"));
m_cmd_binder.set_handler("stop_mining", boost::bind(&simple_wallet::stop_mining, this, _1), tr("Stop mining in daemon"));
m_cmd_binder.set_handler("save_bc", boost::bind(&simple_wallet::save_bc, this, _1), tr("Save current blockchain data"));
m_cmd_binder.set_handler("refresh", boost::bind(&simple_wallet::refresh, this, _1), tr("Resynchronize transactions and balance"));
m_cmd_binder.set_handler("refresh", boost::bind(&simple_wallet::refresh, this, _1), tr("Synchronize transactions and balance"));
m_cmd_binder.set_handler("balance", boost::bind(&simple_wallet::show_balance, this, _1), tr("Show current wallet balance"));
m_cmd_binder.set_handler("incoming_transfers", boost::bind(&simple_wallet::show_incoming_transfers, this, _1), tr("incoming_transfers [available|unavailable] - Show incoming transfers - all of them or filter them by availability"));
m_cmd_binder.set_handler("payments", boost::bind(&simple_wallet::show_payments, this, _1), tr("payments <payment_id_1> [<payment_id_2> ... <payment_id_N>] - Show payments <payment_id_1>, ... <payment_id_N>"));
m_cmd_binder.set_handler("incoming_transfers", boost::bind(&simple_wallet::show_incoming_transfers, this, _1), tr("incoming_transfers [available|unavailable] - Show incoming transfers, all or filtered by availability"));
m_cmd_binder.set_handler("payments", boost::bind(&simple_wallet::show_payments, this, _1), tr("payments <PID_1> [<PID_2> ... <PID_N>] - Show payments for given payment ID[s]"));
m_cmd_binder.set_handler("bc_height", boost::bind(&simple_wallet::show_blockchain_height, this, _1), tr("Show blockchain height"));
m_cmd_binder.set_handler("transfer", boost::bind(&simple_wallet::transfer, this, _1), tr("transfer [<mixin_count>] <addr_1> <amount_1> [<addr_2> <amount_2> ... <addr_N> <amount_N>] [payment_id] - Transfer <amount_1>,... <amount_N> to <address_1>,... <address_N>, respectively. <mixin_count> is the number of transactions yours is indistinguishable from (from 0 to maximum available)"));
m_cmd_binder.set_handler("transfer", boost::bind(&simple_wallet::transfer, this, _1), tr("transfer [<mixin_count>] <addr_1> <amount_1> [<addr_2> <amount_2> ... <addr_N> <amount_N>] [payment_id] - Transfer <amount_1>,... <amount_N> to <address_1>,... <address_N>, respectively. <mixin_count> is the number of extra inputs to include for untraceability (from 0 to maximum available)"));
m_cmd_binder.set_handler("transfer_new", boost::bind(&simple_wallet::transfer_new, this, _1), tr("Same as transfer, but using a new transaction building algorithm"));
m_cmd_binder.set_handler("sweep_dust", boost::bind(&simple_wallet::sweep_dust, this, _1), tr("Send all dust outputs to the same address with mixin 0"));
m_cmd_binder.set_handler("set_log", boost::bind(&simple_wallet::set_log, this, _1), tr("set_log <level> - Change current log detalization level, <level> is a number 0-4"));
m_cmd_binder.set_handler("sweep_dust", boost::bind(&simple_wallet::sweep_dust, this, _1), tr("Send all dust outputs to yourself with mixin 0"));
m_cmd_binder.set_handler("set_log", boost::bind(&simple_wallet::set_log, this, _1), tr("set_log <level> - Change current log detail level, <0-4>"));
m_cmd_binder.set_handler("address", boost::bind(&simple_wallet::print_address, this, _1), tr("Show current wallet public address"));
m_cmd_binder.set_handler("integrated_address", boost::bind(&simple_wallet::print_integrated_address, this, _1), tr("Convert a payment ID to an integrated address for the current wallet public address (no arguments use a random payment ID), or display standard addres and payment ID corresponding to an integrated addres"));
m_cmd_binder.set_handler("save", boost::bind(&simple_wallet::save, this, _1), tr("Save wallet synchronized data"));
m_cmd_binder.set_handler("save_watch_only", boost::bind(&simple_wallet::save_watch_only, this, _1), tr("Save watch only keys file"));
m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::viewkey, this, _1), tr("Get viewkey"));
m_cmd_binder.set_handler("spendkey", boost::bind(&simple_wallet::spendkey, this, _1), tr("Get spendkey"));
m_cmd_binder.set_handler("seed", boost::bind(&simple_wallet::seed, this, _1), tr("Get deterministic seed"));
m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("available options: seed language - Set wallet seed langage; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-info <1|0> - whether to store per outgoing tx info (destination address, payment id, tx secret key) for future reference; default_mixin <n> - set default mixin (default default is 4; auto-refresh <1|0> - whether to automatically refresh new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - control the wallet refresh speedup/assumptions balance"));
m_cmd_binder.set_handler("integrated_address", boost::bind(&simple_wallet::print_integrated_address, this, _1), tr("integrated_address [PID] - Encode a payment ID into an integrated address for the current wallet public address (no argument uses a random payment ID), or decode an integrated address to standard address and payment ID"));
m_cmd_binder.set_handler("save", boost::bind(&simple_wallet::save, this, _1), tr("Save wallet data"));
m_cmd_binder.set_handler("save_watch_only", boost::bind(&simple_wallet::save_watch_only, this, _1), tr("Save a watch-only keys file"));
m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::viewkey, this, _1), tr("Display private view key"));
m_cmd_binder.set_handler("spendkey", boost::bind(&simple_wallet::spendkey, this, _1), tr("Display private spend key"));
m_cmd_binder.set_handler("seed", boost::bind(&simple_wallet::seed, this, _1), tr("Display Electrum-style mnemonic seed"));
m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-mixin <n> - set default mixin (default default is 4); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour"));
m_cmd_binder.set_handler("rescan_spent", boost::bind(&simple_wallet::rescan_spent, this, _1), tr("Rescan blockchain for spent outputs"));
m_cmd_binder.set_handler("get_tx_key", boost::bind(&simple_wallet::get_tx_key, this, _1), tr("Get transaction key (r) for a given tx"));
m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to a given address in a partcular tx"));
m_cmd_binder.set_handler("show_transfers", boost::bind(&simple_wallet::show_transfers, this, _1), tr("show_transfers [in|out] [<min_height> [<max_height>]] - show incoming/outgoing transfers within an optional height range"));
m_cmd_binder.set_handler("get_tx_key", boost::bind(&simple_wallet::get_tx_key, this, _1), tr("Get transaction key (r) for a given <txid>"));
m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to <address> in <txid>"));
m_cmd_binder.set_handler("show_transfers", boost::bind(&simple_wallet::show_transfers, this, _1), tr("show_transfers [in|out] [<min_height> [<max_height>]] - Show incoming/outgoing transfers within an optional height range"));
m_cmd_binder.set_handler("help", boost::bind(&simple_wallet::help, this, _1), tr("Show this help"));
}
//----------------------------------------------------------------------------------------------------
@ -612,7 +612,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
{
if (args.size() <= 1)
{
fail_msg_writer() << tr("set default-mixin: needs an argument (integer greater of equal to 2)");
fail_msg_writer() << tr("set default-mixin: needs an argument (integer >= 2)");
return true;
}
else
@ -643,7 +643,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
if (args.size() <= 1)
{
fail_msg_writer() << tr("set refresh-type: needs an argument:") <<
tr("full (slowest, no assumptions), optimize-coinbase (fast, assumes the whole coinbase is paid to a single address), no-coinbase (fastest, assumes we receive no coinbase transaction), default (same as optimize-coinbase)");
tr("full (slowest, no assumptions); optimize-coinbase (fast, assumes the whole coinbase is paid to a single address); no-coinbase (fastest, assumes we receive no coinbase transaction), default (same as optimize-coinbase)");
return true;
}
else
@ -664,7 +664,7 @@ bool simple_wallet::set_log(const std::vector<std::string> &args)
{
if(args.size() != 1)
{
fail_msg_writer() << tr("use: set_log <log_level_number_0-4>");
fail_msg_writer() << tr("usage: set_log <log_level_number_0-4>");
return true;
}
uint16_t l = 0;
@ -690,7 +690,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
bool valid_path = false;
do {
wallet_path = command_line::input_line(
tr("Specify wallet file name (e.g., wallet.bin). If the wallet doesn't exist, it will be created.\n"
tr("Specify wallet file name (e.g., MyWallet). If the wallet doesn't exist, it will be created.\n"
"Wallet file name: ")
);
valid_path = tools::wallet2::wallet_valid_path_format(wallet_path);
@ -715,7 +715,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
{
if (!m_generate_new.empty() || m_restore_deterministic_wallet || !m_generate_from_view_key.empty())
{
fail_msg_writer() << tr("Attempting to generate or restore wallet, but specified file(s) exist. Exiting to not risk overwriting.");
fail_msg_writer() << tr("attempting to generate or restore wallet, but specified file(s) exist. Exiting to not risk overwriting.");
return false;
}
}
@ -734,7 +734,7 @@ bool simple_wallet::ask_wallet_create_if_needed()
r = true;
}else
{
fail_msg_writer() << tr("Keys file wasn't found: failed to open wallet: ") << "\"" << wallet_path << "\".";
fail_msg_writer() << tr("keys file not found: failed to open wallet: ") << "\"" << wallet_path << "\".";
r = false;
}
}
@ -765,13 +765,13 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!m_daemon_address.empty() && !m_daemon_host.empty() && 0 != m_daemon_port)
{
fail_msg_writer() << tr("you can't specify daemon host or port several times");
fail_msg_writer() << tr("can't specify daemon host or port more than once");
return false;
}
if((!m_generate_new.empty()) + (!m_wallet_file.empty()) + (!m_generate_from_view_key.empty()) > 1)
{
fail_msg_writer() << tr("Specifying more than one of --generate-new-wallet=\"wallet_name\", --wallet-file=\"wallet_name\" and --generate-from-keys doesn't make sense!");
fail_msg_writer() << tr("can't specify more than one of --generate-new-wallet=\"wallet_name\", --wallet-file=\"wallet_name\" and --generate-from-view-key");
return false;
}
else if (m_generate_new.empty() && m_wallet_file.empty() && m_generate_from_view_key.empty())
@ -817,13 +817,13 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
{
if (m_non_deterministic)
{
fail_msg_writer() << tr("Cannot specify both --restore-deterministic-wallet and --non-deterministic");
fail_msg_writer() << tr("can't specify both --restore-deterministic-wallet and --non-deterministic");
return false;
}
if (m_electrum_seed.empty())
{
m_electrum_seed = command_line::input_line("Specify electrum seed: ");
m_electrum_seed = command_line::input_line("Specify Electrum seed: ");
if (m_electrum_seed.empty())
{
fail_msg_writer() << tr("specify a recovery parameter with the --electrum-seed=\"words list here\"");
@ -833,7 +833,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!crypto::ElectrumWords::words_to_bytes(m_electrum_seed, m_recovery_key, old_language))
{
fail_msg_writer() << tr("electrum-style word list failed verification");
fail_msg_writer() << tr("Electrum-style word list failed verification");
return false;
}
}
@ -854,7 +854,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
crypto::hash8 new_payment_id;
if(!get_account_integrated_address_from_str(address, has_payment_id, new_payment_id, testnet, parts[0]))
{
fail_msg_writer() << tr("Failed to parse address");
fail_msg_writer() << tr("failed to parse address");
return false;
}
@ -862,7 +862,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
cryptonote::blobdata viewkey_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(parts[1], viewkey_data))
{
fail_msg_writer() << tr("Failed to parse view key secret key");
fail_msg_writer() << tr("failed to parse view key secret key");
return false;
}
crypto::secret_key viewkey = *reinterpret_cast<const crypto::secret_key*>(viewkey_data.data());
@ -885,7 +885,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
else
{
bool r = open_wallet(m_wallet_file, pwd_container.password(), testnet);
CHECK_AND_ASSERT_MES(r, false, tr("could not open account"));
CHECK_AND_ASSERT_MES(r, false, tr("failed to open account"));
}
return true;
@ -920,8 +920,8 @@ bool simple_wallet::try_connect_to_daemon()
if (!m_wallet->check_connection())
{
fail_msg_writer() << tr("wallet failed to connect to daemon: ") << m_daemon_address << ". " <<
tr("Daemon either is not started or passed wrong port. "
"Please, make sure that daemon is running or restart the wallet with correct daemon address.");
tr("Daemon either is not started or wrong port was passed. "
"Please make sure daemon is running or restart the wallet with the correct daemon address.");
return false;
}
return true;
@ -956,12 +956,12 @@ std::string simple_wallet::get_mnemonic_language()
if (!((language_number >= 0) && (static_cast<unsigned int>(language_number) < language_list.size())))
{
language_number = -1;
fail_msg_writer() << tr("Invalid language choice passed. Please try again.\n");
fail_msg_writer() << tr("invalid language choice passed. Please try again.\n");
}
}
catch (std::exception &e)
{
fail_msg_writer() << tr("Invalid language choice passed. Please try again.\n");
fail_msg_writer() << tr("invalid language choice passed. Please try again.\n");
}
}
return language_list[language_number];
@ -1003,7 +1003,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
recovery_val = m_wallet->generate(wallet_file, password, recovery_key, recover, two_random);
message_writer(epee::log_space::console_color_white, true) << tr("Generated new wallet: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->testnet());
std::cout << tr("view key: ") << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << ENDL;
std::cout << tr("View key: ") << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << ENDL;
}
catch (const std::exception& e)
{
@ -1020,12 +1020,12 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
success_msg_writer() <<
"**********************************************************************\n" <<
tr("Your wallet has been generated.\n"
"To start synchronizing with the daemon use \"refresh\" command.\n"
tr("Your wallet has been generated!\n"
"To start synchronizing with the daemon, use \"refresh\" command.\n"
"Use \"help\" command to see the list of available commands.\n"
"Always use \"exit\" command when closing simplewallet to save\n"
"current session's state. Otherwise, you will possibly need to synchronize \n"
"your wallet again. Your wallet key is NOT under risk anyway.\n")
"Always use \"exit\" command when closing simplewallet to save your\n"
"current session's state. Otherwise, you might need to synchronize \n"
"your wallet again (your wallet keys are NOT at risk in any case).\n")
;
if (!two_random)
@ -1051,7 +1051,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
m_wallet->generate(wallet_file, password, address, viewkey);
message_writer(epee::log_space::console_color_white, true) << tr("Generated new watch-only wallet: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->testnet());
std::cout << tr("view key: ") << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << ENDL;
std::cout << tr("View key: ") << string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_view_secret_key) << ENDL;
}
catch (const std::exception& e)
{
@ -1140,7 +1140,7 @@ bool simple_wallet::close_wallet()
bool r = m_wallet->deinit();
if (!r)
{
fail_msg_writer() << tr("failed to deinit wallet");
fail_msg_writer() << tr("failed to deinitialize wallet");
return false;
}
@ -1205,7 +1205,7 @@ bool simple_wallet::start_mining(const std::vector<std::string>& args)
{
if (!m_trusted_daemon)
{
fail_msg_writer() << tr("This command assume a trusted daemon. Enable with --trusted-daemon");
fail_msg_writer() << tr("this command requires a trusted daemon. Enable with --trusted-daemon");
return true;
}
@ -1278,7 +1278,7 @@ bool simple_wallet::save_bc(const std::vector<std::string>& args)
if (err.empty())
success_msg_writer() << tr("Blockchain saved");
else
fail_msg_writer() << tr("Blockchain can't be saved: ") << err;
fail_msg_writer() << tr("blockchain can't be saved: ") << err;
return true;
}
//----------------------------------------------------------------------------------------------------
@ -1366,21 +1366,21 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
}
catch (const tools::error::daemon_busy&)
{
ss << tr("daemon is busy. Please try later");
ss << tr("daemon is busy. Please try again later.");
}
catch (const tools::error::no_connection_to_daemon&)
{
ss << tr("no connection to daemon. Please, make sure daemon is running");
ss << tr("no connection to daemon. Please make sure daemon is running.");
}
catch (const tools::error::wallet_rpc_error& e)
{
LOG_ERROR("Unknown RPC error: " << e.to_string());
LOG_ERROR("RPC error: " << e.to_string());
ss << tr("RPC error: ") << e.what();
}
catch (const tools::error::refresh_error& e)
{
LOG_ERROR("refresh error: " << e.to_string());
ss << tr("Error refreshing: ") << e.what();
ss << tr("refresh error: ") << e.what();
}
catch (const tools::error::wallet_internal_error& e)
{
@ -1394,7 +1394,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
}
catch (...)
{
LOG_ERROR("Unknown error");
LOG_ERROR("unknown error");
ss << tr("unknown error");
}
@ -1410,7 +1410,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
//----------------------------------------------------------------------------------------------------
bool simple_wallet::show_balance(const std::vector<std::string>& args/* = std::vector<std::string>()*/)
{
success_msg_writer() << tr("balance: ") << print_money(m_wallet->balance()) << ", "
success_msg_writer() << tr("Balance: ") << print_money(m_wallet->balance()) << ", "
<< tr("unlocked balance: ") << print_money(m_wallet->unlocked_balance()) << ", "
<< tr("including unlocked dust: ") << print_money(m_wallet->unlocked_dust_balance(tools::tx_dust_policy(::config::DEFAULT_DUST_THRESHOLD)));
return true;
@ -1517,7 +1517,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
}
else
{
fail_msg_writer() << tr("payment id has invalid format, expected 64-character string: ") << arg;
fail_msg_writer() << tr("payment ID has invalid format, expected 16 or 64 character hex string: ") << arg;
}
}
@ -1551,7 +1551,7 @@ bool simple_wallet::rescan_spent(const std::vector<std::string> &args)
{
if (!m_trusted_daemon)
{
fail_msg_writer() << tr("This command assume a trusted daemon. Enable with --trusted-daemon");
fail_msg_writer() << tr("this command requires a trusted daemon. Enable with --trusted-daemon");
return true;
}
@ -1564,11 +1564,11 @@ bool simple_wallet::rescan_spent(const std::vector<std::string> &args)
}
catch (const tools::error::daemon_busy&)
{
fail_msg_writer() << tr("daemon is busy. Please try later");
fail_msg_writer() << tr("daemon is busy. Please try again later.");
}
catch (const tools::error::no_connection_to_daemon&)
{
fail_msg_writer() << tr("no connection to daemon. Please, make sure daemon is running.");
fail_msg_writer() << tr("no connection to daemon. Please make sure daemon is running.");
}
catch (const tools::error::is_key_image_spent_error&)
{
@ -1576,7 +1576,7 @@ bool simple_wallet::rescan_spent(const std::vector<std::string> &args)
}
catch (const tools::error::wallet_rpc_error& e)
{
LOG_ERROR("Unknown RPC error: " << e.to_string());
LOG_ERROR("RPC error: " << e.to_string());
fail_msg_writer() << tr("RPC error: ") << e.what();
}
catch (const std::exception& e)
@ -1586,7 +1586,7 @@ bool simple_wallet::rescan_spent(const std::vector<std::string> &args)
}
catch (...)
{
LOG_ERROR("Unknown error");
LOG_ERROR("unknown error");
fail_msg_writer() << tr("unknown error");
}
@ -1622,7 +1622,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
if(m_wallet->watch_only())
{
fail_msg_writer() << tr("This is a watch only wallet");
fail_msg_writer() << tr("this is a watch only wallet");
return true;
}
@ -1655,7 +1655,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
if(!r)
{
fail_msg_writer() << tr("payment id has invalid format, expected 16 or 64 character string: ") << payment_id_str;
fail_msg_writer() << tr("payment id has invalid format, expected 16 or 64 character hex string: ") << payment_id_str;
return true;
}
payment_id_seen = true;
@ -1706,23 +1706,23 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
if (confirm_dns_ok != "Y" && confirm_dns_ok != "y" && confirm_dns_ok != "Yes" && confirm_dns_ok != "yes"
&& confirm_dns_ok != tr("yes") && confirm_dns_ok != tr("no"))
{
fail_msg_writer() << tr("You have cancelled the transfer request");
fail_msg_writer() << tr("you have cancelled the transfer request");
return true;
}
}
else
{
fail_msg_writer() << tr("Failed to get a Monero address from: ") << local_args[i];
fail_msg_writer() << tr("failed to get a Monero address from: ") << local_args[i];
return true;
}
}
else if (addresses_from_dns.size() > 1)
{
fail_msg_writer() << tr("Not yet supported: Multiple Monero addresses found for given URL: ") << url;
fail_msg_writer() << tr("not yet supported: Multiple Monero addresses found for given URL: ") << url;
}
else
{
fail_msg_writer() << tr("Wrong address: ") << local_args[i];
fail_msg_writer() << tr("wrong address: ") << local_args[i];
return true;
}
}
@ -1731,7 +1731,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
{
if (payment_id_seen)
{
fail_msg_writer() << tr("A single transaction cannot use more than one payment id: ") << local_args[i];
fail_msg_writer() << tr("a single transaction cannot use more than one payment id: ") << local_args[i];
return true;
}
@ -1740,7 +1740,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
bool r = add_extra_nonce_to_tx_extra(extra, extra_nonce);
if(!r)
{
fail_msg_writer() << tr("Failed to set up payment id, though it was decoded correctly");
fail_msg_writer() << tr("failed to set up payment id, though it was decoded correctly");
return true;
}
}
@ -1780,7 +1780,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
std::string accepted = command_line::input_line(prompt_str);
if (accepted != "Y" && accepted != "y" && accepted != "Yes" && accepted != "yes")
{
fail_msg_writer() << tr("Transaction cancelled.");
fail_msg_writer() << tr("transaction cancelled.");
// would like to return false, because no tx made, but everything else returns true
// and I don't know what returning false might adversely affect. *sigh*
@ -1801,15 +1801,15 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
}
catch (const tools::error::daemon_busy&)
{
fail_msg_writer() << tr("daemon is busy. Please try later");
fail_msg_writer() << tr("daemon is busy. Please try again later.");
}
catch (const tools::error::no_connection_to_daemon&)
{
fail_msg_writer() << tr("no connection to daemon. Please, make sure daemon is running.");
fail_msg_writer() << tr("no connection to daemon. Please make sure daemon is running.");
}
catch (const tools::error::wallet_rpc_error& e)
{
LOG_ERROR("Unknown RPC error: " << e.to_string());
LOG_ERROR("RPC error: " << e.to_string());
fail_msg_writer() << tr("RPC error: ") << e.what();
}
catch (const tools::error::get_random_outs_error&)
@ -1851,7 +1851,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
}
catch (const tools::error::tx_too_big& e)
{
fail_msg_writer() << tr("Failed to find a suitable way to split transactions");
fail_msg_writer() << tr("failed to find a suitable way to split transactions");
}
catch (const tools::error::transfer_error& e)
{
@ -1870,7 +1870,7 @@ bool simple_wallet::transfer_main(bool new_algorithm, const std::vector<std::str
}
catch (...)
{
LOG_ERROR("Unknown error");
LOG_ERROR("unknown error");
fail_msg_writer() << tr("unknown error");
}
@ -1895,7 +1895,7 @@ bool simple_wallet::sweep_dust(const std::vector<std::string> &args_)
if(m_wallet->watch_only())
{
fail_msg_writer() << tr("This is a watch only wallet");
fail_msg_writer() << tr("this is a watch only wallet");
return true;
}
@ -1928,7 +1928,7 @@ bool simple_wallet::sweep_dust(const std::vector<std::string> &args_)
std::string accepted = command_line::input_line(prompt_str);
if (accepted != "Y" && accepted != "y" && accepted != "Yes" && accepted != "yes")
{
fail_msg_writer() << tr("Transaction cancelled.");
fail_msg_writer() << tr("transaction cancelled.");
// would like to return false, because no tx made, but everything else returns true
// and I don't know what returning false might adversely affect. *sigh*
@ -1948,15 +1948,15 @@ bool simple_wallet::sweep_dust(const std::vector<std::string> &args_)
}
catch (const tools::error::daemon_busy&)
{
fail_msg_writer() << tr("daemon is busy. Please try later");
fail_msg_writer() << tr("daemon is busy. Please try again later.");
}
catch (const tools::error::no_connection_to_daemon&)
{
fail_msg_writer() << tr("no connection to daemon. Please, make sure daemon is running.");
fail_msg_writer() << tr("no connection to daemon. Please make sure daemon is running.");
}
catch (const tools::error::wallet_rpc_error& e)
{
LOG_ERROR("Unknown RPC error: " << e.to_string());
LOG_ERROR("RPC error: " << e.to_string());
fail_msg_writer() << tr("RPC error: ") << e.what();
}
catch (const tools::error::get_random_outs_error&)
@ -1998,7 +1998,7 @@ bool simple_wallet::sweep_dust(const std::vector<std::string> &args_)
}
catch (const tools::error::tx_too_big& e)
{
fail_msg_writer() << tr("Failed to find a suitable way to split transactions");
fail_msg_writer() << tr("failed to find a suitable way to split transactions");
}
catch (const tools::error::transfer_error& e)
{
@ -2017,7 +2017,7 @@ bool simple_wallet::sweep_dust(const std::vector<std::string> &args_)
}
catch (...)
{
LOG_ERROR("Unknown error");
LOG_ERROR("unknown error");
fail_msg_writer() << tr("unknown error");
}
@ -2029,14 +2029,14 @@ bool simple_wallet::get_tx_key(const std::vector<std::string> &args_)
std::vector<std::string> local_args = args_;
if(local_args.size() != 1) {
fail_msg_writer() << tr("Usage: get_tx_key <txid>");
fail_msg_writer() << tr("usage: get_tx_key <txid>");
return true;
}
cryptonote::blobdata txid_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(local_args.front(), txid_data))
{
fail_msg_writer() << tr("Failed to parse txid");
fail_msg_writer() << tr("failed to parse txid");
return false;
}
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
@ -2045,12 +2045,12 @@ bool simple_wallet::get_tx_key(const std::vector<std::string> &args_)
bool r = m_wallet->get_tx_key(txid, tx_key);
if (r)
{
success_msg_writer() << tr("tx key: ") << tx_key;
success_msg_writer() << tr("Tx key: ") << tx_key;
return true;
}
else
{
fail_msg_writer() << tr("No tx key found for this txid");
fail_msg_writer() << tr("no tx key found for this txid");
return true;
}
}
@ -2060,7 +2060,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
std::vector<std::string> local_args = args_;
if(local_args.size() != 3) {
fail_msg_writer() << tr("Usage: check_tx_key <txid> <txkey> <address>");
fail_msg_writer() << tr("usage: check_tx_key <txid> <txkey> <address>");
return true;
}
@ -2070,7 +2070,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
cryptonote::blobdata txid_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(local_args[0], txid_data))
{
fail_msg_writer() << tr("Failed to parse txid");
fail_msg_writer() << tr("failed to parse txid");
return true;
}
crypto::hash txid = *reinterpret_cast<const crypto::hash*>(txid_data.data());
@ -2078,7 +2078,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
cryptonote::blobdata tx_key_data;
if(!epee::string_tools::parse_hexstr_to_binbuff(local_args[1], tx_key_data))
{
fail_msg_writer() << tr("Failed to parse tx key");
fail_msg_writer() << tr("failed to parse tx key");
return true;
}
crypto::secret_key tx_key = *reinterpret_cast<const crypto::secret_key*>(tx_key_data.data());
@ -2088,7 +2088,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
crypto::hash8 payment_id;
if(!get_account_integrated_address_from_str(address, has_payment_id, payment_id, m_wallet->testnet(), local_args[2]))
{
fail_msg_writer() << tr("Failed to parse address");
fail_msg_writer() << tr("failed to parse address");
return true;
}
@ -2098,32 +2098,32 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
if (!net_utils::invoke_http_json_remote_command2(m_daemon_address + "/gettransactions", req, res, m_http_client) ||
res.txs_as_hex.empty())
{
fail_msg_writer() << tr("Failed to get transaction from daemon");
fail_msg_writer() << tr("failed to get transaction from daemon");
return true;
}
cryptonote::blobdata tx_data;
if (!string_tools::parse_hexstr_to_binbuff(res.txs_as_hex.front(), tx_data))
{
fail_msg_writer() << tr("Failed to parse transaction from daemon");
fail_msg_writer() << tr("failed to parse transaction from daemon");
return true;
}
crypto::hash tx_hash, tx_prefix_hash;
cryptonote::transaction tx;
if (!cryptonote::parse_and_validate_tx_from_blob(tx_data, tx, tx_hash, tx_prefix_hash))
{
fail_msg_writer() << tr("Failed to validate transaction from daemon");
fail_msg_writer() << tr("failed to validate transaction from daemon");
return true;
}
if (tx_hash != txid)
{
fail_msg_writer() << tr("Failed to get the right transaction from daemon");
fail_msg_writer() << tr("failed to get the right transaction from daemon");
return true;
}
crypto::key_derivation derivation;
if (!crypto::generate_key_derivation(address.m_view_public_key, tx_key, derivation))
{
fail_msg_writer() << tr("Failed to generate key derivation from supplied parameters");
fail_msg_writer() << tr("failed to generate key derivation from supplied parameters");
return true;
}
@ -2142,7 +2142,7 @@ bool simple_wallet::check_tx_key(const std::vector<std::string> &args_)
}
catch(...)
{
LOG_ERROR("Unknown error");
LOG_ERROR("unknown error");
fail_msg_writer() << tr("unknown error");
return true;
}
@ -2169,7 +2169,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
uint64_t max_height = (uint64_t)-1;
if(local_args.size() > 3) {
fail_msg_writer() << tr("Usage: show_transfers [in|out|all|pending] [<min_height> [<max_height>]]");
fail_msg_writer() << tr("usage: show_transfers [in|out|all|pending] [<min_height> [<max_height>]]");
return true;
}
@ -2198,7 +2198,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
min_height = boost::lexical_cast<uint64_t>(local_args[0]);
}
catch (boost::bad_lexical_cast &) {
fail_msg_writer() << tr("Bad min_height parameter:") << " " << local_args[0];
fail_msg_writer() << tr("bad min_height parameter:") << " " << local_args[0];
return true;
}
local_args.erase(local_args.begin());
@ -2210,7 +2210,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
max_height = boost::lexical_cast<uint64_t>(local_args[0]);
}
catch (boost::bad_lexical_cast &) {
fail_msg_writer() << tr("Bad max_height parameter:") << " " << local_args[0];
fail_msg_writer() << tr("bad max_height parameter:") << " " << local_args[0];
return true;
}
local_args.erase(local_args.begin());
@ -2329,7 +2329,7 @@ bool simple_wallet::print_integrated_address(const std::vector<std::string> &arg
crypto::hash8 payment_id;
if (args.size() > 1)
{
fail_msg_writer() << tr("integrated_address only takes one or zero arguments");
fail_msg_writer() << tr("usage: integrated_address [payment ID]");
return true;
}
if (args.size() == 0)
@ -2352,17 +2352,17 @@ bool simple_wallet::print_integrated_address(const std::vector<std::string> &arg
{
if (has_payment_id)
{
success_msg_writer() << boost::format(tr("Integrated address: account %s, payment id %s")) %
success_msg_writer() << boost::format(tr("Integrated address: account %s, payment ID %s")) %
get_account_address_as_str(m_wallet->testnet(),addr) % epee::string_tools::pod_to_hex(payment_id);
}
else
{
success_msg_writer() << tr("Standard address: account: ") << get_account_address_as_str(m_wallet->testnet(),addr);
success_msg_writer() << tr("Standard address: ") << get_account_address_as_str(m_wallet->testnet(),addr);
}
return true;
}
}
fail_msg_writer() << tr("Failed to parse payment id or address");
fail_msg_writer() << tr("failed to parse payment ID or address");
return true;
}
//----------------------------------------------------------------------------------------------------
@ -2420,7 +2420,7 @@ int main(int argc, char* argv[])
// path.
if (! default_log.empty())
{
fail_msg_writer() << sw::tr("Unexpected empty log file name in presence of non-empty file path");
fail_msg_writer() << sw::tr("unexpected empty log file name in presence of non-empty file path");
return false;
}
// epee didn't find path to executable from argv[0], so use this default file name.
@ -2456,7 +2456,7 @@ int main(int argc, char* argv[])
{
success_msg_writer() << CRYPTONOTE_NAME << " " << sw::tr("wallet") << " v" << MONERO_VERSION_FULL;
success_msg_writer() << sw::tr("Usage:") << " simplewallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--daemon-address=<host>:<port>] [<COMMAND>]";
success_msg_writer() << desc_all << '\n' << w.get_commands_str();
success_msg_writer() << desc_all;
return false;
}
else if (command_line::get_arg(vm, command_line::arg_version))