Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

getPerpsVaultState

Read vault state — share supply, equity, and the vault's own perps positions.

The vault is itself a User in the perps contract: it carries positions accumulated from market-making fills and computes equity by the same formula as any other user. depositWithdrawalActive flips to false when the vault's effectiveEquity is non-positive (catastrophic loss). See protocol book: perps/5-vault §4.

Signature

function getPerpsVaultState(
  client: Client,
  parameters?: { height?: number },
): Promise<PerpsVaultState>

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const state = await client.getPerpsVaultState()

Parameters

heightnumber, optional. Block height. Default 0 (latest).

Returns

PerpsVaultState{ shareSupply, equity, depositWithdrawalActive, margin, positions, reservedMargin, openOrderCount }.

Notes

  • This action runs two on-chain queries internally: getPerpsState for shareSupply and getPerpsUserStateExtended (with includeEquity: true) for the vault contract's own positions.

See also