TARAXA
Loading...
Searching...
No Matches
data.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
final_chain/data.hpp
"
4
5
namespace
taraxa::net::rpc::eth
{
6
7
using
taraxa::LogBloom
;
8
using
taraxa::LogBlooms
;
9
using
taraxa::LogEntry
;
10
using
taraxa::TransactionLocation
;
11
using
taraxa::TransactionReceipt
;
12
13
struct
TransactionLocationWithBlockHash
:
TransactionLocation
{
14
h256
blk_h
{};
15
};
16
17
struct
LocalisedTransaction
{
18
std::shared_ptr<Transaction>
trx
;
19
std::optional<TransactionLocationWithBlockHash>
trx_loc
{};
20
};
21
22
struct
ExtendedTransactionLocation
:
TransactionLocationWithBlockHash
{
23
h256
trx_hash
{};
24
};
25
26
struct
LocalisedTransactionReceipt
{
27
TransactionReceipt
r
;
28
ExtendedTransactionLocation
trx_loc
;
29
addr_t
trx_from
;
30
std::optional<addr_t>
trx_to
;
31
};
32
33
struct
LocalisedLogEntry
{
34
LogEntry
le
;
35
ExtendedTransactionLocation
trx_loc
;
36
uint64_t
position_in_receipt
= 0;
37
};
38
39
struct
TransactionSkeleton
{
40
Address
from
;
41
u256
value
;
42
bytes
data
;
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
{
50
EthBlockNumber
starting_block
= 0,
current_block
= 0,
highest_block
= 0;
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
toJsonArray
(std::shared_ptr<
const
std::vector<T>> _es) {
79
Json::Value res(Json::arrayValue);
80
for
(
const
auto
& e : *_es) {
81
res.append(
toJson
(e));
82
}
83
return
res;
84
}
85
86
template
<
typename
T>
87
Json::Value
toJson
(
const
std::optional<T>& t) {
88
return
t ?
toJson
(*t) : Json::Value();
89
}
90
91
// ERRORS
92
const
int
CALL_EXCEPTION
= 3;
93
94
}
// namespace taraxa::net::rpc::eth
dev::FixedHash
Definition
FixedHash.h:35
data.hpp
taraxa::final_chain::BlockHeader
Definition
data.hpp:40
taraxa::net::rpc::eth
Definition
data.hpp:5
taraxa::net::rpc::eth::TransactionSkeleton::gas
std::optional< uint64_t > gas
Definition
data.hpp:45
taraxa::net::rpc::eth::toJsonArray
Json::Value toJsonArray(const std::vector< T > &_es)
Definition
data.hpp:69
taraxa::net::rpc::eth::LocalisedTransaction::trx_loc
std::optional< TransactionLocationWithBlockHash > trx_loc
Definition
data.hpp:19
taraxa::net::rpc::eth::TransactionSkeleton::data
bytes data
Definition
data.hpp:42
taraxa::net::rpc::eth::LocalisedLogEntry::le
LogEntry le
Definition
data.hpp:34
taraxa::net::rpc::eth::LocalisedLogEntry::position_in_receipt
uint64_t position_in_receipt
Definition
data.hpp:36
taraxa::net::rpc::eth::SyncStatus::current_block
EthBlockNumber current_block
Definition
data.hpp:50
taraxa::net::rpc::eth::LocalisedTransactionReceipt::trx_from
addr_t trx_from
Definition
data.hpp:29
taraxa::net::rpc::eth::toJson
Json::Value toJson(const final_chain::BlockHeader &obj)
Definition
Eth.cpp:37
taraxa::net::rpc::eth::TransactionSkeleton::value
u256 value
Definition
data.hpp:41
taraxa::net::rpc::eth::LocalisedTransactionReceipt::r
TransactionReceipt r
Definition
data.hpp:27
taraxa::net::rpc::eth::TransactionSkeleton::from
Address from
Definition
data.hpp:40
taraxa::net::rpc::eth::SyncStatus::highest_block
EthBlockNumber highest_block
Definition
data.hpp:50
taraxa::net::rpc::eth::SyncStatus::starting_block
EthBlockNumber starting_block
Definition
data.hpp:50
taraxa::net::rpc::eth::LocalisedTransactionReceipt::trx_to
std::optional< addr_t > trx_to
Definition
data.hpp:30
taraxa::net::rpc::eth::TransactionSkeleton::nonce
std::optional< trx_nonce_t > nonce
Definition
data.hpp:44
taraxa::net::rpc::eth::LocalisedTransactionReceipt::trx_loc
ExtendedTransactionLocation trx_loc
Definition
data.hpp:28
taraxa::net::rpc::eth::CALL_EXCEPTION
const int CALL_EXCEPTION
Definition
data.hpp:92
taraxa::net::rpc::eth::TransactionSkeleton::to
std::optional< Address > to
Definition
data.hpp:43
taraxa::net::rpc::eth::LocalisedLogEntry::trx_loc
ExtendedTransactionLocation trx_loc
Definition
data.hpp:35
taraxa::net::rpc::eth::LocalisedTransaction::trx
std::shared_ptr< Transaction > trx
Definition
data.hpp:18
taraxa::net::rpc::eth::add
void add(Json::Value &obj, const std::optional< TransactionLocationWithBlockHash > &info)
taraxa::net::rpc::eth::TransactionSkeleton::gas_price
std::optional< u256 > gas_price
Definition
data.hpp:46
taraxa::net::rpc::eth::LocalisedLogEntry
Definition
data.hpp:33
taraxa::net::rpc::eth::LocalisedTransaction
Definition
data.hpp:17
taraxa::net::rpc::eth::LocalisedTransactionReceipt
Definition
data.hpp:26
taraxa::net::rpc::eth::SyncStatus
Definition
data.hpp:49
taraxa::net::rpc::eth::TransactionSkeleton
Definition
data.hpp:39
taraxa::LogBlooms
std::vector< LogBloom > LogBlooms
Definition
receipt.hpp:9
taraxa::EthBlockNumber
uint64_t EthBlockNumber
Definition
types.hpp:24
taraxa::bytes
std::vector< byte > bytes
Definition
types.hpp:53
taraxa::LogEntry
Definition
receipt.hpp:11
taraxa::Transaction
Definition
transaction.hpp:12
taraxa::TransactionLocation
Definition
receipt.hpp:37
taraxa::TransactionReceipt
Definition
receipt.hpp:23
taraxa::net::rpc::eth::ExtendedTransactionLocation
Definition
data.hpp:22
taraxa::net::rpc::eth::ExtendedTransactionLocation::trx_hash
h256 trx_hash
Definition
data.hpp:23
taraxa::net::rpc::eth::TransactionLocationWithBlockHash
Definition
data.hpp:13
taraxa::net::rpc::eth::TransactionLocationWithBlockHash::blk_h
h256 blk_h
Definition
data.hpp:14
libraries
core_libs
network
rpc
eth
data.hpp
Generated by
1.9.8