PolymarketClob.Order.Payload (PolymarketClob v0.2.0)

Copy Markdown View Source

Converts a signed order (as produced by PolymarketClob.Order.Builder) into the exact POST /order request body the official Python v2 client sends.

The builder/signing layer and the HTTP layer both exist; this is the missing middle: the official body wraps the order and changes two field encodings —

  • side — the EIP-712 struct (and therefore the builder) uses 0/1; the POST body uses "BUY"/"SELL".
  • salt — signed as a decimal string; posted as an integer.

Pinned against the post_body entries in test/fixtures/parity/orders.json (generated from py-clob-client-v2), like every other order-shape concern in this package.

Summary

Functions

Builds the POST /order body.

Types

order_type()

@type order_type() :: String.t()

Functions

post_body(signed_order, opts \\ [])

@spec post_body(
  map(),
  keyword()
) :: map()

Builds the POST /order body.

  • signed_order — builder output (string-keyed map with "signature").
  • :owner (required) — the L2 API key of the posting account.
  • :order_type"GTC" (default), "GTD", "FOK", "FAK".
  • :defer_exec — default false.
  • :post_only — default false.