Tree-shaking

The SDK is organized into modular entry points so bundlers can eliminate unused code.

Entry points

The following table lists the available entry points:

Entry point
Contains

@nktkas/hyperliquid

Transports, clients, error classes

@nktkas/hyperliquid/signing

Signing functions, wallet utilities

@nktkas/hyperliquid/utils

formatPrice, formatSize, SymbolConverter

@nktkas/hyperliquid/api/info

Info methods, individually importable

@nktkas/hyperliquid/api/exchange

Exchange methods, individually importable

@nktkas/hyperliquid/api/subscription

Subscription methods, individually importable

Each entry point has independent dependencies. Importing @nktkas/hyperliquid/utils doesn't pull in signing or validation code.

Direct method imports

Instead of creating a client (which bundles all methods), import individual methods directly. Each method accepts the same config as its client as the first argument.

Info methods use InfoClient config:

import { HttpTransport } from "@nktkas/hyperliquid";
import { allMids } from "@nktkas/hyperliquid/api/info";

const transport = new HttpTransport();
const result = await allMids({ transport });

This bundles only the allMids method, its validation schema, and the transport logic — not the full InfoClient with all methods.

Exchange methods use ExchangeClient config:

Subscription methods use SubscriptionClient config:

Last updated