@nktkas/hyperliquid 0.22.1 → 0.23.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 (230) hide show
  1. package/README.md +125 -70
  2. package/esm/mod.d.ts +1 -1
  3. package/esm/mod.d.ts.map +1 -1
  4. package/esm/src/base.d.ts +4 -1
  5. package/esm/src/base.d.ts.map +1 -1
  6. package/esm/src/base.js +2 -2
  7. package/esm/src/clients/exchange.d.ts +420 -368
  8. package/esm/src/clients/exchange.d.ts.map +1 -1
  9. package/esm/src/clients/exchange.js +721 -551
  10. package/esm/src/clients/info.d.ts +137 -41
  11. package/esm/src/clients/info.d.ts.map +1 -1
  12. package/esm/src/clients/info.js +124 -28
  13. package/esm/src/clients/multiSign.d.ts +406 -484
  14. package/esm/src/clients/multiSign.d.ts.map +1 -1
  15. package/esm/src/clients/multiSign.js +639 -734
  16. package/esm/src/clients/subscription.d.ts +38 -3
  17. package/esm/src/clients/subscription.d.ts.map +1 -1
  18. package/esm/src/clients/subscription.js +36 -3
  19. package/esm/src/signing/_signTypedData/ethers.d.ts +33 -0
  20. package/esm/src/signing/_signTypedData/ethers.d.ts.map +1 -0
  21. package/esm/src/signing/_signTypedData/ethers.js +12 -0
  22. package/esm/src/signing/_signTypedData/mod.d.ts +35 -0
  23. package/esm/src/signing/_signTypedData/mod.d.ts.map +1 -0
  24. package/esm/src/signing/_signTypedData/mod.js +59 -0
  25. package/esm/src/signing/_signTypedData/private_key.d.ts +26 -0
  26. package/esm/src/signing/_signTypedData/private_key.d.ts.map +1 -0
  27. package/esm/src/signing/_signTypedData/private_key.js +144 -0
  28. package/esm/src/signing/_signTypedData/viem.d.ts +23 -0
  29. package/esm/src/signing/_signTypedData/viem.d.ts.map +1 -0
  30. package/esm/src/signing/_signTypedData/viem.js +6 -0
  31. package/esm/src/signing/_signTypedData/window.d.ts +29 -0
  32. package/esm/src/signing/_signTypedData/window.d.ts.map +1 -0
  33. package/esm/src/signing/_signTypedData/window.js +30 -0
  34. package/esm/src/signing/_sorter.d.ts +128 -0
  35. package/esm/src/signing/_sorter.d.ts.map +1 -0
  36. package/esm/src/{signing.js → signing/_sorter.js} +36 -449
  37. package/esm/src/signing/mod.d.ts +272 -0
  38. package/esm/src/signing/mod.d.ts.map +1 -0
  39. package/esm/src/signing/mod.js +306 -0
  40. package/esm/src/transports/base.d.ts +1 -1
  41. package/esm/src/transports/base.d.ts.map +1 -1
  42. package/esm/src/transports/base.js +2 -2
  43. package/esm/src/transports/http/http_transport.d.ts +9 -15
  44. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  45. package/esm/src/transports/http/http_transport.js +64 -59
  46. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +1 -1
  47. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  48. package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -1
  49. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  50. package/esm/src/transports/websocket/_reconnecting_websocket.js +17 -4
  51. package/esm/src/transports/websocket/_websocket_async_request.d.ts +0 -9
  52. package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
  53. package/esm/src/transports/websocket/_websocket_async_request.js +14 -20
  54. package/esm/src/transports/websocket/websocket_transport.d.ts +8 -4
  55. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  56. package/esm/src/transports/websocket/websocket_transport.js +83 -54
  57. package/esm/src/types/exchange/requests.d.ts +27 -51
  58. package/esm/src/types/exchange/requests.d.ts.map +1 -1
  59. package/esm/src/types/explorer/requests.d.ts +5 -8
  60. package/esm/src/types/explorer/requests.d.ts.map +1 -1
  61. package/esm/src/types/info/accounts.d.ts +5 -5
  62. package/esm/src/types/info/accounts.d.ts.map +1 -1
  63. package/esm/src/types/info/delegations.d.ts +1 -1
  64. package/esm/src/types/info/delegations.d.ts.map +1 -1
  65. package/esm/src/types/info/orders.d.ts +1 -1
  66. package/esm/src/types/info/orders.d.ts.map +1 -1
  67. package/esm/src/types/info/requests.d.ts +49 -96
  68. package/esm/src/types/info/requests.d.ts.map +1 -1
  69. package/esm/src/types/subscriptions/requests.d.ts +72 -18
  70. package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
  71. package/esm/src/types/subscriptions/responses.d.ts +2 -0
  72. package/esm/src/types/subscriptions/responses.d.ts.map +1 -1
  73. package/package.json +12 -8
  74. package/script/mod.d.ts +1 -1
  75. package/script/mod.d.ts.map +1 -1
  76. package/script/mod.js +13 -23
  77. package/script/src/base.d.ts +4 -1
  78. package/script/src/base.d.ts.map +1 -1
  79. package/script/src/base.js +10 -20
  80. package/script/src/clients/exchange.d.ts +420 -368
  81. package/script/src/clients/exchange.d.ts.map +1 -1
  82. package/script/src/clients/exchange.js +2000 -1840
  83. package/script/src/clients/info.d.ts +137 -41
  84. package/script/src/clients/info.d.ts.map +1 -1
  85. package/script/src/clients/info.js +1296 -1210
  86. package/script/src/clients/multiSign.d.ts +406 -484
  87. package/script/src/clients/multiSign.d.ts.map +1 -1
  88. package/script/src/clients/multiSign.js +2043 -2148
  89. package/script/src/clients/subscription.d.ts +38 -3
  90. package/script/src/clients/subscription.d.ts.map +1 -1
  91. package/script/src/clients/subscription.js +568 -545
  92. package/script/src/signing/_signTypedData/ethers.d.ts +33 -0
  93. package/script/src/signing/_signTypedData/ethers.d.ts.map +1 -0
  94. package/script/src/signing/_signTypedData/ethers.js +16 -0
  95. package/script/src/signing/_signTypedData/mod.d.ts +35 -0
  96. package/script/src/signing/_signTypedData/mod.d.ts.map +1 -0
  97. package/script/src/signing/_signTypedData/mod.js +67 -0
  98. package/script/src/signing/_signTypedData/private_key.d.ts +26 -0
  99. package/script/src/signing/_signTypedData/private_key.d.ts.map +1 -0
  100. package/script/src/signing/_signTypedData/private_key.js +148 -0
  101. package/script/src/signing/_signTypedData/viem.d.ts +23 -0
  102. package/script/src/signing/_signTypedData/viem.d.ts.map +1 -0
  103. package/script/src/signing/_signTypedData/viem.js +9 -0
  104. package/script/src/signing/_signTypedData/window.d.ts +29 -0
  105. package/script/src/signing/_signTypedData/window.d.ts.map +1 -0
  106. package/script/src/signing/_signTypedData/window.js +34 -0
  107. package/script/src/signing/_sorter.d.ts +128 -0
  108. package/script/src/signing/_sorter.d.ts.map +1 -0
  109. package/script/src/signing/_sorter.js +698 -0
  110. package/script/src/signing/mod.d.ts +272 -0
  111. package/script/src/signing/mod.d.ts.map +1 -0
  112. package/script/src/signing/mod.js +331 -0
  113. package/script/src/transports/base.d.ts +1 -1
  114. package/script/src/transports/base.d.ts.map +1 -1
  115. package/script/src/transports/base.js +11 -21
  116. package/script/src/transports/http/http_transport.d.ts +9 -15
  117. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  118. package/script/src/transports/http/http_transport.js +97 -102
  119. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +1 -1
  120. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  121. package/script/src/transports/websocket/_hyperliquid_event_target.js +51 -61
  122. package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  123. package/script/src/transports/websocket/_reconnecting_websocket.js +271 -268
  124. package/script/src/transports/websocket/_websocket_async_request.d.ts +0 -9
  125. package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
  126. package/script/src/transports/websocket/_websocket_async_request.js +157 -174
  127. package/script/src/transports/websocket/websocket_transport.d.ts +8 -4
  128. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  129. package/script/src/transports/websocket/websocket_transport.js +209 -189
  130. package/script/src/types/exchange/requests.d.ts +27 -51
  131. package/script/src/types/exchange/requests.d.ts.map +1 -1
  132. package/script/src/types/exchange/requests.js +2 -12
  133. package/script/src/types/exchange/responses.js +2 -12
  134. package/script/src/types/explorer/requests.d.ts +5 -8
  135. package/script/src/types/explorer/requests.d.ts.map +1 -1
  136. package/script/src/types/explorer/requests.js +2 -12
  137. package/script/src/types/explorer/responses.js +2 -12
  138. package/script/src/types/info/accounts.d.ts +5 -5
  139. package/script/src/types/info/accounts.d.ts.map +1 -1
  140. package/script/src/types/info/accounts.js +2 -12
  141. package/script/src/types/info/assets.js +2 -12
  142. package/script/src/types/info/delegations.d.ts +1 -1
  143. package/script/src/types/info/delegations.d.ts.map +1 -1
  144. package/script/src/types/info/delegations.js +2 -12
  145. package/script/src/types/info/markets.js +2 -12
  146. package/script/src/types/info/orders.d.ts +1 -1
  147. package/script/src/types/info/orders.d.ts.map +1 -1
  148. package/script/src/types/info/orders.js +2 -12
  149. package/script/src/types/info/requests.d.ts +49 -96
  150. package/script/src/types/info/requests.d.ts.map +1 -1
  151. package/script/src/types/info/requests.js +2 -12
  152. package/script/src/types/info/vaults.js +2 -12
  153. package/script/src/types/mod.js +2 -12
  154. package/script/src/types/subscriptions/requests.d.ts +72 -18
  155. package/script/src/types/subscriptions/requests.d.ts.map +1 -1
  156. package/script/src/types/subscriptions/requests.js +2 -12
  157. package/script/src/types/subscriptions/responses.d.ts +2 -0
  158. package/script/src/types/subscriptions/responses.d.ts.map +1 -1
  159. package/script/src/types/subscriptions/responses.js +2 -12
  160. package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts +0 -2
  161. package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts.map +0 -1
  162. package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +0 -1
  163. package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts +0 -95
  164. package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts.map +0 -1
  165. package/esm/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +0 -10
  166. package/esm/deps/jsr.io/@std/async/1.0.13/delay.d.ts +0 -43
  167. package/esm/deps/jsr.io/@std/async/1.0.13/delay.d.ts.map +0 -1
  168. package/esm/deps/jsr.io/@std/async/1.0.13/delay.js +0 -63
  169. package/esm/deps/jsr.io/@std/bytes/1.0.6/_types.d.ts +0 -9
  170. package/esm/deps/jsr.io/@std/bytes/1.0.6/_types.d.ts.map +0 -1
  171. package/esm/deps/jsr.io/@std/bytes/1.0.6/_types.js +0 -2
  172. package/esm/deps/jsr.io/@std/bytes/1.0.6/concat.d.ts +0 -21
  173. package/esm/deps/jsr.io/@std/bytes/1.0.6/concat.d.ts.map +0 -1
  174. package/esm/deps/jsr.io/@std/bytes/1.0.6/concat.js +0 -32
  175. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +0 -23
  176. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +0 -1
  177. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.js +0 -51
  178. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +0 -4
  179. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +0 -1
  180. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +0 -13
  181. package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +0 -9
  182. package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +0 -1
  183. package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.js +0 -2
  184. package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +0 -39
  185. package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +0 -1
  186. package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.js +0 -87
  187. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +0 -9
  188. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +0 -1
  189. package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.js +0 -2
  190. package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts +0 -39
  191. package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +0 -1
  192. package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.js +0 -237
  193. package/esm/src/signing.d.ts +0 -463
  194. package/esm/src/signing.d.ts.map +0 -1
  195. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts +0 -2
  196. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.d.ts.map +0 -1
  197. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +0 -27
  198. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts +0 -95
  199. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.d.ts.map +0 -1
  200. package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +0 -24
  201. package/script/deps/jsr.io/@std/async/1.0.13/delay.d.ts +0 -43
  202. package/script/deps/jsr.io/@std/async/1.0.13/delay.d.ts.map +0 -1
  203. package/script/deps/jsr.io/@std/async/1.0.13/delay.js +0 -76
  204. package/script/deps/jsr.io/@std/bytes/1.0.6/_types.d.ts +0 -9
  205. package/script/deps/jsr.io/@std/bytes/1.0.6/_types.d.ts.map +0 -1
  206. package/script/deps/jsr.io/@std/bytes/1.0.6/_types.js +0 -13
  207. package/script/deps/jsr.io/@std/bytes/1.0.6/concat.d.ts +0 -21
  208. package/script/deps/jsr.io/@std/bytes/1.0.6/concat.d.ts.map +0 -1
  209. package/script/deps/jsr.io/@std/bytes/1.0.6/concat.js +0 -45
  210. package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +0 -23
  211. package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +0 -1
  212. package/script/deps/jsr.io/@std/encoding/1.0.10/_common16.js +0 -67
  213. package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +0 -4
  214. package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +0 -1
  215. package/script/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +0 -26
  216. package/script/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +0 -9
  217. package/script/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +0 -1
  218. package/script/deps/jsr.io/@std/encoding/1.0.10/_types.js +0 -13
  219. package/script/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +0 -39
  220. package/script/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +0 -1
  221. package/script/deps/jsr.io/@std/encoding/1.0.10/hex.js +0 -101
  222. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +0 -9
  223. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +0 -1
  224. package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.js +0 -13
  225. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts +0 -39
  226. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +0 -1
  227. package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.js +0 -250
  228. package/script/src/signing.d.ts +0 -463
  229. package/script/src/signing.d.ts.map +0 -1
  230. package/script/src/signing.js +0 -1129
@@ -1,8 +1,8 @@
1
- import { type Hex, HyperliquidError, type MaybePromise } from "../base.js";
1
+ import { type DeepImmutable, type Hex, HyperliquidError, type MaybePromise } from "../base.js";
2
2
  import type { IRequestTransport } from "../transports/base.js";
3
- import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BaseExchangeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ConvertToMultiSigUserRequest_Signers, CreateSubAccountRequest, CreateVaultRequest, CSignerActionRequest_JailSelf, CSignerActionRequest_UnjailSelf, CValidatorActionRequest_ChangeProfile, CValidatorActionRequest_Register, CValidatorActionRequest_Unregister, CWithdrawRequest, EvmUserModifyRequest, ModifyRequest, MultiSigRequest, OrderRequest, PerpDeployRequest_RegisterAsset, PerpDeployRequest_SetOracle, PerpDexClassTransferRequest, RegisterReferrerRequest, ReserveRequestWeightRequest, ScheduleCancelRequest, SetDisplayNameRequest, SetReferrerRequest, SpotDeployRequest_Genesis, SpotDeployRequest_RegisterHyperliquidity, SpotDeployRequest_RegisterSpot, SpotDeployRequest_RegisterToken2, SpotDeployRequest_SetDeployerTradingFeeShare, SpotDeployRequest_UserGenesis, SpotSendRequest, SpotUserRequest, SubAccountSpotTransferRequest, SubAccountTransferRequest, TokenDelegateRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultDistributeRequest, VaultModifyRequest, VaultTransferRequest, Withdraw3Request } from "../types/exchange/requests.js";
3
+ import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ConvertToMultiSigUserRequest_Signers, CreateSubAccountRequest, CreateVaultRequest, CSignerActionRequest_JailSelf, CSignerActionRequest_UnjailSelf, CValidatorActionRequest_ChangeProfile, CValidatorActionRequest_Register, CValidatorActionRequest_Unregister, CWithdrawRequest, EvmUserModifyRequest, ModifyRequest, MultiSigRequest, OrderRequest, PerpDeployRequest_RegisterAsset, PerpDeployRequest_SetOracle, PerpDexClassTransferRequest, PerpDexTransferRequest, RegisterReferrerRequest, ReserveRequestWeightRequest, ScheduleCancelRequest, SetDisplayNameRequest, SetReferrerRequest, SpotDeployRequest_Genesis, SpotDeployRequest_RegisterHyperliquidity, SpotDeployRequest_RegisterSpot, SpotDeployRequest_RegisterToken2, SpotDeployRequest_SetDeployerTradingFeeShare, SpotDeployRequest_UserGenesis, SpotSendRequest, SpotUserRequest, SubAccountSpotTransferRequest, SubAccountTransferRequest, TokenDelegateRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultDistributeRequest, VaultModifyRequest, VaultTransferRequest, Withdraw3Request } from "../types/exchange/requests.js";
4
4
  import type { CancelResponse, CreateSubAccountResponse, CreateVaultResponse, ErrorResponse, OrderResponse, SuccessResponse, TwapCancelResponse, TwapOrderResponse } from "../types/exchange/responses.js";
5
- import { type AbstractWallet } from "../signing.js";
5
+ import { type AbstractWallet } from "../signing/mod.js";
6
6
  /** Parameters for the {@linkcode ExchangeClient} constructor. */
7
7
  export interface ExchangeClientParameters<T extends IRequestTransport = IRequestTransport, W extends AbstractWallet = AbstractWallet> {
8
8
  /** The transport used to connect to the Hyperliquid API. */
@@ -46,7 +46,7 @@ export type CancelByCloidParameters = Omit<CancelByCloidRequest["action"], "type
46
46
  /** Parameters for the {@linkcode ExchangeClient.cDeposit} method. */
47
47
  export type CDepositParameters = Omit<CDepositRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
48
48
  /** Parameters for the {@linkcode ExchangeClient.convertToMultiSigUser} method. */
49
- export type ConvertToMultiSigUserParameters = NonNullable<ConvertToMultiSigUserRequest_Signers>;
49
+ export type ConvertToMultiSigUserParameters = ConvertToMultiSigUserRequest_Signers;
50
50
  /** Parameters for the {@linkcode ExchangeClient.createSubAccount} method. */
51
51
  export type CreateSubAccountParameters = Omit<CreateSubAccountRequest["action"], "type">;
52
52
  /** Parameters for the {@linkcode ExchangeClient.createVault} method. */
@@ -86,6 +86,8 @@ export type PerpDeployParameters_RegisterAsset = Omit<PerpDeployRequest_Register
86
86
  export type PerpDeployParameters_SetOracle = Omit<PerpDeployRequest_SetOracle["action"], "type">;
87
87
  /** Parameters for the {@linkcode ExchangeClient.perpDexClassTransfer} method. */
88
88
  export type PerpDexClassTransferParameters = Omit<PerpDexClassTransferRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
89
+ /** Parameters for the {@linkcode ExchangeClient.perpDexTransfer} method. */
90
+ export type PerpDexTransferParameters = Omit<PerpDexTransferRequest["action"], "type" | "hyperliquidChain" | "signatureChainId" | "nonce">;
89
91
  /** Parameters for the {@linkcode ExchangeClient.registerReferrer} method. */
90
92
  export type RegisterReferrerParameters = Omit<RegisterReferrerRequest["action"], "type">;
91
93
  /** Parameters for the {@linkcode ExchangeClient.reserveRequestWeight} method. */
@@ -202,46 +204,58 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
202
204
  * Initialises a new instance.
203
205
  * @param args - The parameters for the client.
204
206
  *
205
- * @example Private key via [viem](https://viem.sh/docs/clients/wallet#local-accounts-private-key-mnemonic-etc)
207
+ * @example Private key directly
208
+ * ```ts
209
+ * import * as hl from "@nktkas/hyperliquid";
210
+ *
211
+ * const privateKey = "0x...";
212
+ *
213
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
214
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
215
+ * ```
216
+ *
217
+ * @example [Viem](https://viem.sh/docs/clients/wallet#local-accounts-private-key-mnemonic-etc)
206
218
  * ```ts
207
219
  * import * as hl from "@nktkas/hyperliquid";
208
220
  * import { privateKeyToAccount } from "viem/accounts";
209
221
  *
210
- * const wallet = privateKeyToAccount("0x...");
222
+ * const account = privateKeyToAccount("0x...");
211
223
  *
212
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
213
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
224
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
225
+ * const exchClient = new hl.ExchangeClient({ wallet: account, transport });
214
226
  * ```
215
227
  *
216
- * @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)
228
+ * @example [ethers.js](https://docs.ethers.org/v6/api/wallet/#Wallet) or [ethers.js v5](https://docs.ethers.org/v5/api/signer/#Wallet)
217
229
  * ```ts
218
230
  * import * as hl from "@nktkas/hyperliquid";
219
231
  * import { ethers } from "ethers";
220
232
  *
221
233
  * const wallet = new ethers.Wallet("0x...");
222
234
  *
223
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
235
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
224
236
  * const exchClient = new hl.ExchangeClient({ wallet, transport });
225
237
  * ```
226
238
  *
227
- * @example External wallet (e.g. MetaMask) via [viem](https://viem.sh/docs/clients/wallet#optional-hoist-the-account)
239
+ * @example External wallet (e.g. MetaMask) via [viem](https://viem.sh/docs/clients/wallet)
228
240
  * ```ts
229
241
  * import * as hl from "@nktkas/hyperliquid";
230
242
  * import { createWalletClient, custom } from "viem";
231
243
  *
232
- * const [account] = await window.ethereum.request({ method: "eth_requestAccounts" });
233
- * const wallet = createWalletClient({ account, transport: custom(window.ethereum) });
244
+ * const ethereum = (window as any).ethereum;
245
+ * const [account] = await ethereum.request({ method: "eth_requestAccounts" });
246
+ * const wallet = createWalletClient({ account, transport: custom(ethereum) });
234
247
  *
235
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
248
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
236
249
  * const exchClient = new hl.ExchangeClient({ wallet, transport });
237
250
  * ```
238
251
  *
239
- * @example External wallet (e.g. MetaMask) via `window.ethereum` directly
252
+ * @example External wallet (e.g. MetaMask) via [`window.ethereum`](https://eips.ethereum.org/EIPS/eip-1193)
240
253
  * ```ts
241
254
  * import * as hl from "@nktkas/hyperliquid";
242
255
  *
243
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
244
- * const exchClient = new hl.ExchangeClient({ wallet: window.ethereum, transport });
256
+ * const ethereum = (window as any).ethereum;
257
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
258
+ * const exchClient = new hl.ExchangeClient({ wallet: ethereum, transport });
245
259
  * ```
246
260
  */
247
261
  constructor(args: ExchangeClientParameters<T, W>);
@@ -250,103 +264,103 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
250
264
  * @param args - The parameters for the request.
251
265
  * @param signal - An optional abort signal
252
266
  * @returns Successful response without specific data.
253
- * @throws {ApiRequestError} When the API returns an error response.
267
+ *
268
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
269
+ * @throws {TransportError} When the transport layer throws an error.
254
270
  *
255
271
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
256
272
  * @example
257
273
  * ```ts
258
274
  * import * as hl from "@nktkas/hyperliquid";
259
- * import { privateKeyToAccount } from "viem/accounts";
260
275
  *
261
- * const wallet = privateKeyToAccount("0x...");
262
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
263
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
276
+ * const privateKey = "0x..."; // or `viem`, `ethers`
277
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
278
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
264
279
  *
265
- * const data = await exchClient.approveAgent({ agentAddress: "0x...", agentName: "agentName" });
280
+ * await exchClient.approveAgent({ agentAddress: "0x...", agentName: "..." });
266
281
  * ```
267
282
  */
268
- approveAgent(args: ApproveAgentParameters, signal?: AbortSignal): Promise<SuccessResponse>;
283
+ approveAgent(args: DeepImmutable<ApproveAgentParameters>, signal?: AbortSignal): Promise<SuccessResponse>;
269
284
  /**
270
285
  * Approve a maximum fee rate for a builder.
271
286
  * @param args - The parameters for the request.
272
287
  * @param signal - An optional abort signal.
273
288
  * @returns Successful response without specific data.
274
- * @throws {ApiRequestError} When the API returns an error response.
289
+ *
290
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
291
+ * @throws {TransportError} When the transport layer throws an error.
275
292
  *
276
293
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
277
294
  * @example
278
295
  * ```ts
279
296
  * import * as hl from "@nktkas/hyperliquid";
280
- * import { privateKeyToAccount } from "viem/accounts";
281
297
  *
282
- * const wallet = privateKeyToAccount("0x...");
283
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
284
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
298
+ * const privateKey = "0x..."; // or `viem`, `ethers`
299
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
300
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
285
301
  *
286
- * const data = await exchClient.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
302
+ * await exchClient.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
287
303
  * ```
288
304
  */
289
- approveBuilderFee(args: ApproveBuilderFeeParameters, signal?: AbortSignal): Promise<SuccessResponse>;
305
+ approveBuilderFee(args: DeepImmutable<ApproveBuilderFeeParameters>, signal?: AbortSignal): Promise<SuccessResponse>;
290
306
  /**
291
307
  * Modify multiple orders.
292
308
  * @param args - The parameters for the request.
293
309
  * @param signal - An optional abort signal.
294
310
  * @returns Successful variant of {@link OrderResponse} without error statuses.
295
- * @throws {ApiRequestError} When the API returns an error response.
311
+ *
312
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
313
+ * @throws {TransportError} When the transport layer throws an error.
296
314
  *
297
315
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
298
316
  * @example
299
317
  * ```ts
300
318
  * import * as hl from "@nktkas/hyperliquid";
301
- * import { privateKeyToAccount } from "viem/accounts";
302
319
  *
303
- * const wallet = privateKeyToAccount("0x...");
304
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
305
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
320
+ * const privateKey = "0x..."; // or `viem`, `ethers`
321
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
322
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
306
323
  *
307
324
  * const data = await exchClient.batchModify({
308
- * modifies: [{
309
- * oid: 123,
310
- * order: {
311
- * a: 0, // Asset index
312
- * b: true, // Buy order
313
- * p: "31000", // New price
314
- * s: "0.2", // New size
315
- * r: false, // Not reduce-only
316
- * t: {
317
- * limit: {
318
- * tif: "Gtc", // Good-til-cancelled
319
- * },
325
+ * modifies: [
326
+ * {
327
+ * oid: 123,
328
+ * order: {
329
+ * a: 0,
330
+ * b: true,
331
+ * p: "31000",
332
+ * s: "0.2",
333
+ * r: false,
334
+ * t: { limit: { tif: "Gtc" } },
320
335
  * },
321
- * c: "0x...", // Client Order ID (optional)
322
336
  * },
323
- * }],
337
+ * ],
324
338
  * });
325
339
  * ```
326
340
  */
327
- batchModify(args: BatchModifyParameters, signal?: AbortSignal): Promise<OrderResponseSuccess>;
341
+ batchModify(args: DeepImmutable<BatchModifyParameters>, signal?: AbortSignal): Promise<OrderResponseSuccess>;
328
342
  /**
329
343
  * Cancel order(s).
330
344
  * @param args - The parameters for the request.
331
345
  * @param signal - An optional abort signal.
332
346
  * @returns Successful variant of {@link CancelResponse} without error statuses.
333
- * @throws {ApiRequestError} When the API returns an error response.
347
+ *
348
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
349
+ * @throws {TransportError} When the transport layer throws an error.
334
350
  *
335
351
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
336
352
  * @example
337
353
  * ```ts
338
354
  * import * as hl from "@nktkas/hyperliquid";
339
- * import { privateKeyToAccount } from "viem/accounts";
340
355
  *
341
- * const wallet = privateKeyToAccount("0x...");
342
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
343
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
356
+ * const privateKey = "0x..."; // or `viem`, `ethers`
357
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
358
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
344
359
  *
345
360
  * const data = await exchClient.cancel({
346
- * cancels: [{
347
- * a: 0, // Asset index
348
- * o: 123, // Order ID
349
- * }],
361
+ * cancels: [
362
+ * { a: 0, o: 123 },
363
+ * ],
350
364
  * });
351
365
  * ```
352
366
  */
@@ -356,17 +370,18 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
356
370
  * @param args - The parameters for the request.
357
371
  * @param signal - An optional abort signal.
358
372
  * @returns Successful variant of {@link CancelResponse} without error statuses.
359
- * @throws {ApiRequestError} When the API returns an error response.
373
+ *
374
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
375
+ * @throws {TransportError} When the transport layer throws an error.
360
376
  *
361
377
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
362
378
  * @example
363
379
  * ```ts
364
380
  * import * as hl from "@nktkas/hyperliquid";
365
- * import { privateKeyToAccount } from "viem/accounts";
366
381
  *
367
- * const wallet = privateKeyToAccount("0x...");
368
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
369
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
382
+ * const privateKey = "0x..."; // or `viem`, `ethers`
383
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
384
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
370
385
  *
371
386
  * const data = await exchClient.cancelByCloid({
372
387
  * cancels: [
@@ -381,19 +396,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
381
396
  * @param args - The parameters for the request.
382
397
  * @param signal - An optional abort signal.
383
398
  * @returns Successful response without specific data.
384
- * @throws {ApiRequestError} When the API returns an error response.
399
+ *
400
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
401
+ * @throws {TransportError} When the transport layer throws an error.
385
402
  *
386
403
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
387
404
  * @example
388
405
  * ```ts
389
406
  * import * as hl from "@nktkas/hyperliquid";
390
- * import { privateKeyToAccount } from "viem/accounts";
391
407
  *
392
- * const wallet = privateKeyToAccount("0x...");
393
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
394
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
408
+ * const privateKey = "0x..."; // or `viem`, `ethers`
409
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
410
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
395
411
  *
396
- * const data = await exchClient.cDeposit({ wei: 1 * 1e8 });
412
+ * await exchClient.cDeposit({ wei: 1 * 1e8 });
397
413
  * ```
398
414
  */
399
415
  cDeposit(args: CDepositParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -402,19 +418,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
402
418
  * @param args - The parameters for the request.
403
419
  * @param signal - An optional abort signal.
404
420
  * @returns Successful response without specific data.
405
- * @throws {ApiRequestError} When the API returns an error response.
406
421
  *
407
- * @see null - no documentation
422
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
423
+ * @throws {TransportError} When the transport layer throws an error.
424
+ *
425
+ * @see null
408
426
  * @example
409
427
  * ```ts
410
428
  * import * as hl from "@nktkas/hyperliquid";
411
- * import { privateKeyToAccount } from "viem/accounts";
412
429
  *
413
- * const wallet = privateKeyToAccount("0x...");
414
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
415
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
430
+ * const privateKey = "0x..."; // or `viem`, `ethers`
431
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
432
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
416
433
  *
417
- * const data = await exchClient.claimRewards();
434
+ * await exchClient.claimRewards();
418
435
  * ```
419
436
  */
420
437
  claimRewards(signal?: AbortSignal): Promise<SuccessResponse>;
@@ -423,22 +440,27 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
423
440
  * @param args - The parameters for the request.
424
441
  * @param signal - An optional abort signal.
425
442
  * @returns Successful response without specific data.
426
- * @throws {ApiRequestError} When the API returns an error response.
443
+ *
444
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
445
+ * @throws {TransportError} When the transport layer throws an error.
427
446
  *
428
447
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
429
448
  * @example
430
449
  * ```ts
431
450
  * import * as hl from "@nktkas/hyperliquid";
432
- * import { privateKeyToAccount } from "viem/accounts";
433
451
  *
434
- * const wallet = privateKeyToAccount("0x...");
435
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
436
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
452
+ * const privateKey = "0x..."; // or `viem`, `ethers`
453
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
454
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
437
455
  *
438
- * const data = await exchClient.convertToMultiSigUser({ // convert to multi-sig user
456
+ * // Convert to multi-sig user
457
+ * await exchClient.convertToMultiSigUser({
439
458
  * authorizedUsers: ["0x...", "0x...", "0x..."],
440
459
  * threshold: 2,
441
460
  * });
461
+ *
462
+ * // Convert to single-sig user
463
+ * await exchClient.convertToMultiSigUser(null);
442
464
  * ```
443
465
  */
444
466
  convertToMultiSigUser(args: ConvertToMultiSigUserParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -447,19 +469,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
447
469
  * @param args - The parameters for the request.
448
470
  * @param signal - An optional abort signal.
449
471
  * @returns Response for creating a sub-account.
450
- * @throws {ApiRequestError} When the API returns an error response.
451
472
  *
452
- * @see null - no documentation
473
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
474
+ * @throws {TransportError} When the transport layer throws an error.
475
+ *
476
+ * @see null
453
477
  * @example
454
478
  * ```ts
455
479
  * import * as hl from "@nktkas/hyperliquid";
456
- * import { privateKeyToAccount } from "viem/accounts";
457
480
  *
458
- * const wallet = privateKeyToAccount("0x...");
459
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
460
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
481
+ * const privateKey = "0x..."; // or `viem`, `ethers`
482
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
483
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
461
484
  *
462
- * const data = await exchClient.createSubAccount({ name: "subAccountName" });
485
+ * const data = await exchClient.createSubAccount({ name: "..." });
463
486
  * ```
464
487
  */
465
488
  createSubAccount(args: CreateSubAccountParameters, signal?: AbortSignal): Promise<CreateSubAccountResponse>;
@@ -468,23 +491,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
468
491
  * @param args - The parameters for the request.
469
492
  * @param signal - An optional abort signal.
470
493
  * @returns Response for creating a vault.
471
- * @throws {ApiRequestError} When the API returns an error response.
472
494
  *
473
- * @see null - no documentation
495
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
496
+ * @throws {TransportError} When the transport layer throws an error.
497
+ *
498
+ * @see null
474
499
  * @example
475
500
  * ```ts
476
501
  * import * as hl from "@nktkas/hyperliquid";
477
- * import { privateKeyToAccount } from "viem/accounts";
478
502
  *
479
- * const wallet = privateKeyToAccount("0x...");
480
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
481
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
503
+ * const privateKey = "0x..."; // or `viem`, `ethers`
504
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
505
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
482
506
  *
483
- * const data = await exchClient.createVault({
484
- * name: "VaultName",
485
- * description: "Vault description",
486
- * initialUsd: 100 * 1e6,
487
- * });
507
+ * const data = await exchClient.createVault({ name: "...", description: "...", initialUsd: 100 * 1e6 });
488
508
  * ```
489
509
  */
490
510
  createVault(args: CreateVaultParameters, signal?: AbortSignal): Promise<CreateVaultResponse>;
@@ -493,74 +513,94 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
493
513
  * @param args - The parameters for the request.
494
514
  * @param signal - An optional abort signal.
495
515
  * @returns Successful response without specific data.
496
- * @throws {ApiRequestError} When the API returns an error response.
497
516
  *
498
- * @see null - no documentation
517
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
518
+ * @throws {TransportError} When the transport layer throws an error.
519
+ *
520
+ * @see null
499
521
  * @example
500
522
  * ```ts
501
523
  * import * as hl from "@nktkas/hyperliquid";
502
- * import { privateKeyToAccount } from "viem/accounts";
503
524
  *
504
- * const wallet = privateKeyToAccount("0x...");
505
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
506
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
525
+ * const privateKey = "0x..."; // or `viem`, `ethers`
526
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
527
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
507
528
  *
508
529
  * // Jail self
509
- * const data = await exchClient.cSignerAction({ jailSelf: null });
530
+ * await exchClient.cSignerAction({ jailSelf: null });
510
531
  *
511
532
  * // Unjail self
512
- * const data = await exchClient.cSignerAction({ unjailSelf: null });
533
+ * await exchClient.cSignerAction({ unjailSelf: null });
513
534
  * ```
514
535
  */
515
- cSignerAction(args: CSignerActionParameters_JailSelf, signal?: AbortSignal): Promise<SuccessResponse>;
516
- cSignerAction(args: CSignerActionParameters_UnjailSelf, signal?: AbortSignal): Promise<SuccessResponse>;
536
+ cSignerAction(args: CSignerActionParameters, signal?: AbortSignal): Promise<SuccessResponse>;
517
537
  /**
518
538
  * Action related to validator management.
519
539
  * @param args - The parameters for the request.
520
540
  * @param signal - An optional abort signal.
521
541
  * @returns Successful response without specific data.
522
- * @throws {ApiRequestError} When the API returns an error response.
523
542
  *
543
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
544
+ * @throws {TransportError} When the transport layer throws an error.
545
+ *
546
+ * @see null
524
547
  * @example
525
548
  * ```ts
526
549
  * import * as hl from "@nktkas/hyperliquid";
527
- * import { privateKeyToAccount } from "viem/accounts";
528
550
  *
529
- * const wallet = privateKeyToAccount("0x...");
530
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
531
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
551
+ * const privateKey = "0x..."; // or `viem`, `ethers`
552
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
553
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
532
554
  *
533
555
  * // Change validator profile
534
- * const data = await exchClient.cValidatorAction({
556
+ * await exchClient.cValidatorAction({
535
557
  * changeProfile: {
536
- * name: "My Validator",
537
- * description: "Validator description",
558
+ * name: "...",
559
+ * description: "...",
538
560
  * unjailed: true,
539
561
  * }
540
562
  * });
563
+ *
564
+ * // Register a new validator
565
+ * await exchClient.cValidatorAction({
566
+ * register: {
567
+ * profile: {
568
+ * node_ip: { Ip: "1.2.3.4" },
569
+ * name: "...",
570
+ * description: "...",
571
+ * delegations_disabled: true,
572
+ * commission_bps: 1,
573
+ * signer: "0x...",
574
+ * },
575
+ * unjailed: false,
576
+ * initial_wei: 1,
577
+ * },
578
+ * });
579
+ *
580
+ * // Unregister a validator
581
+ * await exchClient.cValidatorAction({ unregister: null });
541
582
  * ```
542
583
  */
543
- cValidatorAction(args: CValidatorActionParameters_ChangeProfile, signal?: AbortSignal): Promise<SuccessResponse>;
544
- cValidatorAction(args: CValidatorActionParameters_Register, signal?: AbortSignal): Promise<SuccessResponse>;
545
- cValidatorAction(args: CValidatorActionParameters_Unregister, signal?: AbortSignal): Promise<SuccessResponse>;
584
+ cValidatorAction(args: CValidatorActionParameters, signal?: AbortSignal): Promise<SuccessResponse>;
546
585
  /**
547
586
  * Transfer native token from staking into the user's spot account.
548
587
  * @param args - The parameters for the request.
549
588
  * @param signal - An optional abort signal.
550
589
  * @returns Successful response without specific data.
551
- * @throws {ApiRequestError} When the API returns an error response.
590
+ *
591
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
592
+ * @throws {TransportError} When the transport layer throws an error.
552
593
  *
553
594
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
554
595
  * @example
555
596
  * ```ts
556
597
  * import * as hl from "@nktkas/hyperliquid";
557
- * import { privateKeyToAccount } from "viem/accounts";
558
598
  *
559
- * const wallet = privateKeyToAccount("0x...");
560
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
561
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
599
+ * const privateKey = "0x..."; // or `viem`, `ethers`
600
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
601
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
562
602
  *
563
- * const data = await exchClient.cWithdraw({ wei: 1 * 1e8 });
603
+ * await exchClient.cWithdraw({ wei: 1 * 1e8 });
564
604
  * ```
565
605
  */
566
606
  cWithdraw(args: CWithdrawParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -569,17 +609,18 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
569
609
  * @param args - The parameters for the request.
570
610
  * @param signal - An optional abort signal.
571
611
  * @returns Response for creating a sub-account.
572
- * @throws {ApiRequestError} When the API returns an error response.
612
+ *
613
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
614
+ * @throws {TransportError} When the transport layer throws an error.
573
615
  *
574
616
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/evm/dual-block-architecture
575
617
  * @example
576
618
  * ```ts
577
619
  * import * as hl from "@nktkas/hyperliquid";
578
- * import { privateKeyToAccount } from "viem/accounts";
579
620
  *
580
- * const wallet = privateKeyToAccount("0x...");
581
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
582
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
621
+ * const privateKey = "0x..."; // or `viem`, `ethers`
622
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
623
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
583
624
  *
584
625
  * const data = await exchClient.evmUserModify({ usingBigBlocks: true });
585
626
  * ```
@@ -590,32 +631,29 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
590
631
  * @param args - The parameters for the request.
591
632
  * @param signal - An optional abort signal.
592
633
  * @returns Successful response without specific data.
593
- * @throws {ApiRequestError} When the API returns an error response.
634
+ *
635
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
636
+ * @throws {TransportError} When the transport layer throws an error.
594
637
  *
595
638
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
596
639
  * @example
597
640
  * ```ts
598
641
  * import * as hl from "@nktkas/hyperliquid";
599
- * import { privateKeyToAccount } from "viem/accounts";
600
642
  *
601
- * const wallet = privateKeyToAccount("0x...");
602
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
603
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
643
+ * const privateKey = "0x..."; // or `viem`, `ethers`
644
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
645
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
604
646
  *
605
- * const data = await exchClient.modify({
647
+ * await exchClient.modify({
606
648
  * oid: 123,
607
649
  * order: {
608
- * a: 0, // Asset index
609
- * b: true, // Buy order
610
- * p: "31000", // New price
611
- * s: "0.2", // New size
612
- * r: false, // Not reduce-only
613
- * t: {
614
- * limit: {
615
- * tif: "Gtc", // Good-til-cancelled
616
- * },
617
- * },
618
- * c: "0x...", // Client Order ID (optional)
650
+ * a: 0,
651
+ * b: true,
652
+ * p: "31000",
653
+ * s: "0.2",
654
+ * r: false,
655
+ * t: { limit: { tif: "Gtc" } },
656
+ * c: "0x...",
619
657
  * },
620
658
  * });
621
659
  * ```
@@ -625,29 +663,35 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
625
663
  * A multi-signature request.
626
664
  * @param args - The parameters for the request.
627
665
  * @param signal - An optional abort signal.
628
- * @returns Successful response without specific data.
629
- * @throws {ApiRequestError} When the API returns an error response.
666
+ * @returns Any successful response.
667
+ *
668
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
669
+ * @throws {TransportError} When the transport layer throws an error.
630
670
  *
631
671
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
632
672
  * @example
633
673
  * ```ts
634
674
  * import * as hl from "@nktkas/hyperliquid";
675
+ * import { actionSorter, signL1Action } from "@nktkas/hyperliquid/signing";
635
676
  * import { privateKeyToAccount } from "viem/accounts";
636
677
  *
637
- * const wallet = privateKeyToAccount("0x...");
638
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
639
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
678
+ * const wallet = privateKeyToAccount("0x..."); // or any other wallet libraries
679
+ * const multiSigUser = "0x...";
640
680
  *
641
- * const multiSigUser = "0x..."; // Multi-sig user address
681
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
682
+ * const exchClient = new hl.ExchangeClient({ wallet, transport });
642
683
  *
643
684
  * const nonce = Date.now();
644
- * const action = { type: "scheduleCancel", time: Date.now() + 10000 };
685
+ * const action = {
686
+ * type: "scheduleCancel",
687
+ * time: Date.now() + 10000,
688
+ * } as const;
645
689
  *
646
- * const signature = await hl.signL1Action({
690
+ * // Create the required number of signatures
691
+ * const signature = await signL1Action({
647
692
  * wallet,
648
- * action: [multiSigUser.toLowerCase(), signer1.address.toLowerCase(), action],
693
+ * action: [multiSigUser.toLowerCase(), wallet.address.toLowerCase(), actionSorter[action.type](action)],
649
694
  * nonce,
650
- * isTestnet: true,
651
695
  * });
652
696
  *
653
697
  * const data = await exchClient.multiSig({
@@ -667,33 +711,32 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
667
711
  * @param args - The parameters for the request.
668
712
  * @param signal - An optional abort signal.
669
713
  * @returns Successful variant of {@link OrderResponse} without error statuses.
670
- * @throws {ApiRequestError} When the API returns an error response.
714
+ *
715
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
716
+ * @throws {TransportError} When the transport layer throws an error.
671
717
  *
672
718
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
673
719
  * @example
674
720
  * ```ts
675
721
  * import * as hl from "@nktkas/hyperliquid";
676
- * import { privateKeyToAccount } from "viem/accounts";
677
722
  *
678
- * const wallet = privateKeyToAccount("0x...");
679
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
680
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
723
+ * const privateKey = "0x..."; // or `viem`, `ethers`
724
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
725
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
681
726
  *
682
727
  * const data = await exchClient.order({
683
- * orders: [{
684
- * a: 0, // Asset index
685
- * b: true, // Buy order
686
- * p: "30000", // Price
687
- * s: "0.1", // Size
688
- * r: false, // Not reduce-only
689
- * t: {
690
- * limit: {
691
- * tif: "Gtc", // Good-til-cancelled
692
- * },
728
+ * orders: [
729
+ * {
730
+ * a: 0,
731
+ * b: true,
732
+ * p: "30000",
733
+ * s: "0.1",
734
+ * r: false,
735
+ * t: { limit: { tif: "Gtc" } },
736
+ * c: "0x...",
693
737
  * },
694
- * c: "0x...", // Client Order ID (optional)
695
- * }],
696
- * grouping: "na", // No grouping
738
+ * ],
739
+ * grouping: "na",
697
740
  * });
698
741
  * ```
699
742
  */
@@ -703,19 +746,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
703
746
  * @param args - The parameters for the request.
704
747
  * @param signal - An optional abort signal.
705
748
  * @returns Successful response without specific data.
706
- * @throws {ApiRequestError} When the API returns an error response.
749
+ *
750
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
751
+ * @throws {TransportError} When the transport layer throws an error.
707
752
  *
708
753
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-3-assets
709
754
  * @example
710
755
  * ```ts
711
756
  * import * as hl from "@nktkas/hyperliquid";
712
- * import { privateKeyToAccount } from "viem/accounts";
713
757
  *
714
- * const wallet = privateKeyToAccount("0x...");
715
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
716
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
758
+ * const privateKey = "0x..."; // or `viem`, `ethers`
759
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
760
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
717
761
  *
718
- * const data = await exchClient.perpDeploy({
762
+ * await exchClient.perpDeploy({
719
763
  * registerAsset: {
720
764
  * maxGas: 1000000,
721
765
  * assetRequest: {
@@ -730,52 +774,70 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
730
774
  * });
731
775
  * ```
732
776
  */
733
- perpDeploy(args: PerpDeployParameters_RegisterAsset, signal?: AbortSignal): Promise<SuccessResponse>;
734
- perpDeploy(args: PerpDeployParameters_SetOracle, signal?: AbortSignal): Promise<SuccessResponse>;
777
+ perpDeploy(args: PerpDeployParameters, signal?: AbortSignal): Promise<SuccessResponse>;
735
778
  /**
736
779
  * Transfer funds between Spot account and Perp dex account.
737
780
  * @param args - The parameters for the request.
738
781
  * @param signal - An optional abort signal.
739
782
  * @returns Successful response without specific data.
740
- * @throws {ApiRequestError} When the API returns an error response.
783
+ *
784
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
785
+ * @throws {TransportError} When the transport layer throws an error.
741
786
  *
742
787
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
743
788
  * @example
744
789
  * ```ts
745
790
  * import * as hl from "@nktkas/hyperliquid";
746
- * import { privateKeyToAccount } from "viem/accounts";
747
791
  *
748
- * const wallet = privateKeyToAccount("0x...");
749
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
750
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
792
+ * const privateKey = "0x..."; // or `viem`, `ethers`
793
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
794
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
751
795
  *
752
- * const data = await exchClient.perpDexClassTransfer({
753
- * dex: "test",
754
- * token: "USDC",
755
- * amount: "1",
756
- * toPerp: true,
757
- * });
796
+ * await exchClient.perpDexClassTransfer({ dex: "test", token: "USDC", amount: "1", toPerp: true });
758
797
  * ```
759
798
  */
760
799
  perpDexClassTransfer(args: PerpDexClassTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
800
+ /**
801
+ * Transfer collateral tokens between different perp dexes for the same user.
802
+ * @param args - The parameters for the request.
803
+ * @param signal - An optional abort signal.
804
+ * @returns Successful response without specific data.
805
+ *
806
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
807
+ * @throws {TransportError} When the transport layer throws an error.
808
+ *
809
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-perp-account-to-perp-account-for-builder-deployed-dex
810
+ * @example
811
+ * ```ts
812
+ * import * as hl from "@nktkas/hyperliquid";
813
+ *
814
+ * const privateKey = "0x..."; // or `viem`, `ethers`
815
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
816
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
817
+ *
818
+ * await exchClient.perpDexTransfer({ sourceDex: "", destinationDex: "test", amount: "1" });
819
+ * ```
820
+ */
821
+ perpDexTransfer(args: PerpDexTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
761
822
  /**
762
823
  * Create a referral code.
763
824
  * @param args - The parameters for the request.
764
825
  * @param signal - An optional abort signal.
765
826
  * @returns Successful response without specific data.
766
- * @throws {ApiRequestError} When the API returns an error response.
767
827
  *
768
- * @see null - no documentation
828
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
829
+ * @throws {TransportError} When the transport layer throws an error.
830
+ *
831
+ * @see null
769
832
  * @example
770
833
  * ```ts
771
834
  * import * as hl from "@nktkas/hyperliquid";
772
- * import { privateKeyToAccount } from "viem/accounts";
773
835
  *
774
- * const wallet = privateKeyToAccount("0x...");
775
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
776
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
836
+ * const privateKey = "0x..."; // or `viem`, `ethers`
837
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
838
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
777
839
  *
778
- * const data = await exchClient.registerReferrer({ code: "TEST" });
840
+ * await exchClient.registerReferrer({ code: "..." });
779
841
  * ```
780
842
  */
781
843
  registerReferrer(args: RegisterReferrerParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -784,19 +846,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
784
846
  * @param args - The parameters for the request.
785
847
  * @param signal - An optional abort signal.
786
848
  * @returns Successful response without specific data.
787
- * @throws {ApiRequestError} When the API returns an error response.
849
+ *
850
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
851
+ * @throws {TransportError} When the transport layer throws an error.
788
852
  *
789
853
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#reserve-additional-actions
790
854
  * @example
791
855
  * ```ts
792
856
  * import * as hl from "@nktkas/hyperliquid";
793
- * import { privateKeyToAccount } from "viem/accounts";
794
857
  *
795
- * const wallet = privateKeyToAccount("0x...");
796
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
797
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
858
+ * const privateKey = "0x..."; // or `viem`, `ethers`
859
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
860
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
798
861
  *
799
- * const data = await exchClient.reserveRequestWeight({ weight: 10 });
862
+ * await exchClient.reserveRequestWeight({ weight: 10 });
800
863
  * ```
801
864
  */
802
865
  reserveRequestWeight(args: ReserveRequestWeightParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -805,19 +868,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
805
868
  * @param args - The parameters for the request.
806
869
  * @param signal - An optional abort signal.
807
870
  * @returns Successful response without specific data.
808
- * @throws {ApiRequestError} When the API returns an error response.
871
+ *
872
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
873
+ * @throws {TransportError} When the transport layer throws an error.
809
874
  *
810
875
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
811
876
  * @example
812
877
  * ```ts
813
878
  * import * as hl from "@nktkas/hyperliquid";
814
- * import { privateKeyToAccount } from "viem/accounts";
815
879
  *
816
- * const wallet = privateKeyToAccount("0x...");
817
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
818
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
880
+ * const privateKey = "0x..."; // or `viem`, `ethers`
881
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
882
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
819
883
  *
820
- * const data = await exchClient.scheduleCancel({ time: Date.now() + 3600000 });
884
+ * await exchClient.scheduleCancel({ time: Date.now() + 10_000 });
821
885
  * ```
822
886
  */
823
887
  scheduleCancel(args?: ScheduleCancelParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -827,19 +891,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
827
891
  * @param args - The parameters for the request.
828
892
  * @param signal - An optional abort signal.
829
893
  * @returns Successful response without specific data.
830
- * @throws {ApiRequestError} When the API returns an error response.
831
894
  *
832
- * @see null - no documentation
895
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
896
+ * @throws {TransportError} When the transport layer throws an error.
897
+ *
898
+ * @see null
833
899
  * @example
834
900
  * ```ts
835
901
  * import * as hl from "@nktkas/hyperliquid";
836
- * import { privateKeyToAccount } from "viem/accounts";
837
902
  *
838
- * const wallet = privateKeyToAccount("0x...");
839
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
840
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
903
+ * const privateKey = "0x..."; // or `viem`, `ethers`
904
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
905
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
841
906
  *
842
- * const data = await exchClient.setDisplayName({ displayName: "My Name" });
907
+ * await exchClient.setDisplayName({ displayName: "..." });
843
908
  * ```
844
909
  */
845
910
  setDisplayName(args: SetDisplayNameParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -848,19 +913,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
848
913
  * @param args - The parameters for the request.
849
914
  * @param signal - An optional abort signal.
850
915
  * @returns Successful response without specific data.
851
- * @throws {ApiRequestError} When the API returns an error response.
852
916
  *
853
- * @see null - no documentation
917
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
918
+ * @throws {TransportError} When the transport layer throws an error.
919
+ *
920
+ * @see null
854
921
  * @example
855
922
  * ```ts
856
923
  * import * as hl from "@nktkas/hyperliquid";
857
- * import { privateKeyToAccount } from "viem/accounts";
858
924
  *
859
- * const wallet = privateKeyToAccount("0x...");
860
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
861
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
925
+ * const privateKey = "0x..."; // or `viem`, `ethers`
926
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
927
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
862
928
  *
863
- * const data = await exchClient.setReferrer({ code: "TEST" });
929
+ * await exchClient.setReferrer({ code: "..." });
864
930
  * ```
865
931
  */
866
932
  setReferrer(args: SetReferrerParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -869,19 +935,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
869
935
  * @param args - The parameters for the request.
870
936
  * @param signal - An optional abort signal.
871
937
  * @returns Successful response without specific data.
872
- * @throws {ApiRequestError} When the API returns an error response.
938
+ *
939
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
940
+ * @throws {TransportError} When the transport layer throws an error.
873
941
  *
874
942
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
875
943
  * @example
876
944
  * ```ts
877
945
  * import * as hl from "@nktkas/hyperliquid";
878
- * import { privateKeyToAccount } from "viem/accounts";
879
946
  *
880
- * const wallet = privateKeyToAccount("0x...");
881
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
882
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
947
+ * const privateKey = "0x..."; // or `viem`, `ethers`
948
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
949
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
883
950
  *
884
- * const data = await exchClient.spotDeploy({
951
+ * await exchClient.spotDeploy({
885
952
  * registerToken2: {
886
953
  * spec: {
887
954
  * name: "USDC",
@@ -894,30 +961,26 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
894
961
  * });
895
962
  * ```
896
963
  */
897
- spotDeploy(args: SpotDeployParameters_Genesis, signal?: AbortSignal): Promise<SuccessResponse>;
898
- spotDeploy(args: SpotDeployParameters_RegisterHyperliquidity, signal?: AbortSignal): Promise<SuccessResponse>;
899
- spotDeploy(args: SpotDeployParameters_RegisterSpot, signal?: AbortSignal): Promise<SuccessResponse>;
900
- spotDeploy(args: SpotDeployParameters_RegisterToken2, signal?: AbortSignal): Promise<SuccessResponse>;
901
- spotDeploy(args: SpotDeployParameters_SetDeployerTradingFeeShare, signal?: AbortSignal): Promise<SuccessResponse>;
902
- spotDeploy(args: SpotDeployParameters_UserGenesis, signal?: AbortSignal): Promise<SuccessResponse>;
964
+ spotDeploy(args: SpotDeployParameters, signal?: AbortSignal): Promise<SuccessResponse>;
903
965
  /**
904
966
  * Send spot assets to another address.
905
967
  * @param args - The parameters for the request.
906
968
  * @param signal - An optional abort signal.
907
969
  * @returns Successful response without specific data.
908
- * @throws {ApiRequestError} When the API returns an error response.
970
+ *
971
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
972
+ * @throws {TransportError} When the transport layer throws an error.
909
973
  *
910
974
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-spot-transfer
911
975
  * @example
912
976
  * ```ts
913
977
  * import * as hl from "@nktkas/hyperliquid";
914
- * import { privateKeyToAccount } from "viem/accounts";
915
978
  *
916
- * const wallet = privateKeyToAccount("0x...");
917
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
918
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
979
+ * const privateKey = "0x..."; // or `viem`, `ethers`
980
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
981
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
919
982
  *
920
- * const data = await exchClient.spotSend({
983
+ * await exchClient.spotSend({
921
984
  * destination: "0x...",
922
985
  * token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
923
986
  * amount: "1",
@@ -930,19 +993,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
930
993
  * @param args - The parameters for the request.
931
994
  * @param signal - An optional abort signal.
932
995
  * @returns Successful response without specific data.
933
- * @throws {ApiRequestError} When the API returns an error response.
934
996
  *
935
- * @see null - no documentation
997
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
998
+ * @throws {TransportError} When the transport layer throws an error.
999
+ *
1000
+ * @see null
936
1001
  * @example
937
1002
  * ```ts
938
1003
  * import * as hl from "@nktkas/hyperliquid";
939
- * import { privateKeyToAccount } from "viem/accounts";
940
1004
  *
941
- * const wallet = privateKeyToAccount("0x...");
942
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
943
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1005
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1006
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1007
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
944
1008
  *
945
- * const data = await exchClient.spotUser({ toggleSpotDusting: { optOut: false } });
1009
+ * await exchClient.spotUser({ toggleSpotDusting: { optOut: false } });
946
1010
  * ```
947
1011
  */
948
1012
  spotUser(args: SpotUserParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -951,19 +1015,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
951
1015
  * @param args - The parameters for the request.
952
1016
  * @param signal - An optional abort signal.
953
1017
  * @returns Successful response without specific data.
954
- * @throws {ApiRequestError} When the API returns an error response.
955
1018
  *
956
- * @see null - no documentation
1019
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1020
+ * @throws {TransportError} When the transport layer throws an error.
1021
+ *
1022
+ * @see null
957
1023
  * @example
958
1024
  * ```ts
959
1025
  * import * as hl from "@nktkas/hyperliquid";
960
- * import { privateKeyToAccount } from "viem/accounts";
961
1026
  *
962
- * const wallet = privateKeyToAccount("0x...");
963
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
964
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1027
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1028
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1029
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
965
1030
  *
966
- * const data = await exchClient.subAccountSpotTransfer({
1031
+ * await exchClient.subAccountSpotTransfer({
967
1032
  * subAccountUser: "0x...",
968
1033
  * isDeposit: true,
969
1034
  * token: "USDC:0xeb62eee3685fc4c43992febcd9e75443",
@@ -977,23 +1042,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
977
1042
  * @param args - The parameters for the request.
978
1043
  * @param signal - An optional abort signal.
979
1044
  * @returns Successful response without specific data.
980
- * @throws {ApiRequestError} When the API returns an error response.
981
1045
  *
982
- * @see null - no documentation
1046
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1047
+ * @throws {TransportError} When the transport layer throws an error.
1048
+ *
1049
+ * @see null
983
1050
  * @example
984
1051
  * ```ts
985
1052
  * import * as hl from "@nktkas/hyperliquid";
986
- * import { privateKeyToAccount } from "viem/accounts";
987
1053
  *
988
- * const wallet = privateKeyToAccount("0x...");
989
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
990
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1054
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1055
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1056
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
991
1057
  *
992
- * const data = await exchClient.subAccountTransfer({
993
- * subAccountUser: "0x...",
994
- * isDeposit: true,
995
- * usd: 1 * 1e6,
996
- * });
1058
+ * await exchClient.subAccountTransfer({ subAccountUser: "0x...", isDeposit: true, usd: 1 * 1e6 });
997
1059
  * ```
998
1060
  */
999
1061
  subAccountTransfer(args: SubAccountTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1002,23 +1064,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1002
1064
  * @param args - The parameters for the request.
1003
1065
  * @param signal - An optional abort signal.
1004
1066
  * @returns Successful response without specific data.
1005
- * @throws {ApiRequestError} When the API returns an error response.
1067
+ *
1068
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1069
+ * @throws {TransportError} When the transport layer throws an error.
1006
1070
  *
1007
1071
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
1008
1072
  * @example
1009
1073
  * ```ts
1010
1074
  * import * as hl from "@nktkas/hyperliquid";
1011
- * import { privateKeyToAccount } from "viem/accounts";
1012
1075
  *
1013
- * const wallet = privateKeyToAccount("0x...");
1014
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1015
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1076
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1077
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1078
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1016
1079
  *
1017
- * const data = await exchClient.tokenDelegate({
1018
- * validator: "0x...",
1019
- * isUndelegate: true,
1020
- * wei: 1 * 1e8,
1021
- * });
1080
+ * await exchClient.tokenDelegate({ validator: "0x...", isUndelegate: true, wei: 1 * 1e8 });
1022
1081
  * ```
1023
1082
  */
1024
1083
  tokenDelegate(args: TokenDelegateParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1027,22 +1086,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1027
1086
  * @param args - The parameters for the request.
1028
1087
  * @param signal - An optional abort signal.
1029
1088
  * @returns Successful variant of {@link TwapCancelResponse} without error status.
1030
- * @throws {ApiRequestError} When the API returns an error response.
1089
+ *
1090
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1091
+ * @throws {TransportError} When the transport layer throws an error.
1031
1092
  *
1032
1093
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
1033
1094
  * @example
1034
1095
  * ```ts
1035
1096
  * import * as hl from "@nktkas/hyperliquid";
1036
- * import { privateKeyToAccount } from "viem/accounts";
1037
1097
  *
1038
- * const wallet = privateKeyToAccount("0x...");
1039
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1040
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1098
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1099
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1100
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1041
1101
  *
1042
- * const data = await exchClient.twapCancel({
1043
- * a: 0, // Asset index
1044
- * t: 1, // TWAP ID
1045
- * });
1102
+ * const data = await exchClient.twapCancel({ a: 0, t: 1 });
1046
1103
  * ```
1047
1104
  */
1048
1105
  twapCancel(args: TwapCancelParameters, signal?: AbortSignal): Promise<TwapCancelResponseSuccess>;
@@ -1051,25 +1108,26 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1051
1108
  * @param args - The parameters for the request.
1052
1109
  * @param signal - An optional abort signal.
1053
1110
  * @returns Successful variant of {@link TwapOrderResponse} without error status.
1054
- * @throws {ApiRequestError} When the API returns an error response.
1111
+ *
1112
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1113
+ * @throws {TransportError} When the transport layer throws an error.
1055
1114
  *
1056
1115
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
1057
1116
  * @example
1058
1117
  * ```ts
1059
1118
  * import * as hl from "@nktkas/hyperliquid";
1060
- * import { privateKeyToAccount } from "viem/accounts";
1061
1119
  *
1062
- * const wallet = privateKeyToAccount("0x...");
1063
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1064
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1120
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1121
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1122
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1065
1123
  *
1066
1124
  * const data = await exchClient.twapOrder({
1067
- * a: 0, // Asset index
1068
- * b: true, // Buy order
1069
- * s: "1", // Size
1070
- * r: false, // Not reduce-only
1071
- * m: 10, // Duration in minutes
1072
- * t: true, // Randomize order timing
1125
+ * a: 0,
1126
+ * b: true,
1127
+ * s: "1",
1128
+ * r: false,
1129
+ * m: 10,
1130
+ * t: true,
1073
1131
  * });
1074
1132
  * ```
1075
1133
  */
@@ -1079,23 +1137,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1079
1137
  * @param args - The parameters for the request.
1080
1138
  * @param signal - An optional abort signal.
1081
1139
  * @returns Successful response without specific data.
1082
- * @throws {ApiRequestError} When the API returns an error response.
1140
+ *
1141
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1142
+ * @throws {TransportError} When the transport layer throws an error.
1083
1143
  *
1084
1144
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
1085
1145
  * @example
1086
1146
  * ```ts
1087
1147
  * import * as hl from "@nktkas/hyperliquid";
1088
- * import { privateKeyToAccount } from "viem/accounts";
1089
1148
  *
1090
- * const wallet = privateKeyToAccount("0x...");
1091
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1092
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1149
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1150
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1151
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1093
1152
  *
1094
- * const data = await exchClient.updateIsolatedMargin({
1095
- * asset: 0,
1096
- * isBuy: true,
1097
- * ntli: 1 * 1e6,
1098
- * });
1153
+ * await exchClient.updateIsolatedMargin({ asset: 0, isBuy: true, ntli: 1 * 1e6 });
1099
1154
  * ```
1100
1155
  */
1101
1156
  updateIsolatedMargin(args: UpdateIsolatedMarginParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1104,23 +1159,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1104
1159
  * @param args - The parameters for the request.
1105
1160
  * @param signal - An optional abort signal.
1106
1161
  * @returns Successful response without specific data.
1107
- * @throws {ApiRequestError} When the API returns an error response.
1162
+ *
1163
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1164
+ * @throws {TransportError} When the transport layer throws an error.
1108
1165
  *
1109
1166
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
1110
1167
  * @example
1111
1168
  * ```ts
1112
1169
  * import * as hl from "@nktkas/hyperliquid";
1113
- * import { privateKeyToAccount } from "viem/accounts";
1114
1170
  *
1115
- * const wallet = privateKeyToAccount("0x...");
1116
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1117
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1171
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1172
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1173
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1118
1174
  *
1119
- * const data = await exchClient.updateLeverage({
1120
- * asset: 0,
1121
- * isCross: true,
1122
- * leverage: 5,
1123
- * });
1175
+ * await exchClient.updateLeverage({ asset: 0, isCross: true, leverage: 5 });
1124
1176
  * ```
1125
1177
  */
1126
1178
  updateLeverage(args: UpdateLeverageParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1129,19 +1181,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1129
1181
  * @param args - The parameters for the request.
1130
1182
  * @param signal - An optional abort signal.
1131
1183
  * @returns Successful response without specific data.
1132
- * @throws {ApiRequestError} When the API returns an error response.
1184
+ *
1185
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1186
+ * @throws {TransportError} When the transport layer throws an error.
1133
1187
  *
1134
1188
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
1135
1189
  * @example
1136
1190
  * ```ts
1137
1191
  * import * as hl from "@nktkas/hyperliquid";
1138
- * import { privateKeyToAccount } from "viem/accounts";
1139
1192
  *
1140
- * const wallet = privateKeyToAccount("0x...");
1141
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1142
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1193
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1194
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1195
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1143
1196
  *
1144
- * const data = await exchClient.usdClassTransfer({ amount: "1", toPerp: true });
1197
+ * await exchClient.usdClassTransfer({ amount: "1", toPerp: true });
1145
1198
  * ```
1146
1199
  */
1147
1200
  usdClassTransfer(args: UsdClassTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1150,19 +1203,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1150
1203
  * @param args - The parameters for the request.
1151
1204
  * @param signal - An optional abort signal.
1152
1205
  * @returns Successful response without specific data.
1153
- * @throws {ApiRequestError} When the API returns an error response.
1206
+ *
1207
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1208
+ * @throws {TransportError} When the transport layer throws an error.
1154
1209
  *
1155
1210
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-usdc-transfer
1156
1211
  * @example
1157
1212
  * ```ts
1158
1213
  * import * as hl from "@nktkas/hyperliquid";
1159
- * import { privateKeyToAccount } from "viem/accounts";
1160
1214
  *
1161
- * const wallet = privateKeyToAccount("0x...");
1162
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1163
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1215
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1216
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1217
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1164
1218
  *
1165
- * const data = await exchClient.usdSend({ destination: "0x...", amount: "1" });
1219
+ * await exchClient.usdSend({ destination: "0x...", amount: "1" });
1166
1220
  * ```
1167
1221
  */
1168
1222
  usdSend(args: UsdSendParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1171,19 +1225,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1171
1225
  * @param args - The parameters for the request.
1172
1226
  * @param signal - An optional abort signal.
1173
1227
  * @returns Successful response without specific data.
1174
- * @throws {ApiRequestError} When the API returns an error response.
1175
1228
  *
1176
- * @see null - no documentation
1229
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1230
+ * @throws {TransportError} When the transport layer throws an error.
1231
+ *
1232
+ * @see null
1177
1233
  * @example
1178
1234
  * ```ts
1179
1235
  * import * as hl from "@nktkas/hyperliquid";
1180
- * import { privateKeyToAccount } from "viem/accounts";
1181
1236
  *
1182
- * const wallet = privateKeyToAccount("0x...");
1183
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1184
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1237
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1238
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1239
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1185
1240
  *
1186
- * const data = await exchClient.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
1241
+ * await exchClient.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
1187
1242
  * ```
1188
1243
  */
1189
1244
  vaultDistribute(args: VaultDistributeParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1192,19 +1247,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1192
1247
  * @param args - The parameters for the request.
1193
1248
  * @param signal - An optional abort signal.
1194
1249
  * @returns Successful response without specific data.
1195
- * @throws {ApiRequestError} When the API returns an error response.
1196
1250
  *
1197
- * @see null - no documentation
1251
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1252
+ * @throws {TransportError} When the transport layer throws an error.
1253
+ *
1254
+ * @see null
1198
1255
  * @example
1199
1256
  * ```ts
1200
1257
  * import * as hl from "@nktkas/hyperliquid";
1201
- * import { privateKeyToAccount } from "viem/accounts";
1202
1258
  *
1203
- * const wallet = privateKeyToAccount("0x...");
1204
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1205
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1259
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1260
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1261
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1206
1262
  *
1207
- * const data = await exchClient.vaultModify({
1263
+ * await exchClient.vaultModify({
1208
1264
  * vaultAddress: "0x...",
1209
1265
  * allowDeposits: true,
1210
1266
  * alwaysCloseOnWithdraw: false,
@@ -1217,23 +1273,20 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1217
1273
  * @param args - The parameters for the request.
1218
1274
  * @param signal - An optional abort signal.
1219
1275
  * @returns Successful response without specific data.
1220
- * @throws {ApiRequestError} When the API returns an error response.
1276
+ *
1277
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1278
+ * @throws {TransportError} When the transport layer throws an error.
1221
1279
  *
1222
1280
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
1223
1281
  * @example
1224
1282
  * ```ts
1225
1283
  * import * as hl from "@nktkas/hyperliquid";
1226
- * import { privateKeyToAccount } from "viem/accounts";
1227
1284
  *
1228
- * const wallet = privateKeyToAccount("0x...");
1229
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1230
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1285
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1286
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1287
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1231
1288
  *
1232
- * const data = await exchClient.vaultTransfer({
1233
- * vaultAddress: "0x...",
1234
- * isDeposit: true,
1235
- * usd: 10 * 1e6,
1236
- * });
1289
+ * await exchClient.vaultTransfer({ vaultAddress: "0x...", isDeposit: true, usd: 10 * 1e6 });
1237
1290
  * ```
1238
1291
  */
1239
1292
  vaultTransfer(args: VaultTransferParameters, signal?: AbortSignal): Promise<SuccessResponse>;
@@ -1242,24 +1295,23 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1242
1295
  * @param args - The parameters for the request.
1243
1296
  * @param signal - An optional abort signal.
1244
1297
  * @returns Successful response without specific data.
1245
- * @throws {ApiRequestError} When the API returns an error response.
1298
+ *
1299
+ * @throws {ApiRequestError} When the API returns an unsuccessful response.
1300
+ * @throws {TransportError} When the transport layer throws an error.
1246
1301
  *
1247
1302
  * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
1248
1303
  * @example
1249
1304
  * ```ts
1250
1305
  * import * as hl from "@nktkas/hyperliquid";
1251
- * import { privateKeyToAccount } from "viem/accounts";
1252
1306
  *
1253
- * const wallet = privateKeyToAccount("0x...");
1254
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1255
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1307
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1308
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1309
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1256
1310
  *
1257
- * const data = await exchClient.withdraw3({ destination: "0x...", amount: "1" });
1311
+ * await exchClient.withdraw3({ destination: "0x...", amount: "1" });
1258
1312
  * ```
1259
1313
  */
1260
1314
  withdraw3(args: Withdraw3Parameters, signal?: AbortSignal): Promise<SuccessResponse>;
1261
- /** Send an API request and validate the response. */
1262
- protected _request<T extends SuccessResponse | CancelResponseSuccess | CreateSubAccountResponse | CreateVaultResponse | OrderResponseSuccess | TwapOrderResponseSuccess | TwapCancelResponseSuccess>(payload: BaseExchangeRequest, signal?: AbortSignal): Promise<T>;
1263
1315
  /** Guesses the chain ID based on the wallet type or the isTestnet flag. */
1264
1316
  protected _guessSignatureChainId(): Promise<Hex>;
1265
1317
  /** Get the default expiration time for an action. */