2828 *
2929 */
3030
31- #pragma once
32- #include < wallet/common/explorers/AbstractLedgerApiBlockchainExplorer.h>
31+ #ifndef LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
32+ #define LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
33+
3334#include < wallet/tezos/explorers/TezosLikeBlockchainExplorer.h>
3435#include < wallet/tezos/explorers/api/TezosLikeTransactionsParser.h>
3536#include < wallet/tezos/explorers/api/TezosLikeTransactionsBulkParser.h>
3940
4041namespace ledger {
4142 namespace core {
42- using ExternalApiBlockchainExplorer = AbstractLedgerApiBlockchainExplorer<
43- TezosLikeBlockchainExplorerTransaction,
44- TezosLikeBlockchainExplorer::TransactionsBulk,
45- TezosLikeTransactionsParser,
46- TezosLikeTransactionsBulkParser,
47- TezosLikeBlockParser,
48- api::TezosLikeNetworkParameters>;
49-
50- class ExternalTezosLikeBlockchainExplorer : public TezosLikeBlockchainExplorer ,
51- public ExternalApiBlockchainExplorer,
52- public DedicatedContext,
53- public std::enable_shared_from_this<ExternalTezosLikeBlockchainExplorer> {
43+
44+ class ExternalTezosLikeBlockchainExplorer : public TezosLikeBlockchainExplorer
45+ {
5446 public:
55- ExternalTezosLikeBlockchainExplorer (const std::shared_ptr<api::ExecutionContext> &context,
56- const std::shared_ptr<HttpClient> &http,
57- const api::TezosLikeNetworkParameters ¶meters,
58- const std::shared_ptr<api::DynamicObject> &configuration);
47+ ExternalTezosLikeBlockchainExplorer (
48+ const std::shared_ptr<api::ExecutionContext> &context,
49+ const std::shared_ptr<HttpClient> &http,
50+ const api::TezosLikeNetworkParameters ¶meters,
51+ const std::shared_ptr<ledger::core::api::DynamicObject> &configuration);
5952
6053 Future<std::shared_ptr<BigInt>>
61- getBalance (const std::vector< TezosLikeKeychain::Address> &addresses) override ;
54+ getBalance (const TezosLikeKeychain::Address &address) const override ;
6255
6356 Future<std::shared_ptr<BigInt>>
64- getFees () override ;
57+ getFees () const override ;
6558
6659 Future<std::shared_ptr<BigInt>>
67- getGasPrice () override ;
68-
69- Future<String> pushLedgerApiTransaction (const std::vector<uint8_t > &transaction) override ;
60+ getGasPrice () const override ;
7061
71- Future<void *> startSession ( ) override ;
62+ Future<String> pushLedgerApiTransaction ( const std::vector< uint8_t > &transaction ) override ;
7263
73- Future<Unit> killSession (void *session) override ;
74-
75- Future<Bytes> getRawTransaction (const String &transactionHash) override ;
76-
77- Future<String> pushTransaction (const std::vector<uint8_t > &transaction) override ;
64+ Future<String> pushTransaction (const std::vector<uint8_t >& transaction) override ;
7865
7966 FuturePtr<TezosLikeBlockchainExplorer::TransactionsBulk>
80- getTransactions (const std::vector<std::string> &addresses,
81- Option<std::string> offset = Option<std::string>(),
82- Option<void *> session = Option<void *>()) override ;
67+ getTransactions (const std::string& address,
68+ const Either<std::string, uint32_t >& token = {}) const override ;
8369
84- FuturePtr<Block> getCurrentBlock () const override ;
70+ FuturePtr<Block>
71+ getCurrentBlock () const override ;
8572
86- FuturePtr<TezosLikeBlockchainExplorerTransaction >
73+ FuturePtr<Transaction >
8774 getTransactionByHash (const String &transactionHash) const override ;
8875
89- Future<int64_t > getTimestamp () const override ;
90-
91- std::shared_ptr<api::ExecutionContext> getExplorerContext () const override ;
92-
93- api::TezosLikeNetworkParameters getNetworkParameters () const override ;
94-
9576 std::string getExplorerVersion () const override ;
9677
9778 Future<std::shared_ptr<BigInt>>
98- getEstimatedGasLimit (const std::string &address) override ;
79+ getEstimatedGasLimit (const std::string &address) const override ;
9980
10081 Future<std::shared_ptr<GasLimit>>
101- getEstimatedGasLimit (const std::shared_ptr<TezosLikeTransactionApi> &transaction) override ;
82+ getEstimatedGasLimit (const std::shared_ptr<TezosLikeTransactionApi> &tx) const override ;
10283
10384 Future<std::shared_ptr<BigInt>>
104- getStorage (const std::string &address) override ;
85+ getStorage (const std::string &address) const override ;
10586
106- Future<std::shared_ptr<BigInt>> getCounter (const std::string &address) override ;
87+ Future<std::shared_ptr<BigInt>>
88+ getCounter (const std::string &address) const override ;
10789
108- Future<std::vector<uint8_t >> forgeKTOperation (const std::shared_ptr<TezosLikeTransactionApi> &tx) override ;
90+ Future<std::vector<uint8_t >>
91+ forgeKTOperation (const std::shared_ptr<TezosLikeTransactionApi> &tx) const override ;
10992
110- Future<std::string> getManagerKey (const std::string &address) override ;
93+ Future<std::string>
94+ getManagerKey (const std::string &address) const override ;
11195
112- Future<bool > isAllocated (const std::string &address) override ;
96+ Future<bool >
97+ isAllocated (const std::string &address) const override ;
11398
114- Future<std::string> getCurrentDelegate (const std::string &address) override ;
99+ Future<std::string>
100+ getCurrentDelegate (const std::string &address) const override ;
115101
116- Future<bool > isFunded (const std::string &address) override ;
102+ // / Check that the account is funded.
103+ Future<bool >
104+ isFunded (const std::string &address) const override ;
117105
106+ // / Get a token balance for an account
118107 Future<std::shared_ptr<BigInt>>
119- getTokenBalance (const std::string& accountAddress, const std::string& tokenAddress) const override ;
108+ getTokenBalance (const std::string& accountAddress,
109+ const std::string& tokenAddress) const override ;
120110
121- Future<bool > isDelegate (const std::string &address) override ;
111+ Future<bool >
112+ isDelegate (const std::string &address) const override ;
122113
123114 private:
124115 /*
@@ -132,14 +123,16 @@ namespace ledger {
132123 Future<std::shared_ptr<BigInt>>
133124 getHelper (const std::string &url,
134125 const std::string &field,
135- const std::unordered_map<std::string, std::string> ¶ms = std::unordered_map<std::string, std::string>() ,
126+ const std::unordered_map<std::string, std::string> ¶ms = {} ,
136127 const std::string &fallbackValue = " " ,
137128 const std::string &forceUrl = " " ,
138- bool isDecimal = false );
129+ bool isDecimal = false ) const ;
139130
140- api::TezosLikeNetworkParameters _parameters;
141- std::unordered_map<std::string, uint64_t > _sessions;
131+ private:
142132 std::string _bcd;
143133 };
144- }
145- }
134+
135+ } // namespace core
136+ } // namespace ledger
137+
138+ #endif // LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
0 commit comments