lighter_rs/lib.rs
1//! # Lighter RS
2//!
3//! A comprehensive Rust SDK for the Lighter Protocol trading application blockchain.
4//!
5//! This library provides all necessary functionality for trading on Lighter, including:
6//! - Cryptographic signing and key management
7//! - Transaction construction and validation
8//! - HTTP client for API interactions
9//! - Type-safe transaction types for all supported operations
10//!
11//! ## Modules
12//!
13//! - `constants`: Core constants and limits used throughout the protocol
14//! - `signer`: Cryptographic key management and signing functionality
15//! - `types`: Transaction types and request builders
16//! - `client`: HTTP client for API interactions
17//! - `errors`: Error types and handling
18//!
19//! ## Example
20//!
21//! ```rust,no_run
22//! use lighter_rs::client::TxClient;
23//! use lighter_rs::types::CreateOrderTxReq;
24//!
25//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
26//! // Create a transaction client
27//! let tx_client = TxClient::new(
28//! "https://api.lighter.xyz",
29//! "your_api_key_hex",
30//! 12345, // account_index
31//! 0, // api_key_index
32//! 1, // chain_id
33//! )?;
34//!
35//! // Create and submit an order
36//! // let order = CreateOrderTxReq { ... };
37//! // let result = tx_client.create_order(&order, None).await?;
38//! # Ok(())
39//! # }
40//! ```
41
42pub mod client;
43pub mod constants;
44pub mod errors;
45pub mod signer;
46pub mod types;
47pub mod utils;
48pub mod ws_client;
49
50// Re-export commonly used types
51pub use client::TxResponse;
52pub use constants::*;
53pub use errors::{LighterError, Result};
54pub use signer::{KeyManager, Signer};
55pub use types::{TransactOpts, TxInfo};
56
57/// Library version
58pub const VERSION: &str = env!("CARGO_PKG_VERSION");