ledger-core
ApiRippleLikeBlockchainExplorer.h
1 /*
2  *
3  * ApiRippleLikeBlockchainExplorer
4  *
5  * Created by El Khalil Bellakrid on 06/01/2019.
6  *
7  * The MIT License (MIT)
8  *
9  * Copyright (c) 2019 Ledger
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a copy
12  * of this software and associated documentation files (the "Software"), to deal
13  * in the Software without restriction, including without limitation the rights
14  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15  * copies of the Software, and to permit persons to whom the Software is
16  * furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included in all
19  * copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27  * SOFTWARE.
28  *
29  */
30 
31 
32 #ifndef LEDGER_CORE_APIRIPPLELIKEBLOCKCHAINEXPLORER_H
33 #define LEDGER_CORE_APIRIPPLELIKEBLOCKCHAINEXPLORER_H
34 
35 
36 #include <wallet/common/explorers/AbstractLedgerApiBlockchainExplorer.h>
37 #include <wallet/ripple/explorers/RippleLikeBlockchainExplorer.h>
38 #include <wallet/ripple/explorers/api/RippleLikeTransactionsParser.h>
39 #include <wallet/ripple/explorers/api/RippleLikeTransactionsBulkParser.h>
40 #include <wallet/ripple/explorers/api/RippleLikeBlockParser.h>
41 #include <api/RippleLikeNetworkParameters.hpp>
42 
43 namespace ledger {
44  namespace core {
45  using LedgerApiBlockchainExplorer = AbstractLedgerApiBlockchainExplorer<RippleLikeBlockchainExplorerTransaction, RippleLikeBlockchainExplorer::TransactionsBulk, RippleLikeTransactionsParser, RippleLikeTransactionsBulkParser, RippleLikeBlockParser, api::RippleLikeNetworkParameters>;
46 
49  public DedicatedContext,
50  public std::enable_shared_from_this<ApiRippleLikeBlockchainExplorer> {
51  public:
52  ApiRippleLikeBlockchainExplorer(const std::shared_ptr<api::ExecutionContext> &context,
53  const std::shared_ptr<HttpClient> &http,
54  const api::RippleLikeNetworkParameters &parameters,
55  const std::shared_ptr<api::DynamicObject> &configuration);
56 
58  getBalance(const std::vector<RippleLikeKeychain::Address> &addresses) override;
59 
61  getSequence(const std::string &address) override;
62 
64  getFees() override;
65 
67  getBaseReserve() override;
68 
70  getLedgerSequence() override;
71 
72  Future<String> pushLedgerApiTransaction(const std::vector<uint8_t> &transaction) override;
73 
74  Future<void *> startSession() override;
75 
76  Future<Unit> killSession(void *session) override;
77 
78  Future<Bytes> getRawTransaction(const String &transactionHash) override;
79 
80  Future<String> pushTransaction(const std::vector<uint8_t> &transaction) override;
81 
83  getTransactions(const std::vector<std::string> &addresses,
84  Option<std::string> fromBlockHash = Option<std::string>(),
85  Option<void *> session = Option<void *>()) override;
86 
87  FuturePtr<Block> getCurrentBlock() const override;
88 
90  getTransactionByHash(const String &transactionHash) const override;
91 
92  Future<int64_t> getTimestamp() const override;
93 
94  std::shared_ptr<api::ExecutionContext> getExplorerContext() const override;
95 
96  api::RippleLikeNetworkParameters getNetworkParameters() const override;
97 
98  std::string getExplorerVersion() const override;
99 
100  private:
102  std::string _explorerVersion;
103  };
104  }
105 }
106 
107 
108 #endif //LEDGER_CORE_APIRIPPLELIKEBLOCKCHAINEXPLORER_H
Definition: RippleLikeNetworkParameters.hpp:15
Definition: Deffered.hpp:49
Definition: AbstractLedgerApiBlockchainExplorer.h:51
Definition: Account.cpp:8
Definition: DedicatedContext.hpp:39
Definition: RippleLikeBlockchainExplorer.h:89
Definition: ApiRippleLikeBlockchainExplorer.h:47