Documentation Index
Fetch the complete documentation index at: https://unitedmarket.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Orders are submitted through the backend as EIP-712 signed payloads. Backend authentication and order signing are separate: a wallet session can identify a user, but the order itself must still be signed.
SIWE login is optional for submitting a signed order, but cancelling orders requires SIWE bearer auth. For the full login flow, see Sign In & Trade.
| Network | Base URL | Chain ID |
|---|
| Testnet | https://backend-develop.themarketunited.com | 97 |
United Market is currently in sandbox/development stage. All funds, balances, markets, and trades are for testing only and do not represent real money.
1. Load Market Data
curl "https://backend-develop.themarketunited.com/markets/{id}/trading"
2. Approve Trading Contracts
Before trading, the wallet must approve the exchange contract.
| Action | Approval |
|---|
| Buy outcome tokens | Approve the collateral ERC-20 for CTFExchange. |
| Sell outcome tokens | Call setApprovalForAll(CTFExchange, true) on the ConditionalTokens contract. |
Use the testnet exchange address: 0xd5a4af09a90d67d37aaa5a6b6f877a6e1cfb9c6f.
3. Build the EIP-712 Domain
const domain = {
name: "Polymarket CTF Exchange",
version: "1",
chainId: 97,
verifyingContract: "0xd5a4af09a90d67d37aaa5a6b6f877a6e1cfb9c6f",
} as const;
4. Sign the Order
const types = {
Order: [
{ name: "salt", type: "uint256" },
{ name: "maker", type: "address" },
{ name: "signer", type: "address" },
{ name: "taker", type: "address" },
{ name: "tokenId", type: "uint256" },
{ name: "makerAmount", type: "uint256" },
{ name: "takerAmount", type: "uint256" },
{ name: "expiration", type: "uint256" },
{ name: "nonce", type: "uint256" },
{ name: "feeRateBps", type: "uint256" },
{ name: "side", type: "uint8" },
{ name: "signatureType", type: "uint8" },
],
} as const;
const order = {
salt: BigInt(Date.now()),
maker: walletAddress,
signer: walletAddress,
taker: "0x0000000000000000000000000000000000000000",
tokenId,
makerAmount,
takerAmount,
expiration: 0n,
nonce: 0n,
feeRateBps: 0n,
side: 0,
signatureType: 0,
};
const signature = await walletClient.signTypedData({
account: walletAddress,
domain,
types,
primaryType: "Order",
message: order,
});
5. Submit the Order
curl -X POST "https://backend-develop.themarketunited.com/markets/{id}/orders" \
-H "Content-Type: application/json" \
-d '{
"orderType": "GTC",
"order": {
"salt": "123456789",
"maker": "0xYourWallet",
"signer": "0xYourWallet",
"taker": "0x0000000000000000000000000000000000000000",
"tokenId": "TOKEN_ID",
"makerAmount": "50000000",
"takerAmount": "100000000",
"expiration": "0",
"nonce": "0",
"feeRateBps": "0",
"side": 0,
"signatureType": 0,
"signature": "0x..."
}
}'
The response includes an orderHash. Store it for order status and cancellation.
Check or Cancel the Order
curl "https://backend-develop.themarketunited.com/orders/0xORDER_HASH"
curl -X POST "https://backend-develop.themarketunited.com/markets/{id}/orders/cancel" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "orderHash": "0xORDER_HASH" }'