@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,60 +1,62 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import {
|
|
2
|
+
import { Decimal, Hex, UnsignedDecimal, UnsignedInteger } from "../_base.js";
|
|
3
|
+
import { FrontendOrder, TwapState } from "./orders.js";
|
|
4
|
+
import { PerpsAssetCtx, PerpsMeta, SpotAssetCtx } from "./assets.js";
|
|
3
5
|
/** User active asset data. */
|
|
4
|
-
export const ActiveAssetData = v.pipe(v.
|
|
6
|
+
export const ActiveAssetData = v.pipe(v.object({
|
|
5
7
|
/** User address. */
|
|
6
8
|
user: v.pipe(v.pipe(Hex, v.length(42)), v.description("User address.")),
|
|
7
9
|
/** Asset symbol (e.g., BTC). */
|
|
8
10
|
coin: v.pipe(v.string(), v.description("Asset symbol (e.g., BTC).")),
|
|
9
11
|
/** Leverage configuration. */
|
|
10
12
|
leverage: v.pipe(v.union([
|
|
11
|
-
v.
|
|
13
|
+
v.object({
|
|
12
14
|
/** Leverage type. */
|
|
13
15
|
type: v.pipe(v.literal("isolated"), v.description("Leverage type.")),
|
|
14
16
|
/** Leverage value used. */
|
|
15
|
-
value: v.pipe(
|
|
17
|
+
value: v.pipe(UnsignedInteger, v.minValue(1), v.description("Leverage value used.")),
|
|
16
18
|
/** Amount of USD used (1 = 1$). */
|
|
17
19
|
rawUsd: v.pipe(UnsignedDecimal, v.description("Amount of USD used (1 = 1$).")),
|
|
18
20
|
}),
|
|
19
|
-
v.
|
|
21
|
+
v.object({
|
|
20
22
|
/** Leverage type. */
|
|
21
23
|
type: v.pipe(v.literal("cross"), v.description("Leverage type.")),
|
|
22
24
|
/** Leverage value used. */
|
|
23
|
-
value: v.pipe(
|
|
25
|
+
value: v.pipe(UnsignedInteger, v.minValue(1), v.description("Leverage value used.")),
|
|
24
26
|
}),
|
|
25
27
|
]), v.description("Leverage configuration.")),
|
|
26
28
|
/** Maximum trade size range [min, max]. */
|
|
27
|
-
maxTradeSzs: v.pipe(v.
|
|
29
|
+
maxTradeSzs: v.pipe(v.tuple([UnsignedDecimal, UnsignedDecimal]), v.description("Maximum trade size range [min, max].")),
|
|
28
30
|
/** Available to trade range [min, max]. */
|
|
29
|
-
availableToTrade: v.pipe(v.
|
|
31
|
+
availableToTrade: v.pipe(v.tuple([UnsignedDecimal, UnsignedDecimal]), v.description("Available to trade range [min, max].")),
|
|
30
32
|
/** Mark price. */
|
|
31
33
|
markPx: v.pipe(UnsignedDecimal, v.description("Mark price.")),
|
|
32
34
|
}), v.description("User active asset data."));
|
|
33
35
|
/** Position for a specific asset. */
|
|
34
|
-
export const AssetPosition = v.pipe(v.
|
|
36
|
+
export const AssetPosition = v.pipe(v.object({
|
|
35
37
|
/** Position type. */
|
|
36
38
|
type: v.pipe(v.literal("oneWay"), v.description("Position type.")),
|
|
37
39
|
/** Position details. */
|
|
38
|
-
position: v.pipe(v.
|
|
40
|
+
position: v.pipe(v.object({
|
|
39
41
|
/** Asset symbol. */
|
|
40
42
|
coin: v.pipe(v.string(), v.description("Asset symbol.")),
|
|
41
43
|
/** Signed position size. */
|
|
42
|
-
szi: v.pipe(
|
|
44
|
+
szi: v.pipe(Decimal, v.description("Signed position size.")),
|
|
43
45
|
/** Leverage details. */
|
|
44
46
|
leverage: v.pipe(v.union([
|
|
45
|
-
v.
|
|
47
|
+
v.object({
|
|
46
48
|
/** Leverage type. */
|
|
47
49
|
type: v.pipe(v.literal("isolated"), v.description("Leverage type.")),
|
|
48
50
|
/** Leverage value used. */
|
|
49
|
-
value: v.pipe(
|
|
51
|
+
value: v.pipe(UnsignedInteger, v.minValue(1), v.description("Leverage value used.")),
|
|
50
52
|
/** Amount of USD used (1 = 1$). */
|
|
51
53
|
rawUsd: v.pipe(UnsignedDecimal, v.description("Amount of USD used (1 = 1$).")),
|
|
52
54
|
}),
|
|
53
|
-
v.
|
|
55
|
+
v.object({
|
|
54
56
|
/** Leverage type. */
|
|
55
57
|
type: v.pipe(v.literal("cross"), v.description("Leverage type.")),
|
|
56
58
|
/** Leverage value used. */
|
|
57
|
-
value: v.pipe(
|
|
59
|
+
value: v.pipe(UnsignedInteger, v.minValue(1), v.description("Leverage value used.")),
|
|
58
60
|
}),
|
|
59
61
|
]), v.description("Leverage details.")),
|
|
60
62
|
/** Average entry price. */
|
|
@@ -62,46 +64,46 @@ export const AssetPosition = v.pipe(v.strictObject({
|
|
|
62
64
|
/** Position value. */
|
|
63
65
|
positionValue: v.pipe(UnsignedDecimal, v.description("Position value.")),
|
|
64
66
|
/** Unrealized profit and loss. */
|
|
65
|
-
unrealizedPnl: v.pipe(
|
|
67
|
+
unrealizedPnl: v.pipe(Decimal, v.description("Unrealized profit and loss.")),
|
|
66
68
|
/** Return on equity. */
|
|
67
|
-
returnOnEquity: v.pipe(
|
|
69
|
+
returnOnEquity: v.pipe(Decimal, v.description("Return on equity.")),
|
|
68
70
|
/** Liquidation price. */
|
|
69
71
|
liquidationPx: v.pipe(v.union([UnsignedDecimal, v.null()]), v.description("Liquidation price.")),
|
|
70
72
|
/** Margin used. */
|
|
71
73
|
marginUsed: v.pipe(UnsignedDecimal, v.description("Margin used.")),
|
|
72
74
|
/** Maximum allowed leverage. */
|
|
73
|
-
maxLeverage: v.pipe(
|
|
75
|
+
maxLeverage: v.pipe(UnsignedInteger, v.minValue(1), v.description("Maximum allowed leverage.")),
|
|
74
76
|
/** Cumulative funding details. */
|
|
75
|
-
cumFunding: v.pipe(v.
|
|
77
|
+
cumFunding: v.pipe(v.object({
|
|
76
78
|
/** Total funding paid or received since account opening. */
|
|
77
|
-
allTime: v.pipe(
|
|
79
|
+
allTime: v.pipe(Decimal, v.description("Total funding paid or received since account opening.")),
|
|
78
80
|
/** Funding accumulated since the position was opened. */
|
|
79
|
-
sinceOpen: v.pipe(
|
|
81
|
+
sinceOpen: v.pipe(Decimal, v.description("Funding accumulated since the position was opened.")),
|
|
80
82
|
/** Funding accumulated since the last change in position size. */
|
|
81
|
-
sinceChange: v.pipe(
|
|
83
|
+
sinceChange: v.pipe(Decimal, v.description("Funding accumulated since the last change in position size.")),
|
|
82
84
|
}), v.description("Cumulative funding details.")),
|
|
83
85
|
}), v.description("Position details.")),
|
|
84
86
|
}), v.description("Position for a specific asset."));
|
|
85
87
|
/** Escrowed balance for a specific asset. */
|
|
86
|
-
export const EvmEscrowsBalance = v.pipe(v.
|
|
88
|
+
export const EvmEscrowsBalance = v.pipe(v.object({
|
|
87
89
|
/** Asset symbol. */
|
|
88
90
|
coin: v.pipe(v.string(), v.description("Asset symbol.")),
|
|
89
91
|
/** Unique identifier for the token. */
|
|
90
|
-
token: v.pipe(
|
|
92
|
+
token: v.pipe(UnsignedInteger, v.description("Unique identifier for the token.")),
|
|
91
93
|
/** Total balance. */
|
|
92
94
|
total: v.pipe(UnsignedDecimal, v.description("Total balance.")),
|
|
93
95
|
}), v.description("Escrowed balance for a specific asset."));
|
|
94
96
|
/** Extra agent details for a user. */
|
|
95
|
-
export const ExtraAgent = v.pipe(v.
|
|
97
|
+
export const ExtraAgent = v.pipe(v.object({
|
|
96
98
|
/** Extra agent address. */
|
|
97
99
|
address: v.pipe(v.pipe(Hex, v.length(42)), v.description("Extra agent address.")),
|
|
98
100
|
/** Extra agent name. */
|
|
99
101
|
name: v.pipe(v.string(), v.minLength(1), v.description("Extra agent name.")),
|
|
100
102
|
/** Validity period as a timestamp (in ms since epoch). */
|
|
101
|
-
validUntil: v.pipe(
|
|
103
|
+
validUntil: v.pipe(UnsignedInteger, v.description("Validity period as a timestamp (in ms since epoch).")),
|
|
102
104
|
}), v.description("Extra agent details for a user."));
|
|
103
105
|
/** Legal verification status for a user. */
|
|
104
|
-
export const LegalCheck = v.pipe(v.
|
|
106
|
+
export const LegalCheck = v.pipe(v.object({
|
|
105
107
|
/** Whether the user IP address is allowed. */
|
|
106
108
|
ipAllowed: v.pipe(v.boolean(), v.description("Whether the user IP address is allowed.")),
|
|
107
109
|
/** Whether the user has accepted the terms of service. */
|
|
@@ -110,16 +112,16 @@ export const LegalCheck = v.pipe(v.strictObject({
|
|
|
110
112
|
userAllowed: v.pipe(v.boolean(), v.description("Whether the user is allowed to use the platform.")),
|
|
111
113
|
}), v.description("Legal verification status for a user."));
|
|
112
114
|
/** Multi-sig signers for a user. */
|
|
113
|
-
export const MultiSigSigners = v.pipe(v.
|
|
115
|
+
export const MultiSigSigners = v.pipe(v.object({
|
|
114
116
|
/** Authorized users addresses. */
|
|
115
117
|
authorizedUsers: v.pipe(v.array(v.pipe(Hex, v.length(42))), v.minLength(1), v.description("Authorized users addresses.")),
|
|
116
118
|
/** Threshold number of signatures required. */
|
|
117
|
-
threshold: v.pipe(
|
|
119
|
+
threshold: v.pipe(UnsignedInteger, v.minValue(1), v.description("Threshold number of signatures required.")),
|
|
118
120
|
}), v.description("Multi-sig signers for a user."));
|
|
119
121
|
/** Account summary for perpetual trading. */
|
|
120
|
-
export const PerpsClearinghouseState = v.pipe(v.
|
|
122
|
+
export const PerpsClearinghouseState = v.pipe(v.object({
|
|
121
123
|
/** Margin summary details. */
|
|
122
|
-
marginSummary: v.pipe(v.
|
|
124
|
+
marginSummary: v.pipe(v.object({
|
|
123
125
|
/** Total account value. */
|
|
124
126
|
accountValue: v.pipe(UnsignedDecimal, v.description("Total account value.")),
|
|
125
127
|
/** Total notional position value. */
|
|
@@ -130,7 +132,7 @@ export const PerpsClearinghouseState = v.pipe(v.strictObject({
|
|
|
130
132
|
totalMarginUsed: v.pipe(UnsignedDecimal, v.description("Total margin used.")),
|
|
131
133
|
}), v.description("Margin summary details.")),
|
|
132
134
|
/** Cross-margin summary details. */
|
|
133
|
-
crossMarginSummary: v.pipe(v.
|
|
135
|
+
crossMarginSummary: v.pipe(v.object({
|
|
134
136
|
/** Total account value. */
|
|
135
137
|
accountValue: v.pipe(UnsignedDecimal, v.description("Total account value.")),
|
|
136
138
|
/** Total notional position value. */
|
|
@@ -147,30 +149,30 @@ export const PerpsClearinghouseState = v.pipe(v.strictObject({
|
|
|
147
149
|
/** List of asset positions. */
|
|
148
150
|
assetPositions: v.pipe(v.array(AssetPosition), v.description("List of asset positions.")),
|
|
149
151
|
/** Timestamp when data was retrieved (in ms since epoch). */
|
|
150
|
-
time: v.pipe(
|
|
152
|
+
time: v.pipe(UnsignedInteger, v.description("Timestamp when data was retrieved (in ms since epoch).")),
|
|
151
153
|
}), v.description("Account summary for perpetual trading."));
|
|
152
154
|
/** Portfolio metrics snapshot. */
|
|
153
|
-
export const Portfolio = v.pipe(v.
|
|
155
|
+
export const Portfolio = v.pipe(v.object({
|
|
154
156
|
/** History entries for account value as [timestamp, value]. */
|
|
155
|
-
accountValueHistory: v.pipe(v.array(v.
|
|
157
|
+
accountValueHistory: v.pipe(v.array(v.tuple([UnsignedInteger, UnsignedDecimal])), v.description("History entries for account value as [timestamp, value].")),
|
|
156
158
|
/** History entries for profit and loss as [timestamp, value]. */
|
|
157
|
-
pnlHistory: v.pipe(v.array(v.
|
|
159
|
+
pnlHistory: v.pipe(v.array(v.tuple([UnsignedInteger, Decimal])), v.description("History entries for profit and loss as [timestamp, value].")),
|
|
158
160
|
/** Volume metric for the portfolio. */
|
|
159
161
|
vlm: v.pipe(UnsignedDecimal, v.description("Volume metric for the portfolio.")),
|
|
160
162
|
}), v.description("Portfolio metrics snapshot."));
|
|
161
163
|
/** Portfolio metrics grouped by time periods. */
|
|
162
|
-
export const PortfolioPeriods = v.pipe(v.
|
|
163
|
-
v.
|
|
164
|
-
v.
|
|
165
|
-
v.
|
|
166
|
-
v.
|
|
167
|
-
v.
|
|
168
|
-
v.
|
|
169
|
-
v.
|
|
170
|
-
v.
|
|
164
|
+
export const PortfolioPeriods = v.pipe(v.tuple([
|
|
165
|
+
v.tuple([v.literal("day"), Portfolio]),
|
|
166
|
+
v.tuple([v.literal("week"), Portfolio]),
|
|
167
|
+
v.tuple([v.literal("month"), Portfolio]),
|
|
168
|
+
v.tuple([v.literal("allTime"), Portfolio]),
|
|
169
|
+
v.tuple([v.literal("perpDay"), Portfolio]),
|
|
170
|
+
v.tuple([v.literal("perpWeek"), Portfolio]),
|
|
171
|
+
v.tuple([v.literal("perpMonth"), Portfolio]),
|
|
172
|
+
v.tuple([v.literal("perpAllTime"), Portfolio]),
|
|
171
173
|
]), v.description("Portfolio metrics grouped by time periods."));
|
|
172
174
|
/** Pre-transfer user existence check result. */
|
|
173
|
-
export const PreTransferCheck = v.pipe(v.
|
|
175
|
+
export const PreTransferCheck = v.pipe(v.object({
|
|
174
176
|
/** Activation fee. */
|
|
175
177
|
fee: v.pipe(UnsignedDecimal, v.description("Activation fee.")),
|
|
176
178
|
/** Whether the user is sanctioned. */
|
|
@@ -181,10 +183,10 @@ export const PreTransferCheck = v.pipe(v.strictObject({
|
|
|
181
183
|
userHasSentTx: v.pipe(v.boolean(), v.description("Whether the user has sent a transaction.")),
|
|
182
184
|
}), v.description("Pre-transfer user existence check result."));
|
|
183
185
|
/** Referral details for a user. */
|
|
184
|
-
export const Referral = v.pipe(v.
|
|
186
|
+
export const Referral = v.pipe(v.object({
|
|
185
187
|
/** Referrer details. */
|
|
186
188
|
referredBy: v.pipe(v.union([
|
|
187
|
-
v.
|
|
189
|
+
v.object({
|
|
188
190
|
/** Referrer address. */
|
|
189
191
|
referrer: v.pipe(v.pipe(Hex, v.length(42)), v.description("Referrer address.")),
|
|
190
192
|
/** Referral code used. */
|
|
@@ -202,17 +204,17 @@ export const Referral = v.pipe(v.strictObject({
|
|
|
202
204
|
builderRewards: v.pipe(UnsignedDecimal, v.description("Builder reward amount.")),
|
|
203
205
|
/** Current state of the referrer. */
|
|
204
206
|
referrerState: v.pipe(v.union([
|
|
205
|
-
v.
|
|
207
|
+
v.object({
|
|
206
208
|
/** Referrer is ready to receive rewards. */
|
|
207
209
|
stage: v.pipe(v.literal("ready"), v.description("Referrer is ready to receive rewards.")),
|
|
208
210
|
/** Referral program details. */
|
|
209
|
-
data: v.pipe(v.
|
|
211
|
+
data: v.pipe(v.object({
|
|
210
212
|
/** Assigned referral code. */
|
|
211
213
|
code: v.pipe(v.string(), v.minLength(1), v.description("Assigned referral code.")),
|
|
212
214
|
/** Total number of referrals. */
|
|
213
|
-
nReferrals: v.pipe(
|
|
215
|
+
nReferrals: v.pipe(UnsignedInteger, v.description("Total number of referrals.")),
|
|
214
216
|
/** Summary of each referral state. */
|
|
215
|
-
referralStates: v.pipe(v.array(v.
|
|
217
|
+
referralStates: v.pipe(v.array(v.object({
|
|
216
218
|
/** Cumulative traded volume. */
|
|
217
219
|
cumVlm: v.pipe(UnsignedDecimal, v.description("Cumulative traded volume.")),
|
|
218
220
|
/** Total fees rewarded to the referred user since referral. */
|
|
@@ -220,13 +222,13 @@ export const Referral = v.pipe(v.strictObject({
|
|
|
220
222
|
/** Total fees rewarded to the referrer from referred trades. */
|
|
221
223
|
cumFeesRewardedToReferrer: v.pipe(UnsignedDecimal, v.description("Total fees rewarded to the referrer from referred trades.")),
|
|
222
224
|
/** Timestamp when the referred user joined (in ms since epoch). */
|
|
223
|
-
timeJoined: v.pipe(
|
|
225
|
+
timeJoined: v.pipe(UnsignedInteger, v.description("Timestamp when the referred user joined (in ms since epoch).")),
|
|
224
226
|
/** Address of the referred user. */
|
|
225
227
|
user: v.pipe(v.pipe(Hex, v.length(42)), v.description("Address of the referred user.")),
|
|
226
228
|
/** Mapping of token IDs to referral reward states. */
|
|
227
|
-
tokenToState: v.pipe(v.array(v.
|
|
228
|
-
|
|
229
|
-
v.
|
|
229
|
+
tokenToState: v.pipe(v.array(v.tuple([
|
|
230
|
+
UnsignedInteger,
|
|
231
|
+
v.object({
|
|
230
232
|
/** Cumulative traded volume. */
|
|
231
233
|
cumVlm: v.pipe(UnsignedDecimal, v.description("Cumulative traded volume.")),
|
|
232
234
|
/** Total fees rewarded to the referred user since referral. */
|
|
@@ -238,22 +240,22 @@ export const Referral = v.pipe(v.strictObject({
|
|
|
238
240
|
})), v.description("Summary of each referral state.")),
|
|
239
241
|
}), v.description("Referral program details.")),
|
|
240
242
|
}),
|
|
241
|
-
v.
|
|
243
|
+
v.object({
|
|
242
244
|
/** Referrer needs to create a referral code. */
|
|
243
245
|
stage: v.pipe(v.literal("needToCreateCode"), v.description("Referrer needs to create a referral code.")),
|
|
244
246
|
}),
|
|
245
|
-
v.
|
|
247
|
+
v.object({
|
|
246
248
|
/** Referrer must complete a trade before earning rewards. */
|
|
247
249
|
stage: v.pipe(v.literal("needToTrade"), v.description("Referrer must complete a trade before earning rewards.")),
|
|
248
250
|
/** Required trading volume details for activation. */
|
|
249
|
-
data: v.pipe(v.
|
|
251
|
+
data: v.pipe(v.object({
|
|
250
252
|
/** Required trading volume. */
|
|
251
253
|
required: v.pipe(UnsignedDecimal, v.description("Required trading volume.")),
|
|
252
254
|
}), v.description("Required trading volume details for activation.")),
|
|
253
255
|
}),
|
|
254
256
|
]), v.description("Current state of the referrer.")),
|
|
255
257
|
/** History of referral rewards. */
|
|
256
|
-
rewardHistory: v.pipe(v.array(v.
|
|
258
|
+
rewardHistory: v.pipe(v.array(v.object({
|
|
257
259
|
/** Amount of earned rewards. */
|
|
258
260
|
earned: v.pipe(UnsignedDecimal, v.description("Amount of earned rewards.")),
|
|
259
261
|
/** Traded volume at the time of reward. */
|
|
@@ -261,12 +263,12 @@ export const Referral = v.pipe(v.strictObject({
|
|
|
261
263
|
/** Traded volume via referrals. */
|
|
262
264
|
referralVlm: v.pipe(UnsignedDecimal, v.description("Traded volume via referrals.")),
|
|
263
265
|
/** Timestamp when the reward was earned (in ms since epoch). */
|
|
264
|
-
time: v.pipe(
|
|
266
|
+
time: v.pipe(UnsignedInteger, v.description("Timestamp when the reward was earned (in ms since epoch).")),
|
|
265
267
|
})), v.description("History of referral rewards.")),
|
|
266
268
|
/** Mapping of token IDs to referral reward states. */
|
|
267
|
-
tokenToState: v.pipe(v.array(v.
|
|
268
|
-
|
|
269
|
-
v.
|
|
269
|
+
tokenToState: v.pipe(v.array(v.tuple([
|
|
270
|
+
UnsignedInteger,
|
|
271
|
+
v.object({
|
|
270
272
|
/** Cumulative traded volume. */
|
|
271
273
|
cumVlm: v.pipe(UnsignedDecimal, v.description("Cumulative traded volume.")),
|
|
272
274
|
/** Rewards earned but not yet claimed. */
|
|
@@ -279,11 +281,11 @@ export const Referral = v.pipe(v.strictObject({
|
|
|
279
281
|
])), v.description("Mapping of token IDs to referral reward states.")),
|
|
280
282
|
}), v.description("Referral details for a user."));
|
|
281
283
|
/** Balance for a specific spot token. */
|
|
282
|
-
export const SpotBalance = v.pipe(v.
|
|
284
|
+
export const SpotBalance = v.pipe(v.object({
|
|
283
285
|
/** Asset symbol. */
|
|
284
286
|
coin: v.pipe(v.string(), v.description("Asset symbol.")),
|
|
285
287
|
/** Unique identifier for the token. */
|
|
286
|
-
token: v.pipe(
|
|
288
|
+
token: v.pipe(UnsignedInteger, v.description("Unique identifier for the token.")),
|
|
287
289
|
/** Total balance. */
|
|
288
290
|
total: v.pipe(UnsignedDecimal, v.description("Total balance.")),
|
|
289
291
|
/** Amount on hold. */
|
|
@@ -292,14 +294,14 @@ export const SpotBalance = v.pipe(v.strictObject({
|
|
|
292
294
|
entryNtl: v.pipe(UnsignedDecimal, v.description("Entry notional value.")),
|
|
293
295
|
}), v.description("Balance for a specific spot token."));
|
|
294
296
|
/** Account summary for spot trading. */
|
|
295
|
-
export const SpotClearinghouseState = v.pipe(v.
|
|
297
|
+
export const SpotClearinghouseState = v.pipe(v.object({
|
|
296
298
|
/** Balance for each token. */
|
|
297
299
|
balances: v.pipe(v.array(SpotBalance), v.description("Balance for each token.")),
|
|
298
300
|
/** Escrowed balances. */
|
|
299
301
|
evmEscrows: v.pipe(v.optional(v.array(EvmEscrowsBalance)), v.description("Escrowed balances.")),
|
|
300
302
|
}), v.description("Account summary for spot trading."));
|
|
301
303
|
/** Sub-account details for a user. */
|
|
302
|
-
export const SubAccount = v.pipe(v.
|
|
304
|
+
export const SubAccount = v.pipe(v.object({
|
|
303
305
|
/** Sub-account name. */
|
|
304
306
|
name: v.pipe(v.string(), v.minLength(1), v.description("Sub-account name.")),
|
|
305
307
|
/** Sub-account address. */
|
|
@@ -312,9 +314,9 @@ export const SubAccount = v.pipe(v.strictObject({
|
|
|
312
314
|
spotState: v.pipe(SpotClearinghouseState, v.description("Spot tokens clearinghouse state.")),
|
|
313
315
|
}), v.description("Sub-account details for a user."));
|
|
314
316
|
/** User fees. */
|
|
315
|
-
export const UserFees = v.pipe(v.
|
|
317
|
+
export const UserFees = v.pipe(v.object({
|
|
316
318
|
/** Daily user volume metrics. */
|
|
317
|
-
dailyUserVlm: v.pipe(v.array(v.
|
|
319
|
+
dailyUserVlm: v.pipe(v.array(v.object({
|
|
318
320
|
/** Date in YYYY-M-D format. */
|
|
319
321
|
date: v.pipe(v.string(), v.isoDate(), v.description("Date in YYYY-M-D format.")),
|
|
320
322
|
/** User cross-trade volume. */
|
|
@@ -325,7 +327,7 @@ export const UserFees = v.pipe(v.strictObject({
|
|
|
325
327
|
exchange: v.pipe(UnsignedDecimal, v.description("Exchange total volume.")),
|
|
326
328
|
})), v.description("Daily user volume metrics.")),
|
|
327
329
|
/** Fee schedule information. */
|
|
328
|
-
feeSchedule: v.pipe(v.
|
|
330
|
+
feeSchedule: v.pipe(v.object({
|
|
329
331
|
/** Cross-trade fee rate. */
|
|
330
332
|
cross: v.pipe(UnsignedDecimal, v.description("Cross-trade fee rate.")),
|
|
331
333
|
/** Add-liquidity fee rate. */
|
|
@@ -335,9 +337,9 @@ export const UserFees = v.pipe(v.strictObject({
|
|
|
335
337
|
/** Spot add-liquidity fee rate. */
|
|
336
338
|
spotAdd: v.pipe(UnsignedDecimal, v.description("Spot add-liquidity fee rate.")),
|
|
337
339
|
/** Fee tiers details. */
|
|
338
|
-
tiers: v.pipe(v.
|
|
340
|
+
tiers: v.pipe(v.object({
|
|
339
341
|
/** VIP fee tier information. */
|
|
340
|
-
vip: v.pipe(v.array(v.
|
|
342
|
+
vip: v.pipe(v.array(v.object({
|
|
341
343
|
/** Notional volume cutoff. */
|
|
342
344
|
ntlCutoff: v.pipe(UnsignedDecimal, v.description("Notional volume cutoff.")),
|
|
343
345
|
/** Cross-trade fee rate. */
|
|
@@ -350,17 +352,17 @@ export const UserFees = v.pipe(v.strictObject({
|
|
|
350
352
|
spotAdd: v.pipe(UnsignedDecimal, v.description("Spot add-liquidity fee rate.")),
|
|
351
353
|
})), v.description("VIP fee tier information.")),
|
|
352
354
|
/** Market maker fee tier information. */
|
|
353
|
-
mm: v.pipe(v.array(v.
|
|
355
|
+
mm: v.pipe(v.array(v.object({
|
|
354
356
|
/** Maker fraction cutoff. */
|
|
355
357
|
makerFractionCutoff: v.pipe(UnsignedDecimal, v.description("Maker fraction cutoff.")),
|
|
356
358
|
/** Add-liquidity fee rate. */
|
|
357
|
-
add: v.pipe(
|
|
359
|
+
add: v.pipe(Decimal, v.description("Add-liquidity fee rate.")),
|
|
358
360
|
})), v.description("Market maker fee tier information.")),
|
|
359
361
|
}), v.description("Fee tiers details.")),
|
|
360
362
|
/** Referral discount rate. */
|
|
361
363
|
referralDiscount: v.pipe(UnsignedDecimal, v.description("Referral discount rate.")),
|
|
362
364
|
/** Staking discount tiers details. */
|
|
363
|
-
stakingDiscountTiers: v.pipe(v.array(v.
|
|
365
|
+
stakingDiscountTiers: v.pipe(v.array(v.object({
|
|
364
366
|
/** Basis points of maximum supply. */
|
|
365
367
|
bpsOfMaxSupply: v.pipe(UnsignedDecimal, v.description("Basis points of maximum supply.")),
|
|
366
368
|
/** Discount rate applied. */
|
|
@@ -385,7 +387,7 @@ export const UserFees = v.pipe(v.strictObject({
|
|
|
385
387
|
nextTrialAvailableTimestamp: v.pipe(v.union([v.unknown(), v.null()]), v.description("Timestamp when next trial becomes available.")),
|
|
386
388
|
stakingLink: v.union([v.unknown(), v.null()]),
|
|
387
389
|
/** Active staking discount details. */
|
|
388
|
-
activeStakingDiscount: v.pipe(v.
|
|
390
|
+
activeStakingDiscount: v.pipe(v.object({
|
|
389
391
|
/** Basis points of maximum supply. */
|
|
390
392
|
bpsOfMaxSupply: v.pipe(UnsignedDecimal, v.description("Basis points of maximum supply.")),
|
|
391
393
|
/** Discount rate applied. */
|
|
@@ -393,65 +395,65 @@ export const UserFees = v.pipe(v.strictObject({
|
|
|
393
395
|
}), v.description("Active staking discount details.")),
|
|
394
396
|
}), v.description("User fees."));
|
|
395
397
|
/** Funding update details. */
|
|
396
|
-
export const FundingUpdate = v.pipe(v.
|
|
398
|
+
export const FundingUpdate = v.pipe(v.object({
|
|
397
399
|
/** Update type. */
|
|
398
400
|
type: v.pipe(v.literal("funding"), v.description("Update type.")),
|
|
399
401
|
/** Asset symbol. */
|
|
400
402
|
coin: v.pipe(v.string(), v.description("Asset symbol.")),
|
|
401
403
|
/** Amount transferred in USDC. */
|
|
402
|
-
usdc: v.pipe(
|
|
404
|
+
usdc: v.pipe(Decimal, v.description("Amount transferred in USDC.")),
|
|
403
405
|
/** Signed position size. */
|
|
404
|
-
szi: v.pipe(
|
|
406
|
+
szi: v.pipe(Decimal, v.description("Signed position size.")),
|
|
405
407
|
/** Applied funding rate. */
|
|
406
|
-
fundingRate: v.pipe(
|
|
408
|
+
fundingRate: v.pipe(Decimal, v.description("Applied funding rate.")),
|
|
407
409
|
/** Number of samples. */
|
|
408
|
-
nSamples: v.pipe(v.union([
|
|
410
|
+
nSamples: v.pipe(v.union([UnsignedInteger, v.null()]), v.description("Number of samples.")),
|
|
409
411
|
}), v.description("Funding update details."));
|
|
410
412
|
/** Funding ledger update for a user. */
|
|
411
|
-
export const UserFundingUpdate = v.pipe(v.
|
|
413
|
+
export const UserFundingUpdate = v.pipe(v.object({
|
|
412
414
|
/** Timestamp of the update (in ms since epoch). */
|
|
413
|
-
time: v.pipe(
|
|
415
|
+
time: v.pipe(UnsignedInteger, v.description("Timestamp of the update (in ms since epoch).")),
|
|
414
416
|
/** L1 transaction hash. */
|
|
415
417
|
hash: v.pipe(v.pipe(Hex, v.length(66)), v.description("L1 transaction hash.")),
|
|
416
418
|
/** Update details. */
|
|
417
419
|
delta: v.pipe(FundingUpdate, v.description("Update details.")),
|
|
418
420
|
}), v.description("Funding ledger update for a user."));
|
|
419
421
|
/** User rate limits. */
|
|
420
|
-
export const UserRateLimit = v.pipe(v.
|
|
422
|
+
export const UserRateLimit = v.pipe(v.object({
|
|
421
423
|
/** Cumulative trading volume. */
|
|
422
424
|
cumVlm: v.pipe(UnsignedDecimal, v.description("Cumulative trading volume.")),
|
|
423
425
|
/** Number of API requests used. */
|
|
424
|
-
nRequestsUsed: v.pipe(
|
|
426
|
+
nRequestsUsed: v.pipe(UnsignedInteger, v.description("Number of API requests used.")),
|
|
425
427
|
/** Maximum allowed API requests. */
|
|
426
|
-
nRequestsCap: v.pipe(
|
|
428
|
+
nRequestsCap: v.pipe(UnsignedInteger, v.description("Maximum allowed API requests.")),
|
|
427
429
|
}), v.description("User rate limits."));
|
|
428
430
|
/** User role. */
|
|
429
431
|
export const UserRole = v.pipe(v.union([
|
|
430
|
-
v.
|
|
432
|
+
v.object({
|
|
431
433
|
/** Role identifier. */
|
|
432
434
|
role: v.pipe(v.union([v.literal("missing"), v.literal("user"), v.literal("vault")]), v.description("Role identifier.")),
|
|
433
435
|
}),
|
|
434
|
-
v.
|
|
436
|
+
v.object({
|
|
435
437
|
/** Role identifier. */
|
|
436
438
|
role: v.pipe(v.literal("agent"), v.description("Role identifier.")),
|
|
437
439
|
/** Details for agent role. */
|
|
438
|
-
data: v.pipe(v.
|
|
440
|
+
data: v.pipe(v.object({
|
|
439
441
|
/** Master account address associated with the agent. */
|
|
440
442
|
user: v.pipe(v.pipe(Hex, v.length(42)), v.description("Master account address associated with the agent.")),
|
|
441
443
|
}), v.description("Details for agent role.")),
|
|
442
444
|
}),
|
|
443
|
-
v.
|
|
445
|
+
v.object({
|
|
444
446
|
/** Role identifier. */
|
|
445
447
|
role: v.pipe(v.literal("subAccount"), v.description("Role identifier.")),
|
|
446
448
|
/** Details for sub-account role. */
|
|
447
|
-
data: v.pipe(v.
|
|
449
|
+
data: v.pipe(v.object({
|
|
448
450
|
/** Master account address associated with the sub-account. */
|
|
449
451
|
master: v.pipe(v.pipe(Hex, v.length(42)), v.description("Master account address associated with the sub-account.")),
|
|
450
452
|
}), v.description("Details for sub-account role.")),
|
|
451
453
|
}),
|
|
452
454
|
]), v.description("User role."));
|
|
453
455
|
/** Transfer between spot and perpetual accounts. */
|
|
454
|
-
export const AccountClassTransferUpdate = v.pipe(v.
|
|
456
|
+
export const AccountClassTransferUpdate = v.pipe(v.object({
|
|
455
457
|
/** Update type. */
|
|
456
458
|
type: v.pipe(v.literal("accountClassTransfer"), v.description("Update type.")),
|
|
457
459
|
/** Amount transferred in USDC. */
|
|
@@ -460,14 +462,14 @@ export const AccountClassTransferUpdate = v.pipe(v.strictObject({
|
|
|
460
462
|
toPerp: v.pipe(v.boolean(), v.description("Indicates if the transfer is to the perpetual account.")),
|
|
461
463
|
}), v.description("Transfer between spot and perpetual accounts."));
|
|
462
464
|
/** Deposit update to an account. */
|
|
463
|
-
export const DepositUpdate = v.pipe(v.
|
|
465
|
+
export const DepositUpdate = v.pipe(v.object({
|
|
464
466
|
/** Update type. */
|
|
465
467
|
type: v.pipe(v.literal("deposit"), v.description("Update type.")),
|
|
466
468
|
/** Amount deposited in USDC. */
|
|
467
469
|
usdc: v.pipe(UnsignedDecimal, v.description("Amount deposited in USDC.")),
|
|
468
470
|
}), v.description("Deposit update to an account."));
|
|
469
471
|
/** Internal transfer between accounts. */
|
|
470
|
-
export const InternalTransferUpdate = v.pipe(v.
|
|
472
|
+
export const InternalTransferUpdate = v.pipe(v.object({
|
|
471
473
|
/** Update type. */
|
|
472
474
|
type: v.pipe(v.literal("internalTransfer"), v.description("Update type.")),
|
|
473
475
|
/** Amount transferred in USDC. */
|
|
@@ -480,7 +482,7 @@ export const InternalTransferUpdate = v.pipe(v.strictObject({
|
|
|
480
482
|
fee: v.pipe(UnsignedDecimal, v.description("Transfer fee.")),
|
|
481
483
|
}), v.description("Internal transfer between accounts."));
|
|
482
484
|
/** Liquidation event update. */
|
|
483
|
-
export const LiquidationUpdate = v.pipe(v.
|
|
485
|
+
export const LiquidationUpdate = v.pipe(v.object({
|
|
484
486
|
/** Update type. */
|
|
485
487
|
type: v.pipe(v.literal("liquidation"), v.description("Update type.")),
|
|
486
488
|
/** Total notional value of liquidated positions. */
|
|
@@ -490,15 +492,15 @@ export const LiquidationUpdate = v.pipe(v.strictObject({
|
|
|
490
492
|
/** Leverage type for liquidated positions. */
|
|
491
493
|
leverageType: v.pipe(v.union([v.literal("Cross"), v.literal("Isolated")]), v.description("Leverage type for liquidated positions.")),
|
|
492
494
|
/** Details of each liquidated position. */
|
|
493
|
-
liquidatedPositions: v.pipe(v.array(v.
|
|
495
|
+
liquidatedPositions: v.pipe(v.array(v.object({
|
|
494
496
|
/** Asset symbol of the liquidated position. */
|
|
495
497
|
coin: v.pipe(v.string(), v.description("Asset symbol of the liquidated position.")),
|
|
496
498
|
/** Signed position size liquidated. */
|
|
497
|
-
szi: v.pipe(
|
|
499
|
+
szi: v.pipe(Decimal, v.description("Signed position size liquidated.")),
|
|
498
500
|
})), v.description("Details of each liquidated position.")),
|
|
499
501
|
}), v.description("Liquidation event update."));
|
|
500
502
|
/** Rewards claim event update. */
|
|
501
|
-
export const RewardsClaimUpdate = v.pipe(v.
|
|
503
|
+
export const RewardsClaimUpdate = v.pipe(v.object({
|
|
502
504
|
/** Update type. */
|
|
503
505
|
type: v.pipe(v.literal("rewardsClaim"), v.description("Update type.")),
|
|
504
506
|
/** Amount of rewards claimed. */
|
|
@@ -507,7 +509,7 @@ export const RewardsClaimUpdate = v.pipe(v.strictObject({
|
|
|
507
509
|
token: v.pipe(v.string(), v.description("Token symbol.")),
|
|
508
510
|
}), v.description("Rewards claim event update."));
|
|
509
511
|
/** Spot transfer update between accounts. */
|
|
510
|
-
export const SpotTransferUpdate = v.pipe(v.
|
|
512
|
+
export const SpotTransferUpdate = v.pipe(v.object({
|
|
511
513
|
/** Update type. */
|
|
512
514
|
type: v.pipe(v.literal("spotTransfer"), v.description("Update type.")),
|
|
513
515
|
/** Token symbol. */
|
|
@@ -529,7 +531,7 @@ export const SpotTransferUpdate = v.pipe(v.strictObject({
|
|
|
529
531
|
feeToken: v.pipe(v.string(), v.description('Token in which the fee is denominated (e.g., "USDC").')),
|
|
530
532
|
}), v.description("Spot transfer update between accounts."));
|
|
531
533
|
/** Transfer update between sub-accounts. */
|
|
532
|
-
export const SubAccountTransferUpdate = v.pipe(v.
|
|
534
|
+
export const SubAccountTransferUpdate = v.pipe(v.object({
|
|
533
535
|
/** Update type. */
|
|
534
536
|
type: v.pipe(v.literal("subAccountTransfer"), v.description("Update type.")),
|
|
535
537
|
/** Amount transferred in USDC. */
|
|
@@ -540,7 +542,7 @@ export const SubAccountTransferUpdate = v.pipe(v.strictObject({
|
|
|
540
542
|
destination: v.pipe(v.pipe(Hex, v.length(42)), v.description("Destination address.")),
|
|
541
543
|
}), v.description("Transfer update between sub-accounts."));
|
|
542
544
|
/** Vault creation update. */
|
|
543
|
-
export const VaultCreateUpdate = v.pipe(v.
|
|
545
|
+
export const VaultCreateUpdate = v.pipe(v.object({
|
|
544
546
|
/** Update type. */
|
|
545
547
|
type: v.pipe(v.literal("vaultCreate"), v.description("Update type.")),
|
|
546
548
|
/** Address of the created vault. */
|
|
@@ -551,7 +553,7 @@ export const VaultCreateUpdate = v.pipe(v.strictObject({
|
|
|
551
553
|
fee: v.pipe(UnsignedDecimal, v.description("Vault creation fee.")),
|
|
552
554
|
}), v.description("Vault creation update."));
|
|
553
555
|
/** Vault deposit update. */
|
|
554
|
-
export const VaultDepositUpdate = v.pipe(v.
|
|
556
|
+
export const VaultDepositUpdate = v.pipe(v.object({
|
|
555
557
|
/** Update type. */
|
|
556
558
|
type: v.pipe(v.literal("vaultDeposit"), v.description("Update type.")),
|
|
557
559
|
/** Address of the target vault. */
|
|
@@ -560,7 +562,7 @@ export const VaultDepositUpdate = v.pipe(v.strictObject({
|
|
|
560
562
|
usdc: v.pipe(UnsignedDecimal, v.description("Amount deposited in USDC.")),
|
|
561
563
|
}), v.description("Vault deposit update."));
|
|
562
564
|
/** Vault distribution update. */
|
|
563
|
-
export const VaultDistributionUpdate = v.pipe(v.
|
|
565
|
+
export const VaultDistributionUpdate = v.pipe(v.object({
|
|
564
566
|
/** Update type. */
|
|
565
567
|
type: v.pipe(v.literal("vaultDistribution"), v.description("Update type.")),
|
|
566
568
|
/** Address of the vault distributing funds. */
|
|
@@ -569,7 +571,7 @@ export const VaultDistributionUpdate = v.pipe(v.strictObject({
|
|
|
569
571
|
usdc: v.pipe(UnsignedDecimal, v.description("Amount distributed in USDC.")),
|
|
570
572
|
}), v.description("Vault distribution update."));
|
|
571
573
|
/** Vault withdrawal event update. */
|
|
572
|
-
export const VaultWithdrawUpdate = v.pipe(v.
|
|
574
|
+
export const VaultWithdrawUpdate = v.pipe(v.object({
|
|
573
575
|
/** Update type. */
|
|
574
576
|
type: v.pipe(v.literal("vaultWithdraw"), v.description("Update type.")),
|
|
575
577
|
/** Vault address. */
|
|
@@ -588,20 +590,20 @@ export const VaultWithdrawUpdate = v.pipe(v.strictObject({
|
|
|
588
590
|
netWithdrawnUsd: v.pipe(UnsignedDecimal, v.description("Net withdrawn amount in USD after fees and costs.")),
|
|
589
591
|
}), v.description("Vault withdrawal event update."));
|
|
590
592
|
/** Withdrawal update from an account. */
|
|
591
|
-
export const WithdrawUpdate = v.pipe(v.
|
|
593
|
+
export const WithdrawUpdate = v.pipe(v.object({
|
|
592
594
|
/** Update type. */
|
|
593
595
|
type: v.pipe(v.literal("withdraw"), v.description("Update type.")),
|
|
594
596
|
/** Amount withdrawn in USDC. */
|
|
595
597
|
usdc: v.pipe(UnsignedDecimal, v.description("Amount withdrawn in USDC.")),
|
|
596
598
|
/** Unique nonce for the withdrawal request. */
|
|
597
|
-
nonce: v.pipe(
|
|
599
|
+
nonce: v.pipe(UnsignedInteger, v.description("Unique nonce for the withdrawal request.")),
|
|
598
600
|
/** Withdrawal fee. */
|
|
599
601
|
fee: v.pipe(UnsignedDecimal, v.description("Withdrawal fee.")),
|
|
600
602
|
}), v.description("Withdrawal update from an account."));
|
|
601
603
|
/** Non-funding ledger update for a user. */
|
|
602
|
-
export const UserNonFundingLedgerUpdate = v.pipe(v.
|
|
604
|
+
export const UserNonFundingLedgerUpdate = v.pipe(v.object({
|
|
603
605
|
/** Timestamp of the update (in ms since epoch). */
|
|
604
|
-
time: v.pipe(
|
|
606
|
+
time: v.pipe(UnsignedInteger, v.description("Timestamp of the update (in ms since epoch).")),
|
|
605
607
|
/** L1 transaction hash. */
|
|
606
608
|
hash: v.pipe(v.pipe(Hex, v.length(66)), v.description("L1 transaction hash.")),
|
|
607
609
|
/** Update details. */
|
|
@@ -620,3 +622,46 @@ export const UserNonFundingLedgerUpdate = v.pipe(v.strictObject({
|
|
|
620
622
|
WithdrawUpdate,
|
|
621
623
|
]), v.description("Update details.")),
|
|
622
624
|
}), v.description("Non-funding ledger update for a user."));
|
|
625
|
+
/** Comprehensive user and market data. */
|
|
626
|
+
export const WebData2 = v.pipe(v.object({
|
|
627
|
+
/** Account summary for perpetual trading. */
|
|
628
|
+
clearinghouseState: v.pipe(PerpsClearinghouseState, v.description("Account summary for perpetual trading.")),
|
|
629
|
+
/** Leading vaults information. */
|
|
630
|
+
leadingVaults: v.pipe(v.array(v.object({
|
|
631
|
+
/** Address of the vault. */
|
|
632
|
+
address: v.pipe(v.pipe(Hex, v.length(42)), v.description("Address of the vault.")),
|
|
633
|
+
/** Name of the vault. */
|
|
634
|
+
name: v.pipe(v.string(), v.description("Name of the vault.")),
|
|
635
|
+
})), v.description("Leading vaults information.")),
|
|
636
|
+
/** Total equity in vaults. */
|
|
637
|
+
totalVaultEquity: v.pipe(UnsignedDecimal, v.description("Total equity in vaults.")),
|
|
638
|
+
/** User open orders with frontend information. */
|
|
639
|
+
openOrders: v.pipe(v.array(FrontendOrder), v.description("User open orders with frontend information.")),
|
|
640
|
+
/** Agent address if one exists. */
|
|
641
|
+
agentAddress: v.pipe(v.union([v.pipe(Hex, v.length(42)), v.null()]), v.description("Agent address if one exists.")),
|
|
642
|
+
/** Timestamp until which the agent is valid. */
|
|
643
|
+
agentValidUntil: v.pipe(v.union([UnsignedInteger, v.null()]), v.description("Timestamp until which the agent is valid.")),
|
|
644
|
+
/** Cumulative ledger value. */
|
|
645
|
+
cumLedger: v.pipe(UnsignedDecimal, v.description("Cumulative ledger value.")),
|
|
646
|
+
/** Metadata for perpetual assets. */
|
|
647
|
+
meta: v.pipe(PerpsMeta, v.description("Metadata for perpetual assets.")),
|
|
648
|
+
/** Context information for perpetual assets. */
|
|
649
|
+
assetCtxs: v.pipe(v.array(PerpsAssetCtx), v.description("Context information for perpetual assets.")),
|
|
650
|
+
/** Server timestamp (in ms since epoch). */
|
|
651
|
+
serverTime: v.pipe(UnsignedInteger, v.description("Server timestamp (in ms since epoch).")),
|
|
652
|
+
/** Whether this account is a vault. */
|
|
653
|
+
isVault: v.pipe(v.boolean(), v.description("Whether this account is a vault.")),
|
|
654
|
+
/** User address. */
|
|
655
|
+
user: v.pipe(v.pipe(Hex, v.length(42)), v.description("User address.")),
|
|
656
|
+
/** TWAP states. */
|
|
657
|
+
twapStates: v.pipe(v.array(v.tuple([UnsignedInteger, TwapState])), v.description("TWAP states.")),
|
|
658
|
+
/** Account summary for spot trading. */
|
|
659
|
+
spotState: v.pipe(v.optional(SpotClearinghouseState), v.description("Account summary for spot trading.")),
|
|
660
|
+
/** Context information for spot assets. */
|
|
661
|
+
spotAssetCtxs: v.pipe(v.array(SpotAssetCtx), v.description("Context information for spot assets.")),
|
|
662
|
+
/** Whether the user has opted out of spot dusting. */
|
|
663
|
+
optOutOfSpotDusting: v.pipe(v.optional(v.literal(true)), v.description("Whether the user has opted out of spot dusting.")),
|
|
664
|
+
/** Assets currently at their open interest cap. */
|
|
665
|
+
perpsAtOpenInterestCap: v.pipe(v.optional(v.array(v.string())), v.description("Assets currently at their open interest cap.")),
|
|
666
|
+
}), v.description("Comprehensive user and market data."));
|
|
667
|
+
//# sourceMappingURL=accounts.js.map
|