Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rpc): setters for TransportRpcModules #13773

Merged
merged 2 commits into from
Jan 11, 2025
Merged
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
28 changes: 28 additions & 0 deletions crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,34 @@ pub struct TransportRpcModules<Context = ()> {
// === impl TransportRpcModules ===

impl TransportRpcModules {
/// Sets a custom [`TransportRpcModuleConfig`] for the configured modules.
/// This will overwrite current configuration, if any.
pub fn with_config(mut self, config: TransportRpcModuleConfig) -> Self {
self.config = config;
self
}

/// Sets the [`RpcModule`] for the http transport.
/// This will overwrite current module, if any.
pub fn with_http(mut self, http: RpcModule<()>) -> Self {
self.http = Some(http);
self
}

/// Sets the [`RpcModule`] for the ws transport.
/// This will overwrite current module, if any.
pub fn with_ws(mut self, ws: RpcModule<()>) -> Self {
self.ws = Some(ws);
self
}

/// Sets the [`RpcModule`] for the http transport.
/// This will overwrite current module, if any.
pub fn with_ipc(mut self, ipc: RpcModule<()>) -> Self {
self.ipc = Some(ipc);
self
}

/// Returns the [`TransportRpcModuleConfig`] used to configure this instance.
pub const fn module_config(&self) -> &TransportRpcModuleConfig {
&self.config
Expand Down
Loading