SV3 logo

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>

FieldMeaning
spotPriceWad / floorPriceWadCurrent spot and floor, 18-decimal USDC per AVM
curveSupply / actualSupply / supplyOffsetCurve vs token supply
engineDecoded linear-curve coefficients
balances.liquidReserveRawUSDC in the market (6 decimals)
paused / globalPausedMarket and directory pause
feePolicyCreator share used by splitFee
tokensAVM and reserve addresses
mathRevision 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

ErrorWhen
UnsupportedCurveRevisionErrorOn-chain revision is not in SUPPORTED_MATH
Transport errorsRPC / 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.