hyperliquid 1.9.2 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -0
  3. data/docs/API.md +374 -152
  4. data/docs/CONFIGURATION.md +25 -11
  5. data/docs/DEVELOPMENT.md +93 -15
  6. data/docs/ERRORS.md +2 -0
  7. data/docs/EXAMPLES.md +256 -3
  8. data/docs/WS.md +78 -20
  9. data/lib/hyperliquid/client.rb +19 -10
  10. data/lib/hyperliquid/exchange.rb +844 -22
  11. data/lib/hyperliquid/info.rb +27 -14
  12. data/lib/hyperliquid/signing/signer.rb +18 -1
  13. data/lib/hyperliquid/version.rb +1 -1
  14. data/lib/hyperliquid/ws/client.rb +192 -78
  15. data/lib/hyperliquid.rb +6 -0
  16. metadata +36 -34
  17. data/.rspec +0 -3
  18. data/.rubocop.yml +0 -49
  19. data/.ruby-version +0 -1
  20. data/CLAUDE.md +0 -108
  21. data/CODE_OF_CONDUCT.md +0 -132
  22. data/Rakefile +0 -12
  23. data/example.rb +0 -161
  24. data/scripts/test_01_spot_market_roundtrip.rb +0 -48
  25. data/scripts/test_02_spot_limit_order.rb +0 -48
  26. data/scripts/test_03_perp_market_roundtrip.rb +0 -58
  27. data/scripts/test_04_perp_limit_order.rb +0 -52
  28. data/scripts/test_05_update_leverage.rb +0 -50
  29. data/scripts/test_06_modify_order.rb +0 -67
  30. data/scripts/test_07_market_close.rb +0 -55
  31. data/scripts/test_08_usd_class_transfer.rb +0 -36
  32. data/scripts/test_09_sub_account_lifecycle.rb +0 -51
  33. data/scripts/test_10_vault.rb +0 -68
  34. data/scripts/test_11_builder_fee.rb +0 -81
  35. data/scripts/test_12_staking.rb +0 -70
  36. data/scripts/test_13_ws_l2_book.rb +0 -83
  37. data/scripts/test_14_ws_candle.rb +0 -81
  38. data/scripts/test_15_explorer.rb +0 -71
  39. data/scripts/test_16_send_to_evm_with_data.rb +0 -79
  40. data/scripts/test_17_create_vault.rb +0 -73
  41. data/scripts/test_18_user_portfolio_margin.rb +0 -72
  42. data/scripts/test_19_spot_user.rb +0 -55
  43. data/scripts/test_20_explorer_ws.rb +0 -92
  44. data/scripts/test_all.rb +0 -96
  45. data/scripts/test_automated.rb +0 -82
  46. data/scripts/test_helpers.rb +0 -238
  47. data/sig/hyperliquid.rbs +0 -4
  48. data/test_integration.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11b5874db2bd1216e1c16286b4170433837e5b78270cb06604dc31f0cbd71e55
4
- data.tar.gz: 6d2257b428f3b9f74c776660005e93354c5520ce703e4407b570a68588c986ab
3
+ metadata.gz: 353285075e17708af138c8d14c934607f73c9d2e29e898fca33f7c2d70bb34e8
4
+ data.tar.gz: e76bd9c3307fab826dddab97056165be1d0323857b5723eda36f7a90f3a8b6c5
5
5
  SHA512:
6
- metadata.gz: e52c6c735384f3b1e6fd38b9ac908598b62eaceb775fdf37a2a90520bf362ce176de11a69d4cb9911732b1a5c674d5cea86058a21535567c8e8fa85b3bda400f
7
- data.tar.gz: 3ca54c192cd59d0ffdee4c967bea92646c40a09daf9cee96c9b19658986cedbf6f9ac553b35361c9ebcea66385bdd64eb09131e127170ac580b091a356190113
6
+ metadata.gz: 02b0ba9749c8fe7dc3918db4a674877f073da2138c20f980097a6844c974588152f92eda956a84a198d6fe3fb2307828a436191a96c8ad2a5417d4c2a3377674
7
+ data.tar.gz: 85e56fa57887fb750ca7eecf9ecff9abc3ed252519ddf39c5c22fb5d88db717ef5f2c159a55bea101016fc33e6b3ad354b92b601cc5fdfa34ce3f510d6503d43
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  ## [Ruby Hyperliquid SDK Changelog]
2
2
 
3
+ ## [2.0.1] - 2026-10-30
4
+
5
+ ### Security
6
+
7
+ - `hyperliquid` now requires `rbsecp256k1` `~> 6.0, >= 6.0.1`. rbsecp256k1 6.0.1 and later require rubyzip `~> 3.4`, so applications installing this gem resolve a rubyzip release fixed for GHSA-47m2-wp7j-p9vc (CVE-2026-85396); run `bundle update hyperliquid rbsecp256k1 rubyzip` to pick it up. This also requires `eth` 0.5.11 or later, because eth 0.5.0–0.5.10 required rbsecp256k1 5.x.
8
+ - The development and CI lockfile now uses `rbsecp256k1` 6.0.2 from RubyGems instead of the `carter2099/rbsecp256k1` fork. Applications that added the fork line from the 1.9.2 README can remove it; keeping it also satisfies the new requirement.
9
+
10
+ ### Fixed
11
+
12
+ - `Info#user_subaccounts` sent `type: "subaccounts"`, which the API rejects with 422; it now sends `subAccounts`, matching the Python SDK. Its documented return value is now an array of sub-account hashes, or `nil` when the user has none.
13
+
14
+ ## [2.0.0] - 2026-10-02
15
+
16
+ ### Breaking
17
+
18
+ - `Exchange#activate_outcome_deployer` now takes `venue_name:` and sends the protocol's `activate: { venueName }` form. The previous `is_deactivate:` keyword sent a shape the exchange never accepted and has been removed; use the new `Exchange#deactivate_outcome_deployer` to deactivate.
19
+ - `Info#aligned_quote_token_info` has been removed. The API stopped serving `alignedQuoteTokenInfo` (mainnet and testnet return HTTP 422), so every call already failed.
20
+ - `WS::Client#subscribe` raises `Hyperliquid::WebSocketError` for a subscription that conflicts with an active one on a channel whose messages do not say which subscription they belong to: a second user on `orderUpdates`, `userEvents` or `notification`, or a second `aggregateByTime` (`userFills`) / `ignorePortfolioMargin` (`spotState`) value for the same user. Previously both callbacks silently received each other's messages.
21
+ - `Hyperliquid.new(private_key:)` and `Signing::Signer` raise `ArgumentError` unless the key is 64 hex characters, optionally `0x`-prefixed. Empty strings and malformed keys are no longer accepted (the error never echoes the key).
22
+
23
+ ### Added
24
+
25
+ - HIP-3 perp deployer actions (`perpDeploy`): `perp_deploy_register_asset`, `perp_deploy_register_asset2`, `perp_deploy_set_oracle`, `perp_deploy_set_funding_multipliers`, `perp_deploy_set_funding_interest_rates`, `perp_deploy_set_funding_clamps`, `perp_deploy_halt_trading`, `perp_deploy_insert_margin_table`, `perp_deploy_set_margin_table_ids`, `perp_deploy_set_margin_modes`, `perp_deploy_set_open_interest_caps`, `perp_deploy_set_fee_recipient`, `perp_deploy_set_deployer_fees`, `perp_deploy_set_sub_deployers`, `perp_deploy_set_perp_annotation`, `perp_deploy_disable_dex`.
26
+ - HIP-3\* star operations (testnet): `star_modify_approval`, `star_modify_backstop_liquidator_approval`, `star_set_reduce_only`, `star_cancel`, `star_cancel_all`, `star_order`, `star_send_asset`, `star_set_oracle`, and `Info#user_star_state`.
27
+ - HIP-1/HIP-2 spot deployer actions (`spotDeploy`): `spot_deploy_register_token`, `spot_deploy_user_genesis` (with `blacklist_users:`), `spot_deploy_genesis`, `spot_deploy_register_spot`, `spot_deploy_register_hyperliquidity`, `spot_deploy_set_deployer_trading_fee_share`, `spot_deploy_enable_freeze_privilege`, `spot_deploy_freeze_user`, `spot_deploy_revoke_freeze_privilege`, `spot_deploy_enable_quote_token`, `spot_deploy_disable_quote_token`, `spot_deploy_request_evm_contract`, `spot_deploy_set_token_annotation`, `spot_deploy_set_deployer_label`.
28
+ - HIP-4 outcome deployer actions: `deactivate_outcome_deployer`, `register_standalone_outcome_from_template`, `register_question_from_template`, `register_and_associate_named_outcome_from_template`, `settle_outcome`, `settle_question`, `set_outcome_sub_deployers`; and `Info#outcome_deployer_limits`.
29
+ - Validator-operator actions: `c_signer_jail_self`, `c_signer_unjail_self`, `c_validator_register`, `c_validator_change_profile`, `c_validator_unregister`, `validator_l1_stream`.
30
+ - `Exchange#trailing_stop`.
31
+ - 18 WebSocket channels: `userNonFundingLedgerUpdates`, `userTwapSliceFills`, `userTwapHistory`, `userHistoricalOrders`, `allDexsClearinghouseState`, `webData3`, `clearinghouseState`, `openOrders`, `twapStates`, `spotState`, `notification`, `activeAssetCtx` (spot updates arrive on `activeSpotAssetCtx` and are routed transparently), `activeAssetData`, `assetCtxs`, `allDexsAssetCtxs`, `spotAssetCtxs`, `outcomeMetaUpdates`, and `fastAssetCtxs` (base64 + raw-DEFLATE frames are decoded before the callback).
32
+ - All new actions support `expires_after` and match the official Python SDK's signatures byte for byte where Python has the action.
33
+
34
+ ### Fixed
35
+
36
+ - `create_sub_account`, `sub_account_transfer`, `sub_account_spot_transfer`, `vault_transfer` and `set_referrer` now include `expires_after` in the signed hash; with `expires_after` set they were previously rejected or attributed to the wrong signer.
37
+ - Spot `market_order`/`market_close` read each pair's size decimals from its base token (the API never sends `szDecimals` on spotMeta pairs), so spot slippage prices now match the Python SDK.
38
+ - Market-order slippage prices round ties to even on the exact binary value, like the Python SDK (some prices came out one tick higher).
39
+ - `retry_enabled: true` now retries `/info` and explorer reads on 429/502/503/504, connection failures and timeouts (it previously retried nothing); `/exchange` is never retried. The `timeout:` option now also limits how long the SDK waits for a response.
40
+ - `WS::Client` reconnects with backoff when the server closes the connection (previously subscriptions silently stopped), `close` no longer reports a spurious "queue closed" error, subscribing after `close` delivers messages again, a pending reconnect no longer opens a second connection after `close` + `connect`, and each subscription is sent once on open.
41
+ - WebSocket subscription ids are unique across the main-API and explorer connections (`unsubscribe(id)` could remove the wrong subscription), and `userEvents` subscriptions now receive events (the server sends them on channel `user`).
42
+ - Documentation for `Exchange#user_set_abstraction` (takes `unifiedAccount` / `portfolioMargin` / `disabled`) and `Exchange#schedule_cancel` (`time: nil` removes the scheduled cancel).
43
+
44
+ ### Changed
45
+
46
+ - The gem declares `bigdecimal` (>= 3.1) as a runtime dependency; it was already required at load time.
47
+ - The packaged gem contains only `lib/`, `docs/`, `README.md`, `CHANGELOG.md`, `LICENSE.txt` and `SECURITY.md`, every file world-readable (1.9.2 shipped `version.rb`, `CHANGELOG.md` and `CLAUDE.md` as owner-only).
48
+ - `docs/API.md` lists every public method with full signatures and `docs/WS.md` covers both WebSocket transports and every channel.
49
+
50
+ ### Security
51
+
52
+ - `Signing::Signer`, `Exchange` and the SDK object redact `inspect`/`to_s` to address and network, so private keys cannot appear in logs or exception messages.
53
+
3
54
  ## [1.9.2] - 2026-09-29
4
55
 
5
56
  ### Security