From e79769fe248b667c9b437cf39a32beaa0faa4578 Mon Sep 17 00:00:00 2001 From: Nikolay Komarevskiy Date: Tue, 16 Jul 2024 17:50:37 +0200 Subject: [PATCH] chore: fix imports --- ic-agent/src/agent/builder.rs | 30 ++++++++++-------------- ic-agent/src/agent/http_transport/mod.rs | 4 +--- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/ic-agent/src/agent/builder.rs b/ic-agent/src/agent/builder.rs index 5ad2cc175..2aa8eb453 100644 --- a/ic-agent/src/agent/builder.rs +++ b/ic-agent/src/agent/builder.rs @@ -1,18 +1,5 @@ -use reqwest::Client; - use crate::{ - agent::{ - agent_config::AgentConfig, - http_transport::{ - dynamic_routing::{ - dynamic_route_provider::{DynamicRouteProviderBuilder, IC0_SEED_DOMAIN}, - node::Node, - snapshot::latency_based_routing::LatencyRoutingSnapshot, - }, - route_provider::RouteProvider, - }, - Agent, Transport, - }, + agent::{agent_config::AgentConfig, Agent, Transport}, AgentError, Identity, NonceFactory, NonceGenerator, }; use std::sync::Arc; @@ -29,9 +16,18 @@ impl AgentBuilder { Agent::new(self.config) } - /// Set the dynamic transport layer for the [`Agent`], performing continuos discovery of the API boundary nodes and routing traffic via them based on the latencies. - pub async fn with_discovery_transport(self, client: Client) -> Self { - use crate::agent::http_transport::ReqwestTransport; + #[cfg(all(feature = "reqwest", not(target_family = "wasm")))] + /// Set the dynamic transport layer for the [`Agent`], performing continuos discovery of the API boundary nodes and routing traffic via them based on the latencies. + pub async fn with_discovery_transport(self, client: reqwest::Client) -> Self { + use crate::agent::http_transport::{ + dynamic_routing::{ + dynamic_route_provider::{DynamicRouteProviderBuilder, IC0_SEED_DOMAIN}, + node::Node, + snapshot::latency_based_routing::LatencyRoutingSnapshot, + }, + route_provider::RouteProvider, + ReqwestTransport, + }; // TODO: This is a temporary solution to get the seed node. let seed = Node::new(IC0_SEED_DOMAIN).unwrap(); diff --git a/ic-agent/src/agent/http_transport/mod.rs b/ic-agent/src/agent/http_transport/mod.rs index 91959ac0e..7ffdd622c 100644 --- a/ic-agent/src/agent/http_transport/mod.rs +++ b/ic-agent/src/agent/http_transport/mod.rs @@ -30,8 +30,6 @@ const ICP0_SUB_DOMAIN: &str = ".icp0.io"; const ICP_API_SUB_DOMAIN: &str = ".icp-api.io"; #[allow(dead_code)] const LOCALHOST_SUB_DOMAIN: &str = ".localhost"; -/// -#[cfg(not(target_family = "wasm"))] -#[cfg(feature = "reqwest")] +#[cfg(all(feature = "reqwest", not(target_family = "wasm")))] pub mod dynamic_routing; pub mod route_provider;