Skip to content

fix(ws): keep spot asset ctx fields and map identifier - #197

Open
DorianHsia wants to merge 1 commit into
hyperliquid-dex:masterfrom
DorianHsia:fix/spot-active-asset-ctx
Open

fix(ws): keep spot asset ctx fields and map identifier#197
DorianHsia wants to merge 1 commit into
hyperliquid-dex:masterfrom
DorianHsia:fix/spot-active-asset-ctx

Conversation

@DorianHsia

Copy link
Copy Markdown

Problem

Subscribing with ActiveAssetCtx for a spot coin (@107) returns channel activeSpotAssetCtx. The live ctx also includes totalSupply and dayBaseVlm, which SpotAssetCtx dropped.

Closes #88.

Change

  • Store optional total_supply and day_base_vlm on SpotAssetCtx (serde(default)).
  • Regression tests: sample spot JSON deserializes as Message::ActiveSpotAssetCtx, extra fields round-trip, and get_identifier equals Subscription::ActiveAssetCtx { coin }. Perps activeAssetCtx still maps the same way.

cargo test --lib -- ws::

Made with Cursor

activeSpotAssetCtx payloads include totalSupply and dayBaseVlm which
were dropped, and there was no test that spot ctx still routes to the
ActiveAssetCtx subscription key. Persist those optional fields and add
deserialize plus identifier regression tests. Fixes
hyperliquid-dex#88.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Websocket type activeAssetCtx can return wrong channel type activeSpotAssetCtx

1 participant