@nktkas/hyperliquid 0.25.0-beta.1 → 0.25.0-beta.3
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 +64 -16
- package/esm/bin/cli.d.ts +3 -0
- package/esm/bin/cli.d.ts.map +1 -0
- package/esm/bin/cli.js +452 -0
- package/esm/bin/cli.js.map +1 -0
- package/{script/src/errors.d.ts → esm/src/_errors.d.ts} +1 -1
- package/esm/src/_errors.d.ts.map +1 -0
- package/esm/src/{errors.js → _errors.js} +1 -0
- package/esm/src/_errors.js.map +1 -0
- package/esm/src/clients/exchange.d.ts +4 -11
- package/esm/src/clients/exchange.d.ts.map +1 -1
- package/esm/src/clients/exchange.js +8 -9
- package/esm/src/clients/exchange.js.map +1 -0
- package/esm/src/clients/info.d.ts +86 -2
- package/esm/src/clients/info.d.ts.map +1 -1
- package/esm/src/clients/info.js +103 -1
- package/esm/src/clients/info.js.map +1 -0
- package/esm/src/clients/multiSign.d.ts +1 -1
- package/esm/src/clients/multiSign.d.ts.map +1 -1
- package/esm/src/clients/multiSign.js +3 -2
- package/esm/src/clients/multiSign.js.map +1 -0
- package/esm/src/clients/subscription.js +1 -0
- package/esm/src/clients/subscription.js.map +1 -0
- package/esm/src/mod.d.ts +21 -0
- package/esm/src/mod.d.ts.map +1 -0
- package/esm/src/mod.js +14 -0
- package/esm/src/mod.js.map +1 -0
- package/esm/src/schemas/_base.d.ts +11 -3
- package/esm/src/schemas/_base.d.ts.map +1 -1
- package/esm/src/schemas/_base.js +30 -2
- package/esm/src/schemas/_base.js.map +1 -0
- package/esm/src/schemas/exchange/requests.d.ts +1872 -1872
- package/esm/src/schemas/exchange/requests.d.ts.map +1 -1
- package/esm/src/schemas/exchange/requests.js +277 -281
- package/esm/src/schemas/exchange/requests.js.map +1 -0
- package/esm/src/schemas/exchange/responses.d.ts +51 -51
- package/esm/src/schemas/exchange/responses.js +55 -54
- package/esm/src/schemas/exchange/responses.js.map +1 -0
- package/esm/src/schemas/explorer/requests.d.ts +5 -5
- package/esm/src/schemas/explorer/requests.js +6 -5
- package/esm/src/schemas/explorer/requests.js.map +1 -0
- package/esm/src/schemas/explorer/responses.d.ts +10 -10
- package/esm/src/schemas/explorer/responses.js +12 -11
- package/esm/src/schemas/explorer/responses.js.map +1 -0
- package/esm/src/schemas/info/accounts.d.ts +1042 -296
- package/esm/src/schemas/info/accounts.d.ts.map +1 -1
- package/esm/src/schemas/info/accounts.js +154 -109
- package/esm/src/schemas/info/accounts.js.map +1 -0
- package/esm/src/schemas/info/assets.d.ts +130 -101
- package/esm/src/schemas/info/assets.d.ts.map +1 -1
- package/esm/src/schemas/info/assets.js +69 -49
- package/esm/src/schemas/info/assets.js.map +1 -0
- package/esm/src/schemas/info/markets.d.ts +35 -18
- package/esm/src/schemas/info/markets.d.ts.map +1 -1
- package/esm/src/schemas/info/markets.js +27 -15
- package/esm/src/schemas/info/markets.js.map +1 -0
- package/esm/src/schemas/info/orders.d.ts +151 -151
- package/esm/src/schemas/info/orders.js +37 -36
- package/esm/src/schemas/info/orders.js.map +1 -0
- package/esm/src/schemas/info/requests.d.ts +145 -88
- package/esm/src/schemas/info/requests.d.ts.map +1 -1
- package/esm/src/schemas/info/requests.js +116 -73
- package/esm/src/schemas/info/requests.js.map +1 -0
- package/esm/src/schemas/info/validators.d.ts +60 -39
- package/esm/src/schemas/info/validators.d.ts.map +1 -1
- package/esm/src/schemas/info/validators.js +40 -26
- package/esm/src/schemas/info/validators.js.map +1 -0
- package/esm/src/schemas/info/vaults.d.ts +59 -59
- package/esm/src/schemas/info/vaults.js +20 -19
- package/esm/src/schemas/info/vaults.js.map +1 -0
- package/esm/src/schemas/mod.d.ts +4 -3
- package/esm/src/schemas/mod.d.ts.map +1 -1
- package/esm/src/schemas/mod.js +5 -3
- package/esm/src/schemas/mod.js.map +1 -0
- package/esm/src/schemas/subscriptions/requests.d.ts +23 -23
- package/esm/src/schemas/subscriptions/requests.d.ts.map +1 -1
- package/esm/src/schemas/subscriptions/requests.js +25 -24
- package/esm/src/schemas/subscriptions/requests.js.map +1 -0
- package/esm/src/schemas/subscriptions/responses.d.ts +547 -547
- package/esm/src/schemas/subscriptions/responses.js +41 -40
- package/esm/src/schemas/subscriptions/responses.js.map +1 -0
- package/esm/src/signing/mod.d.ts +1 -1
- package/esm/src/signing/mod.d.ts.map +1 -1
- package/esm/src/signing/mod.js +3 -2
- package/esm/src/signing/mod.js.map +1 -0
- package/esm/src/signing/signTypedData/ethers.d.ts.map +1 -0
- package/esm/src/signing/{_signTypedData → signTypedData}/ethers.js +1 -0
- package/esm/src/signing/signTypedData/ethers.js.map +1 -0
- package/esm/src/signing/signTypedData/mod.d.ts.map +1 -0
- package/esm/src/signing/{_signTypedData → signTypedData}/mod.js +1 -0
- package/esm/src/signing/signTypedData/mod.js.map +1 -0
- package/esm/src/signing/signTypedData/private_key.d.ts.map +1 -0
- package/esm/src/signing/{_signTypedData → signTypedData}/private_key.js +10 -8
- package/esm/src/signing/signTypedData/private_key.js.map +1 -0
- package/esm/src/signing/signTypedData/viem.d.ts.map +1 -0
- package/esm/src/signing/{_signTypedData → signTypedData}/viem.js +1 -0
- package/esm/src/signing/signTypedData/viem.js.map +1 -0
- package/esm/src/transports/base.d.ts +4 -4
- package/esm/src/transports/base.d.ts.map +1 -1
- package/esm/src/transports/base.js +3 -2
- package/esm/src/transports/base.js.map +1 -0
- package/esm/src/transports/http/http_transport.d.ts +1 -1
- package/esm/src/transports/http/http_transport.js +1 -0
- package/esm/src/transports/http/http_transport.js.map +1 -0
- package/esm/src/transports/websocket/_hyperliquid_event_target.js +1 -0
- package/esm/src/transports/websocket/_hyperliquid_event_target.js.map +1 -0
- package/esm/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/esm/src/transports/websocket/_reconnecting_websocket.js.map +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.js +1 -0
- package/esm/src/transports/websocket/_websocket_async_request.js.map +1 -0
- package/esm/src/transports/websocket/websocket_transport.d.ts +7 -0
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +4 -0
- package/esm/src/transports/websocket/websocket_transport.js.map +1 -0
- package/package.json +15 -7
- package/script/bin/cli.d.ts +3 -0
- package/script/bin/cli.d.ts.map +1 -0
- package/script/bin/cli.js +490 -0
- package/script/bin/cli.js.map +1 -0
- package/{esm/src/errors.d.ts → script/src/_errors.d.ts} +1 -1
- package/script/src/_errors.d.ts.map +1 -0
- package/script/src/{errors.js → _errors.js} +1 -0
- package/script/src/_errors.js.map +1 -0
- package/script/src/clients/exchange.d.ts +4 -11
- package/script/src/clients/exchange.d.ts.map +1 -1
- package/script/src/clients/exchange.js +9 -10
- package/script/src/clients/exchange.js.map +1 -0
- package/script/src/clients/info.d.ts +86 -2
- package/script/src/clients/info.d.ts.map +1 -1
- package/script/src/clients/info.js +102 -0
- package/script/src/clients/info.js.map +1 -0
- package/script/src/clients/multiSign.d.ts +1 -1
- package/script/src/clients/multiSign.d.ts.map +1 -1
- package/script/src/clients/multiSign.js +3 -2
- package/script/src/clients/multiSign.js.map +1 -0
- package/script/src/clients/subscription.js +1 -0
- package/script/src/clients/subscription.js.map +1 -0
- package/script/src/mod.d.ts +21 -0
- package/script/src/mod.d.ts.map +1 -0
- package/script/{mod.js → src/mod.js} +13 -8
- package/script/src/mod.js.map +1 -0
- package/script/src/schemas/_base.d.ts +11 -3
- package/script/src/schemas/_base.d.ts.map +1 -1
- package/script/src/schemas/_base.js +31 -3
- package/script/src/schemas/_base.js.map +1 -0
- package/script/src/schemas/exchange/requests.d.ts +1872 -1872
- package/script/src/schemas/exchange/requests.d.ts.map +1 -1
- package/script/src/schemas/exchange/requests.js +276 -280
- package/script/src/schemas/exchange/requests.js.map +1 -0
- package/script/src/schemas/exchange/responses.d.ts +51 -51
- package/script/src/schemas/exchange/responses.js +54 -53
- package/script/src/schemas/exchange/responses.js.map +1 -0
- package/script/src/schemas/explorer/requests.d.ts +5 -5
- package/script/src/schemas/explorer/requests.js +5 -4
- package/script/src/schemas/explorer/requests.js.map +1 -0
- package/script/src/schemas/explorer/responses.d.ts +10 -10
- package/script/src/schemas/explorer/responses.js +11 -10
- package/script/src/schemas/explorer/responses.js.map +1 -0
- package/script/src/schemas/info/accounts.d.ts +1042 -296
- package/script/src/schemas/info/accounts.d.ts.map +1 -1
- package/script/src/schemas/info/accounts.js +154 -109
- package/script/src/schemas/info/accounts.js.map +1 -0
- package/script/src/schemas/info/assets.d.ts +130 -101
- package/script/src/schemas/info/assets.d.ts.map +1 -1
- package/script/src/schemas/info/assets.js +69 -49
- package/script/src/schemas/info/assets.js.map +1 -0
- package/script/src/schemas/info/markets.d.ts +35 -18
- package/script/src/schemas/info/markets.d.ts.map +1 -1
- package/script/src/schemas/info/markets.js +27 -15
- package/script/src/schemas/info/markets.js.map +1 -0
- package/script/src/schemas/info/orders.d.ts +151 -151
- package/script/src/schemas/info/orders.js +36 -35
- package/script/src/schemas/info/orders.js.map +1 -0
- package/script/src/schemas/info/requests.d.ts +145 -88
- package/script/src/schemas/info/requests.d.ts.map +1 -1
- package/script/src/schemas/info/requests.js +116 -73
- package/script/src/schemas/info/requests.js.map +1 -0
- package/script/src/schemas/info/validators.d.ts +60 -39
- package/script/src/schemas/info/validators.d.ts.map +1 -1
- package/script/src/schemas/info/validators.js +40 -26
- package/script/src/schemas/info/validators.js.map +1 -0
- package/script/src/schemas/info/vaults.d.ts +59 -59
- package/script/src/schemas/info/vaults.js +19 -18
- package/script/src/schemas/info/vaults.js.map +1 -0
- package/script/src/schemas/mod.d.ts +4 -3
- package/script/src/schemas/mod.d.ts.map +1 -1
- package/script/src/schemas/mod.js +8 -5
- package/script/src/schemas/mod.js.map +1 -0
- package/script/src/schemas/subscriptions/requests.d.ts +23 -23
- package/script/src/schemas/subscriptions/requests.d.ts.map +1 -1
- package/script/src/schemas/subscriptions/requests.js +24 -23
- package/script/src/schemas/subscriptions/requests.js.map +1 -0
- package/script/src/schemas/subscriptions/responses.d.ts +547 -547
- package/script/src/schemas/subscriptions/responses.js +40 -39
- package/script/src/schemas/subscriptions/responses.js.map +1 -0
- package/script/src/signing/mod.d.ts +1 -1
- package/script/src/signing/mod.d.ts.map +1 -1
- package/script/src/signing/mod.js +4 -3
- package/script/src/signing/mod.js.map +1 -0
- package/script/src/signing/signTypedData/ethers.d.ts.map +1 -0
- package/script/src/signing/{_signTypedData → signTypedData}/ethers.js +1 -0
- package/script/src/signing/signTypedData/ethers.js.map +1 -0
- package/script/src/signing/signTypedData/mod.d.ts.map +1 -0
- package/script/src/signing/{_signTypedData → signTypedData}/mod.js +1 -0
- package/script/src/signing/signTypedData/mod.js.map +1 -0
- package/script/src/signing/signTypedData/private_key.d.ts.map +1 -0
- package/script/src/signing/{_signTypedData → signTypedData}/private_key.js +17 -15
- package/script/src/signing/signTypedData/private_key.js.map +1 -0
- package/script/src/signing/signTypedData/viem.d.ts.map +1 -0
- package/script/src/signing/{_signTypedData → signTypedData}/viem.js +1 -0
- package/script/src/signing/signTypedData/viem.js.map +1 -0
- package/script/src/transports/base.d.ts +4 -4
- package/script/src/transports/base.d.ts.map +1 -1
- package/script/src/transports/base.js +4 -3
- package/script/src/transports/base.js.map +1 -0
- package/script/src/transports/http/http_transport.d.ts +1 -1
- package/script/src/transports/http/http_transport.js +1 -0
- package/script/src/transports/http/http_transport.js.map +1 -0
- package/script/src/transports/websocket/_hyperliquid_event_target.js +1 -0
- package/script/src/transports/websocket/_hyperliquid_event_target.js.map +1 -0
- package/script/src/transports/websocket/_reconnecting_websocket.js +1 -0
- package/script/src/transports/websocket/_reconnecting_websocket.js.map +1 -0
- package/script/src/transports/websocket/_websocket_async_request.js +1 -0
- package/script/src/transports/websocket/_websocket_async_request.js.map +1 -0
- package/script/src/transports/websocket/websocket_transport.d.ts +7 -0
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +4 -0
- package/script/src/transports/websocket/websocket_transport.js.map +1 -0
- package/src/bin/cli.ts +481 -0
- package/src/src/_errors.ts +7 -0
- package/src/src/clients/exchange.ts +2246 -0
- package/src/src/clients/info.ts +2110 -0
- package/src/src/clients/multiSign.ts +183 -0
- package/src/src/clients/subscription.ts +841 -0
- package/src/src/mod.ts +29 -0
- package/src/src/schemas/_base.ts +82 -0
- package/src/src/schemas/exchange/requests.ts +3052 -0
- package/src/src/schemas/exchange/responses.ts +540 -0
- package/src/src/schemas/explorer/requests.ts +65 -0
- package/src/src/schemas/explorer/responses.ts +138 -0
- package/src/src/schemas/info/accounts.ts +1598 -0
- package/src/src/schemas/info/assets.ts +693 -0
- package/src/src/schemas/info/markets.ts +171 -0
- package/src/src/schemas/info/orders.ts +597 -0
- package/src/src/schemas/info/requests.ts +1401 -0
- package/src/src/schemas/info/validators.ts +297 -0
- package/src/src/schemas/info/vaults.ts +262 -0
- package/src/src/schemas/mod.ts +121 -0
- package/src/src/schemas/subscriptions/requests.ts +514 -0
- package/src/src/schemas/subscriptions/responses.ts +576 -0
- package/src/src/signing/mod.ts +572 -0
- package/src/src/signing/signTypedData/ethers.ts +59 -0
- package/src/src/signing/signTypedData/mod.ts +121 -0
- package/src/src/signing/signTypedData/private_key.ts +234 -0
- package/src/src/signing/signTypedData/viem.ts +55 -0
- package/src/src/transports/base.ts +54 -0
- package/src/src/transports/http/http_transport.ts +208 -0
- package/src/src/transports/websocket/_hyperliquid_event_target.ts +118 -0
- package/src/src/transports/websocket/_reconnecting_websocket.ts +404 -0
- package/src/src/transports/websocket/_websocket_async_request.ts +229 -0
- package/src/src/transports/websocket/websocket_transport.ts +394 -0
- package/esm/mod.d.ts +0 -20
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -11
- package/esm/src/errors.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/ethers.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/mod.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/private_key.d.ts.map +0 -1
- package/esm/src/signing/_signTypedData/viem.d.ts.map +0 -1
- package/script/mod.d.ts +0 -20
- package/script/mod.d.ts.map +0 -1
- package/script/src/errors.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/ethers.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/mod.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/private_key.d.ts.map +0 -1
- package/script/src/signing/_signTypedData/viem.d.ts.map +0 -1
- /package/esm/src/signing/{_signTypedData → signTypedData}/ethers.d.ts +0 -0
- /package/esm/src/signing/{_signTypedData → signTypedData}/mod.d.ts +0 -0
- /package/esm/src/signing/{_signTypedData → signTypedData}/private_key.d.ts +0 -0
- /package/esm/src/signing/{_signTypedData → signTypedData}/viem.d.ts +0 -0
- /package/script/src/signing/{_signTypedData → signTypedData}/ethers.d.ts +0 -0
- /package/script/src/signing/{_signTypedData → signTypedData}/mod.d.ts +0 -0
- /package/script/src/signing/{_signTypedData → signTypedData}/private_key.d.ts +0 -0
- /package/script/src/signing/{_signTypedData → signTypedData}/viem.d.ts +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { Hex, TokenId,
|
|
2
|
+
import { Hex, TokenId, UnsignedDecimalMayInputNumber, UnsignedIntegerMayInputString } from "../_base.js";
|
|
3
|
+
import { TIF } from "../info/orders.js";
|
|
3
4
|
/** Deeply removes undefined keys from an object. */
|
|
4
5
|
function removeUndefinedKeys(obj) {
|
|
5
6
|
if (typeof obj !== "object" || obj === null) {
|
|
@@ -19,7 +20,7 @@ function removeUndefinedKeys(obj) {
|
|
|
19
20
|
}
|
|
20
21
|
const Percent = v.pipe(v.string(), v.regex(/^[0-9]+(\.[0-9]+)?%$/), v.transform((value) => value));
|
|
21
22
|
/** ECDSA signature components for Ethereum typed data. */
|
|
22
|
-
export const Signature = v.pipe(v.
|
|
23
|
+
export const Signature = v.pipe(v.object({
|
|
23
24
|
/** First 32-byte component of ECDSA signature. */
|
|
24
25
|
r: v.pipe(v.pipe(Hex, v.length(66), v.transform((value) => value.replace(/^0x0+/, "0x"))), v.description("First 32-byte component of ECDSA signature.")),
|
|
25
26
|
/** Second 32-byte component of ECDSA signature. */
|
|
@@ -28,39 +29,33 @@ export const Signature = v.pipe(v.strictObject({
|
|
|
28
29
|
v: v.pipe(v.union([v.literal(27), v.literal(28)]), v.description("Recovery identifier.")),
|
|
29
30
|
}), v.description("ECDSA signature components for Ethereum typed data."));
|
|
30
31
|
/** Order parameters. */
|
|
31
|
-
export const OrderParams = v.pipe(v.
|
|
32
|
+
export const OrderParams = v.pipe(v.object({
|
|
32
33
|
/** Asset ID. */
|
|
33
|
-
a: v.pipe(
|
|
34
|
+
a: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
34
35
|
/** Position side (`true` for long, `false` for short). */
|
|
35
36
|
b: v.pipe(v.boolean(), v.description("Position side (`true` for long, `false` for short).")),
|
|
36
37
|
/** Price. */
|
|
37
|
-
p: v.pipe(
|
|
38
|
+
p: v.pipe(UnsignedDecimalMayInputNumber, v.description("Price.")),
|
|
38
39
|
/** Size (in base currency units). */
|
|
39
|
-
s: v.pipe(
|
|
40
|
+
s: v.pipe(UnsignedDecimalMayInputNumber, v.description("Size (in base currency units).")),
|
|
40
41
|
/** Is reduce-only? */
|
|
41
42
|
r: v.pipe(v.boolean(), v.description("Is reduce-only?")),
|
|
42
43
|
/** Order type. */
|
|
43
44
|
t: v.pipe(v.union([
|
|
44
|
-
v.
|
|
45
|
+
v.object({
|
|
45
46
|
/** Limit order parameters. */
|
|
46
|
-
limit: v.pipe(v.
|
|
47
|
+
limit: v.pipe(v.object({
|
|
47
48
|
/** Time-in-force. */
|
|
48
|
-
tif: v.pipe(v.
|
|
49
|
-
v.literal("Gtc"),
|
|
50
|
-
v.literal("Ioc"),
|
|
51
|
-
v.literal("Alo"),
|
|
52
|
-
v.literal("FrontendMarket"),
|
|
53
|
-
v.literal("LiquidationMarket"),
|
|
54
|
-
]), v.description("Time-in-force.")),
|
|
49
|
+
tif: v.pipe(TIF, v.description("Time-in-force.")),
|
|
55
50
|
}), v.description("Limit order parameters.")),
|
|
56
51
|
}),
|
|
57
|
-
v.
|
|
52
|
+
v.object({
|
|
58
53
|
/** Trigger order parameters. */
|
|
59
|
-
trigger: v.pipe(v.
|
|
54
|
+
trigger: v.pipe(v.object({
|
|
60
55
|
/** Is market order? */
|
|
61
56
|
isMarket: v.pipe(v.boolean(), v.description("Is market order?")),
|
|
62
57
|
/** Trigger price. */
|
|
63
|
-
triggerPx: v.pipe(
|
|
58
|
+
triggerPx: v.pipe(UnsignedDecimalMayInputNumber, v.description("Trigger price.")),
|
|
64
59
|
/** Indicates whether it is take profit or stop loss. */
|
|
65
60
|
tpsl: v.pipe(v.union([v.literal("tp"), v.literal("sl")]), v.description("Indicates whether it is take profit or stop loss.")),
|
|
66
61
|
}), v.description("Trigger order parameters.")),
|
|
@@ -74,9 +69,9 @@ export const OrderParams = v.pipe(v.strictObject({
|
|
|
74
69
|
* @returns {SuccessResponse}
|
|
75
70
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-an-api-wallet
|
|
76
71
|
*/
|
|
77
|
-
export const ApproveAgentRequest = v.pipe(v.
|
|
72
|
+
export const ApproveAgentRequest = v.pipe(v.object({
|
|
78
73
|
/** Action to perform. */
|
|
79
|
-
action: v.pipe(v.
|
|
74
|
+
action: v.pipe(v.object({
|
|
80
75
|
/** Type of action. */
|
|
81
76
|
type: v.pipe(v.literal("approveAgent"), v.description("Type of action.")),
|
|
82
77
|
/** Chain ID used for signing. */
|
|
@@ -88,10 +83,10 @@ export const ApproveAgentRequest = v.pipe(v.strictObject({
|
|
|
88
83
|
/** Agent name or null for unnamed agent. */
|
|
89
84
|
agentName: v.pipe(v.nullable(v.string()), v.description("Agent name or null for unnamed agent.")),
|
|
90
85
|
/** Unique request identifier (current timestamp in ms). */
|
|
91
|
-
nonce: v.pipe(
|
|
86
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
92
87
|
}), v.description("Action to perform.")),
|
|
93
88
|
/** Unique request identifier (current timestamp in ms). */
|
|
94
|
-
nonce: v.pipe(
|
|
89
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
95
90
|
/** Cryptographic signature. */
|
|
96
91
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
97
92
|
}), v.transform(removeUndefinedKeys), v.description("Approve an agent to sign on behalf of the master account."));
|
|
@@ -100,9 +95,9 @@ export const ApproveAgentRequest = v.pipe(v.strictObject({
|
|
|
100
95
|
* @returns {SuccessResponse}
|
|
101
96
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee
|
|
102
97
|
*/
|
|
103
|
-
export const ApproveBuilderFeeRequest = v.pipe(v.
|
|
98
|
+
export const ApproveBuilderFeeRequest = v.pipe(v.object({
|
|
104
99
|
/** Action to perform. */
|
|
105
|
-
action: v.pipe(v.
|
|
100
|
+
action: v.pipe(v.object({
|
|
106
101
|
/** Type of action. */
|
|
107
102
|
type: v.pipe(v.literal("approveBuilderFee"), v.description("Type of action.")),
|
|
108
103
|
/** Chain ID used for signing. */
|
|
@@ -114,10 +109,10 @@ export const ApproveBuilderFeeRequest = v.pipe(v.strictObject({
|
|
|
114
109
|
/** Builder address. */
|
|
115
110
|
builder: v.pipe(v.pipe(Hex, v.length(42)), v.description("Builder address.")),
|
|
116
111
|
/** Unique request identifier (current timestamp in ms). */
|
|
117
|
-
nonce: v.pipe(
|
|
112
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
118
113
|
}), v.description("Action to perform.")),
|
|
119
114
|
/** Unique request identifier (current timestamp in ms). */
|
|
120
|
-
nonce: v.pipe(
|
|
115
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
121
116
|
/** Cryptographic signature. */
|
|
122
117
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
123
118
|
}), v.transform(removeUndefinedKeys), v.description("Approve a maximum fee rate for a builder."));
|
|
@@ -126,16 +121,16 @@ export const ApproveBuilderFeeRequest = v.pipe(v.strictObject({
|
|
|
126
121
|
* @returns {OrderResponse}
|
|
127
122
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
|
128
123
|
*/
|
|
129
|
-
export const BatchModifyRequest = v.pipe(v.
|
|
124
|
+
export const BatchModifyRequest = v.pipe(v.object({
|
|
130
125
|
/** Action to perform. */
|
|
131
|
-
action: v.pipe(v.
|
|
126
|
+
action: v.pipe(v.object({
|
|
132
127
|
/** Type of action. */
|
|
133
128
|
type: v.pipe(v.literal("batchModify"), v.description("Type of action.")),
|
|
134
129
|
/** Order modifications. */
|
|
135
|
-
modifies: v.pipe(v.array(v.
|
|
130
|
+
modifies: v.pipe(v.array(v.object({
|
|
136
131
|
/** Order ID or Client Order ID. */
|
|
137
132
|
oid: v.pipe(v.union([
|
|
138
|
-
|
|
133
|
+
UnsignedIntegerMayInputString,
|
|
139
134
|
v.pipe(Hex, v.length(34)),
|
|
140
135
|
]), v.description("Order ID or Client Order ID.")),
|
|
141
136
|
/** New order parameters. */
|
|
@@ -143,76 +138,76 @@ export const BatchModifyRequest = v.pipe(v.strictObject({
|
|
|
143
138
|
})), v.description("Order modifications.")),
|
|
144
139
|
}), v.description("Action to perform.")),
|
|
145
140
|
/** Unique request identifier (current timestamp in ms). */
|
|
146
|
-
nonce: v.pipe(
|
|
141
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
147
142
|
/** Cryptographic signature. */
|
|
148
143
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
149
144
|
/** Vault address (for vault trading). */
|
|
150
145
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
151
146
|
/** Expiration time of the action. */
|
|
152
|
-
expiresAfter: v.pipe(v.optional(
|
|
147
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
153
148
|
}), v.transform(removeUndefinedKeys), v.description("Modify multiple orders."));
|
|
154
149
|
/**
|
|
155
150
|
* Cancel order(s).
|
|
156
151
|
* @returns {CancelResponse}
|
|
157
152
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
|
158
153
|
*/
|
|
159
|
-
export const CancelRequest = v.pipe(v.
|
|
154
|
+
export const CancelRequest = v.pipe(v.object({
|
|
160
155
|
/** Action to perform. */
|
|
161
|
-
action: v.pipe(v.
|
|
156
|
+
action: v.pipe(v.object({
|
|
162
157
|
/** Type of action. */
|
|
163
158
|
type: v.pipe(v.literal("cancel"), v.description("Type of action.")),
|
|
164
159
|
/** Orders to cancel. */
|
|
165
|
-
cancels: v.pipe(v.array(v.
|
|
160
|
+
cancels: v.pipe(v.array(v.object({
|
|
166
161
|
/** Asset ID. */
|
|
167
|
-
a: v.pipe(
|
|
162
|
+
a: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
168
163
|
/** Order ID. */
|
|
169
|
-
o: v.pipe(
|
|
164
|
+
o: v.pipe(UnsignedIntegerMayInputString, v.description("Order ID.")),
|
|
170
165
|
})), v.description("Orders to cancel.")),
|
|
171
166
|
}), v.description("Action to perform.")),
|
|
172
167
|
/** Unique request identifier (current timestamp in ms). */
|
|
173
|
-
nonce: v.pipe(
|
|
168
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
174
169
|
/** Cryptographic signature. */
|
|
175
170
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
176
171
|
/** Vault address (for vault trading). */
|
|
177
172
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
178
173
|
/** Expiration time of the action. */
|
|
179
|
-
expiresAfter: v.pipe(v.optional(
|
|
174
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
180
175
|
}), v.transform(removeUndefinedKeys), v.description("Cancel order(s)."));
|
|
181
176
|
/**
|
|
182
177
|
* Cancel order(s) by cloid.
|
|
183
178
|
* @returns {CancelResponse}
|
|
184
179
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
|
185
180
|
*/
|
|
186
|
-
export const CancelByCloidRequest = v.pipe(v.
|
|
181
|
+
export const CancelByCloidRequest = v.pipe(v.object({
|
|
187
182
|
/** Action to perform. */
|
|
188
|
-
action: v.pipe(v.
|
|
183
|
+
action: v.pipe(v.object({
|
|
189
184
|
/** Type of action. */
|
|
190
185
|
type: v.pipe(v.literal("cancelByCloid"), v.description("Type of action.")),
|
|
191
186
|
/** Orders to cancel. */
|
|
192
|
-
cancels: v.pipe(v.array(v.
|
|
187
|
+
cancels: v.pipe(v.array(v.object({
|
|
193
188
|
/** Asset ID. */
|
|
194
|
-
asset: v.pipe(
|
|
189
|
+
asset: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
195
190
|
/** Client Order ID. */
|
|
196
191
|
cloid: v.pipe(v.pipe(Hex, v.length(34)), v.description("Client Order ID.")),
|
|
197
192
|
})), v.description("Orders to cancel.")),
|
|
198
193
|
}), v.description("Action to perform.")),
|
|
199
194
|
/** Unique request identifier (current timestamp in ms). */
|
|
200
|
-
nonce: v.pipe(
|
|
195
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
201
196
|
/** Cryptographic signature. */
|
|
202
197
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
203
198
|
/** Vault address (for vault trading). */
|
|
204
199
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
205
200
|
/** Expiration time of the action. */
|
|
206
|
-
expiresAfter: v.pipe(v.optional(
|
|
201
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
207
202
|
}), v.transform(removeUndefinedKeys), v.description("Cancel order(s) by cloid."));
|
|
208
203
|
/**
|
|
209
204
|
* Transfer native token from the user spot account into staking for delegating to validators.
|
|
210
205
|
* @returns {SuccessResponse}
|
|
211
206
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-into-staking
|
|
212
207
|
*/
|
|
213
|
-
export const CDepositRequest = v.pipe(v.
|
|
208
|
+
export const CDepositRequest = v.pipe(v.object({
|
|
214
209
|
/** Action to perform. */
|
|
215
|
-
action: v.pipe(v.
|
|
210
|
+
action: v.pipe(v.object({
|
|
216
211
|
/** Type of action. */
|
|
217
212
|
type: v.pipe(v.literal("cDeposit"), v.description("Type of action.")),
|
|
218
213
|
/** Chain ID used for signing. */
|
|
@@ -220,12 +215,12 @@ export const CDepositRequest = v.pipe(v.strictObject({
|
|
|
220
215
|
/** HyperLiquid network. */
|
|
221
216
|
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
222
217
|
/** Amount of wei to deposit into staking balance (float * 1e8). */
|
|
223
|
-
wei: v.pipe(
|
|
218
|
+
wei: v.pipe(UnsignedIntegerMayInputString, v.description("Amount of wei to deposit into staking balance (float * 1e8).")),
|
|
224
219
|
/** Unique request identifier (current timestamp in ms). */
|
|
225
|
-
nonce: v.pipe(
|
|
220
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
226
221
|
}), v.description("Action to perform.")),
|
|
227
222
|
/** Unique request identifier (current timestamp in ms). */
|
|
228
|
-
nonce: v.pipe(
|
|
223
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
229
224
|
/** Cryptographic signature. */
|
|
230
225
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
231
226
|
}), v.transform(removeUndefinedKeys), v.description("Transfer native token from the user spot account into staking for delegating to validators."));
|
|
@@ -234,26 +229,26 @@ export const CDepositRequest = v.pipe(v.strictObject({
|
|
|
234
229
|
* @returns {SuccessResponse}
|
|
235
230
|
* @see null
|
|
236
231
|
*/
|
|
237
|
-
export const ClaimRewardsRequest = v.pipe(v.
|
|
232
|
+
export const ClaimRewardsRequest = v.pipe(v.object({
|
|
238
233
|
/** Action to perform. */
|
|
239
|
-
action: v.pipe(v.
|
|
234
|
+
action: v.pipe(v.object({
|
|
240
235
|
/** Type of action. */
|
|
241
236
|
type: v.pipe(v.literal("claimRewards"), v.description("Type of action.")),
|
|
242
237
|
}), v.description("Action to perform.")),
|
|
243
238
|
/** Unique request identifier (current timestamp in ms). */
|
|
244
|
-
nonce: v.pipe(
|
|
239
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
245
240
|
/** Cryptographic signature. */
|
|
246
241
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
247
242
|
/** Expiration time of the action. */
|
|
248
|
-
expiresAfter: v.pipe(v.optional(
|
|
243
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
249
244
|
}), v.transform(removeUndefinedKeys), v.description("Claim rewards from referral program."));
|
|
250
245
|
/** Signers configuration for {@linkcode ConvertToMultiSigUserRequest}. */
|
|
251
246
|
export const ConvertToMultiSigUserRequestSigners = v.pipe(v.union([
|
|
252
|
-
v.
|
|
247
|
+
v.object({
|
|
253
248
|
/** List of authorized user addresses. */
|
|
254
249
|
authorizedUsers: v.pipe(v.array(v.pipe(Hex, v.length(42))), v.description("List of authorized user addresses.")),
|
|
255
250
|
/** Minimum number of signatures required. */
|
|
256
|
-
threshold: v.pipe(
|
|
251
|
+
threshold: v.pipe(UnsignedIntegerMayInputString, v.description("Minimum number of signatures required.")),
|
|
257
252
|
}),
|
|
258
253
|
/** Convert a multi-signature account to a single-signature account. */
|
|
259
254
|
v.pipe(v.null(), v.description("Convert a multi-signature account to a single-signature account.")),
|
|
@@ -263,9 +258,9 @@ export const ConvertToMultiSigUserRequestSigners = v.pipe(v.union([
|
|
|
263
258
|
* @returns {SuccessResponse}
|
|
264
259
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
265
260
|
*/
|
|
266
|
-
export const ConvertToMultiSigUserRequest = v.pipe(v.
|
|
261
|
+
export const ConvertToMultiSigUserRequest = v.pipe(v.object({
|
|
267
262
|
/** Action to perform. */
|
|
268
|
-
action: v.pipe(v.
|
|
263
|
+
action: v.pipe(v.object({
|
|
269
264
|
/** Type of action. */
|
|
270
265
|
type: v.pipe(v.literal("convertToMultiSigUser"), v.description("Type of action.")),
|
|
271
266
|
/** Chain ID used for signing. */
|
|
@@ -283,10 +278,10 @@ export const ConvertToMultiSigUserRequest = v.pipe(v.strictObject({
|
|
|
283
278
|
]), v.description("Signers configuration." +
|
|
284
279
|
"\n\nMust be `ConvertToMultiSigUserRequestSigners` converted to a string via `JSON.stringify(...)`.")),
|
|
285
280
|
/** Unique request identifier (current timestamp in ms). */
|
|
286
|
-
nonce: v.pipe(
|
|
281
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
287
282
|
}), v.description("Action to perform.")),
|
|
288
283
|
/** Unique request identifier (current timestamp in ms). */
|
|
289
|
-
nonce: v.pipe(
|
|
284
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
290
285
|
/** Cryptographic signature. */
|
|
291
286
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
292
287
|
}), v.transform(removeUndefinedKeys), v.description("Convert a single-signature account to a multi-signature account."));
|
|
@@ -295,29 +290,29 @@ export const ConvertToMultiSigUserRequest = v.pipe(v.strictObject({
|
|
|
295
290
|
* @returns {CreateSubAccountResponse}
|
|
296
291
|
* @see null
|
|
297
292
|
*/
|
|
298
|
-
export const CreateSubAccountRequest = v.pipe(v.
|
|
293
|
+
export const CreateSubAccountRequest = v.pipe(v.object({
|
|
299
294
|
/** Action to perform. */
|
|
300
|
-
action: v.pipe(v.
|
|
295
|
+
action: v.pipe(v.object({
|
|
301
296
|
/** Type of action. */
|
|
302
297
|
type: v.pipe(v.literal("createSubAccount"), v.description("Type of action.")),
|
|
303
298
|
/** Sub-account name. */
|
|
304
299
|
name: v.pipe(v.string(), v.minLength(1), v.description("Sub-account name.")),
|
|
305
300
|
}), v.description("Action to perform.")),
|
|
306
301
|
/** Unique request identifier (current timestamp in ms). */
|
|
307
|
-
nonce: v.pipe(
|
|
302
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
308
303
|
/** Cryptographic signature. */
|
|
309
304
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
310
305
|
/** Expiration time of the action. */
|
|
311
|
-
expiresAfter: v.pipe(v.optional(
|
|
306
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
312
307
|
}), v.transform(removeUndefinedKeys), v.description("Create a sub-account."));
|
|
313
308
|
/**
|
|
314
309
|
* Create a vault.
|
|
315
310
|
* @returns {CreateVaultResponse}
|
|
316
311
|
* @see null
|
|
317
312
|
*/
|
|
318
|
-
export const CreateVaultRequest = v.pipe(v.
|
|
313
|
+
export const CreateVaultRequest = v.pipe(v.object({
|
|
319
314
|
/** Action to perform. */
|
|
320
|
-
action: v.pipe(v.
|
|
315
|
+
action: v.pipe(v.object({
|
|
321
316
|
/** Type of action. */
|
|
322
317
|
type: v.pipe(v.literal("createVault"), v.description("Type of action.")),
|
|
323
318
|
/** Vault name. */
|
|
@@ -325,17 +320,17 @@ export const CreateVaultRequest = v.pipe(v.strictObject({
|
|
|
325
320
|
/** Vault description. */
|
|
326
321
|
description: v.pipe(v.string(), v.minLength(10), v.description("Vault description.")),
|
|
327
322
|
/** Initial balance (float * 1e6). */
|
|
328
|
-
initialUsd: v.pipe(
|
|
323
|
+
initialUsd: v.pipe(UnsignedIntegerMayInputString, v.minValue(100000000), // 100 USDC
|
|
329
324
|
v.description("Initial balance (float * 1e6).")),
|
|
330
325
|
/** Unique request identifier (current timestamp in ms). */
|
|
331
|
-
nonce: v.pipe(
|
|
326
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
332
327
|
}), v.description("Action to perform.")),
|
|
333
328
|
/** Unique request identifier (current timestamp in ms). */
|
|
334
|
-
nonce: v.pipe(
|
|
329
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
335
330
|
/** Cryptographic signature. */
|
|
336
331
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
337
332
|
/** Expiration time of the action. */
|
|
338
|
-
expiresAfter: v.pipe(v.optional(
|
|
333
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
339
334
|
}), v.transform(removeUndefinedKeys), v.description("Create a vault."));
|
|
340
335
|
/**
|
|
341
336
|
* Perform an action on a signer:
|
|
@@ -344,16 +339,16 @@ export const CreateVaultRequest = v.pipe(v.strictObject({
|
|
|
344
339
|
* @returns {SuccessResponse}
|
|
345
340
|
* @see null
|
|
346
341
|
*/
|
|
347
|
-
export const CSignerActionRequest = v.pipe(v.
|
|
342
|
+
export const CSignerActionRequest = v.pipe(v.object({
|
|
348
343
|
/** Action to perform. */
|
|
349
344
|
action: v.pipe(v.union([
|
|
350
|
-
v.
|
|
345
|
+
v.object({
|
|
351
346
|
/** Type of action. */
|
|
352
347
|
type: v.pipe(v.literal("CSignerAction"), v.description("Type of action.")),
|
|
353
348
|
/** Jail the signer. */
|
|
354
349
|
jailSelf: v.pipe(v.null(), v.description("Jail the signer.")),
|
|
355
350
|
}),
|
|
356
|
-
v.
|
|
351
|
+
v.object({
|
|
357
352
|
/** Type of action. */
|
|
358
353
|
type: v.pipe(v.literal("CSignerAction"), v.description("Type of action.")),
|
|
359
354
|
/** Unjail the signer. */
|
|
@@ -361,11 +356,11 @@ export const CSignerActionRequest = v.pipe(v.strictObject({
|
|
|
361
356
|
}),
|
|
362
357
|
]), v.description("Action to perform.")),
|
|
363
358
|
/** Unique request identifier (current timestamp in ms). */
|
|
364
|
-
nonce: v.pipe(
|
|
359
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
365
360
|
/** Cryptographic signature. */
|
|
366
361
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
367
362
|
/** Expiration time of the action. */
|
|
368
|
-
expiresAfter: v.pipe(v.optional(
|
|
363
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
369
364
|
}), v.transform(removeUndefinedKeys), v.description("Perform an action on a signer." +
|
|
370
365
|
"\n- Jail to prevent them from signing transactions." +
|
|
371
366
|
"\n- Unjail to allow them to sign transactions again."));
|
|
@@ -377,17 +372,17 @@ export const CSignerActionRequest = v.pipe(v.strictObject({
|
|
|
377
372
|
* @returns {SuccessResponse}
|
|
378
373
|
* @see null
|
|
379
374
|
*/
|
|
380
|
-
export const CValidatorActionRequest = v.pipe(v.
|
|
375
|
+
export const CValidatorActionRequest = v.pipe(v.object({
|
|
381
376
|
/** Action to perform. */
|
|
382
377
|
action: v.pipe(v.union([
|
|
383
|
-
v.
|
|
378
|
+
v.object({
|
|
384
379
|
/** Type of action. */
|
|
385
380
|
type: v.pipe(v.literal("CValidatorAction"), v.description("Type of action.")),
|
|
386
381
|
/** Profile changes to apply. */
|
|
387
|
-
changeProfile: v.pipe(v.
|
|
382
|
+
changeProfile: v.pipe(v.object({
|
|
388
383
|
/** Validator node IP address. */
|
|
389
384
|
node_ip: v.pipe(v.union([
|
|
390
|
-
v.
|
|
385
|
+
v.object({
|
|
391
386
|
/** IP address. */
|
|
392
387
|
Ip: v.pipe(v.string(), v.ip(), v.description("IP address.")),
|
|
393
388
|
}),
|
|
@@ -402,20 +397,20 @@ export const CValidatorActionRequest = v.pipe(v.strictObject({
|
|
|
402
397
|
/** Enable or disable delegations. */
|
|
403
398
|
disable_delegations: v.pipe(v.nullable(v.boolean()), v.description("Enable or disable delegations.")),
|
|
404
399
|
/** Commission rate in basis points (1 = 0.0001%). */
|
|
405
|
-
commission_bps: v.pipe(v.nullable(
|
|
400
|
+
commission_bps: v.pipe(v.nullable(UnsignedIntegerMayInputString), v.description("Commission rate in basis points (1 = 0.0001%).")),
|
|
406
401
|
/** Signer address. */
|
|
407
402
|
signer: v.pipe(v.nullable(v.pipe(Hex, v.length(42))), v.description("Signer address.")),
|
|
408
403
|
}), v.description("Profile changes to apply.")),
|
|
409
404
|
}),
|
|
410
|
-
v.
|
|
405
|
+
v.object({
|
|
411
406
|
/** Type of action. */
|
|
412
407
|
type: v.pipe(v.literal("CValidatorAction"), v.description("Type of action.")),
|
|
413
408
|
/** Registration parameters. */
|
|
414
|
-
register: v.pipe(v.
|
|
409
|
+
register: v.pipe(v.object({
|
|
415
410
|
/** Validator profile information. */
|
|
416
|
-
profile: v.pipe(v.
|
|
411
|
+
profile: v.pipe(v.object({
|
|
417
412
|
/** Validator node IP address. */
|
|
418
|
-
node_ip: v.pipe(v.
|
|
413
|
+
node_ip: v.pipe(v.object({
|
|
419
414
|
/** IP address. */
|
|
420
415
|
Ip: v.pipe(v.string(), v.ip(), v.description("IP address.")),
|
|
421
416
|
}), v.description("Validator node IP address.")),
|
|
@@ -426,17 +421,17 @@ export const CValidatorActionRequest = v.pipe(v.strictObject({
|
|
|
426
421
|
/** Whether delegations are disabled. */
|
|
427
422
|
delegations_disabled: v.pipe(v.boolean(), v.description("Whether delegations are disabled.")),
|
|
428
423
|
/** Commission rate in basis points (1 = 0.0001%). */
|
|
429
|
-
commission_bps: v.pipe(
|
|
424
|
+
commission_bps: v.pipe(UnsignedIntegerMayInputString, v.description("Commission rate in basis points (1 = 0.0001%).")),
|
|
430
425
|
/** Signer address. */
|
|
431
426
|
signer: v.pipe(v.pipe(Hex, v.length(42)), v.description("Signer address.")),
|
|
432
427
|
}), v.description("Validator profile information.")),
|
|
433
428
|
/** Initial jail status. */
|
|
434
429
|
unjailed: v.pipe(v.boolean(), v.description("Initial jail status.")),
|
|
435
430
|
/** Initial stake amount in wei. */
|
|
436
|
-
initial_wei: v.pipe(
|
|
431
|
+
initial_wei: v.pipe(UnsignedIntegerMayInputString, v.description("Initial stake amount in wei.")),
|
|
437
432
|
}), v.description("Registration parameters.")),
|
|
438
433
|
}),
|
|
439
|
-
v.
|
|
434
|
+
v.object({
|
|
440
435
|
/** Type of action. */
|
|
441
436
|
type: v.pipe(v.literal("CValidatorAction"), v.description("Type of action.")),
|
|
442
437
|
/** Unregister the validator. */
|
|
@@ -444,11 +439,11 @@ export const CValidatorActionRequest = v.pipe(v.strictObject({
|
|
|
444
439
|
}),
|
|
445
440
|
]), v.description("Action to perform.")),
|
|
446
441
|
/** Unique request identifier (current timestamp in ms). */
|
|
447
|
-
nonce: v.pipe(
|
|
442
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
448
443
|
/** Cryptographic signature. */
|
|
449
444
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
450
445
|
/** Expiration time of the action. */
|
|
451
|
-
expiresAfter: v.pipe(v.optional(
|
|
446
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
452
447
|
}), v.transform(removeUndefinedKeys), v.description("Perform an action on a validator:" +
|
|
453
448
|
"\n- Change profile information." +
|
|
454
449
|
"\n- Register a new validator." +
|
|
@@ -458,9 +453,9 @@ export const CValidatorActionRequest = v.pipe(v.strictObject({
|
|
|
458
453
|
* @returns {SuccessResponse}
|
|
459
454
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#withdraw-from-staking
|
|
460
455
|
*/
|
|
461
|
-
export const CWithdrawRequest = v.pipe(v.
|
|
456
|
+
export const CWithdrawRequest = v.pipe(v.object({
|
|
462
457
|
/** Action to perform. */
|
|
463
|
-
action: v.pipe(v.
|
|
458
|
+
action: v.pipe(v.object({
|
|
464
459
|
/** Type of action. */
|
|
465
460
|
type: v.pipe(v.literal("cWithdraw"), v.description("Type of action.")),
|
|
466
461
|
/** Chain ID used for signing. */
|
|
@@ -468,12 +463,12 @@ export const CWithdrawRequest = v.pipe(v.strictObject({
|
|
|
468
463
|
/** HyperLiquid network. */
|
|
469
464
|
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
470
465
|
/** Amount of wei to withdraw from staking balance (float * 1e8). */
|
|
471
|
-
wei: v.pipe(
|
|
466
|
+
wei: v.pipe(UnsignedIntegerMayInputString, v.description("Amount of wei to withdraw from staking balance (float * 1e8).")),
|
|
472
467
|
/** Unique request identifier (current timestamp in ms). */
|
|
473
|
-
nonce: v.pipe(
|
|
468
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
474
469
|
}), v.description("Action to perform.")),
|
|
475
470
|
/** Unique request identifier (current timestamp in ms). */
|
|
476
|
-
nonce: v.pipe(
|
|
471
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
477
472
|
/** Cryptographic signature. */
|
|
478
473
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
479
474
|
}), v.transform(removeUndefinedKeys), v.description("Transfer native token from staking into the user spot account."));
|
|
@@ -482,74 +477,74 @@ export const CWithdrawRequest = v.pipe(v.strictObject({
|
|
|
482
477
|
* @returns {SuccessResponse}
|
|
483
478
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/dual-block-architecture
|
|
484
479
|
*/
|
|
485
|
-
export const EvmUserModifyRequest = v.pipe(v.
|
|
480
|
+
export const EvmUserModifyRequest = v.pipe(v.object({
|
|
486
481
|
/** Action to perform. */
|
|
487
|
-
action: v.pipe(v.
|
|
482
|
+
action: v.pipe(v.object({
|
|
488
483
|
/** Type of action. */
|
|
489
484
|
type: v.pipe(v.literal("evmUserModify"), v.description("Type of action.")),
|
|
490
485
|
/** `true` for large blocks, `false` for small blocks. */
|
|
491
486
|
usingBigBlocks: v.pipe(v.boolean(), v.description("`true` for large blocks, `false` for small blocks.")),
|
|
492
487
|
}), v.description("Action to perform.")),
|
|
493
488
|
/** Unique request identifier (current timestamp in ms). */
|
|
494
|
-
nonce: v.pipe(
|
|
489
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
495
490
|
/** Cryptographic signature. */
|
|
496
491
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
497
492
|
/** Expiration time of the action. */
|
|
498
|
-
expiresAfter: v.pipe(v.optional(
|
|
493
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
499
494
|
}), v.transform(removeUndefinedKeys), v.description("Configure block type for EVM transactions."));
|
|
500
495
|
/**
|
|
501
496
|
* Modify an order.
|
|
502
497
|
* @returns {SuccessResponse}
|
|
503
498
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
|
504
499
|
*/
|
|
505
|
-
export const ModifyRequest = v.pipe(v.
|
|
500
|
+
export const ModifyRequest = v.pipe(v.object({
|
|
506
501
|
/** Action to perform. */
|
|
507
|
-
action: v.pipe(v.
|
|
502
|
+
action: v.pipe(v.object({
|
|
508
503
|
/** Type of action. */
|
|
509
504
|
type: v.pipe(v.literal("modify"), v.description("Type of action.")),
|
|
510
505
|
/** Order ID or Client Order ID. */
|
|
511
506
|
oid: v.pipe(v.union([
|
|
512
|
-
|
|
507
|
+
UnsignedIntegerMayInputString,
|
|
513
508
|
v.pipe(Hex, v.length(34)),
|
|
514
509
|
]), v.description("Order ID or Client Order ID.")),
|
|
515
510
|
/** New order parameters. */
|
|
516
511
|
order: v.pipe(OrderParams, v.description("New order parameters.")),
|
|
517
512
|
}), v.description("Action to perform.")),
|
|
518
513
|
/** Unique request identifier (current timestamp in ms). */
|
|
519
|
-
nonce: v.pipe(
|
|
514
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
520
515
|
/** Cryptographic signature. */
|
|
521
516
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
522
517
|
/** Vault address (for vault trading). */
|
|
523
518
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
524
519
|
/** Expiration time of the action. */
|
|
525
|
-
expiresAfter: v.pipe(v.optional(
|
|
520
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
526
521
|
}), v.transform(removeUndefinedKeys), v.description("Modify an order."));
|
|
527
522
|
/**
|
|
528
523
|
* This action does not do anything (no operation), but causes the nonce to be marked as used.
|
|
529
524
|
* @returns {SuccessResponse}
|
|
530
525
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#invalidate-pending-nonce-noop
|
|
531
526
|
*/
|
|
532
|
-
export const NoopRequest = v.pipe(v.
|
|
527
|
+
export const NoopRequest = v.pipe(v.object({
|
|
533
528
|
/** Action to perform. */
|
|
534
|
-
action: v.pipe(v.
|
|
529
|
+
action: v.pipe(v.object({
|
|
535
530
|
/** Type of action. */
|
|
536
531
|
type: v.pipe(v.literal("noop"), v.description("Type of action.")),
|
|
537
532
|
}), v.description("Action to perform.")),
|
|
538
533
|
/** Unique request identifier (current timestamp in ms). */
|
|
539
|
-
nonce: v.pipe(
|
|
534
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
540
535
|
/** Cryptographic signature. */
|
|
541
536
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
542
537
|
/** Expiration time of the action. */
|
|
543
|
-
expiresAfter: v.pipe(v.optional(
|
|
538
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
544
539
|
}), v.transform(removeUndefinedKeys), v.description("This action does not do anything (no operation), but causes the nonce to be marked as used."));
|
|
545
540
|
/**
|
|
546
541
|
* Place an order(s).
|
|
547
542
|
* @returns {OrderResponse}
|
|
548
543
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
|
549
544
|
*/
|
|
550
|
-
export const OrderRequest = v.pipe(v.
|
|
545
|
+
export const OrderRequest = v.pipe(v.object({
|
|
551
546
|
/** Action to perform. */
|
|
552
|
-
action: v.pipe(v.
|
|
547
|
+
action: v.pipe(v.object({
|
|
553
548
|
/** Type of action. */
|
|
554
549
|
type: v.pipe(v.literal("order"), v.description("Type of action.")),
|
|
555
550
|
/** Order parameters. */
|
|
@@ -569,21 +564,21 @@ export const OrderRequest = v.pipe(v.strictObject({
|
|
|
569
564
|
"\n- `normalTpsl`: TP/SL order with fixed size that doesn't adjust with position changes." +
|
|
570
565
|
"\n- `positionTpsl`: TP/SL order that adjusts proportionally with the position size.")),
|
|
571
566
|
/** Builder fee. */
|
|
572
|
-
builder: v.pipe(v.optional(v.
|
|
567
|
+
builder: v.pipe(v.optional(v.object({
|
|
573
568
|
/** Builder address. */
|
|
574
569
|
b: v.pipe(v.pipe(Hex, v.length(42)), v.description("Builder address.")),
|
|
575
570
|
/** Builder fee in 0.1bps (1 = 0.0001%). */
|
|
576
|
-
f: v.pipe(
|
|
571
|
+
f: v.pipe(UnsignedIntegerMayInputString, v.description("Builder fee in 0.1bps (1 = 0.0001%).")),
|
|
577
572
|
})), v.description("Builder fee.")),
|
|
578
573
|
}), v.description("Action to perform.")),
|
|
579
574
|
/** Unique request identifier (current timestamp in ms). */
|
|
580
|
-
nonce: v.pipe(
|
|
575
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
581
576
|
/** Cryptographic signature. */
|
|
582
577
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
583
578
|
/** Vault address (for vault trading). */
|
|
584
579
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
585
580
|
/** Expiration time of the action. */
|
|
586
|
-
expiresAfter: v.pipe(v.optional(
|
|
581
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
587
582
|
}), v.transform(removeUndefinedKeys), v.description("Place an order(s)."));
|
|
588
583
|
/**
|
|
589
584
|
* Deploying HIP-3 assets:
|
|
@@ -592,62 +587,62 @@ export const OrderRequest = v.pipe(v.strictObject({
|
|
|
592
587
|
* @returns {SuccessResponse}
|
|
593
588
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-3-assets
|
|
594
589
|
*/
|
|
595
|
-
export const PerpDeployRequest = v.pipe(v.
|
|
590
|
+
export const PerpDeployRequest = v.pipe(v.object({
|
|
596
591
|
/** Action to perform. */
|
|
597
592
|
action: v.pipe(v.union([
|
|
598
|
-
v.pipe(v.
|
|
593
|
+
v.pipe(v.object({
|
|
599
594
|
/** Type of action. */
|
|
600
595
|
type: v.pipe(v.literal("perpDeploy"), v.description("Type of action.")),
|
|
601
596
|
/** Parameters for registering a new perpetual asset. */
|
|
602
|
-
registerAsset: v.pipe(v.
|
|
597
|
+
registerAsset: v.pipe(v.object({
|
|
603
598
|
/** Max gas in native token wei. If not provided, then uses current deploy auction price. */
|
|
604
|
-
maxGas: v.pipe(v.nullable(
|
|
599
|
+
maxGas: v.pipe(v.nullable(UnsignedIntegerMayInputString), v.description("Max gas in native token wei. If not provided, then uses current deploy auction price.")),
|
|
605
600
|
/** Contains new asset listing parameters. */
|
|
606
|
-
assetRequest: v.pipe(v.
|
|
601
|
+
assetRequest: v.pipe(v.object({
|
|
607
602
|
/** Coin symbol for the new asset. */
|
|
608
603
|
coin: v.pipe(v.string(), v.description("Coin symbol for the new asset.")),
|
|
609
604
|
/** Number of decimal places for size. */
|
|
610
|
-
szDecimals: v.pipe(
|
|
605
|
+
szDecimals: v.pipe(UnsignedIntegerMayInputString, v.description("Number of decimal places for size.")),
|
|
611
606
|
/** Initial oracle price for the asset. */
|
|
612
|
-
oraclePx: v.pipe(
|
|
607
|
+
oraclePx: v.pipe(UnsignedDecimalMayInputNumber, v.description("Initial oracle price for the asset.")),
|
|
613
608
|
/** Margin table identifier for risk management. */
|
|
614
|
-
marginTableId: v.pipe(
|
|
609
|
+
marginTableId: v.pipe(UnsignedIntegerMayInputString, v.description("Margin table identifier for risk management.")),
|
|
615
610
|
/** Whether the asset can only be traded with isolated margin. */
|
|
616
611
|
onlyIsolated: v.pipe(v.boolean(), v.description("Whether the asset can only be traded with isolated margin.")),
|
|
617
612
|
}), v.description("Contains new asset listing parameters.")),
|
|
618
613
|
/** Name of the dex. */
|
|
619
614
|
dex: v.pipe(v.string(), v.description("Name of the dex.")),
|
|
620
615
|
/** Contains new dex parameters. */
|
|
621
|
-
schema: v.pipe(v.nullable(v.
|
|
616
|
+
schema: v.pipe(v.nullable(v.object({
|
|
622
617
|
/** Full name of the dex. */
|
|
623
618
|
fullName: v.pipe(v.string(), v.description("Full name of the dex.")),
|
|
624
619
|
/** Collateral token index. */
|
|
625
|
-
collateralToken: v.pipe(
|
|
620
|
+
collateralToken: v.pipe(UnsignedIntegerMayInputString, v.description("Collateral token index.")),
|
|
626
621
|
/** User to update oracles. If not provided, then deployer is assumed to be oracle updater. */
|
|
627
622
|
oracleUpdater: v.pipe(v.nullable(v.pipe(Hex, v.length(42))), v.description("User to update oracles. If not provided, then deployer is assumed to be oracle updater.")),
|
|
628
623
|
})), v.description("Contains new dex parameters.")),
|
|
629
624
|
}), v.description("Parameters for registering a new perpetual asset.")),
|
|
630
625
|
}), v.description("Register asset variant")),
|
|
631
|
-
v.pipe(v.
|
|
626
|
+
v.pipe(v.object({
|
|
632
627
|
/** Type of action. */
|
|
633
628
|
type: v.pipe(v.literal("perpDeploy"), v.description("Type of action.")),
|
|
634
629
|
/** Parameters for setting oracle and mark prices for assets. */
|
|
635
|
-
setOracle: v.pipe(v.
|
|
630
|
+
setOracle: v.pipe(v.object({
|
|
636
631
|
/** Name of the dex. */
|
|
637
632
|
dex: v.pipe(v.string(), v.minLength(1), v.description("Name of the dex.")),
|
|
638
633
|
/** A list (sorted by key) of asset and oracle prices. */
|
|
639
|
-
oraclePxs: v.pipe(v.array(v.
|
|
634
|
+
oraclePxs: v.pipe(v.array(v.tuple([v.string(), UnsignedDecimalMayInputNumber])), v.description("A list (sorted by key) of asset and oracle prices.")),
|
|
640
635
|
/** An outer list of inner lists (inner list sorted by key) of asset and mark prices. */
|
|
641
|
-
markPxs: v.pipe(v.array(v.array(v.
|
|
636
|
+
markPxs: v.pipe(v.array(v.array(v.tuple([v.string(), UnsignedDecimalMayInputNumber]))), v.description("An outer list of inner lists (inner list sorted by key) of asset and mark prices.")),
|
|
642
637
|
}), v.description("Parameters for setting oracle and mark prices for assets.")),
|
|
643
638
|
}), v.description("Set oracle variant")),
|
|
644
639
|
]), v.description("Action to perform.")),
|
|
645
640
|
/** Unique request identifier (current timestamp in ms). */
|
|
646
|
-
nonce: v.pipe(
|
|
641
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
647
642
|
/** Cryptographic signature. */
|
|
648
643
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
649
644
|
/** Expiration time of the action. */
|
|
650
|
-
expiresAfter: v.pipe(v.optional(
|
|
645
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
651
646
|
}), v.transform(removeUndefinedKeys), v.description("Deploying HIP-3 assets:" +
|
|
652
647
|
"\n- Register Asset" +
|
|
653
648
|
"\n- Set Oracle"));
|
|
@@ -656,49 +651,49 @@ export const PerpDeployRequest = v.pipe(v.strictObject({
|
|
|
656
651
|
* @returns {SuccessResponse}
|
|
657
652
|
* @see null
|
|
658
653
|
*/
|
|
659
|
-
export const RegisterReferrerRequest = v.pipe(v.
|
|
654
|
+
export const RegisterReferrerRequest = v.pipe(v.object({
|
|
660
655
|
/** Action to perform. */
|
|
661
|
-
action: v.pipe(v.
|
|
656
|
+
action: v.pipe(v.object({
|
|
662
657
|
/** Type of action. */
|
|
663
658
|
type: v.pipe(v.literal("registerReferrer"), v.description("Type of action.")),
|
|
664
659
|
/** Referral code to create. */
|
|
665
660
|
code: v.pipe(v.string(), v.minLength(1), v.description("Referral code to create.")),
|
|
666
661
|
}), v.description("Action to perform.")),
|
|
667
662
|
/** Unique request identifier (current timestamp in ms). */
|
|
668
|
-
nonce: v.pipe(
|
|
663
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
669
664
|
/** Cryptographic signature. */
|
|
670
665
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
671
666
|
/** Expiration time of the action. */
|
|
672
|
-
expiresAfter: v.pipe(v.optional(
|
|
667
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
673
668
|
}), v.transform(removeUndefinedKeys), v.description("Create a referral code."));
|
|
674
669
|
/**
|
|
675
670
|
* Reserve additional rate-limited actions for a fee.
|
|
676
671
|
* @returns {SuccessResponse}
|
|
677
672
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#reserve-additional-actions
|
|
678
673
|
*/
|
|
679
|
-
export const ReserveRequestWeightRequest = v.pipe(v.
|
|
674
|
+
export const ReserveRequestWeightRequest = v.pipe(v.object({
|
|
680
675
|
/** Action to perform. */
|
|
681
|
-
action: v.pipe(v.
|
|
676
|
+
action: v.pipe(v.object({
|
|
682
677
|
/** Type of action. */
|
|
683
678
|
type: v.pipe(v.literal("reserveRequestWeight"), v.description("Type of action.")),
|
|
684
679
|
/** Amount of request weight to reserve. */
|
|
685
|
-
weight: v.pipe(
|
|
680
|
+
weight: v.pipe(UnsignedIntegerMayInputString, v.description("Amount of request weight to reserve.")),
|
|
686
681
|
}), v.description("Action to perform.")),
|
|
687
682
|
/** Unique request identifier (current timestamp in ms). */
|
|
688
|
-
nonce: v.pipe(
|
|
683
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
689
684
|
/** Cryptographic signature. */
|
|
690
685
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
691
686
|
/** Expiration time of the action. */
|
|
692
|
-
expiresAfter: v.pipe(v.optional(
|
|
687
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
693
688
|
}), v.transform(removeUndefinedKeys), v.description("Reserve additional rate-limited actions for a fee."));
|
|
694
689
|
/**
|
|
695
690
|
* Schedule a cancel-all operation at a future time.
|
|
696
691
|
* @returns {SuccessResponse}
|
|
697
692
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#schedule-cancel-dead-mans-switch
|
|
698
693
|
*/
|
|
699
|
-
export const ScheduleCancelRequest = v.pipe(v.
|
|
694
|
+
export const ScheduleCancelRequest = v.pipe(v.object({
|
|
700
695
|
/** Action to perform. */
|
|
701
|
-
action: v.pipe(v.
|
|
696
|
+
action: v.pipe(v.object({
|
|
702
697
|
/** Type of action. */
|
|
703
698
|
type: v.pipe(v.literal("scheduleCancel"), v.description("Type of action.")),
|
|
704
699
|
/**
|
|
@@ -707,27 +702,27 @@ export const ScheduleCancelRequest = v.pipe(v.strictObject({
|
|
|
707
702
|
*
|
|
708
703
|
* If not specified, will cause all scheduled cancel operations to be deleted.
|
|
709
704
|
*/
|
|
710
|
-
time: v.pipe(v.optional(
|
|
705
|
+
time: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Scheduled time (in ms since epoch)." +
|
|
711
706
|
"\nMust be at least 5 seconds in the future." +
|
|
712
707
|
"\n\nIf not specified, will cause all scheduled cancel operations to be deleted.")),
|
|
713
708
|
}), v.description("Action to perform.")),
|
|
714
709
|
/** Unique request identifier (current timestamp in ms). */
|
|
715
|
-
nonce: v.pipe(
|
|
710
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
716
711
|
/** Cryptographic signature. */
|
|
717
712
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
718
713
|
/** Vault address (for vault trading). */
|
|
719
714
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
720
715
|
/** Expiration time of the action. */
|
|
721
|
-
expiresAfter: v.pipe(v.optional(
|
|
716
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
722
717
|
}), v.transform(removeUndefinedKeys), v.description("Schedule a cancel-all operation at a future time."));
|
|
723
718
|
/**
|
|
724
719
|
* Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts.
|
|
725
720
|
* @returns {SuccessResponse}
|
|
726
721
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#send-asset-testnet-only
|
|
727
722
|
*/
|
|
728
|
-
export const SendAssetRequest = v.pipe(v.
|
|
723
|
+
export const SendAssetRequest = v.pipe(v.object({
|
|
729
724
|
/** Action to perform. */
|
|
730
|
-
action: v.pipe(v.
|
|
725
|
+
action: v.pipe(v.object({
|
|
731
726
|
/** Type of action. */
|
|
732
727
|
type: v.pipe(v.literal("sendAsset"), v.description("Type of action.")),
|
|
733
728
|
/** Chain ID used for signing. */
|
|
@@ -743,17 +738,17 @@ export const SendAssetRequest = v.pipe(v.strictObject({
|
|
|
743
738
|
/** Token identifier. */
|
|
744
739
|
token: v.pipe(TokenId, v.description("Token identifier.")),
|
|
745
740
|
/** Amount to send (not in wei). */
|
|
746
|
-
amount: v.pipe(
|
|
741
|
+
amount: v.pipe(UnsignedDecimalMayInputNumber, v.description("Amount to send (not in wei).")),
|
|
747
742
|
/** Source sub-account address ("" for main account). */
|
|
748
743
|
fromSubAccount: v.pipe(v.union([
|
|
749
744
|
v.literal(""),
|
|
750
745
|
v.pipe(Hex, v.length(42)),
|
|
751
746
|
]), v.description('Source sub-account address ("" for main account).')),
|
|
752
747
|
/** Unique request identifier (current timestamp in ms). */
|
|
753
|
-
nonce: v.pipe(
|
|
748
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
754
749
|
}), v.description("Action to perform.")),
|
|
755
750
|
/** Unique request identifier (current timestamp in ms). */
|
|
756
|
-
nonce: v.pipe(
|
|
751
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
757
752
|
/** Cryptographic signature. */
|
|
758
753
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
759
754
|
}), v.transform(removeUndefinedKeys), v.description("Transfer tokens between different perp DEXs, spot balance, users, and/or sub-accounts."));
|
|
@@ -762,9 +757,9 @@ export const SendAssetRequest = v.pipe(v.strictObject({
|
|
|
762
757
|
* @returns {SuccessResponse}
|
|
763
758
|
* @see null
|
|
764
759
|
*/
|
|
765
|
-
export const SetDisplayNameRequest = v.pipe(v.
|
|
760
|
+
export const SetDisplayNameRequest = v.pipe(v.object({
|
|
766
761
|
/** Action to perform. */
|
|
767
|
-
action: v.pipe(v.
|
|
762
|
+
action: v.pipe(v.object({
|
|
768
763
|
/** Type of action. */
|
|
769
764
|
type: v.pipe(v.literal("setDisplayName"), v.description("Type of action.")),
|
|
770
765
|
/**
|
|
@@ -776,31 +771,31 @@ export const SetDisplayNameRequest = v.pipe(v.strictObject({
|
|
|
776
771
|
"\n\nSet to an empty string to remove the display name.")),
|
|
777
772
|
}), v.description("Action to perform.")),
|
|
778
773
|
/** Unique request identifier (current timestamp in ms). */
|
|
779
|
-
nonce: v.pipe(
|
|
774
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
780
775
|
/** Cryptographic signature. */
|
|
781
776
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
782
777
|
/** Expiration time of the action. */
|
|
783
|
-
expiresAfter: v.pipe(v.optional(
|
|
778
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
784
779
|
}), v.transform(removeUndefinedKeys), v.description("Set the display name in the leaderboard."));
|
|
785
780
|
/**
|
|
786
781
|
* Set a referral code.
|
|
787
782
|
* @returns {SuccessResponse}
|
|
788
783
|
* @see null
|
|
789
784
|
*/
|
|
790
|
-
export const SetReferrerRequest = v.pipe(v.
|
|
785
|
+
export const SetReferrerRequest = v.pipe(v.object({
|
|
791
786
|
/** Action to perform. */
|
|
792
|
-
action: v.pipe(v.
|
|
787
|
+
action: v.pipe(v.object({
|
|
793
788
|
/** Type of action. */
|
|
794
789
|
type: v.pipe(v.literal("setReferrer"), v.description("Type of action.")),
|
|
795
790
|
/** Referral code. */
|
|
796
791
|
code: v.pipe(v.string(), v.minLength(1), v.description("Referral code.")),
|
|
797
792
|
}), v.description("Action to perform.")),
|
|
798
793
|
/** Unique request identifier (current timestamp in ms). */
|
|
799
|
-
nonce: v.pipe(
|
|
794
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
800
795
|
/** Cryptographic signature. */
|
|
801
796
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
802
797
|
/** Expiration time of the action. */
|
|
803
|
-
expiresAfter: v.pipe(v.optional(
|
|
798
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
804
799
|
}), v.transform(removeUndefinedKeys), v.description("Set a referral code."));
|
|
805
800
|
/**
|
|
806
801
|
* Deploying HIP-1 and HIP-2 assets:
|
|
@@ -813,107 +808,107 @@ export const SetReferrerRequest = v.pipe(v.strictObject({
|
|
|
813
808
|
* @returns {SuccessResponse}
|
|
814
809
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/deploying-hip-1-and-hip-2-assets
|
|
815
810
|
*/
|
|
816
|
-
export const SpotDeployRequest = v.pipe(v.
|
|
811
|
+
export const SpotDeployRequest = v.pipe(v.object({
|
|
817
812
|
/** Action to perform. */
|
|
818
813
|
action: v.pipe(v.union([
|
|
819
|
-
v.pipe(v.
|
|
814
|
+
v.pipe(v.object({
|
|
820
815
|
/** Type of action. */
|
|
821
816
|
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
822
817
|
/** Genesis parameters. */
|
|
823
|
-
genesis: v.pipe(v.
|
|
818
|
+
genesis: v.pipe(v.object({
|
|
824
819
|
/** Token identifier. */
|
|
825
|
-
token: v.pipe(
|
|
820
|
+
token: v.pipe(UnsignedIntegerMayInputString, v.description("Token identifier.")),
|
|
826
821
|
/** Maximum token supply. */
|
|
827
|
-
maxSupply: v.pipe(
|
|
822
|
+
maxSupply: v.pipe(UnsignedDecimalMayInputNumber, v.description("Maximum token supply.")),
|
|
828
823
|
/** Set hyperliquidity balance to 0. */
|
|
829
824
|
noHyperliquidity: v.pipe(v.optional(v.literal(true)), v.description("Set hyperliquidity balance to 0.")),
|
|
830
825
|
}), v.description("Genesis parameters.")),
|
|
831
826
|
}), v.description("Genesis variant")),
|
|
832
|
-
v.pipe(v.
|
|
827
|
+
v.pipe(v.object({
|
|
833
828
|
/** Type of action. */
|
|
834
829
|
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
835
830
|
/** Register hyperliquidity parameters. */
|
|
836
|
-
registerHyperliquidity: v.pipe(v.
|
|
831
|
+
registerHyperliquidity: v.pipe(v.object({
|
|
837
832
|
/** Spot index (distinct from base token index). */
|
|
838
|
-
spot: v.pipe(
|
|
833
|
+
spot: v.pipe(UnsignedIntegerMayInputString, v.description("Spot index (distinct from base token index).")),
|
|
839
834
|
/** Starting price for liquidity seeding. */
|
|
840
|
-
startPx: v.pipe(
|
|
835
|
+
startPx: v.pipe(UnsignedDecimalMayInputNumber, v.description("Starting price for liquidity seeding.")),
|
|
841
836
|
/** Order size as a float (not in wei). */
|
|
842
|
-
orderSz: v.pipe(
|
|
837
|
+
orderSz: v.pipe(UnsignedDecimalMayInputNumber, v.description("Order size as a float (not in wei).")),
|
|
843
838
|
/** Total number of orders to place. */
|
|
844
|
-
nOrders: v.pipe(
|
|
839
|
+
nOrders: v.pipe(UnsignedIntegerMayInputString, v.description("Total number of orders to place.")),
|
|
845
840
|
/** Number of levels to seed with USDC. */
|
|
846
|
-
nSeededLevels: v.pipe(v.optional(
|
|
841
|
+
nSeededLevels: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Number of levels to seed with USDC.")),
|
|
847
842
|
}), v.description("Register hyperliquidity parameters.")),
|
|
848
843
|
}), v.description("Register hyperliquidity variant")),
|
|
849
|
-
v.pipe(v.
|
|
844
|
+
v.pipe(v.object({
|
|
850
845
|
/** Type of action. */
|
|
851
846
|
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
852
847
|
/** Register spot parameters. */
|
|
853
|
-
registerSpot: v.pipe(v.
|
|
848
|
+
registerSpot: v.pipe(v.object({
|
|
854
849
|
/** Tuple containing base and quote token indices. */
|
|
855
|
-
tokens: v.pipe(v.
|
|
856
|
-
|
|
857
|
-
|
|
850
|
+
tokens: v.pipe(v.tuple([
|
|
851
|
+
UnsignedIntegerMayInputString,
|
|
852
|
+
UnsignedIntegerMayInputString,
|
|
858
853
|
]), v.description("Tuple containing base and quote token indices.")),
|
|
859
854
|
}), v.description("Register spot parameters.")),
|
|
860
855
|
}), v.description("Register spot variant")),
|
|
861
|
-
v.pipe(v.
|
|
856
|
+
v.pipe(v.object({
|
|
862
857
|
/** Type of action. */
|
|
863
858
|
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
864
859
|
/** Register token parameters. */
|
|
865
|
-
registerToken2: v.pipe(v.
|
|
860
|
+
registerToken2: v.pipe(v.object({
|
|
866
861
|
/** Token specifications. */
|
|
867
|
-
spec: v.pipe(v.
|
|
862
|
+
spec: v.pipe(v.object({
|
|
868
863
|
/** Token name. */
|
|
869
864
|
name: v.pipe(v.string(), v.description("Token name.")),
|
|
870
865
|
/** Number of decimals for token size. */
|
|
871
|
-
szDecimals: v.pipe(
|
|
866
|
+
szDecimals: v.pipe(UnsignedIntegerMayInputString, v.description("Number of decimals for token size.")),
|
|
872
867
|
/** Number of decimals for token amounts in wei. */
|
|
873
|
-
weiDecimals: v.pipe(
|
|
868
|
+
weiDecimals: v.pipe(UnsignedIntegerMayInputString, v.description("Number of decimals for token amounts in wei.")),
|
|
874
869
|
}), v.description("Token specifications.")),
|
|
875
870
|
/** Maximum gas allowed for registration. */
|
|
876
|
-
maxGas: v.pipe(
|
|
871
|
+
maxGas: v.pipe(UnsignedIntegerMayInputString, v.description("Maximum gas allowed for registration.")),
|
|
877
872
|
/** Optional full token name. */
|
|
878
873
|
fullName: v.pipe(v.optional(v.string()), v.description("Optional full token name.")),
|
|
879
874
|
}), v.description("Register token parameters.")),
|
|
880
875
|
}), v.description("Register token variant")),
|
|
881
|
-
v.pipe(v.
|
|
876
|
+
v.pipe(v.object({
|
|
882
877
|
/** Type of action. */
|
|
883
878
|
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
884
879
|
/** Set deployer trading fee share parameters. */
|
|
885
|
-
setDeployerTradingFeeShare: v.pipe(v.
|
|
880
|
+
setDeployerTradingFeeShare: v.pipe(v.object({
|
|
886
881
|
/** Token identifier. */
|
|
887
|
-
token: v.pipe(
|
|
882
|
+
token: v.pipe(UnsignedIntegerMayInputString, v.description("Token identifier.")),
|
|
888
883
|
/** The deployer trading fee share. Range is 0% to 100%. */
|
|
889
884
|
share: v.pipe(Percent, v.description("The deployer trading fee share. Range is 0% to 100%.")),
|
|
890
885
|
}), v.description("Set deployer trading fee share parameters.")),
|
|
891
886
|
}), v.description("Set deployer trading fee share variant")),
|
|
892
|
-
v.pipe(v.
|
|
887
|
+
v.pipe(v.object({
|
|
893
888
|
/** Type of action. */
|
|
894
889
|
type: v.pipe(v.literal("spotDeploy"), v.description("Type of action.")),
|
|
895
890
|
/** User genesis parameters. */
|
|
896
|
-
userGenesis: v.pipe(v.
|
|
891
|
+
userGenesis: v.pipe(v.object({
|
|
897
892
|
/** Token identifier. */
|
|
898
|
-
token: v.pipe(
|
|
893
|
+
token: v.pipe(UnsignedIntegerMayInputString, v.description("Token identifier.")),
|
|
899
894
|
/** Array of tuples: [user address, genesis amount in wei]. */
|
|
900
|
-
userAndWei: v.pipe(v.array(v.
|
|
895
|
+
userAndWei: v.pipe(v.array(v.tuple([v.pipe(Hex, v.length(42)), UnsignedDecimalMayInputNumber])), v.description("Array of tuples: [user address, genesis amount in wei].")),
|
|
901
896
|
/** Array of tuples: [existing token identifier, genesis amount in wei]. */
|
|
902
|
-
existingTokenAndWei: v.pipe(v.array(v.
|
|
903
|
-
|
|
904
|
-
|
|
897
|
+
existingTokenAndWei: v.pipe(v.array(v.tuple([
|
|
898
|
+
UnsignedIntegerMayInputString,
|
|
899
|
+
UnsignedDecimalMayInputNumber,
|
|
905
900
|
])), v.description("Array of tuples: [existing token identifier, genesis amount in wei].")),
|
|
906
901
|
/** Array of tuples: [user address, blacklist status] (`true` for blacklist, `false` to remove existing blacklisted user). */
|
|
907
|
-
blacklistUsers: v.pipe(v.optional(v.array(v.
|
|
902
|
+
blacklistUsers: v.pipe(v.optional(v.array(v.tuple([v.pipe(Hex, v.length(42)), v.boolean()]))), v.description("Array of tuples: [user address, blacklist status] (`true` for blacklist, `false` to remove existing blacklisted user).")),
|
|
908
903
|
}), v.description("User genesis parameters.")),
|
|
909
904
|
}), v.description("User genesis variant")),
|
|
910
905
|
]), v.description("Action to perform.")),
|
|
911
906
|
/** Unique request identifier (current timestamp in ms). */
|
|
912
|
-
nonce: v.pipe(
|
|
907
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
913
908
|
/** Cryptographic signature. */
|
|
914
909
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
915
910
|
/** Expiration time of the action. */
|
|
916
|
-
expiresAfter: v.pipe(v.optional(
|
|
911
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
917
912
|
}), v.transform(removeUndefinedKeys), v.description("Deploying HIP-1 and HIP-2 assets:" +
|
|
918
913
|
"\n- Genesis" +
|
|
919
914
|
"\n- Register Hyperliquidity" +
|
|
@@ -926,9 +921,9 @@ export const SpotDeployRequest = v.pipe(v.strictObject({
|
|
|
926
921
|
* @returns {SuccessResponse}
|
|
927
922
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-spot-transfer
|
|
928
923
|
*/
|
|
929
|
-
export const SpotSendRequest = v.pipe(v.
|
|
924
|
+
export const SpotSendRequest = v.pipe(v.object({
|
|
930
925
|
/** Action to perform. */
|
|
931
|
-
action: v.pipe(v.
|
|
926
|
+
action: v.pipe(v.object({
|
|
932
927
|
/** Type of action. */
|
|
933
928
|
type: v.pipe(v.literal("spotSend"), v.description("Type of action.")),
|
|
934
929
|
/** Chain ID used for signing. */
|
|
@@ -940,12 +935,12 @@ export const SpotSendRequest = v.pipe(v.strictObject({
|
|
|
940
935
|
/** Token identifier. */
|
|
941
936
|
token: v.pipe(TokenId, v.description("Token identifier.")),
|
|
942
937
|
/** Amount to send (not in wei). */
|
|
943
|
-
amount: v.pipe(
|
|
938
|
+
amount: v.pipe(UnsignedDecimalMayInputNumber, v.description("Amount to send (not in wei).")),
|
|
944
939
|
/** Unique request identifier (current timestamp in ms). */
|
|
945
|
-
time: v.pipe(
|
|
940
|
+
time: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
946
941
|
}), v.description("Action to perform.")),
|
|
947
942
|
/** Unique request identifier (current timestamp in ms). */
|
|
948
|
-
nonce: v.pipe(
|
|
943
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
949
944
|
/** Cryptographic signature. */
|
|
950
945
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
951
946
|
}), v.transform(removeUndefinedKeys), v.description("Send spot assets to another address."));
|
|
@@ -954,32 +949,32 @@ export const SpotSendRequest = v.pipe(v.strictObject({
|
|
|
954
949
|
* @returns {SuccessResponse}
|
|
955
950
|
* @see null
|
|
956
951
|
*/
|
|
957
|
-
export const SpotUserRequest = v.pipe(v.
|
|
952
|
+
export const SpotUserRequest = v.pipe(v.object({
|
|
958
953
|
/** Action to perform. */
|
|
959
|
-
action: v.pipe(v.
|
|
954
|
+
action: v.pipe(v.object({
|
|
960
955
|
/** Type of action. */
|
|
961
956
|
type: v.pipe(v.literal("spotUser"), v.description("Type of action.")),
|
|
962
957
|
/** Spot dusting options. */
|
|
963
|
-
toggleSpotDusting: v.pipe(v.
|
|
958
|
+
toggleSpotDusting: v.pipe(v.object({
|
|
964
959
|
/** Opt out of spot dusting. */
|
|
965
960
|
optOut: v.pipe(v.boolean(), v.description("Opt out of spot dusting.")),
|
|
966
961
|
}), v.description("Spot dusting options.")),
|
|
967
962
|
}), v.description("Action to perform.")),
|
|
968
963
|
/** Unique request identifier (current timestamp in ms). */
|
|
969
|
-
nonce: v.pipe(
|
|
964
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
970
965
|
/** Cryptographic signature. */
|
|
971
966
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
972
967
|
/** Expiration time of the action. */
|
|
973
|
-
expiresAfter: v.pipe(v.optional(
|
|
968
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
974
969
|
}), v.transform(removeUndefinedKeys), v.description("Opt Out of Spot Dusting."));
|
|
975
970
|
/**
|
|
976
971
|
* Modify a sub-account.
|
|
977
972
|
* @returns {SuccessResponse}
|
|
978
973
|
* @see null
|
|
979
974
|
*/
|
|
980
|
-
export const SubAccountModifyRequest = v.pipe(v.
|
|
975
|
+
export const SubAccountModifyRequest = v.pipe(v.object({
|
|
981
976
|
/** Action to perform. */
|
|
982
|
-
action: v.pipe(v.
|
|
977
|
+
action: v.pipe(v.object({
|
|
983
978
|
/** Type of action. */
|
|
984
979
|
type: v.pipe(v.literal("subAccountModify"), v.description("Type of action.")),
|
|
985
980
|
/** Sub-account address to modify. */
|
|
@@ -988,20 +983,20 @@ export const SubAccountModifyRequest = v.pipe(v.strictObject({
|
|
|
988
983
|
name: v.pipe(v.string(), v.minLength(1), v.description("New sub-account name.")),
|
|
989
984
|
}), v.description("Action to perform.")),
|
|
990
985
|
/** Unique request identifier (current timestamp in ms). */
|
|
991
|
-
nonce: v.pipe(
|
|
986
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
992
987
|
/** Cryptographic signature. */
|
|
993
988
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
994
989
|
/** Expiration time of the action. */
|
|
995
|
-
expiresAfter: v.pipe(v.optional(
|
|
990
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
996
991
|
}), v.transform(removeUndefinedKeys), v.description("Modify a sub-account."));
|
|
997
992
|
/**
|
|
998
993
|
* Transfer between sub-accounts (spot).
|
|
999
994
|
* @returns {SuccessResponse}
|
|
1000
995
|
* @see null
|
|
1001
996
|
*/
|
|
1002
|
-
export const SubAccountSpotTransferRequest = v.pipe(v.
|
|
997
|
+
export const SubAccountSpotTransferRequest = v.pipe(v.object({
|
|
1003
998
|
/** Action to perform. */
|
|
1004
|
-
action: v.pipe(v.
|
|
999
|
+
action: v.pipe(v.object({
|
|
1005
1000
|
/** Type of action. */
|
|
1006
1001
|
type: v.pipe(v.literal("subAccountSpotTransfer"), v.description("Type of action.")),
|
|
1007
1002
|
/** Sub-account address. */
|
|
@@ -1011,23 +1006,23 @@ export const SubAccountSpotTransferRequest = v.pipe(v.strictObject({
|
|
|
1011
1006
|
/** Token identifier. */
|
|
1012
1007
|
token: v.pipe(TokenId, v.description("Token identifier.")),
|
|
1013
1008
|
/** Amount to send (not in wei). */
|
|
1014
|
-
amount: v.pipe(
|
|
1009
|
+
amount: v.pipe(UnsignedDecimalMayInputNumber, v.description("Amount to send (not in wei).")),
|
|
1015
1010
|
}), v.description("Action to perform.")),
|
|
1016
1011
|
/** Unique request identifier (current timestamp in ms). */
|
|
1017
|
-
nonce: v.pipe(
|
|
1012
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1018
1013
|
/** Cryptographic signature. */
|
|
1019
1014
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1020
1015
|
/** Expiration time of the action. */
|
|
1021
|
-
expiresAfter: v.pipe(v.optional(
|
|
1016
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1022
1017
|
}), v.transform(removeUndefinedKeys), v.description("Transfer between sub-accounts (spot)."));
|
|
1023
1018
|
/**
|
|
1024
1019
|
* Transfer between sub-accounts (perpetual).
|
|
1025
1020
|
* @returns {SuccessResponse}
|
|
1026
1021
|
* @see null
|
|
1027
1022
|
*/
|
|
1028
|
-
export const SubAccountTransferRequest = v.pipe(v.
|
|
1023
|
+
export const SubAccountTransferRequest = v.pipe(v.object({
|
|
1029
1024
|
/** Action to perform. */
|
|
1030
|
-
action: v.pipe(v.
|
|
1025
|
+
action: v.pipe(v.object({
|
|
1031
1026
|
/** Type of action. */
|
|
1032
1027
|
type: v.pipe(v.literal("subAccountTransfer"), v.description("Type of action.")),
|
|
1033
1028
|
/** Sub-account address. */
|
|
@@ -1035,23 +1030,23 @@ export const SubAccountTransferRequest = v.pipe(v.strictObject({
|
|
|
1035
1030
|
/** `true` for deposit, `false` for withdrawal. */
|
|
1036
1031
|
isDeposit: v.pipe(v.boolean(), v.description("`true` for deposit, `false` for withdrawal.")),
|
|
1037
1032
|
/** Amount to transfer (float * 1e6). */
|
|
1038
|
-
usd: v.pipe(
|
|
1033
|
+
usd: v.pipe(UnsignedIntegerMayInputString, v.description("Amount to transfer (float * 1e6).")),
|
|
1039
1034
|
}), v.description("Action to perform.")),
|
|
1040
1035
|
/** Unique request identifier (current timestamp in ms). */
|
|
1041
|
-
nonce: v.pipe(
|
|
1036
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1042
1037
|
/** Cryptographic signature. */
|
|
1043
1038
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1044
1039
|
/** Expiration time of the action. */
|
|
1045
|
-
expiresAfter: v.pipe(v.optional(
|
|
1040
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1046
1041
|
}), v.transform(removeUndefinedKeys), v.description("Transfer between sub-accounts (perpetual)."));
|
|
1047
1042
|
/**
|
|
1048
1043
|
* Delegate or undelegate native tokens to or from a validator.
|
|
1049
1044
|
* @returns {SuccessResponse}
|
|
1050
1045
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#delegate-or-undelegate-stake-from-validator
|
|
1051
1046
|
*/
|
|
1052
|
-
export const TokenDelegateRequest = v.pipe(v.
|
|
1047
|
+
export const TokenDelegateRequest = v.pipe(v.object({
|
|
1053
1048
|
/** Action to perform. */
|
|
1054
|
-
action: v.pipe(v.
|
|
1049
|
+
action: v.pipe(v.object({
|
|
1055
1050
|
/** Type of action. */
|
|
1056
1051
|
type: v.pipe(v.literal("tokenDelegate"), v.description("Type of action.")),
|
|
1057
1052
|
/** Chain ID used for signing. */
|
|
@@ -1061,14 +1056,14 @@ export const TokenDelegateRequest = v.pipe(v.strictObject({
|
|
|
1061
1056
|
/** Validator address. */
|
|
1062
1057
|
validator: v.pipe(v.pipe(Hex, v.length(42)), v.description("Validator address.")),
|
|
1063
1058
|
/** Amount for delegate/undelegate (float * 1e8). */
|
|
1064
|
-
wei: v.pipe(
|
|
1059
|
+
wei: v.pipe(UnsignedIntegerMayInputString, v.description("Amount for delegate/undelegate (float * 1e8).")),
|
|
1065
1060
|
/** `true` for undelegate, `false` for delegate. */
|
|
1066
1061
|
isUndelegate: v.pipe(v.boolean(), v.description("`true` for undelegate, `false` for delegate.")),
|
|
1067
1062
|
/** Unique request identifier (current timestamp in ms). */
|
|
1068
|
-
nonce: v.pipe(
|
|
1063
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1069
1064
|
}), v.description("Action to perform.")),
|
|
1070
1065
|
/** Unique request identifier (current timestamp in ms). */
|
|
1071
|
-
nonce: v.pipe(
|
|
1066
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1072
1067
|
/** Cryptographic signature. */
|
|
1073
1068
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1074
1069
|
}), v.transform(removeUndefinedKeys), v.description("Delegate or undelegate native tokens to or from a validator."));
|
|
@@ -1077,120 +1072,120 @@ export const TokenDelegateRequest = v.pipe(v.strictObject({
|
|
|
1077
1072
|
* @returns {TwapCancelResponse}
|
|
1078
1073
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-a-twap-order
|
|
1079
1074
|
*/
|
|
1080
|
-
export const TwapCancelRequest = v.pipe(v.
|
|
1075
|
+
export const TwapCancelRequest = v.pipe(v.object({
|
|
1081
1076
|
/** Action to perform. */
|
|
1082
|
-
action: v.pipe(v.
|
|
1077
|
+
action: v.pipe(v.object({
|
|
1083
1078
|
/** Type of action. */
|
|
1084
1079
|
type: v.pipe(v.literal("twapCancel"), v.description("Type of action.")),
|
|
1085
1080
|
/** Asset ID. */
|
|
1086
|
-
a: v.pipe(
|
|
1081
|
+
a: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
1087
1082
|
/** Twap ID. */
|
|
1088
|
-
t: v.pipe(
|
|
1083
|
+
t: v.pipe(UnsignedIntegerMayInputString, v.description("Twap ID.")),
|
|
1089
1084
|
}), v.description("Action to perform.")),
|
|
1090
1085
|
/** Unique request identifier (current timestamp in ms). */
|
|
1091
|
-
nonce: v.pipe(
|
|
1086
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1092
1087
|
/** Cryptographic signature. */
|
|
1093
1088
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1094
1089
|
/** Vault address (for vault trading). */
|
|
1095
1090
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1096
1091
|
/** Expiration time of the action. */
|
|
1097
|
-
expiresAfter: v.pipe(v.optional(
|
|
1092
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1098
1093
|
}), v.transform(removeUndefinedKeys), v.description("Cancel a TWAP order."));
|
|
1099
1094
|
/**
|
|
1100
1095
|
* Place a TWAP order.
|
|
1101
1096
|
* @returns {TwapOrderResponse}
|
|
1102
1097
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-a-twap-order
|
|
1103
1098
|
*/
|
|
1104
|
-
export const TwapOrderRequest = v.pipe(v.
|
|
1099
|
+
export const TwapOrderRequest = v.pipe(v.object({
|
|
1105
1100
|
/** Action to perform. */
|
|
1106
|
-
action: v.pipe(v.
|
|
1101
|
+
action: v.pipe(v.object({
|
|
1107
1102
|
/** Type of action. */
|
|
1108
1103
|
type: v.pipe(v.literal("twapOrder"), v.description("Type of action.")),
|
|
1109
1104
|
/** Twap parameters. */
|
|
1110
|
-
twap: v.pipe(v.
|
|
1105
|
+
twap: v.pipe(v.object({
|
|
1111
1106
|
/** Asset ID. */
|
|
1112
|
-
a: v.pipe(
|
|
1107
|
+
a: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
1113
1108
|
/** Position side (`true` for long, `false` for short). */
|
|
1114
1109
|
b: v.pipe(v.boolean(), v.description("Position side (`true` for long, `false` for short).")),
|
|
1115
1110
|
/** Size (in base currency units). */
|
|
1116
|
-
s: v.pipe(
|
|
1111
|
+
s: v.pipe(UnsignedDecimalMayInputNumber, v.description("Size (in base currency units).")),
|
|
1117
1112
|
/** Is reduce-only? */
|
|
1118
1113
|
r: v.pipe(v.boolean(), v.description("Is reduce-only?")),
|
|
1119
1114
|
/** TWAP duration in minutes. */
|
|
1120
|
-
m: v.pipe(
|
|
1115
|
+
m: v.pipe(UnsignedIntegerMayInputString, v.description("TWAP duration in minutes.")),
|
|
1121
1116
|
/** Enable random order timing. */
|
|
1122
1117
|
t: v.pipe(v.boolean(), v.description("Enable random order timing.")),
|
|
1123
1118
|
}), v.description("Twap parameters.")),
|
|
1124
1119
|
}), v.description("Action to perform.")),
|
|
1125
1120
|
/** Unique request identifier (current timestamp in ms). */
|
|
1126
|
-
nonce: v.pipe(
|
|
1121
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1127
1122
|
/** Cryptographic signature. */
|
|
1128
1123
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1129
1124
|
/** Vault address (for vault trading). */
|
|
1130
1125
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1131
1126
|
/** Expiration time of the action. */
|
|
1132
|
-
expiresAfter: v.pipe(v.optional(
|
|
1127
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1133
1128
|
}), v.transform(removeUndefinedKeys), v.description("Place a TWAP order."));
|
|
1134
1129
|
/**
|
|
1135
1130
|
* Add or remove margin from isolated position.
|
|
1136
1131
|
* @returns {SuccessResponse}
|
|
1137
1132
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
|
1138
1133
|
*/
|
|
1139
|
-
export const UpdateIsolatedMarginRequest = v.pipe(v.
|
|
1134
|
+
export const UpdateIsolatedMarginRequest = v.pipe(v.object({
|
|
1140
1135
|
/** Action to perform. */
|
|
1141
|
-
action: v.pipe(v.
|
|
1136
|
+
action: v.pipe(v.object({
|
|
1142
1137
|
/** Type of action. */
|
|
1143
1138
|
type: v.pipe(v.literal("updateIsolatedMargin"), v.description("Type of action.")),
|
|
1144
1139
|
/** Asset ID. */
|
|
1145
|
-
asset: v.pipe(
|
|
1140
|
+
asset: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
1146
1141
|
/** Position side (`true` for long, `false` for short). */
|
|
1147
1142
|
isBuy: v.pipe(v.boolean(), v.description("Position side (`true` for long, `false` for short).")),
|
|
1148
1143
|
/** Amount to adjust (float * 1e6). */
|
|
1149
|
-
ntli: v.pipe(
|
|
1144
|
+
ntli: v.pipe(UnsignedIntegerMayInputString, v.description("Amount to adjust (float * 1e6).")),
|
|
1150
1145
|
}), v.description("Action to perform.")),
|
|
1151
1146
|
/** Unique request identifier (current timestamp in ms). */
|
|
1152
|
-
nonce: v.pipe(
|
|
1147
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1153
1148
|
/** Cryptographic signature. */
|
|
1154
1149
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1155
1150
|
/** Vault address (for vault trading). */
|
|
1156
1151
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1157
1152
|
/** Expiration time of the action. */
|
|
1158
|
-
expiresAfter: v.pipe(v.optional(
|
|
1153
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1159
1154
|
}), v.transform(removeUndefinedKeys), v.description("Add or remove margin from isolated position."));
|
|
1160
1155
|
/**
|
|
1161
1156
|
* Update cross or isolated leverage on a coin.
|
|
1162
1157
|
* @returns {SuccessResponse}
|
|
1163
1158
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage
|
|
1164
1159
|
*/
|
|
1165
|
-
export const UpdateLeverageRequest = v.pipe(v.
|
|
1160
|
+
export const UpdateLeverageRequest = v.pipe(v.object({
|
|
1166
1161
|
/** Action to perform. */
|
|
1167
|
-
action: v.pipe(v.
|
|
1162
|
+
action: v.pipe(v.object({
|
|
1168
1163
|
/** Type of action. */
|
|
1169
1164
|
type: v.pipe(v.literal("updateLeverage"), v.description("Type of action.")),
|
|
1170
1165
|
/** Asset ID. */
|
|
1171
|
-
asset: v.pipe(
|
|
1166
|
+
asset: v.pipe(UnsignedIntegerMayInputString, v.description("Asset ID.")),
|
|
1172
1167
|
/** `true` for cross leverage, `false` for isolated leverage. */
|
|
1173
1168
|
isCross: v.pipe(v.boolean(), v.description("`true` for cross leverage, `false` for isolated leverage.")),
|
|
1174
1169
|
/** New leverage value. */
|
|
1175
|
-
leverage: v.pipe(v.pipe(
|
|
1170
|
+
leverage: v.pipe(v.pipe(UnsignedIntegerMayInputString, v.minValue(1)), v.description("New leverage value.")),
|
|
1176
1171
|
}), v.description("Action to perform.")),
|
|
1177
1172
|
/** Unique request identifier (current timestamp in ms). */
|
|
1178
|
-
nonce: v.pipe(
|
|
1173
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1179
1174
|
/** Cryptographic signature. */
|
|
1180
1175
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1181
1176
|
/** Vault address (for vault trading). */
|
|
1182
1177
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1183
1178
|
/** Expiration time of the action. */
|
|
1184
|
-
expiresAfter: v.pipe(v.optional(
|
|
1179
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1185
1180
|
}), v.transform(removeUndefinedKeys), v.description("Update cross or isolated leverage on a coin."));
|
|
1186
1181
|
/**
|
|
1187
1182
|
* Transfer funds between Spot account and Perp account.
|
|
1188
1183
|
* @returns {SuccessResponse}
|
|
1189
1184
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#transfer-from-spot-account-to-perp-account-and-vice-versa
|
|
1190
1185
|
*/
|
|
1191
|
-
export const UsdClassTransferRequest = v.pipe(v.
|
|
1186
|
+
export const UsdClassTransferRequest = v.pipe(v.object({
|
|
1192
1187
|
/** Action to perform. */
|
|
1193
|
-
action: v.pipe(v.
|
|
1188
|
+
action: v.pipe(v.object({
|
|
1194
1189
|
/** Type of action. */
|
|
1195
1190
|
type: v.pipe(v.literal("usdClassTransfer"), v.description("Type of action.")),
|
|
1196
1191
|
/** Chain ID used for signing. */
|
|
@@ -1198,14 +1193,14 @@ export const UsdClassTransferRequest = v.pipe(v.strictObject({
|
|
|
1198
1193
|
/** HyperLiquid network. */
|
|
1199
1194
|
hyperliquidChain: v.pipe(v.union([v.literal("Mainnet"), v.literal("Testnet")]), v.description("HyperLiquid network.")),
|
|
1200
1195
|
/** Amount to transfer (1 = 1$). */
|
|
1201
|
-
amount: v.pipe(
|
|
1196
|
+
amount: v.pipe(UnsignedDecimalMayInputNumber, v.description("Amount to transfer (1 = 1$).")),
|
|
1202
1197
|
/** `true` for Spot to Perp, `false` for Perp to Spot. */
|
|
1203
1198
|
toPerp: v.pipe(v.boolean(), v.description("`true` for Spot to Perp, `false` for Perp to Spot.")),
|
|
1204
1199
|
/** Unique request identifier (current timestamp in ms). */
|
|
1205
|
-
nonce: v.pipe(
|
|
1200
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1206
1201
|
}), v.description("Action to perform.")),
|
|
1207
1202
|
/** Unique request identifier (current timestamp in ms). */
|
|
1208
|
-
nonce: v.pipe(
|
|
1203
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1209
1204
|
/** Cryptographic signature. */
|
|
1210
1205
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1211
1206
|
}), v.transform(removeUndefinedKeys), v.description("Transfer funds between Spot account and Perp account."));
|
|
@@ -1214,9 +1209,9 @@ export const UsdClassTransferRequest = v.pipe(v.strictObject({
|
|
|
1214
1209
|
* @returns {SuccessResponse}
|
|
1215
1210
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#core-usdc-transfer
|
|
1216
1211
|
*/
|
|
1217
|
-
export const UsdSendRequest = v.pipe(v.
|
|
1212
|
+
export const UsdSendRequest = v.pipe(v.object({
|
|
1218
1213
|
/** Action to perform. */
|
|
1219
|
-
action: v.pipe(v.
|
|
1214
|
+
action: v.pipe(v.object({
|
|
1220
1215
|
/** Type of action. */
|
|
1221
1216
|
type: v.pipe(v.literal("usdSend"), v.description("Type of action.")),
|
|
1222
1217
|
/** Chain ID used for signing. */
|
|
@@ -1226,12 +1221,12 @@ export const UsdSendRequest = v.pipe(v.strictObject({
|
|
|
1226
1221
|
/** Destination address. */
|
|
1227
1222
|
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
1228
1223
|
/** Amount to send (1 = 1$). */
|
|
1229
|
-
amount: v.pipe(
|
|
1224
|
+
amount: v.pipe(UnsignedDecimalMayInputNumber, v.description("Amount to send (1 = 1$).")),
|
|
1230
1225
|
/** Unique request identifier (current timestamp in ms). */
|
|
1231
|
-
time: v.pipe(
|
|
1226
|
+
time: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1232
1227
|
}), v.description("Action to perform.")),
|
|
1233
1228
|
/** Unique request identifier (current timestamp in ms). */
|
|
1234
|
-
nonce: v.pipe(
|
|
1229
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1235
1230
|
/** Cryptographic signature. */
|
|
1236
1231
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1237
1232
|
}), v.transform(removeUndefinedKeys), v.description("Send usd to another address."));
|
|
@@ -1240,9 +1235,9 @@ export const UsdSendRequest = v.pipe(v.strictObject({
|
|
|
1240
1235
|
* @returns {SuccessResponse}
|
|
1241
1236
|
* @see null
|
|
1242
1237
|
*/
|
|
1243
|
-
export const VaultDistributeRequest = v.pipe(v.
|
|
1238
|
+
export const VaultDistributeRequest = v.pipe(v.object({
|
|
1244
1239
|
/** Action to perform. */
|
|
1245
|
-
action: v.pipe(v.
|
|
1240
|
+
action: v.pipe(v.object({
|
|
1246
1241
|
/** Type of action. */
|
|
1247
1242
|
type: v.pipe(v.literal("vaultDistribute"), v.description("Type of action.")),
|
|
1248
1243
|
/** Vault address. */
|
|
@@ -1252,24 +1247,24 @@ export const VaultDistributeRequest = v.pipe(v.strictObject({
|
|
|
1252
1247
|
*
|
|
1253
1248
|
* Set to 0 to close the vault.
|
|
1254
1249
|
*/
|
|
1255
|
-
usd: v.pipe(
|
|
1250
|
+
usd: v.pipe(UnsignedIntegerMayInputString, v.description("Amount to distribute (float * 1e6)." +
|
|
1256
1251
|
"\n\nSet to 0 to close the vault.")),
|
|
1257
1252
|
}), v.description("Action to perform.")),
|
|
1258
1253
|
/** Unique request identifier (current timestamp in ms). */
|
|
1259
|
-
nonce: v.pipe(
|
|
1254
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1260
1255
|
/** Cryptographic signature. */
|
|
1261
1256
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1262
1257
|
/** Expiration time of the action. */
|
|
1263
|
-
expiresAfter: v.pipe(v.optional(
|
|
1258
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1264
1259
|
}), v.transform(removeUndefinedKeys), v.description("Distribute funds from a vault between followers."));
|
|
1265
1260
|
/**
|
|
1266
1261
|
* Modify a vault configuration.
|
|
1267
1262
|
* @returns {SuccessResponse}
|
|
1268
1263
|
* @see null
|
|
1269
1264
|
*/
|
|
1270
|
-
export const VaultModifyRequest = v.pipe(v.
|
|
1265
|
+
export const VaultModifyRequest = v.pipe(v.object({
|
|
1271
1266
|
/** Action to perform. */
|
|
1272
|
-
action: v.pipe(v.
|
|
1267
|
+
action: v.pipe(v.object({
|
|
1273
1268
|
/** Type of action. */
|
|
1274
1269
|
type: v.pipe(v.literal("vaultModify"), v.description("Type of action.")),
|
|
1275
1270
|
/** Vault address. */
|
|
@@ -1280,20 +1275,20 @@ export const VaultModifyRequest = v.pipe(v.strictObject({
|
|
|
1280
1275
|
alwaysCloseOnWithdraw: v.pipe(v.nullable(v.boolean()), v.description("Always close positions on withdrawal.")),
|
|
1281
1276
|
}), v.description("Action to perform.")),
|
|
1282
1277
|
/** Unique request identifier (current timestamp in ms). */
|
|
1283
|
-
nonce: v.pipe(
|
|
1278
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1284
1279
|
/** Cryptographic signature. */
|
|
1285
1280
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1286
1281
|
/** Expiration time of the action. */
|
|
1287
|
-
expiresAfter: v.pipe(v.optional(
|
|
1282
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1288
1283
|
}), v.transform(removeUndefinedKeys), v.description("Modify a vault configuration."));
|
|
1289
1284
|
/**
|
|
1290
1285
|
* Deposit or withdraw from a vault.
|
|
1291
1286
|
* @returns {SuccessResponse}
|
|
1292
1287
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
|
1293
1288
|
*/
|
|
1294
|
-
export const VaultTransferRequest = v.pipe(v.
|
|
1289
|
+
export const VaultTransferRequest = v.pipe(v.object({
|
|
1295
1290
|
/** Action to perform. */
|
|
1296
|
-
action: v.pipe(v.
|
|
1291
|
+
action: v.pipe(v.object({
|
|
1297
1292
|
/** Type of action. */
|
|
1298
1293
|
type: v.pipe(v.literal("vaultTransfer"), v.description("Type of action.")),
|
|
1299
1294
|
/** Vault address. */
|
|
@@ -1301,23 +1296,23 @@ export const VaultTransferRequest = v.pipe(v.strictObject({
|
|
|
1301
1296
|
/** `true` for deposit, `false` for withdrawal. */
|
|
1302
1297
|
isDeposit: v.pipe(v.boolean(), v.description("`true` for deposit, `false` for withdrawal.")),
|
|
1303
1298
|
/** Amount for deposit/withdrawal (float * 1e6). */
|
|
1304
|
-
usd: v.pipe(
|
|
1299
|
+
usd: v.pipe(UnsignedIntegerMayInputString, v.description("Amount for deposit/withdrawal (float * 1e6).")),
|
|
1305
1300
|
}), v.description("Action to perform.")),
|
|
1306
1301
|
/** Unique request identifier (current timestamp in ms). */
|
|
1307
|
-
nonce: v.pipe(
|
|
1302
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1308
1303
|
/** Cryptographic signature. */
|
|
1309
1304
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1310
1305
|
/** Expiration time of the action. */
|
|
1311
|
-
expiresAfter: v.pipe(v.optional(
|
|
1306
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1312
1307
|
}), v.transform(removeUndefinedKeys), v.description("Deposit or withdraw from a vault."));
|
|
1313
1308
|
/**
|
|
1314
1309
|
* Initiate a withdrawal request.
|
|
1315
1310
|
* @returns {SuccessResponse}
|
|
1316
1311
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
|
1317
1312
|
*/
|
|
1318
|
-
export const Withdraw3Request = v.pipe(v.
|
|
1313
|
+
export const Withdraw3Request = v.pipe(v.object({
|
|
1319
1314
|
/** Action to perform. */
|
|
1320
|
-
action: v.pipe(v.
|
|
1315
|
+
action: v.pipe(v.object({
|
|
1321
1316
|
/** Type of action. */
|
|
1322
1317
|
type: v.pipe(v.literal("withdraw3"), v.description("Type of action.")),
|
|
1323
1318
|
/** Chain ID used for signing. */
|
|
@@ -1327,12 +1322,12 @@ export const Withdraw3Request = v.pipe(v.strictObject({
|
|
|
1327
1322
|
/** Destination address. */
|
|
1328
1323
|
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
1329
1324
|
/** Amount to withdraw (1 = 1$). */
|
|
1330
|
-
amount: v.pipe(
|
|
1325
|
+
amount: v.pipe(UnsignedDecimalMayInputNumber, v.description("Amount to withdraw (1 = 1$).")),
|
|
1331
1326
|
/** Unique request identifier (current timestamp in ms). */
|
|
1332
|
-
time: v.pipe(
|
|
1327
|
+
time: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1333
1328
|
}), v.description("Action to perform.")),
|
|
1334
1329
|
/** Unique request identifier (current timestamp in ms). */
|
|
1335
|
-
nonce: v.pipe(
|
|
1330
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1336
1331
|
/** Cryptographic signature. */
|
|
1337
1332
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1338
1333
|
}), v.transform(removeUndefinedKeys), v.description("Initiate a withdrawal request."));
|
|
@@ -1341,9 +1336,9 @@ export const Withdraw3Request = v.pipe(v.strictObject({
|
|
|
1341
1336
|
* @returns {SuccessResponse}
|
|
1342
1337
|
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/multi-sig
|
|
1343
1338
|
*/
|
|
1344
|
-
export const MultiSigRequest = v.pipe(v.
|
|
1339
|
+
export const MultiSigRequest = v.pipe(v.object({
|
|
1345
1340
|
/** Action to perform. */
|
|
1346
|
-
action: v.pipe(v.
|
|
1341
|
+
action: v.pipe(v.object({
|
|
1347
1342
|
/** Type of action. */
|
|
1348
1343
|
type: v.pipe(v.literal("multiSig"), v.description("Type of action.")),
|
|
1349
1344
|
/** Chain ID used for signing. */
|
|
@@ -1351,7 +1346,7 @@ export const MultiSigRequest = v.pipe(v.strictObject({
|
|
|
1351
1346
|
/** List of signatures from authorized signers. */
|
|
1352
1347
|
signatures: v.pipe(v.array(Signature), v.description("List of signatures from authorized signers.")),
|
|
1353
1348
|
/** Multi-signature payload information. */
|
|
1354
|
-
payload: v.pipe(v.
|
|
1349
|
+
payload: v.pipe(v.object({
|
|
1355
1350
|
/** Address of the multi-signature user account. */
|
|
1356
1351
|
multiSigUser: v.pipe(v.pipe(Hex, v.length(42)), v.description("Address of the multi-signature user account.")),
|
|
1357
1352
|
/** Address of the authorized user initiating the request (any authorized user). */
|
|
@@ -1403,11 +1398,12 @@ export const MultiSigRequest = v.pipe(v.strictObject({
|
|
|
1403
1398
|
}), v.description("Multi-signature payload information.")),
|
|
1404
1399
|
}), v.description("Action to perform.")),
|
|
1405
1400
|
/** Unique request identifier (current timestamp in ms). */
|
|
1406
|
-
nonce: v.pipe(
|
|
1401
|
+
nonce: v.pipe(UnsignedIntegerMayInputString, v.description("Unique request identifier (current timestamp in ms).")),
|
|
1407
1402
|
/** Cryptographic signature. */
|
|
1408
1403
|
signature: v.pipe(Signature, v.description("Cryptographic signature.")),
|
|
1409
1404
|
/** Vault address (for vault trading). */
|
|
1410
1405
|
vaultAddress: v.pipe(v.optional(v.pipe(Hex, v.length(42))), v.description("Vault address (for vault trading).")),
|
|
1411
1406
|
/** Expiration time of the action. */
|
|
1412
|
-
expiresAfter: v.pipe(v.optional(
|
|
1407
|
+
expiresAfter: v.pipe(v.optional(UnsignedIntegerMayInputString), v.description("Expiration time of the action.")),
|
|
1413
1408
|
}), v.transform(removeUndefinedKeys), v.description("A multi-signature request."));
|
|
1409
|
+
//# sourceMappingURL=requests.js.map
|