Electroneum
Namespaces | Macros | Typedefs | Enumerations | Functions | Variables
simplewallet.cpp File Reference

Source file that defines simple_wallet class. More...

#include <thread>
#include <iostream>
#include <sstream>
#include <fstream>
#include <ctype.h>
#include <boost/lexical_cast.hpp>
#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/regex.hpp>
#include "include_base_utils.h"
#include "common/i18n.h"
#include "common/command_line.h"
#include "common/util.h"
#include "common/dns_utils.h"
#include "common/base58.h"
#include "common/scoped_message_writer.h"
#include "p2p/net_node.h"
#include "cryptonote_protocol/cryptonote_protocol_handler.h"
#include "simplewallet.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "storages/http_abstract_invoke.h"
#include "rpc/core_rpc_server_commands_defs.h"
#include "crypto/crypto.h"
#include "mnemonics/electrum-words.h"
#include "rapidjson/document.h"
#include "common/json_util.h"
#include "ringct/rctSigs.h"
#include "wallet/wallet_args.h"
#include <stdexcept>
Include dependency graph for simplewallet.cpp:

Namespaces

 anonymous_namespace{simplewallet.cpp}
 

Macros

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "wallet.simplewallet"
 
#define EXTENDED_LOGS_FILE   "wallet_details.log"
 
#define DEFAULT_MIXIN   0
 
#define OUTPUT_EXPORT_FILE_MAGIC   "Electroneum output export\003"
 
#define LOCK_IDLE_SCOPE()
 
#define CHECK_SIMPLE_VARIABLE(name, f, help)
 

Typedefs

typedef cryptonote::simple_wallet sw
 

Enumerations

enum  TransferType { Transfer, TransferLocked }
 

Functions

std::string anonymous_namespace{simplewallet.cpp}::interpret_rpc_response (bool ok, const std::string &status)
 
tools::scoped_message_writer anonymous_namespace{simplewallet.cpp}::success_msg_writer (bool color=false)
 
tools::scoped_message_writer anonymous_namespace{simplewallet.cpp}::message_writer (epee::console_colors color=epee::console_color_default, bool bright=false)
 
tools::scoped_message_writer anonymous_namespace{simplewallet.cpp}::fail_msg_writer ()
 
bool anonymous_namespace{simplewallet.cpp}::is_it_true (const std::string &s)
 
bool anonymous_namespace{simplewallet.cpp}::parse_refresh_type (const std::string &s, tools::wallet2::RefreshType &refresh_type)
 
std::string anonymous_namespace{simplewallet.cpp}::get_refresh_type_name (tools::wallet2::RefreshType type)
 
std::string anonymous_namespace{simplewallet.cpp}::get_version_string (uint32_t version)
 
std::string anonymous_namespace{simplewallet.cpp}::oa_prompter (const std::string &url, const std::vector< std::string > &addresses, bool dnssec_valid)
 
static bool might_be_partial_seed (std::string words)
 
static std::string get_human_readable_timestamp (uint64_t ts)
 
static std::string get_human_readable_timespan (std::chrono::seconds seconds)
 
int main (int argc, char *argv[])
 

Variables

const auto anonymous_namespace{simplewallet.cpp}::allowed_priority_strings = {"default", "unimportant", "normal", "elevated", "priority"}
 
const auto anonymous_namespace{simplewallet.cpp}::arg_wallet_file = wallet_args::arg_wallet_file()
 
const command_line::arg_descriptor< std::string > anonymous_namespace{simplewallet.cpp}::arg_generate_new_wallet = {"generate-new-wallet", sw::tr("Generate new wallet and save it to <arg>"), ""}
 
const command_line::arg_descriptor< std::string > anonymous_namespace{simplewallet.cpp}::arg_generate_from_view_key = {"generate-from-view-key", sw::tr("Generate incoming-only wallet from view key"), ""}
 
const command_line::arg_descriptor< std::string > anonymous_namespace{simplewallet.cpp}::arg_generate_from_keys = {"generate-from-keys", sw::tr("Generate wallet from private keys"), ""}
 
const command_line::arg_descriptor< std::string > anonymous_namespace{simplewallet.cpp}::arg_generate_from_multisig_keys = {"generate-from-multisig-keys", sw::tr("Generate a master wallet from multisig wallet keys"), ""}
 
const auto anonymous_namespace{simplewallet.cpp}::arg_generate_from_json = wallet_args::arg_generate_from_json()
 
const command_line::arg_descriptor< std::string > anonymous_namespace{simplewallet.cpp}::arg_mnemonic_language = {"mnemonic-language", sw::tr("Language for mnemonic"), ""}
 
const command_line::arg_descriptor< std::string > anonymous_namespace{simplewallet.cpp}::arg_electrum_seed = {"electrum-seed", sw::tr("Specify Electrum seed for wallet recovery/creation"), ""}
 
const command_line::arg_descriptor< boolanonymous_namespace{simplewallet.cpp}::arg_restore_deterministic_wallet = {"restore-deterministic-wallet", sw::tr("Recover wallet using Electrum-style mnemonic seed"), false}
 
const command_line::arg_descriptor< boolanonymous_namespace{simplewallet.cpp}::arg_non_deterministic = {"non-deterministic", sw::tr("Create non-deterministic view and spend keys"), false}
 
const command_line::arg_descriptor< boolanonymous_namespace{simplewallet.cpp}::arg_trusted_daemon = {"trusted-daemon", sw::tr("Enable commands which rely on a trusted daemon"), false}
 
const command_line::arg_descriptor< boolanonymous_namespace{simplewallet.cpp}::arg_allow_mismatched_daemon_version = {"allow-mismatched-daemon-version", sw::tr("Allow communicating with a daemon that uses a different RPC version"), false}
 
const command_line::arg_descriptor< uint64_t > anonymous_namespace{simplewallet.cpp}::arg_restore_height = {"restore-height", sw::tr("Restore from specific blockchain height"), 0}
 
const command_line::arg_descriptor< std::vector< std::string > > anonymous_namespace{simplewallet.cpp}::arg_command = {"command", ""}
 
struct {
   const char *   anonymous_namespace{simplewallet.cpp}::name
 
   tools::wallet2::RefreshType   anonymous_namespace{simplewallet.cpp}::refresh_type
 
anonymous_namespace{simplewallet.cpp}::refresh_type_names []
 

Detailed Description

Source file that defines simple_wallet class.

Macro Definition Documentation

◆ CHECK_SIMPLE_VARIABLE

#define CHECK_SIMPLE_VARIABLE (   name,
  f,
  help 
)
Value:
do \
if (args[0] == name) { \
if (args.size() <= 1) \
{ \
fail_msg_writer() << "set " << #name << ": " << tr("needs an argument") << " (" << help << ")"; \
return true; \
} \
else \
{ \
f(args); \
return true; \
} \
} while(0)
#define tr(x)
Definition: common_defines.h:4
const char * name
Definition: simplewallet.cpp:180

◆ DEFAULT_MIXIN

#define DEFAULT_MIXIN   0

◆ ELECTRONEUM_DEFAULT_LOG_CATEGORY

#define ELECTRONEUM_DEFAULT_LOG_CATEGORY   "wallet.simplewallet"

◆ EXTENDED_LOGS_FILE

#define EXTENDED_LOGS_FILE   "wallet_details.log"

◆ LOCK_IDLE_SCOPE

#define LOCK_IDLE_SCOPE ( )
Value:
bool auto_refresh_enabled = m_auto_refresh_enabled.load(std::memory_order_relaxed); \
m_auto_refresh_enabled.store(false, std::memory_order_relaxed); \
/* stop any background refresh, and take over */ \
m_wallet->stop(); \
m_idle_mutex.lock(); \
while (m_auto_refresh_refreshing) \
m_idle_cond.notify_one(); \
m_idle_mutex.unlock(); \
/* if (auto_refresh_run)*/ \
/*m_auto_refresh_thread.join();*/ \
boost::unique_lock<boost::mutex> lock(m_idle_mutex); \
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){ \
m_auto_refresh_enabled.store(auto_refresh_enabled, std::memory_order_relaxed); \
})

◆ OUTPUT_EXPORT_FILE_MAGIC

#define OUTPUT_EXPORT_FILE_MAGIC   "Electroneum output export\003"

Typedef Documentation

◆ sw

Enumeration Type Documentation

◆ TransferType

Enumerator
Transfer 
TransferLocked 

Function Documentation

◆ get_human_readable_timespan()

static std::string get_human_readable_timespan ( std::chrono::seconds  seconds)
static

◆ get_human_readable_timestamp()

static std::string get_human_readable_timestamp ( uint64_t  ts)
static

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ might_be_partial_seed()

static bool might_be_partial_seed ( std::string  words)
static