@nktkas/hyperliquid 0.23.0 → 0.24.0

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