toUnifiedQuoteFromInstantClose
Build a CLOSING UnifiedQuote from a pending instant-close record, without merging.
A close record carries only the quote id and close amounts (already wei), so the market/side metadata is supplied via context — typically copied from the matching on-chain row. Reconciliation overlays closes onto the existing on-chain row directly; this helper is exposed for consumers that want to render a standalone close-only row when the on-chain row is not available.
import { toUnifiedQuoteFromInstantClose } from "@symmio/trading-core";
const row = toUnifiedQuoteFromInstantClose(pending, {
partyA,
symbolId,
positionType,
orderType,
});Parameters
pendingPendingInstantCloserequiredA normalized pending instant-close record (from getInstantCloses).
contextToUnifiedQuoteFromInstantCloseContextrequiredMarket/side metadata for the targeted position — the fields a close record does not carry. See below.
The context object (ToUnifiedQuoteFromInstantCloseContext) identifies the position the close targets:
partyAAddressrequiredSub-account (partyA) that owns the position being closed.
symbolIdbigintrequiredMarket identifier of the position being closed.
positionTypePositionTyperequiredSide of the position being closed.
orderTypeOrderTyperequiredOrder type of the position being closed.
Returns
The unified row, origin: "onchain", lifecycle: CLOSING, keyed onchain:<quoteId>. Open-side fields (requestedOpenPrice, quantity, openQuantity) are 0n — they come from the on-chain row when available.
Related
- UnifiedQuote — the returned shape.
- reconcileQuotes — overlays closes onto the on-chain row directly, rather than producing standalone close rows.
- Solvers —
getInstantClosesproduces thePendingInstantCloseinput.