@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.
- package/README.md +84 -27
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/src/clients/exchange.d.ts +136 -166
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +122 -147
- package/esm/src/clients/multiSign.d.ts +129 -282
- package/esm/src/clients/multiSign.d.ts.map +1 -1
- package/esm/src/clients/multiSign.js +125 -246
- package/esm/src/signing/_ethers.d.ts +33 -0
- package/esm/src/signing/_ethers.d.ts.map +1 -0
- package/esm/src/signing/_ethers.js +12 -0
- package/esm/src/signing/_private_key.d.ts +22 -0
- package/esm/src/signing/_private_key.d.ts.map +1 -0
- package/esm/src/signing/_private_key.js +124 -0
- package/esm/src/signing/_sorter.d.ts +154 -0
- package/esm/src/signing/_sorter.d.ts.map +1 -0
- package/esm/src/{signing.js → signing/_sorter.js} +1 -401
- package/esm/src/signing/_viem.d.ts +23 -0
- package/esm/src/signing/_viem.d.ts.map +1 -0
- package/esm/src/signing/_viem.js +6 -0
- package/esm/src/signing/_window.d.ts +23 -0
- package/esm/src/signing/_window.d.ts.map +1 -0
- package/esm/src/signing/_window.js +29 -0
- package/esm/src/signing/mod.d.ts +251 -0
- package/esm/src/signing/mod.d.ts.map +1 -0
- package/esm/src/signing/mod.js +352 -0
- package/esm/src/types/exchange/requests.d.ts +1 -1
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/package.json +6 -5
- package/script/mod.d.ts +1 -1
- package/script/mod.d.ts.map +1 -1
- package/script/src/clients/exchange.d.ts +136 -166
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +206 -231
- package/script/src/clients/multiSign.d.ts +129 -282
- package/script/src/clients/multiSign.d.ts.map +1 -1
- package/script/src/clients/multiSign.js +170 -291
- package/script/src/signing/_ethers.d.ts +33 -0
- package/script/src/signing/_ethers.d.ts.map +1 -0
- package/script/src/signing/_ethers.js +26 -0
- package/script/src/signing/_private_key.d.ts +22 -0
- package/script/src/signing/_private_key.d.ts.map +1 -0
- package/script/src/signing/_private_key.js +138 -0
- package/script/src/signing/_sorter.d.ts +154 -0
- package/script/src/signing/_sorter.d.ts.map +1 -0
- package/script/src/{signing.js → signing/_sorter.js} +2 -410
- package/script/src/signing/_viem.d.ts +23 -0
- package/script/src/signing/_viem.d.ts.map +1 -0
- package/script/src/signing/_viem.js +19 -0
- package/script/src/signing/_window.d.ts +23 -0
- package/script/src/signing/_window.d.ts.map +1 -0
- package/script/src/signing/_window.js +43 -0
- package/script/src/signing/mod.d.ts +251 -0
- package/script/src/signing/mod.d.ts.map +1 -0
- package/script/src/signing/mod.js +387 -0
- package/script/src/types/exchange/requests.d.ts +1 -1
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/signing.d.ts +0 -463
- package/esm/src/signing.d.ts.map +0 -1
- package/script/src/signing.d.ts +0 -463
- package/script/src/signing.d.ts.map +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Abstract interface for an [ethers.js signer](https://docs.ethers.org/v6/api/providers/#Signer). */
|
|
2
|
+
export interface AbstractEthersSigner {
|
|
3
|
+
signTypedData(domain: {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
chainId: number;
|
|
7
|
+
verifyingContract: string;
|
|
8
|
+
}, types: {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
}, value: Record<string, unknown>): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
/** Abstract interface for an [ethers.js v5 signer](https://docs.ethers.org/v5/api/signer/). */
|
|
16
|
+
export interface AbstractEthersV5Signer {
|
|
17
|
+
_signTypedData(domain: {
|
|
18
|
+
name: string;
|
|
19
|
+
version: string;
|
|
20
|
+
chainId: number;
|
|
21
|
+
verifyingContract: string;
|
|
22
|
+
}, types: {
|
|
23
|
+
[key: string]: {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
}[];
|
|
27
|
+
}, value: Record<string, unknown>): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
/** Checks if the given value is an abstract ethers signer. */
|
|
30
|
+
export declare function isAbstractEthersSigner(client: unknown): client is AbstractEthersSigner;
|
|
31
|
+
/** Checks if the given value is an abstract ethers v5 signer. */
|
|
32
|
+
export declare function isAbstractEthersV5Signer(client: unknown): client is AbstractEthersV5Signer;
|
|
33
|
+
//# sourceMappingURL=_ethers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_ethers.d.ts","sourceRoot":"","sources":["../../../src/src/signing/_ethers.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,MAAM,WAAW,oBAAoB;IACjC,aAAa,CACT,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;KAC7B,EACD,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG;YACX,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;KACP,EACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,+FAA+F;AAC/F,MAAM,WAAW,sBAAsB;IACnC,cAAc,CACV,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;KAC7B,EACD,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG;YACX,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;KACP,EACD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,oBAAoB,CAItF;AAED,iEAAiE;AACjE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,sBAAsB,CAI1F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.isAbstractEthersSigner = isAbstractEthersSigner;
|
|
13
|
+
exports.isAbstractEthersV5Signer = isAbstractEthersV5Signer;
|
|
14
|
+
/** Checks if the given value is an abstract ethers signer. */
|
|
15
|
+
function isAbstractEthersSigner(client) {
|
|
16
|
+
return typeof client === "object" && client !== null &&
|
|
17
|
+
"signTypedData" in client && typeof client.signTypedData === "function" &&
|
|
18
|
+
client.signTypedData.length === 3;
|
|
19
|
+
}
|
|
20
|
+
/** Checks if the given value is an abstract ethers v5 signer. */
|
|
21
|
+
function isAbstractEthersV5Signer(client) {
|
|
22
|
+
return typeof client === "object" && client !== null &&
|
|
23
|
+
"_signTypedData" in client && typeof client._signTypedData === "function" &&
|
|
24
|
+
client._signTypedData.length === 3;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Hex } from "../base.js";
|
|
2
|
+
/** Signs typed data (EIP-712) with a private key. */
|
|
3
|
+
export declare function signTypedDataWithPrivateKey(args: {
|
|
4
|
+
privateKey: string;
|
|
5
|
+
domain: {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
chainId: number;
|
|
9
|
+
verifyingContract: Hex;
|
|
10
|
+
};
|
|
11
|
+
types: {
|
|
12
|
+
[key: string]: {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
primaryType: string;
|
|
18
|
+
message: Record<string, unknown>;
|
|
19
|
+
}): Promise<Hex>;
|
|
20
|
+
/** Validates if a string is a valid secp256k1 private key. */
|
|
21
|
+
export declare function isValidPrivateKey(privateKey: unknown): privateKey is string;
|
|
22
|
+
//# sourceMappingURL=_private_key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_private_key.d.ts","sourceRoot":"","sources":["../../../src/src/signing/_private_key.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,qDAAqD;AACrD,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,GAAG,CAAC;KAC1B,CAAC;IACF,KAAK,EAAE;QACH,CAAC,GAAG,EAAE,MAAM,GAAG;YACX,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;KACP,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,GAAG,OAAO,CAAC,GAAG,CAAC,CAiCf;AA8GD,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,IAAI,MAAM,CAQ3E"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@noble/hashes/sha3", "@noble/secp256k1", "../../deps/jsr.io/@std/encoding/1.0.10/hex.js", "../../deps/jsr.io/@std/bytes/1.0.6/concat.js"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.signTypedDataWithPrivateKey = signTypedDataWithPrivateKey;
|
|
13
|
+
exports.isValidPrivateKey = isValidPrivateKey;
|
|
14
|
+
const sha3_1 = require("@noble/hashes/sha3");
|
|
15
|
+
const secp256k1_1 = require("@noble/secp256k1");
|
|
16
|
+
const hex_js_1 = require("../../deps/jsr.io/@std/encoding/1.0.10/hex.js");
|
|
17
|
+
const concat_js_1 = require("../../deps/jsr.io/@std/bytes/1.0.6/concat.js");
|
|
18
|
+
/** Signs typed data (EIP-712) with a private key. */
|
|
19
|
+
async function signTypedDataWithPrivateKey(args) {
|
|
20
|
+
const { privateKey, domain, types, primaryType, message } = args;
|
|
21
|
+
// 1. Create a complete set of types, including EIP712Domain
|
|
22
|
+
const fullTypes = {
|
|
23
|
+
EIP712Domain: [
|
|
24
|
+
{ name: "name", type: "string" },
|
|
25
|
+
{ name: "version", type: "string" },
|
|
26
|
+
{ name: "chainId", type: "uint256" },
|
|
27
|
+
{ name: "verifyingContract", type: "address" },
|
|
28
|
+
],
|
|
29
|
+
...types,
|
|
30
|
+
};
|
|
31
|
+
// 2. Calculate `domainSeparator`
|
|
32
|
+
const domainSeparator = hashStruct("EIP712Domain", domain, fullTypes);
|
|
33
|
+
// 3. Calculate the message hash
|
|
34
|
+
const messageHash = hashStruct(primaryType, message, fullTypes);
|
|
35
|
+
// 4. Forming the final hash
|
|
36
|
+
const finalHash = (0, sha3_1.keccak_256)((0, concat_js_1.concat)([new Uint8Array([0x19, 0x01]), domainSeparator, messageHash]));
|
|
37
|
+
// 5. Sign the final hash
|
|
38
|
+
const cleanPrivateKey = privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
|
|
39
|
+
const signature = await (0, secp256k1_1.signAsync)(finalHash, cleanPrivateKey);
|
|
40
|
+
// 6. Format the signature
|
|
41
|
+
const r = signature.r.toString(16).padStart(64, "0");
|
|
42
|
+
const s = signature.s.toString(16).padStart(64, "0");
|
|
43
|
+
const v = (signature.recovery + 27).toString(16).padStart(2, "0");
|
|
44
|
+
return `0x${r}${s}${v}`;
|
|
45
|
+
}
|
|
46
|
+
/** Finds all dependent structure types for a given type. */
|
|
47
|
+
function findTypeDependencies(primaryType, types, found = new Set()) {
|
|
48
|
+
if (found.has(primaryType) || !types[primaryType]) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
found.add(primaryType);
|
|
52
|
+
for (const field of types[primaryType]) {
|
|
53
|
+
const baseType = field.type.replace(/\[\]$/, "");
|
|
54
|
+
if (types[baseType]) {
|
|
55
|
+
findTypeDependencies(baseType, types, found);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return Array.from(found);
|
|
59
|
+
}
|
|
60
|
+
/** Encodes the type definition into a string according to EIP-712. */
|
|
61
|
+
function encodeType(primaryType, types) {
|
|
62
|
+
const deps = findTypeDependencies(primaryType, types);
|
|
63
|
+
const sortedDeps = [primaryType, ...deps.filter((d) => d !== primaryType).sort()];
|
|
64
|
+
return sortedDeps
|
|
65
|
+
.map((type) => `${type}(${types[type].map((field) => `${field.type} ${field.name}`).join(",")})`)
|
|
66
|
+
.join("");
|
|
67
|
+
}
|
|
68
|
+
/** Encodes a single value into a 32-byte Uint8Array according to EIP-712 rules. */
|
|
69
|
+
function encodeValue(type, value, allTypes) {
|
|
70
|
+
if (type.endsWith("[]")) {
|
|
71
|
+
if (!Array.isArray(value)) {
|
|
72
|
+
throw new Error(`Expected array for type ${type}, but got ${typeof value}`);
|
|
73
|
+
}
|
|
74
|
+
const baseType = type.slice(0, -2);
|
|
75
|
+
const encodedElements = value.map((item) => encodeValue(baseType, item, allTypes));
|
|
76
|
+
return (0, sha3_1.keccak_256)((0, concat_js_1.concat)(encodedElements));
|
|
77
|
+
}
|
|
78
|
+
if (allTypes[type]) {
|
|
79
|
+
return hashStruct(type, value, allTypes);
|
|
80
|
+
}
|
|
81
|
+
if (type === "string") {
|
|
82
|
+
return (0, sha3_1.keccak_256)(new TextEncoder().encode(value));
|
|
83
|
+
}
|
|
84
|
+
if (type === "bytes") {
|
|
85
|
+
return (0, sha3_1.keccak_256)(value);
|
|
86
|
+
}
|
|
87
|
+
if (type === "bytes32") {
|
|
88
|
+
return (0, hex_js_1.decodeHex)(value.slice(2).padStart(64, "0"));
|
|
89
|
+
}
|
|
90
|
+
if (type === "address") {
|
|
91
|
+
const padded = new Uint8Array(32);
|
|
92
|
+
padded.set((0, hex_js_1.decodeHex)(value.slice(2)), 12);
|
|
93
|
+
return padded;
|
|
94
|
+
}
|
|
95
|
+
if (type.startsWith("uint") || type.startsWith("int")) {
|
|
96
|
+
const bigIntValue = BigInt(value);
|
|
97
|
+
const bits = parseInt(type.slice(type.startsWith("u") ? 4 : 3) || "256", 10);
|
|
98
|
+
const signedValue = type.startsWith("int")
|
|
99
|
+
? BigInt.asIntN(bits, bigIntValue)
|
|
100
|
+
: BigInt.asUintN(bits, bigIntValue);
|
|
101
|
+
let hex = signedValue.toString(16);
|
|
102
|
+
if (hex.length % 2)
|
|
103
|
+
hex = "0" + hex;
|
|
104
|
+
if (signedValue < 0) {
|
|
105
|
+
while (hex.length < 64)
|
|
106
|
+
hex = "f" + hex;
|
|
107
|
+
hex = hex.slice(-64);
|
|
108
|
+
}
|
|
109
|
+
const bytes = (0, hex_js_1.decodeHex)(hex);
|
|
110
|
+
const result = new Uint8Array(32).fill(0);
|
|
111
|
+
result.set(bytes, 32 - bytes.length);
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
if (type === "bool") {
|
|
115
|
+
const result = new Uint8Array(32);
|
|
116
|
+
result[31] = value ? 1 : 0;
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
throw new Error(`Unsupported type: ${type}`);
|
|
120
|
+
}
|
|
121
|
+
/** Hashes a data structure according to EIP-712. */
|
|
122
|
+
function hashStruct(primaryType, data, types) {
|
|
123
|
+
const typeHash = (0, sha3_1.keccak_256)(new TextEncoder().encode(encodeType(primaryType, types)));
|
|
124
|
+
const fields = types[primaryType];
|
|
125
|
+
const encodedValues = fields.map((field) => encodeValue(field.type, data[field.name], types));
|
|
126
|
+
return (0, sha3_1.keccak_256)((0, concat_js_1.concat)([typeHash, ...encodedValues]));
|
|
127
|
+
}
|
|
128
|
+
/** Validates if a string is a valid secp256k1 private key. */
|
|
129
|
+
function isValidPrivateKey(privateKey) {
|
|
130
|
+
if (typeof privateKey !== "string")
|
|
131
|
+
return false;
|
|
132
|
+
const cleanKey = privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
|
|
133
|
+
if (cleanKey.length !== 64 || !/^[0-9a-fA-F]+$/.test(cleanKey))
|
|
134
|
+
return false;
|
|
135
|
+
const keyBigInt = BigInt("0x" + cleanKey);
|
|
136
|
+
return keyBigInt > 0n && keyBigInt < secp256k1_1.CURVE.n;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
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, 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";
|
|
2
|
+
/** Action sorter for correct signature generation. */
|
|
3
|
+
export declare const actionSorter: {
|
|
4
|
+
/** Sorts and formats an `approveAgent` action. */
|
|
5
|
+
approveAgent: (action: ApproveAgentRequest["action"]) => ApproveAgentRequest["action"];
|
|
6
|
+
/** Sorts and formats an `approveBuilderFee` action. */
|
|
7
|
+
approveBuilderFee: (action: ApproveBuilderFeeRequest["action"]) => ApproveBuilderFeeRequest["action"];
|
|
8
|
+
/** Sorts and formats a `batchModify` action. */
|
|
9
|
+
batchModify: (action: BatchModifyRequest["action"]) => BatchModifyRequest["action"];
|
|
10
|
+
/** Sorts and formats a `cancel` action. */
|
|
11
|
+
cancel: (action: CancelRequest["action"]) => CancelRequest["action"];
|
|
12
|
+
/** Sorts and formats a `cancelByCloid` action. */
|
|
13
|
+
cancelByCloid: (action: CancelByCloidRequest["action"]) => CancelByCloidRequest["action"];
|
|
14
|
+
/** Sorts and formats a `cDeposit` action. */
|
|
15
|
+
cDeposit: (action: CDepositRequest["action"]) => CDepositRequest["action"];
|
|
16
|
+
/** Sorts and formats a `claimRewards` action. */
|
|
17
|
+
claimRewards: (action: ClaimRewardsRequest["action"]) => ClaimRewardsRequest["action"];
|
|
18
|
+
/** Sorts and formats a `convertToMultiSigUser` action. */
|
|
19
|
+
convertToMultiSigUser: (action: ConvertToMultiSigUserRequest["action"]) => ConvertToMultiSigUserRequest["action"];
|
|
20
|
+
/** Sorts and formats a `createSubAccount` action. */
|
|
21
|
+
createSubAccount: (action: CreateSubAccountRequest["action"]) => CreateSubAccountRequest["action"];
|
|
22
|
+
/** Sorts and formats a `createVault` action. */
|
|
23
|
+
createVault: (action: CreateVaultRequest["action"]) => CreateVaultRequest["action"];
|
|
24
|
+
/** Sorts and formats a `CSignerAction` action (jail/unjail). */
|
|
25
|
+
CSignerAction: (action: CSignerActionRequest_JailSelf["action"] | CSignerActionRequest_UnjailSelf["action"]) => CSignerActionRequest_JailSelf["action"] | CSignerActionRequest_UnjailSelf["action"];
|
|
26
|
+
/** Sorts and formats a `CValidatorAction` action (register/unregister/change profile). */
|
|
27
|
+
CValidatorAction: (action: CValidatorActionRequest_ChangeProfile["action"] | CValidatorActionRequest_Register["action"] | CValidatorActionRequest_Unregister["action"]) => CValidatorActionRequest_ChangeProfile["action"] | CValidatorActionRequest_Register["action"] | CValidatorActionRequest_Unregister["action"];
|
|
28
|
+
/** Sorts and formats a `cWithdraw` action. */
|
|
29
|
+
cWithdraw: (action: CWithdrawRequest["action"]) => CWithdrawRequest["action"];
|
|
30
|
+
/** Sorts and formats an `evmUserModify` action. */
|
|
31
|
+
evmUserModify: (action: EvmUserModifyRequest["action"]) => EvmUserModifyRequest["action"];
|
|
32
|
+
/** Sorts and formats a `modify` action. */
|
|
33
|
+
modify: (action: ModifyRequest["action"]) => ModifyRequest["action"];
|
|
34
|
+
/** Sorts and formats a `multiSig` action. */
|
|
35
|
+
multiSig: (action: MultiSigRequest["action"]) => MultiSigRequest["action"];
|
|
36
|
+
/** Sorts and formats an `order` action. */
|
|
37
|
+
order: (action: OrderRequest["action"]) => OrderRequest["action"];
|
|
38
|
+
/** Sorts and formats a `perpDeploy` action. */
|
|
39
|
+
perpDeploy: (action: PerpDeployRequest_RegisterAsset["action"] | PerpDeployRequest_SetOracle["action"]) => PerpDeployRequest_RegisterAsset["action"] | PerpDeployRequest_SetOracle["action"];
|
|
40
|
+
/** Sorts and formats a `PerpDexClassTransfer` action. */
|
|
41
|
+
PerpDexClassTransfer: (action: PerpDexClassTransferRequest["action"]) => PerpDexClassTransferRequest["action"];
|
|
42
|
+
/** Sorts and formats a `registerReferrer` action. */
|
|
43
|
+
registerReferrer: (action: RegisterReferrerRequest["action"]) => RegisterReferrerRequest["action"];
|
|
44
|
+
/** Sorts and formats a `reserveRequestWeight` action. */
|
|
45
|
+
reserveRequestWeight: (action: ReserveRequestWeightRequest["action"]) => ReserveRequestWeightRequest["action"];
|
|
46
|
+
/** Sorts and formats a `scheduleCancel` action. */
|
|
47
|
+
scheduleCancel: (action: ScheduleCancelRequest["action"]) => ScheduleCancelRequest["action"];
|
|
48
|
+
/** Sorts and formats a `setDisplayName` action. */
|
|
49
|
+
setDisplayName: (action: SetDisplayNameRequest["action"]) => SetDisplayNameRequest["action"];
|
|
50
|
+
/** Sorts and formats a `setReferrer` action. */
|
|
51
|
+
setReferrer: (action: SetReferrerRequest["action"]) => SetReferrerRequest["action"];
|
|
52
|
+
/** Sorts and formats a `spotDeploy` action. */
|
|
53
|
+
spotDeploy: (action: SpotDeployRequest_Genesis["action"] | SpotDeployRequest_RegisterHyperliquidity["action"] | SpotDeployRequest_RegisterSpot["action"] | SpotDeployRequest_RegisterToken2["action"] | SpotDeployRequest_SetDeployerTradingFeeShare["action"] | SpotDeployRequest_UserGenesis["action"]) => SpotDeployRequest_Genesis["action"] | SpotDeployRequest_RegisterHyperliquidity["action"] | SpotDeployRequest_RegisterSpot["action"] | SpotDeployRequest_RegisterToken2["action"] | SpotDeployRequest_SetDeployerTradingFeeShare["action"] | SpotDeployRequest_UserGenesis["action"];
|
|
54
|
+
/** Sorts and formats a `spotSend` action. */
|
|
55
|
+
spotSend: (action: SpotSendRequest["action"]) => SpotSendRequest["action"];
|
|
56
|
+
/** Sorts and formats a `spotUser` action. */
|
|
57
|
+
spotUser: (action: SpotUserRequest["action"]) => SpotUserRequest["action"];
|
|
58
|
+
/** Sorts and formats a `subAccountSpotTransfer` action. */
|
|
59
|
+
subAccountSpotTransfer: (action: SubAccountSpotTransferRequest["action"]) => SubAccountSpotTransferRequest["action"];
|
|
60
|
+
/** Sorts and formats a `subAccountTransfer` action. */
|
|
61
|
+
subAccountTransfer: (action: SubAccountTransferRequest["action"]) => SubAccountTransferRequest["action"];
|
|
62
|
+
/** Sorts and formats a `tokenDelegate` action. */
|
|
63
|
+
tokenDelegate: (action: TokenDelegateRequest["action"]) => TokenDelegateRequest["action"];
|
|
64
|
+
/** Sorts and formats a `twapCancel` action. */
|
|
65
|
+
twapCancel: (action: TwapCancelRequest["action"]) => TwapCancelRequest["action"];
|
|
66
|
+
/** Sorts and formats a `twapOrder` action. */
|
|
67
|
+
twapOrder: (action: TwapOrderRequest["action"]) => TwapOrderRequest["action"];
|
|
68
|
+
/** Sorts and formats an `updateIsolatedMargin` action. */
|
|
69
|
+
updateIsolatedMargin: (action: UpdateIsolatedMarginRequest["action"]) => UpdateIsolatedMarginRequest["action"];
|
|
70
|
+
/** Sorts and formats an `updateLeverage` action. */
|
|
71
|
+
updateLeverage: (action: UpdateLeverageRequest["action"]) => UpdateLeverageRequest["action"];
|
|
72
|
+
/** Sorts and formats an `usdClassTransfer` action. */
|
|
73
|
+
usdClassTransfer: (action: UsdClassTransferRequest["action"]) => UsdClassTransferRequest["action"];
|
|
74
|
+
/** Sorts and formats an `usdSend` action. */
|
|
75
|
+
usdSend: (action: UsdSendRequest["action"]) => UsdSendRequest["action"];
|
|
76
|
+
/** Sorts and formats a `vaultDistribute` action. */
|
|
77
|
+
vaultDistribute: (action: VaultDistributeRequest["action"]) => VaultDistributeRequest["action"];
|
|
78
|
+
/** Sorts and formats a `vaultModify` action. */
|
|
79
|
+
vaultModify: (action: VaultModifyRequest["action"]) => VaultModifyRequest["action"];
|
|
80
|
+
/** Sorts and formats a `vaultTransfer` action. */
|
|
81
|
+
vaultTransfer: (action: VaultTransferRequest["action"]) => VaultTransferRequest["action"];
|
|
82
|
+
/** Sorts and formats a `withdraw3` action. */
|
|
83
|
+
withdraw3: (action: Withdraw3Request["action"]) => Withdraw3Request["action"];
|
|
84
|
+
};
|
|
85
|
+
/** EIP-712 type definitions for user-signed actions. */
|
|
86
|
+
export declare const userSignedActionEip712Types: {
|
|
87
|
+
approveAgent: {
|
|
88
|
+
"HyperliquidTransaction:ApproveAgent": {
|
|
89
|
+
name: string;
|
|
90
|
+
type: string;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
approveBuilderFee: {
|
|
94
|
+
"HyperliquidTransaction:ApproveBuilderFee": {
|
|
95
|
+
name: string;
|
|
96
|
+
type: string;
|
|
97
|
+
}[];
|
|
98
|
+
};
|
|
99
|
+
cDeposit: {
|
|
100
|
+
"HyperliquidTransaction:CDeposit": {
|
|
101
|
+
name: string;
|
|
102
|
+
type: string;
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
convertToMultiSigUser: {
|
|
106
|
+
"HyperliquidTransaction:ConvertToMultiSigUser": {
|
|
107
|
+
name: string;
|
|
108
|
+
type: string;
|
|
109
|
+
}[];
|
|
110
|
+
};
|
|
111
|
+
cWithdraw: {
|
|
112
|
+
"HyperliquidTransaction:CWithdraw": {
|
|
113
|
+
name: string;
|
|
114
|
+
type: string;
|
|
115
|
+
}[];
|
|
116
|
+
};
|
|
117
|
+
PerpDexClassTransfer: {
|
|
118
|
+
"HyperliquidTransaction:PerpDexClassTransfer": {
|
|
119
|
+
name: string;
|
|
120
|
+
type: string;
|
|
121
|
+
}[];
|
|
122
|
+
};
|
|
123
|
+
spotSend: {
|
|
124
|
+
"HyperliquidTransaction:SpotSend": {
|
|
125
|
+
name: string;
|
|
126
|
+
type: string;
|
|
127
|
+
}[];
|
|
128
|
+
};
|
|
129
|
+
tokenDelegate: {
|
|
130
|
+
"HyperliquidTransaction:TokenDelegate": {
|
|
131
|
+
name: string;
|
|
132
|
+
type: string;
|
|
133
|
+
}[];
|
|
134
|
+
};
|
|
135
|
+
usdClassTransfer: {
|
|
136
|
+
"HyperliquidTransaction:UsdClassTransfer": {
|
|
137
|
+
name: string;
|
|
138
|
+
type: string;
|
|
139
|
+
}[];
|
|
140
|
+
};
|
|
141
|
+
usdSend: {
|
|
142
|
+
"HyperliquidTransaction:UsdSend": {
|
|
143
|
+
name: string;
|
|
144
|
+
type: string;
|
|
145
|
+
}[];
|
|
146
|
+
};
|
|
147
|
+
withdraw3: {
|
|
148
|
+
"HyperliquidTransaction:Withdraw": {
|
|
149
|
+
name: string;
|
|
150
|
+
type: string;
|
|
151
|
+
}[];
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
//# sourceMappingURL=_sorter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_sorter.d.ts","sourceRoot":"","sources":["../../../src/src/signing/_sorter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,mBAAmB,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,4BAA4B,EAC5B,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,+BAA+B,EAC/B,qCAAqC,EACrC,gCAAgC,EAChC,kCAAkC,EAClC,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,EACzB,wCAAwC,EACxC,8BAA8B,EAC9B,gCAAgC,EAChC,4CAA4C,EAC5C,6BAA6B,EAC7B,eAAe,EACf,eAAe,EACf,6BA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