| Crates.io | rs_order_utils |
| lib.rs | rs_order_utils |
| version | 0.1.2 |
| created_at | 2025-11-18 06:58:18.715305+00 |
| updated_at | 2025-12-01 08:24:26.503278+00 |
| description | Rust implementation of Polymarket CLOB order utilities with EIP-712 signing |
| homepage | https://github.com/tdergouzi/rs-order-utils |
| repository | https://github.com/tdergouzi/rs-order-utils |
| max_upload_size | |
| id | 1937967 |
| size | 82,207 |
🦀 Rust implementation of Polymarket CLOB (Central Limit Order Book) order utilities with EIP-712 typed data signatures.
This library provides a complete Rust port of the TypeScript clob-order-utils package, enabling you to create and sign Polymarket exchange orders using EIP-712 standard.
Add this to your Cargo.toml:
[dependencies]
rs_order_utils = "0.1"
alloy-primitives = "0.8"
alloy-signer-local = "0.5"
tokio = { version = "1.0", features = ["full"] }
use alloy_primitives::{address, U256};
use alloy_signer_local::PrivateKeySigner;
use rs_order_utils::{ExchangeOrderBuilder, OrderData, Side};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a signer
let signer = PrivateKeySigner::random();
let maker = signer.address();
// Create order builder
let builder = ExchangeOrderBuilder::new(
address!("4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E"), // Contract address
137, // Polygon chain ID
signer,
);
// Create order data
let order_data = OrderData {
maker,
taker: address!("0000000000000000000000000000000000000000"),
token_id: U256::from(123456),
maker_amount: U256::from(1_000_000),
taker_amount: U256::from(950_000),
side: Side::Buy,
fee_rate_bps: U256::from(100),
nonce: U256::from(1),
signer: None,
expiration: None,
signature_type: None,
};
// Build and sign the order
let signed_order = builder.build_signed_order(order_data).await?;
println!("Order signed! Signature: {}", signed_order.signature);
Ok(())
}
# Run examples
cargo run --example basic_order
# Run tests
cargo test
# Run tests with output
cargo test -- --nocapture
⚠️ AI-Generated Code: This library was generated with AI assistance. While it has been tested, users should:
MIT
Made with 🦀 by the Polymarket community