@ -181,6 +181,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_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_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_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_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_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) > ] " ) ;
const char * USAGE_DONATE ( " donate [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <amount> [<payment_id (obsolete) > ] " ) ;
@ -3144,6 +3145,9 @@ simple_wallet::simple_wallet()
m_cmd_binder . set_handler ( " sweep_all " , boost : : bind ( & simple_wallet : : sweep_all , this , _1 ) ,
m_cmd_binder . set_handler ( " sweep_all " , boost : : bind ( & simple_wallet : : sweep_all , this , _1 ) ,
tr ( USAGE_SWEEP_ALL ) ,
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. " ) ) ;
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 " ,
m_cmd_binder . set_handler ( " sweep_below " ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : sweep_below , _1 ) ,
boost : : bind ( & simple_wallet : : on_command , this , & simple_wallet : : sweep_below , _1 ) ,
tr ( USAGE_SWEEP_BELOW ) ,
tr ( USAGE_SWEEP_BELOW ) ,
@ -6763,7 +6767,7 @@ bool simple_wallet::locked_transfer(const std::vector<std::string> &args_)
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
bool simple_wallet : : locked_sweep_all ( 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 ;
return true ;
}
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
@ -6874,18 +6878,22 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_)
return true ;
return true ;
}
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
bool simple_wallet : : sweep_main ( uint 64_t below , bool locked , const std : : vector < std : : string > & args_ )
bool simple_wallet : : sweep_main ( uint 32_t account , uint 64_t below , bool locked , const std : : vector < std : : string > & args_ )
{
{
auto print_usage = [ below ] ( )
auto print_usage = [ this , account , below ] ( )
{
{
if ( below )
if ( below )
{
{
PRINT_USAGE ( USAGE_SWEEP_BELOW ) ;
PRINT_USAGE ( USAGE_SWEEP_BELOW ) ;
}
}
else
else if ( account = = m_current_subaddress_account )
{
{
PRINT_USAGE ( USAGE_SWEEP_ALL ) ;
PRINT_USAGE ( USAGE_SWEEP_ALL ) ;
}
}
else
{
PRINT_USAGE ( USAGE_SWEEP_ACCOUNT ) ;
}
} ;
} ;
if ( args_ . size ( ) = = 0 )
if ( args_ . size ( ) = = 0 )
{
{
@ -7059,7 +7067,7 @@ bool simple_wallet::sweep_main(uint64_t below, bool locked, const std::vector<st
try
try
{
{
// figure out what tx will be necessary
// 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 ( ) )
if ( ptx_vector . empty ( ) )
{
{
@ -7399,7 +7407,27 @@ bool simple_wallet::sweep_single(const std::vector<std::string> &args_)
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
bool simple_wallet : : sweep_all ( 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 ;
return true ;
}
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
@ -7416,7 +7444,7 @@ bool simple_wallet::sweep_below(const std::vector<std::string> &args_)
fail_msg_writer ( ) < < tr ( " invalid amount threshold " ) ;
fail_msg_writer ( ) < < tr ( " invalid amount threshold " ) ;
return true ;
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 ;
return true ;
}
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------