@nktkas/hyperliquid 0.16.0 → 0.17.1
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 +58 -106
- package/esm/src/clients/event.d.ts.map +1 -1
- package/esm/src/clients/event.js +0 -1
- package/esm/src/clients/public.d.ts +4 -4
- package/esm/src/clients/public.d.ts.map +1 -1
- package/esm/src/clients/public.js +4 -7
- package/esm/src/clients/wallet.d.ts +129 -132
- package/esm/src/clients/wallet.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +290 -268
- package/esm/src/signing.d.ts +149 -32
- package/esm/src/signing.d.ts.map +1 -1
- package/esm/src/signing.js +123 -15
- package/esm/src/transports/http/http_transport.d.ts +14 -24
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +20 -15
- package/esm/src/transports/websocket/websocket_transport.d.ts +6 -2
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/types/exchange/requests.d.ts +52 -38
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/info/accounts.d.ts +4 -0
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/info/assets.d.ts +4 -6
- package/esm/src/types/info/assets.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +28 -20
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +8 -8
- package/esm/src/types/info/requests.d.ts.map +1 -1
- package/esm/src/types/info/vaults.d.ts +2 -0
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/mod.d.ts +21 -0
- package/esm/src/types/mod.d.ts.map +1 -1
- package/esm/src/types/mod.js +21 -0
- package/esm/src/types/subscriptions/requests.d.ts +5 -14
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/package.json +4 -1
- package/script/src/clients/event.d.ts.map +1 -1
- package/script/src/clients/event.js +0 -1
- package/script/src/clients/public.d.ts +4 -4
- package/script/src/clients/public.d.ts.map +1 -1
- package/script/src/clients/public.js +4 -7
- package/script/src/clients/wallet.d.ts +129 -132
- package/script/src/clients/wallet.d.ts.map +1 -1
- package/script/src/clients/wallet.js +290 -268
- package/script/src/signing.d.ts +149 -32
- package/script/src/signing.d.ts.map +1 -1
- package/script/src/signing.js +124 -16
- package/script/src/transports/http/http_transport.d.ts +14 -24
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +20 -15
- package/script/src/transports/websocket/websocket_transport.d.ts +6 -2
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/types/exchange/requests.d.ts +52 -38
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/info/accounts.d.ts +4 -0
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/info/assets.d.ts +4 -6
- package/script/src/types/info/assets.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +28 -20
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +8 -8
- package/script/src/types/info/requests.d.ts.map +1 -1
- package/script/src/types/info/vaults.d.ts +2 -0
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/mod.d.ts +21 -0
- package/script/src/types/mod.d.ts.map +1 -1
- package/script/src/types/mod.js +21 -0
- package/script/src/types/subscriptions/requests.d.ts +5 -14
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
package/script/src/signing.d.ts
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module contains functions for generating Hyperliquid transaction signatures
|
|
3
|
+
* and interfaces to various wallet implementations.
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { signL1Action } from "@nktkas/hyperliquid/signing";
|
|
7
|
+
*
|
|
8
|
+
* const action = {
|
|
9
|
+
* type: "cancel",
|
|
10
|
+
* cancels: [{ a: 0, o: 12345 }],
|
|
11
|
+
* };
|
|
12
|
+
* const nonce = Date.now();
|
|
13
|
+
*
|
|
14
|
+
* const signature = await signL1Action({
|
|
15
|
+
* wallet,
|
|
16
|
+
* action,
|
|
17
|
+
* nonce,
|
|
18
|
+
* isTestnet: true, // Change to false for mainnet
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
|
|
24
|
+
*
|
|
25
|
+
* const action = {
|
|
26
|
+
* type: "approveAgent",
|
|
27
|
+
* hyperliquidChain: "Testnet", // "Mainnet" or "Testnet"
|
|
28
|
+
* signatureChainId: "0x66eee",
|
|
29
|
+
* nonce: Date.now(),
|
|
30
|
+
* agentAddress: "0x...",
|
|
31
|
+
* agentName: "Agent",
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* const signature = await signUserSignedAction({
|
|
35
|
+
* wallet,
|
|
36
|
+
* action,
|
|
37
|
+
* types: {
|
|
38
|
+
* "HyperliquidTransaction:ApproveAgent": [
|
|
39
|
+
* { name: "hyperliquidChain", type: "string" },
|
|
40
|
+
* { name: "agentAddress", type: "address" },
|
|
41
|
+
* { name: "agentName", type: "string" },
|
|
42
|
+
* { name: "nonce", type: "uint64" },
|
|
43
|
+
* ],
|
|
44
|
+
* },
|
|
45
|
+
* chainId: parseInt(action.signatureChainId, 16),
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
* @module
|
|
49
|
+
*/
|
|
1
50
|
import { type ValueMap, type ValueType } from "../deps/jsr.io/@std/msgpack/1.0.3/encode.js";
|
|
2
51
|
import type { Hex } from "./base.js";
|
|
3
52
|
export type { Hex };
|
|
@@ -21,25 +70,6 @@ export interface AbstractViemWalletClient {
|
|
|
21
70
|
message: Record<string, unknown>;
|
|
22
71
|
}): Promise<Hex>;
|
|
23
72
|
}
|
|
24
|
-
/** Abstract interface for an extended [viem wallet](https://viem.sh/docs/clients/wallet) (e.g. privy [useSignTypedData](https://docs.privy.io/reference/sdk/react-auth/functions/useSignTypedData#returns)). */
|
|
25
|
-
export interface AbstractExtendedViemWalletClient {
|
|
26
|
-
signTypedData(params: {
|
|
27
|
-
domain: {
|
|
28
|
-
name: string;
|
|
29
|
-
version: string;
|
|
30
|
-
chainId: number;
|
|
31
|
-
verifyingContract: Hex;
|
|
32
|
-
};
|
|
33
|
-
types: {
|
|
34
|
-
[key: string]: {
|
|
35
|
-
name: string;
|
|
36
|
-
type: string;
|
|
37
|
-
}[];
|
|
38
|
-
};
|
|
39
|
-
primaryType: string;
|
|
40
|
-
message: Record<string, unknown>;
|
|
41
|
-
}, options?: unknown): Promise<Hex>;
|
|
42
|
-
}
|
|
43
73
|
/** Abstract interface for an [ethers.js signer](https://docs.ethers.org/v6/api/providers/#Signer). */
|
|
44
74
|
export interface AbstractEthersSigner {
|
|
45
75
|
signTypedData(domain: {
|
|
@@ -68,6 +98,25 @@ export interface AbstractEthersV5Signer {
|
|
|
68
98
|
}[];
|
|
69
99
|
}, value: Record<string, unknown>): Promise<string>;
|
|
70
100
|
}
|
|
101
|
+
/** Abstract interface for an extended [viem wallet](https://viem.sh/docs/clients/wallet) (e.g. privy [useSignTypedData](https://docs.privy.io/reference/sdk/react-auth/functions/useSignTypedData#returns)). */
|
|
102
|
+
export interface AbstractExtendedViemWalletClient {
|
|
103
|
+
signTypedData(params: {
|
|
104
|
+
domain: {
|
|
105
|
+
name: string;
|
|
106
|
+
version: string;
|
|
107
|
+
chainId: number;
|
|
108
|
+
verifyingContract: Hex;
|
|
109
|
+
};
|
|
110
|
+
types: {
|
|
111
|
+
[key: string]: {
|
|
112
|
+
name: string;
|
|
113
|
+
type: string;
|
|
114
|
+
}[];
|
|
115
|
+
};
|
|
116
|
+
primaryType: string;
|
|
117
|
+
message: Record<string, unknown>;
|
|
118
|
+
}, options?: unknown): Promise<Hex>;
|
|
119
|
+
}
|
|
71
120
|
/** Abstract interface for a [window.ethereum](https://eips.ethereum.org/EIPS/eip-1193) object. */
|
|
72
121
|
export interface AbstractWindowEthereum {
|
|
73
122
|
request(args: {
|
|
@@ -89,18 +138,48 @@ export declare function createL1ActionHash(action: ValueType, nonce: number, vau
|
|
|
89
138
|
* Sign an L1 action.
|
|
90
139
|
*
|
|
91
140
|
* Note: Signature generation depends on the order of the action keys.
|
|
92
|
-
* @param args
|
|
93
|
-
* @param args.action - The action to be signed.
|
|
94
|
-
* @param args.nonce - Unique request identifier (recommended current timestamp in ms).
|
|
95
|
-
* @param args.isTestnet - Indicates if the action is for the testnet. Default is `false`.
|
|
96
|
-
* @param args.vaultAddress - Optional vault address used in the action.
|
|
141
|
+
* @param args - Arguments for signing the action.
|
|
97
142
|
* @returns The signature components r, s, and v.
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* import { signL1Action } from "@nktkas/hyperliquid/signing";
|
|
146
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
147
|
+
*
|
|
148
|
+
* const wallet = privateKeyToAccount("0x..."); // Change to your private key
|
|
149
|
+
*
|
|
150
|
+
* const action = {
|
|
151
|
+
* type: "cancel",
|
|
152
|
+
* cancels: [
|
|
153
|
+
* { a: 0, o: 12345 }, // Asset index and order ID
|
|
154
|
+
* ],
|
|
155
|
+
* };
|
|
156
|
+
* const nonce = Date.now();
|
|
157
|
+
*
|
|
158
|
+
* const signature = await signL1Action({
|
|
159
|
+
* wallet,
|
|
160
|
+
* action,
|
|
161
|
+
* nonce,
|
|
162
|
+
* isTestnet: true, // Change to false for mainnet
|
|
163
|
+
* });
|
|
164
|
+
*
|
|
165
|
+
* const response = await fetch("https://api.hyperliquid-testnet.xyz/exchange", {
|
|
166
|
+
* method: "POST",
|
|
167
|
+
* headers: { "Content-Type": "application/json" },
|
|
168
|
+
* body: JSON.stringify({ action, signature, nonce }),
|
|
169
|
+
* });
|
|
170
|
+
* const body = await response.json();
|
|
171
|
+
* ```
|
|
98
172
|
*/
|
|
99
173
|
export declare function signL1Action(args: {
|
|
100
|
-
|
|
174
|
+
/** Wallet to sign the action. */
|
|
175
|
+
wallet: AbstractViemWalletClient | AbstractEthersSigner | AbstractEthersV5Signer | AbstractExtendedViemWalletClient | AbstractWindowEthereum;
|
|
176
|
+
/** The action to be signed. */
|
|
101
177
|
action: ValueType;
|
|
178
|
+
/** Unique request identifier (recommended current timestamp in ms). */
|
|
102
179
|
nonce: number;
|
|
180
|
+
/** Indicates if the action is for the testnet. Default is `false`. */
|
|
103
181
|
isTestnet?: boolean;
|
|
182
|
+
/** Optional vault address used in the action. */
|
|
104
183
|
vaultAddress?: Hex;
|
|
105
184
|
}): Promise<{
|
|
106
185
|
r: Hex;
|
|
@@ -111,21 +190,59 @@ export declare function signL1Action(args: {
|
|
|
111
190
|
* Sign a user-signed action.
|
|
112
191
|
*
|
|
113
192
|
* Note: Signature generation depends on the order of types.
|
|
114
|
-
* @param args
|
|
115
|
-
* @param args.action - The action to be signed.
|
|
116
|
-
* @param args.types - The types of the action.
|
|
117
|
-
* @param args.chainId - The chain ID.
|
|
193
|
+
* @param args - Arguments for signing the action.
|
|
118
194
|
* @returns The signature components r, s, and v.
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
|
|
198
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
199
|
+
*
|
|
200
|
+
* const wallet = privateKeyToAccount("0x..."); // Change to your private key
|
|
201
|
+
*
|
|
202
|
+
* const action = {
|
|
203
|
+
* type: "approveAgent",
|
|
204
|
+
* hyperliquidChain: "Testnet", // "Mainnet" or "Testnet"
|
|
205
|
+
* signatureChainId: "0x66eee",
|
|
206
|
+
* nonce: Date.now(),
|
|
207
|
+
* agentAddress: "0x...", // Change to your agent address
|
|
208
|
+
* agentName: "Agent",
|
|
209
|
+
* };
|
|
210
|
+
*
|
|
211
|
+
* const signature = await signUserSignedAction({
|
|
212
|
+
* wallet,
|
|
213
|
+
* action,
|
|
214
|
+
* types: {
|
|
215
|
+
* "HyperliquidTransaction:ApproveAgent": [
|
|
216
|
+
* { name: "hyperliquidChain", type: "string" },
|
|
217
|
+
* { name: "agentAddress", type: "address" },
|
|
218
|
+
* { name: "agentName", type: "string" },
|
|
219
|
+
* { name: "nonce", type: "uint64" },
|
|
220
|
+
* ],
|
|
221
|
+
* },
|
|
222
|
+
* chainId: parseInt(action.signatureChainId, 16),
|
|
223
|
+
* });
|
|
224
|
+
*
|
|
225
|
+
* const response = await fetch("https://api.hyperliquid-testnet.xyz/exchange", {
|
|
226
|
+
* method: "POST",
|
|
227
|
+
* headers: { "Content-Type": "application/json" },
|
|
228
|
+
* body: JSON.stringify({ action, signature, nonce: action.nonce }),
|
|
229
|
+
* });
|
|
230
|
+
* const body = await response.json();
|
|
231
|
+
* ```
|
|
119
232
|
*/
|
|
120
233
|
export declare function signUserSignedAction(args: {
|
|
121
|
-
|
|
234
|
+
/** Wallet to sign the action. */
|
|
235
|
+
wallet: AbstractViemWalletClient | AbstractEthersSigner | AbstractEthersV5Signer | AbstractExtendedViemWalletClient | AbstractWindowEthereum;
|
|
236
|
+
/** The action to be signed. */
|
|
122
237
|
action: Record<string, unknown>;
|
|
238
|
+
/** The types of the action. */
|
|
123
239
|
types: {
|
|
124
240
|
[key: string]: {
|
|
125
241
|
name: string;
|
|
126
242
|
type: string;
|
|
127
243
|
}[];
|
|
128
244
|
};
|
|
245
|
+
/** The chain ID. */
|
|
129
246
|
chainId: number;
|
|
130
247
|
}): Promise<{
|
|
131
248
|
r: Hex;
|
|
@@ -134,12 +251,12 @@ export declare function signUserSignedAction(args: {
|
|
|
134
251
|
}>;
|
|
135
252
|
/** Checks if the given value is an abstract viem wallet. */
|
|
136
253
|
export declare function isAbstractViemWalletClient(client: unknown): client is AbstractViemWalletClient;
|
|
137
|
-
/** Checks if the given value is an abstract extended viem wallet (e.g. privy `useSignTypedData`). */
|
|
138
|
-
export declare function isAbstractExtendedViemWalletClient(client: unknown): client is AbstractViemWalletClient;
|
|
139
254
|
/** Checks if the given value is an abstract ethers signer. */
|
|
140
255
|
export declare function isAbstractEthersSigner(client: unknown): client is AbstractEthersSigner;
|
|
141
256
|
/** Checks if the given value is an abstract ethers v5 signer. */
|
|
142
257
|
export declare function isAbstractEthersV5Signer(client: unknown): client is AbstractEthersV5Signer;
|
|
258
|
+
/** Checks if the given value is an abstract extended viem wallet (e.g. privy `useSignTypedData`). */
|
|
259
|
+
export declare function isAbstractExtendedViemWalletClient(client: unknown): client is AbstractViemWalletClient;
|
|
143
260
|
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
144
261
|
export declare function isAbstractWindowEthereum(client: unknown): client is AbstractWindowEthereum;
|
|
145
262
|
//# sourceMappingURL=signing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../src/src/signing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../src/src/signing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAGH,OAAO,EAAU,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAEpG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErC,YAAY,EAAE,GAAG,EAAE,CAAC;AACpB,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAEpC,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACrC,aAAa,CAAC,MAAM,EAAE;QAClB,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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GA2CG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC7C,iCAAiC;IACjC,MAAM,EACA,wBAAwB,GACxB,oBAAoB,GACpB,sBAAsB,GACtB,gCAAgC,GAChC,sBAAsB,CAAC;IAC7B,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,+BAA+B;IAC/B,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IAC3D,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC;IAAE,CAAC,EAAE,GAAG,CAAC;IAAC,CAAC,EAAE,GAAG,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAYzC;AA6FD,4DAA4D;AAC5D,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,wBAAwB,CAI9F;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;AAED,qGAAqG;AACrG,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,wBAAwB,CAItG;AAED,yEAAyE;AACzE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,sBAAsB,CAI1F"}
|
package/script/src/signing.js
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module contains functions for generating Hyperliquid transaction signatures
|
|
3
|
+
* and interfaces to various wallet implementations.
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { signL1Action } from "@nktkas/hyperliquid/signing";
|
|
7
|
+
*
|
|
8
|
+
* const action = {
|
|
9
|
+
* type: "cancel",
|
|
10
|
+
* cancels: [{ a: 0, o: 12345 }],
|
|
11
|
+
* };
|
|
12
|
+
* const nonce = Date.now();
|
|
13
|
+
*
|
|
14
|
+
* const signature = await signL1Action({
|
|
15
|
+
* wallet,
|
|
16
|
+
* action,
|
|
17
|
+
* nonce,
|
|
18
|
+
* isTestnet: true, // Change to false for mainnet
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
|
|
24
|
+
*
|
|
25
|
+
* const action = {
|
|
26
|
+
* type: "approveAgent",
|
|
27
|
+
* hyperliquidChain: "Testnet", // "Mainnet" or "Testnet"
|
|
28
|
+
* signatureChainId: "0x66eee",
|
|
29
|
+
* nonce: Date.now(),
|
|
30
|
+
* agentAddress: "0x...",
|
|
31
|
+
* agentName: "Agent",
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* const signature = await signUserSignedAction({
|
|
35
|
+
* wallet,
|
|
36
|
+
* action,
|
|
37
|
+
* types: {
|
|
38
|
+
* "HyperliquidTransaction:ApproveAgent": [
|
|
39
|
+
* { name: "hyperliquidChain", type: "string" },
|
|
40
|
+
* { name: "agentAddress", type: "address" },
|
|
41
|
+
* { name: "agentName", type: "string" },
|
|
42
|
+
* { name: "nonce", type: "uint64" },
|
|
43
|
+
* ],
|
|
44
|
+
* },
|
|
45
|
+
* chainId: parseInt(action.signatureChainId, 16),
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
* @module
|
|
49
|
+
*/
|
|
1
50
|
(function (factory) {
|
|
2
51
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
52
|
var v = factory(require, exports);
|
|
@@ -13,9 +62,9 @@
|
|
|
13
62
|
exports.signL1Action = signL1Action;
|
|
14
63
|
exports.signUserSignedAction = signUserSignedAction;
|
|
15
64
|
exports.isAbstractViemWalletClient = isAbstractViemWalletClient;
|
|
16
|
-
exports.isAbstractExtendedViemWalletClient = isAbstractExtendedViemWalletClient;
|
|
17
65
|
exports.isAbstractEthersSigner = isAbstractEthersSigner;
|
|
18
66
|
exports.isAbstractEthersV5Signer = isAbstractEthersV5Signer;
|
|
67
|
+
exports.isAbstractExtendedViemWalletClient = isAbstractExtendedViemWalletClient;
|
|
19
68
|
exports.isAbstractWindowEthereum = isAbstractWindowEthereum;
|
|
20
69
|
const sha3_js_1 = require("../deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js");
|
|
21
70
|
const encode_js_1 = require("../deps/jsr.io/@std/msgpack/1.0.3/encode.js");
|
|
@@ -69,12 +118,37 @@
|
|
|
69
118
|
* Sign an L1 action.
|
|
70
119
|
*
|
|
71
120
|
* Note: Signature generation depends on the order of the action keys.
|
|
72
|
-
* @param args
|
|
73
|
-
* @param args.action - The action to be signed.
|
|
74
|
-
* @param args.nonce - Unique request identifier (recommended current timestamp in ms).
|
|
75
|
-
* @param args.isTestnet - Indicates if the action is for the testnet. Default is `false`.
|
|
76
|
-
* @param args.vaultAddress - Optional vault address used in the action.
|
|
121
|
+
* @param args - Arguments for signing the action.
|
|
77
122
|
* @returns The signature components r, s, and v.
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* import { signL1Action } from "@nktkas/hyperliquid/signing";
|
|
126
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
127
|
+
*
|
|
128
|
+
* const wallet = privateKeyToAccount("0x..."); // Change to your private key
|
|
129
|
+
*
|
|
130
|
+
* const action = {
|
|
131
|
+
* type: "cancel",
|
|
132
|
+
* cancels: [
|
|
133
|
+
* { a: 0, o: 12345 }, // Asset index and order ID
|
|
134
|
+
* ],
|
|
135
|
+
* };
|
|
136
|
+
* const nonce = Date.now();
|
|
137
|
+
*
|
|
138
|
+
* const signature = await signL1Action({
|
|
139
|
+
* wallet,
|
|
140
|
+
* action,
|
|
141
|
+
* nonce,
|
|
142
|
+
* isTestnet: true, // Change to false for mainnet
|
|
143
|
+
* });
|
|
144
|
+
*
|
|
145
|
+
* const response = await fetch("https://api.hyperliquid-testnet.xyz/exchange", {
|
|
146
|
+
* method: "POST",
|
|
147
|
+
* headers: { "Content-Type": "application/json" },
|
|
148
|
+
* body: JSON.stringify({ action, signature, nonce }),
|
|
149
|
+
* });
|
|
150
|
+
* const body = await response.json();
|
|
151
|
+
* ```
|
|
78
152
|
*/
|
|
79
153
|
async function signL1Action(args) {
|
|
80
154
|
const { wallet, action, nonce, isTestnet = false, vaultAddress, } = args;
|
|
@@ -102,11 +176,45 @@
|
|
|
102
176
|
* Sign a user-signed action.
|
|
103
177
|
*
|
|
104
178
|
* Note: Signature generation depends on the order of types.
|
|
105
|
-
* @param args
|
|
106
|
-
* @param args.action - The action to be signed.
|
|
107
|
-
* @param args.types - The types of the action.
|
|
108
|
-
* @param args.chainId - The chain ID.
|
|
179
|
+
* @param args - Arguments for signing the action.
|
|
109
180
|
* @returns The signature components r, s, and v.
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* import { signUserSignedAction } from "@nktkas/hyperliquid/signing";
|
|
184
|
+
* import { privateKeyToAccount } from "viem/accounts";
|
|
185
|
+
*
|
|
186
|
+
* const wallet = privateKeyToAccount("0x..."); // Change to your private key
|
|
187
|
+
*
|
|
188
|
+
* const action = {
|
|
189
|
+
* type: "approveAgent",
|
|
190
|
+
* hyperliquidChain: "Testnet", // "Mainnet" or "Testnet"
|
|
191
|
+
* signatureChainId: "0x66eee",
|
|
192
|
+
* nonce: Date.now(),
|
|
193
|
+
* agentAddress: "0x...", // Change to your agent address
|
|
194
|
+
* agentName: "Agent",
|
|
195
|
+
* };
|
|
196
|
+
*
|
|
197
|
+
* const signature = await signUserSignedAction({
|
|
198
|
+
* wallet,
|
|
199
|
+
* action,
|
|
200
|
+
* types: {
|
|
201
|
+
* "HyperliquidTransaction:ApproveAgent": [
|
|
202
|
+
* { name: "hyperliquidChain", type: "string" },
|
|
203
|
+
* { name: "agentAddress", type: "address" },
|
|
204
|
+
* { name: "agentName", type: "string" },
|
|
205
|
+
* { name: "nonce", type: "uint64" },
|
|
206
|
+
* ],
|
|
207
|
+
* },
|
|
208
|
+
* chainId: parseInt(action.signatureChainId, 16),
|
|
209
|
+
* });
|
|
210
|
+
*
|
|
211
|
+
* const response = await fetch("https://api.hyperliquid-testnet.xyz/exchange", {
|
|
212
|
+
* method: "POST",
|
|
213
|
+
* headers: { "Content-Type": "application/json" },
|
|
214
|
+
* body: JSON.stringify({ action, signature, nonce: action.nonce }),
|
|
215
|
+
* });
|
|
216
|
+
* const body = await response.json();
|
|
217
|
+
* ```
|
|
110
218
|
*/
|
|
111
219
|
async function signUserSignedAction(args) {
|
|
112
220
|
const { wallet, action, types, chainId } = args;
|
|
@@ -181,12 +289,6 @@
|
|
|
181
289
|
"signTypedData" in client && typeof client.signTypedData === "function" &&
|
|
182
290
|
client.signTypedData.length === 1;
|
|
183
291
|
}
|
|
184
|
-
/** Checks if the given value is an abstract extended viem wallet (e.g. privy `useSignTypedData`). */
|
|
185
|
-
function isAbstractExtendedViemWalletClient(client) {
|
|
186
|
-
return typeof client === "object" && client !== null &&
|
|
187
|
-
"signTypedData" in client && typeof client.signTypedData === "function" &&
|
|
188
|
-
client.signTypedData.length === 2;
|
|
189
|
-
}
|
|
190
292
|
/** Checks if the given value is an abstract ethers signer. */
|
|
191
293
|
function isAbstractEthersSigner(client) {
|
|
192
294
|
return typeof client === "object" && client !== null &&
|
|
@@ -199,6 +301,12 @@
|
|
|
199
301
|
"_signTypedData" in client && typeof client._signTypedData === "function" &&
|
|
200
302
|
client._signTypedData.length === 3;
|
|
201
303
|
}
|
|
304
|
+
/** Checks if the given value is an abstract extended viem wallet (e.g. privy `useSignTypedData`). */
|
|
305
|
+
function isAbstractExtendedViemWalletClient(client) {
|
|
306
|
+
return typeof client === "object" && client !== null &&
|
|
307
|
+
"signTypedData" in client && typeof client.signTypedData === "function" &&
|
|
308
|
+
client.signTypedData.length === 2;
|
|
309
|
+
}
|
|
202
310
|
/** Checks if the given value is an abstract `window.ethereum` object. */
|
|
203
311
|
function isAbstractWindowEthereum(client) {
|
|
204
312
|
return typeof client === "object" && client !== null &&
|
|
@@ -17,28 +17,10 @@ export declare class HttpRequestError extends TransportError {
|
|
|
17
17
|
/** Configuration options for the HTTP transport layer. */
|
|
18
18
|
export interface HttpTransportOptions {
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* When given as a string or URL, the URL is modified based on the request type:
|
|
23
|
-
* - For `"info"` and `"exchange"`, the hostname is replaced with `api.<baseDomain>`.
|
|
24
|
-
* - For `"explorer"`, the hostname is replaced with `rpc.<baseDomain>`.
|
|
25
|
-
*
|
|
26
|
-
* Alternatively, you can supply an object to specify separate URLs:
|
|
27
|
-
* ```ts
|
|
28
|
-
* {
|
|
29
|
-
* api: "https://api.hyperliquid.xyz",
|
|
30
|
-
* rpc: "https://rpc.hyperliquid.xyz"
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* - Mainnet: `https://hyperliquid.xyz`
|
|
35
|
-
* - Testnet: `https://hyperliquid-testnet.xyz`
|
|
36
|
-
* @defaultValue `https://hyperliquid.xyz`
|
|
20
|
+
* Specifies whether to use the testnet API endpoints.
|
|
21
|
+
* @defaultValue `false`
|
|
37
22
|
*/
|
|
38
|
-
|
|
39
|
-
api?: string | URL;
|
|
40
|
-
rpc?: string | URL;
|
|
41
|
-
};
|
|
23
|
+
isTestnet?: boolean;
|
|
42
24
|
/**
|
|
43
25
|
* Request timeout in ms.
|
|
44
26
|
* Set to `null` to disable.
|
|
@@ -62,10 +44,18 @@ export interface HttpTransportOptions {
|
|
|
62
44
|
}
|
|
63
45
|
/** HTTP implementation of the REST transport interface. */
|
|
64
46
|
export declare class HttpTransport implements IRequestTransport, HttpTransportOptions {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
/** API endpoint paths for mainnet and testnet. */
|
|
48
|
+
protected static readonly endpointPaths: {
|
|
49
|
+
mainnet: {
|
|
50
|
+
api: string;
|
|
51
|
+
rpc: string;
|
|
52
|
+
};
|
|
53
|
+
testnet: {
|
|
54
|
+
api: string;
|
|
55
|
+
rpc: string;
|
|
56
|
+
};
|
|
68
57
|
};
|
|
58
|
+
isTestnet: boolean;
|
|
69
59
|
timeout: number | null;
|
|
70
60
|
fetchOptions: Omit<RequestInit, "body" | "method">;
|
|
71
61
|
onRequest?: (request: Request) => MaybePromise<Request | void | null | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/http/http_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAM7B,QAAQ,EAAE,QAAQ;IAAS,YAAY,CAAC,EAAE,MAAM;IALnE;;;;OAIG;gBACgB,QAAQ,EAAE,QAAQ,EAAS,YAAY,CAAC,EAAE,MAAM,YAAA;CAOtE;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACjC
|
|
1
|
+
{"version":3,"file":"http_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/http/http_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAM7B,QAAQ,EAAE,QAAQ;IAAS,YAAY,CAAC,EAAE,MAAM;IALnE;;;;OAIG;gBACgB,QAAQ,EAAE,QAAQ,EAAS,YAAY,CAAC,EAAE,MAAM,YAAA;CAOtE;AAED,0DAA0D;AAC1D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,OAAO,CAAC,OAAO,CAAC;CAiDtB"}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* @param options - Configuration options for the HTTP transport layer.
|
|
51
51
|
*/
|
|
52
52
|
constructor(options) {
|
|
53
|
-
Object.defineProperty(this, "
|
|
53
|
+
Object.defineProperty(this, "isTestnet", {
|
|
54
54
|
enumerable: true,
|
|
55
55
|
configurable: true,
|
|
56
56
|
writable: true,
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
writable: true,
|
|
81
81
|
value: void 0
|
|
82
82
|
});
|
|
83
|
-
this.
|
|
83
|
+
this.isTestnet = options?.isTestnet ?? false;
|
|
84
84
|
this.timeout = options?.timeout === undefined ? 10_000 : options.timeout;
|
|
85
85
|
this.fetchOptions = options?.fetchOptions ?? {};
|
|
86
86
|
this.onRequest = options?.onRequest;
|
|
@@ -97,19 +97,8 @@
|
|
|
97
97
|
*/
|
|
98
98
|
async request(endpoint, payload, signal) {
|
|
99
99
|
// Construct a Request
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// If a string is provided, get the base domain and apply the modification to it
|
|
103
|
-
const parsedUrl = new URL(this.url);
|
|
104
|
-
const parts = parsedUrl.hostname.split(".");
|
|
105
|
-
const baseDomain = parts.slice(-2).join(".");
|
|
106
|
-
const baseUrl = `${parsedUrl.protocol}//${endpoint === "explorer" ? "rpc" : "api"}.${baseDomain}`;
|
|
107
|
-
url = new URL(endpoint, baseUrl);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
// If an object is specified, use the specific url and add a path to it
|
|
111
|
-
url = new URL(endpoint, endpoint === "explorer" ? this.url.rpc : this.url.api);
|
|
112
|
-
}
|
|
100
|
+
const url = new URL(endpoint, HttpTransport
|
|
101
|
+
.endpointPaths[this.isTestnet ? "testnet" : "mainnet"][endpoint === "explorer" ? "rpc" : "api"]);
|
|
113
102
|
const init = mergeRequestInit({
|
|
114
103
|
body: JSON.stringify(payload),
|
|
115
104
|
headers: {
|
|
@@ -147,6 +136,22 @@
|
|
|
147
136
|
}
|
|
148
137
|
}
|
|
149
138
|
exports.HttpTransport = HttpTransport;
|
|
139
|
+
/** API endpoint paths for mainnet and testnet. */
|
|
140
|
+
Object.defineProperty(HttpTransport, "endpointPaths", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true,
|
|
143
|
+
writable: true,
|
|
144
|
+
value: {
|
|
145
|
+
mainnet: {
|
|
146
|
+
api: "https://api.hyperliquid.xyz",
|
|
147
|
+
rpc: "https://rpc.hyperliquid.xyz",
|
|
148
|
+
},
|
|
149
|
+
testnet: {
|
|
150
|
+
api: "https://api.hyperliquid-testnet.xyz",
|
|
151
|
+
rpc: "https://rpc.hyperliquid-testnet.xyz",
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
});
|
|
150
155
|
/**
|
|
151
156
|
* Merges multiple `HeadersInit` objects into one.
|
|
152
157
|
* @param inits - A list of `HeadersInit` objects to merge.
|
|
@@ -8,8 +8,12 @@ export { type MessageBufferStrategy, ReconnectingWebSocketError, type Reconnecti
|
|
|
8
8
|
export interface WebSocketTransportOptions {
|
|
9
9
|
/**
|
|
10
10
|
* The WebSocket URL.
|
|
11
|
-
* - Mainnet:
|
|
12
|
-
*
|
|
11
|
+
* - Mainnet:
|
|
12
|
+
* - API: `wss://api.hyperliquid.xyz/ws`
|
|
13
|
+
* - RPC: `wss://rpc.hyperliquid.xyz/ws`
|
|
14
|
+
* - Testnet:
|
|
15
|
+
* - API: `wss://api.hyperliquid-testnet.xyz/ws`
|
|
16
|
+
* - RPC: `wss://rpc.hyperliquid-testnet.xyz/ws`
|
|
13
17
|
* @defaultValue `wss://api.hyperliquid.xyz/ws`
|
|
14
18
|
*/
|
|
15
19
|
url?: string | URL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/websocket_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,OAAO,EAAE,KAAK,qBAAqB,EAAE,0BAA0B,EAAE,KAAK,4BAA4B,EAAE,CAAC;AAErG,+DAA+D;AAC/D,MAAM,WAAW,yBAAyB;IACtC
|
|
1
|
+
{"version":3,"file":"websocket_transport.d.ts","sourceRoot":"","sources":["../../../../src/src/transports/websocket/websocket_transport.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,4BAA4B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACvG,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,OAAO,EAAE,KAAK,qBAAqB,EAAE,0BAA0B,EAAE,KAAK,4BAA4B,EAAE,CAAC;AAErG,+DAA+D;AAC/D,MAAM,WAAW,yBAAyB;IACtC;;;;;;;;;OASG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE;QACR;;;;WAIG;QACH,QAAQ,CAAC,EAAE,MAAM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