31 #ifndef LEDGER_CORE_BITCOINLIKEACCOUNT_HPP 32 #define LEDGER_CORE_BITCOINLIKEACCOUNT_HPP 34 #include "BitcoinLikeWallet.hpp" 35 #include <api/BitcoinLikeAccount.hpp> 36 #include "explorers/BitcoinLikeBlockchainExplorer.hpp" 37 #include <wallet/bitcoin/keychains/BitcoinLikeKeychain.hpp> 39 #include <preferences/Preferences.hpp> 40 #include <wallet/common/AbstractAccount.hpp> 41 #include <api/Amount.hpp> 42 #include <api/AmountCallback.hpp> 43 #include <api/OperationListCallback.hpp> 44 #include <api/BitcoinLikeOutput.hpp> 45 #include <api/BitcoinLikePickingStrategy.hpp> 46 #include <api/BitcoinLikeTransactionRequest.hpp> 47 #include <api/BitcoinLikePreparedTransaction.hpp> 48 #include <api/BigIntListCallback.hpp> 49 #include <wallet/bitcoin/types.h> 50 #include <wallet/bitcoin/transaction_builders/BitcoinLikeUtxoPicker.h> 52 #include <wallet/bitcoin/synchronizers/BitcoinLikeAccountSynchronizer.hpp> 57 class BitcoinLikeUtxoPicker;
60 static const int FLAG_NEW_TRANSACTION = 0x01;
61 static const int FLAG_TRANSACTION_UPDATED = 0x01 << 1;
62 static const int FLAG_TRANSACTION_IGNORED = 0x00;
63 static const int FLAG_TRANSACTION_ON_PREVIOUSLY_EMPTY_ADDRESS = 0x01 << 2;
64 static const int FLAG_TRANSACTION_ON_USED_ADDRESS = 0x01 << 3;
65 static const int FLAG_TRANSACTION_CREATED_SENDING_OPERATION = 0x01 << 4;
66 static const int FLAG_TRANSACTION_CREATED_RECEPTION_OPERATION = 0x01 << 5;
70 const std::shared_ptr<BitcoinLikeBlockchainExplorer>& explorer,
71 const std::shared_ptr<BitcoinLikeBlockchainObserver>& observer,
72 const std::shared_ptr<BitcoinLikeAccountSynchronizer>& synchronizer,
73 const std::shared_ptr<BitcoinLikeKeychain>& keychain
91 std::shared_ptr<BitcoinLikeKeychain> getKeychain()
const;
106 const std::string & end,
107 api::TimePeriod precision)
override;
111 std::shared_ptr<api::EventBus>
synchronize()
override;
113 void broadcastRawTransaction(
const std::vector<uint8_t> &transaction,
114 const std::shared_ptr<api::StringCallback> &callback)
override;
116 void broadcastTransaction(
const std::shared_ptr<api::BitcoinLikeTransaction> &transaction,
117 const std::shared_ptr<api::StringCallback> &callback)
override;
123 void getUTXO(int32_t from, int32_t to,
124 const std::shared_ptr<api::BitcoinLikeOutputListCallback> &callback)
override;
127 void getUTXOCount(
const std::shared_ptr<api::I32Callback> &callback)
override;
136 const std::shared_ptr<BitcoinLikeBlockchainExplorer>& getExplorer()
const;
140 void getFees(
const std::shared_ptr<api::BigIntListCallback> & callback)
override ;
142 bool checkIfWalletIsEmpty();
145 std::shared_ptr<BitcoinLikeAccount> getSelf();
146 inline void inflateOperation(
Operation& out,
148 inline void computeOperationTrust(
Operation& operation,
152 std::shared_ptr<BitcoinLikeKeychain> _keychain;
153 std::shared_ptr<BitcoinLikeBlockchainExplorer> _explorer;
154 std::shared_ptr<BitcoinLikeAccountSynchronizer> _synchronizer;
155 std::shared_ptr<BitcoinLikeBlockchainObserver> _observer;
156 std::shared_ptr<BitcoinLikeUtxoPicker> _picker;
157 std::shared_ptr<api::EventBus> _currentSyncEventBus;
158 std::mutex _synchronizationLock;
159 uint64_t _currentBlockHeight;
165 #endif //LEDGER_CORE_BITCOINLIKEACCOUNT_HPP Definition: BitcoinLikeAccount.hpp:58
Definition: BitcoinLikeAccount.hpp:29
std::shared_ptr< api::BitcoinLikeAccount > asBitcoinLikeAccount() override
Definition: BitcoinLikeAccount.cpp:670
Definition: BitcoinLikeBlockchainExplorer.hpp:78
Definition: AbstractAccount.hpp:55
std::shared_ptr< api::EventBus > synchronize() override
Definition: BitcoinLikeAccount.cpp:273
bool isObservingBlockchain() override
Definition: BitcoinLikeAccount.cpp:512
Definition: Deffered.hpp:49
void startBlockchainObservation() override
Definition: BitcoinLikeAccount.cpp:504
void stopBlockchainObservation() override
Definition: BitcoinLikeAccount.cpp:508
int putTransaction(soci::session &sql, const BitcoinLikeBlockchainExplorerTransaction &transaction)
Definition: BitcoinLikeAccount.cpp:110
Definition: Operation.h:53
std::shared_ptr< api::OperationQuery > queryOperations() override
Definition: BitcoinLikeAccount.cpp:367
Definition: Account.cpp:8
bool isSynchronizing() override
Definition: BitcoinLikeAccount.cpp:268
std::string getRestoreKey() override
Definition: BitcoinLikeAccount.cpp:674
bool putBlock(soci::session &sql, const BitcoinLikeBlockchainExplorer::Block &block)
Definition: BitcoinLikeAccount.cpp:342
Definition: optional.hpp:177