@nktkas/hyperliquid 0.13.0 → 0.13.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.
Files changed (206) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +42 -17
  3. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
  4. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
  5. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.js +2 -0
  6. package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
  7. package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.js +1 -1
  9. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
  10. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.js +2 -0
  12. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
  13. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.js +1 -1
  14. package/{script/deps/jsr.io/@std/encoding/1.0.6 → esm/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
  15. package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/hex.js +1 -1
  17. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
  18. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.js +2 -0
  20. package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
  21. package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.js +2 -2
  23. package/esm/mod.d.ts +15 -14
  24. package/esm/mod.d.ts.map +1 -1
  25. package/esm/src/clients/event.d.ts +64 -21
  26. package/esm/src/clients/event.d.ts.map +1 -1
  27. package/esm/src/clients/event.js +76 -18
  28. package/esm/src/clients/public.d.ts +244 -52
  29. package/esm/src/clients/public.d.ts.map +1 -1
  30. package/esm/src/clients/public.js +243 -47
  31. package/esm/src/clients/wallet.d.ts +122 -53
  32. package/esm/src/clients/wallet.d.ts.map +1 -1
  33. package/esm/src/clients/wallet.js +201 -65
  34. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  35. package/esm/src/transports/http/http_transport.js +4 -1
  36. package/esm/src/transports/websocket/hyperliquid_event_target.d.ts +27 -21
  37. package/esm/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -1
  38. package/esm/src/transports/websocket/hyperliquid_event_target.js +37 -0
  39. package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -1
  40. package/esm/src/transports/websocket/websocket_request_dispatcher.js +4 -4
  41. package/esm/src/transports/websocket/websocket_transport.d.ts +7 -10
  42. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  43. package/esm/src/transports/websocket/websocket_transport.js +41 -35
  44. package/esm/src/types/common.d.ts +3 -0
  45. package/esm/src/types/common.d.ts.map +1 -0
  46. package/esm/src/types/common.js +1 -0
  47. package/esm/src/types/exchange/common.d.ts +36 -0
  48. package/esm/src/types/exchange/common.d.ts.map +1 -0
  49. package/esm/src/types/exchange/common.js +1 -0
  50. package/esm/src/types/exchange/requests.d.ts +502 -0
  51. package/esm/src/types/exchange/requests.d.ts.map +1 -0
  52. package/esm/src/types/exchange/requests.js +1 -0
  53. package/esm/src/types/exchange/responses.d.ts +141 -0
  54. package/esm/src/types/exchange/responses.d.ts.map +1 -0
  55. package/esm/src/types/exchange/responses.js +1 -0
  56. package/esm/src/types/explorer/common.d.ts +37 -0
  57. package/esm/src/types/explorer/common.d.ts.map +1 -0
  58. package/esm/src/types/explorer/common.js +1 -0
  59. package/esm/src/types/explorer/requests.d.ts +35 -0
  60. package/esm/src/types/explorer/requests.d.ts.map +1 -0
  61. package/esm/src/types/explorer/requests.js +1 -0
  62. package/esm/src/types/explorer/responses.d.ts +23 -0
  63. package/esm/src/types/explorer/responses.d.ts.map +1 -0
  64. package/esm/src/types/explorer/responses.js +1 -0
  65. package/esm/src/types/info/accounts.d.ts +489 -0
  66. package/esm/src/types/info/accounts.d.ts.map +1 -0
  67. package/esm/src/types/info/accounts.js +1 -0
  68. package/esm/src/types/info/assets.d.ts +275 -0
  69. package/esm/src/types/info/assets.d.ts.map +1 -0
  70. package/esm/src/types/info/assets.js +1 -0
  71. package/esm/src/types/info/delegations.d.ts +117 -0
  72. package/esm/src/types/info/delegations.d.ts.map +1 -0
  73. package/esm/src/types/info/delegations.js +1 -0
  74. package/esm/src/types/info/orders.d.ts +209 -0
  75. package/esm/src/types/info/orders.d.ts.map +1 -0
  76. package/esm/src/types/info/orders.js +1 -0
  77. package/esm/src/types/info/requests.d.ts +445 -0
  78. package/esm/src/types/info/requests.d.ts.map +1 -0
  79. package/esm/src/types/info/requests.js +1 -0
  80. package/esm/src/types/info/vaults.d.ts +90 -0
  81. package/esm/src/types/info/vaults.d.ts.map +1 -0
  82. package/esm/src/types/info/vaults.js +1 -0
  83. package/esm/src/types/subscriptions/common.d.ts +208 -0
  84. package/esm/src/types/subscriptions/common.d.ts.map +1 -0
  85. package/esm/src/types/subscriptions/common.js +1 -0
  86. package/esm/src/types/subscriptions/requests.d.ts +134 -0
  87. package/esm/src/types/subscriptions/requests.d.ts.map +1 -0
  88. package/esm/src/types/subscriptions/requests.js +1 -0
  89. package/esm/src/utils/key_sort.d.ts +3 -3
  90. package/esm/src/utils/key_sort.d.ts.map +1 -1
  91. package/esm/src/utils/signing.d.ts +1 -1
  92. package/esm/src/utils/signing.js +2 -2
  93. package/package.json +2 -2
  94. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +13 -3
  95. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +23 -13
  96. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +55 -45
  97. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.js +97 -87
  98. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.js +14 -4
  99. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js +288 -278
  100. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.js +238 -228
  101. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
  102. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
  103. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.js +13 -0
  104. package/script/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
  105. package/script/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
  106. package/script/deps/jsr.io/@std/bytes/1.0.5/concat.js +45 -0
  107. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
  108. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
  109. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.js +13 -0
  110. package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
  111. package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +39 -0
  112. package/{esm/deps/jsr.io/@std/encoding/1.0.6 → script/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
  113. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  114. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.js +123 -0
  115. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
  116. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
  117. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.js +13 -0
  118. package/script/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
  119. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
  120. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.js +250 -0
  121. package/script/mod.d.ts +15 -14
  122. package/script/mod.d.ts.map +1 -1
  123. package/script/mod.js +23 -13
  124. package/script/src/clients/event.d.ts +64 -21
  125. package/script/src/clients/event.d.ts.map +1 -1
  126. package/script/src/clients/event.js +551 -483
  127. package/script/src/clients/public.d.ts +244 -52
  128. package/script/src/clients/public.d.ts.map +1 -1
  129. package/script/src/clients/public.js +914 -708
  130. package/script/src/clients/wallet.d.ts +122 -53
  131. package/script/src/clients/wallet.d.ts.map +1 -1
  132. package/script/src/clients/wallet.js +1121 -975
  133. package/script/src/transports/base.js +25 -15
  134. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  135. package/script/src/transports/http/http_transport.js +174 -161
  136. package/script/src/transports/websocket/hyperliquid_event_target.d.ts +27 -21
  137. package/script/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -1
  138. package/script/src/transports/websocket/hyperliquid_event_target.js +80 -33
  139. package/script/src/transports/websocket/reconnecting_websocket.js +364 -354
  140. package/script/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -1
  141. package/script/src/transports/websocket/websocket_request_dispatcher.js +196 -186
  142. package/script/src/transports/websocket/websocket_transport.d.ts +7 -10
  143. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  144. package/script/src/transports/websocket/websocket_transport.js +236 -220
  145. package/script/src/types/common.d.ts +3 -0
  146. package/script/src/types/common.d.ts.map +1 -0
  147. package/script/src/types/common.js +12 -0
  148. package/script/src/types/exchange/common.d.ts +36 -0
  149. package/script/src/types/exchange/common.d.ts.map +1 -0
  150. package/script/src/types/exchange/common.js +12 -0
  151. package/script/src/types/exchange/requests.d.ts +502 -0
  152. package/script/src/types/exchange/requests.d.ts.map +1 -0
  153. package/script/src/types/exchange/requests.js +12 -0
  154. package/script/src/types/exchange/responses.d.ts +141 -0
  155. package/script/src/types/exchange/responses.d.ts.map +1 -0
  156. package/script/src/types/exchange/responses.js +12 -0
  157. package/script/src/types/explorer/common.d.ts +37 -0
  158. package/script/src/types/explorer/common.d.ts.map +1 -0
  159. package/script/src/types/explorer/common.js +12 -0
  160. package/script/src/types/explorer/requests.d.ts +35 -0
  161. package/script/src/types/explorer/requests.d.ts.map +1 -0
  162. package/script/src/types/explorer/requests.js +12 -0
  163. package/script/src/types/explorer/responses.d.ts +23 -0
  164. package/script/src/types/explorer/responses.d.ts.map +1 -0
  165. package/script/src/types/explorer/responses.js +12 -0
  166. package/script/src/types/info/accounts.d.ts +489 -0
  167. package/script/src/types/info/accounts.d.ts.map +1 -0
  168. package/script/src/types/info/accounts.js +12 -0
  169. package/script/src/types/info/assets.d.ts +275 -0
  170. package/script/src/types/info/assets.d.ts.map +1 -0
  171. package/script/src/types/info/assets.js +12 -0
  172. package/script/src/types/info/delegations.d.ts +117 -0
  173. package/script/src/types/info/delegations.d.ts.map +1 -0
  174. package/script/src/types/info/delegations.js +12 -0
  175. package/script/src/types/info/orders.d.ts +209 -0
  176. package/script/src/types/info/orders.d.ts.map +1 -0
  177. package/script/src/types/info/orders.js +12 -0
  178. package/script/src/types/info/requests.d.ts +445 -0
  179. package/script/src/types/info/requests.d.ts.map +1 -0
  180. package/script/src/types/info/requests.js +12 -0
  181. package/script/src/types/info/vaults.d.ts +90 -0
  182. package/script/src/types/info/vaults.d.ts.map +1 -0
  183. package/script/src/types/info/vaults.js +12 -0
  184. package/script/src/types/subscriptions/common.d.ts +208 -0
  185. package/script/src/types/subscriptions/common.d.ts.map +1 -0
  186. package/script/src/types/subscriptions/common.js +12 -0
  187. package/script/src/types/subscriptions/requests.d.ts +134 -0
  188. package/script/src/types/subscriptions/requests.d.ts.map +1 -0
  189. package/script/src/types/subscriptions/requests.js +12 -0
  190. package/script/src/utils/key_sort.d.ts +3 -3
  191. package/script/src/utils/key_sort.d.ts.map +1 -1
  192. package/script/src/utils/key_sort.js +133 -123
  193. package/script/src/utils/signing.d.ts +1 -1
  194. package/script/src/utils/signing.js +172 -162
  195. package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
  196. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
  197. package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
  198. package/script/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
  199. package/script/deps/jsr.io/@std/bytes/1.0.4/concat.js +0 -35
  200. package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +0 -29
  201. package/script/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
  202. package/script/deps/jsr.io/@std/encoding/1.0.6/hex.js +0 -113
  203. package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
  204. package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.js +0 -240
  205. /package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
  206. /package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
@@ -0,0 +1,502 @@
1
+ import type { Hex } from "../common.js";
2
+ import type { OrderParams } from "./common.js";
3
+ /** Base structure for exchange requests. */
4
+ export interface BaseExchangeRequest {
5
+ /** Action to perform. */
6
+ action: {
7
+ /** Type of action. */
8
+ type: string;
9
+ /** Additional action parameters. */
10
+ [key: string]: unknown;
11
+ };
12
+ /** Unique request identifier (recommended current timestamp in ms). */
13
+ nonce: number;
14
+ /** Cryptographic signature. */
15
+ signature: {
16
+ r: Hex;
17
+ s: Hex;
18
+ v: number;
19
+ };
20
+ }
21
+ /**
22
+ * Approve an agent to sign on behalf of the master or sub-accounts.
23
+ * @returns {SuccessResponse}
24
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
25
+ */
26
+ export interface ApproveAgentRequest extends BaseExchangeRequest {
27
+ /** Action to be performed. */
28
+ action: {
29
+ /** Type of action. */
30
+ type: "approveAgent";
31
+ /** HyperLiquid network. */
32
+ hyperliquidChain: "Mainnet" | "Testnet";
33
+ /** Chain ID used for signing. */
34
+ signatureChainId: Hex;
35
+ /** Unique request identifier (recommended current timestamp in ms). */
36
+ nonce: number;
37
+ /** Agent address. */
38
+ agentAddress: Hex;
39
+ /** Agent name. */
40
+ agentName: string;
41
+ };
42
+ }
43
+ /**
44
+ * Approve a max fee rate for a builder address.
45
+ * @returns {SuccessResponse}
46
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
47
+ */
48
+ export interface ApproveBuilderFeeRequest extends BaseExchangeRequest {
49
+ /** Action to be performed. */
50
+ action: {
51
+ /** Type of action. */
52
+ type: "approveBuilderFee";
53
+ /** HyperLiquid network. */
54
+ hyperliquidChain: "Mainnet" | "Testnet";
55
+ /** Chain ID used for signing. */
56
+ signatureChainId: Hex;
57
+ /** Unique request identifier (recommended current timestamp in ms). */
58
+ nonce: number;
59
+ /** Max fee rate (e.g., "0.01%"). */
60
+ maxFeeRate: `${string}%`;
61
+ /** Builder address. */
62
+ builder: Hex;
63
+ };
64
+ }
65
+ /**
66
+ * Modify multiple orders.
67
+ * @returns {OrderResponse}
68
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
69
+ */
70
+ export interface BatchModifyRequest extends BaseExchangeRequest {
71
+ /** Action to be performed. */
72
+ action: {
73
+ /** Type of action. */
74
+ type: "batchModify";
75
+ /** Order modifications. */
76
+ modifies: {
77
+ /** Order ID to modify. */
78
+ oid: number;
79
+ /** New order parameters. */
80
+ order: OrderParams;
81
+ }[];
82
+ };
83
+ /** Vault address (for vault trading). */
84
+ vaultAddress?: Hex;
85
+ }
86
+ /**
87
+ * Cancel order(s).
88
+ * @returns {CancelResponse}
89
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
90
+ */
91
+ export interface CancelRequest extends BaseExchangeRequest {
92
+ /** Action to be performed. */
93
+ action: {
94
+ /** Type of action. */
95
+ type: "cancel";
96
+ /** Orders to cancel. */
97
+ cancels: {
98
+ /** Asset ID. */
99
+ a: number;
100
+ /** Order ID. */
101
+ o: number;
102
+ }[];
103
+ };
104
+ /** Vault address (for vault trading). */
105
+ vaultAddress?: Hex;
106
+ }
107
+ /**
108
+ * Cancel order(s) by cloid.
109
+ * @returns {CancelResponse}
110
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
111
+ */
112
+ export interface CancelByCloidRequest extends BaseExchangeRequest {
113
+ /** Action to be performed. */
114
+ action: {
115
+ /** Type of action. */
116
+ type: "cancelByCloid";
117
+ /** Orders to cancel. */
118
+ cancels: {
119
+ /** Asset ID. */
120
+ asset: number;
121
+ /** Client Order ID. */
122
+ cloid: Hex;
123
+ }[];
124
+ };
125
+ /** Vault address (for vault trading). */
126
+ vaultAddress?: Hex;
127
+ }
128
+ /**
129
+ * Deposit into staking balance.
130
+ * @returns {SuccessResponse}
131
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
132
+ */
133
+ export interface CDepositRequest extends BaseExchangeRequest {
134
+ /** Action to be performed. */
135
+ action: {
136
+ /** Type of action. */
137
+ type: "cDeposit";
138
+ /** HyperLiquid network. */
139
+ hyperliquidChain: "Mainnet" | "Testnet";
140
+ /** Chain ID used for signing. */
141
+ signatureChainId: Hex;
142
+ /** Unique request identifier (recommended current timestamp in ms). */
143
+ nonce: number;
144
+ /** Amount of wei to deposit into staking balance. */
145
+ wei: number;
146
+ };
147
+ }
148
+ /**
149
+ * Create a sub-account.
150
+ * @returns {CreateSubAccountResponse}
151
+ * @see null - no documentation
152
+ */
153
+ export interface CreateSubAccountRequest extends BaseExchangeRequest {
154
+ /** Action to be performed. */
155
+ action: {
156
+ /** Type of action. */
157
+ type: "createSubAccount";
158
+ /** Sub-account name. */
159
+ name: string;
160
+ };
161
+ }
162
+ /**
163
+ * Withdraw from staking balance.
164
+ * @returns {SuccessResponse}
165
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
166
+ */
167
+ export interface CWithdrawRequest extends BaseExchangeRequest {
168
+ /** Action to be performed. */
169
+ action: {
170
+ /** Type of action. */
171
+ type: "cWithdraw";
172
+ /** HyperLiquid network. */
173
+ hyperliquidChain: "Mainnet" | "Testnet";
174
+ /** Chain ID used for signing. */
175
+ signatureChainId: Hex;
176
+ /** Unique request identifier (recommended current timestamp in ms). */
177
+ nonce: number;
178
+ /** Amount of wei to withdraw from staking balance. */
179
+ wei: number;
180
+ };
181
+ }
182
+ /**
183
+ * Modify an order.
184
+ * @returns {SuccessResponse}
185
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
186
+ */
187
+ export interface ModifyRequest extends BaseExchangeRequest {
188
+ /** Action to be performed. */
189
+ action: {
190
+ /** Type of action. */
191
+ type: "modify";
192
+ /** Order ID to modify. */
193
+ oid: number;
194
+ /** New order parameters. */
195
+ order: OrderParams;
196
+ };
197
+ /** Vault address (for vault trading). */
198
+ vaultAddress?: Hex;
199
+ }
200
+ /**
201
+ * Place an order(s).
202
+ * @returns {OrderResponse}
203
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
204
+ */
205
+ export interface OrderRequest extends BaseExchangeRequest {
206
+ /** Action to be performed. */
207
+ action: {
208
+ /** Type of action. */
209
+ type: "order";
210
+ /** Order parameters. */
211
+ orders: OrderParams[];
212
+ /**
213
+ * Order grouping strategy:
214
+ * - `na`: Standard order without grouping.
215
+ * - `normalTpsl`: TP/SL order with fixed size that doesn't adjust with position changes.
216
+ * - `positionTpsl`: TP/SL order that adjusts proportionally with the position size.
217
+ */
218
+ grouping: "na" | "normalTpsl" | "positionTpsl";
219
+ /** Builder fee. */
220
+ builder?: {
221
+ /** Builder address. */
222
+ b: Hex;
223
+ /** Builder fee in 0.1bps (1 = 0.0001%). */
224
+ f: number;
225
+ };
226
+ };
227
+ /** Vault address (for vault trading). */
228
+ vaultAddress?: Hex;
229
+ }
230
+ /**
231
+ * Schedule a time to cancel all open orders.
232
+ * @returns {SuccessResponse}
233
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
234
+ */
235
+ export interface ScheduleCancelRequest extends BaseExchangeRequest {
236
+ /** Action to be performed. */
237
+ action: {
238
+ /** Type of action. */
239
+ type: "scheduleCancel";
240
+ /**
241
+ * Scheduled time (in ms since epoch).
242
+ * Must be at least 5 seconds in the future.
243
+ *
244
+ * If not specified, will cause all scheduled cancel operations to be deleted.
245
+ */
246
+ time?: number;
247
+ };
248
+ /** Vault address (for vault trading). */
249
+ vaultAddress?: Hex;
250
+ }
251
+ /**
252
+ * Set a referral code.
253
+ * @returns {SuccessResponse}
254
+ * @see null - no documentation
255
+ */
256
+ export interface SetReferrerRequest extends BaseExchangeRequest {
257
+ /** Action to be performed. */
258
+ action: {
259
+ /** Type of action. */
260
+ type: "setReferrer";
261
+ /** Referral code. */
262
+ code: string;
263
+ };
264
+ }
265
+ /**
266
+ * Transfer a spot asset on L1 to another address.
267
+ * @returns {SuccessResponse}
268
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-spot-transfer
269
+ */
270
+ export interface SpotSendRequest extends BaseExchangeRequest {
271
+ /** Action to be performed. */
272
+ action: {
273
+ /** Type of action. */
274
+ type: "spotSend";
275
+ /** HyperLiquid network. */
276
+ hyperliquidChain: "Mainnet" | "Testnet";
277
+ /** Chain ID used for signing. */
278
+ signatureChainId: Hex;
279
+ /** Unique request identifier (recommended current timestamp in ms). */
280
+ time: number;
281
+ /** Recipient address. */
282
+ destination: Hex;
283
+ /** Token identifier. */
284
+ token: `${string}:${Hex}`;
285
+ /** Amount to send. */
286
+ amount: string;
287
+ };
288
+ }
289
+ /**
290
+ * Transfer between sub-accounts.
291
+ * @returns {SuccessResponse}
292
+ * @see null - no documentation
293
+ */
294
+ export interface SubAccountTransferRequest extends BaseExchangeRequest {
295
+ /** Action to be performed. */
296
+ action: {
297
+ /** Type of action. */
298
+ type: "subAccountTransfer";
299
+ /** Sub-account address. */
300
+ subAccountUser: Hex;
301
+ /** `true` for deposit, `false` for withdrawal. */
302
+ isDeposit: boolean;
303
+ /** Raw amount to transfer (float * 1e6). */
304
+ usd: number;
305
+ };
306
+ }
307
+ /**
308
+ * Delegate or undelegate stake from a validator.
309
+ * @returns {SuccessResponse}
310
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
311
+ */
312
+ export interface TokenDelegateRequest extends BaseExchangeRequest {
313
+ /** Action to be performed. */
314
+ action: {
315
+ /** Type of action. */
316
+ type: "tokenDelegate";
317
+ /** HyperLiquid network. */
318
+ hyperliquidChain: "Mainnet" | "Testnet";
319
+ /** Chain ID used for signing. */
320
+ signatureChainId: Hex;
321
+ /** Unique request identifier (recommended current timestamp in ms). */
322
+ nonce: number;
323
+ /** Validator address. */
324
+ validator: Hex;
325
+ /** `true` for undelegate, `false` for delegate. */
326
+ isUndelegate: boolean;
327
+ /** Amount of wei to delegate. */
328
+ wei: number;
329
+ };
330
+ }
331
+ /**
332
+ * Cancel a TWAP order.
333
+ * @returns {TwapCancelResponse}
334
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
335
+ */
336
+ export interface TwapCancelRequest extends BaseExchangeRequest {
337
+ /** Action to be performed. */
338
+ action: {
339
+ /** Type of action. */
340
+ type: "twapCancel";
341
+ /** Asset ID. */
342
+ a: number;
343
+ /** Twap ID. */
344
+ t: number;
345
+ };
346
+ /** Vault address (for vault trading). */
347
+ vaultAddress?: Hex;
348
+ }
349
+ /**
350
+ * Place a TWAP order.
351
+ * @returns {TwapOrderResponse}
352
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
353
+ */
354
+ export interface TwapOrderRequest extends BaseExchangeRequest {
355
+ /** Action to be performed. */
356
+ action: {
357
+ /** Type of action. */
358
+ type: "twapOrder";
359
+ /** Twap parameters. */
360
+ twap: {
361
+ /** Asset ID. */
362
+ a: number;
363
+ /** Position side (`true` for long, `false` for short). */
364
+ b: boolean;
365
+ /** Size (in base currency units). */
366
+ s: string;
367
+ /** Is reduce-only? */
368
+ r: boolean;
369
+ /** TWAP duration in minutes. */
370
+ m: number;
371
+ /** Enable random order timing. */
372
+ t: boolean;
373
+ };
374
+ };
375
+ /** Vault address (for vault trading). */
376
+ vaultAddress?: Hex;
377
+ }
378
+ /**
379
+ * Update isolated margin for a position.
380
+ * @returns {SuccessResponse}
381
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
382
+ */
383
+ export interface UpdateIsolatedMarginRequest extends BaseExchangeRequest {
384
+ /** Action to be performed. */
385
+ action: {
386
+ /** Type of action. */
387
+ type: "updateIsolatedMargin";
388
+ /** Asset ID. */
389
+ asset: number;
390
+ /** Position side (`true` for long, `false` for short). */
391
+ isBuy: boolean;
392
+ /** Amount to adjust (in USD). */
393
+ ntli: number;
394
+ };
395
+ /** Vault address (for vault trading). */
396
+ vaultAddress?: Hex;
397
+ }
398
+ /**
399
+ * Update leverage for cross or isolated margin.
400
+ * @returns {SuccessResponse}
401
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
402
+ */
403
+ export interface UpdateLeverageRequest extends BaseExchangeRequest {
404
+ /** Action to be performed. */
405
+ action: {
406
+ /** Type of action. */
407
+ type: "updateLeverage";
408
+ /** Asset ID. */
409
+ asset: number;
410
+ /** `true` for cross leverage, `false` for isolated leverage. */
411
+ isCross: boolean;
412
+ /** New leverage value. */
413
+ leverage: number;
414
+ };
415
+ /** Vault address (for vault trading). */
416
+ vaultAddress?: Hex;
417
+ }
418
+ /**
419
+ * Transfer funds between Spot and Perp accounts.
420
+ * @returns {SuccessResponse}
421
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
422
+ */
423
+ export interface UsdClassTransferRequest extends BaseExchangeRequest {
424
+ /** Action to be performed. */
425
+ action: {
426
+ /** Type of action. */
427
+ type: "usdClassTransfer";
428
+ /** HyperLiquid network. */
429
+ hyperliquidChain: "Mainnet" | "Testnet";
430
+ /** Chain ID used for signing. */
431
+ signatureChainId: Hex;
432
+ /** Unique request identifier (recommended current timestamp in ms). */
433
+ nonce: number;
434
+ /** Amount to transfer. */
435
+ amount: string;
436
+ /** `true` for Spot to Perp, `false` for Perp to Spot. */
437
+ toPerp: boolean;
438
+ };
439
+ }
440
+ /**
441
+ * Transfer USDC on L1 to another address.
442
+ * @returns {SuccessResponse}
443
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer
444
+ */
445
+ export interface UsdSendRequest extends BaseExchangeRequest {
446
+ /** Action to be performed. */
447
+ action: {
448
+ /** Type of action. */
449
+ type: "usdSend";
450
+ /** HyperLiquid network. */
451
+ hyperliquidChain: "Mainnet" | "Testnet";
452
+ /** Chain ID used for signing. */
453
+ signatureChainId: Hex;
454
+ /** Unique request identifier (recommended current timestamp in ms). */
455
+ time: number;
456
+ /** Recipient address. */
457
+ destination: Hex;
458
+ /** Amount to send. */
459
+ amount: string;
460
+ };
461
+ }
462
+ /**
463
+ * Add or remove funds from a vault.
464
+ * @returns {SuccessResponse}
465
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
466
+ */
467
+ export interface VaultTransferRequest extends BaseExchangeRequest {
468
+ /** Action to be performed. */
469
+ action: {
470
+ /** Type of action. */
471
+ type: "vaultTransfer";
472
+ /** Vault address. */
473
+ vaultAddress: Hex;
474
+ /** `true` for deposit, `false` for withdrawal. */
475
+ isDeposit: boolean;
476
+ /** Raw amount to transfer (float * 1e6). */
477
+ usd: number;
478
+ };
479
+ }
480
+ /**
481
+ * Initiate a withdrawal request.
482
+ * @returns {SuccessResponse}
483
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
484
+ */
485
+ export interface Withdraw3Request extends BaseExchangeRequest {
486
+ /** Action to be performed. */
487
+ action: {
488
+ /** Type of action. */
489
+ type: "withdraw3";
490
+ /** HyperLiquid network. */
491
+ hyperliquidChain: "Mainnet" | "Testnet";
492
+ /** Chain ID used for signing. */
493
+ signatureChainId: Hex;
494
+ /** Unique request identifier (recommended current timestamp in ms). */
495
+ time: number;
496
+ /** Amount to withdraw. */
497
+ amount: string;
498
+ /** Recipient address. */
499
+ destination: Hex;
500
+ };
501
+ }
502
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/exchange/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAChC,yBAAyB;IACzB,MAAM,EAAE;QACJ,sBAAsB;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,oCAAoC;QACpC,CAAC,GAAG,EAAE,MAAM,GAAG,OAA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ACvE,IAAI,EAAE,MAAM,CAAC;QACb,yBAAyB;QACzB,WAAW,EAAE,GAAG,CAAC;QACjB,sBAAsB;QACtB,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC7D,8BAA8B;IAC9B,MAAM,EAAE;QACJ,sBAAsB;QACtB,IAAI,EAAE,eAAe,CAAC;QACtB,qBAAqB;QACrB,YAAY,EAAE,GAAG,CAAC;QAClB,kDAAkD;QAClD,SAAS,EAAE,OAAO,CAAC;QACnB,4CAA4C;QAC5C,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;CACL;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IACzD,8BAA8B;IAC9B,MAAM,EAAE;QACJ,sBAAsB;QACtB,IAAI,EAAE,WAAW,CAAC;QAClB,2BAA2B;QAC3B,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC;QACxC,iCAAiC;QACjC,gBAAgB,EAAE,GAAG,CAAC;QACtB,uEAAuE;QACvE,IAAI,EAAE,MAAM,CAAC;QACb,0BAA0B;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,yBAAyB;QACzB,WAAW,EAAE,GAAG,CAAC;KACpB,CAAC;CACL"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,141 @@
1
+ import type { Hex } from "../common.js";
2
+ /** Base structure for exchange responses. */
3
+ export interface BaseExchangeResponse {
4
+ /** Response status */
5
+ status: "ok" | "err";
6
+ /** Error message or success data */
7
+ response: string | {
8
+ /** Type of response. */
9
+ type: string;
10
+ /** Specific data for the operation. */
11
+ data?: unknown;
12
+ };
13
+ }
14
+ /** Successful response without specific data. */
15
+ export interface SuccessResponse extends BaseExchangeResponse {
16
+ /** Successful status. */
17
+ status: "ok";
18
+ /** Response details. */
19
+ response: {
20
+ /** Type of response. */
21
+ type: "default";
22
+ };
23
+ }
24
+ /** Error response for failed operations. */
25
+ export interface ErrorResponse extends BaseExchangeResponse {
26
+ /** Error status. */
27
+ status: "err";
28
+ /** Error message. */
29
+ response: string;
30
+ }
31
+ /** Response for order cancellation. */
32
+ export interface CancelResponse extends BaseExchangeResponse {
33
+ /** Successful status. */
34
+ status: "ok";
35
+ /** Response details. */
36
+ response: {
37
+ /** Type of response. */
38
+ type: "cancel";
39
+ /** Specific data. */
40
+ data: {
41
+ /** Array of statuses or error messages. */
42
+ statuses: ("success" | {
43
+ /** Error message. */
44
+ error: string;
45
+ })[];
46
+ };
47
+ };
48
+ }
49
+ /** Response for creating a sub-account. */
50
+ export interface CreateSubAccountResponse extends BaseExchangeResponse {
51
+ /** Successful status. */
52
+ status: "ok";
53
+ /** Response details. */
54
+ response: {
55
+ /** Type of response. */
56
+ type: "createSubAccount";
57
+ /** Sub-account address. */
58
+ data: Hex;
59
+ };
60
+ }
61
+ /** Response for order placement and batch modifications. */
62
+ export interface OrderResponse extends BaseExchangeResponse {
63
+ /** Successful status. */
64
+ status: "ok";
65
+ /** Response details. */
66
+ response: {
67
+ /** Type of response. */
68
+ type: "order";
69
+ /** Specific data. */
70
+ data: {
71
+ /** Array of statuses or error messages. */
72
+ statuses: ({
73
+ /** Resting order status. */
74
+ resting: {
75
+ /** Order ID. */
76
+ oid: number;
77
+ /** Client Order ID. */
78
+ cloid?: Hex;
79
+ };
80
+ } | {
81
+ /** Filled order status. */
82
+ filled: {
83
+ /** Total size filled. */
84
+ totalSz: string;
85
+ /** Average price of fill. */
86
+ avgPx: string;
87
+ /** Order ID. */
88
+ oid: number;
89
+ /** Client Order ID. */
90
+ cloid?: Hex;
91
+ };
92
+ } | {
93
+ /** Error message. */
94
+ error: string;
95
+ })[];
96
+ };
97
+ };
98
+ }
99
+ /** Response for creating a TWAP order. */
100
+ export interface TwapOrderResponse extends BaseExchangeResponse {
101
+ /** Successful status. */
102
+ status: "ok";
103
+ /** Response details. */
104
+ response: {
105
+ /** Type of response. */
106
+ type: "twapOrder";
107
+ /** Specific data. */
108
+ data: {
109
+ /** Status of the operation. */
110
+ status: {
111
+ /** Running order status. */
112
+ running: {
113
+ /** TWAP ID. */
114
+ twapId: number;
115
+ };
116
+ } | {
117
+ /** Error message. */
118
+ error: string;
119
+ };
120
+ };
121
+ };
122
+ }
123
+ /** Response for canceling a TWAP order. */
124
+ export interface TwapCancelResponse extends BaseExchangeResponse {
125
+ /** Successful status. */
126
+ status: "ok";
127
+ /** Response details. */
128
+ response: {
129
+ /** Type of response. */
130
+ type: "twapCancel";
131
+ /** Specific data. */
132
+ data: {
133
+ /** Status of the operation. */
134
+ status: string | {
135
+ /** Error message. */
136
+ error: string;
137
+ };
138
+ };
139
+ };
140
+ }
141
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/exchange/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACjC,sBAAsB;IACtB,MAAM,EAAE,IAAI,GAAG,KAAK,CAAC;IACrB,oCAAoC;IACpC,QAAQ,EACF,MAAM,GACN;QACE,wBAAwB;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,uCAAuC;QACvC,IAAI,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACT;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IACzD,yBAAyB;IACzB,MAAM,EAAE,IAAI,CAAC;IACb,wBAAwB;IACxB,QAAQ,EAAE;QACN,wBAAwB;QACxB,IAAI,EAAE,SAAS,CAAC;KACnB,CAAC;CACL;AAED,4CAA4C;AAC5C,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACvD,oBAAoB;IACpB,MAAM,EAAE,KAAK,CAAC;IACd,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,uCAAuC;AACvC,MAAM,WAAW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