@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,1369 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { Hex, UnsignedInteger } from "../_base.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Request user active asset data.
|
|
6
|
+
* @returns {ActiveAssetData}
|
|
7
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-active-asset-data
|
|
8
|
+
*/
|
|
9
|
+
export const ActiveAssetDataRequest = v.pipe(
|
|
10
|
+
v.object({
|
|
11
|
+
/** Type of request. */
|
|
12
|
+
type: v.pipe(
|
|
13
|
+
v.literal("activeAssetData"),
|
|
14
|
+
v.description("Type of request."),
|
|
15
|
+
),
|
|
16
|
+
/** Asset symbol (e.g., BTC). */
|
|
17
|
+
coin: v.pipe(
|
|
18
|
+
v.string(),
|
|
19
|
+
v.description("Asset symbol (e.g., BTC)."),
|
|
20
|
+
),
|
|
21
|
+
/** User address. */
|
|
22
|
+
user: v.pipe(
|
|
23
|
+
v.pipe(Hex, v.length(42)),
|
|
24
|
+
v.description("User address."),
|
|
25
|
+
),
|
|
26
|
+
}),
|
|
27
|
+
v.description("Request user active asset data."),
|
|
28
|
+
);
|
|
29
|
+
export type ActiveAssetDataRequest = v.InferOutput<typeof ActiveAssetDataRequest>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Request mid coin prices.
|
|
33
|
+
* @returns {AllMids}
|
|
34
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-mids-for-all-coins
|
|
35
|
+
*/
|
|
36
|
+
export const AllMidsRequest = v.pipe(
|
|
37
|
+
v.object({
|
|
38
|
+
/** Type of request. */
|
|
39
|
+
type: v.pipe(
|
|
40
|
+
v.literal("allMids"),
|
|
41
|
+
v.description("Type of request."),
|
|
42
|
+
),
|
|
43
|
+
/** DEX name (empty string for main dex). */
|
|
44
|
+
dex: v.pipe(
|
|
45
|
+
v.optional(v.string()),
|
|
46
|
+
v.description("DEX name (empty string for main dex)."),
|
|
47
|
+
),
|
|
48
|
+
}),
|
|
49
|
+
v.description("Request mid coin prices."),
|
|
50
|
+
);
|
|
51
|
+
export type AllMidsRequest = v.InferOutput<typeof AllMidsRequest>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Request candlestick snapshots.
|
|
55
|
+
* @returns {Candle[]}
|
|
56
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot
|
|
57
|
+
*/
|
|
58
|
+
export const CandleSnapshotRequest = v.pipe(
|
|
59
|
+
v.object({
|
|
60
|
+
/** Type of request. */
|
|
61
|
+
type: v.pipe(
|
|
62
|
+
v.literal("candleSnapshot"),
|
|
63
|
+
v.description("Type of request."),
|
|
64
|
+
),
|
|
65
|
+
/** Request parameters. */
|
|
66
|
+
req: v.pipe(
|
|
67
|
+
v.object({
|
|
68
|
+
/** Asset symbol (e.g., BTC). */
|
|
69
|
+
coin: v.pipe(
|
|
70
|
+
v.string(),
|
|
71
|
+
v.description("Asset symbol (e.g., BTC)."),
|
|
72
|
+
),
|
|
73
|
+
/** Time interval. */
|
|
74
|
+
interval: v.pipe(
|
|
75
|
+
v.union([
|
|
76
|
+
v.literal("1m"),
|
|
77
|
+
v.literal("3m"),
|
|
78
|
+
v.literal("5m"),
|
|
79
|
+
v.literal("15m"),
|
|
80
|
+
v.literal("30m"),
|
|
81
|
+
v.literal("1h"),
|
|
82
|
+
v.literal("2h"),
|
|
83
|
+
v.literal("4h"),
|
|
84
|
+
v.literal("8h"),
|
|
85
|
+
v.literal("12h"),
|
|
86
|
+
v.literal("1d"),
|
|
87
|
+
v.literal("3d"),
|
|
88
|
+
v.literal("1w"),
|
|
89
|
+
v.literal("1M"),
|
|
90
|
+
]),
|
|
91
|
+
v.description("Time interval."),
|
|
92
|
+
),
|
|
93
|
+
/** Start time (in ms since epoch). */
|
|
94
|
+
startTime: v.pipe(
|
|
95
|
+
UnsignedInteger,
|
|
96
|
+
v.description("Start time (in ms since epoch)."),
|
|
97
|
+
),
|
|
98
|
+
/** End time (in ms since epoch). */
|
|
99
|
+
endTime: v.pipe(
|
|
100
|
+
v.nullish(UnsignedInteger),
|
|
101
|
+
v.description("End time (in ms since epoch)."),
|
|
102
|
+
),
|
|
103
|
+
}),
|
|
104
|
+
v.description("Request parameters."),
|
|
105
|
+
),
|
|
106
|
+
}),
|
|
107
|
+
v.description("Request candlestick snapshots."),
|
|
108
|
+
);
|
|
109
|
+
export type CandleSnapshotRequest = v.InferOutput<typeof CandleSnapshotRequest>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Request clearinghouse state.
|
|
113
|
+
* @returns {PerpsClearinghouseState}
|
|
114
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
|
115
|
+
*/
|
|
116
|
+
export const ClearinghouseStateRequest = v.pipe(
|
|
117
|
+
v.object({
|
|
118
|
+
/** Type of request. */
|
|
119
|
+
type: v.pipe(
|
|
120
|
+
v.literal("clearinghouseState"),
|
|
121
|
+
v.description("Type of request."),
|
|
122
|
+
),
|
|
123
|
+
/** User address. */
|
|
124
|
+
user: v.pipe(
|
|
125
|
+
v.pipe(Hex, v.length(42)),
|
|
126
|
+
v.description("User address."),
|
|
127
|
+
),
|
|
128
|
+
/** DEX name (empty string for main dex). */
|
|
129
|
+
dex: v.pipe(
|
|
130
|
+
v.optional(v.string()),
|
|
131
|
+
v.description("DEX name (empty string for main dex)."),
|
|
132
|
+
),
|
|
133
|
+
}),
|
|
134
|
+
v.description("Request clearinghouse state."),
|
|
135
|
+
);
|
|
136
|
+
export type ClearinghouseStateRequest = v.InferOutput<typeof ClearinghouseStateRequest>;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Request user staking delegations.
|
|
140
|
+
* @returns {Delegation[]}
|
|
141
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-delegations
|
|
142
|
+
*/
|
|
143
|
+
export const DelegationsRequest = v.pipe(
|
|
144
|
+
v.object({
|
|
145
|
+
/** Type of request. */
|
|
146
|
+
type: v.pipe(
|
|
147
|
+
v.literal("delegations"),
|
|
148
|
+
v.description("Type of request."),
|
|
149
|
+
),
|
|
150
|
+
/** User address. */
|
|
151
|
+
user: v.pipe(
|
|
152
|
+
v.pipe(Hex, v.length(42)),
|
|
153
|
+
v.description("User address."),
|
|
154
|
+
),
|
|
155
|
+
}),
|
|
156
|
+
v.description("Request user staking delegations."),
|
|
157
|
+
);
|
|
158
|
+
export type DelegationsRequest = v.InferOutput<typeof DelegationsRequest>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Request user staking history.
|
|
162
|
+
* @returns {DelegatorUpdate[]}
|
|
163
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-history
|
|
164
|
+
*/
|
|
165
|
+
export const DelegatorHistoryRequest = v.pipe(
|
|
166
|
+
v.object({
|
|
167
|
+
/** Type of request. */
|
|
168
|
+
type: v.pipe(
|
|
169
|
+
v.literal("delegatorHistory"),
|
|
170
|
+
v.description("Type of request."),
|
|
171
|
+
),
|
|
172
|
+
/** User address. */
|
|
173
|
+
user: v.pipe(
|
|
174
|
+
v.pipe(Hex, v.length(42)),
|
|
175
|
+
v.description("User address."),
|
|
176
|
+
),
|
|
177
|
+
}),
|
|
178
|
+
v.description("Request user staking history."),
|
|
179
|
+
);
|
|
180
|
+
export type DelegatorHistoryRequest = v.InferOutput<typeof DelegatorHistoryRequest>;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Request user staking rewards.
|
|
184
|
+
* @returns {DelegatorReward[]}
|
|
185
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-rewards
|
|
186
|
+
*/
|
|
187
|
+
export const DelegatorRewardsRequest = v.pipe(
|
|
188
|
+
v.object({
|
|
189
|
+
/** Type of request. */
|
|
190
|
+
type: v.pipe(
|
|
191
|
+
v.literal("delegatorRewards"),
|
|
192
|
+
v.description("Type of request."),
|
|
193
|
+
),
|
|
194
|
+
/** User address. */
|
|
195
|
+
user: v.pipe(
|
|
196
|
+
v.pipe(Hex, v.length(42)),
|
|
197
|
+
v.description("User address."),
|
|
198
|
+
),
|
|
199
|
+
}),
|
|
200
|
+
v.description("Request user staking rewards."),
|
|
201
|
+
);
|
|
202
|
+
export type DelegatorRewardsRequest = v.InferOutput<typeof DelegatorRewardsRequest>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Request user staking summary.
|
|
206
|
+
* @returns {DelegatorSummary}
|
|
207
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-staking-summary
|
|
208
|
+
*/
|
|
209
|
+
export const DelegatorSummaryRequest = v.pipe(
|
|
210
|
+
v.object({
|
|
211
|
+
/** Type of request. */
|
|
212
|
+
type: v.pipe(
|
|
213
|
+
v.literal("delegatorSummary"),
|
|
214
|
+
v.description("Type of request."),
|
|
215
|
+
),
|
|
216
|
+
/** User address. */
|
|
217
|
+
user: v.pipe(
|
|
218
|
+
v.pipe(Hex, v.length(42)),
|
|
219
|
+
v.description("User address."),
|
|
220
|
+
),
|
|
221
|
+
}),
|
|
222
|
+
v.description("Request user staking summary."),
|
|
223
|
+
);
|
|
224
|
+
export type DelegatorSummaryRequest = v.InferOutput<typeof DelegatorSummaryRequest>;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Request exchange status information.
|
|
228
|
+
* @returns {ExchangeStatus}
|
|
229
|
+
* @see null
|
|
230
|
+
*/
|
|
231
|
+
export const ExchangeStatusRequest = v.pipe(
|
|
232
|
+
v.object({
|
|
233
|
+
/** Type of request. */
|
|
234
|
+
type: v.pipe(
|
|
235
|
+
v.literal("exchangeStatus"),
|
|
236
|
+
v.description("Type of request."),
|
|
237
|
+
),
|
|
238
|
+
}),
|
|
239
|
+
v.description("Request exchange status information."),
|
|
240
|
+
);
|
|
241
|
+
export type ExchangeStatusRequest = v.InferOutput<typeof ExchangeStatusRequest>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Request user extra agents.
|
|
245
|
+
* @returns {ExtraAgent[]}
|
|
246
|
+
* @see null
|
|
247
|
+
*/
|
|
248
|
+
export const ExtraAgentsRequest = v.pipe(
|
|
249
|
+
v.object({
|
|
250
|
+
/** Type of request. */
|
|
251
|
+
type: v.pipe(
|
|
252
|
+
v.literal("extraAgents"),
|
|
253
|
+
v.description("Type of request."),
|
|
254
|
+
),
|
|
255
|
+
/** User address. */
|
|
256
|
+
user: v.pipe(
|
|
257
|
+
v.pipe(Hex, v.length(42)),
|
|
258
|
+
v.description("User address."),
|
|
259
|
+
),
|
|
260
|
+
}),
|
|
261
|
+
v.description("Request user extra agents."),
|
|
262
|
+
);
|
|
263
|
+
export type ExtraAgentsRequest = v.InferOutput<typeof ExtraAgentsRequest>;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Request frontend open orders.
|
|
267
|
+
* @returns {FrontendOrder[]}
|
|
268
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders-with-additional-frontend-info
|
|
269
|
+
*/
|
|
270
|
+
export const FrontendOpenOrdersRequest = v.pipe(
|
|
271
|
+
v.object({
|
|
272
|
+
/** Type of request. */
|
|
273
|
+
type: v.pipe(
|
|
274
|
+
v.literal("frontendOpenOrders"),
|
|
275
|
+
v.description("Type of request."),
|
|
276
|
+
),
|
|
277
|
+
/** User address. */
|
|
278
|
+
user: v.pipe(
|
|
279
|
+
v.pipe(Hex, v.length(42)),
|
|
280
|
+
v.description("User address."),
|
|
281
|
+
),
|
|
282
|
+
/** DEX name (empty string for main dex). */
|
|
283
|
+
dex: v.pipe(
|
|
284
|
+
v.optional(v.string()),
|
|
285
|
+
v.description("DEX name (empty string for main dex)."),
|
|
286
|
+
),
|
|
287
|
+
}),
|
|
288
|
+
v.description("Request frontend open orders."),
|
|
289
|
+
);
|
|
290
|
+
export type FrontendOpenOrdersRequest = v.InferOutput<typeof FrontendOpenOrdersRequest>;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Request funding history.
|
|
294
|
+
* @returns {FundingHistory[]}
|
|
295
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates
|
|
296
|
+
*/
|
|
297
|
+
export const FundingHistoryRequest = v.pipe(
|
|
298
|
+
v.object({
|
|
299
|
+
/** Type of request. */
|
|
300
|
+
type: v.pipe(
|
|
301
|
+
v.literal("fundingHistory"),
|
|
302
|
+
v.description("Type of request."),
|
|
303
|
+
),
|
|
304
|
+
/** Asset symbol (e.g., BTC). */
|
|
305
|
+
coin: v.pipe(
|
|
306
|
+
v.string(),
|
|
307
|
+
v.description("Asset symbol (e.g., BTC)."),
|
|
308
|
+
),
|
|
309
|
+
/** Start time (in ms since epoch). */
|
|
310
|
+
startTime: v.pipe(
|
|
311
|
+
UnsignedInteger,
|
|
312
|
+
v.description("Start time (in ms since epoch)."),
|
|
313
|
+
),
|
|
314
|
+
/** End time (in ms since epoch). */
|
|
315
|
+
endTime: v.pipe(
|
|
316
|
+
v.nullish(UnsignedInteger),
|
|
317
|
+
v.description("End time (in ms since epoch)."),
|
|
318
|
+
),
|
|
319
|
+
}),
|
|
320
|
+
v.description("Request funding history."),
|
|
321
|
+
);
|
|
322
|
+
export type FundingHistoryRequest = v.InferOutput<typeof FundingHistoryRequest>;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Request user historical orders.
|
|
326
|
+
* @returns {FrontendOrderStatus[]}
|
|
327
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-historical-orders
|
|
328
|
+
*/
|
|
329
|
+
export const HistoricalOrdersRequest = v.pipe(
|
|
330
|
+
v.object({
|
|
331
|
+
/** Type of request. */
|
|
332
|
+
type: v.pipe(
|
|
333
|
+
v.literal("historicalOrders"),
|
|
334
|
+
v.description("Type of request."),
|
|
335
|
+
),
|
|
336
|
+
/** User address. */
|
|
337
|
+
user: v.pipe(
|
|
338
|
+
v.pipe(Hex, v.length(42)),
|
|
339
|
+
v.description("User address."),
|
|
340
|
+
),
|
|
341
|
+
}),
|
|
342
|
+
v.description("Request user historical orders."),
|
|
343
|
+
);
|
|
344
|
+
export type HistoricalOrdersRequest = v.InferOutput<typeof HistoricalOrdersRequest>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Request to check if a user is a VIP.
|
|
348
|
+
* @returns {boolean | null}
|
|
349
|
+
* @see null
|
|
350
|
+
*/
|
|
351
|
+
export const IsVipRequest = v.pipe(
|
|
352
|
+
v.object({
|
|
353
|
+
/** Type of request. */
|
|
354
|
+
type: v.pipe(
|
|
355
|
+
v.literal("isVip"),
|
|
356
|
+
v.description("Type of request."),
|
|
357
|
+
),
|
|
358
|
+
/** User address. */
|
|
359
|
+
user: v.pipe(
|
|
360
|
+
v.pipe(Hex, v.length(42)),
|
|
361
|
+
v.description("User address."),
|
|
362
|
+
),
|
|
363
|
+
}),
|
|
364
|
+
v.description("Request to check if a user is a VIP."),
|
|
365
|
+
);
|
|
366
|
+
export type IsVipRequest = v.InferOutput<typeof IsVipRequest>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Request L2 order book.
|
|
370
|
+
* @returns {Book}
|
|
371
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot
|
|
372
|
+
*/
|
|
373
|
+
export const L2BookRequest = v.pipe(
|
|
374
|
+
v.object({
|
|
375
|
+
/** Type of request. */
|
|
376
|
+
type: v.pipe(
|
|
377
|
+
v.literal("l2Book"),
|
|
378
|
+
v.description("Type of request."),
|
|
379
|
+
),
|
|
380
|
+
/** Asset symbol (e.g., BTC). */
|
|
381
|
+
coin: v.pipe(
|
|
382
|
+
v.string(),
|
|
383
|
+
v.description("Asset symbol (e.g., BTC)."),
|
|
384
|
+
),
|
|
385
|
+
/** Number of significant figures. */
|
|
386
|
+
nSigFigs: v.pipe(
|
|
387
|
+
v.nullish(v.union([v.literal(2), v.literal(3), v.literal(4), v.literal(5)])),
|
|
388
|
+
v.description("Number of significant figures."),
|
|
389
|
+
),
|
|
390
|
+
/** Mantissa for aggregation (if `nSigFigs` is 5). */
|
|
391
|
+
mantissa: v.pipe(
|
|
392
|
+
v.nullish(v.union([v.literal(2), v.literal(5)])),
|
|
393
|
+
v.description("Mantissa for aggregation (if `nSigFigs` is 5)."),
|
|
394
|
+
),
|
|
395
|
+
}),
|
|
396
|
+
v.description("Request L2 order book."),
|
|
397
|
+
);
|
|
398
|
+
export type L2BookRequest = v.InferOutput<typeof L2BookRequest>;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Request leading vaults for a user.
|
|
402
|
+
* @returns {VaultLeading[]}
|
|
403
|
+
* @see null
|
|
404
|
+
*/
|
|
405
|
+
export const LeadingVaultsRequest = v.pipe(
|
|
406
|
+
v.object({
|
|
407
|
+
/** Type of request. */
|
|
408
|
+
type: v.pipe(
|
|
409
|
+
v.literal("leadingVaults"),
|
|
410
|
+
v.description("Type of request."),
|
|
411
|
+
),
|
|
412
|
+
/** User address. */
|
|
413
|
+
user: v.pipe(
|
|
414
|
+
v.pipe(Hex, v.length(42)),
|
|
415
|
+
v.description("User address."),
|
|
416
|
+
),
|
|
417
|
+
}),
|
|
418
|
+
v.description("Request leading vaults for a user."),
|
|
419
|
+
);
|
|
420
|
+
export type LeadingVaultsRequest = v.InferOutput<typeof LeadingVaultsRequest>;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Request legal verification status of a user.
|
|
424
|
+
* @returns {LegalCheck}
|
|
425
|
+
* @see null
|
|
426
|
+
*/
|
|
427
|
+
export const LegalCheckRequest = v.pipe(
|
|
428
|
+
v.object({
|
|
429
|
+
/** Type of request. */
|
|
430
|
+
type: v.pipe(
|
|
431
|
+
v.literal("legalCheck"),
|
|
432
|
+
v.description("Type of request."),
|
|
433
|
+
),
|
|
434
|
+
/** User address. */
|
|
435
|
+
user: v.pipe(
|
|
436
|
+
v.pipe(Hex, v.length(42)),
|
|
437
|
+
v.description("User address."),
|
|
438
|
+
),
|
|
439
|
+
}),
|
|
440
|
+
v.description("Request legal verification status of a user."),
|
|
441
|
+
);
|
|
442
|
+
export type LegalCheckRequest = v.InferOutput<typeof LegalCheckRequest>;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Request liquidatable.
|
|
446
|
+
* @returns {unknown[]} FIXME: Define the return type
|
|
447
|
+
* @see null
|
|
448
|
+
*/
|
|
449
|
+
export const LiquidatableRequest = v.pipe(
|
|
450
|
+
v.object({
|
|
451
|
+
/** Type of request. */
|
|
452
|
+
type: v.pipe(
|
|
453
|
+
v.literal("liquidatable"),
|
|
454
|
+
v.description("Type of request."),
|
|
455
|
+
),
|
|
456
|
+
}),
|
|
457
|
+
v.description("Request liquidatable."),
|
|
458
|
+
);
|
|
459
|
+
export type LiquidatableRequest = v.InferOutput<typeof LiquidatableRequest>;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Request margin table data.
|
|
463
|
+
* @returns {MarginTable}
|
|
464
|
+
* @see null
|
|
465
|
+
*/
|
|
466
|
+
export const MarginTableRequest = v.pipe(
|
|
467
|
+
v.object({
|
|
468
|
+
/** Type of request. */
|
|
469
|
+
type: v.pipe(
|
|
470
|
+
v.literal("marginTable"),
|
|
471
|
+
v.description("Type of request."),
|
|
472
|
+
),
|
|
473
|
+
/** Margin requirements table. */
|
|
474
|
+
id: v.pipe(
|
|
475
|
+
UnsignedInteger,
|
|
476
|
+
v.description("Margin requirements table."),
|
|
477
|
+
),
|
|
478
|
+
}),
|
|
479
|
+
v.description("Request margin table data."),
|
|
480
|
+
);
|
|
481
|
+
export type MarginTableRequest = v.InferOutput<typeof MarginTableRequest>;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Request builder fee approval.
|
|
485
|
+
* @returns {number}
|
|
486
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#check-builder-fee-approval
|
|
487
|
+
*/
|
|
488
|
+
export const MaxBuilderFeeRequest = v.pipe(
|
|
489
|
+
v.object({
|
|
490
|
+
/** Type of request. */
|
|
491
|
+
type: v.pipe(
|
|
492
|
+
v.literal("maxBuilderFee"),
|
|
493
|
+
v.description("Type of request."),
|
|
494
|
+
),
|
|
495
|
+
/** User address. */
|
|
496
|
+
user: v.pipe(
|
|
497
|
+
v.pipe(Hex, v.length(42)),
|
|
498
|
+
v.description("User address."),
|
|
499
|
+
),
|
|
500
|
+
/** Builder address. */
|
|
501
|
+
builder: v.pipe(
|
|
502
|
+
v.pipe(Hex, v.length(42)),
|
|
503
|
+
v.description("Builder address."),
|
|
504
|
+
),
|
|
505
|
+
}),
|
|
506
|
+
v.description("Request builder fee approval."),
|
|
507
|
+
);
|
|
508
|
+
export type MaxBuilderFeeRequest = v.InferOutput<typeof MaxBuilderFeeRequest>;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Request maximum market order notionals.
|
|
512
|
+
* @returns {[number, string][]}
|
|
513
|
+
* @see null
|
|
514
|
+
*/
|
|
515
|
+
export const MaxMarketOrderNtlsRequest = v.pipe(
|
|
516
|
+
v.object({
|
|
517
|
+
/** Type of request. */
|
|
518
|
+
type: v.pipe(
|
|
519
|
+
v.literal("maxMarketOrderNtls"),
|
|
520
|
+
v.description("Type of request."),
|
|
521
|
+
),
|
|
522
|
+
}),
|
|
523
|
+
v.description("Request maximum market order notionals."),
|
|
524
|
+
);
|
|
525
|
+
export type MaxMarketOrderNtlsRequest = v.InferOutput<typeof MaxMarketOrderNtlsRequest>;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Request trading metadata.
|
|
529
|
+
* @returns {PerpsMeta}
|
|
530
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata-universe-and-margin-tables
|
|
531
|
+
*/
|
|
532
|
+
export const MetaRequest = v.pipe(
|
|
533
|
+
v.object({
|
|
534
|
+
/** Type of request. */
|
|
535
|
+
type: v.pipe(
|
|
536
|
+
v.literal("meta"),
|
|
537
|
+
v.description("Type of request."),
|
|
538
|
+
),
|
|
539
|
+
/** DEX name (empty string for main dex). */
|
|
540
|
+
dex: v.pipe(
|
|
541
|
+
v.optional(v.string()),
|
|
542
|
+
v.description("DEX name (empty string for main dex)."),
|
|
543
|
+
),
|
|
544
|
+
}),
|
|
545
|
+
v.description("Request trading metadata."),
|
|
546
|
+
);
|
|
547
|
+
export type MetaRequest = v.InferOutput<typeof MetaRequest>;
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Request metadata and asset contexts.
|
|
551
|
+
* @returns {PerpsMetaAndAssetCtxs}
|
|
552
|
+
* @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
|
|
553
|
+
*/
|
|
554
|
+
export const MetaAndAssetCtxsRequest = v.pipe(
|
|
555
|
+
v.object({
|
|
556
|
+
/** Type of request. */
|
|
557
|
+
type: v.pipe(
|
|
558
|
+
v.literal("metaAndAssetCtxs"),
|
|
559
|
+
v.description("Type of request."),
|
|
560
|
+
),
|
|
561
|
+
/** DEX name (empty string for main dex). */
|
|
562
|
+
dex: v.pipe(
|
|
563
|
+
v.optional(v.string()),
|
|
564
|
+
v.description("DEX name (empty string for main dex)."),
|
|
565
|
+
),
|
|
566
|
+
}),
|
|
567
|
+
v.description("Request metadata and asset contexts."),
|
|
568
|
+
);
|
|
569
|
+
export type MetaAndAssetCtxsRequest = v.InferOutput<typeof MetaAndAssetCtxsRequest>;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Request open orders.
|
|
573
|
+
* @returns {Order[]}
|
|
574
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders
|
|
575
|
+
*/
|
|
576
|
+
export const OpenOrdersRequest = v.pipe(
|
|
577
|
+
v.object({
|
|
578
|
+
/** Type of request. */
|
|
579
|
+
type: v.pipe(
|
|
580
|
+
v.literal("openOrders"),
|
|
581
|
+
v.description("Type of request."),
|
|
582
|
+
),
|
|
583
|
+
/** User address. */
|
|
584
|
+
user: v.pipe(
|
|
585
|
+
v.pipe(Hex, v.length(42)),
|
|
586
|
+
v.description("User address."),
|
|
587
|
+
),
|
|
588
|
+
/** DEX name (empty string for main dex). */
|
|
589
|
+
dex: v.pipe(
|
|
590
|
+
v.optional(v.string()),
|
|
591
|
+
v.description("DEX name (empty string for main dex)."),
|
|
592
|
+
),
|
|
593
|
+
}),
|
|
594
|
+
v.description("Request open orders."),
|
|
595
|
+
);
|
|
596
|
+
export type OpenOrdersRequest = v.InferOutput<typeof OpenOrdersRequest>;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Request order status.
|
|
600
|
+
* @returns {OrderLookup}
|
|
601
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid
|
|
602
|
+
*/
|
|
603
|
+
export const OrderStatusRequest = v.pipe(
|
|
604
|
+
v.object({
|
|
605
|
+
/** Type of request. */
|
|
606
|
+
type: v.pipe(
|
|
607
|
+
v.literal("orderStatus"),
|
|
608
|
+
v.description("Type of request."),
|
|
609
|
+
),
|
|
610
|
+
/** User address. */
|
|
611
|
+
user: v.pipe(
|
|
612
|
+
v.pipe(Hex, v.length(42)),
|
|
613
|
+
v.description("User address."),
|
|
614
|
+
),
|
|
615
|
+
/** Order ID or Client Order ID. */
|
|
616
|
+
oid: v.pipe(
|
|
617
|
+
v.union([UnsignedInteger, v.pipe(Hex, v.length(34))]),
|
|
618
|
+
v.description("Order ID or Client Order ID."),
|
|
619
|
+
),
|
|
620
|
+
}),
|
|
621
|
+
v.description("Request order status."),
|
|
622
|
+
);
|
|
623
|
+
export type OrderStatusRequest = v.InferOutput<typeof OrderStatusRequest>;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Request for the status of the perpetual deploy auction.
|
|
627
|
+
* @returns {DeployAuctionStatus}
|
|
628
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-information-about-the-perp-deploy-auction
|
|
629
|
+
*/
|
|
630
|
+
export const PerpDeployAuctionStatusRequest = v.pipe(
|
|
631
|
+
v.object({
|
|
632
|
+
/** Type of request. */
|
|
633
|
+
type: v.pipe(
|
|
634
|
+
v.literal("perpDeployAuctionStatus"),
|
|
635
|
+
v.description("Type of request."),
|
|
636
|
+
),
|
|
637
|
+
}),
|
|
638
|
+
v.description("Request for the status of the perpetual deploy auction."),
|
|
639
|
+
);
|
|
640
|
+
export type PerpDeployAuctionStatusRequest = v.InferOutput<typeof PerpDeployAuctionStatusRequest>;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Request all perpetual dexs.
|
|
644
|
+
* @returns {PerpDexs}
|
|
645
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-all-perpetual-dexs
|
|
646
|
+
*/
|
|
647
|
+
export const PerpDexsRequest = v.pipe(
|
|
648
|
+
v.object({
|
|
649
|
+
/** Type of request. */
|
|
650
|
+
type: v.pipe(
|
|
651
|
+
v.literal("perpDexs"),
|
|
652
|
+
v.description("Type of request."),
|
|
653
|
+
),
|
|
654
|
+
}),
|
|
655
|
+
v.description("Request all perpetual dexs."),
|
|
656
|
+
);
|
|
657
|
+
export type PerpDexsRequest = v.InferOutput<typeof PerpDexsRequest>;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Request perpetuals at open interest cap.
|
|
661
|
+
* @returns {string[]}
|
|
662
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#query-perps-at-open-interest-caps
|
|
663
|
+
*/
|
|
664
|
+
export const PerpsAtOpenInterestCapRequest = v.pipe(
|
|
665
|
+
v.object({
|
|
666
|
+
/** Type of request. */
|
|
667
|
+
type: v.pipe(
|
|
668
|
+
v.literal("perpsAtOpenInterestCap"),
|
|
669
|
+
v.description("Type of request."),
|
|
670
|
+
),
|
|
671
|
+
/** DEX name (empty string for main dex). */
|
|
672
|
+
dex: v.pipe(
|
|
673
|
+
v.optional(v.string()),
|
|
674
|
+
v.description("DEX name (empty string for main dex)."),
|
|
675
|
+
),
|
|
676
|
+
}),
|
|
677
|
+
v.description("Request perpetuals at open interest cap."),
|
|
678
|
+
);
|
|
679
|
+
export type PerpsAtOpenInterestCapRequest = v.InferOutput<typeof PerpsAtOpenInterestCapRequest>;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Request user portfolio.
|
|
683
|
+
* @returns {PortfolioPeriods}
|
|
684
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-portfolio
|
|
685
|
+
*/
|
|
686
|
+
export const PortfolioRequest = v.pipe(
|
|
687
|
+
v.object({
|
|
688
|
+
/** Type of request. */
|
|
689
|
+
type: v.pipe(
|
|
690
|
+
v.literal("portfolio"),
|
|
691
|
+
v.description("Type of request."),
|
|
692
|
+
),
|
|
693
|
+
/** User address. */
|
|
694
|
+
user: v.pipe(
|
|
695
|
+
v.pipe(Hex, v.length(42)),
|
|
696
|
+
v.description("User address."),
|
|
697
|
+
),
|
|
698
|
+
}),
|
|
699
|
+
v.description("Request user portfolio."),
|
|
700
|
+
);
|
|
701
|
+
export type PortfolioRequest = v.InferOutput<typeof PortfolioRequest>;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Request predicted funding rates.
|
|
705
|
+
* @returns {PredictedFunding[]}
|
|
706
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-predicted-funding-rates-for-different-venues
|
|
707
|
+
*/
|
|
708
|
+
export const PredictedFundingsRequest = v.pipe(
|
|
709
|
+
v.object({
|
|
710
|
+
/** Type of request. */
|
|
711
|
+
type: v.pipe(
|
|
712
|
+
v.literal("predictedFundings"),
|
|
713
|
+
v.description("Type of request."),
|
|
714
|
+
),
|
|
715
|
+
}),
|
|
716
|
+
v.description("Request predicted funding rates."),
|
|
717
|
+
);
|
|
718
|
+
export type PredictedFundingsRequest = v.InferOutput<typeof PredictedFundingsRequest>;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Request user existence check before transfer.
|
|
722
|
+
* @returns {PreTransferCheck}
|
|
723
|
+
* @see null
|
|
724
|
+
*/
|
|
725
|
+
export const PreTransferCheckRequest = v.pipe(
|
|
726
|
+
v.object({
|
|
727
|
+
/** Type of request. */
|
|
728
|
+
type: v.pipe(
|
|
729
|
+
v.literal("preTransferCheck"),
|
|
730
|
+
v.description("Type of request."),
|
|
731
|
+
),
|
|
732
|
+
/** User address. */
|
|
733
|
+
user: v.pipe(
|
|
734
|
+
v.pipe(Hex, v.length(42)),
|
|
735
|
+
v.description("User address."),
|
|
736
|
+
),
|
|
737
|
+
/** Source address. */
|
|
738
|
+
source: v.pipe(
|
|
739
|
+
v.pipe(Hex, v.length(42)),
|
|
740
|
+
v.description("Source address."),
|
|
741
|
+
),
|
|
742
|
+
}),
|
|
743
|
+
v.description("Request user existence check before transfer."),
|
|
744
|
+
);
|
|
745
|
+
export type PreTransferCheckRequest = v.InferOutput<typeof PreTransferCheckRequest>;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Request user referral.
|
|
749
|
+
* @returns {Referral}
|
|
750
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-referral-information
|
|
751
|
+
*/
|
|
752
|
+
export const ReferralRequest = v.pipe(
|
|
753
|
+
v.object({
|
|
754
|
+
/** Type of request. */
|
|
755
|
+
type: v.pipe(
|
|
756
|
+
v.literal("referral"),
|
|
757
|
+
v.description("Type of request."),
|
|
758
|
+
),
|
|
759
|
+
/** User address. */
|
|
760
|
+
user: v.pipe(
|
|
761
|
+
v.pipe(Hex, v.length(42)),
|
|
762
|
+
v.description("User address."),
|
|
763
|
+
),
|
|
764
|
+
}),
|
|
765
|
+
v.description("Request user referral."),
|
|
766
|
+
);
|
|
767
|
+
export type ReferralRequest = v.InferOutput<typeof ReferralRequest>;
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Request spot clearinghouse state.
|
|
771
|
+
* @returns {SpotClearinghouseState}
|
|
772
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances
|
|
773
|
+
*/
|
|
774
|
+
export const SpotClearinghouseStateRequest = v.pipe(
|
|
775
|
+
v.object({
|
|
776
|
+
/** Type of request. */
|
|
777
|
+
type: v.pipe(
|
|
778
|
+
v.literal("spotClearinghouseState"),
|
|
779
|
+
v.description("Type of request."),
|
|
780
|
+
),
|
|
781
|
+
/** User address. */
|
|
782
|
+
user: v.pipe(
|
|
783
|
+
v.pipe(Hex, v.length(42)),
|
|
784
|
+
v.description("User address."),
|
|
785
|
+
),
|
|
786
|
+
/** DEX name (empty string for main dex). */
|
|
787
|
+
dex: v.pipe(
|
|
788
|
+
v.optional(v.string()),
|
|
789
|
+
v.description("DEX name (empty string for main dex)."),
|
|
790
|
+
),
|
|
791
|
+
}),
|
|
792
|
+
v.description("Request spot clearinghouse state."),
|
|
793
|
+
);
|
|
794
|
+
export type SpotClearinghouseStateRequest = v.InferOutput<typeof SpotClearinghouseStateRequest>;
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Request spot deploy state.
|
|
798
|
+
* @returns {SpotDeployState}
|
|
799
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-deploy-auction
|
|
800
|
+
*/
|
|
801
|
+
export const SpotDeployStateRequest = v.pipe(
|
|
802
|
+
v.object({
|
|
803
|
+
/** Type of request. */
|
|
804
|
+
type: v.pipe(
|
|
805
|
+
v.literal("spotDeployState"),
|
|
806
|
+
v.description("Type of request."),
|
|
807
|
+
),
|
|
808
|
+
/** User address. */
|
|
809
|
+
user: v.pipe(
|
|
810
|
+
v.pipe(Hex, v.length(42)),
|
|
811
|
+
v.description("User address."),
|
|
812
|
+
),
|
|
813
|
+
}),
|
|
814
|
+
v.description("Request spot deploy state."),
|
|
815
|
+
);
|
|
816
|
+
export type SpotDeployStateRequest = v.InferOutput<typeof SpotDeployStateRequest>;
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* Request spot trading metadata.
|
|
820
|
+
* @returns {SpotMeta}
|
|
821
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-metadata
|
|
822
|
+
*/
|
|
823
|
+
export const SpotMetaRequest = v.pipe(
|
|
824
|
+
v.object({
|
|
825
|
+
/** Type of request. */
|
|
826
|
+
type: v.pipe(
|
|
827
|
+
v.literal("spotMeta"),
|
|
828
|
+
v.description("Type of request."),
|
|
829
|
+
),
|
|
830
|
+
}),
|
|
831
|
+
v.description("Request spot trading metadata."),
|
|
832
|
+
);
|
|
833
|
+
export type SpotMetaRequest = v.InferOutput<typeof SpotMetaRequest>;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Request spot metadata and asset contexts.
|
|
837
|
+
* @returns {SpotMetaAndAssetCtxs}
|
|
838
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
|
839
|
+
*/
|
|
840
|
+
export const SpotMetaAndAssetCtxsRequest = v.pipe(
|
|
841
|
+
v.object({
|
|
842
|
+
/** Type of request. */
|
|
843
|
+
type: v.pipe(
|
|
844
|
+
v.literal("spotMetaAndAssetCtxs"),
|
|
845
|
+
v.description("Type of request."),
|
|
846
|
+
),
|
|
847
|
+
}),
|
|
848
|
+
v.description("Request spot metadata and asset contexts."),
|
|
849
|
+
);
|
|
850
|
+
export type SpotMetaAndAssetCtxsRequest = v.InferOutput<typeof SpotMetaAndAssetCtxsRequest>;
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Request for the status of the spot deploy auction.
|
|
854
|
+
* @returns {DeployAuctionStatus}
|
|
855
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-the-spot-pair-deploy-auction
|
|
856
|
+
*/
|
|
857
|
+
export const SpotPairDeployAuctionStatusRequest = v.pipe(
|
|
858
|
+
v.object({
|
|
859
|
+
/** Type of request. */
|
|
860
|
+
type: v.pipe(
|
|
861
|
+
v.literal("spotPairDeployAuctionStatus"),
|
|
862
|
+
v.description("Type of request."),
|
|
863
|
+
),
|
|
864
|
+
}),
|
|
865
|
+
v.description("Request for the status of the spot deploy auction."),
|
|
866
|
+
);
|
|
867
|
+
export type SpotPairDeployAuctionStatusRequest = v.InferOutput<typeof SpotPairDeployAuctionStatusRequest>;
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Request user sub-accounts.
|
|
871
|
+
* @returns {SubAccount[] | null}
|
|
872
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-subaccounts
|
|
873
|
+
*/
|
|
874
|
+
export const SubAccountsRequest = v.pipe(
|
|
875
|
+
v.object({
|
|
876
|
+
/** Type of request. */
|
|
877
|
+
type: v.pipe(
|
|
878
|
+
v.literal("subAccounts"),
|
|
879
|
+
v.description("Type of request."),
|
|
880
|
+
),
|
|
881
|
+
/** User address. */
|
|
882
|
+
user: v.pipe(
|
|
883
|
+
v.pipe(Hex, v.length(42)),
|
|
884
|
+
v.description("User address."),
|
|
885
|
+
),
|
|
886
|
+
}),
|
|
887
|
+
v.description("Request user sub-accounts."),
|
|
888
|
+
);
|
|
889
|
+
export type SubAccountsRequest = v.InferOutput<typeof SubAccountsRequest>;
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Request token details.
|
|
893
|
+
* @returns {TokenDetails}
|
|
894
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-information-about-a-token
|
|
895
|
+
*/
|
|
896
|
+
export const TokenDetailsRequest = v.pipe(
|
|
897
|
+
v.object({
|
|
898
|
+
/** Type of request. */
|
|
899
|
+
type: v.pipe(
|
|
900
|
+
v.literal("tokenDetails"),
|
|
901
|
+
v.description("Type of request."),
|
|
902
|
+
),
|
|
903
|
+
/** Token ID. */
|
|
904
|
+
tokenId: v.pipe(
|
|
905
|
+
v.pipe(Hex, v.length(34)),
|
|
906
|
+
v.description("Token ID."),
|
|
907
|
+
),
|
|
908
|
+
}),
|
|
909
|
+
v.description("Request token details."),
|
|
910
|
+
);
|
|
911
|
+
export type TokenDetailsRequest = v.InferOutput<typeof TokenDetailsRequest>;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Request twap history of a user.
|
|
915
|
+
* @returns {TwapHistory[]}
|
|
916
|
+
* @see null
|
|
917
|
+
*/
|
|
918
|
+
export const TwapHistoryRequest = v.pipe(
|
|
919
|
+
v.object({
|
|
920
|
+
/** Type of request. */
|
|
921
|
+
type: v.pipe(
|
|
922
|
+
v.literal("twapHistory"),
|
|
923
|
+
v.description("Type of request."),
|
|
924
|
+
),
|
|
925
|
+
/** User address. */
|
|
926
|
+
user: v.pipe(
|
|
927
|
+
v.pipe(Hex, v.length(42)),
|
|
928
|
+
v.description("User address."),
|
|
929
|
+
),
|
|
930
|
+
}),
|
|
931
|
+
v.description("Request twap history of a user."),
|
|
932
|
+
);
|
|
933
|
+
export type TwapHistoryRequest = v.InferOutput<typeof TwapHistoryRequest>;
|
|
934
|
+
|
|
935
|
+
/**
|
|
936
|
+
* Request user fees.
|
|
937
|
+
* @returns {UserFees}
|
|
938
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-fees
|
|
939
|
+
*/
|
|
940
|
+
export const UserFeesRequest = v.pipe(
|
|
941
|
+
v.object({
|
|
942
|
+
/** Type of request. */
|
|
943
|
+
type: v.pipe(
|
|
944
|
+
v.literal("userFees"),
|
|
945
|
+
v.description("Type of request."),
|
|
946
|
+
),
|
|
947
|
+
/** User address. */
|
|
948
|
+
user: v.pipe(
|
|
949
|
+
v.pipe(Hex, v.length(42)),
|
|
950
|
+
v.description("User address."),
|
|
951
|
+
),
|
|
952
|
+
}),
|
|
953
|
+
v.description("Request user fees."),
|
|
954
|
+
);
|
|
955
|
+
export type UserFeesRequest = v.InferOutput<typeof UserFeesRequest>;
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* Request user fills.
|
|
959
|
+
* @returns {Fill[]}
|
|
960
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
|
|
961
|
+
*/
|
|
962
|
+
export const UserFillsRequest = v.pipe(
|
|
963
|
+
v.object({
|
|
964
|
+
/** Type of request. */
|
|
965
|
+
type: v.pipe(
|
|
966
|
+
v.literal("userFills"),
|
|
967
|
+
v.description("Type of request."),
|
|
968
|
+
),
|
|
969
|
+
/** User address. */
|
|
970
|
+
user: v.pipe(
|
|
971
|
+
v.pipe(Hex, v.length(42)),
|
|
972
|
+
v.description("User address."),
|
|
973
|
+
),
|
|
974
|
+
/** If true, partial fills are aggregated when a crossing order fills multiple resting orders. */
|
|
975
|
+
aggregateByTime: v.pipe(
|
|
976
|
+
v.optional(v.boolean()),
|
|
977
|
+
v.description("If true, partial fills are aggregated when a crossing order fills multiple resting orders."),
|
|
978
|
+
),
|
|
979
|
+
}),
|
|
980
|
+
v.description("Request user fills."),
|
|
981
|
+
);
|
|
982
|
+
export type UserFillsRequest = v.InferOutput<typeof UserFillsRequest>;
|
|
983
|
+
|
|
984
|
+
/**
|
|
985
|
+
* Request user fills by time.
|
|
986
|
+
* @returns {Fill[]}
|
|
987
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
|
|
988
|
+
*/
|
|
989
|
+
export const UserFillsByTimeRequest = v.pipe(
|
|
990
|
+
v.object({
|
|
991
|
+
/** Type of request. */
|
|
992
|
+
type: v.pipe(
|
|
993
|
+
v.literal("userFillsByTime"),
|
|
994
|
+
v.description("Type of request."),
|
|
995
|
+
),
|
|
996
|
+
/** User address. */
|
|
997
|
+
user: v.pipe(
|
|
998
|
+
v.pipe(Hex, v.length(42)),
|
|
999
|
+
v.description("User address."),
|
|
1000
|
+
),
|
|
1001
|
+
/** Start time (in ms since epoch). */
|
|
1002
|
+
startTime: v.pipe(
|
|
1003
|
+
UnsignedInteger,
|
|
1004
|
+
v.description("Start time (in ms since epoch)."),
|
|
1005
|
+
),
|
|
1006
|
+
/** End time (in ms since epoch). */
|
|
1007
|
+
endTime: v.pipe(
|
|
1008
|
+
v.nullish(UnsignedInteger),
|
|
1009
|
+
v.description("End time (in ms since epoch)."),
|
|
1010
|
+
),
|
|
1011
|
+
/** If true, partial fills are aggregated when a crossing order fills multiple resting orders. */
|
|
1012
|
+
aggregateByTime: v.pipe(
|
|
1013
|
+
v.optional(v.boolean()),
|
|
1014
|
+
v.description("If true, partial fills are aggregated when a crossing order fills multiple resting orders."),
|
|
1015
|
+
),
|
|
1016
|
+
}),
|
|
1017
|
+
v.description("Request user fills by time."),
|
|
1018
|
+
);
|
|
1019
|
+
export type UserFillsByTimeRequest = v.InferOutput<typeof UserFillsByTimeRequest>;
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Request user funding.
|
|
1023
|
+
* @returns {UserFundingUpdate[]}
|
|
1024
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates
|
|
1025
|
+
*/
|
|
1026
|
+
export const UserFundingRequest = v.pipe(
|
|
1027
|
+
v.object({
|
|
1028
|
+
/** Type of request. */
|
|
1029
|
+
type: v.pipe(
|
|
1030
|
+
v.literal("userFunding"),
|
|
1031
|
+
v.description("Type of request."),
|
|
1032
|
+
),
|
|
1033
|
+
/** User address. */
|
|
1034
|
+
user: v.pipe(
|
|
1035
|
+
v.pipe(Hex, v.length(42)),
|
|
1036
|
+
v.description("User address."),
|
|
1037
|
+
),
|
|
1038
|
+
/** Start time (in ms since epoch). */
|
|
1039
|
+
startTime: v.pipe(
|
|
1040
|
+
UnsignedInteger,
|
|
1041
|
+
v.description("Start time (in ms since epoch)."),
|
|
1042
|
+
),
|
|
1043
|
+
/** End time (in ms since epoch). */
|
|
1044
|
+
endTime: v.pipe(
|
|
1045
|
+
v.nullish(UnsignedInteger),
|
|
1046
|
+
v.description("End time (in ms since epoch)."),
|
|
1047
|
+
),
|
|
1048
|
+
}),
|
|
1049
|
+
v.description("Request user funding."),
|
|
1050
|
+
);
|
|
1051
|
+
export type UserFundingRequest = v.InferOutput<typeof UserFundingRequest>;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Request user non-funding ledger updates.
|
|
1055
|
+
* @returns {UserNonFundingLedgerUpdate[]}
|
|
1056
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-a-users-funding-history-or-non-funding-ledger-updates
|
|
1057
|
+
*/
|
|
1058
|
+
export const UserNonFundingLedgerUpdatesRequest = v.pipe(
|
|
1059
|
+
v.object({
|
|
1060
|
+
/** Type of request. */
|
|
1061
|
+
type: v.pipe(
|
|
1062
|
+
v.literal("userNonFundingLedgerUpdates"),
|
|
1063
|
+
v.description("Type of request."),
|
|
1064
|
+
),
|
|
1065
|
+
/** User address. */
|
|
1066
|
+
user: v.pipe(
|
|
1067
|
+
v.pipe(Hex, v.length(42)),
|
|
1068
|
+
v.description("User address."),
|
|
1069
|
+
),
|
|
1070
|
+
/** Start time (in ms since epoch). */
|
|
1071
|
+
startTime: v.pipe(
|
|
1072
|
+
UnsignedInteger,
|
|
1073
|
+
v.description("Start time (in ms since epoch)."),
|
|
1074
|
+
),
|
|
1075
|
+
/** End time (in ms since epoch). */
|
|
1076
|
+
endTime: v.pipe(
|
|
1077
|
+
v.nullish(UnsignedInteger),
|
|
1078
|
+
v.description("End time (in ms since epoch)."),
|
|
1079
|
+
),
|
|
1080
|
+
}),
|
|
1081
|
+
v.description("Request user non-funding ledger updates."),
|
|
1082
|
+
);
|
|
1083
|
+
export type UserNonFundingLedgerUpdatesRequest = v.InferOutput<typeof UserNonFundingLedgerUpdatesRequest>;
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Request user rate limits.
|
|
1087
|
+
* @returns {UserRateLimit}
|
|
1088
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-user-rate-limits
|
|
1089
|
+
*/
|
|
1090
|
+
export const UserRateLimitRequest = v.pipe(
|
|
1091
|
+
v.object({
|
|
1092
|
+
/** Type of request. */
|
|
1093
|
+
type: v.pipe(
|
|
1094
|
+
v.literal("userRateLimit"),
|
|
1095
|
+
v.description("Type of request."),
|
|
1096
|
+
),
|
|
1097
|
+
/** User address. */
|
|
1098
|
+
user: v.pipe(
|
|
1099
|
+
v.pipe(Hex, v.length(42)),
|
|
1100
|
+
v.description("User address."),
|
|
1101
|
+
),
|
|
1102
|
+
}),
|
|
1103
|
+
v.description("Request user rate limits."),
|
|
1104
|
+
);
|
|
1105
|
+
export type UserRateLimitRequest = v.InferOutput<typeof UserRateLimitRequest>;
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* Request user role.
|
|
1109
|
+
* @returns {UserRole}
|
|
1110
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-a-users-role
|
|
1111
|
+
*/
|
|
1112
|
+
export const UserRoleRequest = v.pipe(
|
|
1113
|
+
v.object({
|
|
1114
|
+
/** Type of request. */
|
|
1115
|
+
type: v.pipe(
|
|
1116
|
+
v.literal("userRole"),
|
|
1117
|
+
v.description("Type of request."),
|
|
1118
|
+
),
|
|
1119
|
+
/** User address. */
|
|
1120
|
+
user: v.pipe(
|
|
1121
|
+
v.pipe(Hex, v.length(42)),
|
|
1122
|
+
v.description("User address."),
|
|
1123
|
+
),
|
|
1124
|
+
}),
|
|
1125
|
+
v.description("Request user role."),
|
|
1126
|
+
);
|
|
1127
|
+
export type UserRoleRequest = v.InferOutput<typeof UserRoleRequest>;
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Request multi-sig signers for a user.
|
|
1131
|
+
* @returns {MultiSigSigners | null}
|
|
1132
|
+
* @see null
|
|
1133
|
+
*/
|
|
1134
|
+
export const UserToMultiSigSignersRequest = v.pipe(
|
|
1135
|
+
v.object({
|
|
1136
|
+
/** Type of request. */
|
|
1137
|
+
type: v.pipe(
|
|
1138
|
+
v.literal("userToMultiSigSigners"),
|
|
1139
|
+
v.description("Type of request."),
|
|
1140
|
+
),
|
|
1141
|
+
/** User address. */
|
|
1142
|
+
user: v.pipe(
|
|
1143
|
+
v.pipe(Hex, v.length(42)),
|
|
1144
|
+
v.description("User address."),
|
|
1145
|
+
),
|
|
1146
|
+
}),
|
|
1147
|
+
v.description("Request multi-sig signers for a user."),
|
|
1148
|
+
);
|
|
1149
|
+
export type UserToMultiSigSignersRequest = v.InferOutput<typeof UserToMultiSigSignersRequest>;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Request user TWAP slice fills.
|
|
1153
|
+
* @returns {TwapSliceFill[]}
|
|
1154
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-twap-slice-fills
|
|
1155
|
+
*/
|
|
1156
|
+
export const UserTwapSliceFillsRequest = v.pipe(
|
|
1157
|
+
v.object({
|
|
1158
|
+
/** Type of request. */
|
|
1159
|
+
type: v.pipe(
|
|
1160
|
+
v.literal("userTwapSliceFills"),
|
|
1161
|
+
v.description("Type of request."),
|
|
1162
|
+
),
|
|
1163
|
+
/** User address. */
|
|
1164
|
+
user: v.pipe(
|
|
1165
|
+
v.pipe(Hex, v.length(42)),
|
|
1166
|
+
v.description("User address."),
|
|
1167
|
+
),
|
|
1168
|
+
}),
|
|
1169
|
+
v.description("Request user TWAP slice fills."),
|
|
1170
|
+
);
|
|
1171
|
+
export type UserTwapSliceFillsRequest = v.InferOutput<typeof UserTwapSliceFillsRequest>;
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Request user TWAP slice fills by time.
|
|
1175
|
+
* @returns {TwapSliceFill[]}
|
|
1176
|
+
* @see null
|
|
1177
|
+
*/
|
|
1178
|
+
export const UserTwapSliceFillsByTimeRequest = v.pipe(
|
|
1179
|
+
v.object({
|
|
1180
|
+
/** Type of request. */
|
|
1181
|
+
type: v.pipe(
|
|
1182
|
+
v.literal("userTwapSliceFillsByTime"),
|
|
1183
|
+
v.description("Type of request."),
|
|
1184
|
+
),
|
|
1185
|
+
/** User address. */
|
|
1186
|
+
user: v.pipe(
|
|
1187
|
+
v.pipe(Hex, v.length(42)),
|
|
1188
|
+
v.description("User address."),
|
|
1189
|
+
),
|
|
1190
|
+
/** Start time (in ms since epoch). */
|
|
1191
|
+
startTime: v.pipe(
|
|
1192
|
+
UnsignedInteger,
|
|
1193
|
+
v.description("Start time (in ms since epoch)."),
|
|
1194
|
+
),
|
|
1195
|
+
/** End time (in ms since epoch). */
|
|
1196
|
+
endTime: v.pipe(
|
|
1197
|
+
v.nullish(UnsignedInteger),
|
|
1198
|
+
v.description("End time (in ms since epoch)."),
|
|
1199
|
+
),
|
|
1200
|
+
/** If true, partial fills are aggregated when a crossing order fills multiple resting orders. */
|
|
1201
|
+
aggregateByTime: v.pipe(
|
|
1202
|
+
v.optional(v.boolean()),
|
|
1203
|
+
v.description("If true, partial fills are aggregated when a crossing order fills multiple resting orders."),
|
|
1204
|
+
),
|
|
1205
|
+
}),
|
|
1206
|
+
v.description("Request user TWAP slice fills by time."),
|
|
1207
|
+
);
|
|
1208
|
+
export type UserTwapSliceFillsByTimeRequest = v.InferOutput<typeof UserTwapSliceFillsByTimeRequest>;
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Request user vault deposits.
|
|
1212
|
+
* @returns {VaultEquity[]}
|
|
1213
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-vault-deposits
|
|
1214
|
+
*/
|
|
1215
|
+
export const UserVaultEquitiesRequest = v.pipe(
|
|
1216
|
+
v.object({
|
|
1217
|
+
/** Type of request. */
|
|
1218
|
+
type: v.pipe(
|
|
1219
|
+
v.literal("userVaultEquities"),
|
|
1220
|
+
v.description("Type of request."),
|
|
1221
|
+
),
|
|
1222
|
+
/** User address. */
|
|
1223
|
+
user: v.pipe(
|
|
1224
|
+
v.pipe(Hex, v.length(42)),
|
|
1225
|
+
v.description("User address."),
|
|
1226
|
+
),
|
|
1227
|
+
}),
|
|
1228
|
+
v.description("Request user vault deposits."),
|
|
1229
|
+
);
|
|
1230
|
+
export type UserVaultEquitiesRequest = v.InferOutput<typeof UserVaultEquitiesRequest>;
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* Request validator L1 votes.
|
|
1234
|
+
* @returns {unknown[]} FIXME: Define the return type
|
|
1235
|
+
* @see null
|
|
1236
|
+
*/
|
|
1237
|
+
export const ValidatorL1VotesRequest = v.pipe(
|
|
1238
|
+
v.object({
|
|
1239
|
+
/** Type of request. */
|
|
1240
|
+
type: v.pipe(
|
|
1241
|
+
v.literal("validatorL1Votes"),
|
|
1242
|
+
v.description("Type of request."),
|
|
1243
|
+
),
|
|
1244
|
+
}),
|
|
1245
|
+
v.description("Request validator L1 votes."),
|
|
1246
|
+
);
|
|
1247
|
+
export type ValidatorL1VotesRequest = v.InferOutput<typeof ValidatorL1VotesRequest>;
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* Request validator summaries.
|
|
1251
|
+
* @returns {ValidatorSummary[]}
|
|
1252
|
+
* @see null
|
|
1253
|
+
*/
|
|
1254
|
+
export const ValidatorSummariesRequest = v.pipe(
|
|
1255
|
+
v.object({
|
|
1256
|
+
/** Type of request. */
|
|
1257
|
+
type: v.pipe(
|
|
1258
|
+
v.literal("validatorSummaries"),
|
|
1259
|
+
v.description("Type of request."),
|
|
1260
|
+
),
|
|
1261
|
+
}),
|
|
1262
|
+
v.description("Request validator summaries."),
|
|
1263
|
+
);
|
|
1264
|
+
export type ValidatorSummariesRequest = v.InferOutput<typeof ValidatorSummariesRequest>;
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Request details of a vault.
|
|
1268
|
+
* @returns {VaultDetails | null}
|
|
1269
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-details-for-a-vault
|
|
1270
|
+
*/
|
|
1271
|
+
export const VaultDetailsRequest = v.pipe(
|
|
1272
|
+
v.object({
|
|
1273
|
+
/** Type of request. */
|
|
1274
|
+
type: v.pipe(
|
|
1275
|
+
v.literal("vaultDetails"),
|
|
1276
|
+
v.description("Type of request."),
|
|
1277
|
+
),
|
|
1278
|
+
/** Vault address. */
|
|
1279
|
+
vaultAddress: v.pipe(
|
|
1280
|
+
v.pipe(Hex, v.length(42)),
|
|
1281
|
+
v.description("Vault address."),
|
|
1282
|
+
),
|
|
1283
|
+
/** User address. */
|
|
1284
|
+
user: v.pipe(
|
|
1285
|
+
v.nullish(v.pipe(Hex, v.length(42))),
|
|
1286
|
+
v.description("User address."),
|
|
1287
|
+
),
|
|
1288
|
+
}),
|
|
1289
|
+
v.description("Request details of a vault."),
|
|
1290
|
+
);
|
|
1291
|
+
export type VaultDetailsRequest = v.InferOutput<typeof VaultDetailsRequest>;
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Request a list of vaults less than 2 hours old.
|
|
1295
|
+
* @returns {VaultSummary[]}
|
|
1296
|
+
* @see null
|
|
1297
|
+
*/
|
|
1298
|
+
export const VaultSummariesRequest = v.pipe(
|
|
1299
|
+
v.object({
|
|
1300
|
+
/** Type of request. */
|
|
1301
|
+
type: v.pipe(
|
|
1302
|
+
v.literal("vaultSummaries"),
|
|
1303
|
+
v.description("Type of request."),
|
|
1304
|
+
),
|
|
1305
|
+
}),
|
|
1306
|
+
v.description("Request a list of vaults less than 2 hours old."),
|
|
1307
|
+
);
|
|
1308
|
+
export type VaultSummariesRequest = v.InferOutput<typeof VaultSummariesRequest>;
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* Request gossip root IPs.
|
|
1312
|
+
* @returns {GossipRootIps[]}
|
|
1313
|
+
* @see null
|
|
1314
|
+
*/
|
|
1315
|
+
export const GossipRootIpsRequest = v.pipe(
|
|
1316
|
+
v.object({
|
|
1317
|
+
/** Type of request. */
|
|
1318
|
+
type: v.pipe(
|
|
1319
|
+
v.literal("gossipRootIps"),
|
|
1320
|
+
v.description("Type of request."),
|
|
1321
|
+
),
|
|
1322
|
+
}),
|
|
1323
|
+
v.description("Request gossip root IPs."),
|
|
1324
|
+
);
|
|
1325
|
+
export type GossipRootIpsRequest = v.InferOutput<typeof GossipRootIpsRequest>;
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* Request recent trades.
|
|
1329
|
+
* @returns {Trade[]}
|
|
1330
|
+
* @see null
|
|
1331
|
+
*/
|
|
1332
|
+
export const RecentTradesRequest = v.pipe(
|
|
1333
|
+
v.object({
|
|
1334
|
+
/** Type of request. */
|
|
1335
|
+
type: v.pipe(
|
|
1336
|
+
v.literal("recentTrades"),
|
|
1337
|
+
v.description("Type of request."),
|
|
1338
|
+
),
|
|
1339
|
+
/** Asset symbol (e.g., BTC). */
|
|
1340
|
+
coin: v.pipe(
|
|
1341
|
+
v.string(),
|
|
1342
|
+
v.description("Asset symbol (e.g., BTC)."),
|
|
1343
|
+
),
|
|
1344
|
+
}),
|
|
1345
|
+
v.description("Request recent trades."),
|
|
1346
|
+
);
|
|
1347
|
+
export type RecentTradesRequest = v.InferOutput<typeof RecentTradesRequest>;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Request builder deployed perpetual market limits.
|
|
1351
|
+
* @returns {PerpDexLimits}
|
|
1352
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-builder-deployed-perp-market-limits
|
|
1353
|
+
*/
|
|
1354
|
+
export const PerpDexLimitsRequest = v.pipe(
|
|
1355
|
+
v.object({
|
|
1356
|
+
/** Type of request. */
|
|
1357
|
+
type: v.pipe(
|
|
1358
|
+
v.literal("perpDexLimits"),
|
|
1359
|
+
v.description("Type of request."),
|
|
1360
|
+
),
|
|
1361
|
+
/** DEX name (empty string for main dex). */
|
|
1362
|
+
dex: v.pipe(
|
|
1363
|
+
v.string(),
|
|
1364
|
+
v.description("DEX name (empty string for main dex)."),
|
|
1365
|
+
),
|
|
1366
|
+
}),
|
|
1367
|
+
v.description("Request perpetual DEX limits."),
|
|
1368
|
+
);
|
|
1369
|
+
export type PerpDexLimitsRequest = v.InferOutput<typeof PerpDexLimitsRequest>;
|