32 #ifndef LEDGER_CORE_TEZOSLIKEACCOUNT_H 33 #define LEDGER_CORE_TEZOSLIKEACCOUNT_H 35 #include <api/AddressListCallback.hpp> 36 #include <api/Address.hpp> 37 #include <api/TezosLikeAccount.hpp> 38 #include <api/TezosLikeTransactionBuilder.hpp> 39 #include <api/StringCallback.hpp> 40 #include <api/Event.hpp> 41 #include <api/BigIntCallback.hpp> 42 #include <wallet/common/AbstractWallet.hpp> 43 #include <wallet/common/AbstractAccount.hpp> 44 #include <wallet/common/Amount.h> 45 #include <wallet/tezos/explorers/TezosLikeBlockchainExplorer.h> 46 #include <wallet/tezos/synchronizers/TezosLikeAccountSynchronizer.h> 47 #include <wallet/tezos/observers/TezosLikeBlockchainObserver.h> 48 #include <wallet/tezos/keychains/TezosLikeKeychain.h> 49 #include <wallet/tezos/database/TezosLikeAccountDatabaseEntry.h> 57 const std::shared_ptr<DatabaseSessionPool>& pool,
58 const std::shared_ptr<api::ExecutionContext>& context,
59 const std::shared_ptr<api::ExecutionContext>& mainContext) :
OperationQuery(headFilter, pool, context, mainContext) {
63 virtual soci::rowset<soci::row> performExecute(soci::session &sql) {
64 return _builder.select(
"o.account_uid, o.uid, o.wallet_uid, o.type, o.date, o.senders, o.recipients," 65 "o.amount, o.fees, o.currency_name, o.trust, b.hash, b.height, b.time, orig_op.uid" 67 .from(
"operations").to(
"o")
68 .outerJoin(
"blocks AS b",
"o.block_uid = b.uid")
69 .outerJoin(
"tezos_originated_operations AS orig_op",
"o.uid = orig_op.uid")
78 static const int FLAG_TRANSACTION_IGNORED = 0x00;
82 const std::shared_ptr<TezosLikeBlockchainExplorer> &explorer,
83 const std::shared_ptr<TezosLikeBlockchainObserver> &observer,
84 const std::shared_ptr<TezosLikeAccountSynchronizer> &synchronizer,
85 const std::shared_ptr<TezosLikeKeychain> &keychain);
88 const std::shared_ptr<const AbstractWallet> &wallet,
91 int putTransaction(soci::session &sql,
93 const std::string &originatedAccountUid =
"",
94 const std::string &originatedAccountAddress =
"");
96 void updateOriginatedAccounts(soci::session &sql,
const Operation &operation);
100 std::shared_ptr<TezosLikeKeychain> getKeychain()
const;
107 getBalanceHistory(
const std::string &start,
108 const std::string &end,
109 api::TimePeriod precision)
override;
113 bool isSynchronizing()
override;
115 std::shared_ptr<api::EventBus> synchronize()
override;
117 void startBlockchainObservation()
override;
119 void stopBlockchainObservation()
override;
121 bool isObservingBlockchain()
override;
123 std::string getRestoreKey()
override;
125 void broadcastRawTransaction(
const std::vector<uint8_t> &transaction,
126 const std::shared_ptr<api::StringCallback> &callback)
override;
128 void broadcastTransaction(
const std::shared_ptr<api::TezosLikeTransaction> &transaction,
129 const std::shared_ptr<api::StringCallback> &callback)
override;
131 std::shared_ptr<api::TezosLikeTransactionBuilder> buildTransaction()
override;
132 std::shared_ptr<api::TezosLikeTransactionBuilder> buildTransaction(
const std::string &senderAddress);
134 std::shared_ptr<api::OperationQuery> queryOperations()
override;
136 void getEstimatedGasLimit(
const std::string & address,
const std::shared_ptr<api::BigIntCallback> & callback)
override;
139 void getStorage(
const std::string & address,
const std::shared_ptr<api::BigIntCallback> & callback)
override;
142 std::vector<std::shared_ptr<api::TezosLikeOriginatedAccount>> getOriginatedAccounts()
override;
144 void addOriginatedAccounts(soci::session &sql,
const std::vector<TezosLikeOriginatedAccountDatabaseEntry> &originatedEntries);
146 void getFees(
const std::shared_ptr<api::BigIntCallback> & callback)
override;
150 std::shared_ptr<TezosLikeAccount> getSelf();
152 std::shared_ptr<TezosLikeKeychain> _keychain;
153 std::string _accountAddress;
154 std::shared_ptr<TezosLikeBlockchainExplorer> _explorer;
155 std::shared_ptr<TezosLikeAccountSynchronizer> _synchronizer;
156 std::shared_ptr<TezosLikeBlockchainObserver> _observer;
157 std::shared_ptr<api::EventBus> _currentSyncEventBus;
158 std::mutex _synchronizationLock;
159 std::vector<std::shared_ptr<api::TezosLikeOriginatedAccount>> _originatedAccounts;
163 #endif //LEDGER_CORE_TEZOSLIKEACCOUNT_H Definition: OperationQuery.h:48
Definition: TezosLikeBlockchainExplorer.h:68
Definition: AbstractAccount.hpp:55
Definition: Deffered.hpp:49
Definition: TezosLikeAccount.hpp:28
Definition: TezosLikeAccount.h:54
Definition: Operation.h:53
Definition: TezosLikeOriginatedAccount.h:67
Definition: Account.cpp:8
Definition: TezosLikeAccount.h:76