mirror of
https://github.com/wownero/wownero.git
synced 2026-11-06 16:34:13 +01:00
@@ -182,6 +182,7 @@ namespace
|
||||
const char* USAGE_LOCKED_TRANSFER("locked_transfer [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] (<URI> | <addr> <amount>) <lockblocks> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_LOCKED_SWEEP_ALL("locked_sweep_all [index=<N1>[,<N2>,...] | index=all] [<priority>] [<ring_size>] <address> <lockblocks> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_ALL("sweep_all [index=<N1>[,<N2>,...] | index=all] [<priority>] [<ring_size>] [outputs=<N>] <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_ACCOUNT("sweep_account <account> [index=<N1>[,<N2>,...] | index=all] [<priority>] [<ring_size>] [outputs=<N>] <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_BELOW("sweep_below <amount_threshold> [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_SINGLE("sweep_single [<priority>] [<ring_size>] [outputs=<N>] <key_image> <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_DONATE("donate [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <amount> [<payment_id (obsolete)>]");
|
||||
@@ -207,7 +208,7 @@ namespace
|
||||
const char* USAGE_CHECK_SPEND_PROOF("check_spend_proof <txid> <signature_file> [<message>]");
|
||||
const char* USAGE_GET_RESERVE_PROOF("get_reserve_proof (all|<amount>) [<message>]");
|
||||
const char* USAGE_CHECK_RESERVE_PROOF("check_reserve_proof <address> <signature_file> [<message>]");
|
||||
const char* USAGE_SHOW_TRANSFERS("show_transfers [in|out|pending|failed|pool|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]]");
|
||||
const char* USAGE_SHOW_TRANSFERS("show_transfers [in|out|all|pending|failed|pool|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]]");
|
||||
const char* USAGE_UNSPENT_OUTPUTS("unspent_outputs [index=<N1>[,<N2>,...]] [<min_amount> [<max_amount>]]");
|
||||
const char* USAGE_RESCAN_BC("rescan_bc [hard|soft|keep_ki] [start_height=0]");
|
||||
const char* USAGE_SET_TX_NOTE("set_tx_note <txid> [free text note]");
|
||||
@@ -3145,6 +3146,9 @@ simple_wallet::simple_wallet()
|
||||
m_cmd_binder.set_handler("sweep_all", boost::bind(&simple_wallet::sweep_all, this, _1),
|
||||
tr(USAGE_SWEEP_ALL),
|
||||
tr("Send all unlocked balance to an address. If the parameter \"index=<N1>[,<N2>,...]\" or \"index=all\" is specified, the wallet sweeps outputs received by those or all address indices, respectively. If omitted, the wallet randomly chooses an address index to be used. If the parameter \"outputs=<N>\" is specified and N > 0, wallet splits the transaction into N even outputs."));
|
||||
m_cmd_binder.set_handler("sweep_account", boost::bind(&simple_wallet::sweep_account, this, _1),
|
||||
tr(USAGE_SWEEP_ACCOUNT),
|
||||
tr("Send all unlocked balance from a given account to an address. If the parameter \"index=<N1>[,<N2>,...]\" or \"index=all\" is specified, the wallet sweeps outputs received by those or all address indices, respectively. If omitted, the wallet randomly chooses an address index to be used. If the parameter \"outputs=<N>\" is specified and N > 0, wallet splits the transaction into N even outputs."));
|
||||
m_cmd_binder.set_handler("sweep_below",
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::sweep_below, _1),
|
||||
tr(USAGE_SWEEP_BELOW),
|
||||
@@ -3338,7 +3342,7 @@ simple_wallet::simple_wallet()
|
||||
"** Set of address indices used as inputs in this transfer."));
|
||||
m_cmd_binder.set_handler("export_transfers",
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::export_transfers, _1),
|
||||
tr("export_transfers [in|out|all|pending|failed|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]] [output=<filepath>]"),
|
||||
tr("export_transfers [in|out|all|pending|failed|pool|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]] [output=<filepath>]"),
|
||||
tr("Export to CSV the incoming/outgoing transfers within an optional height range."));
|
||||
m_cmd_binder.set_handler("unspent_outputs",
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::unspent_outputs, _1),
|
||||
@@ -5576,14 +5580,19 @@ boost::optional<epee::wipeable_string> simple_wallet::on_device_pin_request()
|
||||
return pwd_container->password();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
boost::optional<epee::wipeable_string> simple_wallet::on_device_passphrase_request(bool on_device)
|
||||
boost::optional<epee::wipeable_string> simple_wallet::on_device_passphrase_request(bool & on_device)
|
||||
{
|
||||
if (on_device){
|
||||
message_writer(console_color_white, true) << tr("Please enter the device passphrase on the device");
|
||||
return boost::none;
|
||||
if (on_device) {
|
||||
std::string accepted = input_line(tr(
|
||||
"Device asks for passphrase. Do you want to enter the passphrase on device (Y) (or on the host (N))?"));
|
||||
if (std::cin.eof() || command_line::is_yes(accepted)) {
|
||||
message_writer(console_color_white, true) << tr("Please enter the device passphrase on the device");
|
||||
return boost::none;
|
||||
}
|
||||
}
|
||||
|
||||
PAUSE_READLINE();
|
||||
on_device = false;
|
||||
std::string msg = tr("Enter device passphrase");
|
||||
auto pwd_container = tools::password_container::prompt(false, msg.c_str());
|
||||
THROW_WALLET_EXCEPTION_IF(!pwd_container, tools::error::password_entry_failed, tr("Failed to read device passphrase"));
|
||||
@@ -6221,6 +6230,7 @@ bool simple_wallet::prompt_if_old(const std::vector<tools::wallet2::pending_tx>
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void simple_wallet::check_for_inactivity_lock(bool user)
|
||||
{
|
||||
if (m_locked)
|
||||
@@ -6758,7 +6768,7 @@ bool simple_wallet::locked_transfer(const std::vector<std::string> &args_)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::locked_sweep_all(const std::vector<std::string> &args_)
|
||||
{
|
||||
sweep_main(0, true, args_);
|
||||
sweep_main(m_current_subaddress_account, 0, true, args_);
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -6869,18 +6879,22 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_)
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<std::string> &args_)
|
||||
bool simple_wallet::sweep_main(uint32_t account, uint64_t below, bool locked, const std::vector<std::string> &args_)
|
||||
{
|
||||
auto print_usage = [below]()
|
||||
auto print_usage = [this, account, below]()
|
||||
{
|
||||
if (below)
|
||||
{
|
||||
PRINT_USAGE(USAGE_SWEEP_BELOW);
|
||||
}
|
||||
else
|
||||
else if (account == m_current_subaddress_account)
|
||||
{
|
||||
PRINT_USAGE(USAGE_SWEEP_ALL);
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_USAGE(USAGE_SWEEP_ACCOUNT);
|
||||
}
|
||||
};
|
||||
if (args_.size() == 0)
|
||||
{
|
||||
@@ -7054,7 +7068,7 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
|
||||
try
|
||||
{
|
||||
// figure out what tx will be necessary
|
||||
auto ptx_vector = m_wallet->create_transactions_all(below, info.address, info.is_subaddress, outputs, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices);
|
||||
auto ptx_vector = m_wallet->create_transactions_all(below, info.address, info.is_subaddress, outputs, fake_outs_count, unlock_block /* unlock_time */, priority, extra, account, subaddr_indices);
|
||||
|
||||
if (ptx_vector.empty())
|
||||
{
|
||||
@@ -7394,7 +7408,27 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::sweep_all(const std::vector<std::string> &args_)
|
||||
{
|
||||
sweep_main(0, false, args_);
|
||||
sweep_main(m_current_subaddress_account, 0, false, args_);
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::sweep_account(const std::vector<std::string> &args_)
|
||||
{
|
||||
auto local_args = args_;
|
||||
if (local_args.empty())
|
||||
{
|
||||
PRINT_USAGE(USAGE_SWEEP_ACCOUNT);
|
||||
return true;
|
||||
}
|
||||
uint32_t account = 0;
|
||||
if (!epee::string_tools::get_xtype_from_string(account, local_args[0]))
|
||||
{
|
||||
fail_msg_writer() << tr("Invalid account");
|
||||
return true;
|
||||
}
|
||||
local_args.erase(local_args.begin());
|
||||
|
||||
sweep_main(account, 0, false, local_args);
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -7411,7 +7445,7 @@ bool simple_wallet::sweep_below(const std::vector<std::string> &args_)
|
||||
fail_msg_writer() << tr("invalid amount threshold");
|
||||
return true;
|
||||
}
|
||||
sweep_main(below, false, std::vector<std::string>(++args_.begin(), args_.end()));
|
||||
sweep_main(m_current_subaddress_account, below, false, std::vector<std::string>(++args_.begin(), args_.end()));
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -8508,7 +8542,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
|
||||
std::vector<std::string> local_args = args_;
|
||||
|
||||
if(local_args.size() > 4) {
|
||||
fail_msg_writer() << tr("usage: show_transfers [in|out|all|pending|failed|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]]");
|
||||
fail_msg_writer() << tr("usage: show_transfers [in|out|all|pending|failed|pool|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]]");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8561,7 +8595,7 @@ bool simple_wallet::export_transfers(const std::vector<std::string>& args_)
|
||||
std::vector<std::string> local_args = args_;
|
||||
|
||||
if(local_args.size() > 5) {
|
||||
fail_msg_writer() << tr("usage: export_transfers [in|out|all|pending|failed|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]] [output=<path>]");
|
||||
fail_msg_writer() << tr("usage: export_transfers [in|out|all|pending|failed|pool|coinbase] [index=<N1>[,<N2>,...]] [<min_height> [<max_height>]] [output=<path>]");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user