polymarket_rs/lib.rs
1//! # polymarket-rs
2//!
3//! A Rust client library for interacting with the Polymarket CLOB (Central Limit Order Book) API.
4//!
5//! This library provides a comprehensive, type-safe interface for:
6//! - Market data queries (public)
7//! - Order creation and management (authenticated)
8//! - Account and balance operations (authenticated)
9//! - Position tracking
10//! - Real-time WebSocket streaming for market data and user events
11//!
12//! ## Features
13//!
14//! - **Builder Pattern**: Fluent API for constructing clients and orders
15//! - **Type Safety**: Strong typing with newtypes for IDs (TokenId, OrderId, ConditionId)
16//! - **Proper Error Handling**: No panics, comprehensive error types
17//! - **EIP-712 Signing**: Full support for Ethereum wallet signatures
18//! - **Decimal Precision**: Accurate decimal math for prices and amounts
19//!
20
21// Public modules
22pub mod client;
23pub mod config;
24pub mod error;
25pub mod orders;
26pub mod request;
27pub mod signing;
28pub mod types;
29pub mod websocket;
30
31// Internal modules
32mod http;
33mod utils;
34
35// Re-export commonly used types
36pub use alloy_primitives::Address;
37pub use alloy_signer::k256;
38pub use alloy_signer_local::PrivateKeySigner;
39pub use error::{Error, Result};
40pub use types::{
41 ApiCreds, AssetType, ConditionId, CreateOrderOptions, ExtraOrderArgs, MarketOrderArgs,
42 OrderArgs, OrderId, OrderType, PostOrderArgs, Side, SignatureType, TokenId,
43};
44
45// Re-export clients
46pub use client::{AuthenticatedClient, ClobClient, DataClient, GammaClient, TradingClient};
47
48// Re-export websocket clients
49pub use websocket::{MarketWsClient, UserWsClient};
50
51// Re-export order builder
52pub use orders::OrderBuilder;
53
54// Re-export signer trait
55pub use signing::EthSigner;
56
57// Re-export stream extension traits
58pub use futures_util::StreamExt;