pub struct DexClient { /* private fields */ }Expand description
Client for fetching DEX aggregator data.
Implementations§
Source§impl DexClient
impl DexClient
Sourcepub fn new() -> Self
👎Deprecated since 0.8.0: pass the transport: use DexClient::new_with_http
pub fn new() -> Self
pass the transport: use DexClient::new_with_http
Creates a new DEX client with a transport built from the environment.
Sourcepub fn new_with_http(http: Arc<dyn HttpClient>) -> Self
pub fn new_with_http(http: Arc<dyn HttpClient>) -> Self
Creates a new DEX client with a pre-built HTTP transport.
Sourcepub async fn get_token_price(
&self,
chain: &str,
token_address: &str,
) -> Option<f64>
pub async fn get_token_price( &self, chain: &str, token_address: &str, ) -> Option<f64>
Fetches the USD price of a token by its address.
Returns None if the token is not found or has no price data.
Sourcepub async fn get_native_token_price(&self, chain: &str) -> Option<f64>
pub async fn get_native_token_price(&self, chain: &str) -> Option<f64>
Fetches the native token price for a chain.
Uses well-known wrapped token addresses to determine the native token price.
Sourcepub async fn get_token_data(
&self,
chain: &str,
token_address: &str,
) -> Result<DexTokenData>
pub async fn get_token_data( &self, chain: &str, token_address: &str, ) -> Result<DexTokenData>
Sourcepub async fn search_tokens(
&self,
query: &str,
chain: Option<&str>,
) -> Result<Vec<TokenSearchResult>>
pub async fn search_tokens( &self, query: &str, chain: Option<&str>, ) -> Result<Vec<TokenSearchResult>>
Sourcepub async fn get_token_profiles(&self) -> Result<Vec<DiscoverToken>>
pub async fn get_token_profiles(&self) -> Result<Vec<DiscoverToken>>
Fetches latest token profiles (featured tokens) from DexScreener.
Sourcepub async fn get_token_boosts(&self) -> Result<Vec<DiscoverToken>>
pub async fn get_token_boosts(&self) -> Result<Vec<DiscoverToken>>
Fetches latest boosted tokens from DexScreener.
Sourcepub async fn get_token_boosts_top(&self) -> Result<Vec<DiscoverToken>>
pub async fn get_token_boosts_top(&self) -> Result<Vec<DiscoverToken>>
Fetches top boosted tokens (most active boosts) from DexScreener.
Sourcepub fn estimate_7d_volume(volume_24h: f64) -> f64
pub fn estimate_7d_volume(volume_24h: f64) -> f64
Gets the 7-day volume by extrapolating from 24h data.
Note: DexScreener doesn’t provide 7d volume directly, so we estimate based on 24h volume.