Skip to content

Drop methods and parameters the API does not serve; fix freshness types - #20

Merged
0xFantomMenace merged 1 commit into
masterfrom
fix/spec-mismatches
Sep 29, 2026
Merged

0xFantomMenace merged 1 commit into
masterfrom
fix/spec-mismatches

Conversation

@0xFantomMenace

Copy link
Copy Markdown
Member

Follow-up to #19. Everything goes into the unreleased 1.12.0 section of the CHANGELOG.

Removed

These methods called routes the API does not serve (each returns 404), so they always failed:

Method Route
hyperliquid.hip4.l2Orderbook.get() / history() / diffs() /v1/hyperliquid/hip4/orderbook/{c}/l2[/history|/diffs]
hyperliquid.hip4.orders.triggerLevels() / triggerLevelsHistory() /v1/hyperliquid/hip4/orders/{c}/trigger-levels[/history]
spot.orders.flow() / tpsl() /v1/hyperliquid/spot/orders/{s}/flow, /tpsl
spot.orders.triggerLevels() / triggerLevelsHistory() /v1/hyperliquid/spot/orders/{s}/trigger-levels[/history]
hyperliquid.hip3.liquidations.byUser() /v1/hyperliquid/hip3/liquidations/user/{addr}

The shared classes are split so each family exposes only what it serves: OrderHistoryResource (Spot: history), OrderFlowResource (HIP-4: plus flow, tpsl), OrdersResource (core and HIP-3: plus trigger levels), and MarketLiquidationsResource (HIP-3) under LiquidationsResource (core: plus byUser). With mocked fetch, every SDK method now calls a route that is in the OpenAPI spec.

Changed

Parameters the API ignores are no longer offered. I checked each one live, and the rows were identical with and without it:

  • side on trade history (GetTradesCursorParams; core, HIP-3, Spot and Lighter all return both sides).
  • user, status, order_type on Spot order history. Core, HIP-3 and HIP-4 order history keep them; core honors status.
  • depth on full-depth L2 history. L3 and L4 history never offered it. depth is still honored on snapshots and on native L2 history.

Fixed

  • spot.freshness() returns a new SpotFreshness type with the buckets Spot reports: order book, trades, L4 checkpoints and diffs, orders, and TWAP. It used to be typed as CoinFreshness and failed with validate: true.
  • CoinFreshness.funding is optional because HIP-4 has no funding. hip4.getFreshness() used to fail with validate: true. symbol is now typed.
  • dataQuality.symbolCoverage() URL-encodes the symbol and keeps its case. Before, HIP-4 #0 was cut off at the #. Its examples now read dataTypes.openInterest, the key the SDK actually returns.

Added

  • account on lighter.l3Orderbook.get() and history().

Verified, no change needed

  • HIP-4 trade cursors are composite (1790575451682_379606340537712). The SDK passes them through unchanged, and following one live returns the next page.

Checks

  • Build and tsc --noEmit are clean, eslint reports 0 errors, the package contents check passes, and vitest run passes 264 tests (16 new).
  • The fixes were also run against the live API with validate: true.

Removed methods whose routes return 404: hip4.l2Orderbook (get, history,
diffs), hip4.orders.triggerLevels and triggerLevelsHistory, spot.orders
flow, tpsl, triggerLevels and triggerLevelsHistory, and
hip3.liquidations.byUser. The shared resources are split so each family
gets only the routes it serves: OrderHistoryResource (Spot),
OrderFlowResource (HIP-4), OrdersResource (core, HIP-3), and
MarketLiquidationsResource (HIP-3) under LiquidationsResource (core).

Parameters the API ignores are no longer offered: side on trade history,
user, status and order_type on Spot order history, and depth on full-depth
L2 history.

spot.freshness() returns SpotFreshness, matching the buckets Spot reports.
CoinFreshness.funding is optional because HIP-4 has none; both failed with
validate: true before. dataQuality.symbolCoverage() URL-encodes the symbol
without changing its case, so HIP-4 #0 reaches the API. L3 get and history
take an account filter.
@0xFantomMenace
0xFantomMenace merged commit 04e356f into master Sep 29, 2026
1 check passed
@0xFantomMenace
0xFantomMenace deleted the fix/spec-mismatches branch September 29, 2026 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant