Skip to content

feat(ts-sdk): add buildOrder method and BuiltOrder type#57

Merged
realfishsam merged 2 commits intopmxt-dev:mainfrom
Aboudjem:feat/unsigned-tx-build
Mar 13, 2026
Merged

feat(ts-sdk): add buildOrder method and BuiltOrder type#57
realfishsam merged 2 commits intopmxt-dev:mainfrom
Aboudjem:feat/unsigned-tx-build

Conversation

@Aboudjem
Copy link
Contributor

Closes #53

Summary

  • Adds buildOrder(params) to the TypeScript SDK Exchange class, mirroring the existing hand-maintained pattern used by createOrder, fetchOHLCV, etc.
  • Adds BuiltOrder interface to pmxt/models.ts matching the core BuiltOrder type (already defined in core/src/types.ts and documented in API_REFERENCE.md)
  • Adds buildOrder and submitOrder to the surface test's PUBLIC_METHODS list

How it works

buildOrder POSTs to /api/{exchange}/buildOrder on the sidecar, which runs the exchange's buildOrder implementation and returns the signed/unsigned payload without submitting. The caller gets back a BuiltOrder with exchange, params, signedOrder (CLOB), tx (AMM), and raw fields — ready to forward through middleware or sign independently.

const built = await exchange.buildOrder({
  marketId: market.marketId,
  outcomeId: market.yes.outcomeId,
  side: 'buy',
  type: 'limit',
  amount: 10,
  price: 0.55,
});
// built.signedOrder — EIP-712 payload for Polymarket CLOB
const order = await exchange.submitOrder(built);

Test plan

  • buildOrder and submitOrder appear in PUBLIC_METHODS surface test (212/212 passing)
  • node sdks/typescript/scripts/generate-client-methods.js produces 0 diff (CI drift check passes)
  • Full TypeScript SDK test suite: 212/212 pass

@realfishsam realfishsam merged commit 45384ca into pmxt-dev:main Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: "build only" mode — return unsigned transaction without submitting

2 participants