Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion chain/ethereum/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ pub enum Transport {

impl Transport {
/// Creates an IPC transport.
///
/// Accepts both a raw file path (`/tmp/geth.ipc`) and an `ipc://` URL
/// (`ipc:///tmp/geth.ipc`). When a URL is provided the file path is
/// extracted so that the underlying IPC connector receives a plain path.
#[cfg(unix)]
pub async fn new_ipc(ipc: &str) -> Self {
let transport = IpcConnect::new(ipc.to_string());
let path = Url::parse(ipc)
.ok()
.map(|u| u.path().to_string())
.unwrap_or_else(|| ipc.to_string());
let transport = IpcConnect::new(path);

Transport::IPC(transport)
}
Expand Down