@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,1414 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { Hex, TokenId, UnsignedDecimal, UnsignedInteger } from "../_base.js";
|
|
3
|
+
/** Deeply removes undefined keys from an object. */
|
|
4
|
+
function removeUndefinedKeys(obj) {
|
|
5
|
+
if (typeof obj !== "object" || obj === null) {
|
|
6
|
+
return obj;
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(obj)) {
|
|
9
|
+
return obj.map((value) => removeUndefinedKeys(value));
|
|
10
|
+
}
|
|
11
|
+
const result = {};
|
|
12
|
+
const entries = Object.entries(obj);
|
|
13
|
+
for (const [key, value] of entries) {
|
|
14
|
+
if (value !== undefined) {
|
|
15
|
+
result[key] = removeUndefinedKeys(value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
const Percent = v.pipe(v.string(), v.regex(/^[0-9]+(\.[0-9]+)?%$/), v.transform((value) => value));
|
|
21
|
+
/** ECDSA signature components for Ethereum typed data. */
|
|
22
|
+
export const Signature = v.pipe(v.object({
|
|
23
|
+
/** First 32-byte component of ECDSA signature. */
|
|
24
|
+
r: v.pipe(v.pipe(Hex, v.length(66), v.transform((value) => value.replace(/^0x0+/, "0x"))), v.description("First 32-byte component of ECDSA signature.")),
|
|
25
|
+
/** Second 32-byte component of ECDSA signature. */
|
|
26
|
+
s: v.pipe(v.pipe(Hex, v.length(66), v.transform((value) => value.replace(/^0x0+/, "0x"))), v.description("Second 32-byte component of ECDSA signature.")),
|
|
27
|
+
/** Recovery identifier. */
|
|
28
|
+
v: v.pipe(v.union([v.literal(27), v.literal(28)]), v.description("Recovery identifier.")),
|
|
29
|
+
}), v.description("ECDSA signature components for Ethereum typed data."));
|
|
30
|
+
/** Order parameters. */
|
|
31
|
+
export const OrderParams = v.pipe(v.object({
|
|
32
|
+
/** Asset ID. */
|
|
33
|
+
a: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
34
|
+
/** Position side (`true` for long, `false` for short). */
|
|
35
|
+
b: v.pipe(v.boolean(), v.description("Position side (`true` for long, `false` for short).")),
|
|
36
|
+
/** Price. */
|
|
37
|
+
p: v.pipe(UnsignedDecimal, v.description("Price.")),
|
|
38
|
+
/** Size (in base currency units). */
|
|
39
|
+
s: v.pipe(UnsignedDecimal, v.description("Size (in base currency units).")),
|
|
40
|
+
/** Is reduce-only? */
|
|
41
|
+
r: v.pipe(v.boolean(), v.description("Is reduce-only?")),
|
|
42
|
+
/** Order type. */
|
|
43
|
+
t: v.pipe(v.union([
|
|
44
|
+
v.object({
|
|
45
|
+
/** Limit order parameters. */
|
|
46
|
+
limit: v.pipe(v.object({
|
|
47
|
+
/** Time-in-force. */
|
|
48
|
+
tif: v.pipe(v.union([
|
|
49
|
+
v.literal("Gtc"),
|
|
50
|
+
v.literal("Ioc"),
|
|
51
|
+
v.literal("Alo"),
|
|
52
|
+
v.literal("FrontendMarket"),
|
|
53
|
+
v.literal("LiquidationMarket"),
|
|
54
|
+
]), v.description("Time-in-force.")),
|
|
55
|
+
}), v.description("Limit order parameters.")),
|
|
56
|
+
}),
|
|
57
|
+
v.object({
|
|
58
|
+
/** Trigger order parameters. */
|
|
59
|
+
trigger: v.pipe(v.object({
|
|
60
|
+
/** Is market order? */
|
|
61
|
+
isMarket: v.pipe(v.boolean(), v.description("Is market order?")),
|
|
62
|
+
/** Trigger price. */
|
|
63
|
+
triggerPx: v.pipe(UnsignedDecimal, v.description("Trigger price.")),
|
|
64
|
+
/** Indicates whether it is take profit or stop loss. */
|
|
65
|
+
tpsl: v.pipe(v.union([v.literal("tp"), v.literal("sl")]), v.description("Indicates whether it is take profit or stop loss.")),
|
|
66
|
+
}), v.description("Trigger order parameters.")),
|
|
67
|
+
}),
|
|
68
|
+
]), v.description("Order type.")),
|
|
69
|
+
/** Client Order ID. */
|
|
70
|
+
c: v.pipe(v.optional(v.pipe(Hex, v.length(34))), v.description("Client Order ID.")),
|
|
71
|
+
}), v.transform(removeUndefinedKeys), v.description("Order parameters."));
|
|
72
|
+
/**
|
|
73
|
+
* Approve an agent to sign on behalf of the master account.
|
|
74
|
+
* @returns {SuccessResponse}
|
|
75
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
|
|
76
|
+
*/
|
|
77
|
+
export const ApproveAgentRequest = v.pipe(v.object({
|
|
78
|
+
/** Action to perform. */
|
|
79
|
+
action: v.pipe(v.object({
|
|
80
|
+
/** Type of action. */
|
|
81
|
+
type: v.pipe(v.literal("approveAgent"), v.description("Type of action.")),
|
|
82
|
+
/** Chain ID used for signing. */
|
|
83
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
84
|
+
/** HyperLiquid network. */
|
|
85
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
86
|
+
/** Agent address. */
|
|
87
|
+
agentAddress: v.pipe(v.pipe(Hex, v.length(42)), v.description("Agent address.")),
|
|
88
|
+
/** Agent name or null for unnamed agent. */
|
|
89
|
+
agentName: v.pipe(v.nullable(v.string()), v.description("Agent name or null for unnamed agent.")),
|
|
90
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
91
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
92
|
+
}), v.description("Action to perform.")),
|
|
93
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
94
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
95
|
+
/** Cryptographic signature. */
|
|
96
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
97
|
+
}), v.transform(removeUndefinedKeys), v.description("Approve an agent to sign on behalf of the master account."));
|
|
98
|
+
/**
|
|
99
|
+
* Approve a maximum fee rate for a builder.
|
|
100
|
+
* @returns {SuccessResponse}
|
|
101
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
|
|
102
|
+
*/
|
|
103
|
+
export const ApproveBuilderFeeRequest = v.pipe(v.object({
|
|
104
|
+
/** Action to perform. */
|
|
105
|
+
action: v.pipe(v.object({
|
|
106
|
+
/** Type of action. */
|
|
107
|
+
type: v.pipe(v.literal("approveBuilderFee"), v.description("Type of action.")),
|
|
108
|
+
/** Chain ID used for signing. */
|
|
109
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
110
|
+
/** HyperLiquid network. */
|
|
111
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
112
|
+
/** Max fee rate (e.g., "0.01%"). */
|
|
113
|
+
maxFeeRate: v.pipe(Percent, v.description('Max fee rate (e.g., "0.01%").')),
|
|
114
|
+
/** Builder address. */
|
|
115
|
+
builder: v.pipe(v.pipe(Hex, v.length(42)), v.description("Builder address.")),
|
|
116
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
117
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
118
|
+
}), v.description("Action to perform.")),
|
|
119
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
120
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
121
|
+
/** Cryptographic signature. */
|
|
122
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
123
|
+
}), v.transform(removeUndefinedKeys), v.description("Approve a maximum fee rate for a builder."));
|
|
124
|
+
/**
|
|
125
|
+
* Modify multiple orders.
|
|
126
|
+
* @returns {OrderResponse}
|
|
127
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
128
|
+
*/
|
|
129
|
+
export const BatchModifyRequest = v.pipe(v.object({
|
|
130
|
+
/** Action to perform. */
|
|
131
|
+
action: v.pipe(v.object({
|
|
132
|
+
/** Type of action. */
|
|
133
|
+
type: v.pipe(v.literal("batchModify"), v.description("Type of action.")),
|
|
134
|
+
/** Order modifications. */
|
|
135
|
+
modifies: v.pipe(v.array(v.object({
|
|
136
|
+
/** Order ID or Client Order ID. */
|
|
137
|
+
oid: v.pipe(v.union([
|
|
138
|
+
UnsignedInteger,
|
|
139
|
+
v.pipe(Hex, v.length(34)),
|
|
140
|
+
]), v.description("Order ID or Client Order ID.")),
|
|
141
|
+
/** New order parameters. */
|
|
142
|
+
order: v.pipe(OrderParams, v.description("New order parameters.")),
|
|
143
|
+
})), v.description("Order modifications.")),
|
|
144
|
+
}), v.description("Action to perform.")),
|
|
145
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
146
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
147
|
+
/** Cryptographic signature. */
|
|
148
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
149
|
+
/** Vault address (for vault trading). */
|
|
150
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
151
|
+
/** Expiration time of the action. */
|
|
152
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
153
|
+
}), v.transform(removeUndefinedKeys), v.description("Modify multiple orders."));
|
|
154
|
+
/**
|
|
155
|
+
* Cancel order(s).
|
|
156
|
+
* @returns {CancelResponse}
|
|
157
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
158
|
+
*/
|
|
159
|
+
export const CancelRequest = v.pipe(v.object({
|
|
160
|
+
/** Action to perform. */
|
|
161
|
+
action: v.pipe(v.object({
|
|
162
|
+
/** Type of action. */
|
|
163
|
+
type: v.pipe(v.literal("cancel"), v.description("Type of action.")),
|
|
164
|
+
/** Orders to cancel. */
|
|
165
|
+
cancels: v.pipe(v.array(v.object({
|
|
166
|
+
/** Asset ID. */
|
|
167
|
+
a: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
168
|
+
/** Order ID. */
|
|
169
|
+
o: v.pipe(UnsignedInteger, v.description("Order ID.")),
|
|
170
|
+
})), v.description("Orders to cancel.")),
|
|
171
|
+
}), v.description("Action to perform.")),
|
|
172
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
173
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
174
|
+
/** Cryptographic signature. */
|
|
175
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
176
|
+
/** Vault address (for vault trading). */
|
|
177
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
178
|
+
/** Expiration time of the action. */
|
|
179
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
180
|
+
}), v.transform(removeUndefinedKeys), v.description("Cancel order(s)."));
|
|
181
|
+
/**
|
|
182
|
+
* Cancel order(s) by cloid.
|
|
183
|
+
* @returns {CancelResponse}
|
|
184
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
185
|
+
*/
|
|
186
|
+
export const CancelByCloidRequest = v.pipe(v.object({
|
|
187
|
+
/** Action to perform. */
|
|
188
|
+
action: v.pipe(v.object({
|
|
189
|
+
/** Type of action. */
|
|
190
|
+
type: v.pipe(v.literal("cancelByCloid"), v.description("Type of action.")),
|
|
191
|
+
/** Orders to cancel. */
|
|
192
|
+
cancels: v.pipe(v.array(v.object({
|
|
193
|
+
/** Asset ID. */
|
|
194
|
+
asset: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
195
|
+
/** Client Order ID. */
|
|
196
|
+
cloid: v.pipe(v.pipe(Hex, v.length(34)), v.description("Client Order ID.")),
|
|
197
|
+
})), v.description("Orders to cancel.")),
|
|
198
|
+
}), v.description("Action to perform.")),
|
|
199
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
200
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
201
|
+
/** Cryptographic signature. */
|
|
202
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
203
|
+
/** Vault address (for vault trading). */
|
|
204
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
205
|
+
/** Expiration time of the action. */
|
|
206
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
207
|
+
}), v.transform(removeUndefinedKeys), v.description("Cancel order(s) by cloid."));
|
|
208
|
+
/**
|
|
209
|
+
* Transfer native token from the user spot account into staking for delegating to validators.
|
|
210
|
+
* @returns {SuccessResponse}
|
|
211
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
|
|
212
|
+
*/
|
|
213
|
+
export const CDepositRequest = v.pipe(v.object({
|
|
214
|
+
/** Action to perform. */
|
|
215
|
+
action: v.pipe(v.object({
|
|
216
|
+
/** Type of action. */
|
|
217
|
+
type: v.pipe(v.literal("cDeposit"), v.description("Type of action.")),
|
|
218
|
+
/** Chain ID used for signing. */
|
|
219
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
220
|
+
/** HyperLiquid network. */
|
|
221
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
222
|
+
/** Amount of wei to deposit into staking balance (float * 1e8). */
|
|
223
|
+
wei: v.pipe(UnsignedInteger, v.description("Amount of wei to deposit into staking balance (float * 1e8).")),
|
|
224
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
225
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
226
|
+
}), v.description("Action to perform.")),
|
|
227
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
228
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
229
|
+
/** Cryptographic signature. */
|
|
230
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
231
|
+
}), v.transform(removeUndefinedKeys), v.description("Transfer native token from the user spot account into staking for delegating to validators."));
|
|
232
|
+
/**
|
|
233
|
+
* Claim rewards from referral program.
|
|
234
|
+
* @returns {SuccessResponse}
|
|
235
|
+
* @see null
|
|
236
|
+
*/
|
|
237
|
+
export const ClaimRewardsRequest = v.pipe(v.object({
|
|
238
|
+
/** Action to perform. */
|
|
239
|
+
action: v.pipe(v.object({
|
|
240
|
+
/** Type of action. */
|
|
241
|
+
type: v.pipe(v.literal("claimRewards"), v.description("Type of action.")),
|
|
242
|
+
}), v.description("Action to perform.")),
|
|
243
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
244
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
245
|
+
/** Cryptographic signature. */
|
|
246
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
247
|
+
/** Expiration time of the action. */
|
|
248
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
249
|
+
}), v.transform(removeUndefinedKeys), v.description("Claim rewards from referral program."));
|
|
250
|
+
/** Signers configuration for {@linkcode ConvertToMultiSigUserRequest}. */
|
|
251
|
+
export const ConvertToMultiSigUserRequestSigners = v.pipe(v.union([
|
|
252
|
+
v.object({
|
|
253
|
+
/** List of authorized user addresses. */
|
|
254
|
+
authorizedUsers: v.pipe(v.array(v.pipe(Hex, v.length(42))), v.description("List of authorized user addresses.")),
|
|
255
|
+
/** Minimum number of signatures required. */
|
|
256
|
+
threshold: v.pipe(UnsignedInteger, v.description("Minimum number of signatures required.")),
|
|
257
|
+
}),
|
|
258
|
+
/** Convert a multi-signature account to a single-signature account. */
|
|
259
|
+
v.pipe(v.null(), v.description("Convert a multi-signature account to a single-signature account.")),
|
|
260
|
+
]), v.description("Signers configuration for `ConvertToMultiSigUserRequest`"));
|
|
261
|
+
/**
|
|
262
|
+
* Convert a single-signature account to a multi-signature account.
|
|
263
|
+
* @returns {SuccessResponse}
|
|
264
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
265
|
+
*/
|
|
266
|
+
export const ConvertToMultiSigUserRequest = v.pipe(v.object({
|
|
267
|
+
/** Action to perform. */
|
|
268
|
+
action: v.pipe(v.object({
|
|
269
|
+
/** Type of action. */
|
|
270
|
+
type: v.pipe(v.literal("convertToMultiSigUser"), v.description("Type of action.")),
|
|
271
|
+
/** Chain ID used for signing. */
|
|
272
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
273
|
+
/** HyperLiquid network. */
|
|
274
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
275
|
+
/**
|
|
276
|
+
* Signers configuration.
|
|
277
|
+
*
|
|
278
|
+
* Must be {@linkcode ConvertToMultiSigUserRequestSigners} converted to a string via `JSON.stringify(...)`.
|
|
279
|
+
*/
|
|
280
|
+
signers: v.pipe(v.union([
|
|
281
|
+
v.pipe(v.string(), v.parseJson(), ConvertToMultiSigUserRequestSigners, v.stringifyJson()),
|
|
282
|
+
v.pipe(ConvertToMultiSigUserRequestSigners, v.stringifyJson()),
|
|
283
|
+
]), v.description("Signers configuration." +
|
|
284
|
+
"\n\nMust be `ConvertToMultiSigUserRequestSigners` converted to a string via `JSON.stringify(...)`.")),
|
|
285
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
286
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
287
|
+
}), v.description("Action to perform.")),
|
|
288
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
289
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
290
|
+
/** Cryptographic signature. */
|
|
291
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
292
|
+
}), v.transform(removeUndefinedKeys), v.description("Convert a single-signature account to a multi-signature account."));
|
|
293
|
+
/**
|
|
294
|
+
* Create a sub-account.
|
|
295
|
+
* @returns {CreateSubAccountResponse}
|
|
296
|
+
* @see null
|
|
297
|
+
*/
|
|
298
|
+
export const CreateSubAccountRequest = v.pipe(v.object({
|
|
299
|
+
/** Action to perform. */
|
|
300
|
+
action: v.pipe(v.object({
|
|
301
|
+
/** Type of action. */
|
|
302
|
+
type: v.pipe(v.literal("createSubAccount"), v.description("Type of action.")),
|
|
303
|
+
/** Sub-account name. */
|
|
304
|
+
name: v.pipe(v.string(), v.minLength(1), v.description("Sub-account name.")),
|
|
305
|
+
}), v.description("Action to perform.")),
|
|
306
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
307
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
308
|
+
/** Cryptographic signature. */
|
|
309
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
310
|
+
/** Expiration time of the action. */
|
|
311
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
312
|
+
}), v.transform(removeUndefinedKeys), v.description("Create a sub-account."));
|
|
313
|
+
/**
|
|
314
|
+
* Create a vault.
|
|
315
|
+
* @returns {CreateVaultResponse}
|
|
316
|
+
* @see null
|
|
317
|
+
*/
|
|
318
|
+
export const CreateVaultRequest = v.pipe(v.object({
|
|
319
|
+
/** Action to perform. */
|
|
320
|
+
action: v.pipe(v.object({
|
|
321
|
+
/** Type of action. */
|
|
322
|
+
type: v.pipe(v.literal("createVault"), v.description("Type of action.")),
|
|
323
|
+
/** Vault name. */
|
|
324
|
+
name: v.pipe(v.string(), v.minLength(3), v.description("Vault name.")),
|
|
325
|
+
/** Vault description. */
|
|
326
|
+
description: v.pipe(v.string(), v.minLength(10), v.description("Vault description.")),
|
|
327
|
+
/** Initial balance (float * 1e6). */
|
|
328
|
+
initialUsd: v.pipe(UnsignedInteger, v.minValue(100000000), // 100 USDC
|
|
329
|
+
v.description("Initial balance (float * 1e6).")),
|
|
330
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
331
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
332
|
+
}), v.description("Action to perform.")),
|
|
333
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
334
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
335
|
+
/** Cryptographic signature. */
|
|
336
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
337
|
+
/** Expiration time of the action. */
|
|
338
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
339
|
+
}), v.transform(removeUndefinedKeys), v.description("Create a vault."));
|
|
340
|
+
/**
|
|
341
|
+
* Perform an action on a signer:
|
|
342
|
+
* - Jail to prevent them from signing transactions.
|
|
343
|
+
* - Unjail to allow them to sign transactions again.
|
|
344
|
+
* @returns {SuccessResponse}
|
|
345
|
+
* @see null
|
|
346
|
+
*/
|
|
347
|
+
export const CSignerActionRequest = v.pipe(v.object({
|
|
348
|
+
/** Action to perform. */
|
|
349
|
+
action: v.pipe(v.union([
|
|
350
|
+
v.object({
|
|
351
|
+
/** Type of action. */
|
|
352
|
+
type: v.pipe(v.literal("CSignerAction"), v.description("Type of action.")),
|
|
353
|
+
/** Jail the signer. */
|
|
354
|
+
jailSelf: v.pipe(v.null(), v.description("Jail the signer.")),
|
|
355
|
+
}),
|
|
356
|
+
v.object({
|
|
357
|
+
/** Type of action. */
|
|
358
|
+
type: v.pipe(v.literal("CSignerAction"), v.description("Type of action.")),
|
|
359
|
+
/** Unjail the signer. */
|
|
360
|
+
unjailSelf: v.pipe(v.null(), v.description("Unjail the signer.")),
|
|
361
|
+
}),
|
|
362
|
+
]), v.description("Action to perform.")),
|
|
363
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
364
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
365
|
+
/** Cryptographic signature. */
|
|
366
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
367
|
+
/** Expiration time of the action. */
|
|
368
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
369
|
+
}), v.transform(removeUndefinedKeys), v.description("Perform an action on a signer." +
|
|
370
|
+
"\n- Jail to prevent them from signing transactions." +
|
|
371
|
+
"\n- Unjail to allow them to sign transactions again."));
|
|
372
|
+
/**
|
|
373
|
+
* Perform an action on a validator:
|
|
374
|
+
* - Change profile information.
|
|
375
|
+
* - Register a new validator.
|
|
376
|
+
* - Unregister an existing validator.
|
|
377
|
+
* @returns {SuccessResponse}
|
|
378
|
+
* @see null
|
|
379
|
+
*/
|
|
380
|
+
export const CValidatorActionRequest = v.pipe(v.object({
|
|
381
|
+
/** Action to perform. */
|
|
382
|
+
action: v.pipe(v.union([
|
|
383
|
+
v.object({
|
|
384
|
+
/** Type of action. */
|
|
385
|
+
type: v.pipe(v.literal("CValidatorAction"), v.description("Type of action.")),
|
|
386
|
+
/** Profile changes to apply. */
|
|
387
|
+
changeProfile: v.pipe(v.object({
|
|
388
|
+
/** Validator node IP address. */
|
|
389
|
+
node_ip: v.pipe(v.union([
|
|
390
|
+
v.object({
|
|
391
|
+
/** IP address. */
|
|
392
|
+
Ip: v.pipe(v.string(), v.ip(), v.description("IP address.")),
|
|
393
|
+
}),
|
|
394
|
+
v.null(),
|
|
395
|
+
]), v.description("Validator node IP address.")),
|
|
396
|
+
/** Validator name. */
|
|
397
|
+
name: v.pipe(v.nullable(v.string()), v.description("Validator name.")),
|
|
398
|
+
/** Validator description. */
|
|
399
|
+
description: v.pipe(v.nullable(v.string()), v.description("Validator description.")),
|
|
400
|
+
/** Validator jail status. */
|
|
401
|
+
unjailed: v.pipe(v.boolean(), v.description("Validator jail status.")),
|
|
402
|
+
/** Enable or disable delegations. */
|
|
403
|
+
disable_delegations: v.pipe(v.nullable(v.boolean()), v.description("Enable or disable delegations.")),
|
|
404
|
+
/** Commission rate in basis points (1 = 0.0001%). */
|
|
405
|
+
commission_bps: v.pipe(v.nullable(UnsignedInteger), v.description("Commission rate in basis points (1 = 0.0001%).")),
|
|
406
|
+
/** Signer address. */
|
|
407
|
+
signer: v.pipe(v.nullable(v.pipe(Hex, v.length(42))), v.description("Signer address.")),
|
|
408
|
+
}), v.description("Profile changes to apply.")),
|
|
409
|
+
}),
|
|
410
|
+
v.object({
|
|
411
|
+
/** Type of action. */
|
|
412
|
+
type: v.pipe(v.literal("CValidatorAction"), v.description("Type of action.")),
|
|
413
|
+
/** Registration parameters. */
|
|
414
|
+
register: v.pipe(v.object({
|
|
415
|
+
/** Validator profile information. */
|
|
416
|
+
profile: v.pipe(v.object({
|
|
417
|
+
/** Validator node IP address. */
|
|
418
|
+
node_ip: v.pipe(v.object({
|
|
419
|
+
/** IP address. */
|
|
420
|
+
Ip: v.pipe(v.string(), v.ip(), v.description("IP address.")),
|
|
421
|
+
}), v.description("Validator node IP address.")),
|
|
422
|
+
/** Validator name. */
|
|
423
|
+
name: v.pipe(v.string(), v.description("Validator name.")),
|
|
424
|
+
/** Validator description. */
|
|
425
|
+
description: v.pipe(v.string(), v.description("Validator description.")),
|
|
426
|
+
/** Whether delegations are disabled. */
|
|
427
|
+
delegations_disabled: v.pipe(v.boolean(), v.description("Whether delegations are disabled.")),
|
|
428
|
+
/** Commission rate in basis points (1 = 0.0001%). */
|
|
429
|
+
commission_bps: v.pipe(UnsignedInteger, v.description("Commission rate in basis points (1 = 0.0001%).")),
|
|
430
|
+
/** Signer address. */
|
|
431
|
+
signer: v.pipe(v.pipe(Hex, v.length(42)), v.description("Signer address.")),
|
|
432
|
+
}), v.description("Validator profile information.")),
|
|
433
|
+
/** Initial jail status. */
|
|
434
|
+
unjailed: v.pipe(v.boolean(), v.description("Initial jail status.")),
|
|
435
|
+
/** Initial stake amount in wei. */
|
|
436
|
+
initial_wei: v.pipe(UnsignedInteger, v.description("Initial stake amount in wei.")),
|
|
437
|
+
}), v.description("Registration parameters.")),
|
|
438
|
+
}),
|
|
439
|
+
v.object({
|
|
440
|
+
/** Type of action. */
|
|
441
|
+
type: v.pipe(v.literal("CValidatorAction"), v.description("Type of action.")),
|
|
442
|
+
/** Unregister the validator. */
|
|
443
|
+
unregister: v.pipe(v.null(), v.description("Unregister the validator.")),
|
|
444
|
+
}),
|
|
445
|
+
]), v.description("Action to perform.")),
|
|
446
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
447
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
448
|
+
/** Cryptographic signature. */
|
|
449
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
450
|
+
/** Expiration time of the action. */
|
|
451
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
452
|
+
}), v.transform(removeUndefinedKeys), v.description("Perform an action on a validator:" +
|
|
453
|
+
"\n- Change profile information." +
|
|
454
|
+
"\n- Register a new validator." +
|
|
455
|
+
"\n- Unregister an existing validator."));
|
|
456
|
+
/**
|
|
457
|
+
* Transfer native token from staking into the user spot account.
|
|
458
|
+
* @returns {SuccessResponse}
|
|
459
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
|
|
460
|
+
*/
|
|
461
|
+
export const CWithdrawRequest = v.pipe(v.object({
|
|
462
|
+
/** Action to perform. */
|
|
463
|
+
action: v.pipe(v.object({
|
|
464
|
+
/** Type of action. */
|
|
465
|
+
type: v.pipe(v.literal("cWithdraw"), v.description("Type of action.")),
|
|
466
|
+
/** Chain ID used for signing. */
|
|
467
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
468
|
+
/** HyperLiquid network. */
|
|
469
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
470
|
+
/** Amount of wei to withdraw from staking balance (float * 1e8). */
|
|
471
|
+
wei: v.pipe(UnsignedInteger, v.description("Amount of wei to withdraw from staking balance (float * 1e8).")),
|
|
472
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
473
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
474
|
+
}), v.description("Action to perform.")),
|
|
475
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
476
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
477
|
+
/** Cryptographic signature. */
|
|
478
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
479
|
+
}), v.transform(removeUndefinedKeys), v.description("Transfer native token from staking into the user spot account."));
|
|
480
|
+
/**
|
|
481
|
+
* Configure block type for EVM transactions.
|
|
482
|
+
* @returns {SuccessResponse}
|
|
483
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
|
|
484
|
+
*/
|
|
485
|
+
export const EvmUserModifyRequest = v.pipe(v.object({
|
|
486
|
+
/** Action to perform. */
|
|
487
|
+
action: v.pipe(v.object({
|
|
488
|
+
/** Type of action. */
|
|
489
|
+
type: v.pipe(v.literal("evmUserModify"), v.description("Type of action.")),
|
|
490
|
+
/** `true` for large blocks, `false` for small blocks. */
|
|
491
|
+
usingBigBlocks: v.pipe(v.boolean(), v.description("`true` for large blocks, `false` for small blocks.")),
|
|
492
|
+
}), v.description("Action to perform.")),
|
|
493
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
494
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
495
|
+
/** Cryptographic signature. */
|
|
496
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
497
|
+
/** Expiration time of the action. */
|
|
498
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
499
|
+
}), v.transform(removeUndefinedKeys), v.description("Configure block type for EVM transactions."));
|
|
500
|
+
/**
|
|
501
|
+
* Modify an order.
|
|
502
|
+
* @returns {SuccessResponse}
|
|
503
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
504
|
+
*/
|
|
505
|
+
export const ModifyRequest = v.pipe(v.object({
|
|
506
|
+
/** Action to perform. */
|
|
507
|
+
action: v.pipe(v.object({
|
|
508
|
+
/** Type of action. */
|
|
509
|
+
type: v.pipe(v.literal("modify"), v.description("Type of action.")),
|
|
510
|
+
/** Order ID or Client Order ID. */
|
|
511
|
+
oid: v.pipe(v.union([
|
|
512
|
+
UnsignedInteger,
|
|
513
|
+
v.pipe(Hex, v.length(34)),
|
|
514
|
+
]), v.description("Order ID or Client Order ID.")),
|
|
515
|
+
/** New order parameters. */
|
|
516
|
+
order: v.pipe(OrderParams, v.description("New order parameters.")),
|
|
517
|
+
}), v.description("Action to perform.")),
|
|
518
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
519
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
520
|
+
/** Cryptographic signature. */
|
|
521
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
522
|
+
/** Vault address (for vault trading). */
|
|
523
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
524
|
+
/** Expiration time of the action. */
|
|
525
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
526
|
+
}), v.transform(removeUndefinedKeys), v.description("Modify an order."));
|
|
527
|
+
/**
|
|
528
|
+
* This action does not do anything (no operation), but causes the nonce to be marked as used.
|
|
529
|
+
* @returns {SuccessResponse}
|
|
530
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#invalidate-pending-nonce-noop
|
|
531
|
+
*/
|
|
532
|
+
export const NoopRequest = v.pipe(v.object({
|
|
533
|
+
/** Action to perform. */
|
|
534
|
+
action: v.pipe(v.object({
|
|
535
|
+
/** Type of action. */
|
|
536
|
+
type: v.pipe(v.literal("noop"), v.description("Type of action.")),
|
|
537
|
+
}), v.description("Action to perform.")),
|
|
538
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
539
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
540
|
+
/** Cryptographic signature. */
|
|
541
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
542
|
+
/** Expiration time of the action. */
|
|
543
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
544
|
+
}), v.transform(removeUndefinedKeys), v.description("This action does not do anything (no operation), but causes the nonce to be marked as used."));
|
|
545
|
+
/**
|
|
546
|
+
* Place an order(s).
|
|
547
|
+
* @returns {OrderResponse}
|
|
548
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
549
|
+
*/
|
|
550
|
+
export const OrderRequest = v.pipe(v.object({
|
|
551
|
+
/** Action to perform. */
|
|
552
|
+
action: v.pipe(v.object({
|
|
553
|
+
/** Type of action. */
|
|
554
|
+
type: v.pipe(v.literal("order"), v.description("Type of action.")),
|
|
555
|
+
/** Order parameters. */
|
|
556
|
+
orders: v.pipe(v.array(OrderParams), v.description("Order parameters.")),
|
|
557
|
+
/**
|
|
558
|
+
* Order grouping strategy:
|
|
559
|
+
* - `na`: Standard order without grouping.
|
|
560
|
+
* - `normalTpsl`: TP/SL order with fixed size that doesn't adjust with position changes.
|
|
561
|
+
* - `positionTpsl`: TP/SL order that adjusts proportionally with the position size.
|
|
562
|
+
*/
|
|
563
|
+
grouping: v.pipe(v.union([
|
|
564
|
+
v.literal("na"),
|
|
565
|
+
v.literal("normalTpsl"),
|
|
566
|
+
v.literal("positionTpsl"),
|
|
567
|
+
]), v.description("Order grouping strategy:" +
|
|
568
|
+
"\n- `na`: Standard order without grouping." +
|
|
569
|
+
"\n- `normalTpsl`: TP/SL order with fixed size that doesn't adjust with position changes." +
|
|
570
|
+
"\n- `positionTpsl`: TP/SL order that adjusts proportionally with the position size.")),
|
|
571
|
+
/** Builder fee. */
|
|
572
|
+
builder: v.pipe(v.optional(v.object({
|
|
573
|
+
/** Builder address. */
|
|
574
|
+
b: v.pipe(v.pipe(Hex, v.length(42)), v.description("Builder address.")),
|
|
575
|
+
/** Builder fee in 0.1bps (1 = 0.0001%). */
|
|
576
|
+
f: v.pipe(UnsignedInteger, v.description("Builder fee in 0.1bps (1 = 0.0001%).")),
|
|
577
|
+
})), v.description("Builder fee.")),
|
|
578
|
+
}), v.description("Action to perform.")),
|
|
579
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
580
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
581
|
+
/** Cryptographic signature. */
|
|
582
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
583
|
+
/** Vault address (for vault trading). */
|
|
584
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
585
|
+
/** Expiration time of the action. */
|
|
586
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
587
|
+
}), v.transform(removeUndefinedKeys), v.description("Place an order(s)."));
|
|
588
|
+
/**
|
|
589
|
+
* Deploying HIP-3 assets:
|
|
590
|
+
* - Register Asset
|
|
591
|
+
* - Set Oracle
|
|
592
|
+
* @returns {SuccessResponse}
|
|
593
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-3-assets
|
|
594
|
+
*/
|
|
595
|
+
export const PerpDeployRequest = v.pipe(v.object({
|
|
596
|
+
/** Action to perform. */
|
|
597
|
+
action: v.pipe(v.union([
|
|
598
|
+
v.pipe(v.object({
|
|
599
|
+
/** Type of action. */
|
|
600
|
+
type: v.pipe(v.literal("perpDeploy"), v.description("Type of action.")),
|
|
601
|
+
/** Parameters for registering a new perpetual asset. */
|
|
602
|
+
registerAsset: v.pipe(v.object({
|
|
603
|
+
/** Max gas in native token wei. If not provided, then uses current deploy auction price. */
|
|
604
|
+
maxGas: v.pipe(v.nullable(UnsignedInteger), v.description("Max gas in native token wei. If not provided, then uses current deploy auction price.")),
|
|
605
|
+
/** Contains new asset listing parameters. */
|
|
606
|
+
assetRequest: v.pipe(v.object({
|
|
607
|
+
/** Coin symbol for the new asset. */
|
|
608
|
+
coin: v.pipe(v.string(), v.description("Coin symbol for the new asset.")),
|
|
609
|
+
/** Number of decimal places for size. */
|
|
610
|
+
szDecimals: v.pipe(UnsignedInteger, v.description("Number of decimal places for size.")),
|
|
611
|
+
/** Initial oracle price for the asset. */
|
|
612
|
+
oraclePx: v.pipe(UnsignedDecimal, v.description("Initial oracle price for the asset.")),
|
|
613
|
+
/** Margin table identifier for risk management. */
|
|
614
|
+
marginTableId: v.pipe(UnsignedInteger, v.description("Margin table identifier for risk management.")),
|
|
615
|
+
/** Whether the asset can only be traded with isolated margin. */
|
|
616
|
+
onlyIsolated: v.pipe(v.boolean(), v.description("Whether the asset can only be traded with isolated margin.")),
|
|
617
|
+
}), v.description("Contains new asset listing parameters.")),
|
|
618
|
+
/** Name of the dex. */
|
|
619
|
+
dex: v.pipe(v.string(), v.description("Name of the dex.")),
|
|
620
|
+
/** Contains new dex parameters. */
|
|
621
|
+
schema: v.pipe(v.nullable(v.object({
|
|
622
|
+
/** Full name of the dex. */
|
|
623
|
+
fullName: v.pipe(v.string(), v.description("Full name of the dex.")),
|
|
624
|
+
/** Collateral token index. */
|
|
625
|
+
collateralToken: v.pipe(UnsignedInteger, v.description("Collateral token index.")),
|
|
626
|
+
/** User to update oracles. If not provided, then deployer is assumed to be oracle updater. */
|
|
627
|
+
oracleUpdater: v.pipe(v.nullable(v.pipe(Hex, v.length(42))), v.description("User to update oracles. If not provided, then deployer is assumed to be oracle updater.")),
|
|
628
|
+
})), v.description("Contains new dex parameters.")),
|
|
629
|
+
}), v.description("Parameters for registering a new perpetual asset.")),
|
|
630
|
+
}), v.description("Register asset variant")),
|
|
631
|
+
v.pipe(v.object({
|
|
632
|
+
/** Type of action. */
|
|
633
|
+
type: v.pipe(v.literal("perpDeploy"), v.description("Type of action.")),
|
|
634
|
+
/** Parameters for setting oracle and mark prices for assets. */
|
|
635
|
+
setOracle: v.pipe(v.object({
|
|
636
|
+
/** Name of the dex. */
|
|
637
|
+
dex: v.pipe(v.string(), v.minLength(1), v.description("Name of the dex.")),
|
|
638
|
+
/** A list (sorted by key) of asset and oracle prices. */
|
|
639
|
+
oraclePxs: v.pipe(v.array(v.tuple([v.string(), UnsignedDecimal])), v.description("A list (sorted by key) of asset and oracle prices.")),
|
|
640
|
+
/** An outer list of inner lists (inner list sorted by key) of asset and mark prices. */
|
|
641
|
+
markPxs: v.pipe(v.array(v.array(v.tuple([v.string(), UnsignedDecimal]))), v.description("An outer list of inner lists (inner list sorted by key) of asset and mark prices.")),
|
|
642
|
+
}), v.description("Parameters for setting oracle and mark prices for assets.")),
|
|
643
|
+
}), v.description("Set oracle variant")),
|
|
644
|
+
]), v.description("Action to perform.")),
|
|
645
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
646
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
647
|
+
/** Cryptographic signature. */
|
|
648
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
649
|
+
/** Expiration time of the action. */
|
|
650
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
651
|
+
}), v.transform(removeUndefinedKeys), v.description("Deploying HIP-3 assets:" +
|
|
652
|
+
"\n- Register Asset" +
|
|
653
|
+
"\n- Set Oracle"));
|
|
654
|
+
/**
|
|
655
|
+
* Create a referral code.
|
|
656
|
+
* @returns {SuccessResponse}
|
|
657
|
+
* @see null
|
|
658
|
+
*/
|
|
659
|
+
export const RegisterReferrerRequest = v.pipe(v.object({
|
|
660
|
+
/** Action to perform. */
|
|
661
|
+
action: v.pipe(v.object({
|
|
662
|
+
/** Type of action. */
|
|
663
|
+
type: v.pipe(v.literal("registerReferrer"), v.description("Type of action.")),
|
|
664
|
+
/** Referral code to create. */
|
|
665
|
+
code: v.pipe(v.string(), v.minLength(1), v.description("Referral code to create.")),
|
|
666
|
+
}), v.description("Action to perform.")),
|
|
667
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
668
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
669
|
+
/** Cryptographic signature. */
|
|
670
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
671
|
+
/** Expiration time of the action. */
|
|
672
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
673
|
+
}), v.transform(removeUndefinedKeys), v.description("Create a referral code."));
|
|
674
|
+
/**
|
|
675
|
+
* Reserve additional rate-limited actions for a fee.
|
|
676
|
+
* @returns {SuccessResponse}
|
|
677
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#reserve-additional-actions
|
|
678
|
+
*/
|
|
679
|
+
export const ReserveRequestWeightRequest = v.pipe(v.object({
|
|
680
|
+
/** Action to perform. */
|
|
681
|
+
action: v.pipe(v.object({
|
|
682
|
+
/** Type of action. */
|
|
683
|
+
type: v.pipe(v.literal("reserveRequestWeight"), v.description("Type of action.")),
|
|
684
|
+
/** Amount of request weight to reserve. */
|
|
685
|
+
weight: v.pipe(UnsignedInteger, v.description("Amount of request weight to reserve.")),
|
|
686
|
+
}), v.description("Action to perform.")),
|
|
687
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
688
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
689
|
+
/** Cryptographic signature. */
|
|
690
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
691
|
+
/** Expiration time of the action. */
|
|
692
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
693
|
+
}), v.transform(removeUndefinedKeys), v.description("Reserve additional rate-limited actions for a fee."));
|
|
694
|
+
/**
|
|
695
|
+
* Schedule a cancel-all operation at a future time.
|
|
696
|
+
* @returns {SuccessResponse}
|
|
697
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
|
|
698
|
+
*/
|
|
699
|
+
export const ScheduleCancelRequest = v.pipe(v.object({
|
|
700
|
+
/** Action to perform. */
|
|
701
|
+
action: v.pipe(v.object({
|
|
702
|
+
/** Type of action. */
|
|
703
|
+
type: v.pipe(v.literal("scheduleCancel"), v.description("Type of action.")),
|
|
704
|
+
/**
|
|
705
|
+
* Scheduled time (in ms since epoch).
|
|
706
|
+
* Must be at least 5 seconds in the future.
|
|
707
|
+
*
|
|
708
|
+
* If not specified, will cause all scheduled cancel operations to be deleted.
|
|
709
|
+
*/
|
|
710
|
+
time: v.pipe(v.optional(UnsignedInteger), v.description("Scheduled time (in ms since epoch)." +
|
|
711
|
+
"\nMust be at least 5 seconds in the future." +
|
|
712
|
+
"\n\nIf not specified, will cause all scheduled cancel operations to be deleted.")),
|
|
713
|
+
}), v.description("Action to perform.")),
|
|
714
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
715
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
716
|
+
/** Cryptographic signature. */
|
|
717
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
718
|
+
/** Vault address (for vault trading). */
|
|
719
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
720
|
+
/** Expiration time of the action. */
|
|
721
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
722
|
+
}), v.transform(removeUndefinedKeys), v.description("Schedule a cancel-all operation at a future time."));
|
|
723
|
+
/**
|
|
724
|
+
* Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts.
|
|
725
|
+
* @returns {SuccessResponse}
|
|
726
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#send-asset-testnet-only
|
|
727
|
+
*/
|
|
728
|
+
export const SendAssetRequest = v.pipe(v.object({
|
|
729
|
+
/** Action to perform. */
|
|
730
|
+
action: v.pipe(v.object({
|
|
731
|
+
/** Type of action. */
|
|
732
|
+
type: v.pipe(v.literal("sendAsset"), v.description("Type of action.")),
|
|
733
|
+
/** Chain ID used for signing. */
|
|
734
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
735
|
+
/** HyperLiquid network. */
|
|
736
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
737
|
+
/** Destination address. */
|
|
738
|
+
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
739
|
+
/** Source DEX ("" for default USDC perp DEX, "spot" for spot). */
|
|
740
|
+
sourceDex: v.pipe(v.string(), v.description('Source DEX ("" for default USDC perp DEX, "spot" for spot).')),
|
|
741
|
+
/** Destination DEX ("" for default USDC perp DEX, "spot" for spot). */
|
|
742
|
+
destinationDex: v.pipe(v.string(), v.description('Destination DEX ("" for default USDC perp DEX, "spot" for spot).')),
|
|
743
|
+
/** Token identifier. */
|
|
744
|
+
token: v.pipe(TokenId, v.description("Token identifier.")),
|
|
745
|
+
/** Amount to send (not in wei). */
|
|
746
|
+
amount: v.pipe(UnsignedDecimal, v.description("Amount to send (not in wei).")),
|
|
747
|
+
/** Source sub-account address ("" for main account). */
|
|
748
|
+
fromSubAccount: v.pipe(v.union([
|
|
749
|
+
v.literal(""),
|
|
750
|
+
v.pipe(Hex, v.length(42)),
|
|
751
|
+
]), v.description('Source sub-account address ("" for main account).')),
|
|
752
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
753
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
754
|
+
}), v.description("Action to perform.")),
|
|
755
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
756
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
757
|
+
/** Cryptographic signature. */
|
|
758
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
759
|
+
}), v.transform(removeUndefinedKeys), v.description("Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts."));
|
|
760
|
+
/**
|
|
761
|
+
* Set the display name in the leaderboard.
|
|
762
|
+
* @returns {SuccessResponse}
|
|
763
|
+
* @see null
|
|
764
|
+
*/
|
|
765
|
+
export const SetDisplayNameRequest = v.pipe(v.object({
|
|
766
|
+
/** Action to perform. */
|
|
767
|
+
action: v.pipe(v.object({
|
|
768
|
+
/** Type of action. */
|
|
769
|
+
type: v.pipe(v.literal("setDisplayName"), v.description("Type of action.")),
|
|
770
|
+
/**
|
|
771
|
+
* Display name.
|
|
772
|
+
*
|
|
773
|
+
* Set to an empty string to remove the display name.
|
|
774
|
+
*/
|
|
775
|
+
displayName: v.pipe(v.string(), v.description("Display name." +
|
|
776
|
+
"\n\nSet to an empty string to remove the display name.")),
|
|
777
|
+
}), v.description("Action to perform.")),
|
|
778
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
779
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
780
|
+
/** Cryptographic signature. */
|
|
781
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
782
|
+
/** Expiration time of the action. */
|
|
783
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
784
|
+
}), v.transform(removeUndefinedKeys), v.description("Set the display name in the leaderboard."));
|
|
785
|
+
/**
|
|
786
|
+
* Set a referral code.
|
|
787
|
+
* @returns {SuccessResponse}
|
|
788
|
+
* @see null
|
|
789
|
+
*/
|
|
790
|
+
export const SetReferrerRequest = v.pipe(v.object({
|
|
791
|
+
/** Action to perform. */
|
|
792
|
+
action: v.pipe(v.object({
|
|
793
|
+
/** Type of action. */
|
|
794
|
+
type: v.pipe(v.literal("setReferrer"), v.description("Type of action.")),
|
|
795
|
+
/** Referral code. */
|
|
796
|
+
code: v.pipe(v.string(), v.minLength(1), v.description("Referral code.")),
|
|
797
|
+
}), v.description("Action to perform.")),
|
|
798
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
799
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
800
|
+
/** Cryptographic signature. */
|
|
801
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
802
|
+
/** Expiration time of the action. */
|
|
803
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
804
|
+
}), v.transform(removeUndefinedKeys), v.description("Set a referral code."));
|
|
805
|
+
/**
|
|
806
|
+
* Deploying HIP-1 and HIP-2 assets:
|
|
807
|
+
* - Genesis
|
|
808
|
+
* - Register Hyperliquidity
|
|
809
|
+
* - Register Spot
|
|
810
|
+
* - Register Token2
|
|
811
|
+
* - Set Deployer Trading Fee Share
|
|
812
|
+
* - User Genesis
|
|
813
|
+
* @returns {SuccessResponse}
|
|
814
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
|
|
815
|
+
*/
|
|
816
|
+
export const SpotDeployRequest = v.pipe(v.object({
|
|
817
|
+
/** Action to perform. */
|
|
818
|
+
action: v.pipe(v.union([
|
|
819
|
+
v.pipe(v.object({
|
|
820
|
+
/** Type of action. */
|
|
821
|
+
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
822
|
+
/** Genesis parameters. */
|
|
823
|
+
genesis: v.pipe(v.object({
|
|
824
|
+
/** Token identifier. */
|
|
825
|
+
token: v.pipe(UnsignedInteger, v.description("Token identifier.")),
|
|
826
|
+
/** Maximum token supply. */
|
|
827
|
+
maxSupply: v.pipe(UnsignedDecimal, v.description("Maximum token supply.")),
|
|
828
|
+
/** Set hyperliquidity balance to 0. */
|
|
829
|
+
noHyperliquidity: v.pipe(v.optional(v.literal(true)), v.description("Set hyperliquidity balance to 0.")),
|
|
830
|
+
}), v.description("Genesis parameters.")),
|
|
831
|
+
}), v.description("Genesis variant")),
|
|
832
|
+
v.pipe(v.object({
|
|
833
|
+
/** Type of action. */
|
|
834
|
+
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
835
|
+
/** Register hyperliquidity parameters. */
|
|
836
|
+
registerHyperliquidity: v.pipe(v.object({
|
|
837
|
+
/** Spot index (distinct from base token index). */
|
|
838
|
+
spot: v.pipe(UnsignedInteger, v.description("Spot index (distinct from base token index).")),
|
|
839
|
+
/** Starting price for liquidity seeding. */
|
|
840
|
+
startPx: v.pipe(UnsignedDecimal, v.description("Starting price for liquidity seeding.")),
|
|
841
|
+
/** Order size as a float (not in wei). */
|
|
842
|
+
orderSz: v.pipe(UnsignedDecimal, v.description("Order size as a float (not in wei).")),
|
|
843
|
+
/** Total number of orders to place. */
|
|
844
|
+
nOrders: v.pipe(UnsignedInteger, v.description("Total number of orders to place.")),
|
|
845
|
+
/** Number of levels to seed with USDC. */
|
|
846
|
+
nSeededLevels: v.pipe(v.optional(UnsignedInteger), v.description("Number of levels to seed with USDC.")),
|
|
847
|
+
}), v.description("Register hyperliquidity parameters.")),
|
|
848
|
+
}), v.description("Register hyperliquidity variant")),
|
|
849
|
+
v.pipe(v.object({
|
|
850
|
+
/** Type of action. */
|
|
851
|
+
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
852
|
+
/** Register spot parameters. */
|
|
853
|
+
registerSpot: v.pipe(v.object({
|
|
854
|
+
/** Tuple containing base and quote token indices. */
|
|
855
|
+
tokens: v.pipe(v.tuple([
|
|
856
|
+
UnsignedInteger,
|
|
857
|
+
UnsignedInteger,
|
|
858
|
+
]), v.description("Tuple containing base and quote token indices.")),
|
|
859
|
+
}), v.description("Register spot parameters.")),
|
|
860
|
+
}), v.description("Register spot variant")),
|
|
861
|
+
v.pipe(v.object({
|
|
862
|
+
/** Type of action. */
|
|
863
|
+
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
864
|
+
/** Register token parameters. */
|
|
865
|
+
registerToken2: v.pipe(v.object({
|
|
866
|
+
/** Token specifications. */
|
|
867
|
+
spec: v.pipe(v.object({
|
|
868
|
+
/** Token name. */
|
|
869
|
+
name: v.pipe(v.string(), v.description("Token name.")),
|
|
870
|
+
/** Number of decimals for token size. */
|
|
871
|
+
szDecimals: v.pipe(UnsignedInteger, v.description("Number of decimals for token size.")),
|
|
872
|
+
/** Number of decimals for token amounts in wei. */
|
|
873
|
+
weiDecimals: v.pipe(UnsignedInteger, v.description("Number of decimals for token amounts in wei.")),
|
|
874
|
+
}), v.description("Token specifications.")),
|
|
875
|
+
/** Maximum gas allowed for registration. */
|
|
876
|
+
maxGas: v.pipe(UnsignedInteger, v.description("Maximum gas allowed for registration.")),
|
|
877
|
+
/** Optional full token name. */
|
|
878
|
+
fullName: v.pipe(v.optional(v.string()), v.description("Optional full token name.")),
|
|
879
|
+
}), v.description("Register token parameters.")),
|
|
880
|
+
}), v.description("Register token variant")),
|
|
881
|
+
v.pipe(v.object({
|
|
882
|
+
/** Type of action. */
|
|
883
|
+
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
884
|
+
/** Set deployer trading fee share parameters. */
|
|
885
|
+
setDeployerTradingFeeShare: v.pipe(v.object({
|
|
886
|
+
/** Token identifier. */
|
|
887
|
+
token: v.pipe(UnsignedInteger, v.description("Token identifier.")),
|
|
888
|
+
/** The deployer trading fee share. Range is 0% to 100%. */
|
|
889
|
+
share: v.pipe(Percent, v.description("The deployer trading fee share. Range is 0% to 100%.")),
|
|
890
|
+
}), v.description("Set deployer trading fee share parameters.")),
|
|
891
|
+
}), v.description("Set deployer trading fee share variant")),
|
|
892
|
+
v.pipe(v.object({
|
|
893
|
+
/** Type of action. */
|
|
894
|
+
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
895
|
+
/** User genesis parameters. */
|
|
896
|
+
userGenesis: v.pipe(v.object({
|
|
897
|
+
/** Token identifier. */
|
|
898
|
+
token: v.pipe(UnsignedInteger, v.description("Token identifier.")),
|
|
899
|
+
/** Array of tuples: [user address, genesis amount in wei]. */
|
|
900
|
+
userAndWei: v.pipe(v.array(v.tuple([v.pipe(Hex, v.length(42)), UnsignedDecimal])), v.description("Array of tuples: [user address, genesis amount in wei].")),
|
|
901
|
+
/** Array of tuples: [existing token identifier, genesis amount in wei]. */
|
|
902
|
+
existingTokenAndWei: v.pipe(v.array(v.tuple([
|
|
903
|
+
UnsignedInteger,
|
|
904
|
+
UnsignedDecimal,
|
|
905
|
+
])), v.description("Array of tuples: [existing token identifier, genesis amount in wei].")),
|
|
906
|
+
/** Array of tuples: [user address, blacklist status] (`true` for blacklist, `false` to remove existing blacklisted user). */
|
|
907
|
+
blacklistUsers: v.pipe(v.optional(v.array(v.tuple([v.pipe(Hex, v.length(42)), v.boolean()]))), v.description("Array of tuples: [user address, blacklist status] (`true` for blacklist, `false` to remove existing blacklisted user).")),
|
|
908
|
+
}), v.description("User genesis parameters.")),
|
|
909
|
+
}), v.description("User genesis variant")),
|
|
910
|
+
]), v.description("Action to perform.")),
|
|
911
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
912
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
913
|
+
/** Cryptographic signature. */
|
|
914
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
915
|
+
/** Expiration time of the action. */
|
|
916
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
917
|
+
}), v.transform(removeUndefinedKeys), v.description("Deploying HIP-1 and HIP-2 assets:" +
|
|
918
|
+
"\n- Genesis" +
|
|
919
|
+
"\n- Register Hyperliquidity" +
|
|
920
|
+
"\n- Register Spot" +
|
|
921
|
+
"\n- Register Token2" +
|
|
922
|
+
"\n- Set Deployer Trading Fee Share" +
|
|
923
|
+
"\n- User Genesis"));
|
|
924
|
+
/**
|
|
925
|
+
* Send spot assets to another address.
|
|
926
|
+
* @returns {SuccessResponse}
|
|
927
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-spot-transfer
|
|
928
|
+
*/
|
|
929
|
+
export const SpotSendRequest = v.pipe(v.object({
|
|
930
|
+
/** Action to perform. */
|
|
931
|
+
action: v.pipe(v.object({
|
|
932
|
+
/** Type of action. */
|
|
933
|
+
type: v.pipe(v.literal("spotSend"), v.description("Type of action.")),
|
|
934
|
+
/** Chain ID used for signing. */
|
|
935
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
936
|
+
/** HyperLiquid network. */
|
|
937
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
938
|
+
/** Destination address. */
|
|
939
|
+
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
940
|
+
/** Token identifier. */
|
|
941
|
+
token: v.pipe(TokenId, v.description("Token identifier.")),
|
|
942
|
+
/** Amount to send (not in wei). */
|
|
943
|
+
amount: v.pipe(UnsignedDecimal, v.description("Amount to send (not in wei).")),
|
|
944
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
945
|
+
time: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
946
|
+
}), v.description("Action to perform.")),
|
|
947
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
948
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
949
|
+
/** Cryptographic signature. */
|
|
950
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
951
|
+
}), v.transform(removeUndefinedKeys), v.description("Send spot assets to another address."));
|
|
952
|
+
/**
|
|
953
|
+
* Opt Out of Spot Dusting.
|
|
954
|
+
* @returns {SuccessResponse}
|
|
955
|
+
* @see null
|
|
956
|
+
*/
|
|
957
|
+
export const SpotUserRequest = v.pipe(v.object({
|
|
958
|
+
/** Action to perform. */
|
|
959
|
+
action: v.pipe(v.object({
|
|
960
|
+
/** Type of action. */
|
|
961
|
+
type: v.pipe(v.literal("spotUser"), v.description("Type of action.")),
|
|
962
|
+
/** Spot dusting options. */
|
|
963
|
+
toggleSpotDusting: v.pipe(v.object({
|
|
964
|
+
/** Opt out of spot dusting. */
|
|
965
|
+
optOut: v.pipe(v.boolean(), v.description("Opt out of spot dusting.")),
|
|
966
|
+
}), v.description("Spot dusting options.")),
|
|
967
|
+
}), v.description("Action to perform.")),
|
|
968
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
969
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
970
|
+
/** Cryptographic signature. */
|
|
971
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
972
|
+
/** Expiration time of the action. */
|
|
973
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
974
|
+
}), v.transform(removeUndefinedKeys), v.description("Opt Out of Spot Dusting."));
|
|
975
|
+
/**
|
|
976
|
+
* Modify a sub-account.
|
|
977
|
+
* @returns {SuccessResponse}
|
|
978
|
+
* @see null
|
|
979
|
+
*/
|
|
980
|
+
export const SubAccountModifyRequest = v.pipe(v.object({
|
|
981
|
+
/** Action to perform. */
|
|
982
|
+
action: v.pipe(v.object({
|
|
983
|
+
/** Type of action. */
|
|
984
|
+
type: v.pipe(v.literal("subAccountModify"), v.description("Type of action.")),
|
|
985
|
+
/** Sub-account address to modify. */
|
|
986
|
+
subAccountUser: v.pipe(v.pipe(Hex, v.length(42)), v.description("Sub-account address to modify.")),
|
|
987
|
+
/** New sub-account name. */
|
|
988
|
+
name: v.pipe(v.string(), v.minLength(1), v.description("New sub-account name.")),
|
|
989
|
+
}), v.description("Action to perform.")),
|
|
990
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
991
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
992
|
+
/** Cryptographic signature. */
|
|
993
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
994
|
+
/** Expiration time of the action. */
|
|
995
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
996
|
+
}), v.transform(removeUndefinedKeys), v.description("Modify a sub-account."));
|
|
997
|
+
/**
|
|
998
|
+
* Transfer between sub-accounts (spot).
|
|
999
|
+
* @returns {SuccessResponse}
|
|
1000
|
+
* @see null
|
|
1001
|
+
*/
|
|
1002
|
+
export const SubAccountSpotTransferRequest = v.pipe(v.object({
|
|
1003
|
+
/** Action to perform. */
|
|
1004
|
+
action: v.pipe(v.object({
|
|
1005
|
+
/** Type of action. */
|
|
1006
|
+
type: v.pipe(v.literal("subAccountSpotTransfer"), v.description("Type of action.")),
|
|
1007
|
+
/** Sub-account address. */
|
|
1008
|
+
subAccountUser: v.pipe(v.pipe(Hex, v.length(42)), v.description("Sub-account address.")),
|
|
1009
|
+
/** `true` for deposit, `false` for withdrawal. */
|
|
1010
|
+
isDeposit: v.pipe(v.boolean(), v.description("`true` for deposit, `false` for withdrawal.")),
|
|
1011
|
+
/** Token identifier. */
|
|
1012
|
+
token: v.pipe(TokenId, v.description("Token identifier.")),
|
|
1013
|
+
/** Amount to send (not in wei). */
|
|
1014
|
+
amount: v.pipe(UnsignedDecimal, v.description("Amount to send (not in wei).")),
|
|
1015
|
+
}), v.description("Action to perform.")),
|
|
1016
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1017
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1018
|
+
/** Cryptographic signature. */
|
|
1019
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1020
|
+
/** Expiration time of the action. */
|
|
1021
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1022
|
+
}), v.transform(removeUndefinedKeys), v.description("Transfer between sub-accounts (spot)."));
|
|
1023
|
+
/**
|
|
1024
|
+
* Transfer between sub-accounts (perpetual).
|
|
1025
|
+
* @returns {SuccessResponse}
|
|
1026
|
+
* @see null
|
|
1027
|
+
*/
|
|
1028
|
+
export const SubAccountTransferRequest = v.pipe(v.object({
|
|
1029
|
+
/** Action to perform. */
|
|
1030
|
+
action: v.pipe(v.object({
|
|
1031
|
+
/** Type of action. */
|
|
1032
|
+
type: v.pipe(v.literal("subAccountTransfer"), v.description("Type of action.")),
|
|
1033
|
+
/** Sub-account address. */
|
|
1034
|
+
subAccountUser: v.pipe(v.pipe(Hex, v.length(42)), v.description("Sub-account address.")),
|
|
1035
|
+
/** `true` for deposit, `false` for withdrawal. */
|
|
1036
|
+
isDeposit: v.pipe(v.boolean(), v.description("`true` for deposit, `false` for withdrawal.")),
|
|
1037
|
+
/** Amount to transfer (float * 1e6). */
|
|
1038
|
+
usd: v.pipe(UnsignedInteger, v.description("Amount to transfer (float * 1e6).")),
|
|
1039
|
+
}), v.description("Action to perform.")),
|
|
1040
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1041
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1042
|
+
/** Cryptographic signature. */
|
|
1043
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1044
|
+
/** Expiration time of the action. */
|
|
1045
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1046
|
+
}), v.transform(removeUndefinedKeys), v.description("Transfer between sub-accounts (perpetual)."));
|
|
1047
|
+
/**
|
|
1048
|
+
* Delegate or undelegate native tokens to or from a validator.
|
|
1049
|
+
* @returns {SuccessResponse}
|
|
1050
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
|
|
1051
|
+
*/
|
|
1052
|
+
export const TokenDelegateRequest = v.pipe(v.object({
|
|
1053
|
+
/** Action to perform. */
|
|
1054
|
+
action: v.pipe(v.object({
|
|
1055
|
+
/** Type of action. */
|
|
1056
|
+
type: v.pipe(v.literal("tokenDelegate"), v.description("Type of action.")),
|
|
1057
|
+
/** Chain ID used for signing. */
|
|
1058
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
1059
|
+
/** HyperLiquid network. */
|
|
1060
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
1061
|
+
/** Validator address. */
|
|
1062
|
+
validator: v.pipe(v.pipe(Hex, v.length(42)), v.description("Validator address.")),
|
|
1063
|
+
/** Amount for delegate/undelegate (float * 1e8). */
|
|
1064
|
+
wei: v.pipe(UnsignedInteger, v.description("Amount for delegate/undelegate (float * 1e8).")),
|
|
1065
|
+
/** `true` for undelegate, `false` for delegate. */
|
|
1066
|
+
isUndelegate: v.pipe(v.boolean(), v.description("`true` for undelegate, `false` for delegate.")),
|
|
1067
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1068
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1069
|
+
}), v.description("Action to perform.")),
|
|
1070
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1071
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1072
|
+
/** Cryptographic signature. */
|
|
1073
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1074
|
+
}), v.transform(removeUndefinedKeys), v.description("Delegate or undelegate native tokens to or from a validator."));
|
|
1075
|
+
/**
|
|
1076
|
+
* Cancel a TWAP order.
|
|
1077
|
+
* @returns {TwapCancelResponse}
|
|
1078
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
|
|
1079
|
+
*/
|
|
1080
|
+
export const TwapCancelRequest = v.pipe(v.object({
|
|
1081
|
+
/** Action to perform. */
|
|
1082
|
+
action: v.pipe(v.object({
|
|
1083
|
+
/** Type of action. */
|
|
1084
|
+
type: v.pipe(v.literal("twapCancel"), v.description("Type of action.")),
|
|
1085
|
+
/** Asset ID. */
|
|
1086
|
+
a: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
1087
|
+
/** Twap ID. */
|
|
1088
|
+
t: v.pipe(UnsignedInteger, v.description("Twap ID.")),
|
|
1089
|
+
}), v.description("Action to perform.")),
|
|
1090
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1091
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1092
|
+
/** Cryptographic signature. */
|
|
1093
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1094
|
+
/** Vault address (for vault trading). */
|
|
1095
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1096
|
+
/** Expiration time of the action. */
|
|
1097
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1098
|
+
}), v.transform(removeUndefinedKeys), v.description("Cancel a TWAP order."));
|
|
1099
|
+
/**
|
|
1100
|
+
* Place a TWAP order.
|
|
1101
|
+
* @returns {TwapOrderResponse}
|
|
1102
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
|
|
1103
|
+
*/
|
|
1104
|
+
export const TwapOrderRequest = v.pipe(v.object({
|
|
1105
|
+
/** Action to perform. */
|
|
1106
|
+
action: v.pipe(v.object({
|
|
1107
|
+
/** Type of action. */
|
|
1108
|
+
type: v.pipe(v.literal("twapOrder"), v.description("Type of action.")),
|
|
1109
|
+
/** Twap parameters. */
|
|
1110
|
+
twap: v.pipe(v.object({
|
|
1111
|
+
/** Asset ID. */
|
|
1112
|
+
a: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
1113
|
+
/** Position side (`true` for long, `false` for short). */
|
|
1114
|
+
b: v.pipe(v.boolean(), v.description("Position side (`true` for long, `false` for short).")),
|
|
1115
|
+
/** Size (in base currency units). */
|
|
1116
|
+
s: v.pipe(UnsignedDecimal, v.description("Size (in base currency units).")),
|
|
1117
|
+
/** Is reduce-only? */
|
|
1118
|
+
r: v.pipe(v.boolean(), v.description("Is reduce-only?")),
|
|
1119
|
+
/** TWAP duration in minutes. */
|
|
1120
|
+
m: v.pipe(UnsignedInteger, v.description("TWAP duration in minutes.")),
|
|
1121
|
+
/** Enable random order timing. */
|
|
1122
|
+
t: v.pipe(v.boolean(), v.description("Enable random order timing.")),
|
|
1123
|
+
}), v.description("Twap parameters.")),
|
|
1124
|
+
}), v.description("Action to perform.")),
|
|
1125
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1126
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1127
|
+
/** Cryptographic signature. */
|
|
1128
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1129
|
+
/** Vault address (for vault trading). */
|
|
1130
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1131
|
+
/** Expiration time of the action. */
|
|
1132
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1133
|
+
}), v.transform(removeUndefinedKeys), v.description("Place a TWAP order."));
|
|
1134
|
+
/**
|
|
1135
|
+
* Add or remove margin from isolated position.
|
|
1136
|
+
* @returns {SuccessResponse}
|
|
1137
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
|
1138
|
+
*/
|
|
1139
|
+
export const UpdateIsolatedMarginRequest = v.pipe(v.object({
|
|
1140
|
+
/** Action to perform. */
|
|
1141
|
+
action: v.pipe(v.object({
|
|
1142
|
+
/** Type of action. */
|
|
1143
|
+
type: v.pipe(v.literal("updateIsolatedMargin"), v.description("Type of action.")),
|
|
1144
|
+
/** Asset ID. */
|
|
1145
|
+
asset: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
1146
|
+
/** Position side (`true` for long, `false` for short). */
|
|
1147
|
+
isBuy: v.pipe(v.boolean(), v.description("Position side (`true` for long, `false` for short).")),
|
|
1148
|
+
/** Amount to adjust (float * 1e6). */
|
|
1149
|
+
ntli: v.pipe(UnsignedInteger, v.description("Amount to adjust (float * 1e6).")),
|
|
1150
|
+
}), v.description("Action to perform.")),
|
|
1151
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1152
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1153
|
+
/** Cryptographic signature. */
|
|
1154
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1155
|
+
/** Vault address (for vault trading). */
|
|
1156
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1157
|
+
/** Expiration time of the action. */
|
|
1158
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1159
|
+
}), v.transform(removeUndefinedKeys), v.description("Add or remove margin from isolated position."));
|
|
1160
|
+
/**
|
|
1161
|
+
* Update cross or isolated leverage on a coin.
|
|
1162
|
+
* @returns {SuccessResponse}
|
|
1163
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
|
|
1164
|
+
*/
|
|
1165
|
+
export const UpdateLeverageRequest = v.pipe(v.object({
|
|
1166
|
+
/** Action to perform. */
|
|
1167
|
+
action: v.pipe(v.object({
|
|
1168
|
+
/** Type of action. */
|
|
1169
|
+
type: v.pipe(v.literal("updateLeverage"), v.description("Type of action.")),
|
|
1170
|
+
/** Asset ID. */
|
|
1171
|
+
asset: v.pipe(UnsignedInteger, v.description("Asset ID.")),
|
|
1172
|
+
/** `true` for cross leverage, `false` for isolated leverage. */
|
|
1173
|
+
isCross: v.pipe(v.boolean(), v.description("`true` for cross leverage, `false` for isolated leverage.")),
|
|
1174
|
+
/** New leverage value. */
|
|
1175
|
+
leverage: v.pipe(v.pipe(UnsignedInteger, v.minValue(1)), v.description("New leverage value.")),
|
|
1176
|
+
}), v.description("Action to perform.")),
|
|
1177
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1178
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1179
|
+
/** Cryptographic signature. */
|
|
1180
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1181
|
+
/** Vault address (for vault trading). */
|
|
1182
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1183
|
+
/** Expiration time of the action. */
|
|
1184
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1185
|
+
}), v.transform(removeUndefinedKeys), v.description("Update cross or isolated leverage on a coin."));
|
|
1186
|
+
/**
|
|
1187
|
+
* Transfer funds between Spot account and Perp account.
|
|
1188
|
+
* @returns {SuccessResponse}
|
|
1189
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
|
|
1190
|
+
*/
|
|
1191
|
+
export const UsdClassTransferRequest = v.pipe(v.object({
|
|
1192
|
+
/** Action to perform. */
|
|
1193
|
+
action: v.pipe(v.object({
|
|
1194
|
+
/** Type of action. */
|
|
1195
|
+
type: v.pipe(v.literal("usdClassTransfer"), v.description("Type of action.")),
|
|
1196
|
+
/** Chain ID used for signing. */
|
|
1197
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
1198
|
+
/** HyperLiquid network. */
|
|
1199
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
1200
|
+
/** Amount to transfer (1 = 1$). */
|
|
1201
|
+
amount: v.pipe(UnsignedDecimal, v.description("Amount to transfer (1 = 1$).")),
|
|
1202
|
+
/** `true` for Spot to Perp, `false` for Perp to Spot. */
|
|
1203
|
+
toPerp: v.pipe(v.boolean(), v.description("`true` for Spot to Perp, `false` for Perp to Spot.")),
|
|
1204
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1205
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1206
|
+
}), v.description("Action to perform.")),
|
|
1207
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1208
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1209
|
+
/** Cryptographic signature. */
|
|
1210
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1211
|
+
}), v.transform(removeUndefinedKeys), v.description("Transfer funds between Spot account and Perp account."));
|
|
1212
|
+
/**
|
|
1213
|
+
* Send usd to another address.
|
|
1214
|
+
* @returns {SuccessResponse}
|
|
1215
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-usdc-transfer
|
|
1216
|
+
*/
|
|
1217
|
+
export const UsdSendRequest = v.pipe(v.object({
|
|
1218
|
+
/** Action to perform. */
|
|
1219
|
+
action: v.pipe(v.object({
|
|
1220
|
+
/** Type of action. */
|
|
1221
|
+
type: v.pipe(v.literal("usdSend"), v.description("Type of action.")),
|
|
1222
|
+
/** Chain ID used for signing. */
|
|
1223
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
1224
|
+
/** HyperLiquid network. */
|
|
1225
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
1226
|
+
/** Destination address. */
|
|
1227
|
+
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
1228
|
+
/** Amount to send (1 = 1$). */
|
|
1229
|
+
amount: v.pipe(UnsignedDecimal, v.description("Amount to send (1 = 1$).")),
|
|
1230
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1231
|
+
time: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1232
|
+
}), v.description("Action to perform.")),
|
|
1233
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1234
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1235
|
+
/** Cryptographic signature. */
|
|
1236
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1237
|
+
}), v.transform(removeUndefinedKeys), v.description("Send usd to another address."));
|
|
1238
|
+
/**
|
|
1239
|
+
* Distribute funds from a vault between followers.
|
|
1240
|
+
* @returns {SuccessResponse}
|
|
1241
|
+
* @see null
|
|
1242
|
+
*/
|
|
1243
|
+
export const VaultDistributeRequest = v.pipe(v.object({
|
|
1244
|
+
/** Action to perform. */
|
|
1245
|
+
action: v.pipe(v.object({
|
|
1246
|
+
/** Type of action. */
|
|
1247
|
+
type: v.pipe(v.literal("vaultDistribute"), v.description("Type of action.")),
|
|
1248
|
+
/** Vault address. */
|
|
1249
|
+
vaultAddress: v.pipe(v.pipe(Hex, v.length(42)), v.description("Vault address.")),
|
|
1250
|
+
/**
|
|
1251
|
+
* Amount to distribute (float * 1e6).
|
|
1252
|
+
*
|
|
1253
|
+
* Set to 0 to close the vault.
|
|
1254
|
+
*/
|
|
1255
|
+
usd: v.pipe(UnsignedInteger, v.description("Amount to distribute (float * 1e6)." +
|
|
1256
|
+
"\n\nSet to 0 to close the vault.")),
|
|
1257
|
+
}), v.description("Action to perform.")),
|
|
1258
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1259
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1260
|
+
/** Cryptographic signature. */
|
|
1261
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1262
|
+
/** Expiration time of the action. */
|
|
1263
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1264
|
+
}), v.transform(removeUndefinedKeys), v.description("Distribute funds from a vault between followers."));
|
|
1265
|
+
/**
|
|
1266
|
+
* Modify a vault configuration.
|
|
1267
|
+
* @returns {SuccessResponse}
|
|
1268
|
+
* @see null
|
|
1269
|
+
*/
|
|
1270
|
+
export const VaultModifyRequest = v.pipe(v.object({
|
|
1271
|
+
/** Action to perform. */
|
|
1272
|
+
action: v.pipe(v.object({
|
|
1273
|
+
/** Type of action. */
|
|
1274
|
+
type: v.pipe(v.literal("vaultModify"), v.description("Type of action.")),
|
|
1275
|
+
/** Vault address. */
|
|
1276
|
+
vaultAddress: v.pipe(v.pipe(Hex, v.length(42)), v.description("Vault address.")),
|
|
1277
|
+
/** Allow deposits from followers. */
|
|
1278
|
+
allowDeposits: v.pipe(v.nullable(v.boolean()), v.description("Allow deposits from followers.")),
|
|
1279
|
+
/** Always close positions on withdrawal. */
|
|
1280
|
+
alwaysCloseOnWithdraw: v.pipe(v.nullable(v.boolean()), v.description("Always close positions on withdrawal.")),
|
|
1281
|
+
}), v.description("Action to perform.")),
|
|
1282
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1283
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1284
|
+
/** Cryptographic signature. */
|
|
1285
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1286
|
+
/** Expiration time of the action. */
|
|
1287
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1288
|
+
}), v.transform(removeUndefinedKeys), v.description("Modify a vault configuration."));
|
|
1289
|
+
/**
|
|
1290
|
+
* Deposit or withdraw from a vault.
|
|
1291
|
+
* @returns {SuccessResponse}
|
|
1292
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
|
1293
|
+
*/
|
|
1294
|
+
export const VaultTransferRequest = v.pipe(v.object({
|
|
1295
|
+
/** Action to perform. */
|
|
1296
|
+
action: v.pipe(v.object({
|
|
1297
|
+
/** Type of action. */
|
|
1298
|
+
type: v.pipe(v.literal("vaultTransfer"), v.description("Type of action.")),
|
|
1299
|
+
/** Vault address. */
|
|
1300
|
+
vaultAddress: v.pipe(v.pipe(Hex, v.length(42)), v.description("Vault address.")),
|
|
1301
|
+
/** `true` for deposit, `false` for withdrawal. */
|
|
1302
|
+
isDeposit: v.pipe(v.boolean(), v.description("`true` for deposit, `false` for withdrawal.")),
|
|
1303
|
+
/** Amount for deposit/withdrawal (float * 1e6). */
|
|
1304
|
+
usd: v.pipe(UnsignedInteger, v.description("Amount for deposit/withdrawal (float * 1e6).")),
|
|
1305
|
+
}), v.description("Action to perform.")),
|
|
1306
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1307
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1308
|
+
/** Cryptographic signature. */
|
|
1309
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1310
|
+
/** Expiration time of the action. */
|
|
1311
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1312
|
+
}), v.transform(removeUndefinedKeys), v.description("Deposit or withdraw from a vault."));
|
|
1313
|
+
/**
|
|
1314
|
+
* Initiate a withdrawal request.
|
|
1315
|
+
* @returns {SuccessResponse}
|
|
1316
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
|
1317
|
+
*/
|
|
1318
|
+
export const Withdraw3Request = v.pipe(v.object({
|
|
1319
|
+
/** Action to perform. */
|
|
1320
|
+
action: v.pipe(v.object({
|
|
1321
|
+
/** Type of action. */
|
|
1322
|
+
type: v.pipe(v.literal("withdraw3"), v.description("Type of action.")),
|
|
1323
|
+
/** Chain ID used for signing. */
|
|
1324
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
1325
|
+
/** HyperLiquid network. */
|
|
1326
|
+
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
1327
|
+
/** Destination address. */
|
|
1328
|
+
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
1329
|
+
/** Amount to withdraw (1 = 1$). */
|
|
1330
|
+
amount: v.pipe(UnsignedDecimal, v.description("Amount to withdraw (1 = 1$).")),
|
|
1331
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1332
|
+
time: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1333
|
+
}), v.description("Action to perform.")),
|
|
1334
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1335
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1336
|
+
/** Cryptographic signature. */
|
|
1337
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1338
|
+
}), v.transform(removeUndefinedKeys), v.description("Initiate a withdrawal request."));
|
|
1339
|
+
/**
|
|
1340
|
+
* A multi-signature request.
|
|
1341
|
+
* @returns {SuccessResponse}
|
|
1342
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
1343
|
+
*/
|
|
1344
|
+
export const MultiSigRequest = v.pipe(v.object({
|
|
1345
|
+
/** Action to perform. */
|
|
1346
|
+
action: v.pipe(v.object({
|
|
1347
|
+
/** Type of action. */
|
|
1348
|
+
type: v.pipe(v.literal("multiSig"), v.description("Type of action.")),
|
|
1349
|
+
/** Chain ID used for signing. */
|
|
1350
|
+
signatureChainId: v.pipe(Hex, v.description("Chain ID used for signing.")),
|
|
1351
|
+
/** List of signatures from authorized signers. */
|
|
1352
|
+
signatures: v.pipe(v.array(Signature), v.description("List of signatures from authorized signers.")),
|
|
1353
|
+
/** Multi-signature payload information. */
|
|
1354
|
+
payload: v.pipe(v.object({
|
|
1355
|
+
/** Address of the multi-signature user account. */
|
|
1356
|
+
multiSigUser: v.pipe(v.pipe(Hex, v.length(42)), v.description("Address of the multi-signature user account.")),
|
|
1357
|
+
/** Address of the authorized user initiating the request (any authorized user). */
|
|
1358
|
+
outerSigner: v.pipe(v.pipe(Hex, v.length(42)), v.description("Address of the authorized user initiating the request (any authorized user).")),
|
|
1359
|
+
/** The underlying action to be executed through multi-sig. */
|
|
1360
|
+
action: v.pipe(v.union([
|
|
1361
|
+
ApproveAgentRequest.entries.action,
|
|
1362
|
+
ApproveBuilderFeeRequest.entries.action,
|
|
1363
|
+
BatchModifyRequest.entries.action,
|
|
1364
|
+
CancelRequest.entries.action,
|
|
1365
|
+
CancelByCloidRequest.entries.action,
|
|
1366
|
+
CDepositRequest.entries.action,
|
|
1367
|
+
ClaimRewardsRequest.entries.action,
|
|
1368
|
+
ConvertToMultiSigUserRequest.entries.action,
|
|
1369
|
+
CreateSubAccountRequest.entries.action,
|
|
1370
|
+
CreateVaultRequest.entries.action,
|
|
1371
|
+
CSignerActionRequest.entries.action,
|
|
1372
|
+
CValidatorActionRequest.entries.action,
|
|
1373
|
+
CWithdrawRequest.entries.action,
|
|
1374
|
+
EvmUserModifyRequest.entries.action,
|
|
1375
|
+
ModifyRequest.entries.action,
|
|
1376
|
+
NoopRequest.entries.action,
|
|
1377
|
+
OrderRequest.entries.action,
|
|
1378
|
+
PerpDeployRequest.entries.action,
|
|
1379
|
+
RegisterReferrerRequest.entries.action,
|
|
1380
|
+
ReserveRequestWeightRequest.entries.action,
|
|
1381
|
+
ScheduleCancelRequest.entries.action,
|
|
1382
|
+
SendAssetRequest.entries.action,
|
|
1383
|
+
SetDisplayNameRequest.entries.action,
|
|
1384
|
+
SetReferrerRequest.entries.action,
|
|
1385
|
+
SpotDeployRequest.entries.action,
|
|
1386
|
+
SpotSendRequest.entries.action,
|
|
1387
|
+
SpotUserRequest.entries.action,
|
|
1388
|
+
SubAccountModifyRequest.entries.action,
|
|
1389
|
+
SubAccountSpotTransferRequest.entries.action,
|
|
1390
|
+
SubAccountTransferRequest.entries.action,
|
|
1391
|
+
TokenDelegateRequest.entries.action,
|
|
1392
|
+
TwapCancelRequest.entries.action,
|
|
1393
|
+
TwapOrderRequest.entries.action,
|
|
1394
|
+
UpdateIsolatedMarginRequest.entries.action,
|
|
1395
|
+
UpdateLeverageRequest.entries.action,
|
|
1396
|
+
UsdClassTransferRequest.entries.action,
|
|
1397
|
+
UsdSendRequest.entries.action,
|
|
1398
|
+
VaultDistributeRequest.entries.action,
|
|
1399
|
+
VaultModifyRequest.entries.action,
|
|
1400
|
+
VaultTransferRequest.entries.action,
|
|
1401
|
+
Withdraw3Request.entries.action,
|
|
1402
|
+
]), v.description("The underlying action to be executed through multi-sig.")),
|
|
1403
|
+
}), v.description("Multi-signature payload information.")),
|
|
1404
|
+
}), v.description("Action to perform.")),
|
|
1405
|
+
/** Unique request identifier (current timestamp in ms). */
|
|
1406
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1407
|
+
/** Cryptographic signature. */
|
|
1408
|
+
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1409
|
+
/** Vault address (for vault trading). */
|
|
1410
|
+
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1411
|
+
/** Expiration time of the action. */
|
|
1412
|
+
expiresAfter: v.pipe(v.optional(UnsignedInteger), v.description("Expiration time of the action.")),
|
|
1413
|
+
}), v.transform(removeUndefinedKeys), v.description("A multi-signature request."));
|
|
1414
|
+
//# sourceMappingURL=requests.js.map
|