@nktkas/hyperliquid 0.22.0 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +84 -27
  2. package/esm/mod.d.ts +1 -1
  3. package/esm/mod.d.ts.map +1 -1
  4. package/esm/src/clients/exchange.d.ts +136 -166
  5. package/esm/src/clients/exchange.d.ts.map +1 -1
  6. package/esm/src/clients/exchange.js +122 -147
  7. package/esm/src/clients/multiSign.d.ts +129 -282
  8. package/esm/src/clients/multiSign.d.ts.map +1 -1
  9. package/esm/src/clients/multiSign.js +125 -246
  10. package/esm/src/signing/_ethers.d.ts +33 -0
  11. package/esm/src/signing/_ethers.d.ts.map +1 -0
  12. package/esm/src/signing/_ethers.js +12 -0
  13. package/esm/src/signing/_private_key.d.ts +22 -0
  14. package/esm/src/signing/_private_key.d.ts.map +1 -0
  15. package/esm/src/signing/_private_key.js +124 -0
  16. package/esm/src/signing/_sorter.d.ts +154 -0
  17. package/esm/src/signing/_sorter.d.ts.map +1 -0
  18. package/esm/src/{signing.js → signing/_sorter.js} +1 -401
  19. package/esm/src/signing/_viem.d.ts +23 -0
  20. package/esm/src/signing/_viem.d.ts.map +1 -0
  21. package/esm/src/signing/_viem.js +6 -0
  22. package/esm/src/signing/_window.d.ts +23 -0
  23. package/esm/src/signing/_window.d.ts.map +1 -0
  24. package/esm/src/signing/_window.js +29 -0
  25. package/esm/src/signing/mod.d.ts +251 -0
  26. package/esm/src/signing/mod.d.ts.map +1 -0
  27. package/esm/src/signing/mod.js +352 -0
  28. package/esm/src/types/exchange/requests.d.ts +1 -1
  29. package/esm/src/types/exchange/requests.d.ts.map +1 -1
  30. package/package.json +6 -5
  31. package/script/mod.d.ts +1 -1
  32. package/script/mod.d.ts.map +1 -1
  33. package/script/src/clients/exchange.d.ts +136 -166
  34. package/script/src/clients/exchange.d.ts.map +1 -1
  35. package/script/src/clients/exchange.js +206 -231
  36. package/script/src/clients/multiSign.d.ts +129 -282
  37. package/script/src/clients/multiSign.d.ts.map +1 -1
  38. package/script/src/clients/multiSign.js +170 -291
  39. package/script/src/signing/_ethers.d.ts +33 -0
  40. package/script/src/signing/_ethers.d.ts.map +1 -0
  41. package/script/src/signing/_ethers.js +26 -0
  42. package/script/src/signing/_private_key.d.ts +22 -0
  43. package/script/src/signing/_private_key.d.ts.map +1 -0
  44. package/script/src/signing/_private_key.js +138 -0
  45. package/script/src/signing/_sorter.d.ts +154 -0
  46. package/script/src/signing/_sorter.d.ts.map +1 -0
  47. package/script/src/{signing.js → signing/_sorter.js} +2 -410
  48. package/script/src/signing/_viem.d.ts +23 -0
  49. package/script/src/signing/_viem.d.ts.map +1 -0
  50. package/script/src/signing/_viem.js +19 -0
  51. package/script/src/signing/_window.d.ts +23 -0
  52. package/script/src/signing/_window.d.ts.map +1 -0
  53. package/script/src/signing/_window.js +43 -0
  54. package/script/src/signing/mod.d.ts +251 -0
  55. package/script/src/signing/mod.d.ts.map +1 -0
  56. package/script/src/signing/mod.js +387 -0
  57. package/script/src/types/exchange/requests.d.ts +1 -1
  58. package/script/src/types/exchange/requests.d.ts.map +1 -1
  59. package/esm/src/signing.d.ts +0 -463
  60. package/esm/src/signing.d.ts.map +0 -1
  61. package/script/src/signing.d.ts +0 -463
  62. package/script/src/signing.d.ts.map +0 -1
@@ -2,7 +2,7 @@ import { type Hex, HyperliquidError, type MaybePromise } from "../base.js";
2
2
  import type { IRequestTransport } from "../transports/base.js";
3
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";
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. */
@@ -202,6 +202,16 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
202
202
  * Initialises a new instance.
203
203
  * @param args - The parameters for the client.
204
204
  *
205
+ * @example Private key
206
+ * ```ts
207
+ * import * as hl from "@nktkas/hyperliquid";
208
+ *
209
+ * const privateKey = "0x...";
210
+ *
211
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
212
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
213
+ * ```
214
+ *
205
215
  * @example Private key via [viem](https://viem.sh/docs/clients/wallet#local-accounts-private-key-mnemonic-etc)
206
216
  * ```ts
207
217
  * import * as hl from "@nktkas/hyperliquid";
@@ -209,7 +219,7 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
209
219
  *
210
220
  * const wallet = privateKeyToAccount("0x...");
211
221
  *
212
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
222
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
213
223
  * const exchClient = new hl.ExchangeClient({ wallet, transport });
214
224
  * ```
215
225
  *
@@ -220,7 +230,7 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
220
230
  *
221
231
  * const wallet = new ethers.Wallet("0x...");
222
232
  *
223
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
233
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
224
234
  * const exchClient = new hl.ExchangeClient({ wallet, transport });
225
235
  * ```
226
236
  *
@@ -232,7 +242,7 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
232
242
  * const [account] = await window.ethereum.request({ method: "eth_requestAccounts" });
233
243
  * const wallet = createWalletClient({ account, transport: custom(window.ethereum) });
234
244
  *
235
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
245
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
236
246
  * const exchClient = new hl.ExchangeClient({ wallet, transport });
237
247
  * ```
238
248
  *
@@ -240,7 +250,7 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
240
250
  * ```ts
241
251
  * import * as hl from "@nktkas/hyperliquid";
242
252
  *
243
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
253
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
244
254
  * const exchClient = new hl.ExchangeClient({ wallet: window.ethereum, transport });
245
255
  * ```
246
256
  */
@@ -256,11 +266,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
256
266
  * @example
257
267
  * ```ts
258
268
  * import * as hl from "@nktkas/hyperliquid";
259
- * import { privateKeyToAccount } from "viem/accounts";
260
269
  *
261
- * const wallet = privateKeyToAccount("0x...");
262
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
263
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
270
+ * const privateKey = "0x..."; // or `viem`, `ethers`
271
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
272
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
264
273
  *
265
274
  * const data = await exchClient.approveAgent({ agentAddress: "0x...", agentName: "agentName" });
266
275
  * ```
@@ -277,11 +286,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
277
286
  * @example
278
287
  * ```ts
279
288
  * import * as hl from "@nktkas/hyperliquid";
280
- * import { privateKeyToAccount } from "viem/accounts";
281
289
  *
282
- * const wallet = privateKeyToAccount("0x...");
283
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
284
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
290
+ * const privateKey = "0x..."; // or `viem`, `ethers`
291
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
292
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
285
293
  *
286
294
  * const data = await exchClient.approveBuilderFee({ maxFeeRate: "0.01%", builder: "0x..." });
287
295
  * ```
@@ -298,11 +306,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
298
306
  * @example
299
307
  * ```ts
300
308
  * import * as hl from "@nktkas/hyperliquid";
301
- * import { privateKeyToAccount } from "viem/accounts";
302
309
  *
303
- * const wallet = privateKeyToAccount("0x...");
304
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
305
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
310
+ * const privateKey = "0x..."; // or `viem`, `ethers`
311
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
312
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
306
313
  *
307
314
  * const data = await exchClient.batchModify({
308
315
  * modifies: [{
@@ -336,11 +343,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
336
343
  * @example
337
344
  * ```ts
338
345
  * import * as hl from "@nktkas/hyperliquid";
339
- * import { privateKeyToAccount } from "viem/accounts";
340
346
  *
341
- * const wallet = privateKeyToAccount("0x...");
342
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
343
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
347
+ * const privateKey = "0x..."; // or `viem`, `ethers`
348
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
349
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
344
350
  *
345
351
  * const data = await exchClient.cancel({
346
352
  * cancels: [{
@@ -362,11 +368,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
362
368
  * @example
363
369
  * ```ts
364
370
  * import * as hl from "@nktkas/hyperliquid";
365
- * import { privateKeyToAccount } from "viem/accounts";
366
371
  *
367
- * const wallet = privateKeyToAccount("0x...");
368
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
369
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
372
+ * const privateKey = "0x..."; // or `viem`, `ethers`
373
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
374
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
370
375
  *
371
376
  * const data = await exchClient.cancelByCloid({
372
377
  * cancels: [
@@ -387,11 +392,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
387
392
  * @example
388
393
  * ```ts
389
394
  * import * as hl from "@nktkas/hyperliquid";
390
- * import { privateKeyToAccount } from "viem/accounts";
391
395
  *
392
- * const wallet = privateKeyToAccount("0x...");
393
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
394
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
396
+ * const privateKey = "0x..."; // or `viem`, `ethers`
397
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
398
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
395
399
  *
396
400
  * const data = await exchClient.cDeposit({ wei: 1 * 1e8 });
397
401
  * ```
@@ -408,11 +412,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
408
412
  * @example
409
413
  * ```ts
410
414
  * import * as hl from "@nktkas/hyperliquid";
411
- * import { privateKeyToAccount } from "viem/accounts";
412
415
  *
413
- * const wallet = privateKeyToAccount("0x...");
414
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
415
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
416
+ * const privateKey = "0x..."; // or `viem`, `ethers`
417
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
418
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
416
419
  *
417
420
  * const data = await exchClient.claimRewards();
418
421
  * ```
@@ -429,11 +432,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
429
432
  * @example
430
433
  * ```ts
431
434
  * import * as hl from "@nktkas/hyperliquid";
432
- * import { privateKeyToAccount } from "viem/accounts";
433
435
  *
434
- * const wallet = privateKeyToAccount("0x...");
435
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
436
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
436
+ * const privateKey = "0x..."; // or `viem`, `ethers`
437
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
438
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
437
439
  *
438
440
  * const data = await exchClient.convertToMultiSigUser({ // convert to multi-sig user
439
441
  * authorizedUsers: ["0x...", "0x...", "0x..."],
@@ -453,11 +455,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
453
455
  * @example
454
456
  * ```ts
455
457
  * import * as hl from "@nktkas/hyperliquid";
456
- * import { privateKeyToAccount } from "viem/accounts";
457
458
  *
458
- * const wallet = privateKeyToAccount("0x...");
459
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
460
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
459
+ * const privateKey = "0x..."; // or `viem`, `ethers`
460
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
461
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
461
462
  *
462
463
  * const data = await exchClient.createSubAccount({ name: "subAccountName" });
463
464
  * ```
@@ -474,11 +475,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
474
475
  * @example
475
476
  * ```ts
476
477
  * import * as hl from "@nktkas/hyperliquid";
477
- * import { privateKeyToAccount } from "viem/accounts";
478
478
  *
479
- * const wallet = privateKeyToAccount("0x...");
480
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
481
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
479
+ * const privateKey = "0x..."; // or `viem`, `ethers`
480
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
481
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
482
482
  *
483
483
  * const data = await exchClient.createVault({
484
484
  * name: "VaultName",
@@ -499,11 +499,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
499
499
  * @example
500
500
  * ```ts
501
501
  * import * as hl from "@nktkas/hyperliquid";
502
- * import { privateKeyToAccount } from "viem/accounts";
503
502
  *
504
- * const wallet = privateKeyToAccount("0x...");
505
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
506
- * 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 });
507
506
  *
508
507
  * // Jail self
509
508
  * const data = await exchClient.cSignerAction({ jailSelf: null });
@@ -524,11 +523,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
524
523
  * @example
525
524
  * ```ts
526
525
  * import * as hl from "@nktkas/hyperliquid";
527
- * import { privateKeyToAccount } from "viem/accounts";
528
526
  *
529
- * const wallet = privateKeyToAccount("0x...");
530
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
531
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
527
+ * const privateKey = "0x..."; // or `viem`, `ethers`
528
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
529
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
532
530
  *
533
531
  * // Change validator profile
534
532
  * const data = await exchClient.cValidatorAction({
@@ -554,11 +552,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
554
552
  * @example
555
553
  * ```ts
556
554
  * import * as hl from "@nktkas/hyperliquid";
557
- * import { privateKeyToAccount } from "viem/accounts";
558
555
  *
559
- * const wallet = privateKeyToAccount("0x...");
560
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
561
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
556
+ * const privateKey = "0x..."; // or `viem`, `ethers`
557
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
558
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
562
559
  *
563
560
  * const data = await exchClient.cWithdraw({ wei: 1 * 1e8 });
564
561
  * ```
@@ -575,11 +572,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
575
572
  * @example
576
573
  * ```ts
577
574
  * import * as hl from "@nktkas/hyperliquid";
578
- * import { privateKeyToAccount } from "viem/accounts";
579
575
  *
580
- * const wallet = privateKeyToAccount("0x...");
581
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
582
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
576
+ * const privateKey = "0x..."; // or `viem`, `ethers`
577
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
578
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
583
579
  *
584
580
  * const data = await exchClient.evmUserModify({ usingBigBlocks: true });
585
581
  * ```
@@ -596,11 +592,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
596
592
  * @example
597
593
  * ```ts
598
594
  * import * as hl from "@nktkas/hyperliquid";
599
- * import { privateKeyToAccount } from "viem/accounts";
600
595
  *
601
- * const wallet = privateKeyToAccount("0x...");
602
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
603
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
596
+ * const privateKey = "0x..."; // or `viem`, `ethers`
597
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
598
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
604
599
  *
605
600
  * const data = await exchClient.modify({
606
601
  * oid: 123,
@@ -632,11 +627,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
632
627
  * @example
633
628
  * ```ts
634
629
  * import * as hl from "@nktkas/hyperliquid";
635
- * import { privateKeyToAccount } from "viem/accounts";
636
630
  *
637
- * const wallet = privateKeyToAccount("0x...");
638
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
639
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
631
+ * const privateKey = "0x..."; // or `viem`, `ethers`
632
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
633
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
640
634
  *
641
635
  * const multiSigUser = "0x..."; // Multi-sig user address
642
636
  *
@@ -673,11 +667,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
673
667
  * @example
674
668
  * ```ts
675
669
  * import * as hl from "@nktkas/hyperliquid";
676
- * import { privateKeyToAccount } from "viem/accounts";
677
670
  *
678
- * const wallet = privateKeyToAccount("0x...");
679
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
680
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
671
+ * const privateKey = "0x..."; // or `viem`, `ethers`
672
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
673
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
681
674
  *
682
675
  * const data = await exchClient.order({
683
676
  * orders: [{
@@ -709,11 +702,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
709
702
  * @example
710
703
  * ```ts
711
704
  * import * as hl from "@nktkas/hyperliquid";
712
- * import { privateKeyToAccount } from "viem/accounts";
713
705
  *
714
- * const wallet = privateKeyToAccount("0x...");
715
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
716
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
706
+ * const privateKey = "0x..."; // or `viem`, `ethers`
707
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
708
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
717
709
  *
718
710
  * const data = await exchClient.perpDeploy({
719
711
  * registerAsset: {
@@ -743,11 +735,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
743
735
  * @example
744
736
  * ```ts
745
737
  * import * as hl from "@nktkas/hyperliquid";
746
- * import { privateKeyToAccount } from "viem/accounts";
747
738
  *
748
- * const wallet = privateKeyToAccount("0x...");
749
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
750
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
739
+ * const privateKey = "0x..."; // or `viem`, `ethers`
740
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
741
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
751
742
  *
752
743
  * const data = await exchClient.perpDexClassTransfer({
753
744
  * dex: "test",
@@ -769,11 +760,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
769
760
  * @example
770
761
  * ```ts
771
762
  * import * as hl from "@nktkas/hyperliquid";
772
- * import { privateKeyToAccount } from "viem/accounts";
773
763
  *
774
- * const wallet = privateKeyToAccount("0x...");
775
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
776
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
764
+ * const privateKey = "0x..."; // or `viem`, `ethers`
765
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
766
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
777
767
  *
778
768
  * const data = await exchClient.registerReferrer({ code: "TEST" });
779
769
  * ```
@@ -790,11 +780,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
790
780
  * @example
791
781
  * ```ts
792
782
  * import * as hl from "@nktkas/hyperliquid";
793
- * import { privateKeyToAccount } from "viem/accounts";
794
783
  *
795
- * const wallet = privateKeyToAccount("0x...");
796
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
797
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
784
+ * const privateKey = "0x..."; // or `viem`, `ethers`
785
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
786
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
798
787
  *
799
788
  * const data = await exchClient.reserveRequestWeight({ weight: 10 });
800
789
  * ```
@@ -811,11 +800,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
811
800
  * @example
812
801
  * ```ts
813
802
  * import * as hl from "@nktkas/hyperliquid";
814
- * import { privateKeyToAccount } from "viem/accounts";
815
803
  *
816
- * const wallet = privateKeyToAccount("0x...");
817
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
818
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
804
+ * const privateKey = "0x..."; // or `viem`, `ethers`
805
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
806
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
819
807
  *
820
808
  * const data = await exchClient.scheduleCancel({ time: Date.now() + 3600000 });
821
809
  * ```
@@ -833,11 +821,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
833
821
  * @example
834
822
  * ```ts
835
823
  * import * as hl from "@nktkas/hyperliquid";
836
- * import { privateKeyToAccount } from "viem/accounts";
837
824
  *
838
- * const wallet = privateKeyToAccount("0x...");
839
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
840
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
825
+ * const privateKey = "0x..."; // or `viem`, `ethers`
826
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
827
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
841
828
  *
842
829
  * const data = await exchClient.setDisplayName({ displayName: "My Name" });
843
830
  * ```
@@ -854,11 +841,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
854
841
  * @example
855
842
  * ```ts
856
843
  * import * as hl from "@nktkas/hyperliquid";
857
- * import { privateKeyToAccount } from "viem/accounts";
858
844
  *
859
- * const wallet = privateKeyToAccount("0x...");
860
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
861
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
845
+ * const privateKey = "0x..."; // or `viem`, `ethers`
846
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
847
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
862
848
  *
863
849
  * const data = await exchClient.setReferrer({ code: "TEST" });
864
850
  * ```
@@ -875,11 +861,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
875
861
  * @example
876
862
  * ```ts
877
863
  * import * as hl from "@nktkas/hyperliquid";
878
- * import { privateKeyToAccount } from "viem/accounts";
879
864
  *
880
- * const wallet = privateKeyToAccount("0x...");
881
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
882
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
865
+ * const privateKey = "0x..."; // or `viem`, `ethers`
866
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
867
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
883
868
  *
884
869
  * const data = await exchClient.spotDeploy({
885
870
  * registerToken2: {
@@ -911,11 +896,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
911
896
  * @example
912
897
  * ```ts
913
898
  * import * as hl from "@nktkas/hyperliquid";
914
- * import { privateKeyToAccount } from "viem/accounts";
915
899
  *
916
- * const wallet = privateKeyToAccount("0x...");
917
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
918
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
900
+ * const privateKey = "0x..."; // or `viem`, `ethers`
901
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
902
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
919
903
  *
920
904
  * const data = await exchClient.spotSend({
921
905
  * destination: "0x...",
@@ -936,11 +920,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
936
920
  * @example
937
921
  * ```ts
938
922
  * import * as hl from "@nktkas/hyperliquid";
939
- * import { privateKeyToAccount } from "viem/accounts";
940
923
  *
941
- * const wallet = privateKeyToAccount("0x...");
942
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
943
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
924
+ * const privateKey = "0x..."; // or `viem`, `ethers`
925
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
926
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
944
927
  *
945
928
  * const data = await exchClient.spotUser({ toggleSpotDusting: { optOut: false } });
946
929
  * ```
@@ -957,11 +940,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
957
940
  * @example
958
941
  * ```ts
959
942
  * import * as hl from "@nktkas/hyperliquid";
960
- * import { privateKeyToAccount } from "viem/accounts";
961
943
  *
962
- * const wallet = privateKeyToAccount("0x...");
963
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
964
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
944
+ * const privateKey = "0x..."; // or `viem`, `ethers`
945
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
946
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
965
947
  *
966
948
  * const data = await exchClient.subAccountSpotTransfer({
967
949
  * subAccountUser: "0x...",
@@ -983,11 +965,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
983
965
  * @example
984
966
  * ```ts
985
967
  * import * as hl from "@nktkas/hyperliquid";
986
- * import { privateKeyToAccount } from "viem/accounts";
987
968
  *
988
- * const wallet = privateKeyToAccount("0x...");
989
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
990
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
969
+ * const privateKey = "0x..."; // or `viem`, `ethers`
970
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
971
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
991
972
  *
992
973
  * const data = await exchClient.subAccountTransfer({
993
974
  * subAccountUser: "0x...",
@@ -1008,11 +989,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1008
989
  * @example
1009
990
  * ```ts
1010
991
  * import * as hl from "@nktkas/hyperliquid";
1011
- * import { privateKeyToAccount } from "viem/accounts";
1012
992
  *
1013
- * const wallet = privateKeyToAccount("0x...");
1014
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1015
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
993
+ * const privateKey = "0x..."; // or `viem`, `ethers`
994
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
995
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1016
996
  *
1017
997
  * const data = await exchClient.tokenDelegate({
1018
998
  * validator: "0x...",
@@ -1033,11 +1013,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1033
1013
  * @example
1034
1014
  * ```ts
1035
1015
  * import * as hl from "@nktkas/hyperliquid";
1036
- * import { privateKeyToAccount } from "viem/accounts";
1037
1016
  *
1038
- * const wallet = privateKeyToAccount("0x...");
1039
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1040
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1017
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1018
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1019
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1041
1020
  *
1042
1021
  * const data = await exchClient.twapCancel({
1043
1022
  * a: 0, // Asset index
@@ -1057,11 +1036,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1057
1036
  * @example
1058
1037
  * ```ts
1059
1038
  * import * as hl from "@nktkas/hyperliquid";
1060
- * import { privateKeyToAccount } from "viem/accounts";
1061
1039
  *
1062
- * const wallet = privateKeyToAccount("0x...");
1063
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1064
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1040
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1041
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1042
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1065
1043
  *
1066
1044
  * const data = await exchClient.twapOrder({
1067
1045
  * a: 0, // Asset index
@@ -1085,11 +1063,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1085
1063
  * @example
1086
1064
  * ```ts
1087
1065
  * import * as hl from "@nktkas/hyperliquid";
1088
- * import { privateKeyToAccount } from "viem/accounts";
1089
1066
  *
1090
- * const wallet = privateKeyToAccount("0x...");
1091
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1092
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1067
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1068
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1069
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1093
1070
  *
1094
1071
  * const data = await exchClient.updateIsolatedMargin({
1095
1072
  * asset: 0,
@@ -1110,11 +1087,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1110
1087
  * @example
1111
1088
  * ```ts
1112
1089
  * import * as hl from "@nktkas/hyperliquid";
1113
- * import { privateKeyToAccount } from "viem/accounts";
1114
1090
  *
1115
- * const wallet = privateKeyToAccount("0x...");
1116
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1117
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1091
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1092
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1093
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1118
1094
  *
1119
1095
  * const data = await exchClient.updateLeverage({
1120
1096
  * asset: 0,
@@ -1135,11 +1111,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1135
1111
  * @example
1136
1112
  * ```ts
1137
1113
  * import * as hl from "@nktkas/hyperliquid";
1138
- * import { privateKeyToAccount } from "viem/accounts";
1139
1114
  *
1140
- * const wallet = privateKeyToAccount("0x...");
1141
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1142
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1115
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1116
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1117
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1143
1118
  *
1144
1119
  * const data = await exchClient.usdClassTransfer({ amount: "1", toPerp: true });
1145
1120
  * ```
@@ -1156,11 +1131,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1156
1131
  * @example
1157
1132
  * ```ts
1158
1133
  * import * as hl from "@nktkas/hyperliquid";
1159
- * import { privateKeyToAccount } from "viem/accounts";
1160
1134
  *
1161
- * const wallet = privateKeyToAccount("0x...");
1162
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1163
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1135
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1136
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1137
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1164
1138
  *
1165
1139
  * const data = await exchClient.usdSend({ destination: "0x...", amount: "1" });
1166
1140
  * ```
@@ -1177,11 +1151,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1177
1151
  * @example
1178
1152
  * ```ts
1179
1153
  * import * as hl from "@nktkas/hyperliquid";
1180
- * import { privateKeyToAccount } from "viem/accounts";
1181
1154
  *
1182
- * const wallet = privateKeyToAccount("0x...");
1183
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1184
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1155
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1156
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1157
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1185
1158
  *
1186
1159
  * const data = await exchClient.vaultDistribute({ vaultAddress: "0x...", usd: 10 * 1e6 });
1187
1160
  * ```
@@ -1198,11 +1171,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1198
1171
  * @example
1199
1172
  * ```ts
1200
1173
  * import * as hl from "@nktkas/hyperliquid";
1201
- * import { privateKeyToAccount } from "viem/accounts";
1202
1174
  *
1203
- * const wallet = privateKeyToAccount("0x...");
1204
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1205
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1175
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1176
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1177
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1206
1178
  *
1207
1179
  * const data = await exchClient.vaultModify({
1208
1180
  * vaultAddress: "0x...",
@@ -1223,11 +1195,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1223
1195
  * @example
1224
1196
  * ```ts
1225
1197
  * import * as hl from "@nktkas/hyperliquid";
1226
- * import { privateKeyToAccount } from "viem/accounts";
1227
1198
  *
1228
- * const wallet = privateKeyToAccount("0x...");
1229
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1230
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1199
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1200
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1201
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1231
1202
  *
1232
1203
  * const data = await exchClient.vaultTransfer({
1233
1204
  * vaultAddress: "0x...",
@@ -1248,11 +1219,10 @@ export declare class ExchangeClient<T extends IRequestTransport = IRequestTransp
1248
1219
  * @example
1249
1220
  * ```ts
1250
1221
  * import * as hl from "@nktkas/hyperliquid";
1251
- * import { privateKeyToAccount } from "viem/accounts";
1252
1222
  *
1253
- * const wallet = privateKeyToAccount("0x...");
1254
- * const transport = new hl.HttpTransport(); // or WebSocketTransport
1255
- * const exchClient = new hl.ExchangeClient({ wallet, transport });
1223
+ * const privateKey = "0x..."; // or `viem`, `ethers`
1224
+ * const transport = new hl.HttpTransport(); // or `WebSocketTransport`
1225
+ * const exchClient = new hl.ExchangeClient({ wallet: privateKey, transport });
1256
1226
  *
1257
1227
  * const data = await exchClient.withdraw3({ destination: "0x...", amount: "1" });
1258
1228
  * ```