ledger-core
|
#include <WalletPool.hpp>
Public Member Functions | |
virtual std::shared_ptr< Logger > | getLogger ()=0 |
virtual std::string | getName ()=0 |
virtual std::shared_ptr< Preferences > | getPreferences ()=0 |
virtual void | getWalletCount (const std::shared_ptr< I32Callback > &callback)=0 |
virtual void | getWallets (int32_t from, int32_t size, const std::shared_ptr< WalletListCallback > &callback)=0 |
virtual void | getWallet (const std::string &name, const std::shared_ptr< WalletCallback > &callback)=0 |
virtual void | updateWalletConfig (const std::string &name, const std::shared_ptr< DynamicObject > &configuration, const std::shared_ptr< ErrorCodeCallback > &callback)=0 |
virtual void | createWallet (const std::string &name, const Currency ¤cy, const std::shared_ptr< DynamicObject > &configuration, const std::shared_ptr< WalletCallback > &callback)=0 |
virtual void | getCurrencies (const std::shared_ptr< CurrencyListCallback > &callback)=0 |
virtual void | getCurrency (const std::string &name, const std::shared_ptr< CurrencyCallback > &callback)=0 |
virtual void | getLastBlock (const std::string ¤cyName, const std::shared_ptr< BlockCallback > &callback)=0 |
virtual std::shared_ptr< EventBus > | getEventBus ()=0 |
virtual void | eraseDataSince (const std::chrono::system_clock::time_point &date, const std::shared_ptr< ErrorCodeCallback > &callback)=0 |
virtual void | freshResetAll (const std::shared_ptr< ErrorCodeCallback > &callback)=0 |
virtual void | changePassword (const std::string &oldPassword, const std::string &newPassword, const std::shared_ptr< ErrorCodeCallback > &callback)=0 |
Static Public Member Functions | |
static std::shared_ptr< WalletPool > | newInstance (const std::string &name, const std::string &password, const std::shared_ptr< HttpClient > &httpClient, const std::shared_ptr< WebSocketClient > &webSocketClient, const std::shared_ptr< PathResolver > &pathResolver, const std::shared_ptr< LogPrinter > &logPrinter, const std::shared_ptr< ThreadDispatcher > &dispatcher, const std::shared_ptr< RandomNumberGenerator > &rng, const std::shared_ptr< DatabaseBackend > &backend, const std::shared_ptr< DynamicObject > &configuration) |
Class respresenting a pool of wallets.
|
pure virtual |
Change Database password.
Allow to change password of database holding all informations about accounts, wallets, transactions etc. and the wallet pool preferences.
WARNING: be careful to have no other instances of WalletPool using same database / preferences.
|
pure virtual |
Instanciate a new wallet under wallet pool.
name,string,name | of newly created wallet |
currency,Currency | object, currency of the wallet |
configuration,DynamicObject | object, configuration of wallet (preferences) |
callback,Callback | object returning a Wallet object |
|
pure virtual |
Erase data (in user's DB) relative to wallet since given date.
date,start | date of data deletion |
|
pure virtual |
Reset wallet pool.
Resetting the wallet pool is an irreversible fresh reset of the whole wallet pool and all of its created (sub-)objects (wallets, accounts, transactions, etc.). Please consider a less destructive option before opting to use this. However, if you’re looking for a way to end up as if you were in a “fresh install” situation, this is the function to go to.
Final warning: this function effectively swipes off everything. You’ve been warned.
Note: when calling that function, you must re-create a WalletPool as all objects got destroyed. Consider restarting / exiting your application right after calling that function. You are also highly advised to run that function on a code path that doesn’t include having lots of objects in memory.
The return value is always true and doesn’t convey any useful information for now.
|
pure virtual |
Return all supported currencies by wallet pool, at least one wallet support one of returned currencies.
callback,ListCallback | object, returns a list of Currency objects |
|
pure virtual |
|
pure virtual |
Get event bus (handler) through which wallet pool observe and gets notified (explorers, DBs ...).
EventBus | object |
Implemented in ledger::core::WalletPoolApi.
|
pure virtual |
|
pure virtual |
Return used logger to dump logs in defined log path by PathResolver.
Implemented in ledger::core::WalletPoolApi.
|
pure virtual |
|
pure virtual |
Return preferences of wallet pool (deduced from configuration).
Implemented in ledger::core::WalletPoolApi.
|
pure virtual |
|
pure virtual |
Return number of wallets instanciated under wallet pool.
callback,Callback | object returns a 32 bits integer, count of wallets |
|
pure virtual |
Get instanciated wallets having index in a given range.
from,32 | bits integer, lower bound of indices to pick |
to,32 | bits integer, upper bound of indices to pick |
callback,ListCallback | object returns a list of Wallet objects |
|
static |
Create a new instance of WalletPool object.
name,string,name | of the wallet pool |
password,string,password | to lock wallet pool (empty string means no password) |
http,HttpClient | object, http client used for all calls made by wallet pool (and aggregated wallets) |
webSocketClient,WebSocketClient | object, socket through which wallet pool observe and get notified (explorer, DBs ...) |
pathResolver,PathResolver | Object, resolve paths to logs, databases, preferences ... |
logPrinter,LogPrinter | object, used to dump/log for debug purpose |
dispatcher,ThreadDispatcher | object, responsable of dispatching task through available threads |
rng,RandomNumberGenerator | object, needed for generating random numbers (for seeds, salts ...) |
backend,DatabseBackend | object, DB in which wallet pool store all required infos (created wallets, their options, their accounts ...) |
configuration,DynamicObject | object, desired configuration for this wallet pool |
|
pure virtual |
Update wallet configuration
name,string,name | of wallet to update |
configuration,DynamicObject | object, configuration object with fields to update |
callback,Callback | object returns the error code, returns ErrorCode::FUTURE_WAS_SUCCESSFULL if everything is fine
|