alloy_node_bindings::nodes::reth

Struct Reth

source
pub struct Reth { /* private fields */ }
Expand description

Builder for launching reth.

§Panics

If spawn is called without reth being available in the user’s $PATH

§Example

use alloy_node_bindings::Reth;

let port = 8545u16;
let url = format!("http://localhost:{}", port).to_string();

let reth = Reth::new().instance(1).block_time("12sec").spawn();

drop(reth); // this will kill the instance

Implementations§

source§

impl Reth

source

pub fn new() -> Self

Creates an empty Reth builder.

The instance number is set to a random number between 1 and 200 by default to reduce the odds of port conflicts. This can be changed with Reth::instance. Set to 0 to use the default ports. 200 is the maximum number of instances that can be run set by Reth.

source

pub fn at(path: impl Into<PathBuf>) -> Self

Creates a Reth builder which will execute reth at the given path.

§Example
use alloy_node_bindings::Reth;
let reth = Reth::at("../reth/target/release/reth").spawn();

println!("Reth running at `{}`", reth.endpoint());
source

pub fn path<T: Into<PathBuf>>(self, path: T) -> Self

Sets the path to the reth executable

By default, it’s expected that reth is in $PATH, see also std::process::Command::new()

source

pub const fn dev(self) -> Self

Enable dev mode for the Reth instance.

source

pub const fn http_port(self, http_port: u16) -> Self

Sets the HTTP port for the Reth instance. Note: this resets the instance number to 0 to allow for custom ports.

source

pub const fn ws_port(self, ws_port: u16) -> Self

Sets the WS port for the Reth instance. Note: this resets the instance number to 0 to allow for custom ports.

source

pub const fn auth_port(self, auth_port: u16) -> Self

Sets the auth port for the Reth instance. Note: this resets the instance number to 0 to allow for custom ports.

source

pub const fn p2p_port(self, p2p_port: u16) -> Self

Sets the p2p port for the Reth instance. Note: this resets the instance number to 0 to allow for custom ports.

source

pub fn block_time(self, block_time: &str) -> Self

Sets the block time for the Reth instance. Parses strings using https://docs.rs/humantime/latest/humantime/fn.parse_duration.html This is only used if dev mode is enabled.

source

pub const fn disable_discovery(self) -> Self

Disables discovery for the Reth instance.

source

pub fn chain_or_path(self, chain_or_path: &str) -> Self

Sets the chain id for the Reth instance.

source

pub const fn enable_ipc(self) -> Self

Enable IPC for the Reth instance.

source

pub const fn instance(self, instance: u16) -> Self

Sets the instance number for the Reth instance. Set to 0 to use the default ports. By default, a random number between 1 and 200 is used.

source

pub fn ipc_path<T: Into<PathBuf>>(self, path: T) -> Self

Sets the IPC path for the socket.

source

pub fn data_dir<T: Into<PathBuf>>(self, path: T) -> Self

Sets the data directory for reth.

source

pub fn genesis(self, genesis: Genesis) -> Self

Sets the genesis.json for the Reth instance.

If this is set, reth will be initialized with reth init and the --datadir option will be set to the same value as data_dir.

This is destructive and will overwrite any existing data in the data directory.

source

pub fn arg<T: Into<OsString>>(self, arg: T) -> Self

Adds an argument to pass to reth.

Pass any arg that is not supported by the builder.

source

pub fn args<I, S>(self, args: I) -> Self
where I: IntoIterator<Item = S>, S: Into<OsString>,

Adds multiple arguments to pass to reth.

Pass any args that is not supported by the builder.

source

pub fn spawn(self) -> RethInstance

Consumes the builder and spawns reth.

§Panics

If spawning the instance fails at any point.

source

pub fn try_spawn(self) -> Result<RethInstance, NodeError>

Consumes the builder and spawns reth. If spawning fails, returns an error.

Trait Implementations§

source§

impl Clone for Reth

source§

fn clone(&self) -> Reth

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Reth

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Reth

source§

fn default() -> Reth

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Reth

§

impl RefUnwindSafe for Reth

§

impl Send for Reth

§

impl Sync for Reth

§

impl Unpin for Reth

§

impl UnwindSafe for Reth

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more