|
|
@ -1216,6 +1216,68 @@ bool WalletImpl::importKeyImages(const string &filename)
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool WalletImpl::exportOutputs(const string &filename, bool all)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_wallet->key_on_device())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setStatusError(string(tr("Not supported on HW wallets.")) + filename);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::string data = m_wallet->export_outputs_to_str(all);
|
|
|
|
|
|
|
|
bool r = m_wallet->save_to_file(filename, data);
|
|
|
|
|
|
|
|
if (!r)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LOG_ERROR("Failed to save file " << filename);
|
|
|
|
|
|
|
|
setStatusError(string(tr("Failed to save file: ")) + filename);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (const std::exception &e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LOG_ERROR("Error exporting outputs: " << e.what());
|
|
|
|
|
|
|
|
setStatusError(string(tr("Error exporting outputs: ")) + e.what());
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG_PRINT_L2("Outputs exported to " << filename);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool WalletImpl::importOutputs(const string &filename)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_wallet->key_on_device())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
setStatusError(string(tr("Not supported on HW wallets.")) + filename);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string data;
|
|
|
|
|
|
|
|
bool r = m_wallet->load_from_file(filename, data);
|
|
|
|
|
|
|
|
if (!r)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LOG_ERROR("Failed to read file: " << filename);
|
|
|
|
|
|
|
|
setStatusError(string(tr("Failed to read file: ")) + filename);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
size_t n_outputs = m_wallet->import_outputs_from_str(data);
|
|
|
|
|
|
|
|
LOG_PRINT_L2(std::to_string(n_outputs) << " outputs imported");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (const std::exception &e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
LOG_ERROR("Failed to import outputs: " << e.what());
|
|
|
|
|
|
|
|
setStatusError(string(tr("Failed to import outputs: ")) + e.what());
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void WalletImpl::addSubaddressAccount(const std::string& label)
|
|
|
|
void WalletImpl::addSubaddressAccount(const std::string& label)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_wallet->add_subaddress_account(label);
|
|
|
|
m_wallet->add_subaddress_account(label);
|
|
|
|