Monero C++ Library
monero_wallet_keys.h
1 
53 #pragma once
54 
55 #include "monero_wallet.h"
56 #include "cryptonote_basic/account.h"
57 
58 using namespace monero;
59 
63 namespace monero {
64 
69 
70  public:
71 
72  // --------------------------- STATIC WALLET UTILS --------------------------
73 
80  static monero_wallet_keys* create_wallet_random(const monero_network_type network_type, const std::string& language = "English");
81 
88  static monero_wallet_keys* create_wallet_from_mnemonic(const monero_network_type network_type, const std::string& mnemonic, const std::string& seed_offset);
89 
99  static monero_wallet_keys* create_wallet_from_keys(const monero_network_type network_type, const std::string& address, const std::string& view_key, const std::string& spend_key, const std::string& language = "English");
100 
106  static std::vector<std::string> get_mnemonic_languages();
107 
108  // ----------------------------- WALLET METHODS -----------------------------
109 
114 
118  bool is_view_only() const override { return m_is_view_only; }
119  monero_version get_version() const override;
120  monero_network_type get_network_type() const override { return m_network_type; }
121  std::string get_mnemonic() const override { return m_mnemonic; }
122  std::string get_mnemonic_language() const override { return m_language; }
123  std::string get_private_view_key() const override { return m_prv_view_key; }
124  std::string get_private_spend_key() const override { return m_prv_spend_key; }
125  std::string get_public_view_key() const override { return m_pub_view_key; }
126  std::string get_public_spend_key() const override { return m_pub_spend_key; }
127  std::string get_primary_address() const override { return m_primary_address; }
128  std::string get_address(const uint32_t account_idx, const uint32_t subaddress_idx) const override;
129  monero_integrated_address get_integrated_address(const std::string& standard_address = "", const std::string& payment_id = "") const override;
130  monero_integrated_address decode_integrated_address(const std::string& integrated_address) const override;
131  monero_account get_account(const uint32_t account_idx, bool include_subaddresses) const override;
132  std::vector<monero_subaddress> get_subaddresses(const uint32_t account_idx, const std::vector<uint32_t>& subaddress_indices) const override;
133  std::string sign_message(const std::string& msg) const override;
134  bool verify_message(const std::string& msg, const std::string& address, const std::string& signature) const override;
135  void close(bool save = false) override;
136 
137  // --------------------------------- PRIVATE --------------------------------
138 
139  private:
140  bool m_is_view_only;
141  monero_network_type m_network_type;
142  cryptonote::account_base m_account;
143  std::string m_mnemonic;
144  std::string m_language;
145  std::string m_pub_view_key;
146  std::string m_prv_view_key;
147  std::string m_pub_spend_key;
148  std::string m_prv_spend_key;
149  std::string m_primary_address;
150 
151  void init_common();
152  };
153 }
monero::monero_wallet_keys::sign_message
std::string sign_message(const std::string &msg) const override
Definition: monero_wallet_keys.cpp:277
monero::monero_wallet_keys::~monero_wallet_keys
~monero_wallet_keys()
Definition: monero_wallet_keys.cpp:209
monero
Definition: monero_daemon.cpp:58
monero::monero_wallet_keys::get_public_spend_key
std::string get_public_spend_key() const override
Definition: monero_wallet_keys.h:126
monero::monero_account
Definition: monero_wallet_model.h:96
monero::monero_wallet_keys::get_address
std::string get_address(const uint32_t account_idx, const uint32_t subaddress_idx) const override
Definition: monero_wallet_keys.cpp:221
monero::monero_wallet_keys::decode_integrated_address
monero_integrated_address decode_integrated_address(const std::string &integrated_address) const override
Definition: monero_wallet_keys.cpp:233
monero::monero_wallet_keys::get_account
monero_account get_account(const uint32_t account_idx, bool include_subaddresses) const override
Definition: monero_wallet_keys.cpp:238
monero::monero_wallet_keys::verify_message
bool verify_message(const std::string &msg, const std::string &address, const std::string &signature) const override
Definition: monero_wallet_keys.cpp:282
monero::monero_wallet_keys::create_wallet_from_keys
static monero_wallet_keys * create_wallet_from_keys(const monero_network_type network_type, const std::string &address, const std::string &view_key, const std::string &spend_key, const std::string &language="English")
Definition: monero_wallet_keys.cpp:128
monero::monero_wallet_keys::create_wallet_from_mnemonic
static monero_wallet_keys * create_wallet_from_mnemonic(const monero_network_type network_type, const std::string &mnemonic, const std::string &seed_offset)
Definition: monero_wallet_keys.cpp:98
monero::monero_wallet
Definition: monero_wallet.h:123
monero::monero_network_type
monero_network_type
Definition: monero_daemon_model.h:90
monero::monero_wallet_keys::get_version
monero_version get_version() const override
Definition: monero_wallet_keys.cpp:214
monero::monero_wallet_keys::is_view_only
bool is_view_only() const override
Definition: monero_wallet_keys.h:118
monero::monero_wallet_keys::get_subaddresses
std::vector< monero_subaddress > get_subaddresses(const uint32_t account_idx, const std::vector< uint32_t > &subaddress_indices) const override
Definition: monero_wallet_keys.cpp:254
monero::monero_wallet_keys::get_private_view_key
std::string get_private_view_key() const override
Definition: monero_wallet_keys.h:123
monero::monero_wallet_keys
Definition: monero_wallet_keys.h:68
monero::monero_integrated_address
Definition: monero_wallet_model.h:322
monero::monero_wallet_keys::get_network_type
monero_network_type get_network_type() const override
Definition: monero_wallet_keys.h:120
monero::monero_wallet_keys::get_public_view_key
std::string get_public_view_key() const override
Definition: monero_wallet_keys.h:125
monero::monero_wallet_keys::get_mnemonic_language
std::string get_mnemonic_language() const override
Definition: monero_wallet_keys.h:122
monero::monero_wallet_keys::get_mnemonic_languages
static std::vector< std::string > get_mnemonic_languages()
Definition: monero_wallet_keys.cpp:201
monero::monero_wallet_keys::get_integrated_address
monero_integrated_address get_integrated_address(const std::string &standard_address="", const std::string &payment_id="") const override
Definition: monero_wallet_keys.cpp:228
monero::monero_wallet_keys::create_wallet_random
static monero_wallet_keys * create_wallet_random(const monero_network_type network_type, const std::string &language="English")
Definition: monero_wallet_keys.cpp:76
monero::monero_wallet_keys::get_mnemonic
std::string get_mnemonic() const override
Definition: monero_wallet_keys.h:121
monero::monero_wallet_keys::get_primary_address
std::string get_primary_address() const override
Definition: monero_wallet_keys.h:127
monero::monero_wallet_keys::get_private_spend_key
std::string get_private_spend_key() const override
Definition: monero_wallet_keys.h:124
monero::monero_wallet_keys::close
void close(bool save=false) override
Definition: monero_wallet_keys.cpp:287
monero::monero_wallet::save
virtual void save()
Definition: monero_wallet.h:1291
monero::monero_version
Definition: monero_daemon_model.h:99