@somnia-chain/markets-sdk


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

Interface: CreateOrderParams

Defined in: packages/sdk/src/unified/exchange.ts:286

The optional trailing params bag of SomniaMarkets.createOrder — time-in-force, market-order slippage, and builder-fee attribution. Everything here has a working default.

Properties

timeInForce?

optional timeInForce?: "GTC" | "IOC" | "FOK" | "PO"

Defined in: packages/sdk/src/unified/exchange.ts:288

"IOC" | "FOK" | "PO" (post-only). Default GTC (rest).


postOnly?

optional postOnly?: boolean

Defined in: packages/sdk/src/unified/exchange.ts:290

Alias for timeInForce: "PO".


slippage?

optional slippage?: number

Defined in: packages/sdk/src/unified/exchange.ts:292

Market-order slippage bound vs the best opposite level (default 0.01 = 1%).


builder?

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

Defined in: packages/sdk/src/unified/exchange.ts:298

Routing/builder frontend to attribute the order to. Requires a prior client.createTrader().approveBuilder(...) opt-in on the pool, else a non-zero builderFeeBpsTimes1k reverts. Works on binary, spot and perp.


builderFeeBpsTimes1k?

optional builderFeeBpsTimes1k?: bigint

Defined in: packages/sdk/src/unified/exchange.ts:303

Per-order builder/routing fee in the pool's native bps×1000 unit (must not exceed the effective approval / the pool's max builder fee).


funding?

optional funding?: "auto" | "explicit" | "skip"

Defined in: packages/sdk/src/unified/exchange.ts:322

What to do when the order's collateral is not on the market's chain.

  • "explicit" (the default on a multi-chain exchange): check the escrow token's balance on the market's chain and throw CollateralOnWrongChainError — with where the funds are and a ready bridge plan — instead of sending anything.
  • "auto": bridge the shortfall from the richest other configured chain through SomniaMarkets.ensureFunds, wait for delivery, then place. The order lands seconds after the call.
  • "skip" (the default on a single-chain exchange, where there is nowhere else the collateral could be): no balance check — the single round-trip, for a hot path that funds itself.

Checked on ERC-20 escrows (a buy's collateral, a spot sell's base). A perp order draws on the MarginBank and a binary sell escrows outcome tokens, so neither is checked here.