getMuonUpnl
Fetch a fresh Muon uPnl attestation for a partyB / partyA pair and normalize it to typed fields. Returns the combined attestation — partyA and partyB uPnL in one response, with a per-party breakdown. For a single-party uPnL use getMuonUpnlA / getMuonUpnlB instead. The oracle URLs and the SYMMIO diamond address are resolved from config; gateways are tried in order until one succeeds.
import { getMuonUpnl } from "@symmio/trading-core";
const a = await getMuonUpnl(config, { partyB: "0xb...", partyA: "0xva..." });
console.log(a.uPnlA, a.uPnlB);Parameters
partyBAddressrequiredThe partyB (solver/hedger) side of the pair to attest.
partyAAddressrequiredThe partyA (virtual account for lowcap) to attest.
chainIdnumberoptionalOptional chain override.
Returns
GetMuonUpnlReturnTypepartyBAddressThe attested partyB.
partyAAddressThe attested partyA.
uPnlAbigintoptionalPartyA’s signed unrealized PnL (18-decimal, signed).
uPnlBbigintoptionalPartyB’s signed unrealized PnL (18-decimal, signed).
notionalValueSumAbigintoptionalSum of notional values across the partyA’s positions.
notionalValueSumBbigintoptionalSum of notional values across the partyB’s positions.
quoteIdsAbigint[]Quote ids included in the partyA side of the attestation.
quoteIdsBbigint[]Quote ids included in the partyB side of the attestation.
Plus the MuonAttestationBase signature envelope fields.
Query options
import { getMuonUpnlQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getMuonUpnlQueryOptions(config, { partyB, partyA }));GetMuonUpnlOptions requires partyB and partyA; the factory does not accept missing inputs or validate them inside queryFn. The getMuonUpnlQueryKey builder still accepts partial inputs for cache matching and invalidation.