@somnia-chain/markets-sdk / index / perpOrderMarginQuote
Function: perpOrderMarginQuote()
perpOrderMarginQuote(
p):PerpOrderMarginQuote
Defined in: packages/sdk/src/perp/margin.ts:1883
The pool's placement arithmetic — pure, no client, no block.
Split out of SomniaMarketsClient.previewPerpOrderMargin so the FORWARD question ("what does this
order cost") and the INVERSE one (client.getMaxPerpOrderSize, "what is the largest
order I can place") are answered by the same code rather than by two ports of the
same contract. They cannot drift, which matters more here than usual: a max size
computed by a second, subtly different rule reverts on placement, and the term such
a rule most often drops is PerpOrderMarginQuote.adverseGapPortion.
Auto-pull (T70) is modelled iff PerpOrderMarginQuoteInputs.wallet is
supplied, and supplying it is a statement about the SENDER, not about the account:
PerpPool._autoPullMargin fires only when msg.sender == order.owner. Given a
wallet, the gates below describe the balance the pool will have topped up to before
it locks; without one they describe the in-bank balance alone, which is what an
operator- or registry-routed placement actually faces. The no-wallet path is
arithmetically identical to the pre-T70 one.