Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
CoreAccountLayergetVirtualAccountsOfSubAccount

getVirtualAccountsOfSubAccount

List a subaccount’s Virtual Accounts (VAs) with their details, in one call. Reading the addresses first and then each VA would take one call per VA. Each row carries the VA’s market and isolation type, so a UI can group a subaccount’s isolated positions by market and side without another read.

import { getVirtualAccountsOfSubAccount } from "@symmio/trading-core"; const vas = await getVirtualAccountsOfSubAccount(config, { subAccount });

The AccountLayer clamps instead of reverting: an offset past the end returns an empty array, and limit is clamped to what remains. One call with the default limit therefore returns every VA of a subaccount that has at most 200; page past that with getVirtualAccountsCountOfSubAccount.

Parameters

subAccountAddressrequired

The subaccount whose VAs to list.

offsetbigintdefault 0n

Pagination offset.

limitbigintdefault 200n

Maximum number of entries to return; clamped on-chain to the number remaining.

chainIdnumberoptional

Optional chain override.

Returns

readonly VirtualAccountDetail[]
accountAddressAddress

The VA’s own address — the on-chain partyA of the positions it holds.

parentAccountAddress

The subaccount that created the VA.

symbolIdbigint

Market the VA trades.

isExistsboolean

true once the VA exists on-chain.

metadataHex

Opaque per-VA metadata blob, or 0x.

isolationTypeVirtualAccountIsolationType

VIRTUAL_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 { getVirtualAccountsOfSubAccountQueryOptions } from "@symmio/trading-core"; import { useQuery } from "@tanstack/react-query"; useQuery(getVirtualAccountsOfSubAccountQueryOptions(config, { subAccount }));

Raw ABI

For consumers that want to call viem directly:

import { accountLayerAbi } from "@symmio/trading-core"; await publicClient.readContract({ abi: accountLayerAbi, address: accountLayerAddress, functionName: "getVirtualAccountsOfSubAccount", args: [subAccount, 0n, 200n], });
Last updated on