chainstream-sdk 2.0.10

SDK for interacting with the ChainStream API
Documentation
//! ChainStream SDK for Rust
//!
//! This SDK provides a Rust client for interacting with the ChainStream API,
//! including both REST API and real-time WebSocket streaming capabilities.
//!
//! # Features
//!
//! - **REST API**: Auto-generated OpenAPI client for all ChainStream endpoints
//! - **Stream API**: Real-time WebSocket subscriptions using the Centrifuge protocol
//! - **Type-safe**: Strongly typed models for all API responses
//!
//! # Quick Start
//!
//! ```rust,no_run
//! use chainstream_sdk::{ChainStreamClient, stream::TokenCandle};
//!
//! #[tokio::main]
//! async fn main() {
//!     // Create a client with your access token
//!     let client = ChainStreamClient::new("your-access-token", None);
//!
//!     // Subscribe to real-time token candles
//!     let unsub = client.stream.subscribe_token_candles(
//!         "sol",
//!         "So11111111111111111111111111111111111111112",
//!         "1s",
//!         |candle: TokenCandle| {
//!             println!("Open: {}, Close: {}", candle.open, candle.close);
//!         },
//!         None,
//!     ).await.unwrap();
//!
//!     // Keep the connection alive
//!     tokio::time::sleep(tokio::time::Duration::from_secs(60)).await;
//!
//!     // Unsubscribe when done
//!     unsub.unsubscribe();
//!
//!     // Close all connections
//!     client.close().await;
//! }
//! ```

#![allow(clippy::doc_lazy_continuation)]
#![allow(clippy::doc_overindented_list_items)]

pub mod chainstream;
pub mod error;
pub mod openapi;
pub mod stream;
pub mod wallet_auth;

// Re-export main types at crate root
pub use chainstream::{
    ChainStreamClient, ChainStreamClientOptions, StaticTokenProvider, TokenProvider,
};
pub use error::ChainStreamError;

/// The default base URL for the ChainStream API
pub const CHAINSTREAM_BASE_URL: &str = "https://api.chainstream.io";

/// The default WebSocket URL for the ChainStream Stream API
pub const CHAINSTREAM_STREAM_URL: &str = "wss://realtime-dex.chainstream.io/connection/websocket";