import type { BuilderConfig } from "@polymarket/builder-signing-sdk"; import type { RequestOptions } from "./http-helpers/index.ts"; import { OrderBuilder } from "./order-builder/builder.ts"; import type { SignatureType, SignedOrder } from "./order-utils/index.ts"; import type { IRfqClient } from "./rfq-deps.ts"; import type { ClobSigner } from "./signer.ts"; import type { ApiKeyCreds, ApiKeysResponse, BalanceAllowanceParams, BalanceAllowanceResponse, BanStatus, BookParams, BuilderApiKey, BuilderApiKeyResponse, BuilderTrade, Chain, CreateOrderOptions, DropNotificationParams, FeeRates, HeartbeatResponse, MarketPrice, MarketReward, MarketTradeEvent, NegRisk, Notification, OpenOrder, OpenOrderParams, OpenOrdersResponse, OrderBookSummary, OrderMarketCancelParams, OrderPayload, OrderScoring, OrderScoringParams, OrdersScoring, OrdersScoringParams, PaginationPayload, PostOrdersArgs, PriceHistoryFilterParams, ReadonlyApiKeyResponse, RewardsPercentages, TickSize, TickSizes, TotalUserEarning, Trade, TradeParams, UserEarning, UserMarketOrder, UserOrder, UserRewardsEarning } from "./types.ts"; import { OrderType, Side } from "./types.ts"; export declare class ClobClient { readonly host: string; readonly chainId: Chain; readonly signer?: ClobSigner; readonly creds?: ApiKeyCreds; readonly orderBuilder: OrderBuilder; readonly tickSizes: TickSizes; readonly negRisk: NegRisk; readonly feeRates: FeeRates; readonly geoBlockToken?: string; readonly useServerTime?: boolean; readonly builderConfig?: BuilderConfig; readonly rfq: IRfqClient; readonly retryOnError?: boolean; readonly throwOnError: boolean; private tickSizeTimestamps; private readonly tickSizeTtlMs; constructor(host: string, chainId: Chain, signer?: ClobSigner, creds?: ApiKeyCreds, signatureType?: SignatureType, funderAddress?: string, geoBlockToken?: string, useServerTime?: boolean, builderConfig?: BuilderConfig, getSigner?: () => Promise | ClobSigner, retryOnError?: boolean, tickSizeTtlMs?: number, throwOnError?: boolean); getOk(): Promise; getServerTime(): Promise; getSamplingSimplifiedMarkets(next_cursor?: string): Promise; getSamplingMarkets(next_cursor?: string): Promise; getSimplifiedMarkets(next_cursor?: string): Promise; getMarkets(next_cursor?: string): Promise; getMarket(conditionID: string): Promise; getOrderBook(tokenID: string): Promise; getOrderBooks(params: BookParams[]): Promise; getTickSize(tokenID: string): Promise; /** * Clears the tick size cache, forcing fresh fetches on the next access. * @param tokenID - If provided, only clears the cache for this token. Otherwise clears all. */ clearTickSizeCache(tokenID?: string): void; getNegRisk(tokenID: string): Promise; getFeeRateBps(tokenID: string): Promise; /** * Calculates the hash for the given orderbook * @param orderbook * @returns */ getOrderBookHash(orderbook: OrderBookSummary): Promise; getMidpoint(tokenID: string): Promise; getMidpoints(params: BookParams[]): Promise; getPrice(tokenID: string, side: string): Promise; getPrices(params: BookParams[]): Promise; getSpread(tokenID: string): Promise; getSpreads(params: BookParams[]): Promise; getLastTradePrice(tokenID: string): Promise; getLastTradesPrices(params: BookParams[]): Promise; getPricesHistory(params: PriceHistoryFilterParams): Promise; /** * Creates a new API key for a user * @param nonce * @returns ApiKeyCreds */ createApiKey(nonce?: number): Promise; /** * Derives an existing API key for a user * @param nonce * @returns ApiKeyCreds */ deriveApiKey(nonce?: number): Promise; createOrDeriveApiKey(nonce?: number): Promise; getApiKeys(): Promise; getClosedOnlyMode(): Promise; deleteApiKey(): Promise; /** * Creates a new readonly API key for a user * @returns ReadonlyApiKeyResponse */ createReadonlyApiKey(): Promise; getReadonlyApiKeys(): Promise; /** * Deletes a readonly API key for a user * @param key The readonly API key to delete * @returns boolean */ deleteReadonlyApiKey(key: string): Promise; /** * Validates a readonly API key for a given address * @param address The wallet address * @param key The readonly API key to validate * @returns string */ validateReadonlyApiKey(address: string, key: string): Promise; getOrder(orderID: string): Promise; getTrades(params?: TradeParams, only_first_page?: boolean, next_cursor?: string): Promise; getTradesPaginated(params?: TradeParams, next_cursor?: string): Promise<{ trades: Trade[]; next_cursor: string; limit: number; count: number; }>; getBuilderTrades(params?: TradeParams, next_cursor?: string): Promise<{ trades: BuilderTrade[]; next_cursor: string; limit: number; count: number; }>; getNotifications(): Promise; dropNotifications(params?: DropNotificationParams): Promise; getBalanceAllowance(params?: BalanceAllowanceParams): Promise; updateBalanceAllowance(params?: BalanceAllowanceParams): Promise; createOrder(userOrder: UserOrder, options?: Partial): Promise; createMarketOrder(userMarketOrder: UserMarketOrder, options?: Partial): Promise; createAndPostOrder(userOrder: UserOrder, options?: Partial, orderType?: T, deferExec?: boolean, postOnly?: boolean): Promise; createAndPostMarketOrder(userMarketOrder: UserMarketOrder, options?: Partial, orderType?: T, deferExec?: boolean): Promise; getOpenOrders(params?: OpenOrderParams, only_first_page?: boolean, next_cursor?: string): Promise; postOrder(order: SignedOrder, orderType?: T, deferExec?: boolean, postOnly?: boolean): Promise; postOrders(args: PostOrdersArgs[], deferExec?: boolean, defaultPostOnly?: boolean): Promise; cancelOrder(payload: OrderPayload): Promise; cancelOrders(ordersHashes: string[]): Promise; cancelAll(): Promise; /** * Sends a heartbeat to the server to keep the session active. * * If heartbeats are started and one isn't sent within 10s, all orders will be cancelled. * Requires Level 2 authentication. * * Pass the previously returned `heartbeat_id` to chain heartbeats. * Pass `undefined`/`null` to start a new heartbeat chain. */ postHeartbeat(heartbeatId?: string | null): Promise; cancelMarketOrders(payload: OrderMarketCancelParams): Promise; isOrderScoring(params?: OrderScoringParams): Promise; areOrdersScoring(params?: OrdersScoringParams): Promise; getEarningsForUserForDay(date: string): Promise; getTotalEarningsForUserForDay(date: string): Promise; getUserEarningsAndMarketsConfig(date: string, order_by?: string, position?: string, no_competition?: boolean): Promise; getRewardPercentages(): Promise; getCurrentRewards(): Promise; getRawRewardsForMarket(conditionId: string): Promise; getMarketTradesEvents(conditionID: string): Promise; calculateMarketPrice(tokenID: string, side: Side, amount: number, orderType?: OrderType): Promise; createBuilderApiKey(): Promise; getBuilderApiKeys(): Promise; revokeBuilderApiKey(): Promise; protected _resolveTickSize(tokenID: string, tickSize?: TickSize): Promise; protected get(endpoint: string, options?: RequestOptions): Promise; protected post(endpoint: string, options?: RequestOptions): Promise; protected put(endpoint: string, options?: RequestOptions): Promise; protected del(endpoint: string, options?: RequestOptions): Promise; private throwIfError; private canL1Auth; private canL2Auth; private mustBuilderAuth; private canBuilderAuth; private _resolveFeeRateBps; private _generateBuilderHeaders; private _getBuilderHeaders; /** * Opportunistically updates the tick size cache from an order book response. */ private updateTickSizeFromOrderBook; }