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
height — number, optional. Block height. Default 0 (latest).
Returns
PerpsVaultState — { shareSupply, equity, depositWithdrawalActive, margin, positions, reservedMargin, openOrderCount }.
Notes
- This action runs two on-chain queries internally:
getPerpsStateforshareSupplyandgetPerpsUserStateExtended(withincludeEquity: true) for the vault contract's own positions.