mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-19 16:18:40 +02:00
get_mnemonic_languages() as static wallet util
This commit is contained in:
@@ -115,7 +115,7 @@ namespace monero {
|
||||
// forward declaration of internal wallet2 listener
|
||||
struct wallet2_listener;
|
||||
|
||||
// ---------------------------- WALLET INTERFACE ----------------------------
|
||||
// ----------------------------- WALLET METHODS -----------------------------
|
||||
|
||||
/**
|
||||
* Base wallet with default implementations.
|
||||
@@ -239,15 +239,6 @@ namespace monero {
|
||||
throw runtime_error("get_mnemonic_language() not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of available languages for the wallet's mnemonic phrase.
|
||||
*
|
||||
* @return the available languages for the wallet's mnemonic phrase
|
||||
*/
|
||||
virtual vector<string> get_languages() const {
|
||||
throw runtime_error("get_languages() not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wallet's public view key.
|
||||
*
|
||||
|
||||
@@ -787,7 +787,7 @@ namespace monero {
|
||||
monero_sync_listener& listener;
|
||||
};
|
||||
|
||||
// ---------------------------- WALLET MANAGEMENT ---------------------------
|
||||
// --------------------------- STATIC WALLET UTILS --------------------------
|
||||
|
||||
bool monero_wallet_core::wallet_exists(const string& path) {
|
||||
MTRACE("wallet_exists(" << path << ")");
|
||||
@@ -915,13 +915,19 @@ namespace monero {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
vector<string> monero_wallet_core::get_mnemonic_languages() {
|
||||
vector<string> languages;
|
||||
crypto::ElectrumWords::get_language_list(languages, true);
|
||||
return languages;
|
||||
}
|
||||
|
||||
// ----------------------------- WALLET METHODS -----------------------------
|
||||
|
||||
monero_wallet_core::~monero_wallet_core() {
|
||||
MTRACE("~monero_wallet_core()");
|
||||
close(false);
|
||||
}
|
||||
|
||||
// ----------------------------- WALLET METHODS -----------------------------
|
||||
|
||||
void monero_wallet_core::set_daemon_connection(const string& uri, const string& username, const string& password) {
|
||||
MTRACE("set_daemon_connection(" << uri << ", " << username << ", " << password << ")");
|
||||
|
||||
@@ -1006,12 +1012,6 @@ namespace monero {
|
||||
return m_w2->get_seed_language();
|
||||
}
|
||||
|
||||
vector<string> monero_wallet_core::get_languages() const {
|
||||
vector<string> languages;
|
||||
crypto::ElectrumWords::get_language_list(languages, true);
|
||||
return languages;
|
||||
}
|
||||
|
||||
string monero_wallet_core::get_public_view_key() const {
|
||||
MTRACE("get_private_view_key()");
|
||||
return epee::string_tools::pod_to_hex(m_w2->get_account().get_keys().m_account_address.m_view_public_key);
|
||||
|
||||
@@ -68,12 +68,12 @@ using namespace monero;
|
||||
*/
|
||||
namespace monero {
|
||||
|
||||
// --------------------------------- LISTENERS ------------------------------
|
||||
// -------------------------------- LISTENERS -------------------------------
|
||||
|
||||
// forward declaration of internal wallet2 listener
|
||||
struct wallet2_listener;
|
||||
|
||||
// ---------------------------- WALLET INTERFACE ----------------------------
|
||||
// --------------------------- STATIC WALLET UTILS --------------------------
|
||||
|
||||
/**
|
||||
* Monero wallet implmentation which uses monero-project's wallet2.
|
||||
@@ -140,6 +140,15 @@ namespace monero {
|
||||
static monero_wallet_core* create_wallet_from_keys(const string& path, const string& password, const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height);
|
||||
static monero_wallet_core* create_wallet_from_keys(const string& path, const string& password, const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const monero_rpc_connection& daemon_connection, uint64_t restore_height, const string& language);
|
||||
|
||||
/**
|
||||
* Get a list of available languages for the wallet's mnemonic phrase.
|
||||
*
|
||||
* @return the available languages for the wallet's mnemonic phrase
|
||||
*/
|
||||
static vector<string> get_mnemonic_languages();
|
||||
|
||||
// ----------------------------- WALLET METHODS -----------------------------
|
||||
|
||||
/**
|
||||
* Destruct the wallet.
|
||||
*/
|
||||
@@ -160,7 +169,6 @@ namespace monero {
|
||||
monero_network_type get_network_type() const;
|
||||
string get_mnemonic() const;
|
||||
string get_mnemonic_language() const;
|
||||
vector<string> get_languages() const;
|
||||
string get_public_view_key() const;
|
||||
string get_private_view_key() const;
|
||||
string get_public_spend_key() const;
|
||||
|
||||
@@ -183,6 +183,12 @@ namespace monero {
|
||||
return wallet;
|
||||
}
|
||||
|
||||
vector<string> monero_wallet_keys::get_mnemonic_languages() {
|
||||
vector<string> languages;
|
||||
crypto::ElectrumWords::get_language_list(languages, true);
|
||||
return languages;
|
||||
}
|
||||
|
||||
// ----------------------------- WALLET METHODS -----------------------------
|
||||
|
||||
monero_wallet_keys::~monero_wallet_keys() {
|
||||
@@ -197,11 +203,6 @@ namespace monero {
|
||||
return version;
|
||||
}
|
||||
|
||||
vector<string> monero_wallet_keys::get_languages() const {
|
||||
cout << "monero_wallet_keys::get_languages()" << endl;
|
||||
throw runtime_error("monero_wallet_keys::get_languages() not implemented");
|
||||
}
|
||||
|
||||
string monero_wallet_keys::get_address(uint32_t account_idx, uint32_t subaddress_idx) const {
|
||||
hw::device &hwdev = m_account.get_device();
|
||||
cryptonote::subaddress_index index{account_idx, subaddress_idx};
|
||||
|
||||
@@ -70,6 +70,8 @@ namespace monero {
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------- STATIC WALLET UTILS --------------------------
|
||||
|
||||
/**
|
||||
* Create a new wallet with a randomly generated seed.
|
||||
*
|
||||
@@ -97,6 +99,15 @@ namespace monero {
|
||||
*/
|
||||
static monero_wallet_keys* create_wallet_from_keys(const monero_network_type network_type, const string& address, const string& view_key, const string& spend_key, const string& language = "English");
|
||||
|
||||
/**
|
||||
* Get a list of available languages for the wallet's mnemonic phrase.
|
||||
*
|
||||
* @return the available languages for the wallet's mnemonic phrase
|
||||
*/
|
||||
static vector<string> get_mnemonic_languages();
|
||||
|
||||
// ----------------------------- WALLET METHODS -----------------------------
|
||||
|
||||
/**
|
||||
* Destruct the wallet.
|
||||
*/
|
||||
@@ -109,7 +120,6 @@ namespace monero {
|
||||
monero_network_type get_network_type() const { return m_network_type; }
|
||||
string get_mnemonic() const { return m_mnemonic; }
|
||||
string get_mnemonic_language() const { return m_language; }
|
||||
vector<string> get_languages() const;
|
||||
string get_private_view_key() const { return m_prv_view_key; }
|
||||
string get_private_spend_key() const { return m_prv_spend_key; }
|
||||
string get_public_view_key() const { return m_pub_view_key; }
|
||||
|
||||
Reference in New Issue
Block a user