Electroneum
Public Member Functions | Static Public Member Functions | List of all members
Electroneum::WalletManager Struct Referenceabstract

WalletManager - provides functions to manage wallets. More...

#include <wallet2_api.h>

Inheritance diagram for Electroneum::WalletManager:
Inheritance graph
[legend]

Public Member Functions

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

Static Public Member Functions

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...
 

Detailed Description

WalletManager - provides functions to manage wallets.

Member Function Documentation

◆ blockchainHeight()

virtual uint64_t Electroneum::WalletManager::blockchainHeight ( ) const
pure virtual

returns current blockchain height

Implemented in Electroneum::WalletManagerImpl.

◆ blockchainTargetHeight()

virtual uint64_t Electroneum::WalletManager::blockchainTargetHeight ( ) const
pure virtual

returns current blockchain target height

Implemented in Electroneum::WalletManagerImpl.

◆ blockTarget()

virtual uint64_t Electroneum::WalletManager::blockTarget ( ) const
pure virtual

returns current block target

Implemented in Electroneum::WalletManagerImpl.

◆ checkPayment()

virtual bool Electroneum::WalletManager::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
pure 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

Implemented in Electroneum::WalletManagerImpl.

◆ checkUpdates()

std::tuple< bool, std::string, std::string, std::string, std::string > Electroneum::WalletManager::checkUpdates ( const std::string &  software,
const std::string &  subdir 
)
static

checks for an update and returns version, hash and url

◆ closeWallet()

virtual bool Electroneum::WalletManager::closeWallet ( Wallet wallet)
pure 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

Implemented in Electroneum::WalletManagerImpl.

◆ connected()

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

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

Implemented in Electroneum::WalletManagerImpl.

◆ createWallet()

virtual Wallet* Electroneum::WalletManager::createWallet ( const std::string &  path,
const std::string &  password,
const std::string &  language,
bool  testnet = false 
)
pure 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)

Implemented in Electroneum::WalletManagerImpl.

◆ createWalletFromKeys()

virtual Wallet* Electroneum::WalletManager::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 = "" 
)
pure 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)

Implemented in Electroneum::WalletManagerImpl.

◆ errorString()

virtual std::string Electroneum::WalletManager::errorString ( ) const
pure virtual

returns verbose error string regarding last error;

Implemented in Electroneum::WalletManagerImpl.

◆ findWallets()

virtual std::vector<std::string> Electroneum::WalletManager::findWallets ( const std::string &  path)
pure 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);

Implemented in Electroneum::WalletManagerImpl.

◆ isMining()

virtual bool Electroneum::WalletManager::isMining ( ) const
pure virtual

returns true iff mining

Implemented in Electroneum::WalletManagerImpl.

◆ miningHashRate()

virtual double Electroneum::WalletManager::miningHashRate ( ) const
pure virtual

returns current mining hash rate (0 if not mining)

Implemented in Electroneum::WalletManagerImpl.

◆ networkDifficulty()

virtual uint64_t Electroneum::WalletManager::networkDifficulty ( ) const
pure virtual

returns current network difficulty

Implemented in Electroneum::WalletManagerImpl.

◆ openWallet()

virtual Wallet* Electroneum::WalletManager::openWallet ( const std::string &  path,
const std::string &  password,
bool  testnet = false 
)
pure 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)

Implemented in Electroneum::WalletManagerImpl.

◆ recoveryWallet()

virtual Wallet* Electroneum::WalletManager::recoveryWallet ( const std::string &  path,
const std::string &  memo,
bool  testnet = false,
uint64_t  restoreHeight = 0 
)
pure 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)

Implemented in Electroneum::WalletManagerImpl.

◆ resolveOpenAlias()

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

resolves an OpenAlias address to a electroneum address

Implemented in Electroneum::WalletManagerImpl.

◆ setDaemonAddress()

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

set the daemon address (hostname and port)

Implemented in Electroneum::WalletManagerImpl.

◆ startMining()

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

starts mining with the set number of threads

Implemented in Electroneum::WalletManagerImpl.

◆ stopMining()

virtual bool Electroneum::WalletManager::stopMining ( )
pure virtual

stops mining

Implemented in Electroneum::WalletManagerImpl.

◆ verifyWalletPassword()

virtual bool Electroneum::WalletManager::verifyWalletPassword ( const std::string &  keys_file_name,
const std::string &  password,
bool  watch_only 
) const
pure 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

Implemented in Electroneum::WalletManagerImpl.

◆ walletExists()

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

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

Parameters
path- filename
Returns
- true if wallet exists

Implemented in Electroneum::WalletManagerImpl.


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