@somnia-chain/markets-sdk / index / PlaceSpotOrderParams
Interface: PlaceSpotOrderParams
Defined in: packages/sdk/src/trade.ts:311
Inputs to Trader.placeSpotOrder — a spot limit or market order on a SpotPool.
Properties
pool
pool:
`0x${string}`
Defined in: packages/sdk/src/trade.ts:313
SpotPool address.
isBid
isBid:
boolean
Defined in: packages/sdk/src/trade.ts:315
True = buy the base asset (pay quote); false = sell base (pay base/native).
price
price:
bigint
Defined in: packages/sdk/src/trade.ts:320
Limit price — raw quote units per whole base token. For a MARKET order pass a crossing price (best opposite level ± slippage); it bounds the escrow.
quantity
quantity:
bigint
Defined in: packages/sdk/src/trade.ts:322
Base quantity, raw base units.
baseDecimals
baseDecimals:
number
Defined in: packages/sdk/src/trade.ts:324
Base-token decimals (for the buy-side escrow math).
quoteToken
quoteToken:
`0x${string}`
Defined in: packages/sdk/src/trade.ts:326
Quote token (approved on a buy).
baseToken
baseToken:
`0x${string}`
Defined in: packages/sdk/src/trade.ts:328
Base token (approved on a non-native sell).
baseIsNative?
optionalbaseIsNative?:boolean
Defined in: packages/sdk/src/trade.ts:330
True when the base asset is native SOMI (sell pays via msg.value).
expireTimestampNs?
optionalexpireTimestampNs?:bigint
Defined in: packages/sdk/src/trade.ts:346
Order expiry in ns. Defaults to ~50y (GTC). A spot pool has no market
expiry to outlive, so the binary verb's OrderExpiryBeyondMarket cap does
not apply here.
Two traps:
- A timestamp already in the PAST reverts with
OrderAlreadyExpired. It used to be accepted silently — the pool skipped the placement and returned no order id, so the transaction succeeded having placed nothing — but the current protocol rejects it outright. - An expired order does NOT auto-return its escrow, and this one IS silent. The funds stay locked in the pool until someone sweeps it — Trader.cancelExpiredOrders reclaims them, and is callable by anyone, not only the owner.
orderType?
optionalorderType?:number
Defined in: packages/sdk/src/trade.ts:348
0 limit (default) or 2 market (IOC). See ORDER_TYPE.
autoApprove?
optionalautoApprove?:boolean
Defined in: packages/sdk/src/trade.ts:350
Approve the escrow token if allowance is short (default true).
builder?
optionalbuilder?:`0x${string}`
Defined in: packages/sdk/src/trade.ts:356
Routing/builder frontend address to attribute the order to. Requires the trader to have opted this builder in via Trader.approveBuilder on this pool. Omit (or zero) for no routing fee.
builderFeeBpsTimes1k?
optionalbuilderFeeBpsTimes1k?:bigint
Defined in: packages/sdk/src/trade.ts:363
Per-order builder/routing fee in the pool's native bps×1000 unit (≤ the
pool's maxBuilderFee ceiling AND ≤ the trader's approval). 0 = none.
The ceiling is owner-updatable on a SpotPool, so read it rather than
caching it indefinitely.
gas?
optionalgas?:bigint
Defined in: packages/sdk/src/trade.ts:365
Gas ceiling for this tx.
Default Value
TraderConfig.gas (10,000,000)