TARAXA
data.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "final_chain/data.hpp"
4 
6 
12 
15 };
16 
18  std::shared_ptr<Transaction> trx;
19  std::optional<TransactionLocationWithBlockHash> trx_loc{};
20 };
21 
24 };
25 
30  std::optional<addr_t> trx_to;
31 };
32 
36  uint64_t position_in_receipt = 0;
37 };
38 
43  std::optional<Address> to;
44  std::optional<trx_nonce_t> nonce;
45  std::optional<uint64_t> gas;
46  std::optional<u256> gas_price;
47 };
48 
49 struct SyncStatus {
51 };
52 
53 void add(Json::Value& obj, const std::optional<TransactionLocationWithBlockHash>& info);
54 void add(Json::Value& obj, const ExtendedTransactionLocation& info);
55 Json::Value toJson(const final_chain::BlockHeader& obj);
56 Json::Value toJson(const Transaction& trx, const std::optional<TransactionLocationWithBlockHash>& loc);
57 Json::Value toJson(const LocalisedTransaction& lt);
58 Json::Value toJson(const final_chain::BlockHeader& obj);
59 Json::Value toJson(const LocalisedLogEntry& lle);
60 Json::Value toJson(const LocalisedTransactionReceipt& ltr);
61 Json::Value toJson(const SyncStatus& obj);
62 
63 template <typename T>
64 Json::Value toJson(const T& t) {
65  return toJS(t);
66 }
67 
68 template <typename T>
69 Json::Value toJsonArray(const std::vector<T>& _es) {
70  Json::Value res(Json::arrayValue);
71  for (const auto& e : _es) {
72  res.append(toJson(e));
73  }
74  return res;
75 }
76 
77 template <typename T>
78 Json::Value toJson(const std::optional<T>& t) {
79  return t ? toJson(*t) : Json::Value();
80 }
81 
82 } // namespace taraxa::net::rpc::eth
dev::h2048 LogBloom
Definition: data.hpp:22
std::vector< LogBloom > LogBlooms
Definition: data.hpp:23
Definition: data.hpp:40
Definition: data.hpp:70
std::string toJS(::byte _b)
Definition: CommonJS.h:14
std::vector<::byte > bytes
Definition: Common.h:46
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
Definition: Common.h:98
Definition: data.hpp:5
std::optional< uint64_t > gas
Definition: data.hpp:45
Json::Value toJsonArray(const std::vector< T > &_es)
Definition: data.hpp:69
std::optional< TransactionLocationWithBlockHash > trx_loc
Definition: data.hpp:19
bytes data
Definition: data.hpp:42
LogEntry le
Definition: data.hpp:34
uint64_t position_in_receipt
Definition: data.hpp:36
EthBlockNumber current_block
Definition: data.hpp:50
Json::Value toJson(const final_chain::BlockHeader &obj)
Definition: Eth.cpp:49
u256 value
Definition: data.hpp:41
TransactionReceipt r
Definition: data.hpp:27
Address from
Definition: data.hpp:40
EthBlockNumber highest_block
Definition: data.hpp:50
EthBlockNumber starting_block
Definition: data.hpp:50
std::optional< addr_t > trx_to
Definition: data.hpp:30
std::optional< trx_nonce_t > nonce
Definition: data.hpp:44
ExtendedTransactionLocation trx_loc
Definition: data.hpp:28
std::optional< Address > to
Definition: data.hpp:43
ExtendedTransactionLocation trx_loc
Definition: data.hpp:35
std::shared_ptr< Transaction > trx
Definition: data.hpp:18
void add(Json::Value &obj, const std::optional< TransactionLocationWithBlockHash > &info)
std::optional< u256 > gas_price
Definition: data.hpp:46
Definition: data.hpp:33
Definition: data.hpp:49
uint64_t EthBlockNumber
Definition: types.hpp:23
Definition: transaction.hpp:11