diff --git a/kinode/src/main.rs b/kinode/src/main.rs index e5794e3c..ae5626c7 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -109,21 +109,17 @@ async fn main() { arg!(--testnet "If set, use Sepolia testnet") .default_value("false") .value_parser(value_parser!(bool)), - ); - - #[cfg(not(feature = "simulation-mode"))] - let app = app - .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)) - .arg(arg!(--rpcnode "RPC node provider must be a valid address").required(false)) + ) .arg( arg!(--public "If set, allow rpc passthrough") .default_value("false") .value_parser(value_parser!(bool)), - ); + ) + .arg(arg!(--rpcnode "RPC node provider must be a valid address").required(false)) + .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)); #[cfg(feature = "simulation-mode")] let app = app - .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)")) .arg(arg!(--password "Networking password")) .arg(arg!(--"fake-node-name" "Name of fake node to boot")) .arg( @@ -194,20 +190,34 @@ async fn main() { #[cfg(not(feature = "simulation-mode"))] let (rpc_node, _is_detached) = (matches.get_one::("rpcnode").cloned(), false); + //#[cfg(feature = "simulation-mode")] + let (rpc_url, rpc_node, password, network_router_port, fake_node_name, is_detached) = ( + matches.get_one::("rpc"), + matches.get_one::("rpcnode"), + matches.get_one::("password"), + matches + .get_one::("network-router-port") + .unwrap() + .clone(), + matches.get_one::("fake-node-name"), + matches.get_one::("detached").unwrap().clone(), + ); + + type ProviderInput = lib::eth::ProviderInput; let eth_provider: ProviderInput; match (rpc_url, rpc_node) { (Some(url), Some(_)) => { println!("passed both node and url for rpc, using url."); - eth_provider = ProviderInput::Ws(url); + eth_provider = ProviderInput::Ws(url.clone()); } (Some(url), None) => { - eth_provider = ProviderInput::Ws(url); + eth_provider = ProviderInput::Ws(url.clone()); } (None, Some(node)) => { println!("trying to use remote node for rpc: {}", node); - eth_provider = ProviderInput::Node(node); + eth_provider = ProviderInput::Node(node.clone()); } (None, None) => { let random_provider = default_pki_entries.choose(&mut rand::thread_rng()).unwrap(); @@ -219,18 +229,6 @@ async fn main() { } } - #[cfg(feature = "simulation-mode")] - let (rpc_url, password, network_router_port, fake_node_name, is_detached) = ( - matches.get_one::("rpc"), - matches.get_one::("password"), - matches - .get_one::("network-router-port") - .unwrap() - .clone(), - matches.get_one::("fake-node-name"), - matches.get_one::("detached").unwrap().clone(), - ); - if let Err(e) = fs::create_dir_all(home_directory_path).await { panic!("failed to create home directory: {:?}", e); } @@ -342,7 +340,6 @@ async fn main() { &home_directory_path, our_ip.to_string(), http_server_port.clone(), - rpc_url.clone(), on_testnet, // true if testnet mode ) .await @@ -588,7 +585,8 @@ async fn main() { if let Some(rpc_url) = rpc_url { tasks.spawn(eth::provider::provider( our.name.clone(), - rpc_url.clone(), + eth_provider, + public, kernel_message_sender.clone(), eth_provider_receiver, print_sender.clone(), diff --git a/kinode/src/net/mod.rs b/kinode/src/net/mod.rs index a565759c..88b46e38 100644 --- a/kinode/src/net/mod.rs +++ b/kinode/src/net/mod.rs @@ -14,12 +14,14 @@ use { }, }; -#[cfg(not(feature = "simulation-mode"))] +//#[cfg(not(feature = "simulation-mode"))] mod types; #[cfg(not(feature = "simulation-mode"))] mod utils; +//#[cfg(not(feature = "simulation-mode"))] +pub use crate::net::types::*; #[cfg(not(feature = "simulation-mode"))] -pub use crate::net::{types::*, utils::*}; +pub use crate::net::utils::*; #[cfg(not(feature = "simulation-mode"))] use lib::types::core::*;