| Crates.io | clob-client-rust |
| lib.rs | clob-client-rust |
| version | 0.2.6 |
| created_at | 2025-11-12 17:19:16.489501+00 |
| updated_at | 2026-01-23 18:42:07.88138+00 |
| description | Polymarket CLOB client ported to Rust: build, sign and submit orders; helper utilities. |
| homepage | |
| repository | https://github.com/imangoMah/polymarket-rs-sdk |
| max_upload_size | |
| id | 1929673 |
| size | 492,581 |
Rust client for Polymarket CLOB (ported from the official TypeScript clob-client).
This crate focuses on:
Important behavior note:
"0.01".[dependencies]
clob-client-rust = "0.1"
Used for trading flows (create/post/cancel) and authenticated reads.
use clob_client_rust::client::ClobClient;
use clob_client_rust::signer_adapter::EthersSigner;
use clob_client_rust::types::ApiKeyCreds;
use std::sync::Arc;
let signer = Arc::new(EthersSigner::new_from_private_key(&pk)?);
let creds = ApiKeyCreds { key, secret, passphrase };
let mut client = ClobClient::new(&host, chain_id, Some(signer), Some(creds), true);
Important TS parity note:
client.getOpenOrders() still uses L2 auth (HMAC headers).getOpenOrdersWithReadonlyKey.ts, by manually calling GET /data/orders with extra headers.Rust parity example (same as TS example, via http_helpers):
use clob_client_rust::endpoints::GET_OPEN_ORDERS;
use clob_client_rust::http_helpers::{RequestOptions, get};
use clob_client_rust::types::SignedOrder;
use std::collections::HashMap;
let endpoint = format!("{}{}", host.trim_end_matches('/'), GET_OPEN_ORDERS);
let mut headers = HashMap::new();
headers.insert("POLY_READONLY_API_KEY".to_string(), readonly_key);
headers.insert("POLY_ADDRESS".to_string(), address.clone());
let mut params = HashMap::new();
params.insert("maker_address".to_string(), address);
let opts = RequestOptions { headers: Some(headers), data: None, params: Some(params) };
let val = get(&endpoint, Some(opts)).await?;
let arr = if val.is_array() { val } else { val["data"].clone() };
let orders: Vec<SignedOrder> = serde_json::from_value(arr)?;
TypeScript injects geo_block_token into every request automatically. In Rust it is optional:
let client = client.with_geo_block_token(token);
When set, the SDK injects geo_block_token into query parameters for supported calls.
RFQ is exposed as a sub-client similar to TS: client.rfq().
use clob_client_rust::types::GetRfqQuotesParams;
let quotes = client
.rfq()
.get_rfq_quotes(Some(GetRfqQuotesParams { limit: Some(10), ..Default::default() }))
.await?;
Accept/approve will:
client.create_order(...)Tick size behavior stays explicit (fallback is "0.01").
The SDK exposes the endpoints added in TS v5.1.0:
create_readonly_api_keyget_readonly_api_keysdelete_readonly_api_keyvalidate_readonly_api_keyTS parity:
create/get/delete require L2 auth.validate_readonly_api_key is a public GET (query params), no L2 needed.See the examples in examples/.
http_helpers provides typed request wrappers including put_typed/put.
Build/sign only (no network):
cargo run --example sign_order
Readonly open orders (TS parity headers):
cargo run --example get_open_orders_with_readonly_key
RFQ quotes:
cargo run --example rfq_get_quotes