chore: default live CLOB host to production

This commit is contained in:
floor-licker
2026-04-28 09:46:06 -03:00
parent e5994d04dd
commit 54c35a7034
19 changed files with 33 additions and 33 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ use polyfill_rs::{ClobClient, Side, OrderType};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = ClobClient::new("https://clob-v2.polymarket.com");
let client = ClobClient::new("https://clob.polymarket.com");
let markets = client.get_sampling_markets(None).await?;
println!("Found {} markets", markets.data.len());
Ok(())
+3 -3
View File
@@ -11,7 +11,7 @@ fn benchmark_real_simplified_markets(c: &mut Criterion) {
c.bench_function("real_fetch_simplified_markets", |b| {
b.iter(|| {
rt.block_on(async {
let client = ClobClient::new("https://clob-v2.polymarket.com");
let client = ClobClient::new("https://clob.polymarket.com");
// This is the real network request + JSON parsing
let result = client.get_sampling_simplified_markets(None).await;
@@ -28,7 +28,7 @@ fn benchmark_real_markets(c: &mut Criterion) {
c.bench_function("real_fetch_markets", |b| {
b.iter(|| {
rt.block_on(async {
let client = ClobClient::new("https://clob-v2.polymarket.com");
let client = ClobClient::new("https://clob.polymarket.com");
// This is the real network request + JSON parsing
let result = client.get_sampling_markets(None).await;
@@ -52,7 +52,7 @@ fn benchmark_real_order_creation(c: &mut Criterion) {
c.bench_function("real_create_order_eip712", |b| {
b.iter(|| {
rt.block_on(async {
let client = ClobClient::new("https://clob-v2.polymarket.com");
let client = ClobClient::new("https://clob.polymarket.com");
// Set up credentials
if let Ok(_key) = std::env::var("POLYMARKET_PRIVATE_KEY") {
+1 -1
View File
@@ -6,7 +6,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Benchmark with Keep-Alive Enabled");
println!("==================================\n");
let client = ClobClient::new("https://clob-v2.polymarket.com");
let client = ClobClient::new("https://clob.polymarket.com");
// Start keep-alive
println!("Starting keep-alive...");
+1 -1
View File
@@ -95,7 +95,7 @@ impl PolyfillDemo {
pub fn new() -> Result<Self> {
// Create basic client
let config = ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: None,
api_credentials: None,
+1 -1
View File
@@ -20,7 +20,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for i in 1..=20 {
let start = Instant::now();
let response = client
.get("https://clob-v2.polymarket.com/simplified-markets?next_cursor=MA==")
.get("https://clob.polymarket.com/simplified-markets?next_cursor=MA==")
.send()
.await?;
+1 -1
View File
@@ -184,7 +184,7 @@ async fn test_config(
let start = Instant::now();
match client
.get("https://clob-v2.polymarket.com/simplified-markets?next_cursor=MA==")
.get("https://clob.polymarket.com/simplified-markets?next_cursor=MA==")
.send()
.await
{
+1 -1
View File
@@ -127,7 +127,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
};
// Create client with API credentials only (no private key needed for custodial trading)
let mut client = ClobClient::new("https://clob-v2.polymarket.com");
let mut client = ClobClient::new("https://clob.polymarket.com");
client.set_api_creds(api_creds);
println!("✅ Client configured for custodial API trading");
+1 -1
View File
@@ -18,7 +18,7 @@ async fn main() -> Result<()> {
info!("======================");
// Create client
let client = ClobClient::new("https://clob-v2.polymarket.com");
let client = ClobClient::new("https://clob.polymarket.com");
// Test 1: Basic connectivity
info!("\nTesting API Connectivity...");
+2 -2
View File
@@ -29,7 +29,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for i in 1..=20 {
let start = Instant::now();
match baseline_http
.get("https://clob-v2.polymarket.com/simplified-markets?next_cursor=MA==")
.get("https://clob.polymarket.com/simplified-markets?next_cursor=MA==")
.send()
.await
{
@@ -68,7 +68,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Test 2: polyfill-rs (with keep-alive)");
println!("══════════════════════════════════════");
let our_client = polyfill_rs::ClobClient::new("https://clob-v2.polymarket.com");
let our_client = polyfill_rs::ClobClient::new("https://clob.polymarket.com");
our_client
.start_keepalive(std::time::Duration::from_secs(30))
.await;
+2 -2
View File
@@ -101,14 +101,14 @@ mod tests {
#[tokio::test]
async fn test_connection_manager_creation() {
let client = reqwest::ClientBuilder::new().no_proxy().build().unwrap();
let manager = ConnectionManager::new(client, "https://clob-v2.polymarket.com".to_string());
let manager = ConnectionManager::new(client, "https://clob.polymarket.com".to_string());
assert!(!manager.is_running());
}
#[tokio::test]
async fn test_keepalive_start_stop() {
let client = reqwest::ClientBuilder::new().no_proxy().build().unwrap();
let manager = ConnectionManager::new(client, "https://clob-v2.polymarket.com".to_string());
let manager = ConnectionManager::new(client, "https://clob.polymarket.com".to_string());
manager.start_keepalive(Duration::from_secs(30)).await;
tokio::time::sleep(Duration::from_millis(100)).await;
+3 -3
View File
@@ -105,7 +105,7 @@ mod tests {
#[ignore = "requires external DNS/network access"]
async fn test_dns_cache_resolve() {
let cache = DnsCache::new().await.unwrap();
let ips = cache.resolve("clob-v2.polymarket.com").await.unwrap();
let ips = cache.resolve("clob.polymarket.com").await.unwrap();
assert!(!ips.is_empty());
}
@@ -113,7 +113,7 @@ mod tests {
#[ignore = "requires external DNS/network access"]
async fn test_dns_cache_prewarm() {
let cache = DnsCache::new().await.unwrap();
cache.prewarm("clob-v2.polymarket.com").await.unwrap();
cache.prewarm("clob.polymarket.com").await.unwrap();
assert_eq!(cache.cache_size().await, 1);
}
@@ -121,7 +121,7 @@ mod tests {
#[ignore = "requires external DNS/network access"]
async fn test_dns_cache_clear() {
let cache = DnsCache::new().await.unwrap();
cache.prewarm("clob-v2.polymarket.com").await.unwrap();
cache.prewarm("clob.polymarket.com").await.unwrap();
cache.clear().await;
assert_eq!(cache.cache_size().await, 0);
}
+4 -4
View File
@@ -20,7 +20,7 @@
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let bootstrap = ClobClient::from_config(ClientConfig {
//! base_url: "https://clob-v2.polymarket.com".to_string(),
//! base_url: "https://clob.polymarket.com".to_string(),
//! chain: 137,
//! private_key: Some("your_private_key".to_string()),
//! ..ClientConfig::default()
@@ -28,7 +28,7 @@
//!
//! let api_creds = bootstrap.create_or_derive_api_key(None).await?;
//! let client = ClobClient::from_config(ClientConfig {
//! base_url: "https://clob-v2.polymarket.com".to_string(),
//! base_url: "https://clob.polymarket.com".to_string(),
//! chain: 137,
//! private_key: Some("your_private_key".to_string()),
//! api_credentials: Some(api_creds),
@@ -59,7 +59,7 @@
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create a basic client
//! let client = ClobClient::new("https://clob-v2.polymarket.com");
//! let client = ClobClient::new("https://clob.polymarket.com");
//!
//! // Get market data
//! let markets = client.get_sampling_markets(None).await.unwrap();
@@ -77,7 +77,7 @@ use tracing::info;
// Global constants
pub const DEFAULT_CHAIN_ID: u64 = 137; // Polygon
pub const DEFAULT_BASE_URL: &str = "https://clob-v2.polymarket.com";
pub const DEFAULT_BASE_URL: &str = "https://clob.polymarket.com";
pub const DEFAULT_TIMEOUT_SECS: u64 = 30;
pub const DEFAULT_MAX_RETRIES: u32 = 3;
pub const DEFAULT_RATE_LIMIT_RPS: u32 = 100;
+1 -1
View File
@@ -815,7 +815,7 @@ pub struct ClientConfig {
impl Default for ClientConfig {
fn default() -> Self {
Self {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137, // Polygon mainnet
private_key: None,
api_credentials: None,
+1 -1
View File
@@ -20,7 +20,7 @@ impl Default for TestConfig {
fn default() -> Self {
Self {
host: env::var("POLYMARKET_HOST")
.unwrap_or_else(|_| "https://clob-v2.polymarket.com".to_string()),
.unwrap_or_else(|_| "https://clob.polymarket.com".to_string()),
chain: env::var("POLYMARKET_CHAIN_ID")
.unwrap_or_else(|_| "137".to_string())
.parse()
+1 -1
View File
@@ -6,7 +6,7 @@ use polyfill_rs::{ClientConfig, ClobClient, OrderArgs, Side};
use rust_decimal_macros::dec;
use std::env;
const HOST: &str = "https://clob-v2.polymarket.com";
const HOST: &str = "https://clob.polymarket.com";
const CHAIN_ID: u64 = 137;
fn load_env_vars() -> (String, Option<String>, Option<String>, Option<String>) {
+2 -2
View File
@@ -13,7 +13,7 @@ async fn test_post_order_authentication() {
env::var("POLYMARKET_PRIVATE_KEY").expect("POLYMARKET_PRIVATE_KEY must be set in .env");
let bootstrap = ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key.clone()),
..ClientConfig::default()
@@ -26,7 +26,7 @@ async fn test_post_order_authentication() {
.await
.expect("Failed to create API key");
let client = ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key),
api_credentials: Some(creds),
+1 -1
View File
@@ -7,7 +7,7 @@
use polyfill_rs::{ClobClient, PricesHistoryInterval};
const HOST: &str = "https://clob-v2.polymarket.com";
const HOST: &str = "https://clob.polymarket.com";
#[tokio::test(flavor = "multi_thread")]
#[ignore]
+5 -5
View File
@@ -4,7 +4,7 @@ use std::env;
fn build_bootstrap_client(private_key: &str) -> ClobClient {
ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key.to_string()),
..ClientConfig::default()
@@ -30,7 +30,7 @@ async fn test_create_api_key_simple() {
println!("Successfully created/derived API key");
println!(" API Key created (len={})", creds.api_key.len());
let client = ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key),
api_credentials: Some(creds),
@@ -77,7 +77,7 @@ async fn test_get_api_keys() {
.await
.expect("Failed to create API key");
let client = ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key),
api_credentials: Some(creds),
@@ -118,7 +118,7 @@ async fn test_get_trades() {
.await
.expect("Failed to create API key");
let client = ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key),
api_credentials: Some(creds),
@@ -159,7 +159,7 @@ async fn test_get_notifications() {
.await
.expect("Failed to create API key");
let client = ClobClient::from_config(ClientConfig {
base_url: "https://clob-v2.polymarket.com".to_string(),
base_url: "https://clob.polymarket.com".to_string(),
chain: 137,
private_key: Some(private_key),
api_credentials: Some(creds),
+1 -1
View File
@@ -14,7 +14,7 @@ use polyfill_rs::{
use std::env;
use std::time::Duration;
const HOST: &str = "https://clob-v2.polymarket.com";
const HOST: &str = "https://clob.polymarket.com";
const WS_MARKET_URL: &str = "wss://ws-subscriptions-clob.polymarket.com/ws/market";
const WS_USER_URL: &str = "wss://ws-subscriptions-clob.polymarket.com/ws/user";
const CHAIN_ID: u64 = 137;