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: GenericTransactionV1,
39 block: Option<BlockId>,
40 state_overrides: Option<StateOverrideSetV1>,
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: GenericTransactionV1,
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: BlockId) -> 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<BlockV1>>;
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<BlockV1>>;
79
80 #[method(name = "eth_getBlockReceipts")]
82 async fn get_block_receipts(&self, block: BlockId) -> RpcResult<Option<Vec<ReceiptInfo>>>;
83
84 #[method(name = "eth_getBlockTransactionCountByHash")]
86 async fn get_block_transaction_count_by_hash(
87 &self,
88 block_hash: Option<H256>,
89 ) -> RpcResult<Option<U256>>;
90
91 #[method(name = "eth_getBlockTransactionCountByNumber")]
93 async fn get_block_transaction_count_by_number(
94 &self,
95 block: Option<BlockNumberOrTag>,
96 ) -> RpcResult<Option<U256>>;
97
98 #[method(name = "eth_getCode")]
100 async fn get_code(&self, address: Address, block: BlockId) -> RpcResult<Bytes>;
101
102 #[method(name = "eth_getLogs")]
104 async fn get_logs(&self, filter: Option<Filter>) -> RpcResult<FilterResults>;
105
106 #[method(name = "eth_getStorageAt")]
108 async fn get_storage_at(
109 &self,
110 address: Address,
111 storage_slot: U256,
112 block: BlockId,
113 ) -> RpcResult<Bytes>;
114
115 #[method(name = "eth_getTransactionByBlockHashAndIndex")]
117 async fn get_transaction_by_block_hash_and_index(
118 &self,
119 block_hash: H256,
120 transaction_index: U256,
121 ) -> RpcResult<Option<TransactionInfoV1>>;
122
123 #[method(name = "eth_getTransactionByBlockNumberAndIndex")]
125 async fn get_transaction_by_block_number_and_index(
126 &self,
127 block: BlockNumberOrTag,
128 transaction_index: U256,
129 ) -> RpcResult<Option<TransactionInfoV1>>;
130
131 #[method(name = "eth_getTransactionByHash")]
133 async fn get_transaction_by_hash(
134 &self,
135 transaction_hash: H256,
136 ) -> RpcResult<Option<TransactionInfoV1>>;
137
138 #[method(name = "eth_getTransactionCount")]
140 async fn get_transaction_count(&self, address: Address, block: BlockId) -> 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: GenericTransactionV1) -> 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
190 #[subscription(
194 name = "eth_subscribe" => "eth_subscription",
195 unsubscribe = "eth_unsubscribe",
196 item = SubscriptionItem
197 )]
198 async fn eth_subscribe(&self, kind: SubscriptionKind, options: Option<SubscriptionOptions>);
199}