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

Public Member Functions

 EthereumLikeAccount (const std::shared_ptr< AbstractWallet > &wallet, int32_t index, const std::shared_ptr< EthereumLikeBlockchainExplorer > &explorer, const std::shared_ptr< EthereumLikeBlockchainObserver > &observer, const std::shared_ptr< EthereumLikeAccountSynchronizer > &synchronizer, const std::shared_ptr< EthereumLikeKeychain > &keychain)
 
FuturePtr< EthereumLikeBlockchainExplorerTransactiongetTransaction (const std::string &hash)
 
void inflateOperation (Operation &out, const std::shared_ptr< const AbstractWallet > &wallet, const EthereumLikeBlockchainExplorerTransaction &tx)
 
int putTransaction (soci::session &sql, const EthereumLikeBlockchainExplorerTransaction &transaction)
 
std::vector< OperationgetInternalOperations (soci::session &sql)
 Get internal transactions related to the parent operation.
 
void updateERC20Accounts (soci::session &sql, const Operation &operation)
 
void updateERC20Operation (soci::session &sql, const Operation &operation, const ERC20Transaction &erc20Tx)
 
void updateInternalTransactions (soci::session &sql, const Operation &operation)
 
bool putBlock (soci::session &sql, const EthereumLikeBlockchainExplorer::Block &block)
 
std::shared_ptr< EthereumLikeKeychaingetKeychain () const
 
FuturePtr< AmountgetBalance () override
 
Future< AbstractAccount::AddressList > getFreshPublicAddresses () override
 
Future< std::vector< std::shared_ptr< api::Amount > > > getBalanceHistory (const std::string &start, const std::string &end, api::TimePeriod precision) override
 
Future< api::ErrorCodeeraseDataSince (const std::chrono::system_clock::time_point &date) override
 
bool isSynchronizing () override
 
std::shared_ptr< api::EventBussynchronize () override
 
void startBlockchainObservation () override
 
void stopBlockchainObservation () override
 
bool isObservingBlockchain () override
 
std::string getRestoreKey () override
 
void broadcastRawTransaction (const std::vector< uint8_t > &transaction, const std::shared_ptr< api::StringCallback > &callback) override
 
void broadcastTransaction (const std::shared_ptr< api::EthereumLikeTransaction > &transaction, const std::shared_ptr< api::StringCallback > &callback) override
 
std::shared_ptr< api::EthereumLikeTransactionBuilderbuildTransaction () override
 
std::shared_ptr< api::OperationQueryqueryOperations () override
 
std::shared_ptr< api::EthereumLikeAccountasEthereumLikeAccount () override
 
std::vector< std::shared_ptr< api::ERC20LikeAccount > > getERC20Accounts () override
 
void getGasPrice (const std::shared_ptr< api::BigIntCallback > &callback) override
 
void getEstimatedGasLimit (const std::string &address, const std::shared_ptr< api::BigIntCallback > &callback) override
 
FuturePtr< api::BigIntgetERC20Balance (const std::string &erc20Address)
 
void getERC20Balance (const std::string &erc20Address, const std::shared_ptr< api::BigIntCallback > &callback) override
 
Future< std::vector< std::shared_ptr< api::BigInt > > > getERC20Balances (const std::vector< std::string > &erc20Addresses)
 
void getERC20Balances (const std::vector< std::string > &erc20Addresses, const std::shared_ptr< api::BigIntListCallback > &callback) override
 
void addERC20Accounts (soci::session &sql, const std::vector< ERC20LikeAccountDatabaseEntry > &erc20Entries)
 
- Public Member Functions inherited from ledger::core::api::EthereumLikeAccount
virtual void broadcastRawTransaction (const std::vector< uint8_t > &transaction, const std::shared_ptr< StringCallback > &callback)=0
 
virtual void broadcastTransaction (const std::shared_ptr< EthereumLikeTransaction > &transaction, const std::shared_ptr< StringCallback > &callback)=0
 
virtual void getGasPrice (const std::shared_ptr< BigIntCallback > &callback)=0
 
virtual void getEstimatedGasLimit (const std::string &address, const std::shared_ptr< BigIntCallback > &callback)=0
 
virtual void getERC20Balance (const std::string &erc20Address, const std::shared_ptr< BigIntCallback > &callback)=0
 
virtual void getERC20Balances (const std::vector< std::string > &erc20Addresses, 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::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::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 Member Functions

static EthereumLikeBlockchainExplorerTransaction getETHLikeBlockchainExplorerTxFromRawTx (const std::shared_ptr< EthereumLikeAccount > &account, const std::string &txHash, const std::vector< uint8_t > &rawTx)
 

Static Public Attributes

static const int FLAG_TRANSACTION_IGNORED = 0x00
 
static const int FLAG_TRANSACTION_CREATED_SENDING_OPERATION = 0x01
 
static const int FLAG_TRANSACTION_CREATED_RECEPTION_OPERATION = 0x01 << 1
 
static const int FLAG_TRANSACTION_CREATED_EXTERNAL_OPERATION = 0x01 << 2
 
- 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"}
 

Additional Inherited Members

- Public Types inherited from ledger::core::AbstractAccount
using AddressList = std::vector< std::shared_ptr< api::Address > >
 
- 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)
 
- Protected Attributes inherited from ledger::core::DedicatedContext
std::shared_ptr< api::ExecutionContext_executionContext
 

Member Function Documentation

◆ asEthereumLikeAccount()

std::shared_ptr< api::EthereumLikeAccount > ledger::core::EthereumLikeAccount::asEthereumLikeAccount ( )
overridevirtual

Turn the account into an Ethereum one, allowing operations to be performrd on the Ethereum network.

Reimplemented from ledger::core::AbstractAccount.

◆ buildTransaction()

std::shared_ptr< api::EthereumLikeTransactionBuilder > ledger::core::EthereumLikeAccount::buildTransaction ( )
overridevirtual

Get a builder object to construct transactions.

Implements ledger::core::api::EthereumLikeAccount.

◆ getERC20Accounts()

std::vector< std::shared_ptr< api::ERC20LikeAccount > > ledger::core::EthereumLikeAccount::getERC20Accounts ( )
overridevirtual

Get the list of ERC20 accounts associated with this Ethereum account.

Implements ledger::core::api::EthereumLikeAccount.

◆ getRestoreKey()

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

Get the key used to generate the account.

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

◆ isObservingBlockchain()

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

Get account's observation status.

Returns
boolean

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

◆ isSynchronizing()

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

Get synchronization status of account.

Returns
bool

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

◆ queryOperations()

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

Get the list of all operations.

Reimplemented from ledger::core::AbstractAccount.

◆ startBlockchainObservation()

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

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

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

◆ stopBlockchainObservation()

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

Stop observing blockchain.

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

◆ synchronize()

std::shared_ptr< api::EventBus > ledger::core::EthereumLikeAccount::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: