getVirtualAccount
Read one Virtual Account’s (VA) detail struct: its market, parent and isolation type. The mapping is fixed when the VA is created, so the result is safe to cache indefinitely.
import { getVirtualAccount } from "@symmio/trading-core";
const detail = await getVirtualAccount(config, { account: vaAddress });Parameters
accountAddressrequiredThe VA address.
chainIdnumberoptionalOptional chain override.
Returns
VirtualAccountDetailaccountAddressAddressThe VA’s own address — the on-chain partyA of the positions it holds.
parentAccountAddressThe subaccount that created the VA.
symbolIdbigintMarket the VA trades.
isExistsbooleantrue once the VA exists on-chain.
metadataHexOpaque per-VA metadata blob, or 0x.
isolationTypeVirtualAccountIsolationTypeVIRTUAL_ACCOUNT_ISOLATION_TYPE: 0 POSITION, 1 MARKET, 2 MARKET_LONG, 3 MARKET_SHORT. MARKET_LONG and
MARKET_SHORT pin the side. Note that 2 means MARKET_DIRECTION on a subaccount’s SubAccountIsolationType.
Query options
import { getVirtualAccountQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getVirtualAccountQueryOptions(config, { account: vaAddress }));Raw ABI
For consumers that want to call viem directly:
import { accountLayerAbi } from "@symmio/trading-core";
await publicClient.readContract({
abi: accountLayerAbi,
address: accountLayerAddress,
functionName: "getVirtualAccount",
args: [vaAddress],
});Last updated on