Skip to main content

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.
NetworkBase URLChain ID
Mainnethttps://backend.themarketunited.com56
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.themarketunited.com/markets/{id}/trading"

2. Approve Trading Contracts

Before trading, the wallet must approve the exchange contract.
ActionApproval
Buy outcome tokensApprove the collateral ERC-20 for CTFExchange.
Sell outcome tokensCall setApprovalForAll(CTFExchange, true) on the ConditionalTokens contract.
Use the mainnet exchange address: 0x9e39462F9cB7d290670111B14097B517d1824cd1.

3. Build the EIP-712 Domain

const domain = {
  name: "Polymarket CTF Exchange",
  version: "1",
  chainId: 56,
  verifyingContract: "0x9e39462F9cB7d290670111B14097B517d1824cd1",
} 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.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.themarketunited.com/orders/0xORDER_HASH"
curl -X POST "https://backend.themarketunited.com/markets/{id}/orders/cancel" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "orderHash": "0xORDER_HASH" }'