@nktkas/hyperliquid 0.13.1 → 0.14.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 (243) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +334 -107
  3. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
  4. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
  5. package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.js +2 -0
  6. package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
  7. package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
  8. package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.js +1 -1
  9. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
  10. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.js +2 -0
  12. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
  13. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.js +1 -1
  14. package/{script/deps/jsr.io/@std/encoding/1.0.6 → esm/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
  15. package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/hex.js +1 -1
  17. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
  18. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
  19. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.js +2 -0
  20. package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
  21. package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
  22. package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.js +2 -2
  23. package/esm/mod.d.ts +4 -12
  24. package/esm/mod.d.ts.map +1 -1
  25. package/esm/mod.js +2 -2
  26. package/{script/src/transports → esm/src}/base.d.ts +10 -13
  27. package/esm/src/base.d.ts.map +1 -0
  28. package/esm/src/base.js +14 -0
  29. package/esm/src/clients/event.d.ts +59 -18
  30. package/esm/src/clients/event.d.ts.map +1 -1
  31. package/esm/src/clients/event.js +74 -18
  32. package/esm/src/clients/public.d.ts +348 -53
  33. package/esm/src/clients/public.d.ts.map +1 -1
  34. package/esm/src/clients/public.js +349 -50
  35. package/esm/src/clients/wallet.d.ts +345 -73
  36. package/esm/src/clients/wallet.d.ts.map +1 -1
  37. package/esm/src/clients/wallet.js +979 -229
  38. package/esm/src/signing.d.ts +135 -0
  39. package/esm/src/signing.d.ts.map +1 -0
  40. package/esm/src/signing.js +188 -0
  41. package/esm/src/transports/http/http_transport.d.ts +1 -1
  42. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  43. package/esm/src/transports/http/http_transport.js +1 -1
  44. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +64 -0
  45. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -0
  46. package/esm/src/transports/websocket/_hyperliquid_event_target.js +52 -0
  47. package/esm/src/transports/websocket/{reconnecting_websocket.d.ts → _reconnecting_websocket.d.ts} +26 -26
  48. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -0
  49. package/esm/src/transports/websocket/{reconnecting_websocket.js → _reconnecting_websocket.js} +91 -76
  50. package/{script/src/transports/websocket/websocket_request_dispatcher.d.ts → esm/src/transports/websocket/_websocket_request_dispatcher.d.ts} +3 -7
  51. package/esm/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +1 -0
  52. package/esm/src/transports/websocket/{websocket_request_dispatcher.js → _websocket_request_dispatcher.js} +6 -10
  53. package/esm/src/transports/websocket/websocket_transport.d.ts +15 -21
  54. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  55. package/esm/src/transports/websocket/websocket_transport.js +55 -52
  56. package/esm/src/types/exchange/requests.d.ts +298 -79
  57. package/esm/src/types/exchange/requests.d.ts.map +1 -1
  58. package/esm/src/types/exchange/responses.d.ts +38 -38
  59. package/esm/src/types/exchange/responses.d.ts.map +1 -1
  60. package/esm/src/types/explorer/requests.d.ts +23 -10
  61. package/esm/src/types/explorer/requests.d.ts.map +1 -1
  62. package/esm/src/types/explorer/responses.d.ts +45 -3
  63. package/esm/src/types/explorer/responses.d.ts.map +1 -1
  64. package/esm/src/types/info/accounts.d.ts +279 -189
  65. package/esm/src/types/info/accounts.d.ts.map +1 -1
  66. package/esm/src/types/info/assets.d.ts +191 -185
  67. package/esm/src/types/info/assets.d.ts.map +1 -1
  68. package/esm/src/types/info/delegations.d.ts +117 -0
  69. package/esm/src/types/info/delegations.d.ts.map +1 -0
  70. package/esm/src/types/info/orders.d.ts +94 -94
  71. package/esm/src/types/info/orders.d.ts.map +1 -1
  72. package/esm/src/types/info/requests.d.ts +192 -64
  73. package/esm/src/types/info/requests.d.ts.map +1 -1
  74. package/esm/src/types/info/vaults.d.ts +42 -85
  75. package/esm/src/types/info/vaults.d.ts.map +1 -1
  76. package/esm/src/types/mod.d.ts +14 -0
  77. package/esm/src/types/mod.d.ts.map +1 -0
  78. package/esm/src/types/subscriptions/requests.d.ts +11 -1
  79. package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
  80. package/{script/src/types/subscriptions/common.d.ts → esm/src/types/subscriptions/responses.d.ts} +18 -3
  81. package/esm/src/types/subscriptions/responses.d.ts.map +1 -0
  82. package/package.json +20 -4
  83. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +13 -3
  84. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +23 -13
  85. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +55 -45
  86. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.js +97 -87
  87. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.js +14 -4
  88. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js +288 -278
  89. package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.js +238 -228
  90. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
  91. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
  92. package/script/deps/jsr.io/@std/bytes/1.0.5/_types.js +13 -0
  93. package/script/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
  94. package/script/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
  95. package/script/deps/jsr.io/@std/bytes/1.0.5/concat.js +45 -0
  96. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
  97. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
  98. package/script/deps/jsr.io/@std/encoding/1.0.7/_types.js +13 -0
  99. package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
  100. package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +39 -0
  101. package/{esm/deps/jsr.io/@std/encoding/1.0.6 → script/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
  102. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  103. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.js +123 -0
  104. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
  105. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
  106. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.js +13 -0
  107. package/script/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
  108. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
  109. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.js +250 -0
  110. package/script/mod.d.ts +4 -12
  111. package/script/mod.d.ts.map +1 -1
  112. package/script/mod.js +21 -13
  113. package/{esm/src/transports → script/src}/base.d.ts +10 -13
  114. package/script/src/base.d.ts.map +1 -0
  115. package/script/src/base.js +29 -0
  116. package/script/src/clients/event.d.ts +59 -18
  117. package/script/src/clients/event.d.ts.map +1 -1
  118. package/script/src/clients/event.js +551 -485
  119. package/script/src/clients/public.d.ts +348 -53
  120. package/script/src/clients/public.d.ts.map +1 -1
  121. package/script/src/clients/public.js +1017 -708
  122. package/script/src/clients/wallet.d.ts +345 -73
  123. package/script/src/clients/wallet.d.ts.map +1 -1
  124. package/script/src/clients/wallet.js +1737 -977
  125. package/script/src/signing.d.ts +135 -0
  126. package/script/src/signing.d.ts.map +1 -0
  127. package/script/src/signing.js +203 -0
  128. package/script/src/transports/http/http_transport.d.ts +1 -1
  129. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  130. package/script/src/transports/http/http_transport.js +174 -164
  131. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +64 -0
  132. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -0
  133. package/script/src/transports/websocket/_hyperliquid_event_target.js +66 -0
  134. package/script/src/transports/websocket/{reconnecting_websocket.d.ts → _reconnecting_websocket.d.ts} +26 -26
  135. package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -0
  136. package/script/src/transports/websocket/_reconnecting_websocket.js +400 -0
  137. package/{esm/src/transports/websocket/websocket_request_dispatcher.d.ts → script/src/transports/websocket/_websocket_request_dispatcher.d.ts} +3 -7
  138. package/script/src/transports/websocket/_websocket_request_dispatcher.d.ts.map +1 -0
  139. package/script/src/transports/websocket/_websocket_request_dispatcher.js +212 -0
  140. package/script/src/transports/websocket/websocket_transport.d.ts +15 -21
  141. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  142. package/script/src/transports/websocket/websocket_transport.js +235 -222
  143. package/script/src/types/exchange/requests.d.ts +298 -79
  144. package/script/src/types/exchange/requests.d.ts.map +1 -1
  145. package/script/src/types/exchange/requests.js +12 -2
  146. package/script/src/types/exchange/responses.d.ts +38 -38
  147. package/script/src/types/exchange/responses.d.ts.map +1 -1
  148. package/script/src/types/exchange/responses.js +12 -2
  149. package/script/src/types/explorer/requests.d.ts +23 -10
  150. package/script/src/types/explorer/requests.d.ts.map +1 -1
  151. package/script/src/types/explorer/requests.js +12 -2
  152. package/script/src/types/explorer/responses.d.ts +45 -3
  153. package/script/src/types/explorer/responses.d.ts.map +1 -1
  154. package/script/src/types/explorer/responses.js +12 -2
  155. package/script/src/types/info/accounts.d.ts +279 -189
  156. package/script/src/types/info/accounts.d.ts.map +1 -1
  157. package/script/src/types/info/accounts.js +12 -2
  158. package/script/src/types/info/assets.d.ts +191 -185
  159. package/script/src/types/info/assets.d.ts.map +1 -1
  160. package/script/src/types/info/assets.js +12 -2
  161. package/script/src/types/info/delegations.d.ts +117 -0
  162. package/script/src/types/info/delegations.d.ts.map +1 -0
  163. package/script/src/types/info/delegations.js +12 -0
  164. package/script/src/types/info/orders.d.ts +94 -94
  165. package/script/src/types/info/orders.d.ts.map +1 -1
  166. package/script/src/types/info/orders.js +12 -2
  167. package/script/src/types/info/requests.d.ts +192 -64
  168. package/script/src/types/info/requests.d.ts.map +1 -1
  169. package/script/src/types/info/requests.js +12 -2
  170. package/script/src/types/info/vaults.d.ts +42 -85
  171. package/script/src/types/info/vaults.d.ts.map +1 -1
  172. package/script/src/types/info/vaults.js +12 -2
  173. package/script/src/types/mod.d.ts +14 -0
  174. package/script/src/types/mod.d.ts.map +1 -0
  175. package/script/src/types/mod.js +12 -0
  176. package/script/src/types/subscriptions/requests.d.ts +11 -1
  177. package/script/src/types/subscriptions/requests.d.ts.map +1 -1
  178. package/script/src/types/subscriptions/requests.js +12 -2
  179. package/{esm/src/types/subscriptions/common.d.ts → script/src/types/subscriptions/responses.d.ts} +18 -3
  180. package/script/src/types/subscriptions/responses.d.ts.map +1 -0
  181. package/script/src/types/subscriptions/responses.js +12 -0
  182. package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
  183. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
  184. package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
  185. package/esm/src/transports/base.d.ts.map +0 -1
  186. package/esm/src/transports/base.js +0 -14
  187. package/esm/src/transports/websocket/hyperliquid_event_target.d.ts +0 -66
  188. package/esm/src/transports/websocket/hyperliquid_event_target.d.ts.map +0 -1
  189. package/esm/src/transports/websocket/hyperliquid_event_target.js +0 -33
  190. package/esm/src/transports/websocket/reconnecting_websocket.d.ts.map +0 -1
  191. package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts.map +0 -1
  192. package/esm/src/types/common.d.ts +0 -3
  193. package/esm/src/types/common.d.ts.map +0 -1
  194. package/esm/src/types/exchange/common.d.ts +0 -36
  195. package/esm/src/types/exchange/common.d.ts.map +0 -1
  196. package/esm/src/types/explorer/common.d.ts +0 -37
  197. package/esm/src/types/explorer/common.d.ts.map +0 -1
  198. package/esm/src/types/subscriptions/common.d.ts.map +0 -1
  199. package/esm/src/types/subscriptions/common.js +0 -1
  200. package/esm/src/utils/key_sort.d.ts +0 -21
  201. package/esm/src/utils/key_sort.d.ts.map +0 -1
  202. package/esm/src/utils/key_sort.js +0 -124
  203. package/esm/src/utils/signing.d.ts +0 -109
  204. package/esm/src/utils/signing.d.ts.map +0 -1
  205. package/esm/src/utils/signing.js +0 -164
  206. package/script/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
  207. package/script/deps/jsr.io/@std/bytes/1.0.4/concat.js +0 -35
  208. package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +0 -29
  209. package/script/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
  210. package/script/deps/jsr.io/@std/encoding/1.0.6/hex.js +0 -113
  211. package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
  212. package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.js +0 -240
  213. package/script/src/transports/base.d.ts.map +0 -1
  214. package/script/src/transports/base.js +0 -18
  215. package/script/src/transports/websocket/hyperliquid_event_target.d.ts +0 -66
  216. package/script/src/transports/websocket/hyperliquid_event_target.d.ts.map +0 -1
  217. package/script/src/transports/websocket/hyperliquid_event_target.js +0 -37
  218. package/script/src/transports/websocket/reconnecting_websocket.d.ts.map +0 -1
  219. package/script/src/transports/websocket/reconnecting_websocket.js +0 -374
  220. package/script/src/transports/websocket/websocket_request_dispatcher.d.ts.map +0 -1
  221. package/script/src/transports/websocket/websocket_request_dispatcher.js +0 -206
  222. package/script/src/types/common.d.ts +0 -3
  223. package/script/src/types/common.d.ts.map +0 -1
  224. package/script/src/types/common.js +0 -2
  225. package/script/src/types/exchange/common.d.ts +0 -36
  226. package/script/src/types/exchange/common.d.ts.map +0 -1
  227. package/script/src/types/exchange/common.js +0 -2
  228. package/script/src/types/explorer/common.d.ts +0 -37
  229. package/script/src/types/explorer/common.d.ts.map +0 -1
  230. package/script/src/types/explorer/common.js +0 -2
  231. package/script/src/types/subscriptions/common.d.ts.map +0 -1
  232. package/script/src/types/subscriptions/common.js +0 -2
  233. package/script/src/utils/key_sort.d.ts +0 -21
  234. package/script/src/utils/key_sort.d.ts.map +0 -1
  235. package/script/src/utils/key_sort.js +0 -127
  236. package/script/src/utils/signing.d.ts +0 -109
  237. package/script/src/utils/signing.d.ts.map +0 -1
  238. package/script/src/utils/signing.js +0 -172
  239. /package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
  240. /package/esm/src/types/{common.js → info/delegations.js} +0 -0
  241. /package/esm/src/types/{exchange/common.js → mod.js} +0 -0
  242. /package/esm/src/types/{explorer/common.js → subscriptions/responses.js} +0 -0
  243. /package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
@@ -1,29 +1,47 @@
1
- import type { Hex } from "../types/common.js";
2
- import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CreateSubAccountRequest, ModifyRequest, OrderRequest, ScheduleCancelRequest, SetReferrerRequest, SpotSendRequest, SubAccountTransferRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultTransferRequest, Withdraw3Request } from "../types/exchange/requests.js";
1
+ import { type Hex, HyperliquidError, type IRequestTransport } from "../base.js";
2
+ import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ClaimRewardsRequest, CreateSubAccountRequest, CWithdrawRequest, EvmUserModifyRequest, ModifyRequest, OrderRequest, ScheduleCancelRequest, SetDisplayNameRequest, SetReferrerRequest, SpotSendRequest, SpotUserRequest, SubAccountSpotTransferRequest, SubAccountTransferRequest, TokenDelegateRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultDistributeRequest, VaultModifyRequest, VaultTransferRequest, Withdraw3Request } from "../types/exchange/requests.js";
3
3
  import type { CancelResponse, CreateSubAccountResponse, ErrorResponse, OrderResponse, SuccessResponse, TwapCancelResponse, TwapOrderResponse } from "../types/exchange/responses.js";
4
- import type { IRequestTransport } from "../transports/base.js";
5
- import { type AbstractEthersSigner, type AbstractEthersV5Signer, type AbstractViemWalletClient } from "../utils/signing.js";
4
+ import { type AbstractEthersSigner, type AbstractEthersV5Signer, type AbstractViemWalletClient } from "../signing.js";
6
5
  /** Parameters for the {@linkcode WalletClient} constructor. */
7
6
  export interface WalletClientParameters<T extends IRequestTransport = IRequestTransport, W extends AbstractViemWalletClient | AbstractEthersSigner | AbstractEthersV5Signer = AbstractViemWalletClient | AbstractEthersSigner | AbstractEthersV5Signer> {
8
7
  /** The transport used to connect to the Hyperliquid API. */
9
8
  transport: T;
10
9
  /** The WalletClient/Account ([viem](https://viem.sh/docs/clients/wallet)) or Signer ([ethers.js](https://docs.ethers.org/v6/api/providers/#Signer)) used for signing transactions. */
11
10
  wallet: W;
12
- /** Specifies whether the client uses testnet. Defaults to `false`. */
11
+ /**
12
+ * Specifies whether the client uses testnet.
13
+ *
14
+ * Defaults to `false`.
15
+ */
13
16
  isTestnet?: boolean;
14
17
  /** Sets a default vaultAddress to be used if no vaultAddress is explicitly passed to a method. */
15
18
  defaultVaultAddress?: Hex;
19
+ /**
20
+ * The network that will be used to sign transactions.
21
+ * Must match the network of the {@link wallet}.
22
+ *
23
+ * Defaults to `0xa4b1` for `isTestnet = false` or `0x66eee` for `isTestnet = true`.
24
+ */
25
+ signatureChainId?: Hex;
16
26
  }
17
27
  /** Parameters for the {@linkcode WalletClient.approveAgent} method. */
18
- export type ApproveAgentParameters = Omit<ApproveAgentRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<ApproveAgentRequest["action"], "signatureChainId" | "nonce">>;
28
+ export type ApproveAgentParameters = Omit<ApproveAgentRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<ApproveAgentRequest["action"], "nonce">>;
19
29
  /** Parameters for the {@linkcode WalletClient.approveBuilderFee} method. */
20
- export type ApproveBuilderFeeParameters = Omit<ApproveBuilderFeeRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<ApproveBuilderFeeRequest["action"], "signatureChainId" | "nonce">>;
30
+ export type ApproveBuilderFeeParameters = Omit<ApproveBuilderFeeRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<ApproveBuilderFeeRequest["action"], "nonce">>;
21
31
  /** Parameters for the {@linkcode WalletClient.batchModify} method. */
22
32
  export type BatchModifyParameters = Omit<BatchModifyRequest["action"], "type"> & Partial<Pick<BatchModifyRequest, "vaultAddress" | "nonce">>;
23
33
  /** Parameters for the {@linkcode WalletClient.cancel} method. */
24
34
  export type CancelParameters = Omit<CancelRequest["action"], "type"> & Partial<Pick<CancelRequest, "vaultAddress" | "nonce">>;
35
+ /** Parameters for the {@linkcode WalletClient.cDeposit} method. */
36
+ export type CDepositParameters = Omit<CDepositRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<CDepositRequest["action"], "nonce">>;
37
+ /** Parameters for the {@linkcode WalletClient.claimRewards} method. */
38
+ export type ClaimRewardsParameters = Omit<ClaimRewardsRequest["action"], "type"> & Partial<Pick<ClaimRewardsRequest, "nonce">>;
25
39
  /** Parameters for the {@linkcode WalletClient.cancelByCloid} method. */
26
40
  export type CancelByCloidParameters = Omit<CancelByCloidRequest["action"], "type"> & Partial<Pick<CancelByCloidRequest, "vaultAddress" | "nonce">>;
41
+ /** Parameters for the {@linkcode WalletClient.cWithdraw} method. */
42
+ export type CWithdrawParameters = Omit<CWithdrawRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<CWithdrawRequest["action"], "nonce">>;
43
+ /** Parameters for the {@linkcode WalletClient.evmUserModify} method. */
44
+ export type EvmUserModifyParameters = Omit<EvmUserModifyRequest["action"], "type"> & Partial<Pick<EvmUserModifyRequest, "nonce">>;
27
45
  /** Parameters for the {@linkcode WalletClient.createSubAccount} method. */
28
46
  export type CreateSubAccountParameters = Omit<CreateSubAccountRequest["action"], "type"> & Partial<Pick<CreateSubAccountRequest, "nonce">>;
29
47
  /** Parameters for the {@linkcode WalletClient.modify} method. */
@@ -32,12 +50,20 @@ export type ModifyParameters = Omit<ModifyRequest["action"], "type"> & Partial<P
32
50
  export type OrderParameters = Omit<OrderRequest["action"], "type"> & Partial<Pick<OrderRequest, "vaultAddress" | "nonce">>;
33
51
  /** Parameters for the {@linkcode WalletClient.scheduleCancel} method. */
34
52
  export type ScheduleCancelParameters = Omit<ScheduleCancelRequest["action"], "type"> & Partial<Pick<ScheduleCancelRequest, "vaultAddress" | "nonce">>;
53
+ /** Parameters for the {@linkcode WalletClient.setDisplayName} method. */
54
+ export type SetDisplayNameParameters = Omit<SetDisplayNameRequest["action"], "type"> & Partial<Pick<SetDisplayNameRequest, "nonce">>;
35
55
  /** Parameters for the {@linkcode WalletClient.setReferrer} method. */
36
56
  export type SetReferrerParameters = Omit<SetReferrerRequest["action"], "type"> & Partial<Pick<SetReferrerRequest, "nonce">>;
37
57
  /** Parameters for the {@linkcode WalletClient.spotSend} method. */
38
- export type SpotSendParameters = Omit<SpotSendRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time"> & Partial<Pick<SpotSendRequest["action"], "signatureChainId" | "time">>;
58
+ export type SpotSendParameters = Omit<SpotSendRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time"> & Partial<Pick<SpotSendRequest["action"], "time">>;
59
+ /** Parameters for the {@linkcode WalletClient.spotUser} method. */
60
+ export type SpotUserParameters = Omit<SpotUserRequest["action"], "type"> & Partial<Pick<SpotUserRequest, "nonce">>;
61
+ /** Parameters for the {@linkcode WalletClient.subAccountSpotTransfer} method. */
62
+ export type SubAccountSpotTransferParameters = Omit<SubAccountSpotTransferRequest["action"], "type"> & Partial<Pick<SubAccountSpotTransferRequest, "nonce">>;
39
63
  /** Parameters for the {@linkcode WalletClient.subAccountTransfer} method. */
40
64
  export type SubAccountTransferParameters = Omit<SubAccountTransferRequest["action"], "type"> & Partial<Pick<SubAccountTransferRequest, "nonce">>;
65
+ /** Parameters for the {@linkcode WalletClient.tokenDelegate} method. */
66
+ export type TokenDelegateParameters = Omit<TokenDelegateRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<TokenDelegateRequest["action"], "nonce">>;
41
67
  /** Parameters for the {@linkcode WalletClient.twapCancel} method. */
42
68
  export type TwapCancelParameters = Omit<TwapCancelRequest["action"], "type"> & Partial<Pick<TwapCancelRequest, "vaultAddress" | "nonce">>;
43
69
  /** Parameters for the {@linkcode WalletClient.twapOrder} method. */
@@ -47,13 +73,17 @@ export type UpdateIsolatedMarginParameters = Omit<UpdateIsolatedMarginRequest["a
47
73
  /** Parameters for the {@linkcode WalletClient.updateLeverage} method. */
48
74
  export type UpdateLeverageParameters = Omit<UpdateLeverageRequest["action"], "type"> & Partial<Pick<UpdateLeverageRequest, "vaultAddress" | "nonce">>;
49
75
  /** Parameters for the {@linkcode WalletClient.usdClassTransfer} method. */
50
- export type UsdClassTransferParameters = Omit<UsdClassTransferRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<UsdClassTransferRequest["action"], "signatureChainId" | "nonce">>;
76
+ export type UsdClassTransferParameters = Omit<UsdClassTransferRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce"> & Partial<Pick<UsdClassTransferRequest["action"], "nonce">>;
51
77
  /** Parameters for the {@linkcode WalletClient.usdSend} method. */
52
- export type UsdSendParameters = Omit<UsdSendRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time"> & Partial<Pick<UsdSendRequest["action"], "signatureChainId" | "time">>;
78
+ export type UsdSendParameters = Omit<UsdSendRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time"> & Partial<Pick<UsdSendRequest["action"], "time">>;
79
+ /** Parameters for the {@linkcode WalletClient.vaultDistribute} method. */
80
+ export type VaultDistributeParameters = Omit<VaultDistributeRequest["action"], "type"> & Partial<Pick<VaultDistributeRequest, "nonce">>;
81
+ /** Parameters for the {@linkcode WalletClient.vaultModify} method. */
82
+ export type VaultModifyParameters = Omit<VaultModifyRequest["action"], "type"> & Partial<Pick<VaultModifyRequest, "nonce">>;
53
83
  /** Parameters for the {@linkcode WalletClient.vaultTransfer} method. */
54
84
  export type VaultTransferParameters = Omit<VaultTransferRequest["action"], "type"> & Partial<Pick<VaultTransferRequest, "nonce">>;
55
85
  /** Parameters for the {@linkcode WalletClient.withdraw3} method. */
56
- export type Withdraw3Parameters = Omit<Withdraw3Request["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time"> & Partial<Pick<Withdraw3Request["action"], "signatureChainId" | "time">>;
86
+ export type Withdraw3Parameters = Omit<Withdraw3Request["action"], "type" | "hyperliquidChain" | "signatureChainId" | "time"> & Partial<Pick<Withdraw3Request["action"], "time">>;
57
87
  /** Successful variant of {@linkcode CancelResponse} without error statuses. */
58
88
  export type CancelResponseSuccess = CancelResponse & {
59
89
  response: {
@@ -95,24 +125,32 @@ export type TwapOrderResponseSuccess = TwapOrderResponse & {
95
125
  };
96
126
  };
97
127
  /** Error thrown when the API returns an error response. */
98
- export declare class ApiRequestError extends Error {
128
+ export declare class ApiRequestError extends HyperliquidError {
99
129
  response: ErrorResponse | OrderResponse | CancelResponse | TwapOrderResponse | TwapCancelResponse;
100
130
  constructor(response: ErrorResponse | OrderResponse | CancelResponse | TwapOrderResponse | TwapCancelResponse);
101
131
  }
102
132
  /**
103
133
  * Wallet client for interacting with the Hyperliquid API.
104
- * @typeParam T - The transport used to connect to the Hyperliquid API.
105
- * @typeParam W - The WalletClient/Account ([viem](https://viem.sh/docs/clients/wallet)) or Signer ([ethers.js](https://docs.ethers.io/v6/api/providers/#Signer)) used for signing transactions.
134
+ * @typeParam T The transport used to connect to the Hyperliquid API.
135
+ * @typeParam W The WalletClient/Account ([viem](https://viem.sh/docs/clients/wallet)) or Signer ([ethers.js](https://docs.ethers.io/v6/api/providers/#Signer)) used for signing transactions.
106
136
  */
107
137
  export declare class WalletClient<T extends IRequestTransport = IRequestTransport, W extends AbstractViemWalletClient | AbstractEthersSigner | AbstractEthersV5Signer = AbstractViemWalletClient | AbstractEthersSigner | AbstractEthersV5Signer> {
108
138
  /** The transport used to connect to the Hyperliquid API. */
109
139
  transport: T;
110
- /** The WalletClient/Account ([viem](https://viem.sh/docs/clients/wallet)) or Signer ([ethers.js](https://docs.ethers.org/v6/api/providers/#Signer)) used for signing transactions. */
140
+ /**
141
+ * The [viem](https://viem.sh/docs/clients/wallet) or [ethers.js](https://docs.ethers.org/v6/api/providers/#Signer)
142
+ * used for signing transactions.
143
+ */
111
144
  wallet: W;
112
145
  /** Specifies whether the client uses testnet. */
113
146
  isTestnet: boolean;
114
147
  /** Sets a default vaultAddress to be used if no vaultAddress is explicitly passed to a method. */
115
148
  defaultVaultAddress?: Hex;
149
+ /**
150
+ * The network that will be used to sign transactions.
151
+ * Must match the network of the {@link wallet}.
152
+ */
153
+ signatureChainId: Hex;
116
154
  /**
117
155
  * Initialises a new instance.
118
156
  * @param args - The parameters for the client.
@@ -128,7 +166,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
128
166
  * const client = new hl.WalletClient({ wallet, transport });
129
167
  * ```
130
168
  *
131
- * @example Private key via [ethers.js](https://docs.ethers.org/v6/api/wallet/#Wallet)
169
+ * @example Private key via [ethers.js](https://docs.ethers.org/v6/api/wallet/#Wallet) or [ethers.js v5](https://docs.ethers.org/v5/api/signer/#Wallet)
132
170
  * ```ts
133
171
  * import * as hl from "@nktkas/hyperliquid";
134
172
  * import { ethers } from "ethers";
@@ -143,24 +181,31 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
143
181
  * ```ts
144
182
  * import * as hl from "@nktkas/hyperliquid";
145
183
  * import { createWalletClient, custom } from "viem";
146
- * import { arbitrum } from "viem/chains";
147
184
  *
148
185
  * const [account] = await window.ethereum.request({ method: "eth_requestAccounts" });
149
- * const wallet = createWalletClient({ account, chain: arbitrum, transport: custom(window.ethereum) });
186
+ * const wallet = createWalletClient({ account, transport: custom(window.ethereum) });
150
187
  *
151
188
  * const transport = new hl.HttpTransport(); // or WebSocketTransport
152
189
  * const client = new hl.WalletClient({ wallet, transport });
153
190
  * ```
191
+ *
192
+ * @example External wallet (e.g. MetaMask) via `window.ethereum` directly
193
+ * ```ts
194
+ * import * as hl from "@nktkas/hyperliquid";
195
+ *
196
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
197
+ * const client = new hl.WalletClient({ wallet: window.ethereum, transport });
198
+ * ```
154
199
  */
155
200
  constructor(args: WalletClientParameters<T, W>);
156
201
  /**
157
202
  * Approve an agent to sign on behalf of the master or sub-accounts.
158
203
  * @param args - The parameters for the request.
159
204
  * @param signal - An optional abort signal
160
- * @returns {SuccessResponse} Successful response without specific data.
205
+ * @returns Successful response without specific data.
161
206
  * @throws {ApiRequestError} When the API returns an error response.
162
207
  *
163
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet | Hyperliquid GitBook}
208
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
164
209
  * @example
165
210
  * ```ts
166
211
  * import * as hl from "@nktkas/hyperliquid";
@@ -174,16 +219,17 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
174
219
  * agentAddress: "0x...",
175
220
  * agentName: "agentName",
176
221
  * });
222
+ * ```
177
223
  */
178
224
  approveAgent(args: ApproveAgentParameters, signal?: AbortSignal): Promise<SuccessResponse>;
179
225
  /**
180
226
  * Approve a max fee rate for a builder address.
181
227
  * @param args - The parameters for the request.
182
228
  * @param signal - An optional abort signal.
183
- * @returns {SuccessResponse} Successful response without specific data.
229
+ * @returns Successful response without specific data.
184
230
  * @throws {ApiRequestError} When the API returns an error response.
185
231
  *
186
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee | Hyperliquid GitBook}
232
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
187
233
  * @example
188
234
  * ```ts
189
235
  * import * as hl from "@nktkas/hyperliquid";
@@ -197,16 +243,17 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
197
243
  * maxFeeRate: "0.01%",
198
244
  * builder: "0x...",
199
245
  * });
246
+ * ```
200
247
  */
201
248
  approveBuilderFee(args: ApproveBuilderFeeParameters, signal?: AbortSignal): Promise<SuccessResponse>;
202
249
  /**
203
250
  * Modify multiple orders.
204
251
  * @param args - The parameters for the request.
205
252
  * @param signal - An optional abort signal.
206
- * @returns {OrderResponseSuccess} Successful variant of {@link OrderResponse} without error statuses.
253
+ * @returns Successful variant of {@link OrderResponse} without error statuses.
207
254
  * @throws {ApiRequestError} When the API returns an error response.
208
255
  *
209
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders | Hyperliquid GitBook}
256
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
210
257
  * @example
211
258
  * ```ts
212
259
  * import * as hl from "@nktkas/hyperliquid";
@@ -241,10 +288,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
241
288
  * Cancel order(s).
242
289
  * @param args - The parameters for the request.
243
290
  * @param signal - An optional abort signal.
244
- * @returns {CancelResponseSuccess} Successful variant of {@link CancelResponse} without error statuses.
291
+ * @returns Successful variant of {@link CancelResponse} without error statuses.
245
292
  * @throws {ApiRequestError} When the API returns an error response.
246
293
  *
247
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s | Hyperliquid GitBook}
294
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
248
295
  * @example
249
296
  * ```ts
250
297
  * import * as hl from "@nktkas/hyperliquid";
@@ -264,13 +311,55 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
264
311
  */
265
312
  cancel(args: CancelParameters, signal?: AbortSignal): Promise<CancelResponseSuccess>;
266
313
  /**
267
- * Cancel order(s) by Client Order ID.
314
+ * Deposit into staking balance.
315
+ * @param args - The parameters for the request.
316
+ * @param signal - An optional abort signal.
317
+ * @returns Successful response without specific data.
318
+ * @throws {ApiRequestError} When the API returns an error response.
319
+ *
320
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
321
+ * @example
322
+ * ```ts
323
+ * import * as hl from "@nktkas/hyperliquid";
324
+ * import { privateKeyToAccount } from "viem/accounts";
325
+ *
326
+ * const wallet = privateKeyToAccount("0x...");
327
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
328
+ * const client = new hl.WalletClient({ wallet, transport });
329
+ *
330
+ * const result = await client.cDeposit({ wei: 1 * 1e8 });
331
+ * ```
332
+ */
333
+ cDeposit(args: CDepositParameters, signal?: AbortSignal): Promise<SuccessResponse>;
334
+ /**
335
+ * Claim rewards from referral program.
336
+ * @param args - The parameters for the request.
337
+ * @param signal - An optional abort signal.
338
+ * @returns Successful response without specific data.
339
+ * @throws {ApiRequestError} When the API returns an error response.
340
+ *
341
+ * @see null - no documentation
342
+ * @example
343
+ * ```ts
344
+ * import * as hl from "@nktkas/hyperliquid";
345
+ * import { privateKeyToAccount } from "viem/accounts";
346
+ *
347
+ * const wallet = privateKeyToAccount("0x...");
348
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
349
+ * const client = new hl.WalletClient({ wallet, transport });
350
+ *
351
+ * const result = await client.claimRewards();
352
+ * ```
353
+ */
354
+ claimRewards(args?: ClaimRewardsParameters, signal?: AbortSignal): Promise<SuccessResponse>;
355
+ /**
356
+ * Cancel order(s) by cloid.
268
357
  * @param args - The parameters for the request.
269
358
  * @param signal - An optional abort signal.
270
- * @returns {CancelResponseSuccess} Successful variant of {@link CancelResponse} without error statuses.
359
+ * @returns Successful variant of {@link CancelResponse} without error statuses.
271
360
  * @throws {ApiRequestError} When the API returns an error response.
272
361
  *
273
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid | Hyperliquid GitBook}
362
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
274
363
  * @example
275
364
  * ```ts
276
365
  * import * as hl from "@nktkas/hyperliquid";
@@ -289,13 +378,56 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
289
378
  * ```
290
379
  */
291
380
  cancelByCloid(args: CancelByCloidParameters, signal?: AbortSignal): Promise<CancelResponseSuccess>;
381
+ /**
382
+ * Withdraw from staking balance.
383
+ * @param args - The parameters for the request.
384
+ * @param signal - An optional abort signal.
385
+ * @returns Successful response without specific data.
386
+ * @throws {ApiRequestError} When the API returns an error response.
387
+ *
388
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
389
+ * @example
390
+ * ```ts
391
+ * import * as hl from "@nktkas/hyperliquid";
392
+ * import { privateKeyToAccount } from "viem/accounts";
393
+ *
394
+ * const wallet = privateKeyToAccount("0x...");
395
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
396
+ * const client = new hl.WalletClient({ wallet, transport });
397
+ *
398
+ * const result = await client.cWithdraw({ wei: 1 * 1e8 });
399
+ * ```
400
+ */
401
+ cWithdraw(args: CWithdrawParameters, signal?: AbortSignal): Promise<SuccessResponse>;
402
+ /**
403
+ * Configure block type for EVM transactions.
404
+ * @param args - The parameters for the request.
405
+ * @param signal - An optional abort signal.
406
+ * @returns Response for creating a sub-account.
407
+ * @throws {ApiRequestError} When the API returns an error response.
408
+ *
409
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/evm/dual-block-architecture
410
+ * @example
411
+ * ```ts
412
+ * import * as hl from "@nktkas/hyperliquid";
413
+ * import { privateKeyToAccount } from "viem/accounts";
414
+ *
415
+ * const wallet = privateKeyToAccount("0x...");
416
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
417
+ * const client = new hl.WalletClient({ wallet, transport });
418
+ *
419
+ * const result = await client.evmUserModify({ usingBigBlocks: true });
420
+ * ```
421
+ */
422
+ evmUserModify(args: EvmUserModifyParameters, signal?: AbortSignal): Promise<SuccessResponse>;
292
423
  /**
293
424
  * Create a sub-account.
294
425
  * @param args - The parameters for the request.
295
426
  * @param signal - An optional abort signal.
296
- * @returns {CreateSubAccountResponse} Response for creating a sub-account.
427
+ * @returns Response for creating a sub-account.
297
428
  * @throws {ApiRequestError} When the API returns an error response.
298
429
  *
430
+ * @see null - no documentation
299
431
  * @example
300
432
  * ```ts
301
433
  * import * as hl from "@nktkas/hyperliquid";
@@ -305,9 +437,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
305
437
  * const transport = new hl.HttpTransport(); // or WebSocketTransport
306
438
  * const client = new hl.WalletClient({ wallet, transport });
307
439
  *
308
- * const result = await client.createSubAccount({
309
- * name: "subAccountName",
310
- * });
440
+ * const result = await client.createSubAccount({ name: "subAccountName" });
311
441
  * ```
312
442
  */
313
443
  createSubAccount(args: CreateSubAccountParameters, signal?: AbortSignal): Promise<CreateSubAccountResponse>;
@@ -315,10 +445,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
315
445
  * Modify an order.
316
446
  * @param args - The parameters for the request.
317
447
  * @param signal - An optional abort signal.
318
- * @returns {SuccessResponse} Successful response without specific data.
448
+ * @returns Successful response without specific data.
319
449
  * @throws {ApiRequestError} When the API returns an error response.
320
450
  *
321
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order | Hyperliquid GitBook}
451
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
322
452
  * @example
323
453
  * ```ts
324
454
  * import * as hl from "@nktkas/hyperliquid";
@@ -351,10 +481,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
351
481
  * Place an order(s).
352
482
  * @param args - The parameters for the request.
353
483
  * @param signal - An optional abort signal.
354
- * @returns {OrderResponseSuccess} Successful variant of {@link OrderResponse} without error statuses.
484
+ * @returns Successful variant of {@link OrderResponse} without error statuses.
355
485
  * @throws {ApiRequestError} When the API returns an error response.
356
486
  *
357
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order | Hyperliquid GitBook}
487
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
358
488
  * @example
359
489
  * ```ts
360
490
  * import * as hl from "@nktkas/hyperliquid";
@@ -387,10 +517,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
387
517
  * Schedule a time to cancel all open orders.
388
518
  * @param args - The parameters for the request.
389
519
  * @param signal - An optional abort signal.
390
- * @returns {SuccessResponse} Successful response without specific data.
520
+ * @returns Successful response without specific data.
391
521
  * @throws {ApiRequestError} When the API returns an error response.
392
522
  *
393
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch | Hyperliquid GitBook}
523
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
394
524
  * @example
395
525
  * ```ts
396
526
  * import * as hl from "@nktkas/hyperliquid";
@@ -400,19 +530,39 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
400
530
  * const transport = new hl.HttpTransport(); // or WebSocketTransport
401
531
  * const client = new hl.WalletClient({ wallet, transport });
402
532
  *
403
- * const result = await client.scheduleCancel({
404
- * time: Date.now() + 3600000, // Schedule cancellation 1 hour from now
405
- * });
533
+ * const result = await client.scheduleCancel({ time: Date.now() + 3600000 });
406
534
  * ```
407
535
  */
408
536
  scheduleCancel(args?: ScheduleCancelParameters, signal?: AbortSignal): Promise<SuccessResponse>;
537
+ /**
538
+ * Set the display name in the leaderboard.
539
+ * @param args - The parameters for the request.
540
+ * @param signal - An optional abort signal.
541
+ * @returns Successful response without specific data.
542
+ * @throws {ApiRequestError} When the API returns an error response.
543
+ *
544
+ * @see null - no documentation
545
+ * @example
546
+ * ```ts
547
+ * import * as hl from "@nktkas/hyperliquid";
548
+ * import { privateKeyToAccount } from "viem/accounts";
549
+ *
550
+ * const wallet = privateKeyToAccount("0x...");
551
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
552
+ * const client = new hl.WalletClient({ wallet, transport });
553
+ *
554
+ * const result = await client.setDisplayName({ displayName: "My Name" });
555
+ * ```
556
+ */
557
+ setDisplayName(args: SetDisplayNameParameters, signal?: AbortSignal): Promise<SuccessResponse>;
409
558
  /**
410
559
  * Set a referral code.
411
560
  * @param args - The parameters for the request.
412
561
  * @param signal - An optional abort signal.
413
- * @returns {SuccessResponse} Successful response without specific data.
562
+ * @returns Successful response without specific data.
414
563
  * @throws {ApiRequestError} When the API returns an error response.
415
564
  *
565
+ * @see null - no documentation
416
566
  * @example
417
567
  * ```ts
418
568
  * import * as hl from "@nktkas/hyperliquid";
@@ -422,9 +572,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
422
572
  * const transport = new hl.HttpTransport(); // or WebSocketTransport
423
573
  * const client = new hl.WalletClient({ wallet, transport });
424
574
  *
425
- * const result = await client.setReferrer({
426
- * code: "TEST",
427
- * });
575
+ * const result = await client.setReferrer({ code: "TEST" });
428
576
  * ```
429
577
  */
430
578
  setReferrer(args: SetReferrerParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -432,10 +580,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
432
580
  * Transfer a spot asset on L1 to another address.
433
581
  * @param args - The parameters for the request.
434
582
  * @param signal - An optional abort signal.
435
- * @returns {SuccessResponse} Successful response without specific data.
583
+ * @returns Successful response without specific data.
436
584
  * @throws {ApiRequestError} When the API returns an error response.
437
585
  *
438
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-spot-transfer | Hyperliquid GitBook}
586
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-spot-transfer
439
587
  * @example
440
588
  * ```ts
441
589
  * import * as hl from "@nktkas/hyperliquid";
@@ -454,12 +602,62 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
454
602
  */
455
603
  spotSend(args: SpotSendParameters, signal?: AbortSignal): Promise<SuccessResponse>;
456
604
  /**
457
- * Transfer between sub-accounts.
605
+ * Opt Out of Spot Dusting.
458
606
  * @param args - The parameters for the request.
459
607
  * @param signal - An optional abort signal.
460
- * @returns {SuccessResponse} Successful response without specific data.
608
+ * @returns Successful response without specific data.
461
609
  * @throws {ApiRequestError} When the API returns an error response.
462
610
  *
611
+ * @see null - no documentation
612
+ * @example
613
+ * ```ts
614
+ * import * as hl from "@nktkas/hyperliquid";
615
+ * import { privateKeyToAccount } from "viem/accounts";
616
+ *
617
+ * const wallet = privateKeyToAccount("0x...");
618
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
619
+ * const client = new hl.WalletClient({ wallet, transport });
620
+ *
621
+ * const result = await client.spotUser({
622
+ * toggleSpotDusting: { optOut: false },
623
+ * });
624
+ * ```
625
+ */
626
+ spotUser(args: SpotUserParameters, signal?: AbortSignal): Promise<SuccessResponse>;
627
+ /**
628
+ * Transfer between sub-accounts (spot).
629
+ * @param args - The parameters for the request.
630
+ * @param signal - An optional abort signal.
631
+ * @returns Successful response without specific data.
632
+ * @throws {ApiRequestError} When the API returns an error response.
633
+ *
634
+ * @see null - no documentation
635
+ * @example
636
+ * ```ts
637
+ * import * as hl from "@nktkas/hyperliquid";
638
+ * import { privateKeyToAccount } from "viem/accounts";
639
+ *
640
+ * const wallet = privateKeyToAccount("0x...");
641
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
642
+ * const client = new hl.WalletClient({ wallet, transport });
643
+ *
644
+ * const result = await client.subAccountSpotTransfer({
645
+ * subAccountUser: "0x...",
646
+ * isDeposit: true,
647
+ * token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
648
+ * amount: "1",
649
+ * });
650
+ * ```
651
+ */
652
+ subAccountSpotTransfer(args: SubAccountSpotTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
653
+ /**
654
+ * Transfer between sub-accounts (perpetual).
655
+ * @param args - The parameters for the request.
656
+ * @param signal - An optional abort signal.
657
+ * @returns Successful response without specific data.
658
+ * @throws {ApiRequestError} When the API returns an error response.
659
+ *
660
+ * @see null - no documentation
463
661
  * @example
464
662
  * ```ts
465
663
  * import * as hl from "@nktkas/hyperliquid";
@@ -472,19 +670,44 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
472
670
  * const result = await client.subAccountTransfer({
473
671
  * subAccountUser: "0x...",
474
672
  * isDeposit: true,
475
- * usd: 1000000, // 1 USD in raw units (float amount * 1e6)
673
+ * usd: 1 * 1e6,
476
674
  * });
477
675
  * ```
478
676
  */
479
677
  subAccountTransfer(args: SubAccountTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
678
+ /**
679
+ * Delegate or undelegate stake from a validator.
680
+ * @param args - The parameters for the request.
681
+ * @param signal - An optional abort signal.
682
+ * @returns Successful response without specific data.
683
+ * @throws {ApiRequestError} When the API returns an error response.
684
+ *
685
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
686
+ * @example
687
+ * ```ts
688
+ * import * as hl from "@nktkas/hyperliquid";
689
+ * import { privateKeyToAccount } from "viem/accounts";
690
+ *
691
+ * const wallet = privateKeyToAccount("0x...");
692
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
693
+ * const client = new hl.WalletClient({ wallet, transport });
694
+ *
695
+ * const result = await client.tokenDelegate({
696
+ * validator: "0x...",
697
+ * isUndelegate: true,
698
+ * wei: 1 * 1e8,
699
+ * });
700
+ * ```
701
+ */
702
+ tokenDelegate(args: TokenDelegateParameters, signal?: AbortSignal): Promise<SuccessResponse>;
480
703
  /**
481
704
  * Cancel a TWAP order.
482
705
  * @param args - The parameters for the request.
483
706
  * @param signal - An optional abort signal.
484
- * @returns {TwapCancelResponseSuccess} Successful variant of {@link TwapCancelResponse} without error status.
707
+ * @returns Successful variant of {@link TwapCancelResponse} without error status.
485
708
  * @throws {ApiRequestError} When the API returns an error response.
486
709
  *
487
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order | Hyperliquid GitBook}
710
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
488
711
  * @example
489
712
  * ```ts
490
713
  * import * as hl from "@nktkas/hyperliquid";
@@ -505,10 +728,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
505
728
  * Place a TWAP order.
506
729
  * @param args - The parameters for the request.
507
730
  * @param signal - An optional abort signal.
508
- * @returns {TwapOrderResponseSuccess} Successful variant of {@link TwapOrderResponse} without error status.
731
+ * @returns Successful variant of {@link TwapOrderResponse} without error status.
509
732
  * @throws {ApiRequestError} When the API returns an error response.
510
733
  *
511
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order | Hyperliquid GitBook}
734
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
512
735
  * @example
513
736
  * ```ts
514
737
  * import * as hl from "@nktkas/hyperliquid";
@@ -533,10 +756,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
533
756
  * Update isolated margin for a position.
534
757
  * @param args - The parameters for the request.
535
758
  * @param signal - An optional abort signal.
536
- * @returns {SuccessResponse} Successful response without specific data.
759
+ * @returns Successful response without specific data.
537
760
  * @throws {ApiRequestError} When the API returns an error response.
538
761
  *
539
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin | Hyperliquid GitBook}
762
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
540
763
  * @example
541
764
  * ```ts
542
765
  * import * as hl from "@nktkas/hyperliquid";
@@ -549,7 +772,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
549
772
  * const result = await client.updateIsolatedMargin({
550
773
  * asset: 0,
551
774
  * isBuy: true, // Add to long position
552
- * ntli: 1000, // Add 1000 USD margin (integer only)
775
+ * ntli: 1, // Add 1 USD margin (integer only)
553
776
  * });
554
777
  * ```
555
778
  */
@@ -558,10 +781,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
558
781
  * Update leverage for cross or isolated margin.
559
782
  * @param args - The parameters for the request.
560
783
  * @param signal - An optional abort signal.
561
- * @returns {SuccessResponse} Successful response without specific data.
784
+ * @returns Successful response without specific data.
562
785
  * @throws {ApiRequestError} When the API returns an error response.
563
786
  *
564
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage | Hyperliquid GitBook}
787
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
565
788
  * @example
566
789
  * ```ts
567
790
  * import * as hl from "@nktkas/hyperliquid";
@@ -583,10 +806,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
583
806
  * Transfer funds between Spot and Perp accounts.
584
807
  * @param args - The parameters for the request.
585
808
  * @param signal - An optional abort signal.
586
- * @returns {SuccessResponse} Successful response without specific data.
809
+ * @returns Successful response without specific data.
587
810
  * @throws {ApiRequestError} When the API returns an error response.
588
811
  *
589
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa | Hyperliquid GitBook}
812
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
590
813
  * @example
591
814
  * ```ts
592
815
  * import * as hl from "@nktkas/hyperliquid";
@@ -597,7 +820,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
597
820
  * const client = new hl.WalletClient({ wallet, transport });
598
821
  *
599
822
  * const result = await client.usdClassTransfer({
600
- * amount: "1000",
823
+ * amount: "1",
601
824
  * toPerp: true, // Transfer from Spot to Perp
602
825
  * });
603
826
  * ```
@@ -607,10 +830,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
607
830
  * Transfer USDC on L1 to another address.
608
831
  * @param args - The parameters for the request.
609
832
  * @param signal - An optional abort signal.
610
- * @returns {SuccessResponse} Successful response without specific data.
833
+ * @returns Successful response without specific data.
611
834
  * @throws {ApiRequestError} When the API returns an error response.
612
835
  *
613
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer | Hyperliquid GitBook}
836
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer
614
837
  * @example
615
838
  * ```ts
616
839
  * import * as hl from "@nktkas/hyperliquid";
@@ -622,19 +845,68 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
622
845
  *
623
846
  * const result = await client.usdSend({
624
847
  * destination: "0x...",
625
- * amount: "1000",
848
+ * amount: "1",
626
849
  * });
627
850
  * ```
628
851
  */
629
852
  usdSend(args: UsdSendParameters, signal?: AbortSignal): Promise<SuccessResponse>;
630
853
  /**
631
- * Transfer funds to/from a vault.
854
+ * Distribute funds from a vault between followers.
632
855
  * @param args - The parameters for the request.
633
856
  * @param signal - An optional abort signal.
634
- * @returns {SuccessResponse} Successful response without specific data.
857
+ * @returns Successful response without specific data.
635
858
  * @throws {ApiRequestError} When the API returns an error response.
636
859
  *
637
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault | Hyperliquid GitBook}
860
+ * @see null - no documentation
861
+ * @example
862
+ * ```ts
863
+ * import * as hl from "@nktkas/hyperliquid";
864
+ * import { privateKeyToAccount } from "viem/accounts";
865
+ *
866
+ * const wallet = privateKeyToAccount("0x...");
867
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
868
+ * const client = new hl.WalletClient({ wallet, transport });
869
+ *
870
+ * const result = await client.vaultDistribute({
871
+ * vaultAddress: "0x...",
872
+ * usd: 10 * 1e6,
873
+ * });
874
+ * ```
875
+ */
876
+ vaultDistribute(args: VaultDistributeParameters, signal?: AbortSignal): Promise<SuccessResponse>;
877
+ /**
878
+ * Modify a vault's configuration.
879
+ * @param args - The parameters for the request.
880
+ * @param signal - An optional abort signal.
881
+ * @returns Successful response without specific data.
882
+ * @throws {ApiRequestError} When the API returns an error response.
883
+ *
884
+ * @see null - no documentation
885
+ * @example
886
+ * ```ts
887
+ * import * as hl from "@nktkas/hyperliquid";
888
+ * import { privateKeyToAccount } from "viem/accounts";
889
+ *
890
+ * const wallet = privateKeyToAccount("0x...");
891
+ * const transport = new hl.HttpTransport(); // or WebSocketTransport
892
+ * const client = new hl.WalletClient({ wallet, transport });
893
+ *
894
+ * const result = await client.vaultModify({
895
+ * vaultAddress: "0x...",
896
+ * allowDeposits: true,
897
+ * alwaysCloseOnWithdraw: false,
898
+ * });
899
+ * ```
900
+ */
901
+ vaultModify(args: VaultModifyParameters, signal?: AbortSignal): Promise<SuccessResponse>;
902
+ /**
903
+ * Add or remove funds from a vault.
904
+ * @param args - The parameters for the request.
905
+ * @param signal - An optional abort signal.
906
+ * @returns Successful response without specific data.
907
+ * @throws {ApiRequestError} When the API returns an error response.
908
+ *
909
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
638
910
  * @example
639
911
  * ```ts
640
912
  * import * as hl from "@nktkas/hyperliquid";
@@ -647,7 +919,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
647
919
  * const result = await client.vaultTransfer({
648
920
  * vaultAddress: "0x...",
649
921
  * isDeposit: true,
650
- * usd: 1000000, // 1 USD in raw units (float amount * 1e6)
922
+ * usd: 10 * 1e6,
651
923
  * });
652
924
  * ```
653
925
  */
@@ -656,10 +928,10 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
656
928
  * Initiate a withdrawal request.
657
929
  * @param args - The parameters for the request.
658
930
  * @param signal - An optional abort signal.
659
- * @returns {SuccessResponse} Successful response without specific data.
931
+ * @returns Successful response without specific data.
660
932
  * @throws {ApiRequestError} When the API returns an error response.
661
933
  *
662
- * @see {@link https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request | Hyperliquid GitBook}
934
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
663
935
  * @example
664
936
  * ```ts
665
937
  * import * as hl from "@nktkas/hyperliquid";
@@ -671,7 +943,7 @@ export declare class WalletClient<T extends IRequestTransport = IRequestTranspor
671
943
  *
672
944
  * const result = await client.withdraw3({
673
945
  * destination: "0x...",
674
- * amount: "1000",
946
+ * amount: "1",
675
947
  * });
676
948
  * ```
677
949
  */