Skip to main content

k256_sdk/
lib.rs

1//! # K256 SDK
2//!
3//! Official Rust SDK for [K256](https://k256.xyz) - the gateway to Solana's liquidity ecosystem.
4//!
5//! Connect any application to Solana's liquidity ecosystem. One API. All venues. Full observability.
6//!
7//! ## Quick Start
8//!
9//! ```rust,no_run
10//! use k256_sdk::{K256WebSocketClient, Config};
11//!
12//! #[tokio::main]
13//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
14//!     let client = K256WebSocketClient::new(Config {
15//!         api_key: std::env::var("K256_API_KEY")?,
16//!         ..Default::default()
17//!     });
18//!
19//!     client.on_pool_update(|update| {
20//!         println!("Pool {}: slot={}", update.pool_address, update.slot);
21//!     });
22//!
23//!     client.connect().await?;
24//!     Ok(())
25//! }
26//! ```
27//!
28//! ## Features
29//!
30//! - **WebSocket streaming** - Real-time pool updates, priority fees, blockhash
31//! - **Binary protocol** - Low-latency bincode-encoded messages
32//! - **Auto-reconnect** - Exponential backoff with jitter
33//! - **Type-safe** - Strongly typed message structs
34//!
35//! ## Modules
36//!
37//! - [`ws`] - WebSocket client and binary decoder
38//! - [`types`] - Core type definitions
39//! - [`utils`] - Utility functions (base58, pubkey validation)
40
41#![cfg_attr(docsrs, feature(doc_cfg))]
42#![warn(missing_docs)]
43#![warn(rustdoc::missing_crate_level_docs)]
44
45pub mod types;
46pub mod utils;
47pub mod ws;
48
49// Re-exports
50pub use types::*;
51pub use ws::{K256WebSocketClient, Config, SubscribeRequest};