reth_rpc_api/
hardhat.rs
1use alloy_primitives::{Address, Bytes, B256, U256};
2use alloy_rpc_types_anvil::{Forking, Metadata};
3use jsonrpsee::{core::RpcResult, proc_macros::rpc};
4
5#[cfg_attr(not(feature = "client"), rpc(server, namespace = "hardhat"))]
8#[cfg_attr(feature = "client", rpc(server, client, namespace = "hardhat"))]
9pub trait HardhatApi {
10 #[method(name = "hardhat_dropTransaction")]
14 async fn hardhat_drop_transaction(&self, tx_hash: B256) -> RpcResult<bool>;
15
16 #[method(name = "impersonateAccount")]
18 async fn hardhat_impersonate_account(&self, address: Address) -> RpcResult<()>;
19
20 #[method(name = "getAutomine")]
22 async fn hardhat_get_automine(&self) -> RpcResult<bool>;
23
24 #[method(name = "metadata")]
26 async fn hardhat_metadata(&self) -> RpcResult<Metadata>;
27
28 #[method(name = "mine")]
30 async fn hardhat_mine(&self, blocks: Option<U256>, interval: Option<U256>) -> RpcResult<()>;
31
32 #[method(name = "reset")]
34 async fn hardhat_reset(&self, fork: Option<Forking>) -> RpcResult<()>;
35
36 #[method(name = "setBalance")]
38 async fn hardhat_set_balance(&self, address: Address, balance: U256) -> RpcResult<()>;
39
40 #[method(name = "setCode")]
42 async fn hardhat_set_code(&self, address: Address, code: Bytes) -> RpcResult<()>;
43
44 #[method(name = "setCoinbase")]
46 async fn hardhat_set_coinbase(&self, address: Address) -> RpcResult<()>;
47
48 #[method(name = "setLoggingEnabled")]
50 async fn hardhat_set_logging_enabled(&self, enabled: bool) -> RpcResult<()>;
51
52 #[method(name = "setMinGasPrice")]
54 async fn hardhat_set_min_gas_price(&self, gas_price: U256) -> RpcResult<()>;
55
56 #[method(name = "setNextBlockBaseFeePerGas")]
58 async fn hardhat_set_next_block_base_fee_per_gas(
59 &self,
60 base_fee_per_gas: U256,
61 ) -> RpcResult<()>;
62
63 #[method(name = "setPrevRandao")]
65 async fn hardhat_set_prev_randao(&self, prev_randao: B256) -> RpcResult<()>;
66
67 #[method(name = "setNonce")]
69 async fn hardhat_set_nonce(&self, address: Address, nonce: U256) -> RpcResult<()>;
70
71 #[method(name = "setStorageAt")]
73 async fn hardhat_set_storage_at(
74 &self,
75 address: Address,
76 slot: U256,
77 value: B256,
78 ) -> RpcResult<()>;
79
80 #[method(name = "stopImpersonatingAccount")]
82 async fn hardhat_stop_impersonating_account(&self, address: Address) -> RpcResult<()>;
83}