@nktkas/hyperliquid 0.23.1 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/CONTRIBUTING.md +3 -2
  2. package/README.md +154 -170
  3. package/esm/mod.d.ts +1 -1
  4. package/esm/mod.d.ts.map +1 -1
  5. package/esm/src/base.d.ts +0 -5
  6. package/esm/src/base.d.ts.map +1 -1
  7. package/esm/src/clients/exchange.d.ts +430 -393
  8. package/esm/src/clients/exchange.d.ts.map +1 -1
  9. package/esm/src/clients/exchange.js +467 -927
  10. package/esm/src/clients/info.d.ts +228 -203
  11. package/esm/src/clients/info.d.ts.map +1 -1
  12. package/esm/src/clients/info.js +236 -368
  13. package/esm/src/clients/multiSign.d.ts +14 -1184
  14. package/esm/src/clients/multiSign.d.ts.map +1 -1
  15. package/esm/src/clients/multiSign.js +37 -2004
  16. package/esm/src/clients/subscription.d.ts +95 -93
  17. package/esm/src/clients/subscription.d.ts.map +1 -1
  18. package/esm/src/clients/subscription.js +101 -146
  19. package/esm/src/signing/_signTypedData/ethers.d.ts +16 -4
  20. package/esm/src/signing/_signTypedData/ethers.d.ts.map +1 -1
  21. package/esm/src/signing/_signTypedData/ethers.js +1 -1
  22. package/esm/src/signing/_signTypedData/mod.d.ts +12 -12
  23. package/esm/src/signing/_signTypedData/mod.d.ts.map +1 -1
  24. package/esm/src/signing/_signTypedData/mod.js +52 -24
  25. package/esm/src/signing/_signTypedData/private_key.d.ts +6 -5
  26. package/esm/src/signing/_signTypedData/private_key.d.ts.map +1 -1
  27. package/esm/src/signing/_signTypedData/private_key.js +40 -19
  28. package/esm/src/signing/_signTypedData/viem.d.ts +27 -6
  29. package/esm/src/signing/_signTypedData/viem.d.ts.map +1 -1
  30. package/esm/src/signing/_signTypedData/viem.js +1 -1
  31. package/esm/src/signing/_sorter.d.ts +12 -21
  32. package/esm/src/signing/_sorter.d.ts.map +1 -1
  33. package/esm/src/signing/_sorter.js +30 -63
  34. package/esm/src/signing/mod.d.ts +177 -127
  35. package/esm/src/signing/mod.d.ts.map +1 -1
  36. package/esm/src/signing/mod.js +182 -130
  37. package/esm/src/transports/base.d.ts +2 -1
  38. package/esm/src/transports/base.d.ts.map +1 -1
  39. package/esm/src/transports/http/http_transport.d.ts +3 -2
  40. package/esm/src/transports/http/http_transport.d.ts.map +1 -1
  41. package/esm/src/transports/http/http_transport.js +4 -4
  42. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
  43. package/esm/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  44. package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -2
  45. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
  46. package/esm/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  47. package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
  48. package/esm/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
  49. package/esm/src/transports/websocket/_websocket_async_request.js +17 -21
  50. package/esm/src/transports/websocket/websocket_transport.d.ts +4 -4
  51. package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  52. package/esm/src/transports/websocket/websocket_transport.js +6 -6
  53. package/esm/src/types/exchange/requests.d.ts +492 -306
  54. package/esm/src/types/exchange/requests.d.ts.map +1 -1
  55. package/esm/src/types/exchange/responses.d.ts +105 -25
  56. package/esm/src/types/exchange/responses.d.ts.map +1 -1
  57. package/esm/src/types/explorer/requests.d.ts +3 -3
  58. package/esm/src/types/explorer/requests.d.ts.map +1 -1
  59. package/esm/src/types/explorer/responses.d.ts +1 -1
  60. package/esm/src/types/explorer/responses.d.ts.map +1 -1
  61. package/esm/src/types/info/accounts.d.ts +403 -98
  62. package/esm/src/types/info/accounts.d.ts.map +1 -1
  63. package/esm/src/types/info/assets.d.ts +131 -35
  64. package/esm/src/types/info/assets.d.ts.map +1 -1
  65. package/esm/src/types/info/markets.d.ts +29 -8
  66. package/esm/src/types/info/markets.d.ts.map +1 -1
  67. package/esm/src/types/info/orders.d.ts +62 -17
  68. package/esm/src/types/info/orders.d.ts.map +1 -1
  69. package/esm/src/types/info/requests.d.ts +117 -51
  70. package/esm/src/types/info/requests.d.ts.map +1 -1
  71. package/esm/src/types/info/validators.d.ts +44 -14
  72. package/esm/src/types/info/validators.d.ts.map +1 -1
  73. package/esm/src/types/info/vaults.d.ts +25 -10
  74. package/esm/src/types/info/vaults.d.ts.map +1 -1
  75. package/esm/src/types/mod.d.ts +1 -1
  76. package/esm/src/types/mod.d.ts.map +1 -1
  77. package/esm/src/types/subscriptions/requests.d.ts +21 -66
  78. package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
  79. package/esm/src/types/subscriptions/responses.d.ts +46 -55
  80. package/esm/src/types/subscriptions/responses.d.ts.map +1 -1
  81. package/package.json +2 -3
  82. package/script/mod.d.ts +1 -1
  83. package/script/mod.d.ts.map +1 -1
  84. package/script/src/base.d.ts +0 -5
  85. package/script/src/base.d.ts.map +1 -1
  86. package/script/src/clients/exchange.d.ts +430 -393
  87. package/script/src/clients/exchange.d.ts.map +1 -1
  88. package/script/src/clients/exchange.js +466 -926
  89. package/script/src/clients/info.d.ts +228 -203
  90. package/script/src/clients/info.d.ts.map +1 -1
  91. package/script/src/clients/info.js +236 -368
  92. package/script/src/clients/multiSign.d.ts +14 -1184
  93. package/script/src/clients/multiSign.d.ts.map +1 -1
  94. package/script/src/clients/multiSign.js +38 -2005
  95. package/script/src/clients/subscription.d.ts +95 -93
  96. package/script/src/clients/subscription.d.ts.map +1 -1
  97. package/script/src/clients/subscription.js +101 -146
  98. package/script/src/signing/_signTypedData/ethers.d.ts +16 -4
  99. package/script/src/signing/_signTypedData/ethers.d.ts.map +1 -1
  100. package/script/src/signing/_signTypedData/ethers.js +2 -2
  101. package/script/src/signing/_signTypedData/mod.d.ts +12 -12
  102. package/script/src/signing/_signTypedData/mod.d.ts.map +1 -1
  103. package/script/src/signing/_signTypedData/mod.js +51 -26
  104. package/script/src/signing/_signTypedData/private_key.d.ts +6 -5
  105. package/script/src/signing/_signTypedData/private_key.d.ts.map +1 -1
  106. package/script/src/signing/_signTypedData/private_key.js +40 -18
  107. package/script/src/signing/_signTypedData/viem.d.ts +27 -6
  108. package/script/src/signing/_signTypedData/viem.d.ts.map +1 -1
  109. package/script/src/signing/_signTypedData/viem.js +2 -2
  110. package/script/src/signing/_sorter.d.ts +12 -21
  111. package/script/src/signing/_sorter.d.ts.map +1 -1
  112. package/script/src/signing/_sorter.js +30 -63
  113. package/script/src/signing/mod.d.ts +177 -127
  114. package/script/src/signing/mod.d.ts.map +1 -1
  115. package/script/src/signing/mod.js +185 -148
  116. package/script/src/transports/base.d.ts +2 -1
  117. package/script/src/transports/base.d.ts.map +1 -1
  118. package/script/src/transports/http/http_transport.d.ts +3 -2
  119. package/script/src/transports/http/http_transport.d.ts.map +1 -1
  120. package/script/src/transports/http/http_transport.js +4 -4
  121. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts +14 -6
  122. package/script/src/transports/websocket/_hyperliquid_event_target.d.ts.map +1 -1
  123. package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -2
  124. package/script/src/transports/websocket/_reconnecting_websocket.d.ts +2 -1
  125. package/script/src/transports/websocket/_reconnecting_websocket.d.ts.map +1 -1
  126. package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
  127. package/script/src/transports/websocket/_websocket_async_request.d.ts.map +1 -1
  128. package/script/src/transports/websocket/_websocket_async_request.js +17 -21
  129. package/script/src/transports/websocket/websocket_transport.d.ts +4 -4
  130. package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
  131. package/script/src/transports/websocket/websocket_transport.js +6 -6
  132. package/script/src/types/exchange/requests.d.ts +492 -306
  133. package/script/src/types/exchange/requests.d.ts.map +1 -1
  134. package/script/src/types/exchange/responses.d.ts +105 -25
  135. package/script/src/types/exchange/responses.d.ts.map +1 -1
  136. package/script/src/types/explorer/requests.d.ts +3 -3
  137. package/script/src/types/explorer/requests.d.ts.map +1 -1
  138. package/script/src/types/explorer/responses.d.ts +1 -1
  139. package/script/src/types/explorer/responses.d.ts.map +1 -1
  140. package/script/src/types/info/accounts.d.ts +403 -98
  141. package/script/src/types/info/accounts.d.ts.map +1 -1
  142. package/script/src/types/info/assets.d.ts +131 -35
  143. package/script/src/types/info/assets.d.ts.map +1 -1
  144. package/script/src/types/info/markets.d.ts +29 -8
  145. package/script/src/types/info/markets.d.ts.map +1 -1
  146. package/script/src/types/info/orders.d.ts +62 -17
  147. package/script/src/types/info/orders.d.ts.map +1 -1
  148. package/script/src/types/info/requests.d.ts +117 -51
  149. package/script/src/types/info/requests.d.ts.map +1 -1
  150. package/script/src/types/info/validators.d.ts +44 -14
  151. package/script/src/types/info/validators.d.ts.map +1 -1
  152. package/script/src/types/info/vaults.d.ts +25 -10
  153. package/script/src/types/info/vaults.d.ts.map +1 -1
  154. package/script/src/types/mod.d.ts +1 -1
  155. package/script/src/types/mod.d.ts.map +1 -1
  156. package/script/src/types/subscriptions/requests.d.ts +21 -66
  157. package/script/src/types/subscriptions/requests.d.ts.map +1 -1
  158. package/script/src/types/subscriptions/responses.d.ts +46 -55
  159. package/script/src/types/subscriptions/responses.d.ts.map +1 -1
  160. package/esm/src/signing/_signTypedData/window.d.ts +0 -29
  161. package/esm/src/signing/_signTypedData/window.d.ts.map +0 -1
  162. package/esm/src/signing/_signTypedData/window.js +0 -30
  163. package/script/src/signing/_signTypedData/window.d.ts +0 -29
  164. package/script/src/signing/_signTypedData/window.d.ts.map +0 -1
  165. package/script/src/signing/_signTypedData/window.js +0 -34
@@ -1,29 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidPrivateKey = exports.isAbstractWindowEthereum = exports.isAbstractViemWalletClient = exports.isAbstractEthersV5Signer = exports.isAbstractEthersSigner = void 0;
4
3
  exports.signTypedData = signTypedData;
4
+ exports.getWalletChainId = getWalletChainId;
5
+ exports.getWalletAddress = getWalletAddress;
5
6
  const ethers_js_1 = require("./ethers.js");
6
- Object.defineProperty(exports, "isAbstractEthersSigner", { enumerable: true, get: function () { return ethers_js_1.isAbstractEthersSigner; } });
7
- Object.defineProperty(exports, "isAbstractEthersV5Signer", { enumerable: true, get: function () { return ethers_js_1.isAbstractEthersV5Signer; } });
8
7
  const private_key_js_1 = require("./private_key.js");
9
- Object.defineProperty(exports, "isValidPrivateKey", { enumerable: true, get: function () { return private_key_js_1.isValidPrivateKey; } });
10
8
  const viem_js_1 = require("./viem.js");
11
- Object.defineProperty(exports, "isAbstractViemWalletClient", { enumerable: true, get: function () { return viem_js_1.isAbstractViemWalletClient; } });
12
- const window_js_1 = require("./window.js");
13
- Object.defineProperty(exports, "isAbstractWindowEthereum", { enumerable: true, get: function () { return window_js_1.isAbstractWindowEthereum; } });
14
9
  async function signTypedData(args) {
15
10
  const { wallet, domain, types, primaryType, message } = args;
16
11
  let signature;
17
- if ((0, private_key_js_1.isValidPrivateKey)(wallet)) {
18
- signature = await (0, private_key_js_1.signTypedData)({
19
- privateKey: wallet,
20
- domain,
21
- types,
22
- primaryType,
23
- message,
24
- });
25
- }
26
- else if ((0, viem_js_1.isAbstractViemWalletClient)(wallet)) {
12
+ if ((0, viem_js_1.isAbstractViemWallet)(wallet)) {
27
13
  signature = await wallet.signTypedData({
28
14
  domain,
29
15
  types: {
@@ -39,20 +25,14 @@ async function signTypedData(args) {
39
25
  message,
40
26
  });
41
27
  }
42
- else if ((0, ethers_js_1.isAbstractEthersSigner)(wallet)) {
28
+ else if ((0, ethers_js_1.isAbstractEthersV6Signer)(wallet)) {
43
29
  signature = await wallet.signTypedData(domain, types, message);
44
30
  }
45
31
  else if ((0, ethers_js_1.isAbstractEthersV5Signer)(wallet)) {
46
32
  signature = await wallet._signTypedData(domain, types, message);
47
33
  }
48
- else if ((0, window_js_1.isAbstractWindowEthereum)(wallet)) {
49
- signature = await (0, window_js_1.signTypedDataWithWindowEthereum)({
50
- ethereum: wallet,
51
- domain,
52
- types,
53
- primaryType,
54
- message,
55
- });
34
+ else if ((0, private_key_js_1.isValidPrivateKey)(wallet)) {
35
+ signature = await (0, private_key_js_1.signTypedData)({ privateKey: wallet, domain, types, primaryType, message });
56
36
  }
57
37
  else {
58
38
  throw new Error("Unsupported wallet for signing typed data");
@@ -65,3 +45,48 @@ function splitSignature(signature) {
65
45
  const v = parseInt(signature.slice(130, 132), 16);
66
46
  return { r, s, v };
67
47
  }
48
+ /** Get the chain ID of the wallet. */
49
+ async function getWalletChainId(wallet) {
50
+ if ((0, viem_js_1.isAbstractViemWallet)(wallet)) {
51
+ if ("getChainId" in wallet && wallet.getChainId) {
52
+ const chainId = await wallet.getChainId();
53
+ return `0x${chainId.toString(16)}`;
54
+ }
55
+ else {
56
+ return "0x1";
57
+ }
58
+ }
59
+ else if ((0, ethers_js_1.isAbstractEthersV6Signer)(wallet) || (0, ethers_js_1.isAbstractEthersV5Signer)(wallet)) {
60
+ if ("provider" in wallet && wallet.provider) {
61
+ const network = await wallet.provider.getNetwork();
62
+ return `0x${network.chainId.toString(16)}`;
63
+ }
64
+ else {
65
+ return "0x1";
66
+ }
67
+ }
68
+ else {
69
+ return "0x1";
70
+ }
71
+ }
72
+ /** Get the wallet address from various wallet types. */
73
+ async function getWalletAddress(wallet) {
74
+ if ((0, viem_js_1.isAbstractViemWallet)(wallet)) {
75
+ if ("address" in wallet && wallet.address) {
76
+ return wallet.address;
77
+ }
78
+ else if ("getAddresses" in wallet && wallet.getAddresses) {
79
+ const addresses = await wallet.getAddresses();
80
+ return addresses[0];
81
+ }
82
+ }
83
+ else if ((0, ethers_js_1.isAbstractEthersV6Signer)(wallet) || (0, ethers_js_1.isAbstractEthersV5Signer)(wallet)) {
84
+ if ("getAddress" in wallet && wallet.getAddress) {
85
+ return await wallet.getAddress();
86
+ }
87
+ }
88
+ else if ((0, private_key_js_1.isValidPrivateKey)(wallet)) {
89
+ return (0, private_key_js_1.privateKeyToAddress)(wallet);
90
+ }
91
+ throw new Error("Unsupported wallet for getting address");
92
+ }
@@ -1,4 +1,3 @@
1
- type Hex = `0x${string}`;
2
1
  interface Types {
3
2
  [type: string]: {
4
3
  name: string;
@@ -8,9 +7,9 @@ interface Types {
8
7
  interface Domain extends Record<string, unknown> {
9
8
  name?: string;
10
9
  version?: string;
11
- chainId?: number | string | bigint | Hex;
12
- verifyingContract?: Hex;
13
- salt?: Hex;
10
+ chainId?: number | string | bigint | `0x${string}`;
11
+ verifyingContract?: `0x${string}`;
12
+ salt?: `0x${string}`;
14
13
  }
15
14
  /** Signs typed data with a private key. */
16
15
  export declare function signTypedData(args: {
@@ -19,8 +18,10 @@ export declare function signTypedData(args: {
19
18
  types: Types;
20
19
  primaryType: string;
21
20
  message: Record<string, unknown>;
22
- }): Promise<Hex>;
21
+ }): Promise<`0x${string}`>;
23
22
  /** Validates if a string is a valid secp256k1 private key. */
24
23
  export declare function isValidPrivateKey(privateKey: unknown): privateKey is string;
24
+ /** Converts a private key to an Ethereum address. */
25
+ export declare function privateKeyToAddress(privateKey: string): `0x${string}`;
25
26
  export {};
26
27
  //# sourceMappingURL=private_key.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"private_key.d.ts","sourceRoot":"","sources":["../../../../src/src/signing/_signTypedData/private_key.ts"],"names":[],"mappings":"AAGA,KAAK,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEzB,UAAU,KAAK;IACX,CAAC,IAAI,EAAE,MAAM,GAAG;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACP;AAED,UAAU,MAAO,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IACzC,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,IAAI,CAAC,EAAE,GAAG,CAAC;CACd;AAED,2CAA2C;AAC3C,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,OAAO,CAAC,GAAG,CAAC,CAkBf;AAuJD,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,MAAM,CAG3E"}
1
+ {"version":3,"file":"private_key.d.ts","sourceRoot":"","sources":["../../../../src/src/signing/_signTypedData/private_key.ts"],"names":[],"mappings":"AAGA,UAAU,KAAK;IACX,CAAC,IAAI,EAAE,MAAM,GAAG;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACP;AAED,UAAU,MAAO,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,MAAM,EAAE,CAAC;IACnD,iBAAiB,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;CACxB;AAED,2CAA2C;AAC3C,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAkBzB;AAsKD,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,MAAM,CAG3E;AAED,qDAAqD;AACrD,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAYrE"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signTypedData = signTypedData;
4
4
  exports.isValidPrivateKey = isValidPrivateKey;
5
+ exports.privateKeyToAddress = privateKeyToAddress;
5
6
  const sha3_1 = require("@noble/hashes/sha3");
6
7
  const secp256k1_1 = require("@noble/secp256k1");
7
8
  /** Signs typed data with a private key. */
@@ -51,20 +52,27 @@ function encodeType(primaryType, types) {
51
52
  const deps = findTypeDependencies(primaryType, types);
52
53
  const sortedDeps = [primaryType, ...deps.filter((d) => d !== primaryType).sort()];
53
54
  return sortedDeps
54
- .map((type) => `${type}(${types[type].map((field) => `${field.type} ${field.name}`).join(",")})`)
55
+ .map((type) => `${type}(${types[type].map((field) => `${resolveTypeAlias(field.type)} ${field.name}`).join(",")})`)
55
56
  .join("");
56
57
  }
57
- function findTypeDependencies(primaryType, types, found = new Set()) {
58
- if (found.has(primaryType) || !types[primaryType])
58
+ function resolveTypeAlias(type) {
59
+ if (type === "uint")
60
+ return "uint256";
61
+ if (type === "int")
62
+ return "int256";
63
+ return type;
64
+ }
65
+ function findTypeDependencies(primaryType, types, _found = new Set()) {
66
+ if (_found.has(primaryType) || !types[primaryType])
59
67
  return [];
60
- found.add(primaryType);
68
+ _found.add(primaryType);
61
69
  for (const field of types[primaryType]) {
62
- const baseType = field.type.replace(/\[\d*\]$/, "");
70
+ const baseType = field.type.replace(/\[.*?\]/g, "");
63
71
  if (types[baseType]) {
64
- findTypeDependencies(baseType, types, found);
72
+ findTypeDependencies(baseType, types, _found);
65
73
  }
66
74
  }
67
- return Array.from(found);
75
+ return Array.from(_found);
68
76
  }
69
77
  function encodeValue(type, value, types) {
70
78
  const arrayMatch = type.match(/^(.*)\[(\d*)\]$/);
@@ -72,10 +80,10 @@ function encodeValue(type, value, types) {
72
80
  // Extract type info: base type and optional length
73
81
  const [, baseType, len] = arrayMatch;
74
82
  if (!Array.isArray(value)) {
75
- throw new Error(`Expected array for ${type}, got ${typeof value}`);
83
+ throw new Error(`Expected array for ${type}. Received: ${typeof value}`);
76
84
  }
77
85
  if (len && value.length !== +len) {
78
- throw new Error(`Invalid length for ${type}: expected ${len}, got ${value.length}`);
86
+ throw new Error(`Invalid length for ${type}: expected ${len}. Received: ${value.length}`);
79
87
  }
80
88
  // Encode each element in the array and hash them together
81
89
  const encodedElements = value.map((v) => encodeValue(baseType, v, types));
@@ -91,8 +99,9 @@ function encodeValue(type, value, types) {
91
99
  }
92
100
  if (type === "address") {
93
101
  const bytes = secp256k1_1.etc.hexToBytes(cleanHex(value));
94
- if (bytes.length !== 20)
95
- throw new Error("address must be 20 bytes");
102
+ if (bytes.length !== 20) {
103
+ throw new Error(`Address must be 20 bytes.`);
104
+ }
96
105
  const padded = new Uint8Array(32);
97
106
  padded.set(bytes, 12);
98
107
  return padded;
@@ -100,9 +109,10 @@ function encodeValue(type, value, types) {
100
109
  if (type.startsWith("uint") || type.startsWith("int")) {
101
110
  // Extract type info: uint/int and bit size
102
111
  const isUint = type.startsWith("uint");
103
- const bits = parseInt(type.slice(isUint ? 4 : 3) || "256");
112
+ const bitsStr = type.slice(isUint ? 4 : 3);
113
+ const bits = parseInt(bitsStr || "256");
104
114
  if (bits > 256 || bits % 8 !== 0) {
105
- throw new Error(`Unsupported bit size for ${type}: ${bits}`);
115
+ throw new Error(`Invalid ${isUint ? "uint" : "int"} size: ${bitsStr}. Must be 8-256 in steps of 8`);
106
116
  }
107
117
  // Apply Two's complement for specified bit size
108
118
  const bigIntValue = BigInt(value);
@@ -124,18 +134,20 @@ function encodeValue(type, value, types) {
124
134
  if (bytesMatch) {
125
135
  // Extract type info: bytes size
126
136
  const size = parseInt(bytesMatch[1]);
127
- if (size === 0 || size > 32)
128
- throw new Error(`Unsupported bytes size: ${size}`);
137
+ if (size === 0 || size > 32) {
138
+ throw new Error(`bytesN size must be 1-32. Received: ${size}`);
139
+ }
129
140
  // Convert hex to bytes
130
141
  const bytes = secp256k1_1.etc.hexToBytes(cleanHex(value));
131
- if (bytes.length !== size)
132
- throw new Error(`Invalid length for ${type}: expected ${size}, got ${bytes.length}`);
142
+ if (bytes.length !== size) {
143
+ throw new Error(`${type} requires exactly ${size} bytes. Received: ${bytes.length} from '${value}'`);
144
+ }
133
145
  // Pad to 32 bytes
134
146
  const padded = new Uint8Array(32);
135
147
  padded.set(bytes, 0);
136
148
  return padded;
137
149
  }
138
- throw new Error(`Unsupported type: ${type}`);
150
+ throw new Error(`Unsupported type: '${type}'.`);
139
151
  }
140
152
  function cleanHex(hex) {
141
153
  return hex.startsWith("0x") ? hex.slice(2) : hex;
@@ -146,3 +158,13 @@ function isValidPrivateKey(privateKey) {
146
158
  return false;
147
159
  return secp256k1_1.utils.isValidPrivateKey(cleanHex(privateKey));
148
160
  }
161
+ /** Converts a private key to an Ethereum address. */
162
+ function privateKeyToAddress(privateKey) {
163
+ const cleanPrivKey = cleanHex(privateKey);
164
+ const publicKey = (0, secp256k1_1.getPublicKey)(cleanPrivKey, false);
165
+ const publicKeyWithoutPrefix = publicKey.slice(1);
166
+ const hash = (0, sha3_1.keccak_256)(publicKeyWithoutPrefix);
167
+ const addressBytes = hash.slice(-20);
168
+ const address = secp256k1_1.etc.bytesToHex(addressBytes);
169
+ return `0x${address}`;
170
+ }
@@ -1,12 +1,11 @@
1
- import type { Hex } from "../../base.js";
2
- /** Abstract interface for a [viem wallet](https://viem.sh/docs/clients/wallet). */
3
- export interface AbstractViemWalletClient {
1
+ /** Abstract interface for a viem {@link https://viem.sh/docs/accounts/jsonRpc#json-rpc-account | JSON-RPC Account}. */
2
+ export interface AbstractViemJsonRpcAccount {
4
3
  signTypedData(params: {
5
4
  domain: {
6
5
  name: string;
7
6
  version: string;
8
7
  chainId: number;
9
- verifyingContract: Hex;
8
+ verifyingContract: `0x${string}`;
10
9
  };
11
10
  types: {
12
11
  [key: string]: {
@@ -16,8 +15,30 @@ export interface AbstractViemWalletClient {
16
15
  };
17
16
  primaryType: string;
18
17
  message: Record<string, unknown>;
19
- }, options?: unknown): Promise<Hex>;
18
+ }, options?: unknown): Promise<`0x${string}`>;
19
+ getAddresses?(): Promise<`0x${string}`[]>;
20
+ getChainId?(): Promise<number>;
21
+ }
22
+ /** Abstract interface for a viem {@link https://viem.sh/docs/accounts/local | Local Account}. */
23
+ export interface AbstractViemLocalAccount {
24
+ signTypedData(params: {
25
+ domain: {
26
+ name: string;
27
+ version: string;
28
+ chainId: number;
29
+ verifyingContract: `0x${string}`;
30
+ };
31
+ types: {
32
+ [key: string]: {
33
+ name: string;
34
+ type: string;
35
+ }[];
36
+ };
37
+ primaryType: string;
38
+ message: Record<string, unknown>;
39
+ }, options?: unknown): Promise<`0x${string}`>;
40
+ address?: `0x${string}`;
20
41
  }
21
42
  /** Checks if the given value is an abstract viem wallet. */
22
- export declare function isAbstractViemWalletClient(client: unknown): client is AbstractViemWalletClient;
43
+ export declare function isAbstractViemWallet(client: unknown): client is AbstractViemJsonRpcAccount | AbstractViemLocalAccount;
23
44
  //# sourceMappingURL=viem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../../../src/src/signing/_signTypedData/viem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACrC,aAAa,CACT,MAAM,EAAE;QACJ,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,iBAAiB,EAAE,GAAG,CAAC;SAC1B,CAAC;QACF,KAAK,EAAE;YACH,CAAC,GAAG,EAAE,MAAM,GAAG;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;aAChB,EAAE,CAAC;SACP,CAAC;QACF,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,EACD,OAAO,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,GAAG,CAAC,CAAC;CACnB;AAED,4DAA4D;AAC5D,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,wBAAwB,CAI9F"}
1
+ {"version":3,"file":"viem.d.ts","sourceRoot":"","sources":["../../../../src/src/signing/_signTypedData/viem.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,MAAM,WAAW,0BAA0B;IACvC,aAAa,CACT,MAAM,EAAE;QACJ,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;SACpC,CAAC;QACF,KAAK,EAAE;YACH,CAAC,GAAG,EAAE,MAAM,GAAG;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;aAChB,EAAE,CAAC;SACP,CAAC;QACF,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,EACD,OAAO,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IAC1B,YAAY,CAAC,IAAI,OAAO,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;IAC1C,UAAU,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,iGAAiG;AACjG,MAAM,WAAW,wBAAwB;IACrC,aAAa,CACT,MAAM,EAAE;QACJ,MAAM,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;YAChB,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;SACpC,CAAC;QACF,KAAK,EAAE;YACH,CAAC,GAAG,EAAE,MAAM,GAAG;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC;aAChB,EAAE,CAAC;SACP,CAAC;QACF,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,EACD,OAAO,CAAC,EAAE,OAAO,GAClB,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;CAC3B;AAED,4DAA4D;AAC5D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,0BAA0B,GAAG,wBAAwB,CAIrH"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAbstractViemWalletClient = isAbstractViemWalletClient;
3
+ exports.isAbstractViemWallet = isAbstractViemWallet;
4
4
  /** Checks if the given value is an abstract viem wallet. */
5
- function isAbstractViemWalletClient(client) {
5
+ function isAbstractViemWallet(client) {
6
6
  return typeof client === "object" && client !== null &&
7
7
  "signTypedData" in client && typeof client.signTypedData === "function" &&
8
8
  (client.signTypedData.length === 1 || client.signTypedData.length === 2);
@@ -1,5 +1,8 @@
1
- import type { DeepImmutable } from "../base.js";
2
- import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ClaimRewardsRequest, ConvertToMultiSigUserRequest, 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";
1
+ import type { ApproveAgentRequest, ApproveBuilderFeeRequest, BatchModifyRequest, CancelByCloidRequest, CancelRequest, CDepositRequest, ClaimRewardsRequest, ConvertToMultiSigUserRequest, ConvertToMultiSigUserRequestWithoutStringify, CreateSubAccountRequest, CreateVaultRequest, CSignerActionRequest, CValidatorActionRequest, CWithdrawRequest, EvmUserModifyRequest, ModifyRequest, MultiSigRequest, OrderRequest, PerpDeployRequest, RegisterReferrerRequest, ReserveRequestWeightRequest, ScheduleCancelRequest, SetDisplayNameRequest, SetReferrerRequest, SpotDeployRequest, SpotSendRequest, SpotUserRequest, SubAccountModifyRequest, SubAccountSpotTransferRequest, SubAccountTransferRequest, TokenDelegateRequest, TwapCancelRequest, TwapOrderRequest, UpdateIsolatedMarginRequest, UpdateLeverageRequest, UsdClassTransferRequest, UsdSendRequest, VaultDistributeRequest, VaultModifyRequest, VaultTransferRequest, Withdraw3Request } from "../types/mod.js";
2
+ /** @see https://github.com/microsoft/TypeScript/issues/13923#issuecomment-2191862501 */
3
+ type DeepImmutable<T> = {
4
+ readonly [K in keyof T]: DeepImmutable<T[K]>;
5
+ };
3
6
  /** Action sorter and formatter for correct signature generation. */
4
7
  export declare const actionSorter: {
5
8
  approveAgent: (action: DeepImmutable<ApproveAgentRequest["action"]>) => ApproveAgentRequest["action"];
@@ -9,27 +12,26 @@ export declare const actionSorter: {
9
12
  cancelByCloid: (action: DeepImmutable<CancelByCloidRequest["action"]>) => CancelByCloidRequest["action"];
10
13
  cDeposit: (action: DeepImmutable<CDepositRequest["action"]>) => CDepositRequest["action"];
11
14
  claimRewards: (action: DeepImmutable<ClaimRewardsRequest["action"]>) => ClaimRewardsRequest["action"];
12
- convertToMultiSigUser: (action: DeepImmutable<ConvertToMultiSigUserRequest["action"]>) => ConvertToMultiSigUserRequest["action"];
15
+ convertToMultiSigUser: (action: DeepImmutable<ConvertToMultiSigUserRequest["action"] | ConvertToMultiSigUserRequestWithoutStringify["action"]>) => ConvertToMultiSigUserRequest["action"];
13
16
  createSubAccount: (action: DeepImmutable<CreateSubAccountRequest["action"]>) => CreateSubAccountRequest["action"];
14
17
  createVault: (action: DeepImmutable<CreateVaultRequest["action"]>) => CreateVaultRequest["action"];
15
- CSignerAction: (action: DeepImmutable<CSignerActionRequest_JailSelf["action"]> | DeepImmutable<CSignerActionRequest_UnjailSelf["action"]>) => CSignerActionRequest_JailSelf["action"] | CSignerActionRequest_UnjailSelf["action"];
16
- CValidatorAction: (action: DeepImmutable<CValidatorActionRequest_ChangeProfile["action"]> | DeepImmutable<CValidatorActionRequest_Register["action"]> | DeepImmutable<CValidatorActionRequest_Unregister["action"]>) => CValidatorActionRequest_ChangeProfile["action"] | CValidatorActionRequest_Register["action"] | CValidatorActionRequest_Unregister["action"];
18
+ CSignerAction: (action: DeepImmutable<CSignerActionRequest["action"]>) => CSignerActionRequest["action"];
19
+ CValidatorAction: (action: DeepImmutable<CValidatorActionRequest["action"]>) => CValidatorActionRequest["action"];
17
20
  cWithdraw: (action: DeepImmutable<CWithdrawRequest["action"]>) => CWithdrawRequest["action"];
18
21
  evmUserModify: (action: DeepImmutable<EvmUserModifyRequest["action"]>) => EvmUserModifyRequest["action"];
19
22
  modify: (action: DeepImmutable<ModifyRequest["action"]>) => ModifyRequest["action"];
20
23
  multiSig: (action: DeepImmutable<MultiSigRequest["action"]>) => MultiSigRequest["action"];
21
24
  order: (action: DeepImmutable<OrderRequest["action"]>) => OrderRequest["action"];
22
- perpDeploy: (action: DeepImmutable<PerpDeployRequest_RegisterAsset["action"]> | DeepImmutable<PerpDeployRequest_SetOracle["action"]>) => PerpDeployRequest_RegisterAsset["action"] | PerpDeployRequest_SetOracle["action"];
23
- PerpDexClassTransfer: (action: DeepImmutable<PerpDexClassTransferRequest["action"]>) => PerpDexClassTransferRequest["action"];
24
- PerpDexTransfer: (action: DeepImmutable<PerpDexTransferRequest["action"]>) => PerpDexTransferRequest["action"];
25
+ perpDeploy: (action: DeepImmutable<PerpDeployRequest["action"]>) => PerpDeployRequest["action"];
25
26
  registerReferrer: (action: DeepImmutable<RegisterReferrerRequest["action"]>) => RegisterReferrerRequest["action"];
26
27
  reserveRequestWeight: (action: DeepImmutable<ReserveRequestWeightRequest["action"]>) => ReserveRequestWeightRequest["action"];
27
28
  scheduleCancel: (action: DeepImmutable<ScheduleCancelRequest["action"]>) => ScheduleCancelRequest["action"];
28
29
  setDisplayName: (action: DeepImmutable<SetDisplayNameRequest["action"]>) => SetDisplayNameRequest["action"];
29
30
  setReferrer: (action: DeepImmutable<SetReferrerRequest["action"]>) => SetReferrerRequest["action"];
30
- spotDeploy: (action: DeepImmutable<SpotDeployRequest_Genesis["action"]> | DeepImmutable<SpotDeployRequest_RegisterHyperliquidity["action"]> | DeepImmutable<SpotDeployRequest_RegisterSpot["action"]> | DeepImmutable<SpotDeployRequest_RegisterToken2["action"]> | DeepImmutable<SpotDeployRequest_SetDeployerTradingFeeShare["action"]> | DeepImmutable<SpotDeployRequest_UserGenesis["action"]>) => SpotDeployRequest_Genesis["action"] | SpotDeployRequest_RegisterHyperliquidity["action"] | SpotDeployRequest_RegisterSpot["action"] | SpotDeployRequest_RegisterToken2["action"] | SpotDeployRequest_SetDeployerTradingFeeShare["action"] | SpotDeployRequest_UserGenesis["action"];
31
+ spotDeploy: (action: DeepImmutable<SpotDeployRequest["action"]>) => SpotDeployRequest["action"];
31
32
  spotSend: (action: DeepImmutable<SpotSendRequest["action"]>) => SpotSendRequest["action"];
32
33
  spotUser: (action: DeepImmutable<SpotUserRequest["action"]>) => SpotUserRequest["action"];
34
+ subAccountModify: (action: DeepImmutable<SubAccountModifyRequest["action"]>) => SubAccountModifyRequest["action"];
33
35
  subAccountSpotTransfer: (action: DeepImmutable<SubAccountSpotTransferRequest["action"]>) => SubAccountSpotTransferRequest["action"];
34
36
  subAccountTransfer: (action: DeepImmutable<SubAccountTransferRequest["action"]>) => SubAccountTransferRequest["action"];
35
37
  tokenDelegate: (action: DeepImmutable<TokenDelegateRequest["action"]>) => TokenDelegateRequest["action"];
@@ -76,18 +78,6 @@ export declare const userSignedActionEip712Types: {
76
78
  type: string;
77
79
  }[];
78
80
  };
79
- PerpDexClassTransfer: {
80
- "HyperliquidTransaction:PerpDexClassTransfer": {
81
- name: string;
82
- type: string;
83
- }[];
84
- };
85
- PerpDexTransfer: {
86
- "HyperliquidTransaction:PerpDexTransfer": {
87
- name: string;
88
- type: string;
89
- }[];
90
- };
91
81
  multiSig: {
92
82
  "HyperliquidTransaction:SendMultiSig": {
93
83
  name: string;
@@ -125,4 +115,5 @@ export declare const userSignedActionEip712Types: {
125
115
  }[];
126
116
  };
127
117
  };
118
+ export {};
128
119
  //# sourceMappingURL=_sorter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_sorter.d.ts","sourceRoot":"","sources":["../../../src/src/signing/_sorter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAO,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EACR,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,eAA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agentAddress.toLowerCase(),
12
- agentName: action.agentName ?? "",
12
+ agentName: action.agentName,
13
13
  nonce: action.nonce,
14
14
  };
15
15
  },
@@ -94,7 +94,10 @@ exports.actionSorter = {
94
94
  type: action.type,
95
95
  signatureChainId: action.signatureChainId,
96
96
  hyperliquidChain: action.hyperliquidChain,
97
- signers: action.signers, // key order is not important
97
+ signers: typeof action.signers === "string" ? action.signers : JSON.stringify(action.signers === null ? action.signers : {
98
+ authorizedUsers: action.signers.authorizedUsers,
99
+ threshold: action.signers.threshold,
100
+ }),
98
101
  nonce: action.nonce,
99
102
  };
100
103
  },
@@ -132,13 +135,13 @@ exports.actionSorter = {
132
135
  return {
133
136
  type: action.type,
134
137
  changeProfile: {
135
- node_ip: action.changeProfile.node_ip ?? null,
136
- name: action.changeProfile.name ?? null,
137
- description: action.changeProfile.description ?? null,
138
+ node_ip: action.changeProfile.node_ip,
139
+ name: action.changeProfile.name,
140
+ description: action.changeProfile.description,
138
141
  unjailed: action.changeProfile.unjailed,
139
- disable_delegations: action.changeProfile.disable_delegations ?? null,
140
- commission_bps: action.changeProfile.commission_bps ?? null,
141
- signer: action.changeProfile.signer?.toLowerCase() ?? null,
142
+ disable_delegations: action.changeProfile.disable_delegations,
143
+ commission_bps: action.changeProfile.commission_bps,
144
+ signer: action.changeProfile.signer?.toLowerCase(),
142
145
  },
143
146
  };
144
147
  }
@@ -161,7 +164,7 @@ exports.actionSorter = {
161
164
  },
162
165
  };
163
166
  }
164
- else { // "unregister" in action
167
+ else {
165
168
  return {
166
169
  type: action.type,
167
170
  unregister: action.unregister,
@@ -225,7 +228,9 @@ exports.actionSorter = {
225
228
  payload: {
226
229
  multiSigUser: action.payload.multiSigUser.toLowerCase(),
227
230
  outerSigner: action.payload.outerSigner.toLowerCase(),
228
- action: structuredClone(action.payload.action),
231
+ action: exports.actionSorter[action.payload.action.type](
232
+ // @ts-ignore - TypeScript cannot infer the type correctly
233
+ action.payload.action),
229
234
  },
230
235
  };
231
236
  },
@@ -275,7 +280,7 @@ exports.actionSorter = {
275
280
  return {
276
281
  type: action.type,
277
282
  registerAsset: {
278
- maxGas: action.registerAsset.maxGas ?? null,
283
+ maxGas: action.registerAsset.maxGas,
279
284
  assetRequest: {
280
285
  coin: action.registerAsset.assetRequest.coin,
281
286
  szDecimals: action.registerAsset.assetRequest.szDecimals,
@@ -288,9 +293,9 @@ exports.actionSorter = {
288
293
  ? {
289
294
  fullName: action.registerAsset.schema.fullName,
290
295
  collateralToken: action.registerAsset.schema.collateralToken,
291
- oracleUpdater: action.registerAsset.schema.oracleUpdater?.toLowerCase() ?? null,
296
+ oracleUpdater: action.registerAsset.schema.oracleUpdater?.toLowerCase(),
292
297
  }
293
- : null,
298
+ : action.registerAsset.schema,
294
299
  },
295
300
  };
296
301
  }
@@ -300,34 +305,11 @@ exports.actionSorter = {
300
305
  setOracle: {
301
306
  dex: action.setOracle.dex,
302
307
  oraclePxs: action.setOracle.oraclePxs.map((el) => [...el]),
303
- markPxs: action.setOracle.markPxs.map((el) => [...el]),
308
+ markPxs: action.setOracle.markPxs.map((el) => el.map((el2) => [...el2])),
304
309
  },
305
310
  };
306
311
  }
307
312
  },
308
- PerpDexClassTransfer: (action) => {
309
- return {
310
- type: action.type,
311
- signatureChainId: action.signatureChainId,
312
- hyperliquidChain: action.hyperliquidChain,
313
- dex: action.dex,
314
- token: action.token,
315
- amount: action.amount,
316
- toPerp: action.toPerp,
317
- nonce: action.nonce,
318
- };
319
- },
320
- PerpDexTransfer: (action) => {
321
- return {
322
- type: action.type,
323
- signatureChainId: action.signatureChainId,
324
- hyperliquidChain: action.hyperliquidChain,
325
- sourceDex: action.sourceDex,
326
- destinationDex: action.destinationDex,
327
- amount: action.amount,
328
- nonce: action.nonce,
329
- };
330
- },
331
313
  registerReferrer: (action) => {
332
314
  return {
333
315
  type: action.type,
@@ -371,9 +353,8 @@ exports.actionSorter = {
371
353
  noHyperliquidity: action.genesis.noHyperliquidity,
372
354
  },
373
355
  };
374
- if (sortedAction.genesis.noHyperliquidity === undefined) {
356
+ if (sortedAction.genesis.noHyperliquidity === undefined)
375
357
  delete sortedAction.genesis.noHyperliquidity;
376
- }
377
358
  return sortedAction;
378
359
  }
379
360
  else if ("registerHyperliquidity" in action) {
@@ -413,9 +394,8 @@ exports.actionSorter = {
413
394
  fullName: action.registerToken2.fullName,
414
395
  },
415
396
  };
416
- if (sortedAction.registerToken2.fullName === undefined) {
397
+ if (sortedAction.registerToken2.fullName === undefined)
417
398
  delete sortedAction.registerToken2.fullName;
418
- }
419
399
  return sortedAction;
420
400
  }
421
401
  else if ("setDeployerTradingFeeShare" in action) {
@@ -427,7 +407,7 @@ exports.actionSorter = {
427
407
  },
428
408
  };
429
409
  }
430
- else { // "userGenesis" in action
410
+ else {
431
411
  const sortedAction = {
432
412
  type: action.type,
433
413
  userGenesis: {
@@ -437,9 +417,8 @@ exports.actionSorter = {
437
417
  blacklistUsers: action.userGenesis.blacklistUsers?.map((el) => [...el]),
438
418
  },
439
419
  };
440
- if (sortedAction.userGenesis.blacklistUsers === undefined) {
420
+ if (sortedAction.userGenesis.blacklistUsers === undefined)
441
421
  delete sortedAction.userGenesis.blacklistUsers;
442
- }
443
422
  return sortedAction;
444
423
  }
445
424
  },
@@ -462,6 +441,13 @@ exports.actionSorter = {
462
441
  },
463
442
  };
464
443
  },
444
+ subAccountModify: (action) => {
445
+ return {
446
+ type: action.type,
447
+ subAccountUser: action.subAccountUser.toLowerCase(),
448
+ name: action.name,
449
+ };
450
+ },
465
451
  subAccountSpotTransfer: (action) => {
466
452
  return {
467
453
  type: action.type,
@@ -627,25 +613,6 @@ exports.userSignedActionEip712Types = {
627
613
  { name: "nonce", type: "uint64" },
628
614
  ],
629
615
  },
630
- PerpDexClassTransfer: {
631
- "HyperliquidTransaction:PerpDexClassTransfer": [
632
- { name: "hyperliquidChain", type: "string" },
633
- { name: "dex", type: "string" },
634
- { name: "token", type: "string" },
635
- { name: "amount", type: "string" },
636
- { name: "toPerp", type: "bool" },
637
- { name: "nonce", type: "uint64" },
638
- ],
639
- },
640
- PerpDexTransfer: {
641
- "HyperliquidTransaction:PerpDexTransfer": [
642
- { name: "hyperliquidChain", type: "string" },
643
- { name: "sourceDex", type: "string" },
644
- { name: "destinationDex", type: "string" },
645
- { name: "amount", type: "string" },
646
- { name: "nonce", type: "uint64" },
647
- ],
648
- },
649
616
  multiSig: {
650
617
  "HyperliquidTransaction:SendMultiSig": [
651
618
  { name: "hyperliquidChain", type: "string" },