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
35
#include < wallet/tezos/explorers/api/TezosLikeTransactionsParser.h>
35
36
#include < wallet/tezos/explorers/api/TezosLikeTransactionsBulkParser.h>
39
40
40
41
namespace ledger {
41
42
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
+ {
54
46
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);
59
52
60
53
Future<std::shared_ptr<BigInt>>
61
- getBalance (const std::vector< TezosLikeKeychain::Address> &addresses) override ;
54
+ getBalance (const TezosLikeKeychain::Address &address) const override ;
62
55
63
56
Future<std::shared_ptr<BigInt>>
64
- getFees () override ;
57
+ getFees () const override ;
65
58
66
59
Future<std::shared_ptr<BigInt>>
67
- getGasPrice () override ;
68
-
69
- Future<String> pushLedgerApiTransaction (const std::vector<uint8_t > &transaction) override ;
60
+ getGasPrice () const override ;
70
61
71
- Future<void *> startSession ( ) override ;
62
+ Future<String> pushLedgerApiTransaction ( const std::vector< uint8_t > &transaction ) override ;
72
63
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 ;
78
65
79
66
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 ;
83
69
84
- FuturePtr<Block> getCurrentBlock () const override ;
70
+ FuturePtr<Block>
71
+ getCurrentBlock () const override ;
85
72
86
- FuturePtr<TezosLikeBlockchainExplorerTransaction >
73
+ FuturePtr<Transaction >
87
74
getTransactionByHash (const String &transactionHash) const override ;
88
75
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
-
95
76
std::string getExplorerVersion () const override ;
96
77
97
78
Future<std::shared_ptr<BigInt>>
98
- getEstimatedGasLimit (const std::string &address) override ;
79
+ getEstimatedGasLimit (const std::string &address) const override ;
99
80
100
81
Future<std::shared_ptr<GasLimit>>
101
- getEstimatedGasLimit (const std::shared_ptr<TezosLikeTransactionApi> &transaction) override ;
82
+ getEstimatedGasLimit (const std::shared_ptr<TezosLikeTransactionApi> &tx) const override ;
102
83
103
84
Future<std::shared_ptr<BigInt>>
104
- getStorage (const std::string &address) override ;
85
+ getStorage (const std::string &address) const override ;
105
86
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 ;
107
89
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 ;
109
92
110
- Future<std::string> getManagerKey (const std::string &address) override ;
93
+ Future<std::string>
94
+ getManagerKey (const std::string &address) const override ;
111
95
112
- Future<bool > isAllocated (const std::string &address) override ;
96
+ Future<bool >
97
+ isAllocated (const std::string &address) const override ;
113
98
114
- Future<std::string> getCurrentDelegate (const std::string &address) override ;
99
+ Future<std::string>
100
+ getCurrentDelegate (const std::string &address) const override ;
115
101
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 ;
117
105
106
+ // / Get a token balance for an account
118
107
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 ;
120
110
121
- Future<bool > isDelegate (const std::string &address) override ;
111
+ Future<bool >
112
+ isDelegate (const std::string &address) const override ;
122
113
123
114
private:
124
115
/*
@@ -132,14 +123,16 @@ namespace ledger {
132
123
Future<std::shared_ptr<BigInt>>
133
124
getHelper (const std::string &url,
134
125
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 = {} ,
136
127
const std::string &fallbackValue = " " ,
137
128
const std::string &forceUrl = " " ,
138
- bool isDecimal = false );
129
+ bool isDecimal = false ) const ;
139
130
140
- api::TezosLikeNetworkParameters _parameters;
141
- std::unordered_map<std::string, uint64_t > _sessions;
131
+ private:
142
132
std::string _bcd;
143
133
};
144
- }
145
- }
134
+
135
+ } // namespace core
136
+ } // namespace ledger
137
+
138
+ #endif // LEDGER_CORE_EXTERNALTEZOSLIKEBLOCKCHAINEXPLORER_H
0 commit comments