Update Polymarket documentation (2026-02-19)
- Added new documentation URLs from llms.txt index - Updated TARGET.md with 244 total documentation pages - Scraped new pages for trading, concepts, and API reference sections - Updated changelog and new index pages
This commit is contained in:
@@ -2,175 +2,231 @@
|
||||
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
|
||||
> Use this file to discover all available pages before exploring further.
|
||||
|
||||
# Setup
|
||||
# Getting Started
|
||||
|
||||
> One-time setup for market making on Polymarket: deposits, approvals, wallets, and API keys
|
||||
> One-time setup for market making on Polymarket
|
||||
|
||||
## Overview
|
||||
Before you can start market making, you need to complete these one-time setup steps — deposit USDC.e to Polygon, deploy a wallet, approve tokens for trading, and generate API credentials.
|
||||
|
||||
Before you can start market making on Polymarket, you need to complete these one-time setup steps:
|
||||
<Steps>
|
||||
<Step title="Deposit USDC.e">
|
||||
Market makers need USDC.e on Polygon to fund their trading operations.
|
||||
|
||||
1. Deposit bridged USDCe to Polygon
|
||||
2. Deploy a wallet (EOA or Safe)
|
||||
3. Approve tokens for trading
|
||||
4. Generate API credentials
|
||||
| Method | Best For | Documentation |
|
||||
| ----------------------- | ------------------------------------ | ---------------------------------------------------- |
|
||||
| Bridge API | Automated deposits from other chains | [Bridge Deposit](/trading/bridge/deposit) |
|
||||
| Direct Polygon transfer | Already have USDC.e on Polygon | N/A |
|
||||
| Cross-chain bridge | Large deposits from Ethereum | [Supported Assets](/trading/bridge/supported-assets) |
|
||||
|
||||
## Deposit USDCe
|
||||
### Using the Bridge API
|
||||
|
||||
Market makers need USDCe on Polygon to fund their trading operations.
|
||||
```typescript theme={null}
|
||||
// Get deposit addresses for your Polymarket wallet
|
||||
const deposit = await fetch("https://bridge.polymarket.com/deposit", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
address: "YOUR_POLYMARKET_WALLET_ADDRESS",
|
||||
}),
|
||||
});
|
||||
|
||||
### Options
|
||||
// Returns deposit addresses for EVM, SVM, and BTC networks
|
||||
const addresses = await deposit.json();
|
||||
// Send USDC to the appropriate address for your source chain
|
||||
```
|
||||
</Step>
|
||||
|
||||
| Method | Best For | Documentation |
|
||||
| ----------------------- | ------------------------------------ | ----------------------------------------------------------------------- |
|
||||
| Bridge API | Automated deposits from other chains | [Bridge Overview](/developers/misc-endpoints/bridge-overview) |
|
||||
| Direct Polygon transfer | Already have USDCe on Polygon | N/A |
|
||||
| Cross-chain bridge | Large deposits from Ethereum | [Large Deposits](/polymarket-learn/deposits/large-cross-chain-deposits) |
|
||||
<Step title="Deploy a Wallet">
|
||||
### EOA (Externally Owned Account)
|
||||
|
||||
### Using the Bridge API
|
||||
Standard Ethereum wallet. You pay for all onchain transactions (approvals, splits, merges, trade execution).
|
||||
|
||||
```typescript theme={null}
|
||||
// Deposit USDCe from Ethereum to Polygon
|
||||
const deposit = await fetch("https://clob.polymarket.com/deposit", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
chainId: "1",
|
||||
fromChain: "ethereum",
|
||||
toChain: "polygon",
|
||||
asset: "USDCe",
|
||||
amount: "100000000000" // $100,000 in USDCe (6 decimals)
|
||||
})
|
||||
});
|
||||
```
|
||||
### Safe Wallet (Recommended)
|
||||
|
||||
See [Bridge Deposit](/api-reference/bridge/create-deposit-addresses) for full API details.
|
||||
Gnosis Safe-based wallet deployed via Polymarket's relayer. Benefits:
|
||||
|
||||
## Wallet Options
|
||||
* **Gasless transactions** — Polymarket pays gas fees for onchain operations
|
||||
* **Contract wallet** — Enables advanced features like batched transactions
|
||||
|
||||
### EOA (Externally Owned Account)
|
||||
Deploy a Safe wallet using the Relayer Client:
|
||||
|
||||
Standard Ethereum wallet. You pay for all onchain transactions (approvals, splits, merges, trade exedcution).
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { RelayClient, RelayerTxType } from "@polymarket/builder-relayer-client";
|
||||
|
||||
### Safe Wallet (Recommended)
|
||||
const client = new RelayClient(
|
||||
"https://relayer-v2.polymarket.com/",
|
||||
137, // Polygon mainnet
|
||||
signer,
|
||||
builderConfig,
|
||||
RelayerTxType.SAFE,
|
||||
);
|
||||
|
||||
Gnosis Safe-based wallet deployed via Polymarket's relayer. Benefits:
|
||||
// Deploy the Safe wallet
|
||||
const response = await client.deploy();
|
||||
const result = await response.wait();
|
||||
console.log("Safe Address:", result?.proxyAddress);
|
||||
```
|
||||
|
||||
* **Gasless transactions** - Polymarket pays gas fees for onchain operations
|
||||
* **Contract wallet** - Enables advanced features like batched transactions.
|
||||
```python Python theme={null}
|
||||
from py_builder_relayer_client.client import RelayClient
|
||||
|
||||
Deploy a Safe wallet using the [Relayer Client](/developers/builders/relayer-client):
|
||||
# client initialized with builder_config
|
||||
|
||||
```typescript theme={null}
|
||||
import { RelayClient, RelayerTxType } from "@polymarket/builder-relayer-client";
|
||||
# Deploy the Safe wallet
|
||||
response = client.deploy()
|
||||
result = response.wait()
|
||||
print("Safe Address:", result.get("proxyAddress"))
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
const client = new RelayClient(
|
||||
"https://relayer-v2.polymarket.com/",
|
||||
137, // Polygon mainnet
|
||||
signer,
|
||||
builderConfig,
|
||||
RelayerTxType.SAFE
|
||||
);
|
||||
<Info>
|
||||
See [Gasless Transactions](/trading/gasless) for full Relayer Client setup
|
||||
including local and remote signing configurations.
|
||||
</Info>
|
||||
</Step>
|
||||
|
||||
// Deploy the Safe wallet
|
||||
const response = await client.deploy();
|
||||
const result = await response.wait();
|
||||
console.log("Safe Address:", result?.proxyAddress);
|
||||
```
|
||||
<Step title="Approve Tokens">
|
||||
Before trading, you must approve the exchange contracts to spend your tokens.
|
||||
|
||||
## Token Approvals
|
||||
### Required Approvals
|
||||
|
||||
Before trading, you must approve the exchange contracts to spend your tokens.
|
||||
| Token | Spender | Purpose |
|
||||
| -------------------- | --------------------- | -------------------------------- |
|
||||
| USDC.e | CTF Contract | Split USDC.e into outcome tokens |
|
||||
| CTF (outcome tokens) | CTF Exchange | Trade outcome tokens |
|
||||
| CTF (outcome tokens) | Neg Risk CTF Exchange | Trade neg-risk market tokens |
|
||||
|
||||
### Required Approvals
|
||||
### Contract Addresses (Polygon Mainnet)
|
||||
|
||||
| Token | Spender | Purpose |
|
||||
| -------------------- | --------------------- | ------------------------------- |
|
||||
| USDCe | CTF Contract | Split USDCe into outcome tokens |
|
||||
| CTF (outcome tokens) | CTF Exchange | Trade outcome tokens |
|
||||
| CTF (outcome tokens) | Neg Risk CTF Exchange | Trade neg-risk market tokens |
|
||||
```typescript theme={null}
|
||||
const ADDRESSES = {
|
||||
USDCe: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
||||
CTF: "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045",
|
||||
CTF_EXCHANGE: "0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E",
|
||||
NEG_RISK_CTF_EXCHANGE: "0xC5d563A36AE78145C45a50134d48A1215220f80a",
|
||||
NEG_RISK_ADAPTER: "0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296",
|
||||
};
|
||||
```
|
||||
|
||||
### Contract Addresses (Polygon Mainnet)
|
||||
### Approve via Relayer Client
|
||||
|
||||
```typescript theme={null}
|
||||
const ADDRESSES = {
|
||||
USDCe: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
||||
CTF: "0x4d97dcd97ec945f40cf65f87097ace5ea0476045",
|
||||
CTF_EXCHANGE: "0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E",
|
||||
NEG_RISK_CTF_EXCHANGE: "0xC5d563A36AE78145C45a50134d48A1215220f80a",
|
||||
NEG_RISK_ADAPTER: "0xd91E80cF2E7be2e162c6513ceD06f1dD0dA35296"
|
||||
};
|
||||
```
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { ethers } from "ethers";
|
||||
import { Interface } from "ethers/lib/utils";
|
||||
|
||||
### Approve via Relayer Client
|
||||
const erc20Interface = new Interface([
|
||||
"function approve(address spender, uint256 amount) returns (bool)",
|
||||
]);
|
||||
|
||||
```typescript theme={null}
|
||||
import { ethers } from "ethers";
|
||||
import { Interface } from "ethers/lib/utils";
|
||||
// Approve USDCe for CTF contract
|
||||
const approveTx = {
|
||||
to: ADDRESSES.USDCe,
|
||||
data: erc20Interface.encodeFunctionData("approve", [
|
||||
ADDRESSES.CTF,
|
||||
ethers.constants.MaxUint256,
|
||||
]),
|
||||
value: "0",
|
||||
};
|
||||
|
||||
const erc20Interface = new Interface([
|
||||
"function approve(address spender, uint256 amount) returns (bool)"
|
||||
]);
|
||||
const response = await client.execute([approveTx], "Approve USDCe for CTF");
|
||||
await response.wait();
|
||||
```
|
||||
|
||||
// Approve USDCe for CTF contract
|
||||
const approveTx = {
|
||||
to: ADDRESSES.USDCe,
|
||||
data: erc20Interface.encodeFunctionData("approve", [
|
||||
ADDRESSES.CTF,
|
||||
ethers.constants.MaxUint256
|
||||
]),
|
||||
value: "0"
|
||||
};
|
||||
```python Python theme={null}
|
||||
from web3 import Web3
|
||||
|
||||
const response = await client.execute([approveTx], "Approve USDCe for CTF");
|
||||
await response.wait();
|
||||
```
|
||||
USDC = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
|
||||
CTF = "0x4D97DCd97eC945f40cF65F87097ACe5EA0476045"
|
||||
MAX_UINT256 = 2**256 - 1
|
||||
|
||||
See [Relayer Client](/developers/builders/relayer-client) for complete examples.
|
||||
approve_tx = {
|
||||
"to": USDC,
|
||||
"data": Web3().eth.contract(
|
||||
address=USDC,
|
||||
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"
|
||||
}
|
||||
|
||||
## API Key Generation
|
||||
response = client.execute([approve_tx], "Approve USDC for CTF")
|
||||
response.wait()
|
||||
```
|
||||
</CodeGroup>
|
||||
</Step>
|
||||
|
||||
To place orders and access authenticated endpoints, you need L2 API credentials.
|
||||
<Step title="Generate API Credentials">
|
||||
To place orders and access authenticated endpoints, you need L2 API credentials derived from your wallet.
|
||||
|
||||
### Generate API Key
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
import { ClobClient } from "@polymarket/clob-client";
|
||||
|
||||
```typescript theme={null}
|
||||
import { ClobClient } from "@polymarket/clob-client";
|
||||
const client = new ClobClient("https://clob.polymarket.com", 137, signer);
|
||||
|
||||
const client = new ClobClient(
|
||||
"https://clob.polymarket.com",
|
||||
137,
|
||||
signer
|
||||
);
|
||||
// Derive API credentials from your wallet
|
||||
const credentials = await client.createOrDeriveApiKey();
|
||||
console.log("API Key:", credentials.key);
|
||||
console.log("Secret:", credentials.secret);
|
||||
console.log("Passphrase:", credentials.passphrase);
|
||||
```
|
||||
|
||||
// Derive API credentials from your wallet
|
||||
const credentials = await client.deriveApiKey();
|
||||
console.log("API Key:", credentials.key);
|
||||
console.log("Secret:", credentials.secret);
|
||||
console.log("Passphrase:", credentials.passphrase);
|
||||
```
|
||||
```python Python theme={null}
|
||||
from py_clob_client.client import ClobClient
|
||||
import os
|
||||
|
||||
### Using Credentials
|
||||
private_key = os.getenv("PRIVATE_KEY")
|
||||
|
||||
Once you have credentials, initialize the client for authenticated operations:
|
||||
temp_client = ClobClient("https://clob.polymarket.com", key=private_key, chain_id=137)
|
||||
credentials = temp_client.create_or_derive_api_creds()
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
```typescript theme={null}
|
||||
const client = new ClobClient(
|
||||
"https://clob.polymarket.com",
|
||||
137,
|
||||
wallet,
|
||||
credentials
|
||||
);
|
||||
```
|
||||
Once you have credentials, initialize the client for authenticated operations:
|
||||
|
||||
See [CLOB Authentication](/developers/CLOB/authentication) for full details.
|
||||
<CodeGroup>
|
||||
```typescript TypeScript theme={null}
|
||||
const tradingClient = new ClobClient(
|
||||
"https://clob.polymarket.com",
|
||||
137,
|
||||
wallet,
|
||||
credentials,
|
||||
);
|
||||
```
|
||||
|
||||
```python Python theme={null}
|
||||
client = ClobClient(
|
||||
"https://clob.polymarket.com",
|
||||
key=private_key,
|
||||
chain_id=137,
|
||||
creds=credentials,
|
||||
)
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
See [Authentication](/trading/overview#authentication) for full details on signature types and REST API headers.
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
***
|
||||
|
||||
## Next Steps
|
||||
|
||||
Once setup is complete:
|
||||
|
||||
<CardGroup cols={1}>
|
||||
<Card title="Start Trading" icon="chart-line" href="/developers/market-makers/trading">
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Trading" icon="chart-line" href="/market-makers/trading">
|
||||
Post limit orders and manage quotes
|
||||
</Card>
|
||||
|
||||
<Card title="Market Data" icon="database" href="/market-data/overview">
|
||||
Connect to real-time market data
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
Reference in New Issue
Block a user