Skip to main content

DexDataSource

Trait DexDataSource 

Source
pub trait DexDataSource: Send + Sync {
    // Required methods
    fn get_token_price<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        chain: &'life1 str,
        address: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Option<f64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_native_token_price<'life0, 'life1, 'async_trait>(
        &'life0 self,
        chain: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<f64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_token_data<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        chain: &'life1 str,
        address: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<DexTokenData>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn search_tokens<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 str,
        chain: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<TokenSearchResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for DEX data providers (prices, token data, search).

Abstracts the DexScreener API to enable dependency injection and testing.

Required Methods§

Source

fn get_token_price<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, chain: &'life1 str, address: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches the price for a specific token on a chain.

Source

fn get_native_token_price<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<f64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetches the native token price for a chain (e.g., ETH for ethereum).

Source

fn get_token_data<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, chain: &'life1 str, address: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<DexTokenData>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches comprehensive token data including pairs, volume, liquidity.

Source

fn search_tokens<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 str, chain: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<TokenSearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Searches for tokens by query string with optional chain filter.

Implementors§