ledger-core
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
ledger::core::BitcoinLikeAccount Class Reference
+ Inheritance diagram for ledger::core::BitcoinLikeAccount:
+ Collaboration diagram for ledger::core::BitcoinLikeAccount:

Public Member Functions

 BitcoinLikeAccount (const std::shared_ptr< AbstractWallet > &wallet, int32_t index, const std::shared_ptr< BitcoinLikeBlockchainExplorer > &explorer, const std::shared_ptr< BitcoinLikeBlockchainObserver > &observer, const std::shared_ptr< BitcoinLikeAccountSynchronizer > &synchronizer, const std::shared_ptr< BitcoinLikeKeychain > &keychain)
 
std::shared_ptr< api::BitcoinLikeAccountasBitcoinLikeAccount () override
 
int putTransaction (soci::session &sql, const BitcoinLikeBlockchainExplorerTransaction &transaction)
 
bool putBlock (soci::session &sql, const BitcoinLikeBlockchainExplorer::Block &block)
 
std::shared_ptr< BitcoinLikeKeychaingetKeychain () const
 
void startBlockchainObservation () override
 
void stopBlockchainObservation () override
 
bool isObservingBlockchain () override
 
bool isSynchronizing () override
 
FuturePtr< ledger::core::AmountgetBalance () override
 
Future< std::vector< std::shared_ptr< api::Amount > > > getBalanceHistory (const std::string &start, const std::string &end, api::TimePeriod precision) override
 
FuturePtr< BitcoinLikeBlockchainExplorerTransactiongetTransaction (const std::string &hash)
 
std::shared_ptr< api::EventBussynchronize () override
 
void broadcastRawTransaction (const std::vector< uint8_t > &transaction, const std::shared_ptr< api::StringCallback > &callback) override
 
void broadcastTransaction (const std::shared_ptr< api::BitcoinLikeTransaction > &transaction, const std::shared_ptr< api::StringCallback > &callback) override
 
std::shared_ptr< api::BitcoinLikeTransactionBuilderbuildTransaction (std::experimental::optional< bool > partial) override
 
std::shared_ptr< api::OperationQueryqueryOperations () override
 
void getUTXO (int32_t from, int32_t to, const std::shared_ptr< api::BitcoinLikeOutputListCallback > &callback) override
 
Future< std::vector< std::shared_ptr< api::BitcoinLikeOutput > > > getUTXO ()
 
Future< std::vector< std::shared_ptr< api::BitcoinLikeOutput > > > getUTXO (int32_t from, int32_t to)
 
void getUTXOCount (const std::shared_ptr< api::I32Callback > &callback) override
 
Future< int32_t > getUTXOCount ()
 
Future< AddressList > getFreshPublicAddresses () override
 
Future< std::string > broadcastTransaction (const std::vector< uint8_t > &transaction)
 
std::string getRestoreKey () override
 
const std::shared_ptr< BitcoinLikeBlockchainExplorer > & getExplorer () const
 
Future< api::ErrorCodeeraseDataSince (const std::chrono::system_clock::time_point &date) override
 
void getFees (const std::shared_ptr< api::BigIntListCallback > &callback) override
 
- Public Member Functions inherited from ledger::core::api::BitcoinLikeAccount
virtual void getUTXO (int32_t from, int32_t to, const std::shared_ptr< BitcoinLikeOutputListCallback > &callback)=0
 
virtual void getUTXOCount (const std::shared_ptr< I32Callback > &callback)=0
 
virtual void broadcastRawTransaction (const std::vector< uint8_t > &transaction, const std::shared_ptr< StringCallback > &callback)=0
 
virtual void broadcastTransaction (const std::shared_ptr< BitcoinLikeTransaction > &transaction, const std::shared_ptr< StringCallback > &callback)=0
 
virtual void getFees (const std::shared_ptr< BigIntListCallback > &callback)=0
 
- Public Member Functions inherited from ledger::core::AbstractAccount
 AbstractAccount (const std::shared_ptr< AbstractWallet > &wallet, int32_t index)
 
int32_t getIndex () override
 
std::shared_ptr< api::PreferencesgetPreferences () override
 
std::shared_ptr< api::LoggergetLogger () override
 
bool isInstanceOfBitcoinLikeAccount () override
 
bool isInstanceOfEthereumLikeAccount () override
 
bool isInstanceOfRippleLikeAccount () override
 
api::WalletType getWalletType () override
 
std::shared_ptr< api::PreferencesgetOperationPreferences (const std::string &uid) override
 
std::shared_ptr< api::BitcoinLikeAccountasBitcoinLikeAccount () override
 
std::shared_ptr< api::EthereumLikeAccountasEthereumLikeAccount () override
 
std::shared_ptr< api::RippleLikeAccountasRippleLikeAccount () override
 
std::shared_ptr< api::TezosLikeAccountasTezosLikeAccount () override
 
virtual std::shared_ptr< PreferencesgetOperationExternalPreferences (const std::string &uid)
 
virtual std::shared_ptr< PreferencesgetOperationInternalPreferences (const std::string &uid)
 
virtual std::shared_ptr< PreferencesgetInternalPreferences () const
 
virtual std::shared_ptr< PreferencesgetExternalPreferences () const
 
virtual std::shared_ptr< spdlog::logger > logger () const
 
virtual const std::string & getAccountUid () const
 
virtual std::shared_ptr< AbstractWalletgetWallet () const
 
virtual std::shared_ptr< AbstractWalletgetWallet ()
 
const std::shared_ptr< api::ExecutionContextgetMainExecutionContext () const
 
void getLastBlock (const std::shared_ptr< api::BlockCallback > &callback) override
 
Future< api::BlockgetLastBlock ()
 
void getBalance (const std::shared_ptr< api::AmountCallback > &callback) override
 
void getFreshPublicAddresses (const std::shared_ptr< api::AddressListCallback > &callback) override
 
void getBalanceHistory (const std::string &start, const std::string &end, api::TimePeriod precision, const std::shared_ptr< api::AmountListCallback > &callback) override
 
std::shared_ptr< api::OperationQueryqueryOperations () override
 
std::shared_ptr< api::EventBusgetEventBus () override
 
void emitEventsNow ()
 
void eraseDataSince (const std::chrono::system_clock::time_point &date, const std::shared_ptr< api::ErrorCodeCallback > &callback) override
 
- Public Member Functions inherited from ledger::core::DedicatedContext
 DedicatedContext (const std::shared_ptr< api::ExecutionContext > &context)
 
template<typename T >
Future< T > async (std::function< T()> f)
 
template<typename T >
Future< T > async (std::function< T()> f) const
 
Future< Unitrun (std::function< void()> f)
 
std::shared_ptr< api::ExecutionContextgetContext () const
 
- Public Member Functions inherited from ledger::core::api::Account
virtual void getBalance (const std::shared_ptr< AmountCallback > &callback)=0
 
virtual void getBalanceHistory (const std::string &start, const std::string &end, TimePeriod period, const std::shared_ptr< AmountListCallback > &callback)=0
 
virtual void getFreshPublicAddresses (const std::shared_ptr< AddressListCallback > &callback)=0
 
virtual void getLastBlock (const std::shared_ptr< BlockCallback > &callback)=0
 
virtual void eraseDataSince (const std::chrono::system_clock::time_point &date, const std::shared_ptr< ErrorCodeCallback > &callback)=0
 

Static Public Attributes

static const int FLAG_NEW_TRANSACTION = 0x01
 
static const int FLAG_TRANSACTION_UPDATED = 0x01 << 1
 
static const int FLAG_TRANSACTION_IGNORED = 0x00
 
static const int FLAG_TRANSACTION_ON_PREVIOUSLY_EMPTY_ADDRESS = 0x01 << 2
 
static const int FLAG_TRANSACTION_ON_USED_ADDRESS = 0x01 << 3
 
static const int FLAG_TRANSACTION_CREATED_SENDING_OPERATION = 0x01 << 4
 
static const int FLAG_TRANSACTION_CREATED_RECEPTION_OPERATION = 0x01 << 5
 
- Static Public Attributes inherited from ledger::core::api::Account
static std::string const EV_SYNC_DURATION_MS = {"EV_SYNC_DURATION_MS"}
 
static std::string const EV_SYNC_ERROR_CODE = {"EV_SYNC_ERROR_CODE"}
 
static std::string const EV_SYNC_ERROR_CODE_INT = {"EV_SYNC_ERROR_CODE_INT"}
 
static std::string const EV_SYNC_ERROR_MESSAGE = {"EV_SYNC_ERROR_MESSAGE"}
 
static std::string const EV_NEW_BLOCK_CURRENCY_NAME = {"EV_NEW_BLOCK_CURRENCY_NAME"}
 
static std::string const EV_NEW_BLOCK_HASH = {"EV_NEW_BLOCK_HASH"}
 
static std::string const EV_NEW_BLOCK_HEIGHT = {"EV_NEW_BLOCK_HEIGHT"}
 
static std::string const EV_NEW_OP_WALLET_NAME = {"EV_NEW_OP_WALLET_NAME"}
 
static std::string const EV_NEW_OP_ACCOUNT_INDEX = {"EV_NEW_OP_ACCOUNT_INDEX"}
 
static std::string const EV_NEW_OP_UID = {"EV_NEW_OP_UID"}
 

Protected Member Functions

bool checkIfWalletIsEmpty ()
 
- Protected Member Functions inherited from ledger::core::AbstractAccount
void emitNewOperationEvent (const Operation &operation)
 
void emitNewBlockEvent (const Block &block)
 
void pushEvent (const std::shared_ptr< api::Event > &event)
 

Additional Inherited Members

- Public Types inherited from ledger::core::AbstractAccount
using AddressList = std::vector< std::shared_ptr< api::Address > >
 
- Protected Attributes inherited from ledger::core::DedicatedContext
std::shared_ptr< api::ExecutionContext_executionContext
 

Member Function Documentation

◆ asBitcoinLikeAccount()

std::shared_ptr< api::BitcoinLikeAccount > ledger::core::BitcoinLikeAccount::asBitcoinLikeAccount ( )
overridevirtual

Turn the account into an Bitcoin one, allowing operations to be performed on the Bitcoin network.

Implements ledger::core::api::Account.

◆ getRestoreKey()

std::string ledger::core::BitcoinLikeAccount::getRestoreKey ( )
overridevirtual

Get the key used to generate the account.

Implements ledger::core::api::Account.

◆ isObservingBlockchain()

bool ledger::core::BitcoinLikeAccount::isObservingBlockchain ( )
overridevirtual

Get account's observation status.

Returns
boolean

Implements ledger::core::api::Account.

◆ isSynchronizing()

bool ledger::core::BitcoinLikeAccount::isSynchronizing ( )
overridevirtual

Get synchronization status of account.

Returns
bool

Implements ledger::core::api::Account.

◆ putBlock()

bool ledger::core::BitcoinLikeAccount::putBlock ( soci::session &  sql,
const BitcoinLikeBlockchainExplorer::Block block 
)
Parameters
block
Returns
true if the block wasn't already known.

◆ putTransaction()

int ledger::core::BitcoinLikeAccount::putTransaction ( soci::session &  sql,
const BitcoinLikeBlockchainExplorerTransaction transaction 
)
Parameters
transaction
Returns
A flag indicating if the transaction was ignored, inserted

◆ queryOperations()

std::shared_ptr< api::OperationQuery > ledger::core::BitcoinLikeAccount::queryOperations ( )
overridevirtual

Get the list of all operations.

Implements ledger::core::api::Account.

◆ startBlockchainObservation()

void ledger::core::BitcoinLikeAccount::startBlockchainObservation ( )
overridevirtual

Start observing blockchain on which account synchronizes and send/receive transactions.

Implements ledger::core::api::Account.

◆ stopBlockchainObservation()

void ledger::core::BitcoinLikeAccount::stopBlockchainObservation ( )
overridevirtual

Stop observing blockchain.

Implements ledger::core::api::Account.

◆ synchronize()

std::shared_ptr< api::EventBus > ledger::core::BitcoinLikeAccount::synchronize ( )
overridevirtual

Start synchronization of account.

Returns
EventBus, handler will be notified of synchronization outcome

Implements ledger::core::api::Account.


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