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 state_overrides: Option<StateOverrideSet>,
41 ) -> RpcResult<Bytes>;
42
43 #[method(name = "eth_chainId")]
45 async fn chain_id(&self) -> RpcResult<U256>;
46
47 #[method(name = "eth_estimateGas")]
50 async fn estimate_gas(
51 &self,
52 transaction: GenericTransaction,
53 block: Option<BlockNumberOrTag>,
54 ) -> RpcResult<U256>;
55
56 #[method(name = "eth_gasPrice")]
58 async fn gas_price(&self) -> RpcResult<U256>;
59
60 #[method(name = "eth_getBalance")]
62 async fn get_balance(&self, address: Address, block: BlockNumberOrTagOrHash)
63 -> RpcResult<U256>;
64
65 #[method(name = "eth_getBlockByHash")]
67 async fn get_block_by_hash(
68 &self,
69 block_hash: H256,
70 hydrated_transactions: bool,
71 ) -> RpcResult<Option<Block>>;
72
73 #[method(name = "eth_getBlockByNumber")]
75 async fn get_block_by_number(
76 &self,
77 block: BlockNumberOrTag,
78 hydrated_transactions: bool,
79 ) -> RpcResult<Option<Block>>;
80
81 #[method(name = "eth_getBlockTransactionCountByHash")]
83 async fn get_block_transaction_count_by_hash(
84 &self,
85 block_hash: Option<H256>,
86 ) -> RpcResult<Option<U256>>;
87
88 #[method(name = "eth_getBlockTransactionCountByNumber")]
90 async fn get_block_transaction_count_by_number(
91 &self,
92 block: Option<BlockNumberOrTag>,
93 ) -> RpcResult<Option<U256>>;
94
95 #[method(name = "eth_getCode")]
97 async fn get_code(&self, address: Address, block: BlockNumberOrTagOrHash) -> RpcResult<Bytes>;
98
99 #[method(name = "eth_getLogs")]
101 async fn get_logs(&self, filter: Option<Filter>) -> RpcResult<FilterResults>;
102
103 #[method(name = "eth_getStorageAt")]
105 async fn get_storage_at(
106 &self,
107 address: Address,
108 storage_slot: U256,
109 block: BlockNumberOrTagOrHash,
110 ) -> RpcResult<Bytes>;
111
112 #[method(name = "eth_getTransactionByBlockHashAndIndex")]
114 async fn get_transaction_by_block_hash_and_index(
115 &self,
116 block_hash: H256,
117 transaction_index: U256,
118 ) -> RpcResult<Option<TransactionInfo>>;
119
120 #[method(name = "eth_getTransactionByBlockNumberAndIndex")]
122 async fn get_transaction_by_block_number_and_index(
123 &self,
124 block: BlockNumberOrTag,
125 transaction_index: U256,
126 ) -> RpcResult<Option<TransactionInfo>>;
127
128 #[method(name = "eth_getTransactionByHash")]
130 async fn get_transaction_by_hash(
131 &self,
132 transaction_hash: H256,
133 ) -> RpcResult<Option<TransactionInfo>>;
134
135 #[method(name = "eth_getTransactionCount")]
137 async fn get_transaction_count(
138 &self,
139 address: Address,
140 block: BlockNumberOrTagOrHash,
141 ) -> RpcResult<U256>;
142
143 #[method(name = "eth_getTransactionReceipt")]
145 async fn get_transaction_receipt(
146 &self,
147 transaction_hash: H256,
148 ) -> RpcResult<Option<ReceiptInfo>>;
149
150 #[method(name = "eth_maxPriorityFeePerGas")]
152 async fn max_priority_fee_per_gas(&self) -> RpcResult<U256>;
153
154 #[method(name = "eth_sendRawTransaction")]
157 async fn send_raw_transaction(&self, transaction: Bytes) -> RpcResult<H256>;
158
159 #[method(name = "eth_sendTransaction")]
161 async fn send_transaction(&self, transaction: GenericTransaction) -> RpcResult<H256>;
162
163 #[method(name = "eth_syncing")]
165 async fn syncing(&self) -> RpcResult<SyncingStatus>;
166
167 #[method(name = "net_listening")]
169 async fn net_listening(&self) -> RpcResult<bool>;
170
171 #[method(name = "net_version")]
173 async fn net_version(&self) -> RpcResult<String>;
174
175 #[method(name = "web3_clientVersion")]
177 async fn web3_client_version(&self) -> RpcResult<String>;
178
179 #[method(name = "eth_feeHistory")]
184 async fn fee_history(
185 &self,
186 block_count: U256,
187 newest_block: BlockNumberOrTag,
188 reward_percentiles: Option<Vec<f64>>,
189 ) -> RpcResult<FeeHistoryResult>;
190
191 #[subscription(
195 name = "eth_subscribe" => "eth_subscription",
196 unsubscribe = "eth_unsubscribe",
197 item = SubscriptionItem
198 )]
199 async fn eth_subscribe(&self, kind: SubscriptionKind, options: Option<SubscriptionOptions>);
200}