Prechádzať zdrojové kódy

chore(fortuna): make fortuna a library crate (#2373)

* make fortuna a lib

* refactor(fortuna): streamline module imports in main.rs
Daniel Chew 9 mesiacov pred
rodič
commit
c7ca8f0dfa

+ 4 - 0
apps/fortuna/Cargo.toml

@@ -3,6 +3,10 @@ name = "fortuna"
 version = "7.4.1"
 edition = "2021"
 
+[lib]
+name = "fortuna"
+path = "src/lib.rs"
+
 [dependencies]
 anyhow = "1.0.75"
 axum = { version = "0.6.20", features = ["json", "ws", "macros"] }

+ 2 - 2
apps/fortuna/src/chain.rs

@@ -1,2 +1,2 @@
-pub(crate) mod ethereum;
-pub(crate) mod reader;
+pub mod ethereum;
+pub mod reader;

+ 1 - 1
apps/fortuna/src/command/run.rs

@@ -101,7 +101,7 @@ pub async fn run_keeper(
     rpc_metrics: Arc<RpcMetrics>,
 ) -> Result<()> {
     let mut handles = Vec::new();
-    let keeper_metrics = Arc::new({
+    let keeper_metrics: Arc<KeeperMetrics> = Arc::new({
         let chain_labels: Vec<(String, Address)> = chains
             .iter()
             .map(|(id, state)| (id.clone(), state.provider_address))

+ 7 - 0
apps/fortuna/src/lib.rs

@@ -0,0 +1,7 @@
+pub mod api;
+pub mod chain;
+pub mod command;
+pub mod config;
+pub mod eth_utils;
+pub mod keeper;
+pub mod state;

+ 6 - 9
apps/fortuna/src/main.rs

@@ -1,14 +1,11 @@
 #![allow(clippy::just_underscores_and_digits)]
 
-use {anyhow::Result, clap::Parser, std::io::IsTerminal};
-
-pub mod api;
-pub mod chain;
-pub mod command;
-pub mod config;
-pub mod eth_utils;
-pub mod keeper;
-pub mod state;
+use {
+    anyhow::Result,
+    clap::Parser,
+    fortuna::{command, config},
+    std::io::IsTerminal,
+};
 
 // Server TODO list:
 // - Tests