pallet_revive_eth_rpc/apis/
execution_apis.rs1#![allow(missing_docs)]
20
21use crate::*;
22use jsonrpsee::{core::RpcResult, proc_macros::rpc};
23
24#[rpc(server, client)]
25pub trait EthRpc {
26 #[method(name = "eth_accounts")]
28 async fn accounts(&self) -> RpcResult<Vec<Address>>;
29
30 #[method(name = "eth_blockNumber")]
32 async fn block_number(&self) -> RpcResult<U256>;
33
34 #[method(name = "eth_call")]
36 async fn call(
37 &self,
38 transaction: GenericTransaction,
39 block: Option<BlockNumberOrTagOrHash>,
40 ) -> RpcResult<Bytes>;
41
42 #[method(name = "eth_chainId")]
44 async fn chain_id(&self) -> RpcResult<U256>;
45
46 #[method(name = "eth_estimateGas")]
49 async fn estimate_gas(
50 &self,
51 transaction: GenericTransaction,
52 block: Option<BlockNumberOrTag>,
53 ) -> RpcResult<U256>;
54
55 #[method(name = "eth_gasPrice")]
57 async fn gas_price(&self) -> RpcResult<U256>;
58
59 #[method(name = "eth_getBalance")]
61 async fn get_balance(&self, address: Address, block: BlockNumberOrTagOrHash)
62 -> RpcResult<U256>;
63
64 #[method(name = "eth_getBlockByHash")]
66 async fn get_block_by_hash(
67 &self,
68 block_hash: H256,
69 hydrated_transactions: bool,
70 ) -> RpcResult<Option<Block>>;
71
72 #[method(name = "eth_getBlockByNumber")]
74 async fn get_block_by_number(
75 &self,
76 block: BlockNumberOrTag,
77 hydrated_transactions: bool,
78 ) -> RpcResult<Option<Block>>;
79
80 #[method(name = "eth_getBlockTransactionCountByHash")]
82 async fn get_block_transaction_count_by_hash(
83 &self,
84 block_hash: Option<H256>,
85 ) -> RpcResult<Option<U256>>;
86
87 #[method(name = "eth_getBlockTransactionCountByNumber")]
89 async fn get_block_transaction_count_by_number(
90 &self,
91 block: Option<BlockNumberOrTag>,
92 ) -> RpcResult<Option<U256>>;
93
94 #[method(name = "eth_getCode")]
96 async fn get_code(&self, address: Address, block: BlockNumberOrTagOrHash) -> RpcResult<Bytes>;
97
98 #[method(name = "eth_getLogs")]
100 async fn get_logs(&self, filter: Option<Filter>) -> RpcResult<FilterResults>;
101
102 #[method(name = "eth_getStorageAt")]
104 async fn get_storage_at(
105 &self,
106 address: Address,
107 storage_slot: U256,
108 block: BlockNumberOrTagOrHash,
109 ) -> RpcResult<Bytes>;
110
111 #[method(name = "eth_getTransactionByBlockHashAndIndex")]
113 async fn get_transaction_by_block_hash_and_index(
114 &self,
115 block_hash: H256,
116 transaction_index: U256,
117 ) -> RpcResult<Option<TransactionInfo>>;
118
119 #[method(name = "eth_getTransactionByBlockNumberAndIndex")]
121 async fn get_transaction_by_block_number_and_index(
122 &self,
123 block: BlockNumberOrTag,
124 transaction_index: U256,
125 ) -> RpcResult<Option<TransactionInfo>>;
126
127 #[method(name = "eth_getTransactionByHash")]
129 async fn get_transaction_by_hash(
130 &self,
131 transaction_hash: H256,
132 ) -> RpcResult<Option<TransactionInfo>>;
133
134 #[method(name = "eth_getTransactionCount")]
136 async fn get_transaction_count(
137 &self,
138 address: Address,
139 block: BlockNumberOrTagOrHash,
140 ) -> RpcResult<U256>;
141
142 #[method(name = "eth_getTransactionReceipt")]
144 async fn get_transaction_receipt(
145 &self,
146 transaction_hash: H256,
147 ) -> RpcResult<Option<ReceiptInfo>>;
148
149 #[method(name = "eth_maxPriorityFeePerGas")]
151 async fn max_priority_fee_per_gas(&self) -> RpcResult<U256>;
152
153 #[method(name = "eth_sendRawTransaction")]
156 async fn send_raw_transaction(&self, transaction: Bytes) -> RpcResult<H256>;
157
158 #[method(name = "eth_sendTransaction")]
160 async fn send_transaction(&self, transaction: GenericTransaction) -> RpcResult<H256>;
161
162 #[method(name = "eth_syncing")]
164 async fn syncing(&self) -> RpcResult<SyncingStatus>;
165
166 #[method(name = "net_listening")]
168 async fn net_listening(&self) -> RpcResult<bool>;
169
170 #[method(name = "net_version")]
172 async fn net_version(&self) -> RpcResult<String>;
173
174 #[method(name = "web3_clientVersion")]
176 async fn web3_client_version(&self) -> RpcResult<String>;
177
178 #[method(name = "eth_feeHistory")]
183 async fn fee_history(
184 &self,
185 block_count: U256,
186 newest_block: BlockNumberOrTag,
187 reward_percentiles: Option<Vec<f64>>,
188 ) -> RpcResult<FeeHistoryResult>;
189}