getSubAccountVirtualNonce
Read a subaccount’s Virtual Account (VA) nonce: the counter the AccountLayer derives each new VA’s address from. The next VA uses nonce + 1. Most apps want usePredictedNextVirtualAccount, which does that derivation for you.
import { getSubAccountVirtualNonce } from "@symmio/trading-core";
const nonce = await getSubAccountVirtualNonce(config, { subAccount });Parameters
subAccountAddressrequiredThe subaccount.
chainIdnumberoptionalOptional chain override.
Returns
bigintThe current VA nonce.
Query options
import { getSubAccountVirtualNonceQueryOptions } from "@symmio/trading-core";
import { useQuery } from "@tanstack/react-query";
useQuery(getSubAccountVirtualNonceQueryOptions(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: "getSubAccountVirtualNonce",
args: [subAccount],
});Last updated on