getQuoteState
Load a block-pinned, frozen market snapshot for local quotes.
Reads one market at a single block and returns a frozen MarketSnapshot. This is the state object every /math function consumes.
getSnapshot is an alias.
Import
import { createSv3Client } from "@repo/contract-client";
Usage
const snapshot = await sv3.market.getQuoteState(market);
snapshot.spotPriceWad;
snapshot.floorPriceWad;
snapshot.curveSupply;
snapshot.engine;
snapshot.balances.liquidReserveRaw;
snapshot.paused;
snapshot.pin.blockNumber;
The client fetches the block first, then multicalls snapshot, isSolvent, identity, tokens, fees, and revision at that blockNumber. Results are cached by (chainId, market, blockHash).
For wallet balances in the same pin, use getTradeContext. For a position as well, use getAccountContext.
Return Value
Promise<MarketSnapshot>
| Field | Meaning |
|---|---|
spotPriceWad / floorPriceWad | Current spot and floor, 18-decimal USDC per AVM |
curveSupply / actualSupply / supplyOffset | Curve vs token supply |
engine | Decoded linear-curve coefficients |
balances.liquidReserveRaw | USDC in the market (6 decimals) |
paused / globalPaused | Market and directory pause |
feePolicy | Creator share used by splitFee |
tokens | AVM and reserve addresses |
math | Revision that local math must match |
pin | { blockNumber, blockHash, blockTimestamp } |
The object is frozen. Do not mutate it between quotes.
Parameters
market
- Type:
Address
The FloorMarket proxy.
const snapshot = await sv3.market.getQuoteState(
"0x…", // FloorMarket
);
Error
| Error | When |
|---|---|
UnsupportedCurveRevisionError | On-chain revision is not in SUPPORTED_MATH |
| Transport errors | RPC / multicall failure |
Tips
- Pin once per UI tick. Then call
quoteBuyExactReserveIn(snapshot, amount)with no extra RPC. sv3.quote.buyExactReserveIn({ market, amount })will load this snapshot for you if you pass an address instead of a snapshot.