Electroneum
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Electroneum::WalletManagerImpl Class Reference

#include <wallet_manager.h>

Inheritance diagram for Electroneum::WalletManagerImpl:
Inheritance graph
[legend]
Collaboration diagram for Electroneum::WalletManagerImpl:
Collaboration graph
[legend]

Public Member Functions

WalletcreateWallet (const std::string &path, const std::string &password, const std::string &language, bool testnet)
 Creates new wallet. More...
 
WalletopenWallet (const std::string &path, const std::string &password, bool testnet)
 Opens existing wallet. More...
 
virtual WalletrecoveryWallet (const std::string &path, const std::string &memo, bool testnet, uint64_t restoreHeight)
 recovers existing wallet using memo (electrum seed) More...
 
virtual WalletcreateWalletFromKeys (const std::string &path, const std::string &language, bool testnet, uint64_t restoreHeight, const std::string &addressString, const std::string &viewKeyString, const std::string &spendKeyString="")
 recovers existing wallet using keys. Creates a view only wallet if spend key is omitted More...
 
virtual bool closeWallet (Wallet *wallet)
 Closes wallet. In case operation succeded, wallet object deleted. in case operation failed, wallet object not deleted. More...
 
bool walletExists (const std::string &path)
 TODO: delme walletExists - check if the given filename is the wallet. More...
 
bool verifyWalletPassword (const std::string &keys_file_name, const std::string &password, bool watch_only) const
 verifyWalletPassword - check if the given filename is the wallet More...
 
std::vector< std::string > findWallets (const std::string &path)
 findWallets - searches for the wallet files by given path name recursively More...
 
std::string errorString () const
 returns verbose error string regarding last error; More...
 
void setDaemonAddress (const std::string &address)
 set the daemon address (hostname and port) More...
 
bool connected (uint32_t *version=NULL) const
 returns whether the daemon can be reached, and its version number More...
 
bool checkPayment (const std::string &address, const std::string &txid, const std::string &txkey, const std::string &daemon_address, uint64_t &received, uint64_t &height, std::string &error) const
 checkPayment - checks a payment was made using a txkey More...
 
uint64_t blockchainHeight () const
 returns current blockchain height More...
 
uint64_t blockchainTargetHeight () const
 returns current blockchain target height More...
 
uint64_t networkDifficulty () const
 returns current network difficulty More...
 
double miningHashRate () const
 returns current mining hash rate (0 if not mining) More...
 
uint64_t blockTarget () const
 returns current block target More...
 
bool isMining () const
 returns true iff mining More...
 
bool startMining (const std::string &address, uint32_t threads=1, bool background_mining=false, bool ignore_battery=true)
 starts mining with the set number of threads More...
 
bool stopMining ()
 stops mining More...
 
std::string resolveOpenAlias (const std::string &address, bool &dnssec_valid) const
 resolves an OpenAlias address to a electroneum address More...
 

Private Member Functions

 WalletManagerImpl ()
 

Private Attributes

std::string m_daemonAddress
 
std::string m_errorString
 

Friends

struct WalletManagerFactory
 

Additional Inherited Members

- Static Public Member Functions inherited from Electroneum::WalletManager
static std::tuple< bool, std::string, std::string, std::string, std::string > checkUpdates (const std::string &software, const std::string &subdir)
 checks for an update and returns version, hash and url More...
 

Constructor & Destructor Documentation

◆ WalletManagerImpl()

Electroneum::WalletManagerImpl::WalletManagerImpl ( )
inlineprivate

Member Function Documentation

◆ blockchainHeight()

uint64_t Electroneum::WalletManagerImpl::blockchainHeight ( ) const
virtual

returns current blockchain height

Implements Electroneum::WalletManager.

◆ blockchainTargetHeight()

uint64_t Electroneum::WalletManagerImpl::blockchainTargetHeight ( ) const
virtual

returns current blockchain target height

Implements Electroneum::WalletManager.

◆ blockTarget()

uint64_t Electroneum::WalletManagerImpl::blockTarget ( ) const
virtual

returns current block target

Implements Electroneum::WalletManager.

◆ checkPayment()

bool Electroneum::WalletManagerImpl::checkPayment ( const std::string &  address,
const std::string &  txid,
const std::string &  txkey,
const std::string &  daemon_address,
uint64_t &  received,
uint64_t &  height,
std::string &  error 
) const
virtual

checkPayment - checks a payment was made using a txkey

Parameters
address- the address the payment was sent to
txid- the transaction id for that payment
txkey- the transaction's secret key
daemon_address- the address (host and port) to the daemon to request transaction data
received- if succesful, will hold the amount of electroneum received
height- if succesful, will hold the height of the transaction (0 if only in the pool)
error- if unsuccesful, will hold an error string with more information about the error
Returns
- true is succesful, false otherwise

Implements Electroneum::WalletManager.

◆ closeWallet()

bool Electroneum::WalletManagerImpl::closeWallet ( Wallet wallet)
virtual

Closes wallet. In case operation succeded, wallet object deleted. in case operation failed, wallet object not deleted.

Parameters
walletpreviously opened / created wallet instance
Returns
None

Implements Electroneum::WalletManager.

◆ connected()

bool Electroneum::WalletManagerImpl::connected ( uint32_t *  version = NULL) const
virtual

returns whether the daemon can be reached, and its version number

Implements Electroneum::WalletManager.

◆ createWallet()

Wallet * Electroneum::WalletManagerImpl::createWallet ( const std::string &  path,
const std::string &  password,
const std::string &  language,
bool  testnet 
)
virtual

Creates new wallet.

Parameters
pathName of wallet file
passwordPassword of wallet file
languageLanguage to be used to generate electrum seed memo
Returns
Wallet instance (Wallet::status() needs to be called to check if created successfully)

Implements Electroneum::WalletManager.

◆ createWalletFromKeys()

Wallet * Electroneum::WalletManagerImpl::createWalletFromKeys ( const std::string &  path,
const std::string &  language,
bool  testnet,
uint64_t  restoreHeight,
const std::string &  addressString,
const std::string &  viewKeyString,
const std::string &  spendKeyString = "" 
)
virtual

recovers existing wallet using keys. Creates a view only wallet if spend key is omitted

Parameters
pathName of wallet file to be created
languagelanguage
testnettestnet
restoreHeightrestore from start height
addressStringpublic address
viewKeyStringview key
spendKeyStringspend key (optional)
Returns
Wallet instance (Wallet::status() needs to be called to check if recovered successfully)

Implements Electroneum::WalletManager.

◆ errorString()

std::string Electroneum::WalletManagerImpl::errorString ( ) const
virtual

returns verbose error string regarding last error;

Implements Electroneum::WalletManager.

◆ findWallets()

std::vector< std::string > Electroneum::WalletManagerImpl::findWallets ( const std::string &  path)
virtual

findWallets - searches for the wallet files by given path name recursively

Parameters
path- starting point to search
Returns
- list of strings with found wallets (absolute paths);

Implements Electroneum::WalletManager.

◆ isMining()

bool Electroneum::WalletManagerImpl::isMining ( ) const
virtual

returns true iff mining

Implements Electroneum::WalletManager.

◆ miningHashRate()

double Electroneum::WalletManagerImpl::miningHashRate ( ) const
virtual

returns current mining hash rate (0 if not mining)

Implements Electroneum::WalletManager.

◆ networkDifficulty()

uint64_t Electroneum::WalletManagerImpl::networkDifficulty ( ) const
virtual

returns current network difficulty

Implements Electroneum::WalletManager.

◆ openWallet()

Wallet * Electroneum::WalletManagerImpl::openWallet ( const std::string &  path,
const std::string &  password,
bool  testnet 
)
virtual

Opens existing wallet.

Parameters
pathName of wallet file
passwordPassword of wallet file
Returns
Wallet instance (Wallet::status() needs to be called to check if opened successfully)

Implements Electroneum::WalletManager.

◆ recoveryWallet()

Wallet * Electroneum::WalletManagerImpl::recoveryWallet ( const std::string &  path,
const std::string &  memo,
bool  testnet,
uint64_t  restoreHeight 
)
virtual

recovers existing wallet using memo (electrum seed)

Parameters
pathName of wallet file to be created
memomemo (25 words electrum seed)
testnettestnet
restoreHeightrestore from start height
Returns
Wallet instance (Wallet::status() needs to be called to check if recovered successfully)

Implements Electroneum::WalletManager.

◆ resolveOpenAlias()

std::string Electroneum::WalletManagerImpl::resolveOpenAlias ( const std::string &  address,
bool dnssec_valid 
) const
virtual

resolves an OpenAlias address to a electroneum address

Implements Electroneum::WalletManager.

◆ setDaemonAddress()

void Electroneum::WalletManagerImpl::setDaemonAddress ( const std::string &  address)
virtual

set the daemon address (hostname and port)

Implements Electroneum::WalletManager.

◆ startMining()

bool Electroneum::WalletManagerImpl::startMining ( const std::string &  address,
uint32_t  threads = 1,
bool  background_mining = false,
bool  ignore_battery = true 
)
virtual

starts mining with the set number of threads

Implements Electroneum::WalletManager.

◆ stopMining()

bool Electroneum::WalletManagerImpl::stopMining ( )
virtual

stops mining

Implements Electroneum::WalletManager.

◆ verifyWalletPassword()

bool Electroneum::WalletManagerImpl::verifyWalletPassword ( const std::string &  keys_file_name,
const std::string &  password,
bool  watch_only 
) const
virtual

verifyWalletPassword - check if the given filename is the wallet

Parameters
keys_file_name- location of keys file
password- password to verify
watch_only- verify only view keys?
Returns
- true if password is correct

Implements Electroneum::WalletManager.

◆ walletExists()

bool Electroneum::WalletManagerImpl::walletExists ( const std::string &  path)
virtual

TODO: delme walletExists - check if the given filename is the wallet.

Parameters
path- filename
Returns
- true if wallet exists

Implements Electroneum::WalletManager.

Friends And Related Function Documentation

◆ WalletManagerFactory

friend struct WalletManagerFactory
friend

Member Data Documentation

◆ m_daemonAddress

std::string Electroneum::WalletManagerImpl::m_daemonAddress
private

◆ m_errorString

std::string Electroneum::WalletManagerImpl::m_errorString
private

The documentation for this class was generated from the following files: