@somnia-chain/markets-sdk


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

Interface: PerpOrderMarginQuoteInputs

Defined in: packages/sdk/src/perp/margin.ts:1624

Everything the placement gates need, and nothing that has to come from a particular block — so perpOrderMarginQuote stays pure.

Properties

isBid

isBid: boolean

Defined in: packages/sdk/src/perp/margin.ts:1626

True = a buy.


quantity

quantity: bigint

Defined in: packages/sdk/src/perp/margin.ts:1628

Order quantity, raw base units.


price

price: bigint

Defined in: packages/sdk/src/perp/margin.ts:1630

Limit price, raw quote units per whole base.


oneBase

oneBase: bigint

Defined in: packages/sdk/src/perp/margin.ts:1632

10^decimals of the synthetic base.


markPrice

markPrice: bigint

Defined in: packages/sdk/src/perp/margin.ts:1634

Current mark, raw quote units per whole base.


effectiveImfBps

effectiveImfBps: bigint

Defined in: packages/sdk/src/perp/margin.ts:1636

The OI-scaled IMF in force, bps.


positionSize

positionSize: bigint

Defined in: packages/sdk/src/perp/margin.ts:1638

SIGNED existing position size, raw base units.


effectiveReducingCapacity

effectiveReducingCapacity: bigint

Defined in: packages/sdk/src/perp/margin.ts:1640

Reducing capacity resting orders have not already spoken for, raw base units.


equity

equity: bigint

Defined in: packages/sdk/src/perp/margin.ts:1642

Account equity, signed.


imRequirement

imRequirement: bigint

Defined in: packages/sdk/src/perp/margin.ts:1644

Aggregate initial-margin requirement.


unlockedCollateral

unlockedCollateral: bigint

Defined in: packages/sdk/src/perp/margin.ts:1646

Unlocked collateral balance, signed.


accountMaxLeverageX

accountMaxLeverageX: number

Defined in: packages/sdk/src/perp/margin.ts:1648

The account's own per-market cap, 0 when unset.


protocolMaxLeverageX

protocolMaxLeverageX: number

Defined in: packages/sdk/src/perp/margin.ts:1650

Protocol-wide ceiling.


creditFloor

creditFloor: bigint

Defined in: packages/sdk/src/perp/margin.ts:1652

The account's credit-voucher floor.


voucherLeverageCapX

voucherLeverageCapX: number

Defined in: packages/sdk/src/perp/margin.ts:1654

The protocol's voucher leverage cap, 0 when unset.


voucherMarketAllowed

voucherMarketAllowed: boolean

Defined in: packages/sdk/src/perp/margin.ts:1656

Whether this market is voucher-allowlisted.


wallet?

optional wallet?: object

Defined in: packages/sdk/src/perp/margin.ts:1673

The owner's wallet, which turns auto-pull (T70) modelling ON.

Supply it only when the transaction sender will be the order owner, because that is the pool's entire gate: PerpPool._autoPullMargin returns early unless msg.sender == order.owner, deliberately narrower than spot's, which also admits registry-approved operators. Routing through placeOrderFor, an operator grant, a router, or the stop registry means no pull — omit this and the gates fall back to the in-bank balance, which is what those paths actually face.

balance is the owner's collateral-token balance and allowance their approval to the MarginBank (the same one deposit already needs — the pool reaches the wallet through depositFor). Both bind: the pull is an ordinary transferFrom, so whichever is smaller is the ceiling, and an insufficient one reverts from the TOKEN rather than being swallowed.

balance

balance: bigint

allowance

allowance: bigint


takerFeeBpsTimes1k?

optional takerFeeBpsTimes1k?: bigint

Defined in: packages/sdk/src/perp/margin.ts:1678

The pool's taker fee, BPS_TIMES_1K. Feeds PerpOrderMarginQuote.feeHeadroom only; the lock itself is fee-free. Defaults to 0n.


makerFeeBpsTimes1k?

optional makerFeeBpsTimes1k?: bigint

Defined in: packages/sdk/src/perp/margin.ts:1680

The pool's maker fee, BPS_TIMES_1K and SIGNED — negative is a rebate. Defaults to 0n.


builderFeeBpsTimes1k?

optional builderFeeBpsTimes1k?: bigint

Defined in: packages/sdk/src/perp/margin.ts:1682

The builder fee attached to this order, BPS_TIMES_1K. Defaults to 0n.


restricted?

optional restricted?: boolean

Defined in: packages/sdk/src/perp/margin.ts:1689

The market is in close-only mode (PerpPool.isRestricted()). Defaults to false.

Rejects any order with an increasing leg outright — no arithmetic involved — so it behaves like the voucher block rather than like a margin gate.


isolationAllowsMarket?

optional isolationAllowsMarket?: boolean

Defined in: packages/sdk/src/perp/margin.ts:1696

MarginBank.isolationAllowsMarket(account, pool). Defaults to true.

false rejects the WHOLE order, reducing legs included — the one placement gate that does, because it is a market-selection rule rather than a margin one.