@nktkas/hyperliquid 0.24.2 → 0.25.0-beta.1

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