@nktkas/hyperliquid 0.24.3 → 0.25.0-beta.2
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.
- package/README.md +141 -32
- package/esm/mod.d.ts +11 -11
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -1
- package/esm/mod.js.map +1 -0
- package/esm/src/clients/exchange.d.ts +29 -25
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +54 -53
- package/esm/src/clients/exchange.js.map +1 -0
- package/esm/src/clients/info.d.ts +80 -20
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +312 -73
- package/esm/src/clients/info.js.map +1 -0
- package/esm/src/clients/multiSign.d.ts +11 -7
- package/esm/src/clients/multiSign.d.ts.map +1 -1
- package/esm/src/clients/multiSign.js +2 -1
- package/esm/src/clients/multiSign.js.map +1 -0
- package/esm/src/clients/subscription.d.ts +9 -9
- package/esm/src/clients/subscription.d.ts.map +1 -1
- package/esm/src/clients/subscription.js +29 -27
- package/esm/src/clients/subscription.js.map +1 -0
- package/esm/src/{base.d.ts → errors.d.ts} +1 -1
- package/esm/src/errors.d.ts.map +1 -0
- package/esm/src/{base.js → errors.js} +1 -0
- package/esm/src/errors.js.map +1 -0
- package/esm/src/schemas/_base.d.ts +14 -0
- package/esm/src/schemas/_base.d.ts.map +1 -0
- package/esm/src/schemas/_base.js +15 -0
- package/esm/src/schemas/_base.js.map +1 -0
- package/esm/src/schemas/exchange/requests.d.ts +8953 -0
- package/esm/src/schemas/exchange/requests.d.ts.map +1 -0
- package/esm/src/schemas/exchange/requests.js +1414 -0
- package/esm/src/schemas/exchange/requests.js.map +1 -0
- package/esm/src/schemas/exchange/responses.d.ts +567 -0
- package/esm/src/schemas/exchange/responses.d.ts.map +1 -0
- package/esm/src/schemas/exchange/responses.js +244 -0
- package/esm/src/schemas/exchange/responses.js.map +1 -0
- package/esm/src/schemas/explorer/requests.d.ts +44 -0
- package/esm/src/schemas/explorer/requests.d.ts.map +1 -0
- package/esm/src/schemas/explorer/requests.js +33 -0
- package/esm/src/schemas/explorer/requests.js.map +1 -0
- package/esm/src/schemas/explorer/responses.d.ts +360 -0
- package/esm/src/schemas/explorer/responses.d.ts.map +1 -0
- package/esm/src/schemas/explorer/responses.js +57 -0
- package/esm/src/schemas/explorer/responses.js.map +1 -0
- package/esm/src/schemas/info/accounts.d.ts +2159 -0
- package/esm/src/schemas/info/accounts.d.ts.map +1 -0
- package/esm/src/schemas/info/accounts.js +623 -0
- package/esm/src/schemas/info/accounts.js.map +1 -0
- package/esm/src/schemas/info/assets.d.ts +974 -0
- package/esm/src/schemas/info/assets.d.ts.map +1 -0
- package/esm/src/schemas/info/assets.js +285 -0
- package/esm/src/schemas/info/assets.js.map +1 -0
- package/esm/src/schemas/info/markets.d.ts +155 -0
- package/esm/src/schemas/info/markets.d.ts.map +1 -0
- package/esm/src/schemas/info/markets.js +70 -0
- package/esm/src/schemas/info/markets.js.map +1 -0
- package/esm/src/schemas/info/orders.d.ts +957 -0
- package/esm/src/schemas/info/orders.d.ts.map +1 -0
- package/esm/src/schemas/info/orders.js +298 -0
- package/esm/src/schemas/info/orders.js.map +1 -0
- package/esm/src/schemas/info/requests.d.ts +924 -0
- package/esm/src/schemas/info/requests.d.ts.map +1 -0
- package/esm/src/schemas/info/requests.js +687 -0
- package/esm/src/schemas/info/requests.js.map +1 -0
- package/esm/src/schemas/info/validators.d.ts +326 -0
- package/esm/src/schemas/info/validators.d.ts.map +1 -0
- package/esm/src/schemas/info/validators.js +126 -0
- package/esm/src/schemas/info/validators.js.map +1 -0
- package/esm/src/schemas/info/vaults.d.ts +447 -0
- package/esm/src/schemas/info/vaults.d.ts.map +1 -0
- package/esm/src/schemas/info/vaults.js +111 -0
- package/esm/src/schemas/info/vaults.js.map +1 -0
- package/esm/src/schemas/mod.d.ts +101 -0
- package/esm/src/schemas/mod.d.ts.map +1 -0
- package/esm/src/schemas/mod.js +115 -0
- package/esm/src/schemas/mod.js.map +1 -0
- package/esm/src/schemas/subscriptions/requests.d.ts +332 -0
- package/esm/src/schemas/subscriptions/requests.d.ts.map +1 -0
- package/esm/src/schemas/subscriptions/requests.js +259 -0
- package/esm/src/schemas/subscriptions/requests.js.map +1 -0
- package/esm/src/schemas/subscriptions/responses.d.ts +3643 -0
- package/esm/src/schemas/subscriptions/responses.d.ts.map +1 -0
- package/esm/src/schemas/subscriptions/responses.js +234 -0
- package/esm/src/schemas/subscriptions/responses.js.map +1 -0
- package/esm/src/signing/_signTypedData/ethers.js +1 -0
- package/esm/src/signing/_signTypedData/ethers.js.map +1 -0
- package/esm/src/signing/_signTypedData/mod.js +1 -0
- package/esm/src/signing/_signTypedData/mod.js.map +1 -0
- package/esm/src/signing/_signTypedData/private_key.js +1 -0
- package/esm/src/signing/_signTypedData/private_key.js.map +1 -0
- package/esm/src/signing/_signTypedData/viem.js +1 -0
- package/esm/src/signing/_signTypedData/viem.js.map +1 -0
- package/esm/src/signing/mod.d.ts +109 -29
- package/esm/src/signing/mod.d.ts.map +1 -1
- package/esm/src/signing/mod.js +136 -29
- package/esm/src/signing/mod.js.map +1 -0
- package/esm/src/transports/base.d.ts +4 -4
- package/esm/src/transports/base.d.ts.map +1 -1
- package/esm/src/transports/base.js +3 -2
- package/esm/src/transports/base.js.map +1 -0
- package/esm/src/transports/http/http_transport.d.ts +3 -2
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +1 -0
- package/esm/src/transports/http/http_transport.js.map +1 -0
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +1 -1
- package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -0
- package/esm/src/transports/websocket/_hyperliquid_event_target.js.map +1 -0
- package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/esm/src/transports/websocket/_reconnecting_websocket.js.map +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.js +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.js.map +1 -0
- package/esm/src/transports/websocket/websocket_transport.d.ts +9 -1
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +4 -0
- package/esm/src/transports/websocket/websocket_transport.js.map +1 -0
- package/package.json +6 -5
- package/script/mod.d.ts +11 -11
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +2 -1
- package/script/mod.js.map +1 -0
- package/script/src/clients/exchange.d.ts +29 -25
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +60 -59
- package/script/src/clients/exchange.js.map +1 -0
- package/script/src/clients/info.d.ts +80 -20
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +312 -73
- package/script/src/clients/info.js.map +1 -0
- package/script/src/clients/multiSign.d.ts +11 -7
- package/script/src/clients/multiSign.d.ts.map +1 -1
- package/script/src/clients/multiSign.js +2 -1
- package/script/src/clients/multiSign.js.map +1 -0
- package/script/src/clients/subscription.d.ts +9 -9
- package/script/src/clients/subscription.d.ts.map +1 -1
- package/script/src/clients/subscription.js +29 -27
- package/script/src/clients/subscription.js.map +1 -0
- package/script/src/{base.d.ts → errors.d.ts} +1 -1
- package/script/src/errors.d.ts.map +1 -0
- package/script/src/{base.js → errors.js} +1 -0
- package/script/src/errors.js.map +1 -0
- package/script/src/schemas/_base.d.ts +14 -0
- package/script/src/schemas/_base.d.ts.map +1 -0
- package/script/src/schemas/_base.js +51 -0
- package/script/src/schemas/_base.js.map +1 -0
- package/script/src/schemas/exchange/requests.d.ts +8953 -0
- package/script/src/schemas/exchange/requests.d.ts.map +1 -0
- package/script/src/schemas/exchange/requests.js +1450 -0
- package/script/src/schemas/exchange/requests.js.map +1 -0
- package/script/src/schemas/exchange/responses.d.ts +567 -0
- package/script/src/schemas/exchange/responses.d.ts.map +1 -0
- package/script/src/schemas/exchange/responses.js +280 -0
- package/script/src/schemas/exchange/responses.js.map +1 -0
- package/script/src/schemas/explorer/requests.d.ts +44 -0
- package/script/src/schemas/explorer/requests.d.ts.map +1 -0
- package/script/src/schemas/explorer/requests.js +69 -0
- package/script/src/schemas/explorer/requests.js.map +1 -0
- package/script/src/schemas/explorer/responses.d.ts +360 -0
- package/script/src/schemas/explorer/responses.d.ts.map +1 -0
- package/script/src/schemas/explorer/responses.js +93 -0
- package/script/src/schemas/explorer/responses.js.map +1 -0
- package/script/src/schemas/info/accounts.d.ts +2159 -0
- package/script/src/schemas/info/accounts.d.ts.map +1 -0
- package/script/src/schemas/info/accounts.js +659 -0
- package/script/src/schemas/info/accounts.js.map +1 -0
- package/script/src/schemas/info/assets.d.ts +974 -0
- package/script/src/schemas/info/assets.d.ts.map +1 -0
- package/script/src/schemas/info/assets.js +321 -0
- package/script/src/schemas/info/assets.js.map +1 -0
- package/script/src/schemas/info/markets.d.ts +155 -0
- package/script/src/schemas/info/markets.d.ts.map +1 -0
- package/script/src/schemas/info/markets.js +106 -0
- package/script/src/schemas/info/markets.js.map +1 -0
- package/script/src/schemas/info/orders.d.ts +957 -0
- package/script/src/schemas/info/orders.d.ts.map +1 -0
- package/script/src/schemas/info/orders.js +334 -0
- package/script/src/schemas/info/orders.js.map +1 -0
- package/script/src/schemas/info/requests.d.ts +924 -0
- package/script/src/schemas/info/requests.d.ts.map +1 -0
- package/script/src/schemas/info/requests.js +724 -0
- package/script/src/schemas/info/requests.js.map +1 -0
- package/script/src/schemas/info/validators.d.ts +326 -0
- package/script/src/schemas/info/validators.d.ts.map +1 -0
- package/script/src/schemas/info/validators.js +162 -0
- package/script/src/schemas/info/validators.js.map +1 -0
- package/script/src/schemas/info/vaults.d.ts +447 -0
- package/script/src/schemas/info/vaults.d.ts.map +1 -0
- package/script/src/schemas/info/vaults.js +147 -0
- package/script/src/schemas/info/vaults.js.map +1 -0
- package/script/src/schemas/mod.d.ts +101 -0
- package/script/src/schemas/mod.d.ts.map +1 -0
- package/script/src/schemas/mod.js +157 -0
- package/script/src/schemas/mod.js.map +1 -0
- package/script/src/schemas/subscriptions/requests.d.ts +332 -0
- package/script/src/schemas/subscriptions/requests.d.ts.map +1 -0
- package/script/src/schemas/subscriptions/requests.js +295 -0
- package/script/src/schemas/subscriptions/requests.js.map +1 -0
- package/script/src/schemas/subscriptions/responses.d.ts +3643 -0
- package/script/src/schemas/subscriptions/responses.d.ts.map +1 -0
- package/script/src/schemas/subscriptions/responses.js +270 -0
- package/script/src/schemas/subscriptions/responses.js.map +1 -0
- package/script/src/signing/_signTypedData/ethers.js +1 -0
- package/script/src/signing/_signTypedData/ethers.js.map +1 -0
- package/script/src/signing/_signTypedData/mod.js +1 -0
- package/script/src/signing/_signTypedData/mod.js.map +1 -0
- package/script/src/signing/_signTypedData/private_key.js +1 -0
- package/script/src/signing/_signTypedData/private_key.js.map +1 -0
- package/script/src/signing/_signTypedData/viem.js +1 -0
- package/script/src/signing/_signTypedData/viem.js.map +1 -0
- package/script/src/signing/mod.d.ts +109 -29
- package/script/src/signing/mod.d.ts.map +1 -1
- package/script/src/signing/mod.js +138 -33
- package/script/src/signing/mod.js.map +1 -0
- package/script/src/transports/base.d.ts +4 -4
- package/script/src/transports/base.d.ts.map +1 -1
- package/script/src/transports/base.js +4 -3
- package/script/src/transports/base.js.map +1 -0
- package/script/src/transports/http/http_transport.d.ts +3 -2
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +1 -0
- package/script/src/transports/http/http_transport.js.map +1 -0
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +1 -1
- package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
- package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -0
- package/script/src/transports/websocket/_hyperliquid_event_target.js.map +1 -0
- package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/script/src/transports/websocket/_reconnecting_websocket.js.map +1 -0
- package/script/src/transports/websocket/_websocket_async_request.js +1 -0
- package/script/src/transports/websocket/_websocket_async_request.js.map +1 -0
- package/script/src/transports/websocket/websocket_transport.d.ts +9 -1
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +4 -0
- package/script/src/transports/websocket/websocket_transport.js.map +1 -0
- package/src/mod.ts +28 -0
- package/src/src/clients/exchange.ts +2246 -0
- package/src/src/clients/info.ts +2076 -0
- package/src/src/clients/multiSign.ts +183 -0
- package/src/src/clients/subscription.ts +841 -0
- package/src/src/errors.ts +7 -0
- package/src/src/schemas/_base.ts +43 -0
- package/src/src/schemas/exchange/requests.ts +3057 -0
- package/src/src/schemas/exchange/responses.ts +540 -0
- package/src/src/schemas/explorer/requests.ts +65 -0
- package/src/src/schemas/explorer/responses.ts +138 -0
- package/src/src/schemas/info/accounts.ts +1490 -0
- package/src/src/schemas/info/assets.ts +693 -0
- package/src/src/schemas/info/markets.ts +171 -0
- package/src/src/schemas/info/orders.ts +597 -0
- package/src/src/schemas/info/requests.ts +1369 -0
- package/src/src/schemas/info/validators.ts +299 -0
- package/src/src/schemas/info/vaults.ts +262 -0
- package/src/src/schemas/mod.ts +121 -0
- package/src/src/schemas/subscriptions/requests.ts +504 -0
- package/src/src/schemas/subscriptions/responses.ts +576 -0
- package/src/src/signing/_signTypedData/ethers.ts +59 -0
- package/src/src/signing/_signTypedData/mod.ts +121 -0
- package/src/src/signing/_signTypedData/private_key.ts +229 -0
- package/src/src/signing/_signTypedData/viem.ts +55 -0
- package/src/src/signing/mod.ts +572 -0
- package/src/src/transports/base.ts +54 -0
- package/src/src/transports/http/http_transport.ts +208 -0
- package/src/src/transports/websocket/_hyperliquid_event_target.ts +118 -0
- package/src/src/transports/websocket/_reconnecting_websocket.ts +404 -0
- package/src/src/transports/websocket/_websocket_async_request.ts +229 -0
- package/src/src/transports/websocket/websocket_transport.ts +394 -0
- package/esm/src/base.d.ts.map +0 -1
- package/esm/src/signing/_sorter.d.ts +0 -127
- package/esm/src/signing/_sorter.d.ts.map +0 -1
- package/esm/src/signing/_sorter.js +0 -693
- package/esm/src/types/exchange/requests.d.ts +0 -1345
- package/esm/src/types/exchange/requests.d.ts.map +0 -1
- package/esm/src/types/exchange/requests.js +0 -1
- package/esm/src/types/exchange/responses.d.ts +0 -233
- package/esm/src/types/exchange/responses.d.ts.map +0 -1
- package/esm/src/types/exchange/responses.js +0 -1
- package/esm/src/types/explorer/requests.d.ts +0 -32
- package/esm/src/types/explorer/requests.d.ts.map +0 -1
- package/esm/src/types/explorer/requests.js +0 -1
- package/esm/src/types/explorer/responses.d.ts +0 -58
- package/esm/src/types/explorer/responses.d.ts.map +0 -1
- package/esm/src/types/explorer/responses.js +0 -1
- package/esm/src/types/info/accounts.d.ts +0 -864
- package/esm/src/types/info/accounts.d.ts.map +0 -1
- package/esm/src/types/info/accounts.js +0 -1
- package/esm/src/types/info/assets.d.ts +0 -354
- package/esm/src/types/info/assets.d.ts.map +0 -1
- package/esm/src/types/info/assets.js +0 -1
- package/esm/src/types/info/markets.d.ts +0 -79
- package/esm/src/types/info/markets.d.ts.map +0 -1
- package/esm/src/types/info/markets.js +0 -1
- package/esm/src/types/info/orders.d.ts +0 -266
- package/esm/src/types/info/orders.d.ts.map +0 -1
- package/esm/src/types/info/orders.js +0 -1
- package/esm/src/types/info/requests.d.ts +0 -640
- package/esm/src/types/info/requests.d.ts.map +0 -1
- package/esm/src/types/info/requests.js +0 -1
- package/esm/src/types/info/validators.d.ts +0 -147
- package/esm/src/types/info/validators.d.ts.map +0 -1
- package/esm/src/types/info/validators.js +0 -1
- package/esm/src/types/info/vaults.d.ts +0 -119
- package/esm/src/types/info/vaults.d.ts.map +0 -1
- package/esm/src/types/info/vaults.js +0 -1
- package/esm/src/types/mod.d.ts +0 -38
- package/esm/src/types/mod.d.ts.map +0 -1
- package/esm/src/types/mod.js +0 -24
- package/esm/src/types/subscriptions/requests.d.ts +0 -154
- package/esm/src/types/subscriptions/requests.d.ts.map +0 -1
- package/esm/src/types/subscriptions/requests.js +0 -1
- package/esm/src/types/subscriptions/responses.d.ts +0 -238
- package/esm/src/types/subscriptions/responses.d.ts.map +0 -1
- package/esm/src/types/subscriptions/responses.js +0 -1
- package/script/src/base.d.ts.map +0 -1
- package/script/src/signing/_sorter.d.ts +0 -127
- package/script/src/signing/_sorter.d.ts.map +0 -1
- package/script/src/signing/_sorter.js +0 -696
- package/script/src/types/exchange/requests.d.ts +0 -1345
- package/script/src/types/exchange/requests.d.ts.map +0 -1
- package/script/src/types/exchange/requests.js +0 -2
- package/script/src/types/exchange/responses.d.ts +0 -233
- package/script/src/types/exchange/responses.d.ts.map +0 -1
- package/script/src/types/exchange/responses.js +0 -2
- package/script/src/types/explorer/requests.d.ts +0 -32
- package/script/src/types/explorer/requests.d.ts.map +0 -1
- package/script/src/types/explorer/requests.js +0 -2
- package/script/src/types/explorer/responses.d.ts +0 -58
- package/script/src/types/explorer/responses.d.ts.map +0 -1
- package/script/src/types/explorer/responses.js +0 -2
- package/script/src/types/info/accounts.d.ts +0 -864
- package/script/src/types/info/accounts.d.ts.map +0 -1
- package/script/src/types/info/accounts.js +0 -2
- package/script/src/types/info/assets.d.ts +0 -354
- package/script/src/types/info/assets.d.ts.map +0 -1
- package/script/src/types/info/assets.js +0 -2
- package/script/src/types/info/markets.d.ts +0 -79
- package/script/src/types/info/markets.d.ts.map +0 -1
- package/script/src/types/info/markets.js +0 -2
- package/script/src/types/info/orders.d.ts +0 -266
- package/script/src/types/info/orders.d.ts.map +0 -1
- package/script/src/types/info/orders.js +0 -2
- package/script/src/types/info/requests.d.ts +0 -640
- package/script/src/types/info/requests.d.ts.map +0 -1
- package/script/src/types/info/requests.js +0 -2
- package/script/src/types/info/validators.d.ts +0 -147
- package/script/src/types/info/validators.d.ts.map +0 -1
- package/script/src/types/info/validators.js +0 -2
- package/script/src/types/info/vaults.d.ts +0 -119
- package/script/src/types/info/vaults.d.ts.map +0 -1
- package/script/src/types/info/vaults.js +0 -2
- package/script/src/types/mod.d.ts +0 -38
- package/script/src/types/mod.d.ts.map +0 -1
- package/script/src/types/mod.js +0 -25
- package/script/src/types/subscriptions/requests.d.ts +0 -154
- package/script/src/types/subscriptions/requests.d.ts.map +0 -1
- package/script/src/types/subscriptions/requests.js +0 -2
- package/script/src/types/subscriptions/responses.d.ts +0 -238
- package/script/src/types/subscriptions/responses.d.ts.map +0 -1
- package/script/src/types/subscriptions/responses.js +0 -2
|
@@ -0,0 +1,2076 @@
|
|
|
1
|
+
import type { IRequestTransport } from "../transports/base.js";
|
|
2
|
+
import {
|
|
3
|
+
type ActiveAssetData,
|
|
4
|
+
ActiveAssetDataRequest,
|
|
5
|
+
type AllMids,
|
|
6
|
+
AllMidsRequest,
|
|
7
|
+
type BlockDetails,
|
|
8
|
+
BlockDetailsRequest,
|
|
9
|
+
type BlockDetailsResponse,
|
|
10
|
+
type Book,
|
|
11
|
+
type Candle,
|
|
12
|
+
CandleSnapshotRequest,
|
|
13
|
+
ClearinghouseStateRequest,
|
|
14
|
+
type Delegation,
|
|
15
|
+
DelegationsRequest,
|
|
16
|
+
DelegatorHistoryRequest,
|
|
17
|
+
type DelegatorReward,
|
|
18
|
+
DelegatorRewardsRequest,
|
|
19
|
+
type DelegatorSummary,
|
|
20
|
+
DelegatorSummaryRequest,
|
|
21
|
+
type DelegatorUpdate,
|
|
22
|
+
type DeployAuctionStatus,
|
|
23
|
+
type ExchangeStatus,
|
|
24
|
+
ExchangeStatusRequest,
|
|
25
|
+
type ExtraAgent,
|
|
26
|
+
ExtraAgentsRequest,
|
|
27
|
+
type Fill,
|
|
28
|
+
FrontendOpenOrdersRequest,
|
|
29
|
+
type FrontendOrder,
|
|
30
|
+
type FrontendOrderStatus,
|
|
31
|
+
type FundingHistory,
|
|
32
|
+
FundingHistoryRequest,
|
|
33
|
+
type GossipRootIps,
|
|
34
|
+
GossipRootIpsRequest,
|
|
35
|
+
HistoricalOrdersRequest,
|
|
36
|
+
IsVipRequest,
|
|
37
|
+
L2BookRequest,
|
|
38
|
+
LeadingVaultsRequest,
|
|
39
|
+
type LegalCheck,
|
|
40
|
+
LegalCheckRequest,
|
|
41
|
+
LiquidatableRequest,
|
|
42
|
+
type MarginTable,
|
|
43
|
+
MarginTableRequest,
|
|
44
|
+
MaxBuilderFeeRequest,
|
|
45
|
+
MaxMarketOrderNtlsRequest,
|
|
46
|
+
MetaAndAssetCtxsRequest,
|
|
47
|
+
MetaRequest,
|
|
48
|
+
type MultiSigSigners,
|
|
49
|
+
OpenOrdersRequest,
|
|
50
|
+
type Order,
|
|
51
|
+
type OrderLookup,
|
|
52
|
+
OrderStatusRequest,
|
|
53
|
+
parser,
|
|
54
|
+
PerpDeployAuctionStatusRequest,
|
|
55
|
+
type PerpDex,
|
|
56
|
+
type PerpDexLimits,
|
|
57
|
+
PerpDexLimitsRequest,
|
|
58
|
+
PerpDexsRequest,
|
|
59
|
+
PerpsAtOpenInterestCapRequest,
|
|
60
|
+
type PerpsClearinghouseState,
|
|
61
|
+
type PerpsMeta,
|
|
62
|
+
type PerpsMetaAndAssetCtxs,
|
|
63
|
+
type PortfolioPeriods,
|
|
64
|
+
PortfolioRequest,
|
|
65
|
+
type PredictedFunding,
|
|
66
|
+
PredictedFundingsRequest,
|
|
67
|
+
type PreTransferCheck,
|
|
68
|
+
PreTransferCheckRequest,
|
|
69
|
+
RecentTradesRequest,
|
|
70
|
+
type Referral,
|
|
71
|
+
ReferralRequest,
|
|
72
|
+
type SpotClearinghouseState,
|
|
73
|
+
SpotClearinghouseStateRequest,
|
|
74
|
+
type SpotDeployState,
|
|
75
|
+
SpotDeployStateRequest,
|
|
76
|
+
type SpotMeta,
|
|
77
|
+
type SpotMetaAndAssetCtxs,
|
|
78
|
+
SpotMetaAndAssetCtxsRequest,
|
|
79
|
+
SpotMetaRequest,
|
|
80
|
+
SpotPairDeployAuctionStatusRequest,
|
|
81
|
+
type SubAccount,
|
|
82
|
+
SubAccountsRequest,
|
|
83
|
+
type TokenDetails,
|
|
84
|
+
TokenDetailsRequest,
|
|
85
|
+
type Trade,
|
|
86
|
+
type TwapHistory,
|
|
87
|
+
TwapHistoryRequest,
|
|
88
|
+
type TwapSliceFill,
|
|
89
|
+
type TxDetails,
|
|
90
|
+
TxDetailsRequest,
|
|
91
|
+
type TxDetailsResponse,
|
|
92
|
+
UserDetailsRequest,
|
|
93
|
+
type UserDetailsResponse,
|
|
94
|
+
type UserFees,
|
|
95
|
+
UserFeesRequest,
|
|
96
|
+
UserFillsByTimeRequest,
|
|
97
|
+
UserFillsRequest,
|
|
98
|
+
UserFundingRequest,
|
|
99
|
+
type UserFundingUpdate,
|
|
100
|
+
type UserNonFundingLedgerUpdate,
|
|
101
|
+
UserNonFundingLedgerUpdatesRequest,
|
|
102
|
+
type UserRateLimit,
|
|
103
|
+
UserRateLimitRequest,
|
|
104
|
+
type UserRole,
|
|
105
|
+
UserRoleRequest,
|
|
106
|
+
UserToMultiSigSignersRequest,
|
|
107
|
+
UserTwapSliceFillsByTimeRequest,
|
|
108
|
+
UserTwapSliceFillsRequest,
|
|
109
|
+
UserVaultEquitiesRequest,
|
|
110
|
+
type ValidatorL1Vote,
|
|
111
|
+
ValidatorL1VotesRequest,
|
|
112
|
+
ValidatorSummariesRequest,
|
|
113
|
+
type ValidatorSummary,
|
|
114
|
+
type VaultDetails,
|
|
115
|
+
VaultDetailsRequest,
|
|
116
|
+
type VaultEquity,
|
|
117
|
+
type VaultLeading,
|
|
118
|
+
VaultSummariesRequest,
|
|
119
|
+
type VaultSummary,
|
|
120
|
+
} from "../schemas/mod.js";
|
|
121
|
+
|
|
122
|
+
/** @see https://github.com/microsoft/TypeScript/issues/13923#issuecomment-2191862501 */
|
|
123
|
+
type DeepImmutable<T> = {
|
|
124
|
+
readonly [K in keyof T]: DeepImmutable<T[K]>;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** Parameters for the {@linkcode InfoClient} constructor. */
|
|
128
|
+
export interface InfoClientParameters<T extends IRequestTransport = IRequestTransport> {
|
|
129
|
+
/** The transport used to connect to the Hyperliquid API. */
|
|
130
|
+
transport: T;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Request parameters for the {@linkcode InfoClient.activeAssetData} method. */
|
|
134
|
+
export type ActiveAssetDataParameters = Omit<ActiveAssetDataRequest, "type">;
|
|
135
|
+
/** Request parameters for the {@linkcode InfoClient.allMids} method. */
|
|
136
|
+
export type AllMidsParameters = Omit<AllMidsRequest, "type">;
|
|
137
|
+
/** Request parameters for the {@linkcode InfoClient.blockDetails} method. */
|
|
138
|
+
export type BlockDetailsParameters = Omit<BlockDetailsRequest, "type">;
|
|
139
|
+
/** Request parameters for the {@linkcode InfoClient.candleSnapshot} method. */
|
|
140
|
+
export type CandleSnapshotParameters = CandleSnapshotRequest["req"];
|
|
141
|
+
/** Request parameters for the {@linkcode InfoClient.clearinghouseState} method. */
|
|
142
|
+
export type ClearinghouseStateParameters = Omit<ClearinghouseStateRequest, "type">;
|
|
143
|
+
/** Request parameters for the {@linkcode InfoClient.delegations} method. */
|
|
144
|
+
export type DelegationsParameters = Omit<DelegationsRequest, "type">;
|
|
145
|
+
/** Request parameters for the {@linkcode InfoClient.delegatorHistory} method. */
|
|
146
|
+
export type DelegatorHistoryParameters = Omit<DelegatorHistoryRequest, "type">;
|
|
147
|
+
/** Request parameters for the {@linkcode InfoClient.delegatorRewards} method. */
|
|
148
|
+
export type DelegatorRewardsParameters = Omit<DelegatorRewardsRequest, "type">;
|
|
149
|
+
/** Request parameters for the {@linkcode InfoClient.delegatorSummary} method. */
|
|
150
|
+
export type DelegatorSummaryParameters = Omit<DelegatorSummaryRequest, "type">;
|
|
151
|
+
/** Request parameters for the {@linkcode InfoClient.extraAgents} method. */
|
|
152
|
+
export type ExtraAgentsParameters = Omit<ExtraAgentsRequest, "type">;
|
|
153
|
+
/** Request parameters for the {@linkcode InfoClient.frontendOpenOrders} method. */
|
|
154
|
+
export type FrontendOpenOrdersParameters = Omit<FrontendOpenOrdersRequest, "type">;
|
|
155
|
+
/** Request parameters for the {@linkcode InfoClient.fundingHistory} method. */
|
|
156
|
+
export type FundingHistoryParameters = Omit<FundingHistoryRequest, "type">;
|
|
157
|
+
/** Request parameters for the {@linkcode InfoClient.historicalOrders} method. */
|
|
158
|
+
export type HistoricalOrdersParameters = Omit<HistoricalOrdersRequest, "type">;
|
|
159
|
+
/** Request parameters for the {@linkcode InfoClient.isVip} method. */
|
|
160
|
+
export type IsVipParameters = Omit<IsVipRequest, "type">;
|
|
161
|
+
/** Request parameters for the {@linkcode InfoClient.l2Book} method. */
|
|
162
|
+
export type L2BookParameters = Omit<L2BookRequest, "type">;
|
|
163
|
+
/** Request parameters for the {@linkcode InfoClient.leadingVaults} method. */
|
|
164
|
+
export type LeadingVaultsParameters = Omit<LeadingVaultsRequest, "type">;
|
|
165
|
+
/** Request parameters for the {@linkcode InfoClient.legalCheck} method. */
|
|
166
|
+
export type LegalCheckParameters = Omit<LegalCheckRequest, "type">;
|
|
167
|
+
/** Request parameters for the {@linkcode InfoClient.marginTable} method. */
|
|
168
|
+
export type MarginTableParameters = Omit<MarginTableRequest, "type">;
|
|
169
|
+
/** Request parameters for the {@linkcode InfoClient.maxBuilderFee} method. */
|
|
170
|
+
export type MaxBuilderFeeParameters = Omit<MaxBuilderFeeRequest, "type">;
|
|
171
|
+
/** Request parameters for the {@linkcode InfoClient.meta} method. */
|
|
172
|
+
export type MetaParameters = Omit<MetaRequest, "type">;
|
|
173
|
+
/** Request parameters for the {@linkcode InfoClient.metaAndAssetCtxs} method. */
|
|
174
|
+
export type MetaAndAssetCtxsParameters = Omit<MetaAndAssetCtxsRequest, "type">;
|
|
175
|
+
/** Request parameters for the {@linkcode InfoClient.openOrders} method. */
|
|
176
|
+
export type OpenOrdersParameters = Omit<OpenOrdersRequest, "type">;
|
|
177
|
+
/** Request parameters for the {@linkcode InfoClient.orderStatus} method. */
|
|
178
|
+
export type OrderStatusParameters = Omit<OrderStatusRequest, "type">;
|
|
179
|
+
/** Request parameters for the {@linkcode InfoClient.perpDexLimits} method. */
|
|
180
|
+
export type PerpDexLimitsParameters = Omit<PerpDexLimitsRequest, "type">;
|
|
181
|
+
/** Request parameters for the {@linkcode InfoClient.perpsAtOpenInterestCap} method. */
|
|
182
|
+
export type PerpsAtOpenInterestCapParameters = Omit<PerpsAtOpenInterestCapRequest, "type">;
|
|
183
|
+
/** Request parameters for the {@linkcode InfoClient.portfolio} method. */
|
|
184
|
+
export type PortfolioParameters = Omit<PortfolioRequest, "type">;
|
|
185
|
+
/** Request parameters for the {@linkcode InfoClient.preTransferCheck} method. */
|
|
186
|
+
export type PreTransferCheckParameters = Omit<PreTransferCheckRequest, "type">;
|
|
187
|
+
/** Request parameters for the {@linkcode InfoClient.recentTrades} method. */
|
|
188
|
+
export type RecentTradesParameters = Omit<RecentTradesRequest, "type">;
|
|
189
|
+
/** Request parameters for the {@linkcode InfoClient.referral} method. */
|
|
190
|
+
export type ReferralParameters = Omit<ReferralRequest, "type">;
|
|
191
|
+
/** Request parameters for the {@linkcode InfoClient.spotClearinghouseState} method. */
|
|
192
|
+
export type SpotClearinghouseStateParameters = Omit<SpotClearinghouseStateRequest, "type">;
|
|
193
|
+
/** Request parameters for the {@linkcode InfoClient.spotDeployState} method. */
|
|
194
|
+
export type SpotDeployStateParameters = Omit<SpotDeployStateRequest, "type">;
|
|
195
|
+
/** Request parameters for the {@linkcode InfoClient.subAccounts} method. */
|
|
196
|
+
export type SubAccountsParameters = Omit<SubAccountsRequest, "type">;
|
|
197
|
+
/** Request parameters for the {@linkcode InfoClient.tokenDetails} method. */
|
|
198
|
+
export type TokenDetailsParameters = Omit<TokenDetailsRequest, "type">;
|
|
199
|
+
/** Request parameters for the {@linkcode InfoClient.twapHistory} method. */
|
|
200
|
+
export type TwapHistoryParameters = Omit<TwapHistoryRequest, "type">;
|
|
201
|
+
/** Request parameters for the {@linkcode InfoClient.txDetails} method. */
|
|
202
|
+
export type TxDetailsParameters = Omit<TxDetailsRequest, "type">;
|
|
203
|
+
/** Request parameters for the {@linkcode InfoClient.userDetails} method. */
|
|
204
|
+
export type UserDetailsParameters = Omit<UserDetailsRequest, "type">;
|
|
205
|
+
/** Request parameters for the {@linkcode InfoClient.userFees} method. */
|
|
206
|
+
export type UserFeesParameters = Omit<UserFeesRequest, "type">;
|
|
207
|
+
/** Request parameters for the {@linkcode InfoClient.userFills} method. */
|
|
208
|
+
export type UserFillsParameters = Omit<UserFillsRequest, "type">;
|
|
209
|
+
/** Request parameters for the {@linkcode InfoClient.userFillsByTime} method. */
|
|
210
|
+
export type UserFillsByTimeParameters = Omit<UserFillsByTimeRequest, "type">;
|
|
211
|
+
/** Request parameters for the {@linkcode InfoClient.userFunding} method. */
|
|
212
|
+
export type UserFundingParameters = Omit<UserFundingRequest, "type">;
|
|
213
|
+
/** Request parameters for the {@linkcode InfoClient.userNonFundingLedgerUpdates} method. */
|
|
214
|
+
export type UserNonFundingLedgerUpdatesParameters = Omit<UserNonFundingLedgerUpdatesRequest, "type">;
|
|
215
|
+
/** Request parameters for the {@linkcode InfoClient.userRateLimit} method. */
|
|
216
|
+
export type UserRateLimitParameters = Omit<UserRateLimitRequest, "type">;
|
|
217
|
+
/** Request parameters for the {@linkcode InfoClient.userRole} method. */
|
|
218
|
+
export type UserRoleParameters = Omit<UserRoleRequest, "type">;
|
|
219
|
+
/** Request parameters for the {@linkcode InfoClient.userToMultiSigSigners} method. */
|
|
220
|
+
export type UserToMultiSigSignersParameters = Omit<UserToMultiSigSignersRequest, "type">;
|
|
221
|
+
/** Request parameters for the {@linkcode InfoClient.userTwapSliceFills} method. */
|
|
222
|
+
export type UserTwapSliceFillsParameters = Omit<UserTwapSliceFillsRequest, "type">;
|
|
223
|
+
/** Request parameters for the {@linkcode InfoClient.userTwapSliceFillsByTime} method. */
|
|
224
|
+
export type UserTwapSliceFillsByTimeParameters = Omit<UserTwapSliceFillsByTimeRequest, "type">;
|
|
225
|
+
/** Request parameters for the {@linkcode InfoClient.userVaultEquities} method. */
|
|
226
|
+
export type UserVaultEquitiesParameters = Omit<UserVaultEquitiesRequest, "type">;
|
|
227
|
+
/** Request parameters for the {@linkcode InfoClient.vaultDetails} method. */
|
|
228
|
+
export type VaultDetailsParameters = Omit<VaultDetailsRequest, "type">;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Info client for interacting with the Hyperliquid API.
|
|
232
|
+
* @typeParam T The type of transport used to connect to the Hyperliquid API.
|
|
233
|
+
*/
|
|
234
|
+
export class InfoClient<
|
|
235
|
+
T extends IRequestTransport = IRequestTransport,
|
|
236
|
+
> implements InfoClientParameters<T>, AsyncDisposable {
|
|
237
|
+
transport: T;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Initialises a new instance.
|
|
241
|
+
* @param args - The arguments for initialisation.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
246
|
+
*
|
|
247
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
248
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
constructor(args: InfoClientParameters<T>) {
|
|
252
|
+
this.transport = args.transport;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Request user active asset data.
|
|
257
|
+
* @param params - An optional request-specific parameters.
|
|
258
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
259
|
+
* @returns User active asset data.
|
|
260
|
+
*
|
|
261
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
262
|
+
*
|
|
263
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data
|
|
264
|
+
* @example
|
|
265
|
+
* ```ts
|
|
266
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
267
|
+
*
|
|
268
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
269
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
270
|
+
*
|
|
271
|
+
* const data = await infoClient.activeAssetData({ user: "0x...", coin: "ETH" });
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
activeAssetData(
|
|
275
|
+
params: DeepImmutable<ActiveAssetDataParameters>,
|
|
276
|
+
signal?: AbortSignal,
|
|
277
|
+
): Promise<ActiveAssetData> {
|
|
278
|
+
const request = parser(ActiveAssetDataRequest)({
|
|
279
|
+
type: "activeAssetData",
|
|
280
|
+
...params,
|
|
281
|
+
});
|
|
282
|
+
return this.transport.request("info", request, signal);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Request mid coin prices.
|
|
287
|
+
* @param params - An optional request-specific parameters.
|
|
288
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
289
|
+
* @returns Mapping of coin symbols to mid prices.
|
|
290
|
+
*
|
|
291
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
292
|
+
*
|
|
293
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
297
|
+
*
|
|
298
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
299
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
300
|
+
*
|
|
301
|
+
* const data = await infoClient.allMids();
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
allMids(params?: DeepImmutable<AllMidsParameters>, signal?: AbortSignal): Promise<AllMids>;
|
|
305
|
+
allMids(signal?: AbortSignal): Promise<AllMids>;
|
|
306
|
+
allMids(
|
|
307
|
+
params_or_signal?: DeepImmutable<AllMidsParameters> | AbortSignal,
|
|
308
|
+
maybeSignal?: AbortSignal,
|
|
309
|
+
): Promise<AllMids> {
|
|
310
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
311
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
312
|
+
|
|
313
|
+
const request = parser(AllMidsRequest)({
|
|
314
|
+
type: "allMids",
|
|
315
|
+
...params,
|
|
316
|
+
});
|
|
317
|
+
return this.transport.request("info", request, signal);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Block details by block height.
|
|
322
|
+
* @param params - Request-specific parameters.
|
|
323
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
324
|
+
* @returns Block details.
|
|
325
|
+
*
|
|
326
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
327
|
+
*
|
|
328
|
+
* @see null
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
332
|
+
*
|
|
333
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
334
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
335
|
+
*
|
|
336
|
+
* const data = await infoClient.blockDetails({ height: 123 });
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
blockDetails(
|
|
340
|
+
// allow only those transports that support `explorer` requests
|
|
341
|
+
this: T extends { request(endpoint: "explorer", ...args: unknown[]): unknown } ? this : never,
|
|
342
|
+
params: DeepImmutable<BlockDetailsParameters>,
|
|
343
|
+
signal?: AbortSignal,
|
|
344
|
+
): Promise<BlockDetails> {
|
|
345
|
+
const request = parser(BlockDetailsRequest)({
|
|
346
|
+
type: "blockDetails",
|
|
347
|
+
...params,
|
|
348
|
+
});
|
|
349
|
+
return this.transport.request<BlockDetailsResponse>("explorer", request, signal)
|
|
350
|
+
.then(({ blockDetails }) => blockDetails);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Request candlestick snapshots.
|
|
355
|
+
* @param params - Request-specific parameters.
|
|
356
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
357
|
+
* @returns Array of candlestick data points.
|
|
358
|
+
*
|
|
359
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
360
|
+
*
|
|
361
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
365
|
+
*
|
|
366
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
367
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
368
|
+
*
|
|
369
|
+
* const data = await infoClient.candleSnapshot({
|
|
370
|
+
* coin: "ETH",
|
|
371
|
+
* interval: "1h",
|
|
372
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
373
|
+
* });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
candleSnapshot(
|
|
377
|
+
params: DeepImmutable<CandleSnapshotParameters>,
|
|
378
|
+
signal?: AbortSignal,
|
|
379
|
+
): Promise<Candle[]> {
|
|
380
|
+
const request = parser(CandleSnapshotRequest)({
|
|
381
|
+
type: "candleSnapshot",
|
|
382
|
+
req: params,
|
|
383
|
+
});
|
|
384
|
+
return this.transport.request("info", request, signal);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Request clearinghouse state.
|
|
389
|
+
* @param params - Request-specific parameters.
|
|
390
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
391
|
+
* @returns Account summary for perpetual trading.
|
|
392
|
+
*
|
|
393
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
394
|
+
*
|
|
395
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
|
396
|
+
* @example
|
|
397
|
+
* ```ts
|
|
398
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
399
|
+
*
|
|
400
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
401
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
402
|
+
*
|
|
403
|
+
* const data = await infoClient.clearinghouseState({ user: "0x..." });
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
clearinghouseState(
|
|
407
|
+
params: DeepImmutable<ClearinghouseStateParameters>,
|
|
408
|
+
signal?: AbortSignal,
|
|
409
|
+
): Promise<PerpsClearinghouseState> {
|
|
410
|
+
const request = parser(ClearinghouseStateRequest)({
|
|
411
|
+
type: "clearinghouseState",
|
|
412
|
+
...params,
|
|
413
|
+
});
|
|
414
|
+
return this.transport.request("info", request, signal);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Request user staking delegations.
|
|
419
|
+
* @param params - Request-specific parameters.
|
|
420
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
421
|
+
* @returns Array of user's delegations to validators.
|
|
422
|
+
*
|
|
423
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
424
|
+
*
|
|
425
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-delegations
|
|
426
|
+
* @example
|
|
427
|
+
* ```ts
|
|
428
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
429
|
+
*
|
|
430
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
431
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
432
|
+
*
|
|
433
|
+
* const data = await infoClient.delegations({ user: "0x..." });
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
delegations(
|
|
437
|
+
params: DeepImmutable<DelegationsParameters>,
|
|
438
|
+
signal?: AbortSignal,
|
|
439
|
+
): Promise<Delegation[]> {
|
|
440
|
+
const request = parser(DelegationsRequest)({
|
|
441
|
+
type: "delegations",
|
|
442
|
+
...params,
|
|
443
|
+
});
|
|
444
|
+
return this.transport.request("info", request, signal);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Request user staking history.
|
|
449
|
+
* @param params - Request-specific parameters.
|
|
450
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
451
|
+
* @returns Array of user's staking updates.
|
|
452
|
+
*
|
|
453
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
454
|
+
*
|
|
455
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-history
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
459
|
+
*
|
|
460
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
461
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
462
|
+
*
|
|
463
|
+
* const data = await infoClient.delegatorHistory({ user: "0x..." });
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
delegatorHistory(
|
|
467
|
+
params: DeepImmutable<DelegatorHistoryParameters>,
|
|
468
|
+
signal?: AbortSignal,
|
|
469
|
+
): Promise<DelegatorUpdate[]> {
|
|
470
|
+
const request = parser(DelegatorHistoryRequest)({
|
|
471
|
+
type: "delegatorHistory",
|
|
472
|
+
...params,
|
|
473
|
+
});
|
|
474
|
+
return this.transport.request("info", request, signal);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Request user staking rewards.
|
|
479
|
+
* @param params - Request-specific parameters.
|
|
480
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
481
|
+
* @returns Array of user's staking rewards.
|
|
482
|
+
*
|
|
483
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
484
|
+
*
|
|
485
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-rewards
|
|
486
|
+
* @example
|
|
487
|
+
* ```ts
|
|
488
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
489
|
+
*
|
|
490
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
491
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
492
|
+
*
|
|
493
|
+
* const data = await infoClient.delegatorRewards({ user: "0x..." });
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
delegatorRewards(
|
|
497
|
+
params: DeepImmutable<DelegatorRewardsParameters>,
|
|
498
|
+
signal?: AbortSignal,
|
|
499
|
+
): Promise<DelegatorReward[]> {
|
|
500
|
+
const request = parser(DelegatorRewardsRequest)({
|
|
501
|
+
type: "delegatorRewards",
|
|
502
|
+
...params,
|
|
503
|
+
});
|
|
504
|
+
return this.transport.request("info", request, signal);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Request user staking summary.
|
|
509
|
+
* @param params - Request-specific parameters.
|
|
510
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
511
|
+
* @returns Summary of a user's staking delegations.
|
|
512
|
+
*
|
|
513
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
514
|
+
*
|
|
515
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary
|
|
516
|
+
* @example
|
|
517
|
+
* ```ts
|
|
518
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
519
|
+
*
|
|
520
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
521
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
522
|
+
*
|
|
523
|
+
* const data = await infoClient.delegatorSummary({ user: "0x..." });
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
delegatorSummary(
|
|
527
|
+
params: DeepImmutable<DelegatorSummaryParameters>,
|
|
528
|
+
signal?: AbortSignal,
|
|
529
|
+
): Promise<DelegatorSummary> {
|
|
530
|
+
const request = parser(DelegatorSummaryRequest)({
|
|
531
|
+
type: "delegatorSummary",
|
|
532
|
+
...params,
|
|
533
|
+
});
|
|
534
|
+
return this.transport.request("info", request, signal);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Request exchange status information.
|
|
539
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
540
|
+
* @returns Exchange system status information.
|
|
541
|
+
*
|
|
542
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
543
|
+
*
|
|
544
|
+
* @see null
|
|
545
|
+
* @example
|
|
546
|
+
* ```ts
|
|
547
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
548
|
+
*
|
|
549
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
550
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
551
|
+
*
|
|
552
|
+
* const data = await infoClient.exchangeStatus();
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
exchangeStatus(signal?: AbortSignal): Promise<ExchangeStatus> {
|
|
556
|
+
const request = parser(ExchangeStatusRequest)({
|
|
557
|
+
type: "exchangeStatus",
|
|
558
|
+
});
|
|
559
|
+
return this.transport.request("info", request, signal);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Request user's extra agents.
|
|
564
|
+
* @param params - Request-specific parameters.
|
|
565
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
566
|
+
* @returns User's extra agents.
|
|
567
|
+
*
|
|
568
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
569
|
+
*
|
|
570
|
+
* @see null
|
|
571
|
+
* @example
|
|
572
|
+
* ```ts
|
|
573
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
574
|
+
*
|
|
575
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
576
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
577
|
+
*
|
|
578
|
+
* const data = await infoClient.extraAgents({ user: "0x..." });
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
extraAgents(
|
|
582
|
+
params: DeepImmutable<ExtraAgentsParameters>,
|
|
583
|
+
signal?: AbortSignal,
|
|
584
|
+
): Promise<ExtraAgent[]> {
|
|
585
|
+
const request = parser(ExtraAgentsRequest)({
|
|
586
|
+
type: "extraAgents",
|
|
587
|
+
...params,
|
|
588
|
+
});
|
|
589
|
+
return this.transport.request("info", request, signal);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Request frontend open orders.
|
|
594
|
+
* @param params - Request-specific parameters.
|
|
595
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
596
|
+
* @returns Array of open orders with additional frontend information.
|
|
597
|
+
*
|
|
598
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
599
|
+
*
|
|
600
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders-with-additional-frontend-info
|
|
601
|
+
* @example
|
|
602
|
+
* ```ts
|
|
603
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
604
|
+
*
|
|
605
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
606
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
607
|
+
*
|
|
608
|
+
* const data = await infoClient.frontendOpenOrders({ user: "0x..." });
|
|
609
|
+
* ```
|
|
610
|
+
*/
|
|
611
|
+
frontendOpenOrders(
|
|
612
|
+
params: DeepImmutable<FrontendOpenOrdersParameters>,
|
|
613
|
+
signal?: AbortSignal,
|
|
614
|
+
): Promise<FrontendOrder[]> {
|
|
615
|
+
const request = parser(FrontendOpenOrdersRequest)({
|
|
616
|
+
type: "frontendOpenOrders",
|
|
617
|
+
...params,
|
|
618
|
+
});
|
|
619
|
+
return this.transport.request("info", request, signal);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Request funding history.
|
|
624
|
+
* @param params - Request-specific parameters.
|
|
625
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
626
|
+
* @returns Array of historical funding rate data for an asset.
|
|
627
|
+
*
|
|
628
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
629
|
+
*
|
|
630
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates
|
|
631
|
+
* @example
|
|
632
|
+
* ```ts
|
|
633
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
634
|
+
*
|
|
635
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
636
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
637
|
+
*
|
|
638
|
+
* const data = await infoClient.fundingHistory({
|
|
639
|
+
* coin: "ETH",
|
|
640
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
641
|
+
* });
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
fundingHistory(
|
|
645
|
+
params: DeepImmutable<FundingHistoryParameters>,
|
|
646
|
+
signal?: AbortSignal,
|
|
647
|
+
): Promise<FundingHistory[]> {
|
|
648
|
+
const request = parser(FundingHistoryRequest)({
|
|
649
|
+
type: "fundingHistory",
|
|
650
|
+
...params,
|
|
651
|
+
});
|
|
652
|
+
return this.transport.request("info", request, signal);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Request gossip root IPs.
|
|
657
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
658
|
+
* @returns Array of gossip root IPs.
|
|
659
|
+
*
|
|
660
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
661
|
+
*
|
|
662
|
+
* @see null
|
|
663
|
+
* @example
|
|
664
|
+
* ```ts
|
|
665
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
666
|
+
*
|
|
667
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
668
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
669
|
+
*
|
|
670
|
+
* const data = await infoClient.gossipRootIps();
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
gossipRootIps(
|
|
674
|
+
signal?: AbortSignal,
|
|
675
|
+
): Promise<GossipRootIps> {
|
|
676
|
+
const request = parser(GossipRootIpsRequest)({
|
|
677
|
+
type: "gossipRootIps",
|
|
678
|
+
});
|
|
679
|
+
return this.transport.request("info", request, signal);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Request user's historical orders.
|
|
684
|
+
* @param params - Request-specific parameters.
|
|
685
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
686
|
+
* @returns Array of user's historical orders.
|
|
687
|
+
*
|
|
688
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
689
|
+
*
|
|
690
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders
|
|
691
|
+
* @example
|
|
692
|
+
* ```ts
|
|
693
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
694
|
+
*
|
|
695
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
696
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
697
|
+
*
|
|
698
|
+
* const data = await infoClient.historicalOrders({ user: "0x..." });
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
historicalOrders(
|
|
702
|
+
params: DeepImmutable<HistoricalOrdersParameters>,
|
|
703
|
+
signal?: AbortSignal,
|
|
704
|
+
): Promise<FrontendOrderStatus[]> {
|
|
705
|
+
const request = parser(HistoricalOrdersRequest)({
|
|
706
|
+
type: "historicalOrders",
|
|
707
|
+
...params,
|
|
708
|
+
});
|
|
709
|
+
return this.transport.request("info", request, signal);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Request to check if a user is a VIP.
|
|
714
|
+
* @param params - Request-specific parameters.
|
|
715
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
716
|
+
* @returns Boolean indicating user's VIP status.
|
|
717
|
+
*
|
|
718
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
719
|
+
*
|
|
720
|
+
* @see null
|
|
721
|
+
* @example
|
|
722
|
+
* ```ts
|
|
723
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
724
|
+
*
|
|
725
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
726
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
727
|
+
*
|
|
728
|
+
* const data = await infoClient.isVip({ user: "0x..." });
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
isVip(
|
|
732
|
+
params: DeepImmutable<IsVipParameters>,
|
|
733
|
+
signal?: AbortSignal,
|
|
734
|
+
): Promise<boolean | null> {
|
|
735
|
+
const request = parser(IsVipRequest)({
|
|
736
|
+
type: "isVip",
|
|
737
|
+
...params,
|
|
738
|
+
});
|
|
739
|
+
return this.transport.request("info", request, signal);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* Request L2 order book.
|
|
744
|
+
* @param params - Request-specific parameters.
|
|
745
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
746
|
+
* @returns L2 order book snapshot.
|
|
747
|
+
*
|
|
748
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
749
|
+
*
|
|
750
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot
|
|
751
|
+
* @example
|
|
752
|
+
* ```ts
|
|
753
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
754
|
+
*
|
|
755
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
756
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
757
|
+
*
|
|
758
|
+
* const data = await infoClient.l2Book({ coin: "ETH", nSigFigs: 2 });
|
|
759
|
+
* ```
|
|
760
|
+
*/
|
|
761
|
+
l2Book(
|
|
762
|
+
params: DeepImmutable<L2BookParameters>,
|
|
763
|
+
signal?: AbortSignal,
|
|
764
|
+
): Promise<Book> {
|
|
765
|
+
const request = parser(L2BookRequest)({
|
|
766
|
+
type: "l2Book",
|
|
767
|
+
...params,
|
|
768
|
+
});
|
|
769
|
+
return this.transport.request("info", request, signal);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Request leading vaults for a user.
|
|
774
|
+
* @param params - Request-specific parameters.
|
|
775
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
776
|
+
* @returns
|
|
777
|
+
*
|
|
778
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
779
|
+
*
|
|
780
|
+
* @see null
|
|
781
|
+
* @example
|
|
782
|
+
* ```ts
|
|
783
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
784
|
+
*
|
|
785
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
786
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
787
|
+
*
|
|
788
|
+
* const data = await infoClient.leadingVaults({ user: "0x..." });
|
|
789
|
+
* ```
|
|
790
|
+
*/
|
|
791
|
+
leadingVaults(
|
|
792
|
+
params: DeepImmutable<LeadingVaultsParameters>,
|
|
793
|
+
signal?: AbortSignal,
|
|
794
|
+
): Promise<VaultLeading[]> {
|
|
795
|
+
const request = parser(LeadingVaultsRequest)({
|
|
796
|
+
type: "leadingVaults",
|
|
797
|
+
...params,
|
|
798
|
+
});
|
|
799
|
+
return this.transport.request("info", request, signal);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Request legal verification status of a user.
|
|
804
|
+
* @param params - Request-specific parameters.
|
|
805
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
806
|
+
* @returns Legal verification status for a user.
|
|
807
|
+
*
|
|
808
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
809
|
+
*
|
|
810
|
+
* @see null
|
|
811
|
+
* @example
|
|
812
|
+
* ```ts
|
|
813
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
814
|
+
*
|
|
815
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
816
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
817
|
+
*
|
|
818
|
+
* const data = await infoClient.legalCheck({ user: "0x..." });
|
|
819
|
+
* ```
|
|
820
|
+
*/
|
|
821
|
+
legalCheck(
|
|
822
|
+
params: DeepImmutable<LegalCheckParameters>,
|
|
823
|
+
signal?: AbortSignal,
|
|
824
|
+
): Promise<LegalCheck> {
|
|
825
|
+
const request = parser(LegalCheckRequest)({
|
|
826
|
+
type: "legalCheck",
|
|
827
|
+
...params,
|
|
828
|
+
});
|
|
829
|
+
return this.transport.request("info", request, signal);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Request liquidatable.
|
|
834
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
835
|
+
* @returns
|
|
836
|
+
*
|
|
837
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
838
|
+
*
|
|
839
|
+
* @see null
|
|
840
|
+
* @example
|
|
841
|
+
* ```ts
|
|
842
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
843
|
+
*
|
|
844
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
845
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
846
|
+
*
|
|
847
|
+
* const data = await infoClient.liquidatable();
|
|
848
|
+
* ```
|
|
849
|
+
*/
|
|
850
|
+
liquidatable(signal?: AbortSignal): Promise<unknown[]> {
|
|
851
|
+
const request = parser(LiquidatableRequest)({
|
|
852
|
+
type: "liquidatable",
|
|
853
|
+
});
|
|
854
|
+
return this.transport.request("info", request, signal);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Request margin table data.
|
|
859
|
+
* @param params - Request-specific parameters.
|
|
860
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
861
|
+
* @returns Margin requirements table with multiple tiers.
|
|
862
|
+
*
|
|
863
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
864
|
+
*
|
|
865
|
+
* @see null
|
|
866
|
+
* @example
|
|
867
|
+
* ```ts
|
|
868
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
869
|
+
*
|
|
870
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
871
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
872
|
+
*
|
|
873
|
+
* const data = await infoClient.marginTable({ id: 1 });
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
marginTable(
|
|
877
|
+
params: DeepImmutable<MarginTableParameters>,
|
|
878
|
+
signal?: AbortSignal,
|
|
879
|
+
): Promise<MarginTable> {
|
|
880
|
+
const request = parser(MarginTableRequest)({
|
|
881
|
+
type: "marginTable",
|
|
882
|
+
...params,
|
|
883
|
+
});
|
|
884
|
+
return this.transport.request("info", request, signal);
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Request builder fee approval.
|
|
889
|
+
* @param params - Request-specific parameters.
|
|
890
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
891
|
+
* @returns Maximum builder fee approval.
|
|
892
|
+
*
|
|
893
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
894
|
+
*
|
|
895
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#check-builder-fee-approval
|
|
896
|
+
* @example
|
|
897
|
+
* ```ts
|
|
898
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
899
|
+
*
|
|
900
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
901
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
902
|
+
*
|
|
903
|
+
* const data = await infoClient.maxBuilderFee({ user: "0x...", builder: "0x..." });
|
|
904
|
+
* ```
|
|
905
|
+
*/
|
|
906
|
+
maxBuilderFee(
|
|
907
|
+
params: DeepImmutable<MaxBuilderFeeParameters>,
|
|
908
|
+
signal?: AbortSignal,
|
|
909
|
+
): Promise<number> {
|
|
910
|
+
const request = parser(MaxBuilderFeeRequest)({
|
|
911
|
+
type: "maxBuilderFee",
|
|
912
|
+
...params,
|
|
913
|
+
});
|
|
914
|
+
return this.transport.request("info", request, signal);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Request maximum market order notionals.
|
|
919
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
920
|
+
* @returns
|
|
921
|
+
*
|
|
922
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
923
|
+
*
|
|
924
|
+
* @see null
|
|
925
|
+
* @example
|
|
926
|
+
* ```ts
|
|
927
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
928
|
+
*
|
|
929
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
930
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
931
|
+
*
|
|
932
|
+
* const data = await infoClient.maxMarketOrderNtls();
|
|
933
|
+
* ```
|
|
934
|
+
*/
|
|
935
|
+
maxMarketOrderNtls(signal?: AbortSignal): Promise<[number, string][]> {
|
|
936
|
+
const request = parser(MaxMarketOrderNtlsRequest)({
|
|
937
|
+
type: "maxMarketOrderNtls",
|
|
938
|
+
});
|
|
939
|
+
return this.transport.request("info", request, signal);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Request trading metadata.
|
|
944
|
+
* @param params - An optional request-specific parameters.
|
|
945
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
946
|
+
* @returns Metadata for perpetual assets.
|
|
947
|
+
*
|
|
948
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
949
|
+
*
|
|
950
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables
|
|
951
|
+
* @example
|
|
952
|
+
* ```ts
|
|
953
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
954
|
+
*
|
|
955
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
956
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
957
|
+
*
|
|
958
|
+
* const data = await infoClient.meta();
|
|
959
|
+
* ```
|
|
960
|
+
*/
|
|
961
|
+
meta(params?: DeepImmutable<MetaParameters>, signal?: AbortSignal): Promise<PerpsMeta>;
|
|
962
|
+
meta(signal?: AbortSignal): Promise<PerpsMeta>;
|
|
963
|
+
meta(
|
|
964
|
+
params_or_signal?: DeepImmutable<MetaParameters> | AbortSignal,
|
|
965
|
+
maybeSignal?: AbortSignal,
|
|
966
|
+
): Promise<PerpsMeta> {
|
|
967
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
968
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
969
|
+
|
|
970
|
+
const request = parser(MetaRequest)({
|
|
971
|
+
type: "meta",
|
|
972
|
+
...params,
|
|
973
|
+
});
|
|
974
|
+
return this.transport.request("info", request, signal);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Request metadata and asset contexts.
|
|
979
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
980
|
+
* @returns Metadata and context for perpetual assets.
|
|
981
|
+
*
|
|
982
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
983
|
+
*
|
|
984
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
|
985
|
+
* @example
|
|
986
|
+
* ```ts
|
|
987
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
988
|
+
*
|
|
989
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
990
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
991
|
+
*
|
|
992
|
+
* const data = await infoClient.metaAndAssetCtxs();
|
|
993
|
+
* ```
|
|
994
|
+
*/
|
|
995
|
+
metaAndAssetCtxs(
|
|
996
|
+
params?: DeepImmutable<MetaAndAssetCtxsParameters>,
|
|
997
|
+
signal?: AbortSignal,
|
|
998
|
+
): Promise<PerpsMetaAndAssetCtxs>;
|
|
999
|
+
metaAndAssetCtxs(signal?: AbortSignal): Promise<PerpsMetaAndAssetCtxs>;
|
|
1000
|
+
metaAndAssetCtxs(
|
|
1001
|
+
params_or_signal?: DeepImmutable<MetaAndAssetCtxsParameters> | AbortSignal,
|
|
1002
|
+
maybeSignal?: AbortSignal,
|
|
1003
|
+
): Promise<PerpsMetaAndAssetCtxs> {
|
|
1004
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
1005
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
1006
|
+
|
|
1007
|
+
const request = parser(MetaAndAssetCtxsRequest)({
|
|
1008
|
+
type: "metaAndAssetCtxs",
|
|
1009
|
+
...params,
|
|
1010
|
+
});
|
|
1011
|
+
return this.transport.request("info", request, signal);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Request open orders.
|
|
1016
|
+
* @param params - Request-specific parameters.
|
|
1017
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1018
|
+
* @returns Array of open order.
|
|
1019
|
+
*
|
|
1020
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1021
|
+
*
|
|
1022
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```ts
|
|
1025
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1026
|
+
*
|
|
1027
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1028
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1029
|
+
*
|
|
1030
|
+
* const data = await infoClient.openOrders({ user: "0x..." });
|
|
1031
|
+
* ```
|
|
1032
|
+
*/
|
|
1033
|
+
openOrders(
|
|
1034
|
+
params: DeepImmutable<OpenOrdersParameters>,
|
|
1035
|
+
signal?: AbortSignal,
|
|
1036
|
+
): Promise<Order[]> {
|
|
1037
|
+
const request = parser(OpenOrdersRequest)({
|
|
1038
|
+
type: "openOrders",
|
|
1039
|
+
...params,
|
|
1040
|
+
});
|
|
1041
|
+
return this.transport.request("info", request, signal);
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Request order status.
|
|
1046
|
+
* @param params - Request-specific parameters.
|
|
1047
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1048
|
+
* @returns Result of an order status lookup.
|
|
1049
|
+
*
|
|
1050
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1051
|
+
*
|
|
1052
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid
|
|
1053
|
+
* @example
|
|
1054
|
+
* ```ts
|
|
1055
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1056
|
+
*
|
|
1057
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1058
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1059
|
+
*
|
|
1060
|
+
* const data = await infoClient.orderStatus({ user: "0x...", oid: 12345 });
|
|
1061
|
+
* ```
|
|
1062
|
+
*/
|
|
1063
|
+
orderStatus(
|
|
1064
|
+
params: DeepImmutable<OrderStatusParameters>,
|
|
1065
|
+
signal?: AbortSignal,
|
|
1066
|
+
): Promise<OrderLookup> {
|
|
1067
|
+
const request = parser(OrderStatusRequest)({
|
|
1068
|
+
type: "orderStatus",
|
|
1069
|
+
...params,
|
|
1070
|
+
});
|
|
1071
|
+
return this.transport.request("info", request, signal);
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Request for the status of the perpetual deploy auction.
|
|
1076
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1077
|
+
* @returns Status of the perpetual deploy auction.
|
|
1078
|
+
*
|
|
1079
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1080
|
+
*
|
|
1081
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-information-about-the-perp-deploy-auction
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```ts
|
|
1084
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1085
|
+
*
|
|
1086
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1087
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1088
|
+
*
|
|
1089
|
+
* const data = await infoClient.perpDeployAuctionStatus();
|
|
1090
|
+
* ```
|
|
1091
|
+
*/
|
|
1092
|
+
perpDeployAuctionStatus(signal?: AbortSignal): Promise<DeployAuctionStatus> {
|
|
1093
|
+
const request = parser(PerpDeployAuctionStatusRequest)({
|
|
1094
|
+
type: "perpDeployAuctionStatus",
|
|
1095
|
+
});
|
|
1096
|
+
return this.transport.request("info", request, signal);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Request builder deployed perpetual market limits.
|
|
1101
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1102
|
+
* @returns Status of the perpetual deploy auction.
|
|
1103
|
+
*
|
|
1104
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1105
|
+
*
|
|
1106
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-builder-deployed-perp-market-limits
|
|
1107
|
+
* @example
|
|
1108
|
+
* ```ts
|
|
1109
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1110
|
+
*
|
|
1111
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1112
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1113
|
+
*
|
|
1114
|
+
* const data = await infoClient.perpDexLimits({ dex: "test" });
|
|
1115
|
+
* ```
|
|
1116
|
+
*/
|
|
1117
|
+
perpDexLimits(
|
|
1118
|
+
params: DeepImmutable<PerpDexLimitsParameters>,
|
|
1119
|
+
signal?: AbortSignal,
|
|
1120
|
+
): Promise<PerpDexLimits | null> {
|
|
1121
|
+
const request = parser(PerpDexLimitsRequest)({
|
|
1122
|
+
type: "perpDexLimits",
|
|
1123
|
+
...params,
|
|
1124
|
+
});
|
|
1125
|
+
return this.transport.request("info", request, signal);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Request all perpetual dexs.
|
|
1130
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1131
|
+
* @returns Array of perpetual dexes (null is main dex).
|
|
1132
|
+
*
|
|
1133
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1134
|
+
*
|
|
1135
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-all-perpetual-dexs
|
|
1136
|
+
* @example
|
|
1137
|
+
* ```ts
|
|
1138
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1139
|
+
*
|
|
1140
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1141
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1142
|
+
*
|
|
1143
|
+
* const data = await infoClient.perpDexs();
|
|
1144
|
+
* ```
|
|
1145
|
+
*/
|
|
1146
|
+
perpDexs(signal?: AbortSignal): Promise<(PerpDex | null)[]> {
|
|
1147
|
+
const request = parser(PerpDexsRequest)({
|
|
1148
|
+
type: "perpDexs",
|
|
1149
|
+
});
|
|
1150
|
+
return this.transport.request("info", request, signal);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Request perpetuals at open interest cap.
|
|
1155
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1156
|
+
* @returns Array of perpetuals at open interest caps.
|
|
1157
|
+
*
|
|
1158
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1159
|
+
*
|
|
1160
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#query-perps-at-open-interest-caps
|
|
1161
|
+
* @example
|
|
1162
|
+
* ```ts
|
|
1163
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1164
|
+
*
|
|
1165
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1166
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1167
|
+
*
|
|
1168
|
+
* const data = await infoClient.perpsAtOpenInterestCap();
|
|
1169
|
+
* ```
|
|
1170
|
+
*/
|
|
1171
|
+
perpsAtOpenInterestCap(
|
|
1172
|
+
params?: DeepImmutable<PerpsAtOpenInterestCapParameters>,
|
|
1173
|
+
signal?: AbortSignal,
|
|
1174
|
+
): Promise<string[]>;
|
|
1175
|
+
perpsAtOpenInterestCap(signal?: AbortSignal): Promise<string[]>;
|
|
1176
|
+
perpsAtOpenInterestCap(
|
|
1177
|
+
params_or_signal?: DeepImmutable<PerpsAtOpenInterestCapParameters> | AbortSignal,
|
|
1178
|
+
maybeSignal?: AbortSignal,
|
|
1179
|
+
): Promise<string[]> {
|
|
1180
|
+
const params = params_or_signal instanceof AbortSignal ? {} : params_or_signal;
|
|
1181
|
+
const signal = params_or_signal instanceof AbortSignal ? params_or_signal : maybeSignal;
|
|
1182
|
+
|
|
1183
|
+
const request = parser(PerpsAtOpenInterestCapRequest)({
|
|
1184
|
+
type: "perpsAtOpenInterestCap",
|
|
1185
|
+
...params,
|
|
1186
|
+
});
|
|
1187
|
+
return this.transport.request("info", request, signal);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* Request user portfolio.
|
|
1192
|
+
* @param params - Request-specific parameters.
|
|
1193
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1194
|
+
* @returns Portfolio metrics grouped by time periods.
|
|
1195
|
+
*
|
|
1196
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1197
|
+
*
|
|
1198
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-portfolio
|
|
1199
|
+
* @example
|
|
1200
|
+
* ```ts
|
|
1201
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1202
|
+
*
|
|
1203
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1204
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1205
|
+
*
|
|
1206
|
+
* const data = await infoClient.portfolio({ user: "0x..." });
|
|
1207
|
+
* ```
|
|
1208
|
+
*/
|
|
1209
|
+
portfolio(
|
|
1210
|
+
params: DeepImmutable<PortfolioParameters>,
|
|
1211
|
+
signal?: AbortSignal,
|
|
1212
|
+
): Promise<PortfolioPeriods> {
|
|
1213
|
+
const request = parser(PortfolioRequest)({
|
|
1214
|
+
type: "portfolio",
|
|
1215
|
+
...params,
|
|
1216
|
+
});
|
|
1217
|
+
return this.transport.request("info", request, signal);
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Request predicted funding rates.
|
|
1222
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1223
|
+
* @returns Array of predicted funding rates.
|
|
1224
|
+
*
|
|
1225
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1226
|
+
*
|
|
1227
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-predicted-funding-rates-for-different-venues
|
|
1228
|
+
* @example
|
|
1229
|
+
* ```ts
|
|
1230
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1231
|
+
*
|
|
1232
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1233
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1234
|
+
*
|
|
1235
|
+
* const data = await infoClient.predictedFundings();
|
|
1236
|
+
* ```
|
|
1237
|
+
*/
|
|
1238
|
+
predictedFundings(signal?: AbortSignal): Promise<PredictedFunding[]> {
|
|
1239
|
+
const request = parser(PredictedFundingsRequest)({
|
|
1240
|
+
type: "predictedFundings",
|
|
1241
|
+
});
|
|
1242
|
+
return this.transport.request("info", request, signal);
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Request user's existence check before transfer.
|
|
1247
|
+
* @param params - Request-specific parameters.
|
|
1248
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1249
|
+
* @returns Pre-transfer user existence check result.
|
|
1250
|
+
*
|
|
1251
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1252
|
+
*
|
|
1253
|
+
* @see null
|
|
1254
|
+
* @example
|
|
1255
|
+
* ```ts
|
|
1256
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1257
|
+
*
|
|
1258
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1259
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1260
|
+
*
|
|
1261
|
+
* const data = await infoClient.preTransferCheck({ user: "0x...", source: "0x..." });
|
|
1262
|
+
* ```
|
|
1263
|
+
*/
|
|
1264
|
+
preTransferCheck(
|
|
1265
|
+
params: DeepImmutable<PreTransferCheckParameters>,
|
|
1266
|
+
signal?: AbortSignal,
|
|
1267
|
+
): Promise<PreTransferCheck> {
|
|
1268
|
+
const request = parser(PreTransferCheckRequest)({
|
|
1269
|
+
type: "preTransferCheck",
|
|
1270
|
+
...params,
|
|
1271
|
+
});
|
|
1272
|
+
return this.transport.request("info", request, signal);
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
/**
|
|
1276
|
+
* Request recent trades.
|
|
1277
|
+
* @param params - Request-specific parameters.
|
|
1278
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1279
|
+
* @returns Array of recent trades.
|
|
1280
|
+
*
|
|
1281
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1282
|
+
*
|
|
1283
|
+
* @see null
|
|
1284
|
+
* @example
|
|
1285
|
+
* ```ts
|
|
1286
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1287
|
+
*
|
|
1288
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1289
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1290
|
+
*
|
|
1291
|
+
* const data = await infoClient.recentTrades({ coin: "ETH" });
|
|
1292
|
+
* ```
|
|
1293
|
+
*/
|
|
1294
|
+
recentTrades(
|
|
1295
|
+
params: DeepImmutable<RecentTradesParameters>,
|
|
1296
|
+
signal?: AbortSignal,
|
|
1297
|
+
): Promise<Trade[]> {
|
|
1298
|
+
const request = parser(RecentTradesRequest)({
|
|
1299
|
+
type: "recentTrades",
|
|
1300
|
+
...params,
|
|
1301
|
+
});
|
|
1302
|
+
return this.transport.request("info", request, signal);
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Request user referral.
|
|
1307
|
+
* @param params - Request-specific parameters.
|
|
1308
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1309
|
+
* @returns Referral information for a user.
|
|
1310
|
+
*
|
|
1311
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1312
|
+
*
|
|
1313
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-referral-information
|
|
1314
|
+
* @example
|
|
1315
|
+
* ```ts
|
|
1316
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1317
|
+
*
|
|
1318
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1319
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1320
|
+
*
|
|
1321
|
+
* const data = await infoClient.referral({ user: "0x..." });
|
|
1322
|
+
* ```
|
|
1323
|
+
*/
|
|
1324
|
+
referral(
|
|
1325
|
+
params: DeepImmutable<ReferralParameters>,
|
|
1326
|
+
signal?: AbortSignal,
|
|
1327
|
+
): Promise<Referral> {
|
|
1328
|
+
const request = parser(ReferralRequest)({
|
|
1329
|
+
type: "referral",
|
|
1330
|
+
...params,
|
|
1331
|
+
});
|
|
1332
|
+
return this.transport.request("info", request, signal);
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Request spot clearinghouse state.
|
|
1337
|
+
* @param params - Request-specific parameters.
|
|
1338
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1339
|
+
* @returns Account summary for spot trading.
|
|
1340
|
+
*
|
|
1341
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1342
|
+
*
|
|
1343
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances
|
|
1344
|
+
* @example
|
|
1345
|
+
* ```ts
|
|
1346
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1347
|
+
*
|
|
1348
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1349
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1350
|
+
*
|
|
1351
|
+
* const data = await infoClient.spotClearinghouseState({ user: "0x..." });
|
|
1352
|
+
* ```
|
|
1353
|
+
*/
|
|
1354
|
+
spotClearinghouseState(
|
|
1355
|
+
params: DeepImmutable<SpotClearinghouseStateParameters>,
|
|
1356
|
+
signal?: AbortSignal,
|
|
1357
|
+
): Promise<SpotClearinghouseState> {
|
|
1358
|
+
const request = parser(SpotClearinghouseStateRequest)({
|
|
1359
|
+
type: "spotClearinghouseState",
|
|
1360
|
+
...params,
|
|
1361
|
+
});
|
|
1362
|
+
return this.transport.request("info", request, signal);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* Request spot deploy state.
|
|
1367
|
+
* @param params - Request-specific parameters.
|
|
1368
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1369
|
+
* @returns Deploy state for spot tokens.
|
|
1370
|
+
*
|
|
1371
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1372
|
+
*
|
|
1373
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-deploy-auction
|
|
1374
|
+
* @example
|
|
1375
|
+
* ```ts
|
|
1376
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1377
|
+
*
|
|
1378
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1379
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1380
|
+
*
|
|
1381
|
+
* const data = await infoClient.spotDeployState({ user: "0x..." });
|
|
1382
|
+
* ```
|
|
1383
|
+
*/
|
|
1384
|
+
spotDeployState(
|
|
1385
|
+
params: DeepImmutable<SpotDeployStateParameters>,
|
|
1386
|
+
signal?: AbortSignal,
|
|
1387
|
+
): Promise<SpotDeployState> {
|
|
1388
|
+
const request = parser(SpotDeployStateRequest)({
|
|
1389
|
+
type: "spotDeployState",
|
|
1390
|
+
...params,
|
|
1391
|
+
});
|
|
1392
|
+
return this.transport.request("info", request, signal);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Request spot trading metadata.
|
|
1397
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1398
|
+
* @returns Metadata for spot assets.
|
|
1399
|
+
*
|
|
1400
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1401
|
+
*
|
|
1402
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-metadata
|
|
1403
|
+
* @example
|
|
1404
|
+
* ```ts
|
|
1405
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1406
|
+
*
|
|
1407
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1408
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1409
|
+
*
|
|
1410
|
+
* const data = await infoClient.spotMeta();
|
|
1411
|
+
* ```
|
|
1412
|
+
*/
|
|
1413
|
+
spotMeta(signal?: AbortSignal): Promise<SpotMeta> {
|
|
1414
|
+
const request = parser(SpotMetaRequest)({
|
|
1415
|
+
type: "spotMeta",
|
|
1416
|
+
});
|
|
1417
|
+
return this.transport.request("info", request, signal);
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* Request spot metadata and asset contexts.
|
|
1422
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1423
|
+
* @returns Metadata and context for spot assets.
|
|
1424
|
+
*
|
|
1425
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1426
|
+
*
|
|
1427
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
|
1428
|
+
* @example
|
|
1429
|
+
* ```ts
|
|
1430
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1431
|
+
*
|
|
1432
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1433
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1434
|
+
*
|
|
1435
|
+
* const data = await infoClient.spotMetaAndAssetCtxs();
|
|
1436
|
+
* ```
|
|
1437
|
+
*/
|
|
1438
|
+
spotMetaAndAssetCtxs(signal?: AbortSignal): Promise<SpotMetaAndAssetCtxs> {
|
|
1439
|
+
const request = parser(SpotMetaAndAssetCtxsRequest)({
|
|
1440
|
+
type: "spotMetaAndAssetCtxs",
|
|
1441
|
+
});
|
|
1442
|
+
return this.transport.request("info", request, signal);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Request for the status of the spot deploy auction.
|
|
1447
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1448
|
+
* @returns Status of the spot deploy auction.
|
|
1449
|
+
*
|
|
1450
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1451
|
+
*
|
|
1452
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-pair-deploy-auction
|
|
1453
|
+
* @example
|
|
1454
|
+
* ```ts
|
|
1455
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1456
|
+
*
|
|
1457
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1458
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1459
|
+
*
|
|
1460
|
+
* const data = await infoClient.spotPairDeployAuctionStatus();
|
|
1461
|
+
* ```
|
|
1462
|
+
*/
|
|
1463
|
+
spotPairDeployAuctionStatus(signal?: AbortSignal): Promise<DeployAuctionStatus> {
|
|
1464
|
+
const request = parser(SpotPairDeployAuctionStatusRequest)({
|
|
1465
|
+
type: "spotPairDeployAuctionStatus",
|
|
1466
|
+
});
|
|
1467
|
+
return this.transport.request("info", request, signal);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
/**
|
|
1471
|
+
* Request user sub-accounts.
|
|
1472
|
+
* @param params - Request-specific parameters.
|
|
1473
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1474
|
+
* @returns Array of user sub-account or null if the user does not have any sub-accounts.
|
|
1475
|
+
*
|
|
1476
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1477
|
+
*
|
|
1478
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-subaccounts
|
|
1479
|
+
* @example
|
|
1480
|
+
* ```ts
|
|
1481
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1482
|
+
*
|
|
1483
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1484
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1485
|
+
*
|
|
1486
|
+
* const data = await infoClient.subAccounts({ user: "0x..." });
|
|
1487
|
+
* ```
|
|
1488
|
+
*/
|
|
1489
|
+
subAccounts(
|
|
1490
|
+
params: DeepImmutable<SubAccountsParameters>,
|
|
1491
|
+
signal?: AbortSignal,
|
|
1492
|
+
): Promise<SubAccount[] | null> {
|
|
1493
|
+
const request = parser(SubAccountsRequest)({
|
|
1494
|
+
type: "subAccounts",
|
|
1495
|
+
...params,
|
|
1496
|
+
});
|
|
1497
|
+
return this.transport.request("info", request, signal);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Request token details.
|
|
1502
|
+
* @param params - Request-specific parameters.
|
|
1503
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1504
|
+
* @returns Details of a token.
|
|
1505
|
+
*
|
|
1506
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1507
|
+
*
|
|
1508
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-token
|
|
1509
|
+
* @example
|
|
1510
|
+
* ```ts
|
|
1511
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1512
|
+
*
|
|
1513
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1514
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1515
|
+
*
|
|
1516
|
+
* const data = await infoClient.tokenDetails({ tokenId: "0x..." });
|
|
1517
|
+
* ```
|
|
1518
|
+
*/
|
|
1519
|
+
tokenDetails(
|
|
1520
|
+
params: DeepImmutable<TokenDetailsParameters>,
|
|
1521
|
+
signal?: AbortSignal,
|
|
1522
|
+
): Promise<TokenDetails> {
|
|
1523
|
+
const request = parser(TokenDetailsRequest)({
|
|
1524
|
+
type: "tokenDetails",
|
|
1525
|
+
...params,
|
|
1526
|
+
});
|
|
1527
|
+
return this.transport.request("info", request, signal);
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Request twap history of a user.
|
|
1532
|
+
* @param params - Request-specific parameters.
|
|
1533
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1534
|
+
* @returns Array of user's TWAP history.
|
|
1535
|
+
*
|
|
1536
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1537
|
+
*
|
|
1538
|
+
* @see null
|
|
1539
|
+
* @example
|
|
1540
|
+
* ```ts
|
|
1541
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1542
|
+
*
|
|
1543
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1544
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1545
|
+
*
|
|
1546
|
+
* const data = await infoClient.twapHistory({ user: "0x..." });
|
|
1547
|
+
* ```
|
|
1548
|
+
*/
|
|
1549
|
+
twapHistory(
|
|
1550
|
+
params: DeepImmutable<TwapHistoryParameters>,
|
|
1551
|
+
signal?: AbortSignal,
|
|
1552
|
+
): Promise<TwapHistory[]> {
|
|
1553
|
+
const request = parser(TwapHistoryRequest)({
|
|
1554
|
+
type: "twapHistory",
|
|
1555
|
+
...params,
|
|
1556
|
+
});
|
|
1557
|
+
return this.transport.request("info", request, signal);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Request transaction details by transaction hash.
|
|
1562
|
+
* @param params - Request-specific parameters.
|
|
1563
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1564
|
+
* @returns Transaction details.
|
|
1565
|
+
*
|
|
1566
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1567
|
+
*
|
|
1568
|
+
* @see null
|
|
1569
|
+
* @example
|
|
1570
|
+
* ```ts
|
|
1571
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1572
|
+
*
|
|
1573
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1574
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1575
|
+
*
|
|
1576
|
+
* const data = await infoClient.txDetails({ hash: "0x..." });
|
|
1577
|
+
* ```
|
|
1578
|
+
*/
|
|
1579
|
+
txDetails(
|
|
1580
|
+
// allow only those transports that support `explorer` requests
|
|
1581
|
+
this: T extends { request(endpoint: "explorer", ...args: unknown[]): unknown } ? this : never,
|
|
1582
|
+
params: DeepImmutable<TxDetailsParameters>,
|
|
1583
|
+
signal?: AbortSignal,
|
|
1584
|
+
): Promise<TxDetails> {
|
|
1585
|
+
const request = parser(TxDetailsRequest)({
|
|
1586
|
+
type: "txDetails",
|
|
1587
|
+
...params,
|
|
1588
|
+
});
|
|
1589
|
+
return this.transport.request<TxDetailsResponse>("explorer", request, signal)
|
|
1590
|
+
.then(({ tx }) => tx);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* Request user details by user's address.
|
|
1595
|
+
* @param params - Request-specific parameters.
|
|
1596
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1597
|
+
* @returns User details.
|
|
1598
|
+
*
|
|
1599
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1600
|
+
*
|
|
1601
|
+
* @see null
|
|
1602
|
+
* @example
|
|
1603
|
+
* ```ts
|
|
1604
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1605
|
+
*
|
|
1606
|
+
* const transport = new hl.HttpTransport(); // only `HttpTransport` supports this method
|
|
1607
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1608
|
+
*
|
|
1609
|
+
* const data = await infoClient.userDetails({ user: "0x..." });
|
|
1610
|
+
* ```
|
|
1611
|
+
*/
|
|
1612
|
+
userDetails(
|
|
1613
|
+
// allow only those transports that support `explorer` requests
|
|
1614
|
+
this: T extends { request(endpoint: "explorer", ...args: unknown[]): unknown } ? this : never,
|
|
1615
|
+
params: DeepImmutable<UserDetailsParameters>,
|
|
1616
|
+
signal?: AbortSignal,
|
|
1617
|
+
): Promise<TxDetails[]> {
|
|
1618
|
+
const request = parser(UserDetailsRequest)({
|
|
1619
|
+
type: "userDetails",
|
|
1620
|
+
...params,
|
|
1621
|
+
});
|
|
1622
|
+
return this.transport.request<UserDetailsResponse>("explorer", request, signal)
|
|
1623
|
+
.then(({ txs }) => txs);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/**
|
|
1627
|
+
* Request user fees.
|
|
1628
|
+
* @param params - Request-specific parameters.
|
|
1629
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1630
|
+
* @returns User fees.
|
|
1631
|
+
*
|
|
1632
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1633
|
+
*
|
|
1634
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-fees
|
|
1635
|
+
* @example
|
|
1636
|
+
* ```ts
|
|
1637
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1638
|
+
*
|
|
1639
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1640
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1641
|
+
*
|
|
1642
|
+
* const data = await infoClient.userFees({ user: "0x..." });
|
|
1643
|
+
* ```
|
|
1644
|
+
*/
|
|
1645
|
+
userFees(
|
|
1646
|
+
params: DeepImmutable<UserFeesParameters>,
|
|
1647
|
+
signal?: AbortSignal,
|
|
1648
|
+
): Promise<UserFees> {
|
|
1649
|
+
const request = parser(UserFeesRequest)({
|
|
1650
|
+
type: "userFees",
|
|
1651
|
+
...params,
|
|
1652
|
+
});
|
|
1653
|
+
return this.transport.request("info", request, signal);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Request user fills.
|
|
1658
|
+
* @param params - Request-specific parameters.
|
|
1659
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1660
|
+
* @returns Array of user's trade fill.
|
|
1661
|
+
*
|
|
1662
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1663
|
+
*
|
|
1664
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
|
|
1665
|
+
* @example
|
|
1666
|
+
* ```ts
|
|
1667
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1668
|
+
*
|
|
1669
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1670
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1671
|
+
*
|
|
1672
|
+
* const data = await infoClient.userFills({ user: "0x..." });
|
|
1673
|
+
* ```
|
|
1674
|
+
*/
|
|
1675
|
+
userFills(
|
|
1676
|
+
params: DeepImmutable<UserFillsParameters>,
|
|
1677
|
+
signal?: AbortSignal,
|
|
1678
|
+
): Promise<Fill[]> {
|
|
1679
|
+
const request = parser(UserFillsRequest)({
|
|
1680
|
+
type: "userFills",
|
|
1681
|
+
...params,
|
|
1682
|
+
});
|
|
1683
|
+
return this.transport.request("info", request, signal);
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Request user fills by time.
|
|
1688
|
+
* @param params - Request-specific parameters.
|
|
1689
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1690
|
+
* @returns Array of user's trade fill.
|
|
1691
|
+
*
|
|
1692
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1693
|
+
*
|
|
1694
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
|
|
1695
|
+
* @example
|
|
1696
|
+
* ```ts
|
|
1697
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1698
|
+
*
|
|
1699
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1700
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1701
|
+
*
|
|
1702
|
+
* const data = await infoClient.userFillsByTime({
|
|
1703
|
+
* user: "0x...",
|
|
1704
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
1705
|
+
* });
|
|
1706
|
+
* ```
|
|
1707
|
+
*/
|
|
1708
|
+
userFillsByTime(
|
|
1709
|
+
params: DeepImmutable<UserFillsByTimeParameters>,
|
|
1710
|
+
signal?: AbortSignal,
|
|
1711
|
+
): Promise<Fill[]> {
|
|
1712
|
+
const request = parser(UserFillsByTimeRequest)({
|
|
1713
|
+
type: "userFillsByTime",
|
|
1714
|
+
...params,
|
|
1715
|
+
});
|
|
1716
|
+
return this.transport.request("info", request, signal);
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
/**
|
|
1720
|
+
* Request user funding.
|
|
1721
|
+
* @param params - Request-specific parameters.
|
|
1722
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1723
|
+
* @returns Array of user's funding ledger update.
|
|
1724
|
+
*
|
|
1725
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1726
|
+
*
|
|
1727
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates
|
|
1728
|
+
* @example
|
|
1729
|
+
* ```ts
|
|
1730
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1731
|
+
*
|
|
1732
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1733
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1734
|
+
*
|
|
1735
|
+
* const data = await infoClient.userFunding({
|
|
1736
|
+
* user: "0x...",
|
|
1737
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
1738
|
+
* });
|
|
1739
|
+
* ```
|
|
1740
|
+
*/
|
|
1741
|
+
userFunding(
|
|
1742
|
+
params: DeepImmutable<UserFundingParameters>,
|
|
1743
|
+
signal?: AbortSignal,
|
|
1744
|
+
): Promise<UserFundingUpdate[]> {
|
|
1745
|
+
const request = parser(UserFundingRequest)({
|
|
1746
|
+
type: "userFunding",
|
|
1747
|
+
...params,
|
|
1748
|
+
});
|
|
1749
|
+
return this.transport.request("info", request, signal);
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Request user non-funding ledger updates.
|
|
1754
|
+
* @param params - Request-specific parameters.
|
|
1755
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1756
|
+
* @returns Array of user's non-funding ledger update.
|
|
1757
|
+
*
|
|
1758
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1759
|
+
*
|
|
1760
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates
|
|
1761
|
+
* @example
|
|
1762
|
+
* ```ts
|
|
1763
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1764
|
+
*
|
|
1765
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1766
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1767
|
+
*
|
|
1768
|
+
* const data = await infoClient.userNonFundingLedgerUpdates({
|
|
1769
|
+
* user: "0x...",
|
|
1770
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
1771
|
+
* });
|
|
1772
|
+
* ```
|
|
1773
|
+
*/
|
|
1774
|
+
userNonFundingLedgerUpdates(
|
|
1775
|
+
params: DeepImmutable<UserNonFundingLedgerUpdatesParameters>,
|
|
1776
|
+
signal?: AbortSignal,
|
|
1777
|
+
): Promise<UserNonFundingLedgerUpdate[]> {
|
|
1778
|
+
const request = parser(UserNonFundingLedgerUpdatesRequest)({
|
|
1779
|
+
type: "userNonFundingLedgerUpdates",
|
|
1780
|
+
...params,
|
|
1781
|
+
});
|
|
1782
|
+
return this.transport.request("info", request, signal);
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* Request user rate limits.
|
|
1787
|
+
* @param params - Request-specific parameters.
|
|
1788
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1789
|
+
* @returns User's rate limits.
|
|
1790
|
+
*
|
|
1791
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1792
|
+
*
|
|
1793
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-user-rate-limits
|
|
1794
|
+
* @example
|
|
1795
|
+
* ```ts
|
|
1796
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1797
|
+
*
|
|
1798
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1799
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1800
|
+
*
|
|
1801
|
+
* const data = await infoClient.userRateLimit({ user: "0x..." });
|
|
1802
|
+
* ```
|
|
1803
|
+
*/
|
|
1804
|
+
userRateLimit(
|
|
1805
|
+
params: DeepImmutable<UserRateLimitParameters>,
|
|
1806
|
+
signal?: AbortSignal,
|
|
1807
|
+
): Promise<UserRateLimit> {
|
|
1808
|
+
const request = parser(UserRateLimitRequest)({
|
|
1809
|
+
type: "userRateLimit",
|
|
1810
|
+
...params,
|
|
1811
|
+
});
|
|
1812
|
+
return this.transport.request("info", request, signal);
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Request user role.
|
|
1817
|
+
* @param params - Request-specific parameters.
|
|
1818
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1819
|
+
* @returns User's role.
|
|
1820
|
+
*
|
|
1821
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1822
|
+
*
|
|
1823
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-role
|
|
1824
|
+
* @example
|
|
1825
|
+
* ```ts
|
|
1826
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1827
|
+
*
|
|
1828
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1829
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1830
|
+
*
|
|
1831
|
+
* const data = await infoClient.userRole({ user: "0x..." });
|
|
1832
|
+
* ```
|
|
1833
|
+
*/
|
|
1834
|
+
userRole(
|
|
1835
|
+
params: DeepImmutable<UserRoleParameters>,
|
|
1836
|
+
signal?: AbortSignal,
|
|
1837
|
+
): Promise<UserRole> {
|
|
1838
|
+
const request = parser(UserRoleRequest)({
|
|
1839
|
+
type: "userRole",
|
|
1840
|
+
...params,
|
|
1841
|
+
});
|
|
1842
|
+
return this.transport.request("info", request, signal);
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
* Request multi-sig signers for a user.
|
|
1847
|
+
* @param params - Request-specific parameters.
|
|
1848
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1849
|
+
* @returns Multi-sig signers for a user or null if the user does not have any multi-sig signers.
|
|
1850
|
+
*
|
|
1851
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1852
|
+
*
|
|
1853
|
+
* @see null
|
|
1854
|
+
* @example
|
|
1855
|
+
* ```ts
|
|
1856
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1857
|
+
*
|
|
1858
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1859
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1860
|
+
*
|
|
1861
|
+
* const data = await infoClient.userToMultiSigSigners({ user: "0x..." });
|
|
1862
|
+
* ```
|
|
1863
|
+
*/
|
|
1864
|
+
userToMultiSigSigners(
|
|
1865
|
+
params: DeepImmutable<UserToMultiSigSignersParameters>,
|
|
1866
|
+
signal?: AbortSignal,
|
|
1867
|
+
): Promise<MultiSigSigners | null> {
|
|
1868
|
+
const request = parser(UserToMultiSigSignersRequest)({
|
|
1869
|
+
type: "userToMultiSigSigners",
|
|
1870
|
+
...params,
|
|
1871
|
+
});
|
|
1872
|
+
return this.transport.request("info", request, signal);
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Request user twap slice fills.
|
|
1877
|
+
* @param params - Request-specific parameters.
|
|
1878
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1879
|
+
* @returns Array of user's twap slice fill.
|
|
1880
|
+
*
|
|
1881
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1882
|
+
*
|
|
1883
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-twap-slice-fills
|
|
1884
|
+
* @example
|
|
1885
|
+
* ```ts
|
|
1886
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1887
|
+
*
|
|
1888
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1889
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1890
|
+
*
|
|
1891
|
+
* const data = await infoClient.userTwapSliceFills({ user: "0x..." });
|
|
1892
|
+
* ```
|
|
1893
|
+
*/
|
|
1894
|
+
userTwapSliceFills(
|
|
1895
|
+
params: DeepImmutable<UserTwapSliceFillsParameters>,
|
|
1896
|
+
signal?: AbortSignal,
|
|
1897
|
+
): Promise<TwapSliceFill[]> {
|
|
1898
|
+
const request = parser(UserTwapSliceFillsRequest)({
|
|
1899
|
+
type: "userTwapSliceFills",
|
|
1900
|
+
...params,
|
|
1901
|
+
});
|
|
1902
|
+
return this.transport.request("info", request, signal);
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Request user twap slice fills by time.
|
|
1907
|
+
* @param params - Request-specific parameters.
|
|
1908
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1909
|
+
* @returns Array of user's twap slice fill.
|
|
1910
|
+
*
|
|
1911
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1912
|
+
*
|
|
1913
|
+
* @see null
|
|
1914
|
+
* @example
|
|
1915
|
+
* ```ts
|
|
1916
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1917
|
+
*
|
|
1918
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1919
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1920
|
+
*
|
|
1921
|
+
* const data = await infoClient.userTwapSliceFillsByTime({
|
|
1922
|
+
* user: "0x...",
|
|
1923
|
+
* startTime: Date.now() - 1000 * 60 * 60 * 24
|
|
1924
|
+
* });
|
|
1925
|
+
* ```
|
|
1926
|
+
*/
|
|
1927
|
+
userTwapSliceFillsByTime(
|
|
1928
|
+
params: DeepImmutable<UserTwapSliceFillsByTimeParameters>,
|
|
1929
|
+
signal?: AbortSignal,
|
|
1930
|
+
): Promise<TwapSliceFill[]> {
|
|
1931
|
+
const request = parser(UserTwapSliceFillsByTimeRequest)({
|
|
1932
|
+
type: "userTwapSliceFillsByTime",
|
|
1933
|
+
...params,
|
|
1934
|
+
});
|
|
1935
|
+
return this.transport.request("info", request, signal);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Request user vault deposits.
|
|
1940
|
+
* @param params - Request-specific parameters.
|
|
1941
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1942
|
+
* @returns Array of user's vault deposits.
|
|
1943
|
+
*
|
|
1944
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1945
|
+
*
|
|
1946
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-vault-deposits
|
|
1947
|
+
* @example
|
|
1948
|
+
* ```ts
|
|
1949
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1950
|
+
*
|
|
1951
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1952
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1953
|
+
*
|
|
1954
|
+
* const data = await infoClient.userVaultEquities({ user: "0x..." });
|
|
1955
|
+
* ```
|
|
1956
|
+
*/
|
|
1957
|
+
userVaultEquities(
|
|
1958
|
+
params: DeepImmutable<UserVaultEquitiesParameters>,
|
|
1959
|
+
signal?: AbortSignal,
|
|
1960
|
+
): Promise<VaultEquity[]> {
|
|
1961
|
+
const request = parser(UserVaultEquitiesRequest)({
|
|
1962
|
+
type: "userVaultEquities",
|
|
1963
|
+
...params,
|
|
1964
|
+
});
|
|
1965
|
+
return this.transport.request("info", request, signal);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/**
|
|
1969
|
+
* Request validator L1 votes.
|
|
1970
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1971
|
+
* @returns
|
|
1972
|
+
*
|
|
1973
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1974
|
+
*
|
|
1975
|
+
* @see null
|
|
1976
|
+
* @example
|
|
1977
|
+
* ```ts
|
|
1978
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
1979
|
+
*
|
|
1980
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
1981
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
1982
|
+
*
|
|
1983
|
+
* const data = await infoClient.validatorL1Votes();
|
|
1984
|
+
* ```
|
|
1985
|
+
*/
|
|
1986
|
+
validatorL1Votes(signal?: AbortSignal): Promise<ValidatorL1Vote[]> {
|
|
1987
|
+
const request = parser(ValidatorL1VotesRequest)({
|
|
1988
|
+
type: "validatorL1Votes",
|
|
1989
|
+
});
|
|
1990
|
+
return this.transport.request("info", request, signal);
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
/**
|
|
1994
|
+
* Request validator summaries.
|
|
1995
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
1996
|
+
* @returns Array of validator summaries.
|
|
1997
|
+
*
|
|
1998
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
1999
|
+
*
|
|
2000
|
+
* @see null
|
|
2001
|
+
* @example
|
|
2002
|
+
* ```ts
|
|
2003
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
2004
|
+
*
|
|
2005
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
2006
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
2007
|
+
*
|
|
2008
|
+
* const data = await infoClient.validatorSummaries();
|
|
2009
|
+
* ```
|
|
2010
|
+
*/
|
|
2011
|
+
validatorSummaries(signal?: AbortSignal): Promise<ValidatorSummary[]> {
|
|
2012
|
+
const request = parser(ValidatorSummariesRequest)({
|
|
2013
|
+
type: "validatorSummaries",
|
|
2014
|
+
});
|
|
2015
|
+
return this.transport.request("info", request, signal);
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* Request details of a vault.
|
|
2020
|
+
* @param params - Request-specific parameters.
|
|
2021
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
2022
|
+
* @returns Details of a vault or null if the vault does not exist.
|
|
2023
|
+
*
|
|
2024
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
2025
|
+
*
|
|
2026
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-details-for-a-vault
|
|
2027
|
+
* @example
|
|
2028
|
+
* ```ts
|
|
2029
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
2030
|
+
*
|
|
2031
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
2032
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
2033
|
+
*
|
|
2034
|
+
* const data = await infoClient.vaultDetails({ vaultAddress: "0x..." });
|
|
2035
|
+
* ```
|
|
2036
|
+
*/
|
|
2037
|
+
vaultDetails(
|
|
2038
|
+
params: DeepImmutable<VaultDetailsParameters>,
|
|
2039
|
+
signal?: AbortSignal,
|
|
2040
|
+
): Promise<VaultDetails | null> {
|
|
2041
|
+
const request = parser(VaultDetailsRequest)({
|
|
2042
|
+
type: "vaultDetails",
|
|
2043
|
+
...params,
|
|
2044
|
+
});
|
|
2045
|
+
return this.transport.request("info", request, signal);
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* Request a list of vaults less than 2 hours old.
|
|
2050
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
2051
|
+
* @returns Array of vault summaries.
|
|
2052
|
+
*
|
|
2053
|
+
* @throws {TransportError} When the transport layer throws an error.
|
|
2054
|
+
*
|
|
2055
|
+
* @see null
|
|
2056
|
+
* @example
|
|
2057
|
+
* ```ts
|
|
2058
|
+
* import * as hl from "@nktkas/hyperliquid";
|
|
2059
|
+
*
|
|
2060
|
+
* const transport = new hl.HttpTransport(); // or `WebSocketTransport`
|
|
2061
|
+
* const infoClient = new hl.InfoClient({ transport });
|
|
2062
|
+
*
|
|
2063
|
+
* const data = await infoClient.vaultSummaries();
|
|
2064
|
+
* ```
|
|
2065
|
+
*/
|
|
2066
|
+
vaultSummaries(signal?: AbortSignal): Promise<VaultSummary[]> {
|
|
2067
|
+
const request = parser(VaultSummariesRequest)({
|
|
2068
|
+
type: "vaultSummaries",
|
|
2069
|
+
});
|
|
2070
|
+
return this.transport.request("info", request, signal);
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
async [Symbol.asyncDispose](): Promise<void> {
|
|
2074
|
+
await this.transport[Symbol.asyncDispose]?.();
|
|
2075
|
+
}
|
|
2076
|
+
}
|