@nktkas/hyperliquid 0.13.0 → 0.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +42 -17
- package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/1.0.5/_types.js +2 -0
- package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
- package/esm/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.js +1 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_types.js +2 -0
- package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.js +1 -1
- package/{script/deps/jsr.io/@std/encoding/1.0.6 → esm/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/hex.js +1 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/_types.js +2 -0
- package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.js +2 -2
- package/esm/mod.d.ts +15 -14
- package/esm/mod.d.ts.map +1 -1
- package/esm/src/clients/event.d.ts +64 -21
- package/esm/src/clients/event.d.ts.map +1 -1
- package/esm/src/clients/event.js +76 -18
- package/esm/src/clients/public.d.ts +244 -52
- package/esm/src/clients/public.d.ts.map +1 -1
- package/esm/src/clients/public.js +243 -47
- package/esm/src/clients/wallet.d.ts +122 -53
- package/esm/src/clients/wallet.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +201 -65
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +4 -1
- package/esm/src/transports/websocket/hyperliquid_event_target.d.ts +27 -21
- package/esm/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -1
- package/esm/src/transports/websocket/hyperliquid_event_target.js +37 -0
- package/esm/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_request_dispatcher.js +4 -4
- package/esm/src/transports/websocket/websocket_transport.d.ts +7 -10
- package/esm/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/esm/src/transports/websocket/websocket_transport.js +41 -35
- package/esm/src/types/common.d.ts +3 -0
- package/esm/src/types/common.d.ts.map +1 -0
- package/esm/src/types/common.js +1 -0
- package/esm/src/types/exchange/common.d.ts +36 -0
- package/esm/src/types/exchange/common.d.ts.map +1 -0
- package/esm/src/types/exchange/common.js +1 -0
- package/esm/src/types/exchange/requests.d.ts +502 -0
- package/esm/src/types/exchange/requests.d.ts.map +1 -0
- package/esm/src/types/exchange/requests.js +1 -0
- package/esm/src/types/exchange/responses.d.ts +141 -0
- package/esm/src/types/exchange/responses.d.ts.map +1 -0
- package/esm/src/types/exchange/responses.js +1 -0
- package/esm/src/types/explorer/common.d.ts +37 -0
- package/esm/src/types/explorer/common.d.ts.map +1 -0
- package/esm/src/types/explorer/common.js +1 -0
- package/esm/src/types/explorer/requests.d.ts +35 -0
- package/esm/src/types/explorer/requests.d.ts.map +1 -0
- package/esm/src/types/explorer/requests.js +1 -0
- package/esm/src/types/explorer/responses.d.ts +23 -0
- package/esm/src/types/explorer/responses.d.ts.map +1 -0
- package/esm/src/types/explorer/responses.js +1 -0
- package/esm/src/types/info/accounts.d.ts +489 -0
- package/esm/src/types/info/accounts.d.ts.map +1 -0
- package/esm/src/types/info/accounts.js +1 -0
- package/esm/src/types/info/assets.d.ts +275 -0
- package/esm/src/types/info/assets.d.ts.map +1 -0
- package/esm/src/types/info/assets.js +1 -0
- package/esm/src/types/info/delegations.d.ts +117 -0
- package/esm/src/types/info/delegations.d.ts.map +1 -0
- package/esm/src/types/info/delegations.js +1 -0
- package/esm/src/types/info/orders.d.ts +209 -0
- package/esm/src/types/info/orders.d.ts.map +1 -0
- package/esm/src/types/info/orders.js +1 -0
- package/esm/src/types/info/requests.d.ts +445 -0
- package/esm/src/types/info/requests.d.ts.map +1 -0
- package/esm/src/types/info/requests.js +1 -0
- package/esm/src/types/info/vaults.d.ts +90 -0
- package/esm/src/types/info/vaults.d.ts.map +1 -0
- package/esm/src/types/info/vaults.js +1 -0
- package/esm/src/types/subscriptions/common.d.ts +208 -0
- package/esm/src/types/subscriptions/common.d.ts.map +1 -0
- package/esm/src/types/subscriptions/common.js +1 -0
- package/esm/src/types/subscriptions/requests.d.ts +134 -0
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -0
- package/esm/src/types/subscriptions/requests.js +1 -0
- package/esm/src/utils/key_sort.d.ts +3 -3
- package/esm/src/utils/key_sort.d.ts.map +1 -1
- package/esm/src/utils/signing.d.ts +1 -1
- package/esm/src/utils/signing.js +2 -2
- package/package.json +2 -2
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/mod.js +13 -3
- package/script/deps/jsr.io/@derzade/typescript-event-target/1.1.1/src/TypedEventTarget.js +23 -13
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_assert.js +55 -45
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/_u64.js +97 -87
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/crypto.js +14 -4
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/sha3.js +288 -278
- package/script/deps/jsr.io/@noble/hashes/1.7.1/src/utils.js +238 -228
- package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts +9 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/_types.js +13 -0
- package/script/deps/jsr.io/@std/bytes/{1.0.4 → 1.0.5}/concat.d.ts +3 -1
- package/script/deps/jsr.io/@std/bytes/1.0.5/concat.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/bytes/1.0.5/concat.js +45 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts +9 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/_types.js +13 -0
- package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +39 -0
- package/{esm/deps/jsr.io/@std/encoding/1.0.6 → script/deps/jsr.io/@std/encoding/1.0.7}/hex.d.ts +3 -1
- package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.7/hex.js +123 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts +9 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.3/_types.js +13 -0
- package/script/deps/jsr.io/@std/msgpack/{1.0.2 → 1.0.3}/encode.d.ts +3 -1
- package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/msgpack/1.0.3/encode.js +250 -0
- package/script/mod.d.ts +15 -14
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +23 -13
- package/script/src/clients/event.d.ts +64 -21
- package/script/src/clients/event.d.ts.map +1 -1
- package/script/src/clients/event.js +551 -483
- package/script/src/clients/public.d.ts +244 -52
- package/script/src/clients/public.d.ts.map +1 -1
- package/script/src/clients/public.js +914 -708
- package/script/src/clients/wallet.d.ts +122 -53
- package/script/src/clients/wallet.d.ts.map +1 -1
- package/script/src/clients/wallet.js +1121 -975
- package/script/src/transports/base.js +25 -15
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +174 -161
- package/script/src/transports/websocket/hyperliquid_event_target.d.ts +27 -21
- package/script/src/transports/websocket/hyperliquid_event_target.d.ts.map +1 -1
- package/script/src/transports/websocket/hyperliquid_event_target.js +80 -33
- package/script/src/transports/websocket/reconnecting_websocket.js +364 -354
- package/script/src/transports/websocket/websocket_request_dispatcher.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_request_dispatcher.js +196 -186
- package/script/src/transports/websocket/websocket_transport.d.ts +7 -10
- package/script/src/transports/websocket/websocket_transport.d.ts.map +1 -1
- package/script/src/transports/websocket/websocket_transport.js +236 -220
- package/script/src/types/common.d.ts +3 -0
- package/script/src/types/common.d.ts.map +1 -0
- package/script/src/types/common.js +12 -0
- package/script/src/types/exchange/common.d.ts +36 -0
- package/script/src/types/exchange/common.d.ts.map +1 -0
- package/script/src/types/exchange/common.js +12 -0
- package/script/src/types/exchange/requests.d.ts +502 -0
- package/script/src/types/exchange/requests.d.ts.map +1 -0
- package/script/src/types/exchange/requests.js +12 -0
- package/script/src/types/exchange/responses.d.ts +141 -0
- package/script/src/types/exchange/responses.d.ts.map +1 -0
- package/script/src/types/exchange/responses.js +12 -0
- package/script/src/types/explorer/common.d.ts +37 -0
- package/script/src/types/explorer/common.d.ts.map +1 -0
- package/script/src/types/explorer/common.js +12 -0
- package/script/src/types/explorer/requests.d.ts +35 -0
- package/script/src/types/explorer/requests.d.ts.map +1 -0
- package/script/src/types/explorer/requests.js +12 -0
- package/script/src/types/explorer/responses.d.ts +23 -0
- package/script/src/types/explorer/responses.d.ts.map +1 -0
- package/script/src/types/explorer/responses.js +12 -0
- package/script/src/types/info/accounts.d.ts +489 -0
- package/script/src/types/info/accounts.d.ts.map +1 -0
- package/script/src/types/info/accounts.js +12 -0
- package/script/src/types/info/assets.d.ts +275 -0
- package/script/src/types/info/assets.d.ts.map +1 -0
- package/script/src/types/info/assets.js +12 -0
- package/script/src/types/info/delegations.d.ts +117 -0
- package/script/src/types/info/delegations.d.ts.map +1 -0
- package/script/src/types/info/delegations.js +12 -0
- package/script/src/types/info/orders.d.ts +209 -0
- package/script/src/types/info/orders.d.ts.map +1 -0
- package/script/src/types/info/orders.js +12 -0
- package/script/src/types/info/requests.d.ts +445 -0
- package/script/src/types/info/requests.d.ts.map +1 -0
- package/script/src/types/info/requests.js +12 -0
- package/script/src/types/info/vaults.d.ts +90 -0
- package/script/src/types/info/vaults.d.ts.map +1 -0
- package/script/src/types/info/vaults.js +12 -0
- package/script/src/types/subscriptions/common.d.ts +208 -0
- package/script/src/types/subscriptions/common.d.ts.map +1 -0
- package/script/src/types/subscriptions/common.js +12 -0
- package/script/src/types/subscriptions/requests.d.ts +134 -0
- package/script/src/types/subscriptions/requests.d.ts.map +1 -0
- package/script/src/types/subscriptions/requests.js +12 -0
- package/script/src/utils/key_sort.d.ts +3 -3
- package/script/src/utils/key_sort.d.ts.map +1 -1
- package/script/src/utils/key_sort.js +133 -123
- package/script/src/utils/signing.d.ts +1 -1
- package/script/src/utils/signing.js +172 -162
- package/esm/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/bytes/1.0.4/concat.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/bytes/1.0.4/concat.js +0 -35
- package/script/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +0 -29
- package/script/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/encoding/1.0.6/hex.js +0 -113
- package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/msgpack/1.0.2/encode.js +0 -240
- /package/esm/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
- /package/script/deps/jsr.io/@std/encoding/{1.0.6 → 1.0.7}/_validate_binary_like.d.ts +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import type { Hex } from "../common.js";
|
|
2
|
+
/** Mapping of coin symbols to mid prices. */
|
|
3
|
+
export interface AllMids {
|
|
4
|
+
/** Mid prices mapped by coin symbol. */
|
|
5
|
+
[coin: string]: string;
|
|
6
|
+
}
|
|
7
|
+
/** Context for a perpetual asset. */
|
|
8
|
+
export interface PerpsAssetCtx extends SharedAssetCtx {
|
|
9
|
+
/** Funding rate. */
|
|
10
|
+
funding: string;
|
|
11
|
+
/** Total open interest. */
|
|
12
|
+
openInterest: string;
|
|
13
|
+
/** Premium price. */
|
|
14
|
+
premium: string | null;
|
|
15
|
+
/** Oracle price. */
|
|
16
|
+
oraclePx: string;
|
|
17
|
+
/** Array of impact prices. */
|
|
18
|
+
impactPxs: string[] | null;
|
|
19
|
+
/** Daily volume in base currency. */
|
|
20
|
+
dayBaseVlm: string;
|
|
21
|
+
}
|
|
22
|
+
/** Shared context for assets. */
|
|
23
|
+
export interface SharedAssetCtx {
|
|
24
|
+
/** Previous day's closing price. */
|
|
25
|
+
prevDayPx: string;
|
|
26
|
+
/** Daily notional volume. */
|
|
27
|
+
dayNtlVlm: string;
|
|
28
|
+
/** Mark price. */
|
|
29
|
+
markPx: string;
|
|
30
|
+
/** Mid price. */
|
|
31
|
+
midPx: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** Context for a spot asset. */
|
|
34
|
+
export interface SpotAssetCtx extends SharedAssetCtx {
|
|
35
|
+
/** Circulating supply. */
|
|
36
|
+
circulatingSupply: string;
|
|
37
|
+
/** Asset symbol. */
|
|
38
|
+
coin: string;
|
|
39
|
+
/** Total supply. */
|
|
40
|
+
totalSupply: string;
|
|
41
|
+
/** Daily volume in base currency. */
|
|
42
|
+
dayBaseVlm: string;
|
|
43
|
+
}
|
|
44
|
+
/** Metadata for perpetual assets. */
|
|
45
|
+
export interface PerpsMeta {
|
|
46
|
+
/** Trading universes available for perpetual trading. */
|
|
47
|
+
universe: PerpsUniverse[];
|
|
48
|
+
}
|
|
49
|
+
/** Metadata for spot assets. */
|
|
50
|
+
export interface SpotMeta {
|
|
51
|
+
/** Trading universes available for spot trading. */
|
|
52
|
+
universe: SpotUniverse[];
|
|
53
|
+
/** Tokens available for spot trading. */
|
|
54
|
+
tokens: SpotToken[];
|
|
55
|
+
}
|
|
56
|
+
/** Trading universe parameters for perpetual assets. */
|
|
57
|
+
export interface PerpsUniverse {
|
|
58
|
+
/** Minimum decimal places for order sizes. */
|
|
59
|
+
szDecimals: number;
|
|
60
|
+
/**
|
|
61
|
+
* Name of the universe.
|
|
62
|
+
*
|
|
63
|
+
* Note: Maximum length 6 characters. No uniqueness constraints.
|
|
64
|
+
*/
|
|
65
|
+
name: string;
|
|
66
|
+
/** Maximum allowed leverage. */
|
|
67
|
+
maxLeverage: number;
|
|
68
|
+
/** Indicates if only isolated margin trading is allowed. */
|
|
69
|
+
onlyIsolated?: true;
|
|
70
|
+
/** Indicates if the universe is delisted. */
|
|
71
|
+
isDelisted?: true;
|
|
72
|
+
}
|
|
73
|
+
/** Trading universe parameters for spot assets. */
|
|
74
|
+
export interface SpotUniverse {
|
|
75
|
+
/** Token indices included in this universe. */
|
|
76
|
+
tokens: number[];
|
|
77
|
+
/**
|
|
78
|
+
* Name of the universe.
|
|
79
|
+
*
|
|
80
|
+
* Note: Maximum length 6 characters. No uniqueness constraints.
|
|
81
|
+
*/
|
|
82
|
+
name: string;
|
|
83
|
+
/** Unique identifier of the universe. */
|
|
84
|
+
index: number;
|
|
85
|
+
/** Indicates if the token is the primary representation in the system. */
|
|
86
|
+
isCanonical: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Details for a trading token in spot markets. */
|
|
89
|
+
export interface SpotToken {
|
|
90
|
+
/**
|
|
91
|
+
* Name of the token.
|
|
92
|
+
*
|
|
93
|
+
* Note: Maximum length 6 characters. No uniqueness constraints.
|
|
94
|
+
*/
|
|
95
|
+
name: string;
|
|
96
|
+
/** Minimum decimal places for order sizes. */
|
|
97
|
+
szDecimals: number;
|
|
98
|
+
/** Number of decimals for the token's smallest unit. */
|
|
99
|
+
weiDecimals: number;
|
|
100
|
+
/** Unique identifier for the token. */
|
|
101
|
+
index: number;
|
|
102
|
+
/** Token ID. */
|
|
103
|
+
tokenId: Hex;
|
|
104
|
+
/** Indicates if the token is the primary representation in the system. */
|
|
105
|
+
isCanonical: boolean;
|
|
106
|
+
/** EVM contract details. */
|
|
107
|
+
evmContract: {
|
|
108
|
+
/** Contract address. */
|
|
109
|
+
address: Hex;
|
|
110
|
+
/** Extra decimals in the token's smallest unit. */
|
|
111
|
+
evm_extra_wei_decimals: number;
|
|
112
|
+
} | null;
|
|
113
|
+
/** Full display name of the token. */
|
|
114
|
+
fullName: string | null;
|
|
115
|
+
/** Deployer trading fee share for the token. */
|
|
116
|
+
deployerTradingFeeShare: string;
|
|
117
|
+
}
|
|
118
|
+
/** Details of a token. */
|
|
119
|
+
export interface TokenDetails {
|
|
120
|
+
/** Name of the token. */
|
|
121
|
+
name: string;
|
|
122
|
+
/** Maximum supply of the token. */
|
|
123
|
+
maxSupply: string;
|
|
124
|
+
/** Total supply of the token. */
|
|
125
|
+
totalSupply: string;
|
|
126
|
+
/** Circulating supply of the token. */
|
|
127
|
+
circulatingSupply: string;
|
|
128
|
+
/** Decimal places for the minimum tradable unit. */
|
|
129
|
+
szDecimals: number;
|
|
130
|
+
/** Decimal places for the token's smallest unit. */
|
|
131
|
+
weiDecimals: number;
|
|
132
|
+
/** Mid price of the token. */
|
|
133
|
+
midPx: string;
|
|
134
|
+
/** Mark price of the token. */
|
|
135
|
+
markPx: string;
|
|
136
|
+
/** Previous day's price of the token. */
|
|
137
|
+
prevDayPx: string;
|
|
138
|
+
/** Genesis data for the token. */
|
|
139
|
+
genesis: {
|
|
140
|
+
/** User balances. */
|
|
141
|
+
userBalances: [Hex, string][];
|
|
142
|
+
/** Existing token balances. */
|
|
143
|
+
existingTokenBalances: [number, string][];
|
|
144
|
+
/** Blacklisted users. */
|
|
145
|
+
blacklistUsers: Hex[];
|
|
146
|
+
} | null;
|
|
147
|
+
/** Deployer address. */
|
|
148
|
+
deployer: Hex | null;
|
|
149
|
+
/** Gas used during token deployment. */
|
|
150
|
+
deployGas: string | null;
|
|
151
|
+
/** Deployment time. */
|
|
152
|
+
deployTime: string | null;
|
|
153
|
+
/** Seeded USDC amount for the token. */
|
|
154
|
+
seededUsdc: string;
|
|
155
|
+
/** Non-circulating user balances of the token. */
|
|
156
|
+
nonCirculatingUserBalances: [Hex, string][];
|
|
157
|
+
/** Future emissions amount. */
|
|
158
|
+
futureEmissions: string;
|
|
159
|
+
}
|
|
160
|
+
/** Metadata and context for perpetual assets. */
|
|
161
|
+
export type PerpsMetaAndAssetCtxs = [
|
|
162
|
+
/** Metadata for assets. */
|
|
163
|
+
PerpsMeta,
|
|
164
|
+
/** Context for each perpetual asset. */
|
|
165
|
+
PerpsAssetCtx[]
|
|
166
|
+
];
|
|
167
|
+
/** Metadata and context for spot assets. */
|
|
168
|
+
export type SpotMetaAndAssetCtxs = [
|
|
169
|
+
/** Metadata for assets. */
|
|
170
|
+
SpotMeta,
|
|
171
|
+
/** Context for each spot asset. */
|
|
172
|
+
SpotAssetCtx[]
|
|
173
|
+
];
|
|
174
|
+
/** Candlestick data point. */
|
|
175
|
+
export interface Candle {
|
|
176
|
+
/** Opening timestamp (ms since epoch). */
|
|
177
|
+
t: number;
|
|
178
|
+
/** Closing timestamp (ms since epoch). */
|
|
179
|
+
T: number;
|
|
180
|
+
/** Asset symbol. */
|
|
181
|
+
s: string;
|
|
182
|
+
/** Candle interval (e.g., "1m", "5m", "1h", etc.). */
|
|
183
|
+
i: string;
|
|
184
|
+
/** Opening price. */
|
|
185
|
+
o: string;
|
|
186
|
+
/** Closing price. */
|
|
187
|
+
c: string;
|
|
188
|
+
/** Highest price. */
|
|
189
|
+
h: string;
|
|
190
|
+
/** Lowest price. */
|
|
191
|
+
l: string;
|
|
192
|
+
/** Total volume traded in base currency. */
|
|
193
|
+
v: string;
|
|
194
|
+
/** Number of trades executed. */
|
|
195
|
+
n: number;
|
|
196
|
+
}
|
|
197
|
+
/** Historical funding rate record for an asset. */
|
|
198
|
+
export interface FundingHistory {
|
|
199
|
+
/** Asset symbol. */
|
|
200
|
+
coin: string;
|
|
201
|
+
/** Funding rate. */
|
|
202
|
+
fundingRate: string;
|
|
203
|
+
/** Premium price. */
|
|
204
|
+
premium: string;
|
|
205
|
+
/** Funding record timestamp (ms since epoch). */
|
|
206
|
+
time: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Predicted funding data.
|
|
210
|
+
*
|
|
211
|
+
* The first element is the asset symbol and the second element is an array of predicted funding data for each exchange.
|
|
212
|
+
*/
|
|
213
|
+
export type PredictedFunding = [
|
|
214
|
+
/** Asset symbol. */
|
|
215
|
+
string,
|
|
216
|
+
/** Array of predicted funding data for each exchange. */
|
|
217
|
+
[
|
|
218
|
+
/** Exchange symbol. */
|
|
219
|
+
string,
|
|
220
|
+
/** Predicted funding data. */
|
|
221
|
+
{
|
|
222
|
+
/** Predicted funding rate. */
|
|
223
|
+
fundingRate: string;
|
|
224
|
+
/** Next funding time (ms since epoch). */
|
|
225
|
+
nextFundingTime: number;
|
|
226
|
+
} | null
|
|
227
|
+
][]
|
|
228
|
+
];
|
|
229
|
+
/** Deploy state for spot tokens. */
|
|
230
|
+
export interface SpotDeployState {
|
|
231
|
+
/** Array of deploy states for tokens. */
|
|
232
|
+
states: {
|
|
233
|
+
/** Token ID. */
|
|
234
|
+
token: number;
|
|
235
|
+
/** Token specification. */
|
|
236
|
+
spec: {
|
|
237
|
+
/** Name of the token. */
|
|
238
|
+
name: string;
|
|
239
|
+
/** Minimum decimal places for order sizes. */
|
|
240
|
+
szDecimals: number;
|
|
241
|
+
/** Number of decimals for the token's smallest unit. */
|
|
242
|
+
weiDecimals: number;
|
|
243
|
+
};
|
|
244
|
+
/** Full name of the token. */
|
|
245
|
+
fullName: string | null;
|
|
246
|
+
/** Deployer trading fee share for the token. */
|
|
247
|
+
deployerTradingFeeShare: string;
|
|
248
|
+
/** Spot indices for the token. */
|
|
249
|
+
spots: number[];
|
|
250
|
+
/** Maximum supply of the token. */
|
|
251
|
+
maxSupply: string | null;
|
|
252
|
+
/** Hyperliquidity genesis balance of the token. */
|
|
253
|
+
hyperliquidityGenesisBalance: string;
|
|
254
|
+
/** Total genesis balance (in Wei) for the token. */
|
|
255
|
+
totalGenesisBalanceWei: string;
|
|
256
|
+
/** User genesis balances for the token. */
|
|
257
|
+
userGenesisBalances: [Hex, string][];
|
|
258
|
+
/** Existing token genesis balances for the token. */
|
|
259
|
+
existingTokenGenesisBalances: [number, string][];
|
|
260
|
+
}[];
|
|
261
|
+
/** Gas auction details. */
|
|
262
|
+
gasAuction: {
|
|
263
|
+
/** Current gas. */
|
|
264
|
+
currentGas: string | null;
|
|
265
|
+
/** Duration in seconds. */
|
|
266
|
+
durationSeconds: number;
|
|
267
|
+
/** Ending gas. */
|
|
268
|
+
endGas: string | null;
|
|
269
|
+
/** Starting gas. */
|
|
270
|
+
startGas: string;
|
|
271
|
+
/** Auction start time (seconds since epoch). */
|
|
272
|
+
startTimeSeconds: number;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../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,MAAM,GAAG,IAAI,CAAC;QACxB,gDAAgD;QAChD,uBAAuB,EAAE,MAAM,CAAC;QAChC,kCAAkC;QAClC,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,mCAAmC;QACnC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,mDAAmD;QACnD,4BAA4B,EAAE,MAAM,CAAC;QACrC,oDAAoD;QACpD,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2CAA2C;QAC3C,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC;QACrC,qDAAqD;QACrD,4BAA4B,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;KACpD,EAAE,CAAC;IACJ,2BAA2B;IAC3B,UAAU,EAAE;QACR,mBAAmB;QACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,2BAA2B;QAC3B,eAAe,EAAE,MAAM,CAAC;QACxB,kBAAkB;QAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,oBAAoB;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,gDAAgD;QAChD,gBAAgB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { Hex } from "../common.js";
|
|
2
|
+
/** User delegation to a validator. */
|
|
3
|
+
export interface Delegation {
|
|
4
|
+
/** Validator address. */
|
|
5
|
+
validator: Hex;
|
|
6
|
+
/** Amount of tokens delegated to the validator. */
|
|
7
|
+
amount: string;
|
|
8
|
+
/** Locked until timestamp (in ms since epoch). */
|
|
9
|
+
lockedUntilTimestamp: number;
|
|
10
|
+
}
|
|
11
|
+
/** Reward received from staking activities. */
|
|
12
|
+
export interface DelegatorReward {
|
|
13
|
+
/** Timestamp when the reward was received (in ms since epoch). */
|
|
14
|
+
time: number;
|
|
15
|
+
/** Source of the reward. */
|
|
16
|
+
source: "delegation" | "commission";
|
|
17
|
+
/** Total reward amount. */
|
|
18
|
+
totalAmount: string;
|
|
19
|
+
}
|
|
20
|
+
/** Record of a staking event by a delegator. */
|
|
21
|
+
export interface DelegatorUpdate {
|
|
22
|
+
/** Timestamp of the delegation event (in ms since epoch). */
|
|
23
|
+
time: number;
|
|
24
|
+
/** Transaction hash of the delegation event. */
|
|
25
|
+
hash: Hex;
|
|
26
|
+
/** Details of the update. */
|
|
27
|
+
delta: DelegatorUpdateDelegate | DelegatorUpdateDeposit | DelegatorUpdateWithdrawal;
|
|
28
|
+
}
|
|
29
|
+
/** Delegation operation in a delegator update. */
|
|
30
|
+
export interface DelegatorUpdateDelegate {
|
|
31
|
+
/** Delegation operation details. */
|
|
32
|
+
delegate: {
|
|
33
|
+
/** Address of the validator receiving or losing delegation. */
|
|
34
|
+
validator: Hex;
|
|
35
|
+
/** Amount of tokens being delegated or undelegated. */
|
|
36
|
+
amount: string;
|
|
37
|
+
/** Whether this is an undelegation operation. */
|
|
38
|
+
isUndelegate: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Deposit operation in a delegator update. */
|
|
42
|
+
export interface DelegatorUpdateDeposit {
|
|
43
|
+
/** Deposit details. */
|
|
44
|
+
cDeposit: {
|
|
45
|
+
/** Amount of tokens being deposited. */
|
|
46
|
+
amount: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Withdrawal operation in a delegator update. */
|
|
50
|
+
export interface DelegatorUpdateWithdrawal {
|
|
51
|
+
/** Withdrawal details. */
|
|
52
|
+
withdrawal: {
|
|
53
|
+
/** Amount of tokens being withdrawn. */
|
|
54
|
+
amount: string;
|
|
55
|
+
/** Phase of the withdrawal process. */
|
|
56
|
+
phase: "initiated" | "finalized";
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Summary of a user's staking. */
|
|
60
|
+
export interface DelegatorSummary {
|
|
61
|
+
/** Total amount of delegated tokens. */
|
|
62
|
+
delegated: string;
|
|
63
|
+
/** Total amount of undelegated tokens. */
|
|
64
|
+
undelegated: string;
|
|
65
|
+
/** Total amount of tokens pending withdrawal. */
|
|
66
|
+
totalPendingWithdrawal: string;
|
|
67
|
+
/** Number of pending withdrawals. */
|
|
68
|
+
nPendingWithdrawals: number;
|
|
69
|
+
}
|
|
70
|
+
/** Summary of a validator's status and performance. */
|
|
71
|
+
export interface ValidatorSummary {
|
|
72
|
+
/** Address of the validator. */
|
|
73
|
+
validator: Hex;
|
|
74
|
+
/** Address of the validator's signer. */
|
|
75
|
+
signer: Hex;
|
|
76
|
+
/** Name of the validator. */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Description of the validator. */
|
|
79
|
+
description: string;
|
|
80
|
+
/** Number of blocks produced recently. */
|
|
81
|
+
nRecentBlocks: number;
|
|
82
|
+
/** Total amount of tokens staked. */
|
|
83
|
+
stake: number;
|
|
84
|
+
/** Whether the validator is currently jailed. */
|
|
85
|
+
isJailed: boolean;
|
|
86
|
+
/** Timestamp when the validator can be unjailed (in ms since epoch). */
|
|
87
|
+
unjailableAfter: number | null;
|
|
88
|
+
/** Whether the validator is currently active. */
|
|
89
|
+
isActive: boolean;
|
|
90
|
+
/** Commission rate charged by the validator. */
|
|
91
|
+
commission: string;
|
|
92
|
+
/** Performance statistics over different time periods. */
|
|
93
|
+
stats: [
|
|
94
|
+
[
|
|
95
|
+
"day",
|
|
96
|
+
ValidatorStats
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
"week",
|
|
100
|
+
ValidatorStats
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
"month",
|
|
104
|
+
ValidatorStats
|
|
105
|
+
]
|
|
106
|
+
];
|
|
107
|
+
}
|
|
108
|
+
/** Statistics for validator performance over a time period. */
|
|
109
|
+
export interface ValidatorStats {
|
|
110
|
+
/** Fraction of time the validator was online. */
|
|
111
|
+
uptimeFraction: string;
|
|
112
|
+
/** Predicted annual percentage rate of returns. */
|
|
113
|
+
predictedApr: string;
|
|
114
|
+
/** Number of samples used for statistics calculation. */
|
|
115
|
+
nSamples: number;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=delegations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegations.d.ts","sourceRoot":"","sources":["../../../../src/src/types/info/delegations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,sCAAsC;AACtC,MAAM,WAAW,UAAU;IACvB,yBAAyB;IACzB,SAAS,EAAE,GAAG,CAAC;IACf,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC5B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,MAAM,EAAE,YAAY,GAAG,YAAY,CAAC;IACpC,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC5B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,IAAI,EAAE,GAAG,CAAC;IACV,6BAA6B;IAC7B,KAAK,EAAE,uBAAuB,GAAG,sBAAsB,GAAG,yBAAyB,CAAC;CACvF;AAED,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACpC,oCAAoC;IACpC,QAAQ,EAAE;QACN,+DAA+D;QAC/D,SAAS,EAAE,GAAG,CAAC;QACf,uDAAuD;QACvD,MAAM,EAAE,MAAM,CAAC;QACf,iDAAiD;QACjD,YAAY,EAAE,OAAO,CAAC;KACzB,CAAC;CACL;AAED,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB;IACnC,uBAAuB;IACvB,QAAQ,EAAE;QACN,wCAAwC;QACxC,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL;AAED,kDAAkD;AA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M,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import type { Hex } from "../common.js";
|
|
2
|
+
/**
|
|
3
|
+
* Order types for market execution.
|
|
4
|
+
* - Market: Executes immediately at the market price.
|
|
5
|
+
* - Limit: Executes at the specified limit price or better.
|
|
6
|
+
* - Stop Market: Activates as a market order when a stop price is reached.
|
|
7
|
+
* - Stop Limit: Activates as a limit order when a stop price is reached.
|
|
8
|
+
*
|
|
9
|
+
* @see https://hyperliquid.gitbook.io/hyperliquid-docs/trading/order-types
|
|
10
|
+
*/
|
|
11
|
+
export type OrderType = "Market" | "Limit" | "Stop Market" | "Stop Limit";
|
|
12
|
+
/**
|
|
13
|
+
* Time-in-force options.
|
|
14
|
+
* - Gtc: Remains active until filled or canceled.
|
|
15
|
+
* - Ioc: Fills immediately or cancels any unfilled portion.
|
|
16
|
+
* - Alo: Adds liquidity only.
|
|
17
|
+
* - FrontendMarket: Similar to Ioc, used in Hyperliquid UI.
|
|
18
|
+
* - LiquidationMarket: Similar to Ioc, used in Hyperliquid UI.
|
|
19
|
+
*/
|
|
20
|
+
export type TIF = "Gtc" | "Ioc" | "Alo" | "FrontendMarket" | "LiquidationMarket";
|
|
21
|
+
/**
|
|
22
|
+
* TWAP order status.
|
|
23
|
+
* - finished: Fully executed.
|
|
24
|
+
* - activated: Active and executing.
|
|
25
|
+
* - terminated: Terminated.
|
|
26
|
+
* - error: An error occurred.
|
|
27
|
+
*/
|
|
28
|
+
export type TwapStatus = {
|
|
29
|
+
/** Status of the TWAP order. */
|
|
30
|
+
status: "finished" | "activated" | "terminated";
|
|
31
|
+
} | {
|
|
32
|
+
/** Status of the TWAP order. */
|
|
33
|
+
status: "error";
|
|
34
|
+
/** Error message. */
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Order processing status.
|
|
39
|
+
* - filled: Order fully executed.
|
|
40
|
+
* - open: Order active and waiting to be filled.
|
|
41
|
+
* - canceled: Order canceled by the user.
|
|
42
|
+
* - triggered: Order triggered and awaiting execution.
|
|
43
|
+
* - rejected: Order rejected by the system.
|
|
44
|
+
* - marginCanceled: Order canceled due to insufficient margin.
|
|
45
|
+
*/
|
|
46
|
+
export type OrderProcessingStatus = "filled" | "open" | "canceled" | "triggered" | "rejected" | "marginCanceled";
|
|
47
|
+
/** L2 order book snapshot. */
|
|
48
|
+
export interface Book {
|
|
49
|
+
/** Asset symbol. */
|
|
50
|
+
coin: string;
|
|
51
|
+
/** Timestamp of the snapshot (in ms since epoch). */
|
|
52
|
+
time: number;
|
|
53
|
+
/** Bid and ask levels (index 0 = bids, index 1 = asks). */
|
|
54
|
+
levels: [BookLevel[], BookLevel[]];
|
|
55
|
+
}
|
|
56
|
+
/** Order book level. */
|
|
57
|
+
export interface BookLevel {
|
|
58
|
+
/** Price. */
|
|
59
|
+
px: string;
|
|
60
|
+
/** Total size. */
|
|
61
|
+
sz: string;
|
|
62
|
+
/** Number of individual orders. */
|
|
63
|
+
n: number;
|
|
64
|
+
}
|
|
65
|
+
/** Trade fill record. */
|
|
66
|
+
export interface Fill {
|
|
67
|
+
/** Asset symbol. */
|
|
68
|
+
coin: string;
|
|
69
|
+
/** Price. */
|
|
70
|
+
px: string;
|
|
71
|
+
/** Size. */
|
|
72
|
+
sz: string;
|
|
73
|
+
/** Order side ("B" = Bid/Buy, "A" = Ask/Sell). */
|
|
74
|
+
side: "B" | "A";
|
|
75
|
+
/** Timestamp when the trade occurred (in ms since epoch). */
|
|
76
|
+
time: number;
|
|
77
|
+
/** Start position size. */
|
|
78
|
+
startPosition: string;
|
|
79
|
+
/** Direction indicator for frontend display. */
|
|
80
|
+
dir: string;
|
|
81
|
+
/** Realized PnL. */
|
|
82
|
+
closedPnl: string;
|
|
83
|
+
/** L1 transaction hash. */
|
|
84
|
+
hash: Hex;
|
|
85
|
+
/** Order ID. */
|
|
86
|
+
oid: number;
|
|
87
|
+
/** Indicates if the fill was a taker order. */
|
|
88
|
+
crossed: boolean;
|
|
89
|
+
/** Fee charged or rebate received (negative indicates rebate). */
|
|
90
|
+
fee: string;
|
|
91
|
+
/** Unique transaction identifier for a partial fill of an order. */
|
|
92
|
+
tid: number;
|
|
93
|
+
/** Client Order ID. */
|
|
94
|
+
cloid?: Hex;
|
|
95
|
+
/** Liquidation details. */
|
|
96
|
+
liquidation?: FillLiquidation;
|
|
97
|
+
/** Token in which the fee is denominated (e.g., "USDC"). */
|
|
98
|
+
feeToken: string;
|
|
99
|
+
}
|
|
100
|
+
/** Liquidation details for a trade fill. */
|
|
101
|
+
export interface FillLiquidation {
|
|
102
|
+
/** Address of the liquidated user. */
|
|
103
|
+
liquidatedUser: Hex;
|
|
104
|
+
/** Mark price at the time of liquidation. */
|
|
105
|
+
markPx: string;
|
|
106
|
+
/** Liquidation method. */
|
|
107
|
+
method: "market" | "backstop";
|
|
108
|
+
}
|
|
109
|
+
/** Frontend order with additional display information. */
|
|
110
|
+
export interface FrontendOrder extends Omit<Order, "reduceOnly" | "cloid"> {
|
|
111
|
+
/** Condition for triggering the order. */
|
|
112
|
+
triggerCondition: string;
|
|
113
|
+
/** Indicates if the order is a trigger order. */
|
|
114
|
+
isTrigger: boolean;
|
|
115
|
+
/** Trigger price. */
|
|
116
|
+
triggerPx: string;
|
|
117
|
+
/** Child orders associated with this order. */
|
|
118
|
+
children: FrontendOrder[];
|
|
119
|
+
/** Indicates if the order is a position TP/SL order. */
|
|
120
|
+
isPositionTpsl: boolean;
|
|
121
|
+
/** Indicates whether the order is reduce-only. */
|
|
122
|
+
reduceOnly: boolean;
|
|
123
|
+
/** Order type. */
|
|
124
|
+
orderType: OrderType;
|
|
125
|
+
/** Time-in-force option. */
|
|
126
|
+
tif: TIF | null;
|
|
127
|
+
/** Client Order ID. */
|
|
128
|
+
cloid: Hex | null;
|
|
129
|
+
}
|
|
130
|
+
/** Open order details. */
|
|
131
|
+
export interface Order {
|
|
132
|
+
/** Asset symbol. */
|
|
133
|
+
coin: string;
|
|
134
|
+
/** Order side ("B" = Bid/Buy, "A" = Ask/Sell). */
|
|
135
|
+
side: "B" | "A";
|
|
136
|
+
/** Limit price. */
|
|
137
|
+
limitPx: string;
|
|
138
|
+
/** Size. */
|
|
139
|
+
sz: string;
|
|
140
|
+
/** Order ID. */
|
|
141
|
+
oid: number;
|
|
142
|
+
/** Timestamp when the order was placed (in ms since epoch). */
|
|
143
|
+
timestamp: number;
|
|
144
|
+
/** Original size at order placement. */
|
|
145
|
+
origSz: string;
|
|
146
|
+
/** Client Order ID. */
|
|
147
|
+
cloid?: Hex;
|
|
148
|
+
/** Indicates if the order is reduce-only. */
|
|
149
|
+
reduceOnly?: true;
|
|
150
|
+
}
|
|
151
|
+
/** Order status with additional frontend information and current state. */
|
|
152
|
+
export interface OrderStatus<O extends Order | FrontendOrder> {
|
|
153
|
+
/** Order details. */
|
|
154
|
+
order: O;
|
|
155
|
+
/** Order processing status. */
|
|
156
|
+
status: OrderProcessingStatus;
|
|
157
|
+
/** Timestamp when the status was last updated (in ms since epoch). */
|
|
158
|
+
statusTimestamp: number;
|
|
159
|
+
}
|
|
160
|
+
/** Result of an order status lookup. */
|
|
161
|
+
export type OrderLookup = {
|
|
162
|
+
/** Indicates that the order was found. */
|
|
163
|
+
status: "order";
|
|
164
|
+
/** Order details. */
|
|
165
|
+
order: OrderStatus<FrontendOrder>;
|
|
166
|
+
} | {
|
|
167
|
+
/** Indicates that the order was not found. */
|
|
168
|
+
status: "unknownOid";
|
|
169
|
+
};
|
|
170
|
+
/** TWAP history record for a user. */
|
|
171
|
+
export interface TwapHistory {
|
|
172
|
+
/** Creation time of the history record (in seconds since epoch). */
|
|
173
|
+
time: number;
|
|
174
|
+
/** State of the TWAP order. */
|
|
175
|
+
state: TwapState;
|
|
176
|
+
/** Current status of the TWAP order. */
|
|
177
|
+
status: TwapStatus;
|
|
178
|
+
}
|
|
179
|
+
/** TWAP slice fill details. */
|
|
180
|
+
export interface TwapSliceFill {
|
|
181
|
+
/** Fill details for the TWAP slice. */
|
|
182
|
+
fill: Omit<Fill, "cloid" | "liquidation">;
|
|
183
|
+
/** ID of the TWAP. */
|
|
184
|
+
twapId: number;
|
|
185
|
+
}
|
|
186
|
+
/** Current state of a TWAP order. */
|
|
187
|
+
export interface TwapState {
|
|
188
|
+
/** Asset symbol. */
|
|
189
|
+
coin: string;
|
|
190
|
+
/** Executed notional value. */
|
|
191
|
+
executedNtl: string;
|
|
192
|
+
/** Executed size. */
|
|
193
|
+
executedSz: string;
|
|
194
|
+
/** Duration in minutes. */
|
|
195
|
+
minutes: number;
|
|
196
|
+
/** Indicates if the TWAP randomizes execution. */
|
|
197
|
+
randomize: boolean;
|
|
198
|
+
/** Indicates if the order is reduce-only. */
|
|
199
|
+
reduceOnly: boolean;
|
|
200
|
+
/** Order side ("B" = Bid/Buy, "A" = Ask/Sell). */
|
|
201
|
+
side: "B" | "A";
|
|
202
|
+
/** Order size. */
|
|
203
|
+
sz: string;
|
|
204
|
+
/** Start time of the TWAP order (in ms since epoch). */
|
|
205
|
+
timestamp: number;
|
|
206
|
+
/** User address. */
|
|
207
|
+
user: Hex;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=orders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.d.ts","sourceRoot":"","sources":["../../../../src/src/types/info/orders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,YAAY,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEjF;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAChB;IACE,gCAAgC;IAChC,MAAM,EAAE,UAAU,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