This is the field-by-field type reference for
@inflexion/sdk. For the conceptual treatment of why reads never throw and writes never crash at construction, read Degradation envelopes first — this page is the dense lookup behind it. Two contracts run through every type: a read returns a typed degraded envelope you must narrow before touching the payload; a write either throws a clear error on call (LP/MM) or returns a WriteResult carrying the unsigned tx (Depositor). Every shape below is one of those two stories.export * from './types.js', the quote helpers from ./quote.js, and the math port namespaced as cvamm. Import directly:
1. The five envelope types
Everything fallible the SDK returns is one of exactly five shapes. Three are read envelopes (Degraded<T>, Priceable<T>, ApiPending), one is a read precision flag (NonceStatus), and one is the write-result union (WriteResult).
1.1 Degraded<T>
available.
boolean
required
Discriminant.
true ⇒ the payload T is present and safe to read; false ⇒ only reason is present.string
Present only on the
available: false branch. In practice drawn from DegradeReason — typically 'no-rpc' or 'vol-uninitialized'.depositor.getVaultState, getPosition, getRegime, and data.getSurfaceSigmaRef.
1.2 Priceable<T> / NotPriceable
Degraded<T> because the dominant failure is the live price being unavailable. Every read that derives catches an OracleManager.getPrice revert (stale feed, sequencer down) and returns NotPriceable { reason: 'oracle-degraded' } rather than throwing.
boolean
required
Discriminant.
true ⇒ payload T present; false ⇒ a NotPriceable.DegradeReason
On the failure branch. The closed
DegradeReason union — for Priceable typically 'oracle-degraded', 'market-unknown', or 'position-unknown'.string
Optional human-readable elaboration on the failure (e.g. the underlying revert string).
lp.resolveGeometry, previewPremium, getPayoffCurve, the nested ilToDate inside getProtectionStatus, and hedge.greeks / suggestHedgeChecked.
1.3 ApiPending
SUBGRAPH_URL is unset. Rather than fabricate a number, it returns the route and the exact query that would be sent — so the UI renders “coming from <route>” and the API is wired in with zero re-derivation. The subgraph is now deployed and indexing, so these history surfaces are served live through the hosted API; the envelope remains the typed degraded fallback when a backing is missing.
false
required
Always
false. Returned when a surface’s backing source is absent (e.g. SUBGRAPH_URL unset).'no-history-source'
required
Fixed literal — the
DegradeReason for the no-history-source case.string
required
The API route this call hits (e.g.
'/data/load-surface'). Render it as the source.unknown
required
The exact query object that would be sent — the caller’s args, normalised. The API can be wired with no re-derivation.
string
Optional note (e.g. “off-chain telemetry by design” for
getDemandRequests).Structures ship from day one; the full DYNAMICS (pool-vs-MM spread as a forward-vol signal) mature with multiple competing MMs and volume. The dataset begins at the single redeploy; the off-chain telemetry halves begin at the first interaction logged.What Inflexion offers today is the architecture and the first public view into the microstructure of the DeFi LP volatility-risk premium — not yet a mature dataset:
- Structures are present day-one. All five non-circular behavioral signals are defined and queryable from launch.
- Dynamics mature with volume. The richer signal — the pool-vs-MM spread read as a forward-vol indicator — only sharpens once multiple market makers compete and real flow accumulates.
- The dataset begins at the single redeploy, and the off-chain telemetry halves begin at the first interaction logged. History is served live from the subgraph via the API; if a backing (subgraph URL / RPC / telemetry) is absent, surfaces degrade to a typed
pendingstate — never an error.
1.4 NonceStatus
boolean
required
Whether the nonce bit is set on-chain via
Core.isNonceUsed(mm, nonce).'coarse' | 'precise'
required
'coarse' from the on-chain bitmap alone: the bit is set on both a fill and a cancel, and SwapCreated/SwapRouted carry no quoteId/nonce, so filled cannot be distinguished from cancelled on-chain alone. 'precise' from the now-deployed subgraph, which indexes the now-live QuoteFilled event.string
required
Human-readable elaboration (e.g.
'nonce bit set (fill OR cancel)').1.5 WriteResult
makeWalletClient returns undefined rather than crashing.
{ to: Hex; data: Hex; value: bigint }
required
The transaction calldata. On
'deferred-no-wallet' this is the unsigned tx for an external signer; on 'sent'/'error' it is the calldata that was submitted.Hex
Present only when
status === 'sent' — the broadcast transaction hash.'sent' | 'deferred-no-wallet' | 'error'
required
'sent' — broadcast (txHash present). 'deferred-no-wallet' — no signer; calldata returned in tx for external signing. 'error' — an on-chain revert surfaced as a value, not a throw (e.g. the JuniorBelowLocked gate on withdraw).string
On
'error', the revert reason / underlying message.Per-surface write semantics differ by intent. Only DepositorClient returns
WriteResult. LP/MM writes (lp.buyProtection, lp.settle, lp.poke, mm.cancelNonces) throw a clear error on the call when there is no wallet — there is no sensible “deferred” semantics for “buy this protection now”. See guardrails.2. StagedWrite — multi-step deferred writes
depositor.rebalance(from, to, shares) returns a StagedWrite: step 1 (requestWithdrawal) is sent, while steps 2 (withdraw) and 3 (deposit) are returned unsent across the on-chain cooldown — the caller resubmits them once withdrawalCooldown elapses. The pattern keeps a cooldown-gated, multi-tx flow honest without the SDK holding state across the wait.
3. DegradeReason — the closed union
Every reason on a Priceable / Degraded / ApiPending failure is drawn from one closed union, so the UI can exhaustively switch on it:
4. Core domain types
The success-branch payloads carried inside the envelopes above. All dUSDC figures are 6-decimal raw bigints (1 dUSDC = 1_000_000n); all WAD ratios are 1e18; sqrtPriceX96 is Uniswap Q64.96. See decimals & units.
4.1 LpGeometry
The frozen geometry of a position-for-market — the unit the protocol prices. Returned inside Priceable<{ geometry: LpGeometry }> from lp.resolveGeometry.
bigint
Uniswap v3 position NFT id.
Hex
Position token0 address (from
NPM.positions).Hex
Position token1 address.
number
Pool fee tier (e.g.
500).number
Lower tick of the range.
number
Upper tick of the range.
bigint
Position liquidity — read at creation and frozen on-chain (invariant I6: settlement never re-reads the NFT).
bigint
Lower-bound sqrt price (Q64.96), from
tickLower.bigint
Upper-bound sqrt price (Q64.96), from
tickUpper.bigint
Entry sqrt price (Q64.96), the oracle-derived .
bigint
in WAD — the lower normalised price ratio.
bigint
in WAD — the upper normalised price ratio.
bigint
token0 amount implied at entry by and (
ILMath.getAmountsForLiquidity).bigint
token1 amount at entry.
bigint
MaxIL — the load-bearing payout cap and the unit of risk, pure geometry, dUSDC 6-dec (
ILMath.computeMaxIL). See MaxIL.boolean
sqrtP0 >= sqrtPa && sqrtP0 <= sqrtPb — the createSwap in-range gate. Out-of-range entries are rejected at creation. and are the whole of the geometry the Φ-sum fair value needs. Because MaxIL is L-independent in the fair-rate sense, two positions sharing are fungible to an underwriter — which is why an MM quote is per-market, never per-NFT.
4.2 EligiblePosition
A row from lp.listEligiblePositions — one (position × duration) pair. Carries the LpGeometry (or the price-degraded state) plus the resolved marketId and a convenience inRange?: boolean that is undefined when the oracle is degraded.
4.3 PreviewResult
The priced quote returned inside Priceable<PreviewResult> from lp.previewPremium. All premiums are dUSDC 6-dec, capped at MaxIL.
Hex
The resolved market.
bigint
The cap — every premium is
min(·, maxIL).The on-chain Φ-sum fair premium from
FairValueOracle.fairPremium — never reimplemented off-chain.bigint
The fair rate (WAD) — fair premium per unit MaxIL.
bigint
The reference volatility σ_ref (WAD) the price was struck against.
Path-A pool premium:
cvamm.premiumFromLoad(fairPremium, totalLoad) capped at MaxIL — exactly _pricePathAFromFair on-chain.Path-B MM premium:
cvamm.pathBPremium(fairPremium, loadBps, maxIL). Present only when a live signed MM quote beat the pool; absent if the engine is unreachable.bigint
required
The cheaper of
premiumA / premiumB — what the LP actually pays.'A' | 'B'
required
Which rail produced
best. Path B only when an MM quote won.4.4 ProtectionStatus
Returned by lp.getProtectionStatus as ProtectionStatus | { available: false; reason }.
number
required
On-chain swap status:
0 UNINITIALIZED, 1 ACTIVE, 2 SETTLED.boolean
required
mm == convexityVault — the swap was underwritten by the pool, not an MM.Priceable<{ il; payout; capHit }>
required
Mark-to-market IL — itself a
Priceable, so it can be not priceable while the swap is known. payout = min(il, maxIL); capHit = payout < il.4.5 PayoffCurve
Returned inside Priceable<PayoffCurve> from lp.getPayoffCurve — ILMath.computeIL evaluated over a sqrt-price grid with the cap applied. Each point carries the price and the capped payout min(IL(P_T), MaxIL).
4.6 ClaimableFees
Returned by lp.getClaimableFees as ClaimableFees | { available: false }. Reads checkpointed tokensOwed0/1 from NPM.positions.
5. Depositor domain types
5.1 VaultState
Returned inside Degraded<VaultState> from depositor.getVaultState. Every success branch carries capitalNotGuaranteed: true.
bigint
Total pool assets, dUSDC 6-dec.
bigint
Senior-tranche assets.
bigint
Junior-tranche assets (first-loss buffer).
bigint
Collateral locked against active swaps. Invariant I5:
locked ≤ deposited; junior-first waterfall keeps totalLocked ≤ juniorAssets.bigint
Idle, instantly-liquid collateral.
bigint
Utilisation (WAD).
bigint
Concentration (HHI dispersion) of locked collateral (WAD).
bigint
Utilisation-skew load component (WAD).
bigint
Dispersion-skew load component (WAD).
bigint
Record<Hex, bigint>
Colour map keyed by caller-supplied marketIds. Free collateral is pool-wide fungible, so this is HHI/concentration colour, not a per-market budget.
bigint
σ_ref EWMA (WAD).
Regime
The current volatility regime band.
bigint
Instantaneous yield (WAD). Subgraph-only ⇒ omitted from the on-chain read; served by the now-deployed subgraph via the API.
5.2 DepositorPosition
Returned inside Degraded<DepositorPosition> from depositor.getPosition(owner). Carries seniorShares / juniorShares and their convertToAssets valuations (seniorAssets / juniorAssets), plus capitalNotGuaranteed: true.
5.3 LoadParams
The cached on-chain load-curve parameters, read from Core.loadParams by every surface. Carries the regime bands, the base-load-by-regime table, the utilisation-knee + convex-exponent curve, the dispersion cap, and maxLoadBps — the I10 ceiling every quote’s loadBps must respect. These are read on-chain, never hardcoded; the off-chain cvamm port consumes them to reproduce the load stack byte-equal.
5.4 Tranche / TRANCHE_ENUM
5.5 Regime
The volatility-regime enum derived from σ_ref against the LoadParams bands (cvamm.regimeOf). Selects the base-load band in the load stack.
6. MM domain types
6.1 MarketConfig
Returned by mm.getMarketConfig(marketId) as MarketConfig | undefined (undefined when token0 == address(0)). The immutable, post-freeze market parameters: token0, token1, fee, durationSeconds, oracle token. Cached because configs are immutable after freeze.
6.2 PricingGeometry (input) and MmMarketPricing (result)
PricingGeometry is the geometry input to mm.getMarketPricing:
bigint
required
Lower price ratio (WAD).
bigint
required
Upper price ratio (WAD).
bigint
required
Hedge tenor.
bigint
required
The cap / unit of risk, dUSDC 6-dec.
Hex
Optional override for the σ_ref token.
MmMarketPricing is the result: fairPremium, fairRateWad, sigmaRefWad, poolPremium (= capped at MaxIL — the floor an MM must undercut), maxIL, load: LoadBreakdown, totalLoadBps, the per-component baseLoadWad / utilSkewWad / dispSkewWad, util, conc, and regime.
6.3 PoolLoadTick / LoadBreakdown
PoolLoadTick is the geometry-free “load to beat” from mm.getPoolLoadToBeat / streamPoolLoadToBeat: the pure pool floor an MM must undercut — totalLoadBps plus the baseLoad / util / disp decomposition — needing no position geometry, because the load percentage is geometry-independent. LoadBreakdown is that per-component decomposition. See why a quote is per-market.
6.4 Greeks
The finite-difference greeks from mm.greeksForSwap, hedge.greeks, and getBook({ withGreeks: true }). δ/γ finite-difference the deployed ILMath.computeIL of the capped payoff (reported per unit price-ratio , decimals-independent); vega/θ finite-difference the on-chain FairValueOracle.fairRate(a, b, σ, T) (vega per 1.0 vol, theta per year) — never a reimplemented Φ-sum. See greeks & hedging.
6.5 SigmaComponents
Returned by mm.getSigmaComponents(token) as SigmaComponents | undefined — the EWMA decomposition behind σ_ref from VolOracle.sigmaComponents.
6.6 Other MM result shapes
BookResult—mm.getBook(mm, opts?): the MM’s swap book from an on-chainnextSwapId/swapsscan, optionally with greeks.SignQuoteResult—mm.signQuote(...):{ envelope, belowPoolChecked, poolLoadBps?, i10Ok: true }.MmQuoteError— thrown bysignQuote;code ∈ { 'i10-exceeded', 'not-below-pool', 'pool-load-unreadable', 'no-signer', 'bad-nonce' }.StreamHandle— the{ stop() }returned by every polling stream (watchFills,quoteStream,streamPoolLoadToBeat).
7. The SignedQuote type — the EIP-712 shape
Re-exported via @inflexion/sdk and @inflexion/sdk/quote. The field order, types, and domain MUST match InflexionCore.SIGNED_QUOTE_TYPEHASH exactly or createSwap / createSwapRouted rejects the signature. See quote signing.
Hex (address)
required
The market maker EOA / contract that signed and posts collateral.
Hex (bytes32)
required
The market the quote prices. Per-market, never per-NFT — the quote carries no
tokenId.number (uint16)
required
The MM’s load over the on-chain fair premium. Must satisfy
≤ loadParams.maxLoadBps (I10) and (to win) be below the live pool load.number (uint16)
required
Lower bound of the MaxIL-ratio band the MM will fill.
number (uint16)
required
Upper bound of the MaxIL-ratio band.
bigint (uint128)
required
The oracle price the MM signed against — the Fork-2 band anchor.
createSwap reverts iff live deviates beyond priceBandBps (I9).number (uint16)
required
The allowed deviation of live price from
quotePrice at fill.number (uint8)
required
CollateralModel: FULL = 0, PARTIAL = 1. FULL is the only supported mode in v1.number (uint16)
required
PARTIAL-mode collateral ratio (unused while v1 is FULL-only).
bigint (uint128)
required
Capacity in numéraire (dUSDC 6-dec). On-chain
consumedNotional[quoteId] ≤ maxNotionalV0 (I7).bigint (uint64)
required
Absolute expiry timestamp; on-chain bound to
now + [5,15]s.Hex (bytes32)
required
The capacity-tracking id
consumedNotional is keyed by.bigint (uint256)
required
Bitmap nonce
(word << 8) | bit, bit ∈ [0, 255]. Build with encodeNonce(word, bit).Supporting quote types & helpers
8. Worked example — narrowing every envelope
Where to go next
Degradation envelopes
The conceptual treatment — why reads never throw and writes fail clearly.
Guardrails
The write-safety model —
build* calldata, deferred results, never-merge claims.LP reference
Every LpClient method that produces
LpGeometry, PreviewResult, ProtectionStatus.Data reference
The live data surfaces and the five behavioral signals, with the
ApiPending fallback.Quote helpers
signQuote, quoteDigest, verifyQuote, and the SignedQuote ⇄ QuoteWire codec.Decimals & units
Why every premium/collateral figure is a 6-dec raw bigint and ratios are WAD.