Skip to content

feat(polymarket): add buildOnly mode for unsigned transactions - Fixes #53#54

Closed
theluckystrike wants to merge 1 commit intopmxt-dev:mainfrom
theluckystrike:main
Closed

feat(polymarket): add buildOnly mode for unsigned transactions - Fixes #53#54
theluckystrike wants to merge 1 commit intopmxt-dev:mainfrom
theluckystrike:main

Conversation

@theluckystrike
Copy link
Copy Markdown
Contributor

@theluckystrike theluckystrike commented Mar 4, 2026

Summary

This PR adds a buildOnly parameter to CreateOrderParams that enables a "build only" mode for the Polymarket exchange. When buildOnly is set to true, the order is created and signed but NOT submitted to the network. Instead, the signed order data is returned, allowing users to:

  • Sign and broadcast the transaction themselves
  • Route the transaction through an on-chain middleware contract
  • Use non-custodial integrations

Changes

  1. core/src/types.ts: Added buildOnly?: boolean to CreateOrderParams interface
  2. core/src/exchanges/polymarket/index.ts: Modified createOrder to check for buildOnly flag:
    • When buildOnly is true: calls client.createOrder() which builds and signs the order but does NOT submit it, returns the order with status pending
    • When buildOnly is false (default): behaves as before, submits the order via createAndPostOrder()

Usage Example

const order = await client.createOrder({
  marketId: ...,
  outcomeId: ...,
  side: buy,
  type: market,
  amount: 100,
  buildOnly: true  // Returns signed order without submitting
});
// order.status === pending
// Use order.id (orderHash) for your own signing/broadcasting flow

Contributed by theluckystrike | Zovo — Chrome Extension Studio

…sactions

Adds a buildOnly parameter to CreateOrderParams that when set to true,
returns the signed order data without submitting to the network. This
enables non-custodial integrations where users can sign and broadcast
transactions themselves or route them through on-chain middleware.

Fixes #53
@theluckystrike theluckystrike closed this by deleting the head repository Mar 5, 2026
@realfishsam
Copy link
Copy Markdown
Contributor

Why did you close this? I was going to merge it into the latest changes and credit you as a co-author! Please reopen, and I will do so!

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.

2 participants