Skip to main content
Update your integration to trade on Polymarket Protocol V2 markets while keeping support for existing CTF markets. Before you start:
1

Upgrade the SDK

Upgrade @polymarket/client to the latest release (0.12.0 or later) using your preferred package manager.
2

Ensure Trading Approvals

Keep calling setupTradingApprovals() on your SecureClient. It also approves the contracts required for Polymarket Protocol V2. Gasless wallets need a configured Relayer or Builder API key.
3

Select the Trading ID

Given a market, for example returned by fetchMarket(), check its version: use the desired outcome’s positionId for V2 or tokenId for V1. This example selects YES:
4

Trade as Usual

Use the selected assetId:
Use the selected ID for order books, prices, and market subscriptions too.

Verify the Migration

Verify BUY and SELL fills and balances on both a V2 market and a CTF market.

Read Balances and Allowances

Read balances and allowances using the asset ID selected earlier:
Balances and allowances are returned in base units. Allowances are keyed by spender address. To refresh before reading, import updateBalanceAllowance from @polymarket/client/actions and pass client followed by the same parameters.

Update Resolution Reads

If your integration tracks V2 market resolution:
Call fetchResolutions for the selected market:
Use payouts only from a row whose status is "resolved".