import { type ApiKeyCreds, ClobClient, type ClobClientOptions, type MarketDetails, type OpenOrdersResponse, type OrderBookSummary, OrderType, Side, type TickSize } from "@polymarket/clob-client-v2"; import { type PolymarketEnvironment } from "../protocol/constants"; export type PolymarketClobSigner = NonNullable; export type CreatePolymarketClobClientArgs = { chainId: number; environment?: PolymarketEnvironment; host?: string; signer?: PolymarketClobSigner; credentials?: ApiKeyCreds; funderAddress?: string; useServerTime?: boolean; retryOnError?: boolean; throwOnError?: boolean; }; export declare function createPolymarketClobClient({ chainId, environment, host, signer, credentials, funderAddress, useServerTime, retryOnError, throwOnError, }: CreatePolymarketClobClientArgs): ClobClient; export declare function getClobMarketInfo(client: ClobClient, conditionId: string): Promise; export declare function getClobOrderBook(client: ClobClient, tokenId: string): Promise; export declare function getClobTickSize(client: ClobClient, tokenId: string): Promise; export declare function getClobNegRisk(client: ClobClient, tokenId: string): Promise; export declare function getClobMidpoint(client: ClobClient, tokenId: string): Promise; export declare function getClobPrice(client: ClobClient, tokenId: string, side: Side | "BUY" | "SELL"): Promise; export type PolymarketCreateOrderParams = { tokenId: string; price: number; side: Side | "BUY" | "SELL"; size: number; metadata?: string; builderCode?: string; expiration?: number; userUSDCBalance?: number; }; export type PolymarketCreateOrderOptions = { tickSize: TickSize; negRisk?: boolean; orderType?: OrderType.GTC | OrderType.GTD; postOnly?: boolean; deferExec?: boolean; }; export declare function createAndPostClobOrder(client: ClobClient, order: PolymarketCreateOrderParams, options: PolymarketCreateOrderOptions): Promise; /** * Market-order variant of {@link PolymarketCreateOrderParams}. Polymarket's * CLOB v2 splits limit orders (`GTC`/`GTD` via `createAndPostOrder`) from * market orders (`FOK`/`FAK` via `createAndPostMarketOrder`) at the SDK * level, so we expose a dedicated DTO rather than overloading the limit- * order shape. `userUSDCBalance` is FOK/FAK-only — the CLOB uses it to * prevent oversized fills. */ export type PolymarketCreateMarketOrderParams = { tokenId: string; side: Side | "BUY" | "SELL"; /** * For BUY orders, the **dollar** amount to spend (denominated in USDC). * For SELL orders, the **share** amount to sell. Matches the underlying * SDK's `UserMarketOrderV{1,2}.amount` semantics. */ amount: number; /** Worst execution price the caller will accept. Must satisfy `0 < price <= 1`. */ price?: number; metadata?: string; builderCode?: string; /** FOK/FAK-only: caps fills at the caller's available USDC balance. */ userUSDCBalance?: number; }; export type PolymarketCreateMarketOrderOptions = { tickSize: TickSize; negRisk?: boolean; /** * Defaults to `OrderType.FOK` (fill-or-kill) at the SDK layer. Pass * `OrderType.FAK` for fill-and-kill (partial fills allowed; unfilled * remainder cancelled). `postOnly` is rejected by the CLOB for market * orders and therefore not exposed here. */ orderType?: OrderType.FOK | OrderType.FAK; deferExec?: boolean; }; /** * Submit a Polymarket CLOB market order (`FOK` or `FAK`). Thin wrapper over * `ClobClient.createAndPostMarketOrder` that translates the SDK's * `tokenId` / `side` shape to the underlying `tokenID` / `Side` enum. * * `postOnly` is intentionally omitted from * {@link PolymarketCreateMarketOrderOptions} because the CLOB rejects it * for FOK/FAK at request time with `postOnly is not supported for FOK/FAK orders`. */ export declare function createAndPostClobMarketOrder(client: ClobClient, order: PolymarketCreateMarketOrderParams, options: PolymarketCreateMarketOrderOptions): Promise; export type PolymarketOpenOrdersParams = { id?: string; market?: string; assetId?: string; nextCursor?: string; }; export declare function getClobOpenOrders(client: ClobClient, params?: PolymarketOpenOrdersParams): Promise; export type PolymarketCancelOrdersParams = { all?: boolean; orderId?: string; orderIds?: string[]; market?: string; assetId?: string; }; export declare function cancelClobOrders(client: ClobClient, params: PolymarketCancelOrdersParams): Promise; export { ClobClient };