-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add functionality to create all components
commit-id:bb128e01
- Loading branch information
1 parent
f6bd8aa
commit eaac21e
Showing
5 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use starknet_gateway::gateway::{create_gateway, Gateway}; | ||
use starknet_mempool::mempool::Mempool; | ||
|
||
use crate::communication::MempoolNodeClients; | ||
use crate::config::MempoolNodeConfig; | ||
|
||
pub struct Components { | ||
pub gateway: Option<Gateway>, | ||
pub mempool: Option<Mempool>, | ||
} | ||
|
||
pub fn create_components(config: &MempoolNodeConfig, clients: &MempoolNodeClients) -> Components { | ||
let gateway_component = if config.components.gateway_component.execute { | ||
let mempool_clent = | ||
clients.get_mempool_client().expect("Mempool Client should be available"); | ||
|
||
Some(create_gateway( | ||
config.gateway_config.clone(), | ||
config.rpc_state_reader_config.clone(), | ||
mempool_clent, | ||
)) | ||
} else { | ||
None | ||
}; | ||
|
||
let mempool_component = | ||
if config.components.mempool_component.execute { Some(Mempool::empty()) } else { None }; | ||
|
||
Components { gateway: gateway_component, mempool: mempool_component } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pub mod communication; | ||
pub mod components; | ||
pub mod config; | ||
pub mod version; |