@somnia-chain/markets-sdk


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

Interface: PlacePerpStopOrderParams

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

Inputs to Trader.placePerpStopOrder — a take-profit / stop-loss (or, with intent: "opening", a stop-entry) that the PerpStopOrderRegistry holds pending and places on the PerpPool when the MARK price crosses the trigger.

Pass pair to arm two legs as a linked one-cancels-other set in a single transaction, at 2x the SOMI payment. There is no separate "place linked" method on purpose: a pair is the same order with a second leg, and splitting it would give callers two ways to say one thing.

Extends

Properties

isBid

isBid: boolean

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

True = the triggered order buys, false = sells.

Inherited from

PerpStopOrderLeg.isBid


quantity

quantity: bigint

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

Base quantity to trade at trigger, raw base units.

ZERO is a sentinel meaning "the whole position at trigger time" — the size is resolved against the live position when it fires, so the stop keeps covering a position that GREW after it was armed. A non-zero quantity is fixed at creation and only ever clamped DOWN. Rejected for "opening" intent, where it has no meaning.

Inherited from

PerpStopOrderLeg.quantity


triggerPrice

triggerPrice: bigint

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

Mark price that arms the trigger (raw collateral units per whole base).

Inherited from

PerpStopOrderLeg.triggerPrice


triggerOperator

triggerOperator: 0 | 1

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

0 = GTE (fires when mark ≥ triggerPrice), 1 = LTE (mark ≤ triggerPrice).

Inherited from

PerpStopOrderLeg.triggerOperator


stopOrderType

stopOrderType: 0 | 1

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

0 = LIMIT (uses limitPrice), 1 = MARKET (slippage-bounded by the registry).

Inherited from

PerpStopOrderLeg.stopOrderType


limitPrice?

optional limitPrice?: bigint

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

Limit price for a LIMIT stop (raw collateral per whole base). Must be 0 for MARKET.

Inherited from

PerpStopOrderLeg.limitPrice


builder?

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

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

Builder to tag on the triggered order. Omit for none.

Inherited from

PerpStopOrderLeg.builder


builderFeeBpsTimes1k?

optional builderFeeBpsTimes1k?: bigint

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

Builder fee in bps x 1000 (so 1500 = 1.5bps). Requires builder.

Inherited from

PerpStopOrderLeg.builderFeeBpsTimes1k


registry

registry: `0x${string}`

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

PerpStopOrderRegistry address (one per PerpPool).


pool

pool: `0x${string}`

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

The PerpPool the registry places on — needed for the operator-auth check.


operatorRegistry?

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

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

Shared OperatorPermissionsRegistry where the one-time global approval is granted. Resolved from the live config (addresses.operatorPermissionsRegistry) if omitted.


intent?

optional intent?: PerpStopIntent

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

Reduce-only (default) or opening. Omit and existing callers keep the behaviour they always had.


pair?

optional pair?: PerpStopOrderLeg

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

A second leg, armed atomically and LINKED to the first: when one fires and fills, the other is cancelled and its SOMI refunded.

The pair must be a coherent TP/SL set — same side, OPPOSITE trigger operators, and straddling (the GTE leg's trigger above the LTE leg's) — or the registry rejects it. Both legs are reduce-only; an opening leg cannot be paired, because a bracket whose children activate on the parent's FILL is not expressible (the pool does not notify the registry on fill).


somiPayment?

optional somiPayment?: bigint

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

SOMI to fund the reactivity trigger gas, PER LEG. Read from registry.somiPaymentPerOrder() if omitted; a pair sends twice this.


skipOperatorApproval?

optional skipOperatorApproval?: boolean

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

Skip the one-time operator-approval check/tx (default false). Set true if you know the registry is already operator-approved for this owner.


gas?

optional gas?: bigint

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

Gas ceiling for this tx.

Default Value

TraderConfig.gas (10,000,000)