@somnia-chain/markets-sdk / index / PlaceSpotOrderParams
Interface: PlaceSpotOrderParams
Defined in: packages/sdk/src/trade.ts:415
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:417
SpotPool address.
isBid
isBid:
boolean
Defined in: packages/sdk/src/trade.ts:419
True = buy the base asset (pay quote); false = sell base (pay base/native).
price
price:
bigint
Defined in: packages/sdk/src/trade.ts:424
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:426
Base quantity, raw base units.
baseDecimals?
optionalbaseDecimals?:number
Defined in: packages/sdk/src/trade.ts:433
Base-token decimals. The pool now reports its exact funding requirement, so the SDK no longer uses this value.
Deprecated
Retained for source compatibility. New calls can omit it.
quoteToken
quoteToken:
`0x${string}`
Defined in: packages/sdk/src/trade.ts:435
Quote token (approved on a buy).
baseToken
baseToken:
`0x${string}`
Defined in: packages/sdk/src/trade.ts:437
Base token (approved on a non-native sell).
baseIsNative?
optionalbaseIsNative?:boolean
Defined in: packages/sdk/src/trade.ts:445
True when the base asset is native SOMI. A sell then pays via msg.value
instead of an approval — the pool's exact vault shortfall, fee headroom
included, read from getAutoPullRequirement (one eth_call) right before
the order is encoded. The bare quantity would revert InvalidMsgValue on
any fee-bearing pool.
expireTimestampNs?
optionalexpireTimestampNs?:bigint
Defined in: packages/sdk/src/trade.ts:461
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:463
0 limit (default) or 2 market (IOC). See ORDER_TYPE.
selfMatchingOption?
optionalselfMatchingOption?:number
Defined in: packages/sdk/src/trade.ts:468
Self-match behaviour when this order crosses your OWN resting order, default
0 (CANCEL_TAKER). See SELF_MATCHING_OPTION.
userData?
optionaluserData?:bigint
Defined in: packages/sdk/src/trade.ts:470
Opaque market-maker bookkeeping tag, forwarded verbatim. Default 0.
autoApprove?
optionalautoApprove?:boolean
Defined in: packages/sdk/src/trade.ts:472
Approve the escrow token if allowance is short (default true).
builder?
optionalbuilder?:`0x${string}`
Defined in: packages/sdk/src/trade.ts:478
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:485
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:491
Gas ceiling for this tx.
Default
TraderConfig.gas (10,000,000)