28
28
*
29
29
*/
30
30
31
- #pragma once
32
- #include < wallet/common/explorers/AbstractLedgerApiBlockchainExplorer.h>
31
+ #ifndef LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
32
+ #define LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
33
+
33
34
#include < wallet/tezos/explorers/TezosLikeBlockchainExplorer.h>
34
- #include < wallet/tezos/explorers/api/TezosLikeTransactionsParser.h>
35
- #include < wallet/tezos/explorers/api/TezosLikeTransactionsBulkParser.h>
36
- #include < wallet/tezos/explorers/api/TezosLikeBlockParser.h>
37
- #include < api/TezosLikeNetworkParameters.hpp>
38
35
#include < wallet/tezos/api_impl/TezosLikeTransactionApi.h>
39
36
40
37
namespace ledger {
41
38
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> {
39
+
40
+ class ExternalTezosLikeBlockchainExplorer : public TezosLikeBlockchainExplorer
41
+ {
54
42
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);
43
+ ExternalTezosLikeBlockchainExplorer (
44
+ const std::shared_ptr<api::ExecutionContext> &context,
45
+ const std::shared_ptr<HttpClient> &http,
46
+ const api::TezosLikeNetworkParameters ¶meters,
47
+ const std::shared_ptr<ledger::core::api::DynamicObject> &configuration);
59
48
60
49
Future<std::shared_ptr<BigInt>>
61
- getBalance (const std::vector< TezosLikeKeychain::Address> &addresses) override ;
50
+ getBalance (const TezosLikeKeychain::Address &address) const override ;
62
51
63
52
Future<std::shared_ptr<BigInt>>
64
- getFees () override ;
53
+ getFees () const override ;
65
54
66
55
Future<std::shared_ptr<BigInt>>
67
- getGasPrice () override ;
68
-
69
- Future<String> pushLedgerApiTransaction (const std::vector<uint8_t > &transaction) override ;
70
-
71
- Future<void *> startSession () override ;
56
+ getGasPrice () const override ;
72
57
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 ;
58
+ Future<String> pushLedgerApiTransaction (const std::vector<uint8_t > &transaction) override ;
78
59
79
60
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 ;
83
-
84
- FuturePtr<Block> getCurrentBlock () const override ;
85
-
86
- FuturePtr<TezosLikeBlockchainExplorerTransaction>
87
- getTransactionByHash (const String &transactionHash) const override ;
61
+ getTransactions (const std::string& address,
62
+ const Either<std::string, uint32_t >& token = {}) const override ;
88
63
89
- Future<int64_t > getTimestamp () const override ;
90
-
91
- std::shared_ptr<api::ExecutionContext> getExplorerContext () const override ;
92
-
93
- api::TezosLikeNetworkParameters getNetworkParameters () const override ;
64
+ FuturePtr<Block>
65
+ getCurrentBlock () const override ;
94
66
95
67
std::string getExplorerVersion () const override ;
96
68
97
69
Future<std::shared_ptr<BigInt>>
98
- getEstimatedGasLimit (const std::string &address) override ;
70
+ getEstimatedGasLimit (const std::string &address) const override ;
99
71
100
72
Future<std::shared_ptr<GasLimit>>
101
- getEstimatedGasLimit (const std::shared_ptr<TezosLikeTransactionApi> &transaction) override ;
73
+ getEstimatedGasLimit (const std::shared_ptr<TezosLikeTransactionApi> &tx) const override ;
102
74
103
75
Future<std::shared_ptr<BigInt>>
104
- getStorage (const std::string &address) override ;
76
+ getStorage (const std::string &address) const override ;
105
77
106
- Future<std::shared_ptr<BigInt>> getCounter (const std::string &address) override ;
78
+ Future<std::vector<uint8_t >>
79
+ forgeKTOperation (const std::shared_ptr<TezosLikeTransactionApi> &tx) const override ;
107
80
108
- Future<std::vector<uint8_t >> forgeKTOperation (const std::shared_ptr<TezosLikeTransactionApi> &tx) override ;
81
+ Future<std::string>
82
+ getManagerKey (const std::string &address) const override ;
109
83
110
- Future<std::string> getManagerKey (const std::string &address) override ;
84
+ Future<bool >
85
+ isAllocated (const std::string &address) const override ;
111
86
112
- Future<bool > isAllocated (const std::string &address) override ;
87
+ Future<std::string>
88
+ getCurrentDelegate (const std::string &address) const override ;
113
89
114
- Future<std::string> getCurrentDelegate (const std::string &address) override ;
90
+ Future<std::shared_ptr<BigInt>>
91
+ getCounter (const std::string &address) const override ;
115
92
116
- Future<bool > isFunded (const std::string &address) override ;
93
+ Future<bool >
94
+ isFunded (const std::string &address) const override ;
117
95
118
- Future<std::shared_ptr<BigInt> >
119
- getTokenBalance (const std::string& accountAddress, const std::string& tokenAddress ) const override ;
96
+ Future<bool >
97
+ isDelegate (const std::string &address ) const override ;
120
98
121
- Future<bool > isDelegate (const std::string &address) override ;
99
+ Future<std::shared_ptr<BigInt>>
100
+ getTokenBalance (const std::string& accountAddress,
101
+ const std::string& tokenAddress) const override ;
122
102
123
103
private:
124
104
/*
@@ -132,14 +112,16 @@ namespace ledger {
132
112
Future<std::shared_ptr<BigInt>>
133
113
getHelper (const std::string &url,
134
114
const std::string &field,
135
- const std::unordered_map<std::string, std::string> ¶ms = std::unordered_map<std::string, std::string>() ,
115
+ const std::unordered_map<std::string, std::string> ¶ms = {} ,
136
116
const std::string &fallbackValue = " " ,
137
117
const std::string &forceUrl = " " ,
138
- bool isDecimal = false );
118
+ bool isDecimal = false ) const ;
139
119
140
- api::TezosLikeNetworkParameters _parameters;
141
- std::unordered_map<std::string, uint64_t > _sessions;
120
+ private:
142
121
std::string _bcd;
143
122
};
144
- }
145
- }
123
+
124
+ } // namespace core
125
+ } // namespace ledger
126
+
127
+ #endif // LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
0 commit comments