Client-signed execution

Hedge Layer forwards signed Polymarket requests through the same MCP and HTTP interfaces as market data. Your client signs the order and its venue authentication. Polymarket verifies them and handles matching and settlement.

Prepare an order

  1. Retrieve the market with get_polymarket_market and select its labeled outcome token ID.
  2. Call get_polymarket_orderbook with that token ID. Inspect liquidity, tick size, minimum order size, and the negative-risk flag.
  3. Use the current Polymarket CLOB SDK on your machine to construct and sign the order. Choose the exact side, amount, price, and order type yourself.
  4. Serialize the venue order body once. Generate fresh L2 authentication over that exact string and the venue method and path below.
  5. Submit the resulting request through Hedge Layer using a read-and-trade-scoped token.

See the repository's local signing example and the Polymarket trading documentation for SDK setup. Hedge Layer never needs your private key or API signing secret.

Signed request contract

ToolSign this venue requestScope
submit_polymarket_orderPOST /orderread + trade
cancel_polymarket_orderDELETE /orderread + trade
get_polymarket_orderGET /data/order/<order_id>read

Submission and cancellation take signed_body, the exact JSON string used for the venue HMAC, and auth. Lookup takes order_id and auth, with no body in its HMAC. Do not sign the Hedge Layer URL.

{
  "signed_body": "<exact serialized venue body>",
  "auth": {
    "address": "<POLY_ADDRESS>",
    "api_key": "<POLY_API_KEY>",
    "passphrase": "<POLY_PASSPHRASE>",
    "timestamp": "<POLY_TIMESTAMP>",
    "signature": "<POLY_SIGNATURE>"
  }
}

The API key ID and passphrase identify the venue credential. The signature is computed locally with its secret. Timestamps must be within 60 seconds of server time; generate the signed request immediately before sending it. Consult the live tool schemas for field constraints.

CLI

Save arguments to a protected local file, then call:

hl call submit_polymarket_order --file signed-request.json

For raw HTTP, put the same object inside { "arguments": ... } and send it to the corresponding /api/v1/tools/<name> endpoint. For MCP, use it as the tool's arguments.

Agent H

Agent H asks for approval when an execution tool is proposed. Use /load signed-request.json to load private request data locally, review the decoded order, and use /approve to submit or /reject to decline. Private authentication and signatures are excluded from the model context and conversation history.

Inspect the outcome

A submitted order may be resting, matched, or otherwise pending at the venue. Keep its returned order ID and query get_polymarket_order with fresh signed lookup authentication. Cancellation succeeds only when the venue confirms that exact order was canceled.

Network errors can leave execution outcomes unknown. Neither transport retries automatically. Inspect the venue account and order state before sending another submission. Venue eligibility, funding, allowances, matching, and settlement remain governed by the venue.