docs: refresh all documentation - fill 98 empty files and update changelog
Date: 2026-06-19 Changes: - Fixed 98 empty .md files that had failed to scrape - Updated changelog with latest entries (Jun 15, 2026: CLOB DELETE /orders limit reduced to 1000) - Refreshed FAQ, Polymarket Learn, Developers, and other sections Notable updates: - Jun 15, 2026: CLOB DELETE /orders maximum batch size reduced to 1000 - Jun 1, 2026: Increased CLOB order rate limits - May 18, 2026: builderCode added to builders endpoints - May 14, 2026: GET /markets/keyset limit reduced to 100
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Data Resources
|
||||
|
||||
> Access Polymarket on-chain activity for data & analytics
|
||||
|
||||
Polymarket data that lands on the blockchain, such as trades, balances, positions, and redeems, is available through various on-chain analytics platforms and blockchain data providers. Polymarket also provides its own APIs and WebSockets. See the [API Endpoints reference](/quickstart/reference/endpoints) for more information.
|
||||
|
||||
The purpose of this page is to serve as a public good for Polymarket builders, researches, and analysts alike.
|
||||
|
||||
***
|
||||
|
||||
## Data
|
||||
|
||||
### Goldsky
|
||||
|
||||
[Goldsky](https://docs.goldsky.com/chains/polymarket) provides real-time streaming pipelines for Polymarket on-chain activity (i.e. trades, balances, positions, etc...) into your own database/data warehouse.
|
||||
|
||||
Goldsky also partnered with [ClickHouse](https://clickhouse.com) to create [CryptoHouse](https://crypto.clickhouse.com), where you can query Polymarket on-chain data using SQL.
|
||||
|
||||
### Dune
|
||||
|
||||
[Dune](https://dune.com) is a blockchain analytics platform that has Polymarket on-chain activity (i.e. trades, balances, positions, etc...). Query Polymarket data using SQL, create custom dashboards, and more.
|
||||
|
||||
Here are a few simple queries to get started:
|
||||
|
||||
| Query | Description | Link |
|
||||
| ------------- | --------------------------------------------- | --------------------------------------------------- |
|
||||
| Volume | Notional Volume and Maker & Taker USDC Volume | [View Dune Query](https://dune.com/queries/6545441) |
|
||||
| TVL | USDC locked in Polymarket smart contracts | [View Dune Query](https://dune.com/queries/6588784) |
|
||||
| Open Interest | Estimated market open interest, and over time | [View Dune Query](https://dune.com/queries/6555478) |
|
||||
|
||||
### Allium
|
||||
|
||||
[Allium](https://docs.allium.so/historical-data/predictions) is a blockchain analytics platform that has Polymarket on-chain activity (i.e. trades, balances, positions, etc...). Query Polymarket data using SQL, create custom dashboards, and more.
|
||||
|
||||
\--
|
||||
|
||||
## Dashboards
|
||||
|
||||
Third-party blockchain analytics platforms that aggregate and visualize Polymarket data:
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="Blockworks" img="https://pbs.twimg.com/profile_images/1651677302634483712/7s2FxV2K_400x400.jpg" href="https://blockworks.com/analytics/polymarket" />
|
||||
|
||||
<Card title="Artemis" img="https://pbs.twimg.com/profile_images/1896982195723546624/2XeO9mPb_400x400.png" href="https://app.artemisanalytics.com/asset/polymarket?from=assets" />
|
||||
|
||||
<Card title="Dune" img="https://pbs.twimg.com/profile_images/1986458079248986112/qq80s3hx_400x400.jpg" href="https://dune.com/discover/content/popular?q=polymarket&resource-type=dashboards" />
|
||||
|
||||
<Card title="DeFiLlama" img="https://pbs.twimg.com/profile_images/1915756547705036800/rAeLzZqs_400x400.jpg" href="https://defillama.com/protocol/polymarket" />
|
||||
|
||||
<Card title="The Block" img="https://pbs.twimg.com/profile_images/1944749695525425152/9babG7Df_400x400.jpg" href="https://www.theblock.co/data/decentralized-finance/prediction-markets-and-betting" />
|
||||
|
||||
<Card title="Token Terminal" img="https://pbs.twimg.com/profile_images/1594678659222306817/SMum_RcQ_400x400.jpg" href="https://tokenterminal.com/explorer/projects/polymarket" />
|
||||
|
||||
<Card title="Allium" img="https://pbs.twimg.com/profile_images/1778926940407132160/UEwR3lHt_400x400.jpg" href="https://predictions.allium.so" />
|
||||
</CardGroup>
|
||||
|
||||
### Community Dashboards
|
||||
|
||||
Community-created Dune dashboards of Polymarket on-chain analytics:
|
||||
|
||||
| Dashboard | Created By | Link |
|
||||
| ------------------------------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||
| Polymarket Overview | [@datadashboards](https://x.com/datadashboards) | [View Dashboard](https://dune.com/datadashboards/polymarket-overview) |
|
||||
| Polymarket Volume, OI, Markets, Addresses and TVL | [@hildobby](https://x.com/hildobby) | [View Dashboard](https://dune.com/hildobby/polymarket) |
|
||||
| Polymarket Historical Accuracy | [@alexmccullaaa](https://x.com/alexmccullaaa) | [View Dashboard](https://dune.com/alexmccullough/how-accurate-is-polymarket) |
|
||||
| Polymarket Builders Dashboard | [@defioasis](https://x.com/defioasis) | [View Dashboard](https://dune.com/gateresearch/pmbuilders) |
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Builder Program
|
||||
|
||||
> Build applications that route orders through Polymarket
|
||||
|
||||
A **builder** is a person, group, or organization that routes orders from users to Polymarket. If you've created a platform that allows users to trade on Polymarket through your system, this program is for you.
|
||||
|
||||
## Program Benefits
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Gasless Transactions" icon="gas-pump">
|
||||
All onchain operations are gas-free through our relayer
|
||||
</Card>
|
||||
|
||||
<Card title="Order Attribution" icon="tag">
|
||||
Get credit for orders and compete for grants on the Builder Leaderboard
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### What You Get
|
||||
|
||||
| Benefit | Description |
|
||||
| ------------------- | ------------------------------------------------------------------------------- |
|
||||
| **Relayer Access** | Gas-free wallet deployment, approvals, order execution and CTF operations |
|
||||
| **Volume Tracking** | All orders attributed to your builder profile |
|
||||
| **Leaderboard** | Public visibility on [builders.polymarket.com](https://builders.polymarket.com) |
|
||||
| **Support** | Telegram channel and engineering support (Verified+) |
|
||||
|
||||
<Warning>
|
||||
EOA wallets do not have relayer access. Users trading directly from an EOA pay
|
||||
their own gas fees.
|
||||
</Warning>
|
||||
|
||||
## How It Works
|
||||
|
||||
<Steps>
|
||||
<Step title="User Places Order">
|
||||
User places an order through your application.
|
||||
</Step>
|
||||
|
||||
<Step title="Attach Builder Code">
|
||||
Your app adds your `builderCode` to the order struct.
|
||||
</Step>
|
||||
|
||||
<Step title="Submit to CLOB">
|
||||
Order is submitted to Polymarket's CLOB — the builder code is serialized
|
||||
onchain as part of the signed order.
|
||||
</Step>
|
||||
|
||||
<Step title="Trade Execution">
|
||||
Polymarket matches the order and covers gas fees for onchain operations.
|
||||
</Step>
|
||||
|
||||
<Step title="Volume Attribution">
|
||||
Volume is credited to your builder account for every matched trade where
|
||||
your code is attached.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Getting Started
|
||||
|
||||
<Steps>
|
||||
<Step title="Create Builder Profile">
|
||||
Go to
|
||||
[polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)
|
||||
and copy your builder code.
|
||||
</Step>
|
||||
|
||||
<Step title="Attach Your Builder Code">
|
||||
Pass `builderCode` on every order you submit — see [Order
|
||||
Attribution](/trading/orders/attribution).
|
||||
</Step>
|
||||
|
||||
<Step title="Enable Gasless Transactions">
|
||||
Use the Relayer Client for gas-free wallet deployment and onchain
|
||||
operations.
|
||||
</Step>
|
||||
|
||||
<Step title="Track Performance">
|
||||
Monitor your volume on the [Builder
|
||||
Leaderboard](https://builders.polymarket.com).
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## SDKs and Libraries
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="CLOB Client (TypeScript)" icon="github" href="https://github.com/Polymarket/clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Client (Python)" icon="github" href="https://github.com/Polymarket/py-clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
|
||||
<Card title="Relayer Client (TypeScript)" icon="github" href="https://github.com/Polymarket/builder-relayer-client">
|
||||
Gasless onchain transactions
|
||||
</Card>
|
||||
|
||||
<Card title="Relayer Client (Python)" icon="github" href="https://github.com/Polymarket/py-builder-relayer-client">
|
||||
Gasless onchain transactions
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Client (Rust)" icon="github" href="https://github.com/Polymarket/rs-clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Examples
|
||||
|
||||
These open-source demo applications show how to integrate Polymarket's CLOB Client and Builder Relayer Client for gasless trading with builder order attribution.
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Authentication" icon="user-check">
|
||||
Multiple wallet providers
|
||||
</Card>
|
||||
|
||||
<Card title="Gasless Trading" icon="gas-pump">
|
||||
Deposit wallet support for new API users
|
||||
</Card>
|
||||
|
||||
<Card title="Full Integration" icon="puzzle-piece">
|
||||
Orders, positions, CTF ops
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Deposit Wallet Integrations
|
||||
|
||||
New API users should use deposit wallets. Use the Builder Relayer Client to
|
||||
deploy deposit wallets and execute signed wallet batches, then place CLOB
|
||||
orders with `POLY_1271`.
|
||||
|
||||
See the [Deposit Wallet Guide](/trading/deposit-wallets) for TypeScript,
|
||||
Python, Rust, and direct API integration details.
|
||||
|
||||
### Existing Safe Wallet Examples
|
||||
|
||||
Existing Safe integrations can continue using Gnosis Safe wallets:
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="wagmi + Safe" icon="wallet" href="https://github.com/Polymarket/wagmi-safe-builder-example">
|
||||
MetaMask, Phantom, Rabby, and other browser wallets
|
||||
</Card>
|
||||
|
||||
<Card title="Privy + Safe" icon="shield-check" href="https://github.com/Polymarket/privy-safe-builder-example">
|
||||
Privy embedded wallets
|
||||
</Card>
|
||||
|
||||
<Card title="Magic Link + Safe" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-safe-builder-example">
|
||||
Magic Link email/social authentication
|
||||
</Card>
|
||||
|
||||
<Card title="Turnkey + Safe" icon="key" href="https://github.com/Polymarket/turnkey-safe-builder-example">
|
||||
Turnkey embedded wallets
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Existing Proxy Wallet Examples
|
||||
|
||||
For existing Magic Link users from Polymarket.com:
|
||||
|
||||
<CardGroup cols={1}>
|
||||
<Card title="Magic Link + Proxy" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-proxy-builder-example">
|
||||
Auto-deploying proxy wallets for Polymarket.com Magic users
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### What Each Demo Covers
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Authentication">
|
||||
<ul>
|
||||
<li>User sign-in via wallet provider</li>
|
||||
<li>User API credential derivation (L2 auth)</li>
|
||||
<li>Builder config with remote signing</li>
|
||||
<li>Signature types for Deposit Wallet, Safe, and Proxy wallets</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
|
||||
<Tab title="Wallet Operations">
|
||||
<ul>
|
||||
<li>Deposit wallet deployment via Relayer</li>
|
||||
<li>Batch token approvals (pUSD + outcome tokens)</li>
|
||||
<li>CTF operations (split, merge, redeem)</li>
|
||||
<li>Transaction monitoring</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
|
||||
<Tab title="Trading">
|
||||
<ul>
|
||||
<li>CLOB client initialization</li>
|
||||
<li>Order placement with builder attribution</li>
|
||||
<li>Position and order management</li>
|
||||
<li>Market discovery via Gamma API</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Get API Keys" icon="key" href="/builders/api-keys">
|
||||
Create and manage your Builder API credentials.
|
||||
</Card>
|
||||
|
||||
<Card title="Understand Tiers" icon="layer-group" href="/builders/tiers">
|
||||
Learn about rate limits and how to upgrade.
|
||||
</Card>
|
||||
|
||||
<Card title="Attribute Orders" icon="tag" href="/trading/orders/attribution">
|
||||
Configure your client to credit trades to your account.
|
||||
</Card>
|
||||
|
||||
<Card title="Gasless Guide" icon="gas-pump" href="/trading/gasless">
|
||||
Set up gasless transactions for your users.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Builder Program
|
||||
|
||||
> Build applications that route orders through Polymarket
|
||||
|
||||
A **builder** is a person, group, or organization that routes orders from users to Polymarket. If you've created a platform that allows users to trade on Polymarket through your system, this program is for you.
|
||||
|
||||
## Program Benefits
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Gasless Transactions" icon="gas-pump">
|
||||
All onchain operations are gas-free through our relayer
|
||||
</Card>
|
||||
|
||||
<Card title="Order Attribution" icon="tag">
|
||||
Get credit for orders and compete for grants on the Builder Leaderboard
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### What You Get
|
||||
|
||||
| Benefit | Description |
|
||||
| ------------------- | ------------------------------------------------------------------------------- |
|
||||
| **Relayer Access** | Gas-free wallet deployment, approvals, order execution and CTF operations |
|
||||
| **Volume Tracking** | All orders attributed to your builder profile |
|
||||
| **Leaderboard** | Public visibility on [builders.polymarket.com](https://builders.polymarket.com) |
|
||||
| **Support** | Telegram channel and engineering support (Verified+) |
|
||||
|
||||
<Warning>
|
||||
EOA wallets do not have relayer access. Users trading directly from an EOA pay
|
||||
their own gas fees.
|
||||
</Warning>
|
||||
|
||||
## How It Works
|
||||
|
||||
<Steps>
|
||||
<Step title="User Places Order">
|
||||
User places an order through your application.
|
||||
</Step>
|
||||
|
||||
<Step title="Attach Builder Code">
|
||||
Your app adds your `builderCode` to the order struct.
|
||||
</Step>
|
||||
|
||||
<Step title="Submit to CLOB">
|
||||
Order is submitted to Polymarket's CLOB — the builder code is serialized
|
||||
onchain as part of the signed order.
|
||||
</Step>
|
||||
|
||||
<Step title="Trade Execution">
|
||||
Polymarket matches the order and covers gas fees for onchain operations.
|
||||
</Step>
|
||||
|
||||
<Step title="Volume Attribution">
|
||||
Volume is credited to your builder account for every matched trade where
|
||||
your code is attached.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Getting Started
|
||||
|
||||
<Steps>
|
||||
<Step title="Create Builder Profile">
|
||||
Go to
|
||||
[polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)
|
||||
and copy your builder code.
|
||||
</Step>
|
||||
|
||||
<Step title="Attach Your Builder Code">
|
||||
Pass `builderCode` on every order you submit — see [Order
|
||||
Attribution](/trading/orders/attribution).
|
||||
</Step>
|
||||
|
||||
<Step title="Enable Gasless Transactions">
|
||||
Use the Relayer Client for gas-free wallet deployment and onchain
|
||||
operations.
|
||||
</Step>
|
||||
|
||||
<Step title="Track Performance">
|
||||
Monitor your volume on the [Builder
|
||||
Leaderboard](https://builders.polymarket.com).
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## SDKs and Libraries
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="CLOB Client (TypeScript)" icon="github" href="https://github.com/Polymarket/clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Client (Python)" icon="github" href="https://github.com/Polymarket/py-clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
|
||||
<Card title="Relayer Client (TypeScript)" icon="github" href="https://github.com/Polymarket/builder-relayer-client">
|
||||
Gasless onchain transactions
|
||||
</Card>
|
||||
|
||||
<Card title="Relayer Client (Python)" icon="github" href="https://github.com/Polymarket/py-builder-relayer-client">
|
||||
Gasless onchain transactions
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Client (Rust)" icon="github" href="https://github.com/Polymarket/rs-clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Examples
|
||||
|
||||
These open-source demo applications show how to integrate Polymarket's CLOB Client and Builder Relayer Client for gasless trading with builder order attribution.
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Authentication" icon="user-check">
|
||||
Multiple wallet providers
|
||||
</Card>
|
||||
|
||||
<Card title="Gasless Trading" icon="gas-pump">
|
||||
Deposit wallet support for new API users
|
||||
</Card>
|
||||
|
||||
<Card title="Full Integration" icon="puzzle-piece">
|
||||
Orders, positions, CTF ops
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Deposit Wallet Integrations
|
||||
|
||||
New API users should use deposit wallets. Use the Builder Relayer Client to
|
||||
deploy deposit wallets and execute signed wallet batches, then place CLOB
|
||||
orders with `POLY_1271`.
|
||||
|
||||
See the [Deposit Wallet Guide](/trading/deposit-wallets) for TypeScript,
|
||||
Python, Rust, and direct API integration details.
|
||||
|
||||
### Existing Safe Wallet Examples
|
||||
|
||||
Existing Safe integrations can continue using Gnosis Safe wallets:
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="wagmi + Safe" icon="wallet" href="https://github.com/Polymarket/wagmi-safe-builder-example">
|
||||
MetaMask, Phantom, Rabby, and other browser wallets
|
||||
</Card>
|
||||
|
||||
<Card title="Privy + Safe" icon="shield-check" href="https://github.com/Polymarket/privy-safe-builder-example">
|
||||
Privy embedded wallets
|
||||
</Card>
|
||||
|
||||
<Card title="Magic Link + Safe" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-safe-builder-example">
|
||||
Magic Link email/social authentication
|
||||
</Card>
|
||||
|
||||
<Card title="Turnkey + Safe" icon="key" href="https://github.com/Polymarket/turnkey-safe-builder-example">
|
||||
Turnkey embedded wallets
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Existing Proxy Wallet Examples
|
||||
|
||||
For existing Magic Link users from Polymarket.com:
|
||||
|
||||
<CardGroup cols={1}>
|
||||
<Card title="Magic Link + Proxy" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-proxy-builder-example">
|
||||
Auto-deploying proxy wallets for Polymarket.com Magic users
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### What Each Demo Covers
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Authentication">
|
||||
<ul>
|
||||
<li>User sign-in via wallet provider</li>
|
||||
<li>User API credential derivation (L2 auth)</li>
|
||||
<li>Builder config with remote signing</li>
|
||||
<li>Signature types for Deposit Wallet, Safe, and Proxy wallets</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
|
||||
<Tab title="Wallet Operations">
|
||||
<ul>
|
||||
<li>Deposit wallet deployment via Relayer</li>
|
||||
<li>Batch token approvals (pUSD + outcome tokens)</li>
|
||||
<li>CTF operations (split, merge, redeem)</li>
|
||||
<li>Transaction monitoring</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
|
||||
<Tab title="Trading">
|
||||
<ul>
|
||||
<li>CLOB client initialization</li>
|
||||
<li>Order placement with builder attribution</li>
|
||||
<li>Position and order management</li>
|
||||
<li>Market discovery via Gamma API</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Get API Keys" icon="key" href="/builders/api-keys">
|
||||
Create and manage your Builder API credentials.
|
||||
</Card>
|
||||
|
||||
<Card title="Understand Tiers" icon="layer-group" href="/builders/tiers">
|
||||
Learn about rate limits and how to upgrade.
|
||||
</Card>
|
||||
|
||||
<Card title="Attribute Orders" icon="tag" href="/trading/orders/attribution">
|
||||
Configure your client to credit trades to your account.
|
||||
</Card>
|
||||
|
||||
<Card title="Gasless Guide" icon="gas-pump" href="/trading/gasless">
|
||||
Set up gasless transactions for your users.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Tiers
|
||||
|
||||
> Rate limits, rewards, and how to upgrade
|
||||
|
||||
The Builder Program uses a tiered system to manage rate limits while rewarding high-performing integrations. Higher tiers unlock increased limits, weekly rewards, and priority support.
|
||||
|
||||
## Feature Definitions
|
||||
|
||||
| Feature | Description |
|
||||
| --------------------------- | ------------------------------------------------------------------------------------------ |
|
||||
| **Daily Relayer Txn Limit** | Maximum Relayer transactions per day for deposit wallet, Safe, and Proxy wallet operations |
|
||||
| **API Rate Limits** | Rate limits for non-relayer endpoints (CLOB, Gamma, etc.) |
|
||||
| **Gasless Trading** | Gas fees subsidized for supported smart-wallet operations |
|
||||
| **Order Attribution** | Orders tracked and attributed to your Builder profile |
|
||||
| **Builder Fees** | Builders who route orders can charge fees and monetize on flow |
|
||||
| **Leaderboard Visibility** | Visibility on the [Builder Leaderboard](https://builders.polymarket.com/) |
|
||||
| **Telegram Channel** | Private Builders channel for announcements and support |
|
||||
| **Engineering Support** | Direct access to engineering team |
|
||||
| **Marketing Support** | Promotion via official Polymarket social accounts |
|
||||
| **Priority Access** | Early access to new features and products |
|
||||
|
||||
***
|
||||
|
||||
## Tier Comparison
|
||||
|
||||
| Feature | Unverified | Verified | Partner |
|
||||
| --------------------------- | :--------: | :--------: | :-------: |
|
||||
| **Daily Relayer Txn Limit** | 100/day | 10,000/day | Unlimited |
|
||||
| **API Rate Limits** | Standard | Standard | Highest |
|
||||
| **Gasless Trading\*** | Yes | Yes | Yes |
|
||||
| **Order Attribution** | Yes | Yes | Yes |
|
||||
| **Builder Fees** | Yes | Yes | Yes |
|
||||
| **Leaderboard Visibility** | — | Yes | Yes |
|
||||
| **Telegram Channel** | — | Yes | Yes |
|
||||
| **Engineering Support** | — | Standard | Elevated |
|
||||
| **Marketing Support** | — | Standard | Elevated |
|
||||
| **Priority Access** | — | — | Yes |
|
||||
|
||||
***
|
||||
|
||||
## Unverified
|
||||
|
||||
<Card title="100 Relay transactions/day" icon="seedling">
|
||||
The default tier for all new builders. Start immediately with no approval
|
||||
required.
|
||||
</Card>
|
||||
|
||||
**How to get started:**
|
||||
|
||||
1. Go to [polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)
|
||||
2. Create a builder profile
|
||||
3. Click **"+ Create New"** to generate API keys
|
||||
4. Attach your [builder code](/trading/orders/attribution) to CLOB orders for attribution; use a Relayer API key for gasless wallet operations
|
||||
|
||||
**What's included:**
|
||||
|
||||
* Gasless trading through deposit wallets for new API users and existing Safe/Proxy wallets
|
||||
* Gas subsidized on all Relayer transactions up to the daily limit
|
||||
* Access to all client libraries and documentation
|
||||
|
||||
***
|
||||
|
||||
## Verified
|
||||
|
||||
<Card title="10,000 Relay transactions/day" icon="badge-check">
|
||||
For builders who need higher throughput. Requires manual approval.
|
||||
</Card>
|
||||
|
||||
**How to upgrade:**
|
||||
|
||||
Contact us at [builder@polymarket.com](mailto:builder@polymarket.com) with:
|
||||
|
||||
* Your Builder API Key
|
||||
* Use case description
|
||||
* Expected volume
|
||||
* Other relevant information (links, docs, decks, etc.)
|
||||
|
||||
**Unlocks over Unverified:**
|
||||
|
||||
* 100x daily Relayer transaction limit
|
||||
* Monetize with Builder fees
|
||||
* Leaderboard visibility at [builders.polymarket.com](https://builders.polymarket.com)
|
||||
* Private Telegram channel for announcements and support
|
||||
* Weekly USDC rewards based on volume (subject to approval)
|
||||
* Grants (subject to approval)
|
||||
|
||||
***
|
||||
|
||||
## Partner
|
||||
|
||||
<Card title="Unlimited Relay transactions/day" icon="handshake">
|
||||
Enterprise tier for high-volume integrations and strategic partners.
|
||||
</Card>
|
||||
|
||||
**Unlocks over Verified:**
|
||||
|
||||
* Unlimited Relayer transactions
|
||||
* Highest API rate limits
|
||||
* Elevated engineering support
|
||||
* Elevated and coordinated marketing support
|
||||
* Priority access to new features and products
|
||||
|
||||
***
|
||||
|
||||
## How to Upgrade
|
||||
|
||||
<Steps>
|
||||
<Step title="Build and Launch">
|
||||
Start with the Unverified tier and build your integration.
|
||||
</Step>
|
||||
|
||||
<Step title="Generate Volume">
|
||||
Route orders through Polymarket and demonstrate consistent usage.
|
||||
</Step>
|
||||
|
||||
<Step title="Apply for Verification">
|
||||
Email [builder@polymarket.com](mailto:builder@polymarket.com) with your
|
||||
builder key and use case.
|
||||
</Step>
|
||||
|
||||
<Step title="Get Approved">
|
||||
The Polymarket team reviews applications and responds within a few business
|
||||
days.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Contact
|
||||
|
||||
Ready to upgrade or have questions?
|
||||
|
||||
<Card title="builder@polymarket.com" icon="envelope" href="mailto:builder@polymarket.com">
|
||||
Email us with your Builder API Key and use case details.
|
||||
</Card>
|
||||
|
||||
## FAQ
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="How do I know if I am verified">
|
||||
Verification is displayed in your [Builder Profile](https://polymarket.com/settings?tab=builder) settings.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="What happens if I exceed my daily limit">
|
||||
Relayer requests beyond your daily limit will be rate-limited and return an
|
||||
error. Consider upgrading to Verified or Partner tier if you're hitting
|
||||
limits.
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="What if I just need more daily Relay transaction limits for my own wallet">
|
||||
If you're not routing orders for other users (wallets), you can get unlimited
|
||||
daily Relay transactions by obtaining a [Relayer API key](https://polymarket.com/settings?tab=api-keys).
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Get API Keys" icon="key" href="/builders/api-keys">
|
||||
Create your Builder API credentials.
|
||||
</Card>
|
||||
|
||||
<Card title="Attribute Orders" icon="tag" href="/trading/orders/attribution">
|
||||
Configure your client to credit trades to your account.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Builder Program
|
||||
|
||||
> Build applications that route orders through Polymarket
|
||||
|
||||
A **builder** is a person, group, or organization that routes orders from users to Polymarket. If you've created a platform that allows users to trade on Polymarket through your system, this program is for you.
|
||||
|
||||
## Program Benefits
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Gasless Transactions" icon="gas-pump">
|
||||
All onchain operations are gas-free through our relayer
|
||||
</Card>
|
||||
|
||||
<Card title="Order Attribution" icon="tag">
|
||||
Get credit for orders and compete for grants on the Builder Leaderboard
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### What You Get
|
||||
|
||||
| Benefit | Description |
|
||||
| ------------------- | ------------------------------------------------------------------------------- |
|
||||
| **Relayer Access** | Gas-free wallet deployment, approvals, order execution and CTF operations |
|
||||
| **Volume Tracking** | All orders attributed to your builder profile |
|
||||
| **Leaderboard** | Public visibility on [builders.polymarket.com](https://builders.polymarket.com) |
|
||||
| **Support** | Telegram channel and engineering support (Verified+) |
|
||||
|
||||
<Warning>
|
||||
EOA wallets do not have relayer access. Users trading directly from an EOA pay
|
||||
their own gas fees.
|
||||
</Warning>
|
||||
|
||||
## How It Works
|
||||
|
||||
<Steps>
|
||||
<Step title="User Places Order">
|
||||
User places an order through your application.
|
||||
</Step>
|
||||
|
||||
<Step title="Attach Builder Code">
|
||||
Your app adds your `builderCode` to the order struct.
|
||||
</Step>
|
||||
|
||||
<Step title="Submit to CLOB">
|
||||
Order is submitted to Polymarket's CLOB — the builder code is serialized
|
||||
onchain as part of the signed order.
|
||||
</Step>
|
||||
|
||||
<Step title="Trade Execution">
|
||||
Polymarket matches the order and covers gas fees for onchain operations.
|
||||
</Step>
|
||||
|
||||
<Step title="Volume Attribution">
|
||||
Volume is credited to your builder account for every matched trade where
|
||||
your code is attached.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Getting Started
|
||||
|
||||
<Steps>
|
||||
<Step title="Create Builder Profile">
|
||||
Go to
|
||||
[polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)
|
||||
and copy your builder code.
|
||||
</Step>
|
||||
|
||||
<Step title="Attach Your Builder Code">
|
||||
Pass `builderCode` on every order you submit — see [Order
|
||||
Attribution](/trading/orders/attribution).
|
||||
</Step>
|
||||
|
||||
<Step title="Enable Gasless Transactions">
|
||||
Use the Relayer Client for gas-free wallet deployment and onchain
|
||||
operations.
|
||||
</Step>
|
||||
|
||||
<Step title="Track Performance">
|
||||
Monitor your volume on the [Builder
|
||||
Leaderboard](https://builders.polymarket.com).
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## SDKs and Libraries
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="CLOB Client (TypeScript)" icon="github" href="https://github.com/Polymarket/clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Client (Python)" icon="github" href="https://github.com/Polymarket/py-clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
|
||||
<Card title="Relayer Client (TypeScript)" icon="github" href="https://github.com/Polymarket/builder-relayer-client">
|
||||
Gasless onchain transactions
|
||||
</Card>
|
||||
|
||||
<Card title="Relayer Client (Python)" icon="github" href="https://github.com/Polymarket/py-builder-relayer-client">
|
||||
Gasless onchain transactions
|
||||
</Card>
|
||||
|
||||
<Card title="CLOB Client (Rust)" icon="github" href="https://github.com/Polymarket/rs-clob-client-v2">
|
||||
Place orders with builder attribution
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Examples
|
||||
|
||||
These open-source demo applications show how to integrate Polymarket's CLOB Client and Builder Relayer Client for gasless trading with builder order attribution.
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Authentication" icon="user-check">
|
||||
Multiple wallet providers
|
||||
</Card>
|
||||
|
||||
<Card title="Gasless Trading" icon="gas-pump">
|
||||
Deposit wallet support for new API users
|
||||
</Card>
|
||||
|
||||
<Card title="Full Integration" icon="puzzle-piece">
|
||||
Orders, positions, CTF ops
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Deposit Wallet Integrations
|
||||
|
||||
New API users should use deposit wallets. Use the Builder Relayer Client to
|
||||
deploy deposit wallets and execute signed wallet batches, then place CLOB
|
||||
orders with `POLY_1271`.
|
||||
|
||||
See the [Deposit Wallet Guide](/trading/deposit-wallets) for TypeScript,
|
||||
Python, Rust, and direct API integration details.
|
||||
|
||||
### Existing Safe Wallet Examples
|
||||
|
||||
Existing Safe integrations can continue using Gnosis Safe wallets:
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="wagmi + Safe" icon="wallet" href="https://github.com/Polymarket/wagmi-safe-builder-example">
|
||||
MetaMask, Phantom, Rabby, and other browser wallets
|
||||
</Card>
|
||||
|
||||
<Card title="Privy + Safe" icon="shield-check" href="https://github.com/Polymarket/privy-safe-builder-example">
|
||||
Privy embedded wallets
|
||||
</Card>
|
||||
|
||||
<Card title="Magic Link + Safe" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-safe-builder-example">
|
||||
Magic Link email/social authentication
|
||||
</Card>
|
||||
|
||||
<Card title="Turnkey + Safe" icon="key" href="https://github.com/Polymarket/turnkey-safe-builder-example">
|
||||
Turnkey embedded wallets
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Existing Proxy Wallet Examples
|
||||
|
||||
For existing Magic Link users from Polymarket.com:
|
||||
|
||||
<CardGroup cols={1}>
|
||||
<Card title="Magic Link + Proxy" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-proxy-builder-example">
|
||||
Auto-deploying proxy wallets for Polymarket.com Magic users
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### What Each Demo Covers
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Authentication">
|
||||
<ul>
|
||||
<li>User sign-in via wallet provider</li>
|
||||
<li>User API credential derivation (L2 auth)</li>
|
||||
<li>Builder config with remote signing</li>
|
||||
<li>Signature types for Deposit Wallet, Safe, and Proxy wallets</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
|
||||
<Tab title="Wallet Operations">
|
||||
<ul>
|
||||
<li>Deposit wallet deployment via Relayer</li>
|
||||
<li>Batch token approvals (pUSD + outcome tokens)</li>
|
||||
<li>CTF operations (split, merge, redeem)</li>
|
||||
<li>Transaction monitoring</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
|
||||
<Tab title="Trading">
|
||||
<ul>
|
||||
<li>CLOB client initialization</li>
|
||||
<li>Order placement with builder attribution</li>
|
||||
<li>Position and order management</li>
|
||||
<li>Market discovery via Gamma API</li>
|
||||
</ul>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Get API Keys" icon="key" href="/builders/api-keys">
|
||||
Create and manage your Builder API credentials.
|
||||
</Card>
|
||||
|
||||
<Card title="Understand Tiers" icon="layer-group" href="/builders/tiers">
|
||||
Learn about rate limits and how to upgrade.
|
||||
</Card>
|
||||
|
||||
<Card title="Attribute Orders" icon="tag" href="/trading/orders/attribution">
|
||||
Configure your client to credit trades to your account.
|
||||
</Card>
|
||||
|
||||
<Card title="Gasless Guide" icon="gas-pump" href="/trading/gasless">
|
||||
Set up gasless transactions for your users.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Order Attribution
|
||||
|
||||
> Attribute orders to your builder code for volume credit and fee rewards
|
||||
|
||||
Order attribution credits trades to your builder account by attaching your **builder code** to every order. This enables:
|
||||
|
||||
* Volume tracking on the [Builder Leaderboard](https://builders.polymarket.com/)
|
||||
* Fee rewards through the [Builder Program](/builders/overview)
|
||||
* Performance monitoring via the Data API
|
||||
|
||||
***
|
||||
|
||||
## Builder Code
|
||||
|
||||
Your **builder code** is a `bytes32` identifier tied to your builder profile. Find it at [polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder).
|
||||
|
||||
That's the only credential you need for attribution — no HMAC signing, no separate API key, no special headers.
|
||||
|
||||
<Note>
|
||||
Builder codes are public identifiers — they appear onchain in the `builder`
|
||||
field of every order you attribute. Only you control which orders include your
|
||||
code, so keep it scoped to apps you own.
|
||||
</Note>
|
||||
|
||||
***
|
||||
|
||||
## Attaching the Builder Code
|
||||
|
||||
Pass `builderCode` in the order struct on every order you submit. The SDK serializes it into the onchain order's `builder` field, and the protocol attributes every matched trade to your profile.
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { ClobClient, Side, OrderType } from "@polymarket/clob-client-v2";
|
||||
|
||||
const client = new ClobClient({
|
||||
host: "https://clob.polymarket.com",
|
||||
chain: 137,
|
||||
signer,
|
||||
creds: apiCreds,
|
||||
signatureType: 3,
|
||||
funderAddress: depositWalletAddress,
|
||||
});
|
||||
|
||||
const response = await client.createAndPostOrder(
|
||||
{
|
||||
tokenID: "0x...",
|
||||
price: 0.55,
|
||||
size: 100,
|
||||
side: Side.BUY,
|
||||
builderCode: "0xabc123...", // your builder code from polymarket.com/settings?tab=builder
|
||||
},
|
||||
{ tickSize: "0.01", negRisk: false },
|
||||
OrderType.GTC,
|
||||
);
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
from py_clob_client_v2 import ClobClient
|
||||
from py_clob_client_v2 import OrderArgs, OrderType, PartialCreateOrderOptions
|
||||
from py_clob_client_v2.order_builder.constants import BUY
|
||||
|
||||
client = ClobClient(
|
||||
host="https://clob.polymarket.com",
|
||||
chain_id=137,
|
||||
key=private_key,
|
||||
creds=api_creds,
|
||||
signature_type=3,
|
||||
funder=deposit_wallet_address,
|
||||
)
|
||||
|
||||
response = client.create_and_post_order(
|
||||
OrderArgs(
|
||||
token_id="0x...",
|
||||
price=0.55,
|
||||
size=100,
|
||||
side=BUY,
|
||||
builder_code="0xabc123...", # your builder code from polymarket.com/settings?tab=builder
|
||||
),
|
||||
options=PartialCreateOrderOptions(tick_size="0.01", neg_risk=False),
|
||||
order_type=OrderType.GTC,
|
||||
)
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Every order placed with `builderCode` attached is credited to your builder profile — no additional configuration needed.
|
||||
|
||||
***
|
||||
|
||||
## Verifying Attribution
|
||||
|
||||
Query trades attributed to your builder code:
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
const trades = await client.getBuilderTrades();
|
||||
|
||||
// Filtered by market
|
||||
const marketTrades = await client.getBuilderTrades({
|
||||
market: "0xbd31dc8a...",
|
||||
});
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
trades = client.get_builder_trades()
|
||||
|
||||
market_trades = client.get_builder_trades(
|
||||
market="0xbd31dc8a..."
|
||||
)
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Each `BuilderTrade` includes: `id`, `market`, `assetId`, `side`, `size`, `price`, `status`, `outcome`, `owner`, `maker`, `builder`, `transactionHash`, `matchTime`, `fee`, and `feeUsdc`.
|
||||
|
||||
***
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Volume not appearing on the leaderboard">
|
||||
<ul>
|
||||
<li>Confirm your `builderCode` is correctly attached to every order</li>
|
||||
<li>Check that orders are being matched, not just placed</li>
|
||||
<li>Allow up to 24 hours for volume to appear on the leaderboard</li>
|
||||
</ul>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Invalid builder code">
|
||||
Verify the code matches what's shown on [your Builder
|
||||
Profile](https://polymarket.com/settings?tab=builder). Builder codes are
|
||||
`bytes32` hex values starting with `0x`.
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Builder Program" icon="hammer" href="/builders/overview">
|
||||
Learn about the Builder Program tiers and rewards
|
||||
</Card>
|
||||
|
||||
<Card title="Create Orders" icon="plus" href="/trading/orders/create">
|
||||
Build, sign, and submit orders
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -0,0 +1,432 @@
|
||||
> ## Documentation Index
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Gasless Transactions
|
||||
|
||||
> Execute onchain operations without paying gas fees
|
||||
|
||||
Polymarket's **Relayer Client** enables gasless transactions for your users. Instead of requiring users to hold POL for gas, Polymarket's infrastructure pays all transaction fees. This creates a seamless experience where users only need pUSD to trade.
|
||||
|
||||
## How It Works
|
||||
|
||||
The relayer acts as a transaction sponsor:
|
||||
|
||||
1. Your app creates a transaction
|
||||
2. The user signs it with their private key
|
||||
3. Your app sends it to Polymarket's relayer
|
||||
4. The relayer submits it onchain and pays the gas fee
|
||||
5. The transaction executes from the user's wallet
|
||||
|
||||
## What Is Covered
|
||||
|
||||
Polymarket pays gas for all operations routed through the relayer:
|
||||
|
||||
| Operation | Description |
|
||||
| --------------------- | ------------------------------------------------- |
|
||||
| **Wallet deployment** | Deploy deposit wallets for new API users |
|
||||
| **Token approvals** | Approve contracts to spend pUSD or outcome tokens |
|
||||
| **CTF operations** | Split, merge, and redeem positions |
|
||||
| **Transfers** | Move tokens between addresses |
|
||||
|
||||
## Authentication
|
||||
|
||||
The relayer uses **Relayer API Keys**. You can create one from [Settings > API Keys](https://polymarket.com/settings?tab=api-keys) on the Polymarket website.
|
||||
|
||||
<Note>
|
||||
**Already have a builder signing key?** Your existing HMAC-based builder API
|
||||
key keeps working with the Relayer — no need to rotate or reissue. Order
|
||||
attribution is now associated with the native `builderCode` field in CLOB V2.
|
||||
See [Migrating to CLOB V2](/v2-migration#builder-program) for context.
|
||||
</Note>
|
||||
|
||||
Include these headers with your requests:
|
||||
|
||||
| Header | Description |
|
||||
| ------------------------- | ----------------------------- |
|
||||
| `RELAYER_API_KEY` | Your Relayer API key |
|
||||
| `RELAYER_API_KEY_ADDRESS` | The address that owns the key |
|
||||
|
||||
<Info>
|
||||
If you want to use the Relayer API Key directly without the SDK, see the
|
||||
[Relayer API Reference](/api-reference/relayer).
|
||||
</Info>
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before using the relayer, you need:
|
||||
|
||||
| Requirement | Source |
|
||||
| ---------------------------- | ------------------------------------------------------------------- |
|
||||
| Relayer API Key | [Settings > API Keys](https://polymarket.com/settings?tab=api-keys) |
|
||||
| User's private key or signer | Your wallet integration |
|
||||
| pUSD balance | For trading (not for gas) |
|
||||
|
||||
## Installation
|
||||
|
||||
<CodeGroup>
|
||||
```bash npm theme={null}
|
||||
npm install @polymarket/builder-relayer-client
|
||||
```
|
||||
|
||||
```bash pip theme={null}
|
||||
pip install py-builder-relayer-client
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Client Setup
|
||||
|
||||
Initialize the relayer client with your Relayer API Key:
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { createWalletClient, http, Hex } from "viem";
|
||||
import { privateKeyToAccount } from "viem/accounts";
|
||||
import { polygon } from "viem/chains";
|
||||
import { RelayClient } from "@polymarket/builder-relayer-client";
|
||||
|
||||
const account = privateKeyToAccount(process.env.PRIVATE_KEY as Hex);
|
||||
const wallet = createWalletClient({
|
||||
account,
|
||||
chain: polygon,
|
||||
transport: http(process.env.RPC_URL),
|
||||
});
|
||||
|
||||
const client = new RelayClient({
|
||||
host: "https://relayer-v2.polymarket.com/",
|
||||
chain: 137,
|
||||
signer: wallet,
|
||||
relayerApiKey: process.env.RELAYER_API_KEY!,
|
||||
relayerApiKeyAddress: process.env.RELAYER_API_KEY_ADDRESS!,
|
||||
});
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
import os
|
||||
from py_builder_relayer_client.client import RelayClient
|
||||
|
||||
client = RelayClient(
|
||||
host="https://relayer-v2.polymarket.com",
|
||||
chain=137,
|
||||
signer=os.getenv("PRIVATE_KEY"),
|
||||
relayer_api_key=os.environ["RELAYER_API_KEY"],
|
||||
relayer_api_key_address=os.environ["RELAYER_API_KEY_ADDRESS"],
|
||||
)
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Warning>
|
||||
Never expose your Relayer API Key in client-side code. Use environment
|
||||
variables or a secrets manager.
|
||||
</Warning>
|
||||
|
||||
## Wallet Types
|
||||
|
||||
Use deposit wallets for new API users. Existing Safe and Proxy users can keep
|
||||
using their current wallet type and signature flow.
|
||||
|
||||
| Type | Deployment | Best For |
|
||||
| ------------------ | ---------------------------------------- | ----------------------------------- |
|
||||
| **Deposit Wallet** | Call `deployDepositWallet()` | New API users |
|
||||
| **Safe** | Call `deploy()` before first transaction | Existing Safe integrations |
|
||||
| **Proxy** | Auto-deploys on first transaction | Existing Polymarket.com proxy users |
|
||||
|
||||
<Info>
|
||||
For the new deposit wallet flow, including `WALLET-CREATE`, signed `WALLET`
|
||||
batches, and `POLY_1271` CLOB orders, see the [Deposit Wallet
|
||||
Guide](/trading/deposit-wallets).
|
||||
</Info>
|
||||
|
||||
<CodeGroup>
|
||||
```typescript Safe Wallet (TypeScript) theme={null}
|
||||
import { RelayClient, RelayerTxType } from "@polymarket/builder-relayer-client";
|
||||
|
||||
const client = new RelayClient({
|
||||
host: "https://relayer-v2.polymarket.com/",
|
||||
chain: 137,
|
||||
signer: wallet,
|
||||
relayerApiKey: process.env.RELAYER_API_KEY!,
|
||||
relayerApiKeyAddress: process.env.RELAYER_API_KEY_ADDRESS!,
|
||||
txType: RelayerTxType.SAFE,
|
||||
});
|
||||
|
||||
// Deploy before first transaction
|
||||
const response = await client.deploy();
|
||||
const result = await response.wait();
|
||||
console.log("Safe Address:", result?.proxyAddress);
|
||||
```
|
||||
|
||||
```python Safe Wallet (Python) theme={null}
|
||||
from py_builder_relayer_client.client import RelayClient
|
||||
|
||||
# client initialized with relayer credentials (see Client Setup above)
|
||||
|
||||
# Deploy before first transaction
|
||||
response = client.deploy()
|
||||
result = response.wait()
|
||||
print("Safe Address:", result.get("proxyAddress"))
|
||||
```
|
||||
|
||||
```typescript Proxy Wallet (TypeScript) theme={null}
|
||||
import { RelayClient, RelayerTxType } from "@polymarket/builder-relayer-client";
|
||||
|
||||
const client = new RelayClient({
|
||||
host: "https://relayer-v2.polymarket.com/",
|
||||
chain: 137,
|
||||
signer: wallet,
|
||||
relayerApiKey: process.env.RELAYER_API_KEY!,
|
||||
relayerApiKeyAddress: process.env.RELAYER_API_KEY_ADDRESS!,
|
||||
txType: RelayerTxType.PROXY,
|
||||
});
|
||||
|
||||
// No deploy needed - auto-deploys on first transaction
|
||||
```
|
||||
|
||||
```python Proxy Wallet (Python) theme={null}
|
||||
from py_builder_relayer_client.client import RelayClient
|
||||
|
||||
# client initialized with relayer credentials (see Client Setup above)
|
||||
# No deploy needed - auto-deploys on first transaction
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Executing Transactions
|
||||
|
||||
Use the `execute` method to send transactions through the relayer:
|
||||
|
||||
```typescript theme={null}
|
||||
interface Transaction {
|
||||
to: string; // Target contract address
|
||||
data: string; // Encoded function call
|
||||
value: string; // POL to send (usually "0")
|
||||
}
|
||||
|
||||
const response = await client.execute(transactions, "Description");
|
||||
const result = await response.wait();
|
||||
```
|
||||
|
||||
### Token Approval
|
||||
|
||||
Approve contracts to spend tokens:
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { encodeFunctionData, maxUint256 } from "viem";
|
||||
|
||||
const pUSD = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB";
|
||||
const CTF = "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045";
|
||||
|
||||
const approveTx = {
|
||||
to: pUSD,
|
||||
data: encodeFunctionData({
|
||||
abi: [
|
||||
{
|
||||
name: "approve",
|
||||
type: "function",
|
||||
inputs: [
|
||||
{ name: "spender", type: "address" },
|
||||
{ name: "amount", type: "uint256" },
|
||||
],
|
||||
outputs: [{ type: "bool" }],
|
||||
},
|
||||
],
|
||||
functionName: "approve",
|
||||
args: [CTF, maxUint256],
|
||||
}),
|
||||
value: "0",
|
||||
};
|
||||
|
||||
const response = await client.execute([approveTx], "Approve pUSD for CTF");
|
||||
await response.wait();
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
from web3 import Web3
|
||||
|
||||
pUSD = "0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB"
|
||||
CTF = "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045"
|
||||
MAX_UINT256 = 2**256 - 1
|
||||
|
||||
approve_tx = {
|
||||
"to": pUSD,
|
||||
"data": Web3().eth.contract(
|
||||
address=pUSD,
|
||||
abi=[{
|
||||
"name": "approve",
|
||||
"type": "function",
|
||||
"inputs": [
|
||||
{"name": "spender", "type": "address"},
|
||||
{"name": "amount", "type": "uint256"}
|
||||
],
|
||||
"outputs": [{"type": "bool"}]
|
||||
}]
|
||||
).encode_abi(abi_element_identifier="approve", args=[CTF, MAX_UINT256]),
|
||||
"value": "0"
|
||||
}
|
||||
|
||||
response = client.execute([approve_tx], "Approve pUSD for CTF")
|
||||
response.wait()
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Redeem Positions
|
||||
|
||||
Exchange winning tokens for pUSD after market resolution:
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { encodeFunctionData } from "viem";
|
||||
|
||||
const redeemTx = {
|
||||
to: CTF_ADDRESS,
|
||||
data: encodeFunctionData({
|
||||
abi: [
|
||||
{
|
||||
name: "redeemPositions",
|
||||
type: "function",
|
||||
inputs: [
|
||||
{ name: "collateralToken", type: "address" },
|
||||
{ name: "parentCollectionId", type: "bytes32" },
|
||||
{ name: "conditionId", type: "bytes32" },
|
||||
{ name: "indexSets", type: "uint256[]" },
|
||||
],
|
||||
outputs: [],
|
||||
},
|
||||
],
|
||||
functionName: "redeemPositions",
|
||||
args: [collateralToken, parentCollectionId, conditionId, indexSets],
|
||||
}),
|
||||
value: "0",
|
||||
};
|
||||
|
||||
const response = await client.execute([redeemTx], "Redeem positions");
|
||||
await response.wait();
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
CTF = "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045"
|
||||
|
||||
redeem_tx = {
|
||||
"to": CTF,
|
||||
"data": Web3().eth.contract(
|
||||
address=CTF,
|
||||
abi=[{
|
||||
"name": "redeemPositions",
|
||||
"type": "function",
|
||||
"inputs": [
|
||||
{"name": "collateralToken", "type": "address"},
|
||||
{"name": "parentCollectionId", "type": "bytes32"},
|
||||
{"name": "conditionId", "type": "bytes32"},
|
||||
{"name": "indexSets", "type": "uint256[]"}
|
||||
],
|
||||
"outputs": []
|
||||
}]
|
||||
).encode_abi(
|
||||
abi_element_identifier="redeemPositions",
|
||||
args=[collateral_token, parent_collection_id, condition_id, index_sets]
|
||||
),
|
||||
"value": "0"
|
||||
}
|
||||
|
||||
response = client.execute([redeem_tx], "Redeem positions")
|
||||
response.wait()
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Batch Transactions
|
||||
|
||||
Execute multiple operations atomically in a single call:
|
||||
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
const approveTx = {
|
||||
to: pUSD,
|
||||
data: encodeFunctionData({
|
||||
abi: erc20Abi,
|
||||
functionName: "approve",
|
||||
args: [CTF, maxUint256],
|
||||
}),
|
||||
value: "0",
|
||||
};
|
||||
|
||||
const transferTx = {
|
||||
to: pUSD,
|
||||
data: encodeFunctionData({
|
||||
abi: erc20Abi,
|
||||
functionName: "transfer",
|
||||
args: [recipientAddress, parseUnits("50", 6)],
|
||||
}),
|
||||
value: "0",
|
||||
};
|
||||
|
||||
// Both execute atomically
|
||||
const response = await client.execute(
|
||||
[approveTx, transferTx],
|
||||
"Approve and transfer",
|
||||
);
|
||||
await response.wait();
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
approve_tx = {
|
||||
"to": pUSD,
|
||||
"data": contract.encode_abi(
|
||||
abi_element_identifier="approve",
|
||||
args=[CTF, MAX_UINT256]
|
||||
),
|
||||
"value": "0"
|
||||
}
|
||||
|
||||
transfer_tx = {
|
||||
"to": pUSD,
|
||||
"data": contract.encode_abi(
|
||||
abi_element_identifier="transfer",
|
||||
args=[recipient_address, 50 * 10**6]
|
||||
),
|
||||
"value": "0"
|
||||
}
|
||||
|
||||
# Both execute atomically
|
||||
response = client.execute([approve_tx, transfer_tx], "Approve and transfer")
|
||||
response.wait()
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<Tip>
|
||||
Batching reduces latency and ensures all transactions succeed or fail
|
||||
together.
|
||||
</Tip>
|
||||
|
||||
## Transaction States
|
||||
|
||||
Track transaction progress through these states:
|
||||
|
||||
| State | Terminal | Description |
|
||||
| ----------------- | -------- | ------------------------------- |
|
||||
| `STATE_NEW` | No | Transaction received by relayer |
|
||||
| `STATE_EXECUTED` | No | Submitted onchain |
|
||||
| `STATE_MINED` | No | Included in a block |
|
||||
| `STATE_CONFIRMED` | Yes | Finalized successfully |
|
||||
| `STATE_FAILED` | Yes | Failed permanently |
|
||||
| `STATE_INVALID` | Yes | Rejected as invalid |
|
||||
|
||||
## Contract Addresses
|
||||
|
||||
See [Contracts](/resources/contracts) for all Polymarket smart contract addresses on Polygon.
|
||||
|
||||
## Resources
|
||||
|
||||
* [Builder Relayer Client (TypeScript)](https://github.com/Polymarket/builder-relayer-client)
|
||||
* [Builder Relayer Client (Python)](https://github.com/Polymarket/py-builder-relayer-client)
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Negative Risk Markets" icon="scale-balanced" href="/advanced/neg-risk">
|
||||
Learn about capital-efficient trading for multi-outcome events.
|
||||
</Card>
|
||||
|
||||
<Card title="Positions & Tokens" icon="coins" href="/concepts/positions-tokens">
|
||||
Understand token operations like split, merge, and redeem.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
Reference in New Issue
Block a user