Monero C++ Library
monero_wallet_keys.h
1
53#pragma once
54
55#include "monero_wallet.h"
56#include "cryptonote_basic/account.h"
57
58using namespace monero;
59
63namespace 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, monero_message_signature_type signature_type, uint32_t account_idx = 0, uint32_t subaddress_idx = 0) const override;
134 monero_message_signature_result 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}
Definition: monero_wallet_keys.h:68
monero_account get_account(const uint32_t account_idx, bool include_subaddresses) const override
Definition: monero_wallet_keys.cpp:242
std::string get_private_view_key() const override
Definition: monero_wallet_keys.h:123
void close(bool save=false) override
Definition: monero_wallet_keys.cpp:291
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:258
monero_version get_version() const override
Definition: monero_wallet_keys.cpp:218
monero_message_signature_result verify_message(const std::string &msg, const std::string &address, const std::string &signature) const override
Definition: monero_wallet_keys.cpp:286
bool is_view_only() const override
Definition: monero_wallet_keys.h:118
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
std::string sign_message(const std::string &msg, monero_message_signature_type signature_type, uint32_t account_idx=0, uint32_t subaddress_idx=0) const override
Definition: monero_wallet_keys.cpp:281
static std::vector< std::string > get_mnemonic_languages()
Definition: monero_wallet_keys.cpp:205
~monero_wallet_keys()
Definition: monero_wallet_keys.cpp:213
std::string get_public_spend_key() const override
Definition: monero_wallet_keys.h:126
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
std::string get_mnemonic_language() const override
Definition: monero_wallet_keys.h:122
monero_integrated_address get_integrated_address(const std::string &standard_address="", const std::string &payment_id="") const override
Definition: monero_wallet_keys.cpp:232
std::string get_primary_address() const override
Definition: monero_wallet_keys.h:127
std::string get_public_view_key() const override
Definition: monero_wallet_keys.h:125
std::string get_address(const uint32_t account_idx, const uint32_t subaddress_idx) const override
Definition: monero_wallet_keys.cpp:225
std::string get_mnemonic() const override
Definition: monero_wallet_keys.h:121
std::string get_private_spend_key() const override
Definition: monero_wallet_keys.h:124
monero_integrated_address decode_integrated_address(const std::string &integrated_address) const override
Definition: monero_wallet_keys.cpp:237
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_network_type get_network_type() const override
Definition: monero_wallet_keys.h:120
Definition: monero_wallet.h:123
virtual void save()
Definition: monero_wallet.h:1380
Definition: monero_daemon.cpp:58
monero_message_signature_type
Definition: monero_wallet_model.h:415
monero_network_type
Definition: monero_daemon_model.h:90
Definition: monero_wallet_model.h:126
Definition: monero_wallet_model.h:353
Definition: monero_wallet_model.h:423
Definition: monero_daemon_model.h:99