feat(perps): update latest hyperliquid sdk#28672
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Automated dev run — TAT-2906
Worker reportReport — TAT-2906: Update Hyperliquid SDKSummaryUpdated Changes
Test Plan
Evidence Artifacts
Ticket |
c703bba to
9727fc2
Compare
…nsport @nktkas/rews v2 (dependency of @nktkas/hyperliquid 0.32.2) uses `new CloseEvent(...)` which is not available in React Native/Hermes. This caused the WebSocket transport to crash on initialization, preventing perps from loading in E2E tests.
Revert all HyperLiquidClientService changes — the HTTP fallback, isInitialized, and disconnect changes were causing E2E test regressions by interfering with the E2E controller mixin. The CloseEvent polyfill in shim.js is the only change needed for the SDK upgrade; the WebSocket connects to the real API in CI so no fallback logic is required.
When rews v2 + CloseEvent polyfill properly terminates after failed reconnection attempts, ready() rejects and the catch block was destroying ALL clients. Now HTTP clients survive: exchangeClient and infoClientHttp stay alive, infoClient falls back to HTTP, and Connected state is reported to prevent controller polling fallback from overwriting E2E mock data.
…latest-hyperliquid-sdk
rews v2 also uses `new MessageEvent(...)` which doesn't exist in React Native/Hermes — every WebSocket message dispatch crashed, breaking all WS subscriptions and data flow. Revert HyperLiquidClientService changes — the polyfills (CloseEvent + MessageEvent) are the only fixes needed. With both polyfills, rews v2 works correctly in React Native and the WebSocket connects normally.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aa71f14. Configure here.
Bugbot correctly flagged that `||` drops falsy-but-valid values like `0`, `""`, `false` in CloseEvent/MessageEvent polyfills.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The Hyperliquid SDK is used in Tag selection rationale:
The shim polyfills are low-level but critical — if Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |




Description
Bumps
@nktkas/hyperliquidfrom0.30.2to0.32.2(latest).What changed in the SDK:
@nktkas/rews1.2.3 → 2.1.0 (WebSocket reconnection library)valibot1.2.0 → 1.3.1 (request validation)micro-eth-signerremoved (signing now fully delegated to wallet adapter)What this PR changes:
package.json/yarn.lock— version bumpshim.js— AddedCloseEventandMessageEventpolyfills for React Native/Hermes.@nktkas/rewsv2 usesnew CloseEvent(...)andnew MessageEvent(...)which are standard Web APIs but not available as constructors in Hermes. Without these polyfills, every WebSocket close/message event crashes the transport.No changes to
HyperLiquidClientService,HyperLiquidProvider, or any other app code.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2906
Manual testing steps
Reproduce via recipe:
Screenshots/Recordings
Before
No UI changes — dependency update only.
After
Full trade lifecycle validated (14/14 steps pass): navigate → testnet → open BTC long → TP/SL → close → verify.
sdk-upgrade-validation.mp4
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Updates the Hyperliquid perps dependency and its WebSocket stack, which can affect trading connectivity and runtime behavior. Adds global
CloseEvent/MessageEventconstructors to prevent Hermes crashes, but changes occur in app-wide shims.Overview
Upgrades
@nktkas/hyperliquidto0.32.2, pulling in@nktkas/rewsv2 and updated validation deps, and updating the lockfile accordingly.Adds React Native/Hermes polyfills in
shim.jsfor globalCloseEventandMessageEventto support the SDK’s updated WebSocket transport and avoid crashes when handling close/message events.Reviewed by Cursor Bugbot for commit e109022. Bugbot is set up for automated code reviews on this repo. Configure here.