Skip to content

docs(hyperliquid): add nktkas TypeScript SDK tutorial#468

Merged
akegaviar merged 1 commit into
mainfrom
docs/hl-nktkas-tutorial
Jun 24, 2026
Merged

docs(hyperliquid): add nktkas TypeScript SDK tutorial#468
akegaviar merged 1 commit into
mainfrom
docs/hl-nktkas-tutorial

Conversation

@akegaviar

Copy link
Copy Markdown
Member

Adds a dedicated "Building on Hyperliquid with the nktkas TypeScript SDK" guide to the Mastering Hyperliquid collection, which was Python-heavy (the only TS content was the brief tooling overview). @nktkas/hyperliquid is the community-favorite TS SDK, so it warrants a proper deep-dive.

What it covers

  • Mental model — the three clients (InfoClient / ExchangeClient / SubscriptionClient) over the two transports (HttpTransport / WebSocketTransport)
  • Reading market dataallMids, meta, l2Book, clearinghouseState
  • Wallets & signing — viem privateKeyToAccount (+ ethers Wallet); nktkas auto-selects L1 vs user-signed; agent-wallet tip → links the signing/debugging guides
  • Tradingorder, cancel, updateLeverage (asset-index + precision notes → links order-precision)
  • Real-timeSubscriptionClient over WebSocketTransport (allMids, l2Book, orderUpdates)
  • Using your Chainstack node — the key section: apiUrl routes both /info and /exchange, but nodes don't serve /exchange, so trading stays public; some reads are public-only; HyperEVM (eth_*) is where your node shines. Tied directly to the methods table we just updated.
  • Error handling + Summary + Related resources

Accuracy

  • Every snippet uses the current nktkas API (verified against the SDK source this session — note PrivateKeySigner is gone, so this uses viem/ethers accounts throughout).
  • The InfoClient example was run live (allMids/meta/l2Book/clearinghouseState all return real data).
  • mint broken-links passes; nav wired once; no MDX $ hazards.

Follows the Hyperliquid docs sync in #462/#463/#465/#467.

Add a dedicated "Building on Hyperliquid with the nktkas TypeScript SDK"
guide to the Mastering Hyperliquid collection (which was Python-heavy).
Covers the three clients (Info/Exchange/Subscription) over the two
transports, viem/ethers wallets and signing, placing/managing trades,
real-time subscriptions, and — the key section — what runs on a Chainstack
node vs the public API (trading and public-only reads stay public; HyperEVM
+ the served HyperCore reads use your node), tied to the methods table.

All snippets use the current nktkas API; the InfoClient example was run
live (allMids/meta/l2Book/clearinghouseState).
@infra-bot-atlantis

Copy link
Copy Markdown
Error: This repo is not allowlisted for Atlantis.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a new documentation page covering the Hyperliquid TypeScript SDK, including examples for market data, trading actions, leverage updates, and real-time subscriptions.
    • Expanded the “Mastering Hyperliquid” navigation to include the new guide.

Walkthrough

A new documentation page (docs/hyperliquid-typescript-sdk-nktkas.mdx) is added covering the nktkas Hyperliquid TypeScript SDK with a three-client/two-transport model, end-to-end TypeScript examples, Chainstack node routing, and error-handling patterns. The page is registered in the docs.json navigation under "Mastering Hyperliquid".

Changes

Hyperliquid TypeScript SDK Documentation

Layer / File(s) Summary
Navigation registration and page prerequisites
docs.json, docs/hyperliquid-typescript-sdk-nktkas.mdx
Adds the page path to the "Mastering Hyperliquid" pages array in docs.json and opens the MDX file with title, description, and prerequisite checklist (Node.js version, package installs, Chainstack endpoint).
SDK mental model: clients and transports
docs/hyperliquid-typescript-sdk-nktkas.mdx
Describes the three-client (InfoClient, ExchangeClient, SubscriptionClient) and two-transport (HttpTransport, WebSocketTransport) conceptual model and their composition.
Client usage examples and wallet setup
docs/hyperliquid-typescript-sdk-nktkas.mdx
Documents InfoClient market-data reads, wallet setup with viem and ethers for signed actions, and ExchangeClient operations for placing/canceling orders and updating leverage with precision notes.
Subscriptions, Chainstack routing, error handling, and conclusion
docs/hyperliquid-typescript-sdk-nktkas.mdx
Covers SubscriptionClient WebSocket streaming, apiUrl routing through a Chainstack node, HyperCore vs public-only method distinctions, try/catch error-handling patterns, and concluding resource links.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, the docs are here at last,
Three clients and two transports, built to last!
InfoClient reads, ExchangeClient trades,
SubscriptionClient streams through WebSocket shades.
With Chainstack routing and errors caught tight,
The SDK guide hops into the light! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a Hyperliquid nktkas TypeScript SDK tutorial.
Description check ✅ Passed The description is directly related to the new Hyperliquid TypeScript SDK guide and its covered topics.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/hl-nktkas-tutorial

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
chainstack 🔴 Failed Jun 24, 2026, 10:32 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/hyperliquid-typescript-sdk-nktkas.mdx`:
- Line 13: The console link text in the docs page needs to follow the standard
wording. Update the markdown link in the Hyperliquid SDK docs so the console URL
uses the required `[Chainstack account](https://console.chainstack.com/)` text,
and keep any chainstack.com links labeled as `[Chainstack]` to avoid mixing
console and marketing link labels.
- Around line 70-77: The example snippets in the docs still use placeholder
values like private key and endpoint strings, so update the code examples to use
realistic non-sensitive sample data that can be copied and run as published.
Adjust the affected example blocks around the wallet/account setup and any
related Hyperliquid client initialization so they reference concrete sample
values instead of "0x..." or "YOUR_CHAINSTACK_ENDPOINT", keeping the examples
consistent across the affected sections.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 577f1e99-d1e7-4872-a5b9-487f314afe83

📥 Commits

Reviewing files that changed from the base of the PR and between 2a463c0 and aae3b3d.

📒 Files selected for processing (2)
  • docs.json
  • docs/hyperliquid-typescript-sdk-nktkas.mdx


- Node.js 18 or higher (for the built-in `fetch` and `WebSocket`)
- `@nktkas/hyperliquid` and `viem` installed (`npm install @nktkas/hyperliquid viem`)
- [Reliable Hyperliquid RPC endpoint](https://chainstack.com/build-better-with-hyperliquid/) ([sign up for free](https://console.chainstack.com/))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required console link text format.

Please change the console link to [Chainstack account](https://console.chainstack.com/) per the docs linking standard.

As per coding guidelines, "Use [Chainstack account](link) to link to console.chainstack.com and [Chainstack](link) for chainstack.com; do not mix these".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/hyperliquid-typescript-sdk-nktkas.mdx` at line 13, The console link text
in the docs page needs to follow the standard wording. Update the markdown link
in the Hyperliquid SDK docs so the console URL uses the required `[Chainstack
account](https://console.chainstack.com/)` text, and keep any chainstack.com
links labeled as `[Chainstack]` to avoid mixing console and marketing link
labels.

Source: Coding guidelines

Comment on lines +70 to +77
const wallet = privateKeyToAccount("0x..."); // your private key
```

```typescript ethers
import { Wallet } from "ethers";

const wallet = new Wallet("0x..."); // your private key
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Replace placeholder values with realistic sample data in code examples.

"0x..." and "YOUR_CHAINSTACK_ENDPOINT" are placeholders. Use realistic, non-sensitive sample values so snippets are runnable as published examples.

As per coding guidelines, "Use realistic data in code examples, not placeholders" and "Include complete, runnable code examples when appropriate".

Also applies to: 143-143, 157-157, 162-162

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/hyperliquid-typescript-sdk-nktkas.mdx` around lines 70 - 77, The example
snippets in the docs still use placeholder values like private key and endpoint
strings, so update the code examples to use realistic non-sensitive sample data
that can be copied and run as published. Adjust the affected example blocks
around the wallet/account setup and any related Hyperliquid client
initialization so they reference concrete sample values instead of "0x..." or
"YOUR_CHAINSTACK_ENDPOINT", keeping the examples consistent across the affected
sections.

Source: Coding guidelines

@akegaviar
akegaviar merged commit 4dc805c into main Jun 24, 2026
2 of 3 checks passed
@akegaviar
akegaviar deleted the docs/hl-nktkas-tutorial branch June 24, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant