Skip to main content

Checking Balances

On-chain reads​

These need no privateKey. On testnet (Ethereum Sepolia):

const staked = await client.staking.balance(address); // staked $7N7D (ProfitDistributor v2)
const rewards = await client.staking.earned(address); // unclaimed USDC
const tokens = await client.token.balance(address); // wallet $7N7D (hub token)
const power = await client.governance.votingPower(address); // current staked $7N7D

Vault reads​

There is no vault on testnet today (V1 retired 2026-11-25, Vault V2 not deployed yet), so these throw ConfigError on the default preset. They work against a configured vault, for example the retired V1 vault for read-only history:

import { SevenNSevenD, NETWORKS } from '@7n7d/sdk';

const legacy = NETWORKS.testnet.legacy.arbitrumSepolia;
const vaultClient = new SevenNSevenD({
apiKey: process.env.SEVEN_N_SEVEN_D_API_KEY!,
chain: { id: legacy.chainId, rpcUrl: legacy.rpcUrl, explorerUrl: legacy.explorerUrl },
contracts: { tradingVault: legacy.tradingVaultV1, usdc: legacy.mockUsdc },
});

const shares = await vaultClient.vault.balance(address); // v7N7D shares (6 decimals, string)
const price = await vaultClient.vault.sharePrice(); // USDC per share (6 decimals, string)
const nav = await vaultClient.vault.currentNav(); // agent-written NAV in USDC (string)
const tvl = await vaultClient.vault.totalAssets(); // NAV, or the vault's USDC before the first NAV write
const idle = await vaultClient.vault.getIdleLiquidity(); // USDC held by the vault (pays withdrawals)
const pending = await vaultClient.vault.getWithdrawalRequest(address);

Position value​

const value = Number(shares) * Number(price);
  • What it includes. Shares locked in a pending withdrawal sit in the vault, so vault.balance(address) no longer counts them. Add pending.shares if you want the full position.
  • No earnings helper. The SDK has no earnings or APY helper. Earnings = position value − your net deposits, which you can read from the vault's Deposit and WithdrawalProcessed events.
  • No yield promise. The share price can go down.

API reads​

const status = await client.api.status(); // vault + agent status, trading network
const positions = await client.api.positions(); // agent's open positions
const snapshot = await client.api.accountSnapshot(); // agent's trading-account snapshot
const balance = await client.api.balance(address); // network + contract addresses for an address

api.positions and api.accountSnapshot describe the agent's Hyperliquid account, not your vault position. On testnet, that account is faucet-funded and separate from the vault. See How Testnet Works.


Next: Delegation or the API Reference.