@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / PlaceOrderParams

Interface: PlaceOrderParams

Defined in: packages/sdk/src/trade.ts:171

Inputs to Trader.placeOrder — a binary YES/NO limit or market order on a BinaryPool.

Properties

pool

pool: `0x${string}`

Defined in: packages/sdk/src/trade.ts:173

BinaryPool address.


side

side: BinarySide

Defined in: packages/sdk/src/trade.ts:178

Side + outcome ("BUY_YES" | "SELL_YES" | "BUY_NO" | "SELL_NO") — mapped onto the pool's OrderKind enum. Buys escrow collateral, sells escrow outcome tokens.


price

price: bigint

Defined in: packages/sdk/src/trade.ts:180

YES limit price as raw collateral units per whole outcome token (price × 10^decimals).


quantity

quantity: bigint

Defined in: packages/sdk/src/trade.ts:182

Outcome-token quantity, raw units.


outcomeToken?

optional outcomeToken?: `0x${string}`

Defined in: packages/sdk/src/trade.ts:187

Outcome-token singleton + this pool's YES/NO ids. Resolved from the pool (IBinaryPool.outcomeToken/yesId/noId) if omitted.


yesId?

optional yesId?: bigint

Defined in: packages/sdk/src/trade.ts:189

This pool's YES position id on the singleton; resolved from the pool if omitted.


noId?

optional noId?: bigint

Defined in: packages/sdk/src/trade.ts:191

This pool's NO position id on the singleton; resolved from the pool if omitted.


collateral?

optional collateral?: `0x${string}`

Defined in: packages/sdk/src/trade.ts:193

Collateral (buy-side escrow) token; resolved from the pool if omitted.


expireTimestampNs?

optional expireTimestampNs?: bigint

Defined in: packages/sdk/src/trade.ts:207

Order expiry in ns. Defaults to the POOL'S MARKET EXPIRY, not to a far future — a binary order must satisfy 0 < expireNs <= pool.marketExpiryNs or the pool rejects it with OrderExpiryBeyondMarket, which keeps the book drainable by the expiry sweeps once the market locks.

So an order left to default stops resting when its market expires. On a rolling series that is hours, not decades. There is no GTC here; ~50y is the spot and perp default, where there is no market expiry to outlive.

A value already in the past reverts (OrderAlreadyExpired) — a deliberate choice is honoured verbatim rather than silently clamped.


orderType?

optional orderType?: number

Defined in: packages/sdk/src/trade.ts:213

OrderBook OrderType (see ORDER_TYPE): 0 NormalOrder (rest), 1 FillOrKill, 2 ImmediateOrCancel, 3 PostOnly. Defaults to 0. A market order is an IOC (2) placed at the price extreme so it crosses immediately and cancels the remainder.


selfMatchingOption?

optional selfMatchingOption?: number

Defined in: packages/sdk/src/trade.ts:218

Self-match behaviour when this order crosses your OWN resting order, default 0 (CANCEL_TAKER). See SELF_MATCHING_OPTION.


autoApprove?

optional autoApprove?: boolean

Defined in: packages/sdk/src/trade.ts:220

Approve the escrow token to the pool if allowance is short (default true).


builder?

optional builder?: `0x${string}`

Defined in: packages/sdk/src/trade.ts:226

Routing/builder frontend address to attribute the order to. Requires the trader to have opted this builder in via Trader.approveBuilder. Omit (or zero) for no routing fee.


builderFeeBpsTimes1k?

optional builderFeeBpsTimes1k?: bigint

Defined in: packages/sdk/src/trade.ts:231

Per-order builder/routing fee in the pool's native bps×1000 unit (≤ the venue's frozen maxBuilderFee ceiling AND ≤ the trader's approval). 0 = none.


userData?

optional userData?: bigint

Defined in: packages/sdk/src/trade.ts:237

Opaque market-maker bookkeeping tag (v2). Forwarded verbatim to the pool (stored on the order + emitted in OrderPlaced); the SDK never interprets it and the pool no longer uses it for side derivation. Default 0.


gas?

optional gas?: bigint

Defined in: packages/sdk/src/trade.ts:243

Gas ceiling for this tx.

Default

TraderConfig.gas (10,000,000)