use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_rpc_types_anvil::{Forking, Metadata};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "hardhat"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "hardhat"))]
pub trait HardhatApi {
#[method(name = "hardhat_dropTransaction")]
async fn hardhat_drop_transaction(&self, tx_hash: B256) -> RpcResult<bool>;
#[method(name = "impersonateAccount")]
async fn hardhat_impersonate_account(&self, address: Address) -> RpcResult<()>;
#[method(name = "getAutomine")]
async fn hardhat_get_automine(&self) -> RpcResult<bool>;
#[method(name = "metadata")]
async fn hardhat_metadata(&self) -> RpcResult<Metadata>;
#[method(name = "mine")]
async fn hardhat_mine(&self, blocks: Option<U256>, interval: Option<U256>) -> RpcResult<()>;
#[method(name = "reset")]
async fn hardhat_reset(&self, fork: Option<Forking>) -> RpcResult<()>;
#[method(name = "setBalance")]
async fn hardhat_set_balance(&self, address: Address, balance: U256) -> RpcResult<()>;
#[method(name = "setCode")]
async fn hardhat_set_code(&self, address: Address, code: Bytes) -> RpcResult<()>;
#[method(name = "setCoinbase")]
async fn hardhat_set_coinbase(&self, address: Address) -> RpcResult<()>;
#[method(name = "setLoggingEnabled")]
async fn hardhat_set_logging_enabled(&self, enabled: bool) -> RpcResult<()>;
#[method(name = "setMinGasPrice")]
async fn hardhat_set_min_gas_price(&self, gas_price: U256) -> RpcResult<()>;
#[method(name = "setNextBlockBaseFeePerGas")]
async fn hardhat_set_next_block_base_fee_per_gas(
&self,
base_fee_per_gas: U256,
) -> RpcResult<()>;
#[method(name = "setPrevRandao")]
async fn hardhat_set_prev_randao(&self, prev_randao: B256) -> RpcResult<()>;
#[method(name = "setNonce")]
async fn hardhat_set_nonce(&self, address: Address, nonce: U256) -> RpcResult<()>;
#[method(name = "setStorageAt")]
async fn hardhat_set_storage_at(
&self,
address: Address,
slot: U256,
value: B256,
) -> RpcResult<()>;
#[method(name = "stopImpersonatingAccount")]
async fn hardhat_stop_impersonating_account(&self, address: Address) -> RpcResult<()>;
}