1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! A simple Ethereum RPC implementation.
#[cfg(feature = "curl")]
pub mod curl;
#[cfg(feature = "http")]
pub mod http;
pub mod jsonrpc;
#[macro_use]
pub mod method;
mod bloom;
mod debug;
mod serialization;
pub mod types;
use self::types::*;
module! {
/// The `web3` namespace.
pub mod web3 {
/// Gets the current client version.
pub struct ClientVersion as "web3_clientVersion"
Empty => String;
}
}
module! {
/// The `eth` namespace.
///
/// Documentation for the APIs can be found here:
/// <https://ethereum.github.io/execution-apis/api-documentation/>
pub mod eth {
/// Gets the current client version.
pub struct BlockNumber as "eth_blockNumber"
Empty => U256;
/// Simulates a transaction without adding it to the blockchain.
pub struct Call as "eth_call"
(TransactionCall, BlockId) => Vec<u8> [serialization::bytes];
/// Returns information about a block by hash.
pub struct GetBlockByHash as "eth_getBlockByHash"
(Digest, Hydrated) => Option<Block>;
/// Returns information about a block by number.
pub struct GetBlockByNumber as "eth_getBlockByNumber"
(BlockSpec, Hydrated) => Option<Block>;
/// Returns the number of transactions in a block from a block matching the given block hash.
pub struct GetBlockTransactionCountByHash as "eth_getBlockTransactionCountByHash"
(Digest,) => Option<U256>;
/// Returns the number of transactions in a block matching the given block number.
pub struct GetBlockTransactionCountByNumber as "eth_getBlockTransactionCountByNumber"
(BlockSpec,) => Option<U256>;
/// Returns code at a given address.
pub struct GetCode as "eth_getCode"
(Address, BlockId) => Vec<u8> [serialization::bytes];
/// Returns a collection of all logs matching the given filter.
pub struct GetLogs as "eth_getLogs"
(LogFilter,) => Vec<Log>;
/// Returns information about a transaction by block hash and transaction index position.
pub struct GetTransactionByBlockHashAndIndex as "eth_getTransactionByBlockHashAndIndex"
(Digest, U256) => Option<SignedTransaction>;
/// Returns information about a transaction by block number and transaction index position.
pub struct GetTransactionByBlockNumberAndIndex as "eth_getTransactionByBlockNumberAndIndex"
(BlockSpec, U256) => Option<SignedTransaction>;
/// Returns information about a transaction requested by transaction hash.
pub struct GetTransactionByHash as "eth_getTransactionByHash"
(Digest,) => Option<SignedTransaction>;
}
}
/// Module containing common extensions to the standard Ethereum RPC methods.
pub mod ext {
use crate::{serialization, types::*};
module! {
/// Extensions to the `eth` namespace.
pub mod eth {
/// Simulates a transaction without adding it to the blockchain with
/// support for state overrides.
pub struct Call as "eth_call"
(TransactionCall, BlockId, StateOverrides) => Vec<u8> [serialization::bytes];
}
}
}