docs(hyperliquid): add nktkas TypeScript SDK tutorial#468
Conversation
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).
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughA new documentation page ( ChangesHyperliquid TypeScript SDK Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
docs.jsondocs/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/)) |
There was a problem hiding this comment.
📐 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
| const wallet = privateKeyToAccount("0x..."); // your private key | ||
| ``` | ||
|
|
||
| ```typescript ethers | ||
| import { Wallet } from "ethers"; | ||
|
|
||
| const wallet = new Wallet("0x..."); // your private key | ||
| ``` |
There was a problem hiding this comment.
📐 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
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/hyperliquidis the community-favorite TS SDK, so it warrants a proper deep-dive.What it covers
InfoClient/ExchangeClient/SubscriptionClient) over the two transports (HttpTransport/WebSocketTransport)allMids,meta,l2Book,clearinghouseStateprivateKeyToAccount(+ ethersWallet); nktkas auto-selects L1 vs user-signed; agent-wallet tip → links the signing/debugging guidesorder,cancel,updateLeverage(asset-index + precision notes → links order-precision)SubscriptionClientoverWebSocketTransport(allMids,l2Book,orderUpdates)apiUrlroutes both/infoand/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.Accuracy
PrivateKeySigneris gone, so this uses viem/ethers accounts throughout).InfoClientexample was run live (allMids/meta/l2Book/clearinghouseStateall return real data).mint broken-linkspasses; nav wired once; no MDX$hazards.Follows the Hyperliquid docs sync in #462/#463/#465/#467.