- TypeScript
- Python
- Rust
The examples below map previous client capabilities to
Omit Remote Builder SigningKeep Builder credentials behind your signing endpoint. The client sends the
same On the signing server, replace If you only have a condition ID, filter Set Use
@polymarket/client. The SDK also covers the Gamma API and Data API. Migrating
direct Gamma and Data calls can simplify application code and give you
normalized, typed models that work seamlessly with the SDK’s trading and
account workflows.Install the Unified SDK
Remove the previous CLOB, relayer, and builder-signing packages used by your integration. Then install the unified SDK and your wallet library.The unified SDK includes signer adapters for Viem, Privy, and Ethers v5, so
you can connect your wallet library without implementing CLOB-specific
signing. See Wallet
Integrations for setup
examples.
Client and Wallet Setup
Create a Public Client
PublicClient provides unauthenticated market discovery and data reads.
createPublicClient uses production by default and does not require a host or
chain ID.Before
After
Create an Authenticated Client
SecureClient adds authenticated trading, account, and wallet actions.
createSecureClient derives or creates CLOB credentials, resolves the account
wallet, and configures the correct signing flow.Before
After
wallet to use the default Deposit Wallet flow.Resume With Existing Credentials
Read credentials from an authenticated client, store them securely, and pass them to a new client to resume with the same API key. The signer and wallet must identify the account that owns the credentials.Before
After
Revoke the Current API Key
Ending authentication revokes the current API key, invalidates theSecureClient, and returns a PublicClient.Before
After
Configure Builder API Keys
SecureClient accepts Builder authorization for gasless wallet actions.
Migrate local or remote Builder signing to the matching helper.Local Builder API keyKeep local Builder credentials on the server. The Node.js entrypoint generates
the required HMAC headers.Before
After
{ method, path, body } request and applies the same Builder headers, so
the endpoint contract does not change.Before
After
BuilderConfig.generateBuilderHeaders with
buildHmacSignature. Keep your existing caller authentication and
authorization around this handler.Before
After
Configure Relayer API Keys
SecureClient configures Relayer API keys directly. Pass the key and its
associated address to relayerApiKey when reconnecting an existing account.Deploy a Deposit Wallet
Creating aSecureClient without a wallet derives the signer’s Deposit Wallet
address and deploys it when needed. Use one of the Builder authorization
strategies above to authorize the deployment.Before
After
Market Discovery
Fetch a Market
BothPublicClient and SecureClient provide fetchMarket for reads by Gamma
market ID, slug, or Polymarket URL.Before
After
listMarkets and fetch its first page.List Markets
BothPublicClient and SecureClient provide listMarkets, which returns a
paginator and accepts filters directly.Before
After
getSimplifiedMarkets does not need a separate replacement. Unified market
models are normalized for SDK use. Sampling-market reads should migrate to
listCurrentRewards, which lists the active reward configurations.Before
After
Market Data
Read Trading Parameters
BothPublicClient and SecureClient return tick size and negative-risk status
on the unified market model. Order methods also resolve them automatically, so
you no longer pass either value when placing an order.Before
After
Read CLOB Market Details
BothPublicClient and SecureClient return the normalized market model for
public product data. Its trading fields replace the compact CLOB market response
and standalone fee reads.Before
After
Fetch Order Books
BothPublicClient and SecureClient provide single and batch order book reads
with camelCase request fields.Before
After
Fetch Prices
BothPublicClient and SecureClient provide single and batch price reads with
OrderSide and camelCase request fields.Before
After
Fetch Midpoints
BothPublicClient and SecureClient provide fetchMidpoint and
fetchMidpoints for single and batch reads.Before
After
Fetch Spreads
BothPublicClient and SecureClient provide single and batch spread reads
with the same request pattern.Before
After
Fetch Last Trade Prices
BothPublicClient and SecureClient provide singular and batch methods for
last-trade prices.Before
After
Fetch Price History
BothPublicClient and SecureClient provide price history. Pass all parameters
in one request object; the response uses camelCase fields and typed timestamps.Before
After
Estimate a Market Order Price
BothPublicClient and SecureClient provide market-order price estimates. The
request distinguishes collateral spent for buys from shares sold for sells.Before
After
List Recent Market Trades
BothPublicClient and SecureClient provide the public trade paginator, which
replaces the previous market-events response.Before
After
Orders
Place a Limit Order
SecureClient resolves tick size, negative-risk status, fees, and signing
details before it submits a limit order.Before
After
expiration for a GTD order and postOnly: true for a post-only order.Place a Market Order
SecureClient places market orders. Buys specify collateral to spend, while
sells specify shares to sell.Before
After
userUSDCBalance becomes maxSpend. The previous field supplied the account
balance used to adjust the order for fees; the unified SDK instead accepts the
maximum total USD to spend. Set maxSpend equal to amount when the amount
should include fees, or omit it to pay applicable fees on top.Sign Without Posting
SecureClient provides order-type-specific creation methods when signing and
submission need to happen separately.Before
After
createMarketOrder instead when preparing an FAK or FOK market order.Post Several Orders
SecureClient provides postOrders. Order type and post-only behavior are part
of each signed order, so the method accepts the signed orders directly.Before
After
Attribute an Order to a Builder
SecureClient attaches the builder code to each order.Before
After
Cancel Orders
SecureClient provides the cancel methods. They now accept camelCase request
objects, while cancelAll remains parameterless.Before
After
Fetch an Order
SecureClient fetches an order by ID using a request object.Before
After
List Open Orders
SecureClient provides listOpenOrders, which returns a paginator. Filters and
response fields use camelCase.Before
After
Check Order Scoring
SecureClient provides fetchOrderScoring for one order and
fetchOrdersScoring for several.Before
After
Account Activity and Balances
List Account Trades
SecureClient replaces both previous account trade-history methods with one
paginator.Before
After
List Builder Trades
BothPublicClient and SecureClient provide public builder trade history,
filtered by builder code.Before
After
Read and Drop Notifications
SecureClient provides notification methods with action-oriented names and
camelCase request fields.Before
After
Refresh Balances and Allowances
SecureClient manages balances and allowances while placing orders. It detects
a missing allowance, completes the required approval, refreshes the balance and
allowance, and retries the order.Before
After
Positions
The unified methods build and submit the wallet transactions. You no longer need to encode contract calls or pass transaction arrays toexecute.Split a Position
SecureClient splits collateral into a complete set of YES and NO outcome
tokens.Before
After
Merge Positions
SecureClient merges balanced YES and NO tokens back into collateral.Before
After
Redeem Resolved Positions
SecureClient redeems winning outcome tokens for collateral after resolution.Before
After
Service Status
NeitherPublicClient nor SecureClient requires these calls. The unified
clients manage request timing internally.Before
After