feat: add miner rpc bindings (#13099)

This commit is contained in:
Matthias Seitz
2024-12-03 14:12:13 +01:00
committed by GitHub
parent e4c0f192ee
commit 1404073e05
2 changed files with 24 additions and 0 deletions

View File

@ -21,6 +21,7 @@ mod engine;
mod ganache;
mod hardhat;
mod mev;
mod miner;
mod net;
mod otterscan;
mod reth;
@ -40,6 +41,7 @@ pub mod servers {
debug::{DebugApiServer, DebugExecutionWitnessApiServer},
engine::{EngineApiServer, EngineEthApiServer},
mev::{MevFullApiServer, MevSimApiServer},
miner::MinerApiServer,
net::NetApiServer,
otterscan::OtterscanServer,
reth::RethApiServer,
@ -70,6 +72,7 @@ pub mod clients {
ganache::GanacheApiClient,
hardhat::HardhatApiClient,
mev::{MevFullApiClient, MevSimApiClient},
miner::MinerApiClient,
net::NetApiClient,
otterscan::OtterscanClient,
reth::RethApiClient,

View File

@ -0,0 +1,21 @@
use alloy_primitives::{Bytes, U128};
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
/// Miner namespace rpc interface that can control miner/builder settings
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "miner"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "miner"))]
pub trait MinerApi {
/// Sets the extra data string that is included when this miner mines a block.
///
/// Returns an error if the extra data is too long.
#[method(name = "setExtra")]
fn set_extra(&self, record: Bytes) -> RpcResult<bool>;
/// Sets the minimum accepted gas price for the miner.
#[method(name = "setGasPrice")]
fn set_gas_price(&self, gas_price: U128) -> RpcResult<bool>;
/// Sets the gaslimit to target towards during mining.
#[method(name = "setGasLimit")]
fn set_gas_limit(&self, gas_price: U128) -> RpcResult<bool>;
}