Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
ReactMuon Oracle hooks

Muon Oracle hooks

React hooks over the Core Muon slice. Fetch Muon-attested signature payloads (UPNL, price, price range, partyA overview) reactively — consumers reach for these when preparing an on-chain write that requires a Muon signature: removeMargin / deallocate, sendQuote, force-close, and settlement.

The three …Sig hooks — useDeallocateUpnlSig, useSendQuoteUpnlSig, useForceClosePriceSig — return contract-ready structs, so their results pass straight into the matching write. The remaining useMuon… hooks return the raw normalized attestations.

Every hook on this page is a mutation, not a query. Muon attestations are timestamped and short-lived, so they must be fetched on an explicit action rather than eagerly on mount — call mutateAsync(...) with the action’s inputs as the mutation variables. The on-chain writes that consume these signatures live on their own slices (see SYMMIO Contract).

Which solver enforces Muon verification is a property of its kind: the majors rasa solver requires live attestations for sendQuote and force-close, whereas the lowcap enigma InstantLayer flow signs placeholders and delegates the byte range to the solver. See Solvers & chains and Rasa solver.

Import

import { useMuonPrice, useMuonPriceRange, useMuonUpnl, useMuonUpnlA, useMuonUpnlB, useMuonUpnlWithSymbolPrice, useMuonUpnlAWithSymbolPrice, useMuonSettleUpnl, useMuonPartyAOverview, useDeallocateUpnlSig, useSendQuoteUpnlSig, useForceClosePriceSig, } from "@symmio/trading-react";

Contract signatures

The three …Sig hooks return contract-ready structs rather than raw attestations, so their results pass straight into the matching write. The corresponding write hooks (useRemoveMargin, useInstantOpen) already fetch these internally — reach for them only when you drive the calldata yourself.

useDeallocateUpnlSig

A uPnl_A attestation assembled into the SingleUpnlSig that removeMargin / deallocate require.

const { mutateAsync } = useDeallocateUpnlSig(); const upnlSig = await mutateAsync({ virtualAccount });

useSendQuoteUpnlSig

A uPnl_A_withSymbolPrice attestation assembled into the SingleUpnlAndPriceSig that sendQuote requires. Solvers enforcing Muon verification need a live one; the lowcap flow signs a placeholder instead.

const { mutateAsync } = useSendQuoteUpnlSig(); const upnlSig = await mutateAsync({ partyA: subAccount, symbolId: 1n });

Mutation variables (GetSendQuoteUpnlSigParameters): partyA: Address (the sub-account on cross-margin rasa solvers; the virtual account on lowcap), symbolId: bigint, optional chainId. The hook parameter is only an optional config override. Returns a SingleUpnlAndPriceSig.

The signature is signed inside the quote calldata, so it must be fetched immediately before signing — never from cache.

useForceClosePriceSig

A priceRange attestation assembled into the HighLowPriceSig that forceClosePosition verifies.

const { mutateAsync } = useForceClosePriceSig(); const sig = await mutateAsync({ partyA, partyB: solverAddress, symbolId: 1n, t0, t1 });

Mutation variables (GetForceClosePriceSigParameters): partyA / partyB: Address (partyB is the solver), symbolId: bigint, t0 / t1: bigint (window bounds in unix seconds), optional chainId. The hook parameter is only an optional config override. Returns a HighLowPriceSig. Force-close is a majors-only (rasa) flow. For the raw, un-assembled attestation use useMuonPriceRange instead.

Price attestations

useMuonPrice

Attested single-point price for a market.

const priceSig = useMuonPrice({ symbolId: 1n });

useMuonPriceRange

Attested min / max price window across a block range.

const rangeSig = useMuonPriceRange({ symbolId: 1n, fromBlock: 100n, toBlock: 200n, });

UPNL attestations

useMuonUpnl / useMuonUpnlA / useMuonUpnlB

Attest to an account’s UPNL. Variants: any side, party-A (trader), party-B (solver).

const upnl = useMuonUpnlA({ partyA });

useMuonUpnlWithSymbolPrice / useMuonUpnlAWithSymbolPrice

Combined UPNL + market price attestations. Consumed by writes that need both (e.g. partial close settlement).

const combo = useMuonUpnlAWithSymbolPrice({ partyA, symbolId: 1n });

useMuonSettleUpnl

Full settlement UPNL attestation across both parties. Required by settlement flows synchronizing both sides.

Account snapshot

useMuonPartyAOverview

Account-wide UPNL + collateral snapshot for a PartyA — one attestation covering every open position.

const overview = useMuonPartyAOverview({ partyA });

Errors

Muon-side errors surface as SymmioRequestError kind: "api":

  • MUON_URLS_NOT_CONFIGURED — chain has no Muon endpoint.
  • FETCH_MUON_REQUEST_FAILED — transport / HTTP failure.

Muon-side quorum failures come back as kind: "api" with the Muon error.message.

  • Core Muon — signature payload shape.
  • SYMMIO Contract — writes that consume these signatures.
  • Solvers & chains — which solver kind enforces Muon verification.
  • Rasa solver — the majors flow that requires live sendQuote and force-close attestations.
Last updated on