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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T