@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,394 @@
|
|
|
1
|
+
import { TransportError } from "../base.js";
|
|
2
|
+
import type { IRequestTransport, ISubscriptionTransport, Subscription } from "../base.js";
|
|
3
|
+
import {
|
|
4
|
+
type MessageBufferStrategy,
|
|
5
|
+
ReconnectingWebSocket,
|
|
6
|
+
ReconnectingWebSocketError,
|
|
7
|
+
type ReconnectingWebSocketOptions,
|
|
8
|
+
} from "./_reconnecting_websocket.js";
|
|
9
|
+
import { HyperliquidEventTarget } from "./_hyperliquid_event_target.js";
|
|
10
|
+
import { WebSocketAsyncRequest } from "./_websocket_async_request.js";
|
|
11
|
+
|
|
12
|
+
export { type MessageBufferStrategy, ReconnectingWebSocketError, type ReconnectingWebSocketOptions };
|
|
13
|
+
|
|
14
|
+
/** Configuration options for the WebSocket transport layer. */
|
|
15
|
+
export interface WebSocketTransportOptions {
|
|
16
|
+
/**
|
|
17
|
+
* The WebSocket URL.
|
|
18
|
+
* - Mainnet:
|
|
19
|
+
* - API: `wss://api.hyperliquid.xyz/ws`
|
|
20
|
+
* - Explorer: `wss://rpc.hyperliquid.xyz/ws`
|
|
21
|
+
* - Testnet:
|
|
22
|
+
* - API: `wss://api.hyperliquid-testnet.xyz/ws`
|
|
23
|
+
* - Explorer: `wss://rpc.hyperliquid-testnet.xyz/ws`
|
|
24
|
+
* @defaultValue `wss://api.hyperliquid.xyz/ws`
|
|
25
|
+
*/
|
|
26
|
+
url?: string | URL;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Indicates this transport uses testnet endpoint.
|
|
30
|
+
* @defaultValue `false`
|
|
31
|
+
*/
|
|
32
|
+
isTestnet?: boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Timeout for requests in ms.
|
|
36
|
+
* Set to `null` to disable.
|
|
37
|
+
* @defaultValue `10_000`
|
|
38
|
+
*/
|
|
39
|
+
timeout?: number | null;
|
|
40
|
+
|
|
41
|
+
/** Keep-alive configuration. */
|
|
42
|
+
keepAlive?: {
|
|
43
|
+
/**
|
|
44
|
+
* Interval between sending ping messages in ms.
|
|
45
|
+
* Set to `null` to disable.
|
|
46
|
+
* @defaultValue `30_000`
|
|
47
|
+
*/
|
|
48
|
+
interval?: number | null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Timeout for the ping request in ms.
|
|
52
|
+
* Set to `null` to disable.
|
|
53
|
+
* @defaultValue same as {@link timeout} for requests.
|
|
54
|
+
*/
|
|
55
|
+
timeout?: number | null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Reconnection policy configuration for closed connections. */
|
|
59
|
+
reconnect?: ReconnectingWebSocketOptions;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Enable automatic event resubscription after reconnection.
|
|
63
|
+
* @defaultValue `true`
|
|
64
|
+
*/
|
|
65
|
+
autoResubscribe?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Error thrown when a WebSocket request fails. */
|
|
69
|
+
export class WebSocketRequestError extends TransportError {
|
|
70
|
+
constructor(message?: string, options?: ErrorOptions) {
|
|
71
|
+
super(message, options);
|
|
72
|
+
this.name = "WebSocketRequestError";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** WebSocket implementation of the REST and Subscription transport interfaces. */
|
|
77
|
+
export class WebSocketTransport implements IRequestTransport, ISubscriptionTransport, AsyncDisposable {
|
|
78
|
+
protected _wsRequester: WebSocketAsyncRequest;
|
|
79
|
+
protected _hlEvents: HyperliquidEventTarget;
|
|
80
|
+
protected _keepAliveTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
81
|
+
protected _subscriptions: Map<
|
|
82
|
+
string, // Unique identifier based on the payload
|
|
83
|
+
{
|
|
84
|
+
listeners: Map<
|
|
85
|
+
(data: CustomEvent) => void, // Event listener function
|
|
86
|
+
() => Promise<void> // Unsubscribe function
|
|
87
|
+
>;
|
|
88
|
+
promise: Promise<unknown>; // Subscription request promise
|
|
89
|
+
resubscribeAbortController?: AbortController; // To monitor reconnection errors
|
|
90
|
+
}
|
|
91
|
+
> = new Map();
|
|
92
|
+
protected _isReconnecting = false;
|
|
93
|
+
|
|
94
|
+
/** Indicates this transport uses testnet endpoint. */
|
|
95
|
+
isTestnet: boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Request timeout in ms.
|
|
99
|
+
* Set to `null` to disable.
|
|
100
|
+
*/
|
|
101
|
+
timeout: number | null;
|
|
102
|
+
|
|
103
|
+
/** Keep-alive configuration. */
|
|
104
|
+
keepAlive: {
|
|
105
|
+
/**
|
|
106
|
+
* Interval between sending ping messages in ms.
|
|
107
|
+
* Set to `null` to disable.
|
|
108
|
+
*/
|
|
109
|
+
interval: number | null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Timeout for the ping request in ms.
|
|
113
|
+
* Set to `null` to disable.
|
|
114
|
+
*/
|
|
115
|
+
timeout?: number | null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/** Enable automatic resubscription after reconnection. */
|
|
119
|
+
autoResubscribe: boolean;
|
|
120
|
+
|
|
121
|
+
/** The WebSocket that is used for communication. */
|
|
122
|
+
readonly socket: ReconnectingWebSocket;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new WebSocket transport instance.
|
|
126
|
+
* @param options - Configuration options for the WebSocket transport layer.
|
|
127
|
+
*/
|
|
128
|
+
constructor(options?: WebSocketTransportOptions) {
|
|
129
|
+
this.socket = new ReconnectingWebSocket(
|
|
130
|
+
options?.url ?? "wss://api.hyperliquid.xyz/ws",
|
|
131
|
+
undefined,
|
|
132
|
+
options?.reconnect,
|
|
133
|
+
);
|
|
134
|
+
this._hlEvents = new HyperliquidEventTarget(this.socket);
|
|
135
|
+
this._wsRequester = new WebSocketAsyncRequest(this.socket, this._hlEvents);
|
|
136
|
+
|
|
137
|
+
this.isTestnet = options?.isTestnet ?? false;
|
|
138
|
+
this.timeout = options?.timeout === undefined ? 10_000 : options.timeout;
|
|
139
|
+
this.keepAlive = {
|
|
140
|
+
interval: options?.keepAlive?.interval === undefined ? 30_000 : options.keepAlive?.interval,
|
|
141
|
+
timeout: options?.keepAlive?.timeout === undefined ? this.timeout : options.keepAlive?.timeout,
|
|
142
|
+
};
|
|
143
|
+
this.autoResubscribe = options?.autoResubscribe ?? true;
|
|
144
|
+
|
|
145
|
+
// Initialize listeners
|
|
146
|
+
this.socket.addEventListener("open", () => {
|
|
147
|
+
this._keepAliveStart();
|
|
148
|
+
this._resubscribeStart();
|
|
149
|
+
});
|
|
150
|
+
this.socket.addEventListener("close", () => {
|
|
151
|
+
this._keepAliveStop();
|
|
152
|
+
this._resubscribeStop();
|
|
153
|
+
this._isReconnecting = true;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Sends a request to the Hyperliquid API via WebSocket.
|
|
159
|
+
*
|
|
160
|
+
* Note: Explorer requests are not supported in the Hyperliquid WebSocket API.
|
|
161
|
+
*
|
|
162
|
+
* @param endpoint - The API endpoint to send the request to (`explorer` requests are not supported).
|
|
163
|
+
* @param payload - The payload to send with the request.
|
|
164
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the request can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
165
|
+
* @returns A promise that resolves with parsed JSON response body.
|
|
166
|
+
*
|
|
167
|
+
* @throws {WebSocketRequestError} - An error that occurs when a WebSocket request fails.
|
|
168
|
+
*/
|
|
169
|
+
async request<T>(type: "info" | "exchange", payload: unknown, signal?: AbortSignal): Promise<T> {
|
|
170
|
+
try {
|
|
171
|
+
const timeoutSignal = this.timeout ? AbortSignal.timeout(this.timeout) : undefined;
|
|
172
|
+
const combinedSignal = signal && timeoutSignal
|
|
173
|
+
? AbortSignal.any([signal, timeoutSignal])
|
|
174
|
+
: signal ?? timeoutSignal;
|
|
175
|
+
|
|
176
|
+
return await this._wsRequester.request(
|
|
177
|
+
"post",
|
|
178
|
+
{
|
|
179
|
+
type: type === "exchange" ? "action" : type,
|
|
180
|
+
payload,
|
|
181
|
+
},
|
|
182
|
+
combinedSignal,
|
|
183
|
+
);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
if (error instanceof TransportError) throw error; // Re-throw known errors
|
|
186
|
+
throw new WebSocketRequestError(
|
|
187
|
+
`Unknown error while making a WebSocket request: ${error}`,
|
|
188
|
+
{ cause: error },
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Subscribes to a Hyperliquid event channel.
|
|
195
|
+
* Sends a subscription request to the server and listens for events.
|
|
196
|
+
*
|
|
197
|
+
* @param channel - The event channel to listen to.
|
|
198
|
+
* @param payload - A payload to send with the subscription request.
|
|
199
|
+
* @param listener - A function to call when the event is dispatched.
|
|
200
|
+
* @returns A promise that resolves with a {@link Subscription} object to manage the subscription lifecycle.
|
|
201
|
+
*
|
|
202
|
+
* @throws {WebSocketRequestError} - An error that occurs when a WebSocket request fails.
|
|
203
|
+
*/
|
|
204
|
+
async subscribe<T>(
|
|
205
|
+
channel: string,
|
|
206
|
+
payload: unknown,
|
|
207
|
+
listener: (data: CustomEvent<T>) => void,
|
|
208
|
+
): Promise<Subscription> {
|
|
209
|
+
try {
|
|
210
|
+
// Create a unique identifier for the subscription
|
|
211
|
+
const id = WebSocketAsyncRequest.requestToId(payload);
|
|
212
|
+
|
|
213
|
+
// Initialize new subscription, if it doesn't exist
|
|
214
|
+
let subscription = this._subscriptions.get(id);
|
|
215
|
+
if (!subscription) {
|
|
216
|
+
// Send subscription request
|
|
217
|
+
const promise = this._wsRequester.request("subscribe", payload);
|
|
218
|
+
|
|
219
|
+
// Cache subscription info
|
|
220
|
+
subscription = {
|
|
221
|
+
listeners: new Map(),
|
|
222
|
+
promise,
|
|
223
|
+
resubscribeAbortController: new AbortController(),
|
|
224
|
+
};
|
|
225
|
+
this._subscriptions.set(id, subscription);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Initialize new listener, if it doesn't exist
|
|
229
|
+
let unsubscribe = subscription.listeners.get(listener);
|
|
230
|
+
if (!unsubscribe) {
|
|
231
|
+
// Create new unsubscribe function
|
|
232
|
+
unsubscribe = async () => {
|
|
233
|
+
try {
|
|
234
|
+
// Remove listener and cleanup
|
|
235
|
+
this._hlEvents.removeEventListener(channel, listener as EventListener);
|
|
236
|
+
const subscription = this._subscriptions.get(id);
|
|
237
|
+
subscription?.listeners.delete(listener);
|
|
238
|
+
|
|
239
|
+
// If no listeners remain, remove subscription entirely
|
|
240
|
+
if (subscription?.listeners.size === 0) {
|
|
241
|
+
// Cleanup subscription
|
|
242
|
+
this._subscriptions.delete(id);
|
|
243
|
+
|
|
244
|
+
// If the socket is open, send unsubscription request
|
|
245
|
+
if (this.socket.readyState === ReconnectingWebSocket.OPEN) {
|
|
246
|
+
await this._wsRequester.request("unsubscribe", payload);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} catch (error) {
|
|
250
|
+
if (error instanceof TransportError) throw error; // Re-throw known errors
|
|
251
|
+
throw new WebSocketRequestError(
|
|
252
|
+
`Unknown error while unsubscribing from a WebSocket channel: ${error}`,
|
|
253
|
+
{ cause: error },
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// Add listener and cache unsubscribe function
|
|
259
|
+
this._hlEvents.addEventListener(channel, listener as EventListener);
|
|
260
|
+
subscription.listeners.set(listener, unsubscribe);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Wait for the initial subscription request to complete
|
|
264
|
+
await subscription.promise;
|
|
265
|
+
|
|
266
|
+
// Return subscription control object
|
|
267
|
+
return {
|
|
268
|
+
unsubscribe,
|
|
269
|
+
resubscribeSignal: subscription.resubscribeAbortController?.signal,
|
|
270
|
+
};
|
|
271
|
+
} catch (error) {
|
|
272
|
+
if (error instanceof TransportError) throw error; // Re-throw known errors
|
|
273
|
+
throw new WebSocketRequestError(
|
|
274
|
+
`Unknown error while subscribing to a WebSocket channel: ${error}`,
|
|
275
|
+
{ cause: error },
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Waits until the WebSocket connection is ready.
|
|
282
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the promise can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
283
|
+
* @returns A promise that resolves when the connection is ready.
|
|
284
|
+
*/
|
|
285
|
+
ready(signal?: AbortSignal): Promise<void> {
|
|
286
|
+
return new Promise((resolve, reject) => {
|
|
287
|
+
const combinedSignal = signal
|
|
288
|
+
? AbortSignal.any([this.socket.reconnectAbortController.signal, signal])
|
|
289
|
+
: this.socket.reconnectAbortController.signal;
|
|
290
|
+
|
|
291
|
+
if (combinedSignal.aborted) return reject(combinedSignal.reason);
|
|
292
|
+
if (this.socket.readyState === ReconnectingWebSocket.OPEN) return resolve();
|
|
293
|
+
|
|
294
|
+
const handleOpen = () => {
|
|
295
|
+
combinedSignal.removeEventListener("abort", handleAbort);
|
|
296
|
+
resolve();
|
|
297
|
+
};
|
|
298
|
+
const handleAbort = () => {
|
|
299
|
+
this.socket.removeEventListener("open", handleOpen);
|
|
300
|
+
reject(combinedSignal.reason);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
this.socket.addEventListener("open", handleOpen, { once: true });
|
|
304
|
+
combinedSignal.addEventListener("abort", handleAbort, { once: true });
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Closes the WebSocket connection and waits until it is fully closed.
|
|
310
|
+
* @param signal - An {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | AbortSignal}. If this option is set, the promise can be canceled by calling {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort | abort()} on the corresponding {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/AbortController | AbortController}.
|
|
311
|
+
* @returns A promise that resolves when the connection is fully closed.
|
|
312
|
+
*/
|
|
313
|
+
close(signal?: AbortSignal): Promise<void> {
|
|
314
|
+
return new Promise((resolve, reject) => {
|
|
315
|
+
if (signal?.aborted) return reject(signal.reason);
|
|
316
|
+
if (this.socket.readyState === ReconnectingWebSocket.CLOSED) return resolve();
|
|
317
|
+
|
|
318
|
+
const handleClose = () => {
|
|
319
|
+
signal?.removeEventListener("abort", handleAbort);
|
|
320
|
+
resolve();
|
|
321
|
+
};
|
|
322
|
+
const handleAbort = () => {
|
|
323
|
+
this.socket.removeEventListener("close", handleClose);
|
|
324
|
+
reject(signal?.reason);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
this.socket.addEventListener("close", handleClose, { once: true });
|
|
328
|
+
signal?.addEventListener("abort", handleAbort, { once: true });
|
|
329
|
+
|
|
330
|
+
this.socket.close();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Keep the connection alive. Sends ping only when necessary. */
|
|
335
|
+
protected _keepAliveStart(): void {
|
|
336
|
+
if (this.keepAlive.interval === null || this._keepAliveTimeout) return;
|
|
337
|
+
|
|
338
|
+
const tick = async () => {
|
|
339
|
+
if (
|
|
340
|
+
this.socket.readyState !== ReconnectingWebSocket.OPEN || !this._keepAliveTimeout ||
|
|
341
|
+
this.keepAlive.interval === null
|
|
342
|
+
) return;
|
|
343
|
+
|
|
344
|
+
// Check if the last request was sent more than the keep-alive interval ago
|
|
345
|
+
if (Date.now() - this._wsRequester.lastRequestTime >= this.keepAlive.interval) {
|
|
346
|
+
const timeoutSignal = this.keepAlive.timeout ? AbortSignal.timeout(this.keepAlive.timeout) : undefined;
|
|
347
|
+
await this._wsRequester.request("ping", timeoutSignal)
|
|
348
|
+
.catch(() => undefined); // Ignore errors
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Schedule the next ping
|
|
352
|
+
if (
|
|
353
|
+
this.socket.readyState === ReconnectingWebSocket.OPEN && this._keepAliveTimeout &&
|
|
354
|
+
this.keepAlive.interval !== null
|
|
355
|
+
) {
|
|
356
|
+
const nextDelay = this.keepAlive.interval - (Date.now() - this._wsRequester.lastRequestTime);
|
|
357
|
+
this._keepAliveTimeout = setTimeout(tick, nextDelay);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
this._keepAliveTimeout = setTimeout(tick, this.keepAlive.interval);
|
|
362
|
+
}
|
|
363
|
+
protected _keepAliveStop(): void {
|
|
364
|
+
if (this._keepAliveTimeout !== null) {
|
|
365
|
+
clearTimeout(this._keepAliveTimeout);
|
|
366
|
+
this._keepAliveTimeout = null;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** Resubscribe to all existing subscriptions if auto-resubscribe is enabled. */
|
|
371
|
+
protected _resubscribeStart(): void {
|
|
372
|
+
if (this.autoResubscribe && this._isReconnecting) {
|
|
373
|
+
for (const [id, subscriptionInfo] of this._subscriptions.entries()) {
|
|
374
|
+
subscriptionInfo.promise = this._wsRequester.request("subscribe", JSON.parse(id))
|
|
375
|
+
.catch((error) => {
|
|
376
|
+
subscriptionInfo.resubscribeAbortController?.abort(error);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
protected _resubscribeStop(): void {
|
|
382
|
+
if (!this.autoResubscribe || this.socket.reconnectAbortController.signal.aborted) {
|
|
383
|
+
for (const subscriptionInfo of this._subscriptions.values()) {
|
|
384
|
+
for (const [_, unsubscribe] of subscriptionInfo.listeners) {
|
|
385
|
+
unsubscribe(); // does not cause an error if used when the connection is closed
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async [Symbol.asyncDispose](): Promise<void> {
|
|
392
|
+
await this.close();
|
|
393
|
+
}
|
|
394
|
+
}
|
package/esm/src/base.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/src/base.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,qBAAa,gBAAiB,SAAQ,KAAK;gBAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIvD"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ClaimRewardsRequest, ConvertToMultiSigUserRequest, ConvertToMultiSigUserRequestWithoutStringify, CreateSubAccountRequest, CreateVaultRequest, CSignerActionRequest, CValidatorActionRequest, CWithdrawRequest, EvmUserModifyRequest, ModifyRequest, MultiSigRequest, NoopRequest, OrderRequest, PerpDeployRequest, RegisterReferrerRequest, ReserveRequestWeightRequest, ScheduleCancelRequest, SendAssetRequest, SetDisplayNameRequest, SetReferrerRequest, SpotDeployRequest, SpotSendRequest, SpotUserRequest, SubAccountModifyRequest, SubAccountSpotTransferRequest, SubAccountTransferRequest, TokenDelegateRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultDistributeRequest, VaultModifyRequest, VaultTransferRequest, Withdraw3Request } from "../types/mod.js";
|
|
2
|
-
/** @see https://github.com/microsoft/TypeScript/issues/13923#issuecomment-2191862501 */
|
|
3
|
-
type DeepImmutable<T> = {
|
|
4
|
-
readonly [K in keyof T]: DeepImmutable<T[K]>;
|
|
5
|
-
};
|
|
6
|
-
/** Action sorter and formatter for correct signature generation. */
|
|
7
|
-
export declare const actionSorter: {
|
|
8
|
-
approveAgent: (action: DeepImmutable<ApproveAgentRequest["action"]>) => ApproveAgentRequest["action"];
|
|
9
|
-
approveBuilderFee: (action: DeepImmutable<ApproveBuilderFeeRequest["action"]>) => ApproveBuilderFeeRequest["action"];
|
|
10
|
-
batchModify: (action: DeepImmutable<BatchModifyRequest["action"]>) => BatchModifyRequest["action"];
|
|
11
|
-
cancel: (action: DeepImmutable<CancelRequest["action"]>) => CancelRequest["action"];
|
|
12
|
-
cancelByCloid: (action: DeepImmutable<CancelByCloidRequest["action"]>) => CancelByCloidRequest["action"];
|
|
13
|
-
cDeposit: (action: DeepImmutable<CDepositRequest["action"]>) => CDepositRequest["action"];
|
|
14
|
-
claimRewards: (action: DeepImmutable<ClaimRewardsRequest["action"]>) => ClaimRewardsRequest["action"];
|
|
15
|
-
convertToMultiSigUser: (action: DeepImmutable<ConvertToMultiSigUserRequest["action"] | ConvertToMultiSigUserRequestWithoutStringify["action"]>) => ConvertToMultiSigUserRequest["action"];
|
|
16
|
-
createSubAccount: (action: DeepImmutable<CreateSubAccountRequest["action"]>) => CreateSubAccountRequest["action"];
|
|
17
|
-
createVault: (action: DeepImmutable<CreateVaultRequest["action"]>) => CreateVaultRequest["action"];
|
|
18
|
-
CSignerAction: (action: DeepImmutable<CSignerActionRequest["action"]>) => CSignerActionRequest["action"];
|
|
19
|
-
CValidatorAction: (action: DeepImmutable<CValidatorActionRequest["action"]>) => CValidatorActionRequest["action"];
|
|
20
|
-
cWithdraw: (action: DeepImmutable<CWithdrawRequest["action"]>) => CWithdrawRequest["action"];
|
|
21
|
-
evmUserModify: (action: DeepImmutable<EvmUserModifyRequest["action"]>) => EvmUserModifyRequest["action"];
|
|
22
|
-
modify: (action: DeepImmutable<ModifyRequest["action"]>) => ModifyRequest["action"];
|
|
23
|
-
multiSig: (action: DeepImmutable<MultiSigRequest["action"]>) => MultiSigRequest["action"];
|
|
24
|
-
noop: (action: DeepImmutable<NoopRequest["action"]>) => NoopRequest["action"];
|
|
25
|
-
order: (action: DeepImmutable<OrderRequest["action"]>) => OrderRequest["action"];
|
|
26
|
-
perpDeploy: (action: DeepImmutable<PerpDeployRequest["action"]>) => PerpDeployRequest["action"];
|
|
27
|
-
registerReferrer: (action: DeepImmutable<RegisterReferrerRequest["action"]>) => RegisterReferrerRequest["action"];
|
|
28
|
-
reserveRequestWeight: (action: DeepImmutable<ReserveRequestWeightRequest["action"]>) => ReserveRequestWeightRequest["action"];
|
|
29
|
-
scheduleCancel: (action: DeepImmutable<ScheduleCancelRequest["action"]>) => ScheduleCancelRequest["action"];
|
|
30
|
-
sendAsset: (action: DeepImmutable<SendAssetRequest["action"]>) => SendAssetRequest["action"];
|
|
31
|
-
setDisplayName: (action: DeepImmutable<SetDisplayNameRequest["action"]>) => SetDisplayNameRequest["action"];
|
|
32
|
-
setReferrer: (action: DeepImmutable<SetReferrerRequest["action"]>) => SetReferrerRequest["action"];
|
|
33
|
-
spotDeploy: (action: DeepImmutable<SpotDeployRequest["action"]>) => SpotDeployRequest["action"];
|
|
34
|
-
spotSend: (action: DeepImmutable<SpotSendRequest["action"]>) => SpotSendRequest["action"];
|
|
35
|
-
spotUser: (action: DeepImmutable<SpotUserRequest["action"]>) => SpotUserRequest["action"];
|
|
36
|
-
subAccountModify: (action: DeepImmutable<SubAccountModifyRequest["action"]>) => SubAccountModifyRequest["action"];
|
|
37
|
-
subAccountSpotTransfer: (action: DeepImmutable<SubAccountSpotTransferRequest["action"]>) => SubAccountSpotTransferRequest["action"];
|
|
38
|
-
subAccountTransfer: (action: DeepImmutable<SubAccountTransferRequest["action"]>) => SubAccountTransferRequest["action"];
|
|
39
|
-
tokenDelegate: (action: DeepImmutable<TokenDelegateRequest["action"]>) => TokenDelegateRequest["action"];
|
|
40
|
-
twapCancel: (action: DeepImmutable<TwapCancelRequest["action"]>) => TwapCancelRequest["action"];
|
|
41
|
-
twapOrder: (action: DeepImmutable<TwapOrderRequest["action"]>) => TwapOrderRequest["action"];
|
|
42
|
-
updateIsolatedMargin: (action: DeepImmutable<UpdateIsolatedMarginRequest["action"]>) => UpdateIsolatedMarginRequest["action"];
|
|
43
|
-
updateLeverage: (action: DeepImmutable<UpdateLeverageRequest["action"]>) => UpdateLeverageRequest["action"];
|
|
44
|
-
usdClassTransfer: (action: DeepImmutable<UsdClassTransferRequest["action"]>) => UsdClassTransferRequest["action"];
|
|
45
|
-
usdSend: (action: DeepImmutable<UsdSendRequest["action"]>) => UsdSendRequest["action"];
|
|
46
|
-
vaultDistribute: (action: DeepImmutable<VaultDistributeRequest["action"]>) => VaultDistributeRequest["action"];
|
|
47
|
-
vaultModify: (action: DeepImmutable<VaultModifyRequest["action"]>) => VaultModifyRequest["action"];
|
|
48
|
-
vaultTransfer: (action: DeepImmutable<VaultTransferRequest["action"]>) => VaultTransferRequest["action"];
|
|
49
|
-
withdraw3: (action: DeepImmutable<Withdraw3Request["action"]>) => Withdraw3Request["action"];
|
|
50
|
-
};
|
|
51
|
-
/** EIP-712 type definitions for user-signed actions. */
|
|
52
|
-
export declare const userSignedActionEip712Types: {
|
|
53
|
-
approveAgent: {
|
|
54
|
-
"HyperliquidTransaction:ApproveAgent": {
|
|
55
|
-
name: string;
|
|
56
|
-
type: string;
|
|
57
|
-
}[];
|
|
58
|
-
};
|
|
59
|
-
approveBuilderFee: {
|
|
60
|
-
"HyperliquidTransaction:ApproveBuilderFee": {
|
|
61
|
-
name: string;
|
|
62
|
-
type: string;
|
|
63
|
-
}[];
|
|
64
|
-
};
|
|
65
|
-
cDeposit: {
|
|
66
|
-
"HyperliquidTransaction:CDeposit": {
|
|
67
|
-
name: string;
|
|
68
|
-
type: string;
|
|
69
|
-
}[];
|
|
70
|
-
};
|
|
71
|
-
convertToMultiSigUser: {
|
|
72
|
-
"HyperliquidTransaction:ConvertToMultiSigUser": {
|
|
73
|
-
name: string;
|
|
74
|
-
type: string;
|
|
75
|
-
}[];
|
|
76
|
-
};
|
|
77
|
-
cWithdraw: {
|
|
78
|
-
"HyperliquidTransaction:CWithdraw": {
|
|
79
|
-
name: string;
|
|
80
|
-
type: string;
|
|
81
|
-
}[];
|
|
82
|
-
};
|
|
83
|
-
multiSig: {
|
|
84
|
-
"HyperliquidTransaction:SendMultiSig": {
|
|
85
|
-
name: string;
|
|
86
|
-
type: string;
|
|
87
|
-
}[];
|
|
88
|
-
};
|
|
89
|
-
sendAsset: {
|
|
90
|
-
"HyperliquidTransaction:SendAsset": {
|
|
91
|
-
name: string;
|
|
92
|
-
type: string;
|
|
93
|
-
}[];
|
|
94
|
-
};
|
|
95
|
-
spotSend: {
|
|
96
|
-
"HyperliquidTransaction:SpotSend": {
|
|
97
|
-
name: string;
|
|
98
|
-
type: string;
|
|
99
|
-
}[];
|
|
100
|
-
};
|
|
101
|
-
tokenDelegate: {
|
|
102
|
-
"HyperliquidTransaction:TokenDelegate": {
|
|
103
|
-
name: string;
|
|
104
|
-
type: string;
|
|
105
|
-
}[];
|
|
106
|
-
};
|
|
107
|
-
usdClassTransfer: {
|
|
108
|
-
"HyperliquidTransaction:UsdClassTransfer": {
|
|
109
|
-
name: string;
|
|
110
|
-
type: string;
|
|
111
|
-
}[];
|
|
112
|
-
};
|
|
113
|
-
usdSend: {
|
|
114
|
-
"HyperliquidTransaction:UsdSend": {
|
|
115
|
-
name: string;
|
|
116
|
-
type: string;
|
|
117
|
-
}[];
|
|
118
|
-
};
|
|
119
|
-
withdraw3: {
|
|
120
|
-
"HyperliquidTransaction:Withdraw": {
|
|
121
|
-
name: string;
|
|
122
|
-
type: string;
|
|
123
|
-
}[];
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
export {};
|
|
127
|
-
//# sourceMappingURL=_sorter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_sorter.d.ts","sourceRoot":"","sources":["../../../src/src/signing/_sorter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,4BAA4B,EAC5B,4CAA4C,EAC5C,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,6BAA6B,EAC7B,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,wFAAwF;AACxF,KAAK,aAAa,CAAC,CAAC,IAAI;IACpB,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/C,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,YAAY;2BACE,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAG,mBAAmB,CAAC,QAAQ,CAAC;gCAWvF,aAAa,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,KAC1D,wBAAwB,CAAC,QAAQ,CAAC;0BAUf,aAAa,CAAC,kBAAkB,CAAC,QAA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