Findings from binding the vendored rs-clob-client-v2 into the polymarket-clob crate (Plan 3b, Task 1). Covers import paths, type quirks, builder patterns, and clippy landmines introduced by enabling the "clob" feature across the workspace.

Import Paths

The SDK does not re-export everything at the crate root. Use these exact paths:

SymbolPath
U256polymarket_client_sdk_v2::types::U256
Unauthenticatedpolymarket_client_sdk_v2::auth::state::Unauthenticated
Clientpolymarket_client_sdk_v2::clob::Client
Configpolymarket_client_sdk_v2::clob::Config

Unauthenticated is NOT re-exported at crate root

use polymarket_client_sdk_v2::Unauthenticated does not compile. You must use the full auth::state path.

U256 Parsing and Display

U256 is alloy’s primitive, re-exported from the SDK’s types module.

  • Parse from string: U256::from_str(s) via std::str::FromStr trait.
  • Do NOT use: from_str_radix — alloy’s U256 does not expose this method.
  • Display: u256_val.to_string() emits decimal, not hex. This is important when serialising token IDs for CLOB requests.

Client Construction

Client::new(host: &str, config: Config) -> Result<Client<Unauthenticated>>

There is no chain ID argument — the chain is implicit in the host/config. Do not pass it.

Builder Patterns

OrderBookSummaryRequest uses a bon builder:

let req = OrderBookSummaryRequest::builder()
    .token_id(u256_val)
    .build();

.build() returns the struct directly — not a Result. Do not unwrap or ?.

MarketResponse Field Types

MarketResponse field types that differ from what you might expect:

FieldTypeNotes
end_date_isoOption<DateTime<Utc>>Nullable
minimum_tick_sizeDecimalFlat Decimal, NOT TickSize
neg_riskboolDirect bool
tokensVec<Token>See Token fields below

Token fields:

  • token_id: U256
  • outcome: String

TickSizeResponse.minimum_tick_size (a separate response type) is TickSize — call .as_decimal() to get a Decimal.

Clippy Landmines from the "clob" Feature

Enabling features = ["clob"] causes cargo clippy --workspace --all-targets to lint the vendored crate. Several issues require suppression.

Vendored Config::default() impl

The vendored Config has a manual Default impl that clippy flags as clippy::derivable_impls. Suppress on the vendored impl:

#[expect(clippy::derivable_impls, reason = "vendored code")]
impl Default for Config { ... }

Vendored example required-features

Four vendored examples (async, authenticated, aws_authenticated, builder_authenticated) were missing "tracing" in their required-features. Add it to fix the clippy gate.

single_option_map

A function returning Option with a single .map() call triggers clippy::single_option_map. Two remedies:

  1. Suppress with #[expect(clippy::single_option_map, reason = "...")]
  2. Renaming with an _opt suffix alone does not satisfy the lint — the suppression attribute is still needed.

The plan’s secs_until was renamed to secs_until_opt and also needed #[expect(clippy::single_option_map)].

unused_self

Methods that reference self only in the signature trigger clippy::unused_self. Fix by making them associated functions:

fn foo(m: &MarketType) { ... }
// call as:
Self::foo(&self.market);

struct_excessive_bools

Existing #[allow(clippy::struct_excessive_bools)] suppressions must be converted to #[expect(..., reason = "...")] under workspace lint rules (the workspace Cargo.toml uses expect everywhere).

For Agents

The workspace enforces #[expect] not #[allow] for clippy suppressions. Any vendored or new code added under features = ["clob"] must follow the same convention or the gate will fail.