SYMMIO Contract
Reads and writes against the on-chain SYMMIO diamond contract — quotes, collateral, allocation, withdraw, on-chain market list, on-chain open interest. This slice targets the Symmio contract directly via viem clients.
Solver-side catalog / limit reads (getMarkets, getLockedParams, getNotionalCapBySymbolId, getOpenInterestBySymbolId) hit the solver REST API and live under Solvers — they are not contract reads even when the numbers ultimately reflect on-chain state.
Import
import {
// On-chain market catalog
getOnchainContractMarkets,
// Quote reads
getQuote,
getSubAccountQuotes,
getPartyAOpenPositions,
getPartyAPendingQuotes,
// Collateral
getCollateralAllowance,
getCollateralBalance,
// Allocate / deallocate
allocate,
deallocate,
allocated,
allocateUpnlSig,
getDeallocateUpnlSig,
// Withdraw
createClassicWithdrawPart,
getLastWithdrawRequestId,
getPendingWithdrawRequests,
} from "@symmio/trading-core";Every action mentioned below ships a matching xyzQueryOptions (reads) or xyzMutationOptions (writes). See Query options.
On-chain markets
getOnchainContractMarkets
Read the contract’s getSymbol() view — the authoritative on-chain market list, without solver-added metadata like precision or tick bounds.
const markets = await getOnchainContractMarkets(config, {});Use this when you need on-chain truth (e.g. verifying the solver’s catalog is in sync). For UI catalogs, prefer the solver’s getMarkets — it adds precision / tick metadata the contract doesn’t carry.
Quote reads
getQuote
Read one quote struct by id.
const quote = await getQuote(config, { quoteId: 42n });getSubAccountQuotes
Paginated quote list for one SubAccount.
const quotes = await getSubAccountQuotes(config, {
account: subAccount,
offset: 0n,
size: 20n,
});getPartyAOpenPositions
Open positions (quotes past anchor) for a PartyA (Virtual Account).
const open = await getPartyAOpenPositions(config, {
partyA,
offset: 0n,
size: 50n,
});getPartyAPendingQuotes
Quotes still in the pending stages for a PartyA.
const pending = await getPartyAPendingQuotes(config, {
partyA,
offset: 0n,
size: 50n,
});Collateral
getCollateralBalance
ERC-20 balance of the collateral token for one account.
const balance = await getCollateralBalance(config, { account });getCollateralAllowance
Allowance the account has granted the SYMMIO contract to spend collateral.
const allowance = await getCollateralAllowance(config, { account });Allocate / deallocate
allocate
Move collateral from the account into the SubAccount’s tradable pool.
const hash = await allocate(config, {
account: subAccount,
amount: parseUnits("100", 6),
});allocated
Read how much the SubAccount already has allocated.
const already = await allocated(config, { account: subAccount });deallocate
Withdraw idle allocated collateral. Requires an unrealised-PnL signature from Muon.
const upnlSig = await getDeallocateUpnlSig(config, { partyA });
const hash = await deallocate(config, {
account: partyA,
amount: parseUnits("50", 6),
upnlSig,
});allocateUpnlSig / getDeallocateUpnlSig
Fetch the Muon signature required for allocate / deallocate. See Muon oracle for the underlying request shape.
Withdraw
createClassicWithdrawPart
Build the calldata for the classic (non-instant) withdraw path. Combine with the AccountLayer’s simulate/write helpers, or feed into the InstantLayer for delegated execution.
const part = createClassicWithdrawPart(config, { account, amount });getLastWithdrawRequestId
Read the id of the most recent withdraw request for an account.
const lastId = await getLastWithdrawRequestId(config, { account });getPendingWithdrawRequests
Read the queued (not yet claimable) withdraws for an account.
const pending = await getPendingWithdrawRequests(config, { account });Query options
Every read exposes xyzQueryOptions / xyzQueryKey; writes expose xyzMutationOptions. See Query options.
Related
- Solvers — solver REST catalog: markets, locked params, notional cap, open interest.
- AccountLayer — SubAccount / Virtual Account creation, deposits, margin.
- InstantLayer — delegated instant flows on top of
allocate/deallocate. - Muon oracle — signature helpers for UPNL-gated writes.
- Errors — every write can surface a viem revert or an SDK-level
SymmError.