Agent wallets and vaults

Hyperliquid supports delegated trading through agent walletsarrow-up-right, and isolated capital through vaults and sub-accountsarrow-up-right.

Agent wallets

An agent wallet signs trades on behalf of your master account. Approve it once, then use the agent's private key for all subsequent requests:

import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
import { privateKeyToAccount } from "viem/accounts";

const client = new ExchangeClient({
  transport: new HttpTransport(),
  wallet: privateKeyToAccount("0x..."), // agent's private key
});

// All trades are executed as the master account
await client.order({
  orders: [{
    a: 0,
    b: true,
    p: "50000",
    s: "0.01",
    r: false,
    t: { limit: { tif: "Gtc" } },
  }],
  grouping: "na",
});

Create an agent

Approve an agent via approveAgent or through the Hyperliquid UIarrow-up-right:

Agents expire after 90 days by default. To set a custom expiration (up to 180 days), append valid_until <timestamp> to the name:

Vaults

A vault is an isolated trading account that other users can deposit into. Trade on behalf of a vault by setting vaultAddress:

Manage vaults

Sub-accounts

Sub-accounts work like vaults but belong to a single user. They share the same vaultAddress mechanism for trading:

Last updated