diff --git a/src/client.rs b/src/client.rs index 9099005..ce471e4 100644 --- a/src/client.rs +++ b/src/client.rs @@ -9,16 +9,16 @@ use crate::types::Cluster; use reqwest::Client; pub struct Helius { - pub config: Config, + pub config: Arc, pub client: Client, pub rpc_client: Arc, } impl Helius { pub fn new(api_key: &str, cluster: Cluster) -> Result { - let config: Config = Config::new(api_key, cluster)?; + let config: Arc = Arc::new(Config::new(api_key, cluster)?); let client: Client = Client::new(); - let rpc_client: RpcClient = Arc::new(RpcClient::new(Arc::new(client.clone()), config.clone())); + let rpc_client: Arc = Arc::new(RpcClient::new(Arc::new(client.clone()), config.clone())?); Ok(Helius { config, diff --git a/src/factory.rs b/src/factory.rs index 3160189..edf1cfb 100644 --- a/src/factory.rs +++ b/src/factory.rs @@ -20,9 +20,9 @@ impl HeliusFactory { } pub fn create(&self, cluster: Cluster) -> Result { - let config: Config = Config::new(&self.api_key, cluster)?; + let config: Arc = Arc::new(Config::new(&self.api_key, cluster)?); let client: Client = Client::new(); - let rpc_client = RpcClient::new(Arc::new(client), Arc::new(config.clone()))?; + let rpc_client: Arc = Arc::new(RpcClient::new(Arc::new(client.clone()), config.clone())?); Ok(Helius { config,