ledger-core
RippleLikeBlockchainExplorer.h
1 /*
2  *
3  * RippleLikeBlockchainExplorer
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_RIPPLELIKEBLOCKCHAINEXPLORER_H
33 #define LEDGER_CORE_RIPPLELIKEBLOCKCHAINEXPLORER_H
34 
35 
36 #include <string>
37 
38 #include <api/DynamicObject.hpp>
39 #include <api/ExecutionContext.hpp>
40 #include <api/RippleLikeNetworkParameters.hpp>
41 #include <api/RippleLikeMemo.hpp>
42 #include <async/DedicatedContext.hpp>
43 #include <collections/DynamicObject.hpp>
44 #include <math/BigInt.h>
45 #include <net/HttpClient.hpp>
46 #include <utils/ConfigurationMatchable.h>
47 #include <utils/Option.hpp>
48 #include <wallet/common/Block.h>
49 #include <wallet/common/explorers/AbstractBlockchainExplorer.h>
50 #include <wallet/ripple/keychains/RippleLikeKeychain.h>
51 
52 namespace ledger {
53  namespace core {
54 
56  std::string hash;
57  std::chrono::system_clock::time_point receivedAt;
58  BigInt value;
59  BigInt fees;
60  BigInt sequence;
61  std::string receiver;
62  std::string sender;
63  Option<Block> block;
64  uint64_t confirmations;
65  Option<uint64_t> destinationTag;
66 
67  std::vector<api::RippleLikeMemo> memos;
68 
70  confirmations = 0;
71  }
72 
74  this->block = cpy.block;
75  this->hash = cpy.hash;
76  this->receivedAt = cpy.receivedAt;
77  this->confirmations = cpy.confirmations;
78  this->fees = cpy.fees;
79  this->sequence = cpy.sequence;
80  this->receiver = cpy.receiver;
81  this->sender = cpy.sender;
82  this->value = cpy.value;
83  this->memos = cpy.memos;
84  this->destinationTag = cpy.destinationTag;
85  }
86 
87  };
88 
90  public AbstractBlockchainExplorer<RippleLikeBlockchainExplorerTransaction> {
91  public:
92  typedef ledger::core::Block Block;
93 
94  RippleLikeBlockchainExplorer(const std::shared_ptr<ledger::core::api::DynamicObject> &configuration,
95  const std::vector<std::string> &matchableKeys);
96 
98  getBalance(const std::vector<RippleLikeKeychain::Address> &addresses) = 0;
99 
101  getSequence(const std::string &address) = 0;
102 
104  getFees() = 0;
105 
107  getBaseReserve() = 0;
108 
110  getLedgerSequence() = 0;
111  };
112  }
113 }
114 
115 
116 #endif //LEDGER_CORE_RIPPLELIKEBLOCKCHAINEXPLORER_H
Definition: Option.hpp:49
Definition: AbstractBlockchainExplorer.h:48
Definition: Deffered.hpp:49
Definition: ConfigurationMatchable.h:38
Definition: RippleLikeBlockchainExplorer.h:55
Definition: Account.cpp:8
Definition: RippleLikeBlockchainExplorer.h:89
Definition: BigInt.h:56
Definition: Block.h:40