npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gdexsdk/hyper-liquid-trader

v1.1.0

Published

HyperLiquid Trader SDK

Readme

🤖 Gbot — Hyperliquid Trader SDK

Gbot Hyperliquid Trader SDK is a custom, professionally typed wrapper around the core @nktkas/hyperliquid library designed to natively handle multi-asset copy trading, HIP-3 strictly isolated assets, and zero-latency WebSocket stream normalization.

Table of Contents

Highlights

  • Native HIP-3 Isolated Margin — Fully certified to calculate offsets and execute dynamic leverage boundaries specifically for strictly isolated assets (e.g., xyz:GOLD, PURR).
  • Strictly Typed Payloads — Replaces legacy any callbacks with rigid, mapped WsTradePayload and WsTradeElement schemas extending safety into asynchronous workers.
  • WebSocket Load Balancing — Multiple instances of WebSocketTransport dynamically cycle subscriptions via round-robin index mapping preventing connection saturation across hundreds of token streams.
  • Unified Trader Execution — Abstracts ExchangeClient behaviors to intelligently select between Spot, Cross Perpetual, or Forced-Isolated execution routes based purely on configuration parameters.
  • Zero Floating Promises — Pre-committed ESLint/TypeScript configurations guarantee that all events and connection handling gracefully resolve without hidden memory leaks.

Installation

# Using Yarn
yarn add @gdexsdk/hyper-liquid-trader

# Using npm
npm install @gdexsdk/hyper-liquid-trader

Core Features & Execution Routes

The HyperLiquidTrading class orchestrates interaction via three strictly defined routes ensuring clear intent over hidden state configuration:

  • executeCrossPerp: Directly targets traditional cross-margin trading positions across standard Layer 1 assets like BTC and ETH.
  • executeIsolatedPerp: Enforces isolated margin mode dynamically. Automatically forces a leverage synchronization packet to the L1 API before generating the matching isolated execution parameter blocks.
  • executeSpot: Standard execution wrapper for Spot assets bypassing all TPSL trigger complications entirely.

Quick Start

import { HyperLiquidTrading } from '@gdexsdk/hyper-liquid-trader';

// 1. Initialize the SDK
const hlt = new HyperLiquidTrading();

// 2. Configure Trading Assets
hlt.setAssets([
  { szDecimals: 5, name: 'BTC', maxLeverage: 40, assetId: 4 },
  { szDecimals: 4, name: 'xyz:GOLD', maxLeverage: 25, assetId: 110003, onlyIsolated: true },
]);

// 3. Track specific Whales/Traders
hlt.setTargetWallets(['0xTargetTraderAddress']);

// 4. Start Event Stream
await hlt.startCopyTrade((trade) => {
  console.log('Incoming Trade Detected:', trade);
});

HIP-3 Isolated Margin Compliance

The Hyperliquid Layer 1 strictly forbids trading specific sub-deployer assets (like xyz:GOLD) from the global cross-margin account structure. Waitlist / HIP-3 components must be traded in pure isolation.

If you attempt to mistakenly route a HIP-3 token through the default processor, the SDK enforces a security block:

Error: [executeCrossPerp] HIP-3 Margin Error: xyz:GOLD is a strict isolated asset. You must use executeIsolatedPerp() with explicit leverage.

To route successfully, you must pass the target leverage integer locally:

await hlt.executeIsolatedPerp(pk, {
  coin: 'xyz:GOLD',
  isLong: true,
  price: '1900.5',
  positionSize: '0.005',
  leverage: 5 // Required explicitly
});

Development & Linting

This SDK forces stringent code quality standards out-of-the-box. The tsconfig.json runs locally with "noUnusedParameters": true & "noUnusedLocals": true.

To verify standards locally:

# Runs the strict Prettier auto-formatter
yarn format

# Performs ESLint code analysis and standardizations
yarn lint

# Runs the TypeScript compiler ignoring emits 
yarn typecheck