@somnia-chain/markets-sdk


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

Type Alias: PerpStopOrder

PerpStopOrder = object

Defined in: packages/sdk/src/perp/stops.ts:91

One take-profit / stop-loss order on a perp market.

Properties

id

id: string

Defined in: packages/sdk/src/perp/stops.ts:93

Row id (${registry}_${orderId}).


registry

registry: string

Defined in: packages/sdk/src/perp/stops.ts:95

The PerpStopOrderRegistry holding it (lowercased).


orderIdRaw

orderIdRaw: string

Defined in: packages/sdk/src/perp/stops.ts:97

uint128 registry OrderId as a decimal string — pass to trader.cancelStopOrder.


owner

owner: string

Defined in: packages/sdk/src/perp/stops.ts:99

The order's owner (lowercased).


isBid

isBid: boolean

Defined in: packages/sdk/src/perp/stops.ts:101

True = the triggered order buys, false = sells.


quantity

quantity: string

Defined in: packages/sdk/src/perp/stops.ts:103

Quantity in raw base units.


triggerPrice

triggerPrice: string

Defined in: packages/sdk/src/perp/stops.ts:105

The MARK price at which it fires, raw quote units per whole base.


triggerOperator

triggerOperator: number

Defined in: packages/sdk/src/perp/stops.ts:111

Which way the mark must cross triggerPrice to fire: 0 = GTE (fires at or above), 1 = LTE (fires at or below). This, not the side, is what makes a stop a take-profit or a stop-loss.


orderType

orderType: number

Defined in: packages/sdk/src/perp/stops.ts:113

0 = LIMIT, 1 = MARKET — the type of order placed when it fires.


builder

builder: string

Defined in: packages/sdk/src/perp/stops.ts:115

Builder tagged on the resulting order (lowercased); zero address for none.


builderFeeBpsTimes1k

builderFeeBpsTimes1k: string

Defined in: packages/sdk/src/perp/stops.ts:123

The builder fee the triggered order will charge, in bps x 1000 — so 1500 is 1.5bps, not 1500bps. "0" when no builder is tagged.

Only knowable from the creation event: the registry deletes a pending order on every fire, so after a trigger nothing on chain can say what fee was agreed.


status

status: StopOrderStatus

Defined in: packages/sdk/src/perp/stops.ts:125

Lifecycle state — see StopOrderStatus.


placedOrderId

placedOrderId: string | null

Defined in: packages/sdk/src/perp/stops.ts:127

The PerpPool order id created on a successful trigger; null otherwise.


dropReason

dropReason: PerpStopDropReason | null

Defined in: packages/sdk/src/perp/stops.ts:136

Why a trigger placed nothing, decoded — null on a pending or successful order.

Read it before calling a TRIGGER_FAILED order a failure: a reduce-only drop means the stop was overtaken by events (position already closed, flipped, or below minimum), which is ordinary. Only PlacementFailed is a rejection. SOMI is consumed on every fire regardless of outcome.


createdAt

createdAt: string

Defined in: packages/sdk/src/perp/stops.ts:138

Timestamp (unix seconds) the stop was created.


updatedAt

updatedAt: string

Defined in: packages/sdk/src/perp/stops.ts:140

Timestamp (unix seconds) of the last state change.


txHash

txHash: string

Defined in: packages/sdk/src/perp/stops.ts:142

Tx hash the stop was created in.


market

market: PerpStopOrderMarket

Defined in: packages/sdk/src/perp/stops.ts:144

The perp market it targets.