dydx 0.3.0

dYdX v4 asynchronous client.
Documentation
/// Indexer client configuration.
pub mod config;
mod rest;
mod sock;
/// Tokens.
pub mod tokens;
/// Types for Indexer data.
pub mod types;

pub use config::IndexerConfig;
pub use rest::*;
pub use sock::*;
pub use tokens::*;
pub use types::*;

/// Indexer client.
#[derive(Debug)]
pub struct IndexerClient {
    rest: RestClient,
    sock: SockClient,
}

impl IndexerClient {
    /// Create a new Indexer client.
    pub fn new(config: IndexerConfig) -> Self {
        Self {
            rest: RestClient::new(config.rest),
            sock: SockClient::new(config.sock),
        }
    }

    /// Get accounts query dispatcher.
    pub fn accounts(&self) -> rest::Accounts<'_> {
        self.rest.accounts()
    }

    /// Get markets query dispatcher.
    pub fn markets(&self) -> rest::Markets<'_> {
        self.rest.markets()
    }

    /// Get utility query dispatcher.
    pub fn utility(&self) -> rest::Utility<'_> {
        self.rest.utility()
    }

    /// Get vaults query dispatcher.
    pub fn vaults(&self) -> rest::Vaults<'_> {
        self.rest.vaults()
    }

    /// Get affiliates query dispatcher.
    pub fn affiliates(&self) -> rest::Affiliates<'_> {
        self.rest.affiliates()
    }

    /// Get feeds dispatcher.
    pub fn feed(&mut self) -> Feeds<'_> {
        Feeds::new(&mut self.sock)
    }
}