@nktkas/hyperliquid 0.17.1 → 0.17.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 +42 -4
- package/esm/deps/jsr.io/@std/encoding/1.0.9/_common16.d.ts +23 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.9/_common16.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.9/_common16.js +51 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.9/_common_detach.d.ts +4 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.9/_common_detach.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.9/_common_detach.js +13 -0
- package/{script/deps/jsr.io/@std/encoding/1.0.7 → esm/deps/jsr.io/@std/encoding/1.0.9}/_types.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.9/hex.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.9/hex.js +87 -0
- package/esm/src/clients/event.d.ts +25 -2
- package/esm/src/clients/event.d.ts.map +1 -1
- package/esm/src/clients/event.js +31 -0
- package/esm/src/clients/public.d.ts +86 -86
- package/esm/src/clients/public.d.ts.map +1 -1
- package/esm/src/clients/public.js +111 -111
- package/esm/src/clients/wallet.d.ts +36 -13
- package/esm/src/clients/wallet.d.ts.map +1 -1
- package/esm/src/clients/wallet.js +53 -12
- package/esm/src/signing.js +1 -1
- package/esm/src/transports/http/http_transport.d.ts.map +1 -1
- package/esm/src/transports/http/http_transport.js +8 -2
- package/esm/src/types/exchange/requests.d.ts +36 -22
- package/esm/src/types/exchange/requests.d.ts.map +1 -1
- package/esm/src/types/explorer/requests.d.ts +3 -3
- package/esm/src/types/info/accounts.d.ts +14 -1
- package/esm/src/types/info/accounts.d.ts.map +1 -1
- package/esm/src/types/info/orders.d.ts +3 -1
- package/esm/src/types/info/orders.d.ts.map +1 -1
- package/esm/src/types/info/requests.d.ts +2 -2
- package/esm/src/types/info/vaults.d.ts +22 -17
- package/esm/src/types/info/vaults.d.ts.map +1 -1
- package/esm/src/types/subscriptions/requests.d.ts +29 -22
- package/esm/src/types/subscriptions/requests.d.ts.map +1 -1
- package/esm/src/types/subscriptions/responses.d.ts +48 -48
- package/esm/src/types/subscriptions/responses.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/deps/jsr.io/@std/encoding/1.0.9/_common16.d.ts +23 -0
- package/script/deps/jsr.io/@std/encoding/1.0.9/_common16.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.9/_common16.js +67 -0
- package/script/deps/jsr.io/@std/encoding/1.0.9/_common_detach.d.ts +4 -0
- package/script/deps/jsr.io/@std/encoding/1.0.9/_common_detach.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/1.0.9/_common_detach.js +26 -0
- package/{esm/deps/jsr.io/@std/encoding/1.0.7 → script/deps/jsr.io/@std/encoding/1.0.9}/_types.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/encoding/1.0.9/hex.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/hex.js +23 -45
- package/script/src/clients/event.d.ts +25 -2
- package/script/src/clients/event.d.ts.map +1 -1
- package/script/src/clients/event.js +31 -0
- package/script/src/clients/public.d.ts +86 -86
- package/script/src/clients/public.d.ts.map +1 -1
- package/script/src/clients/public.js +111 -111
- package/script/src/clients/wallet.d.ts +36 -13
- package/script/src/clients/wallet.d.ts.map +1 -1
- package/script/src/clients/wallet.js +53 -12
- package/script/src/signing.js +2 -2
- package/script/src/transports/http/http_transport.d.ts.map +1 -1
- package/script/src/transports/http/http_transport.js +8 -2
- package/script/src/types/exchange/requests.d.ts +36 -22
- package/script/src/types/exchange/requests.d.ts.map +1 -1
- package/script/src/types/explorer/requests.d.ts +3 -3
- package/script/src/types/info/accounts.d.ts +14 -1
- package/script/src/types/info/accounts.d.ts.map +1 -1
- package/script/src/types/info/orders.d.ts +3 -1
- package/script/src/types/info/orders.d.ts.map +1 -1
- package/script/src/types/info/requests.d.ts +2 -2
- package/script/src/types/info/vaults.d.ts +22 -17
- package/script/src/types/info/vaults.d.ts.map +1 -1
- package/script/src/types/subscriptions/requests.d.ts +29 -22
- package/script/src/types/subscriptions/requests.d.ts.map +1 -1
- package/script/src/types/subscriptions/responses.d.ts +48 -48
- package/script/src/types/subscriptions/responses.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.d.ts +0 -2
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +0 -26
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.js +0 -109
- package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.d.ts +0 -2
- package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +0 -39
- package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/_types.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/_types.js +0 -0
- /package/esm/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/hex.d.ts +0 -0
- /package/script/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/_types.d.ts +0 -0
- /package/script/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/_types.js +0 -0
- /package/script/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.9}/hex.d.ts +0 -0
|
@@ -14,29 +14,17 @@ export interface VaultDetails {
|
|
|
14
14
|
portfolio: PortfolioPeriods;
|
|
15
15
|
/** Annual percentage rate. */
|
|
16
16
|
apr: number;
|
|
17
|
-
/**
|
|
18
|
-
followerState:
|
|
17
|
+
/** Current user's follower state */
|
|
18
|
+
followerState: VaultFollowerState | null;
|
|
19
19
|
/** Ownership percentage held by leader. */
|
|
20
20
|
leaderFraction: number;
|
|
21
21
|
/** Leader's commission percentage. */
|
|
22
22
|
leaderCommission: number;
|
|
23
23
|
/** Vault followers list. */
|
|
24
|
-
followers: {
|
|
25
|
-
/** Follower address or
|
|
24
|
+
followers: (Omit<VaultFollowerState, "user"> & {
|
|
25
|
+
/** Follower's address or Leader. */
|
|
26
26
|
user: Hex | "Leader";
|
|
27
|
-
|
|
28
|
-
vaultEquity: string;
|
|
29
|
-
/** Current profit and loss. */
|
|
30
|
-
pnl: string;
|
|
31
|
-
/** All-time profit and loss. */
|
|
32
|
-
allTimePnl: string;
|
|
33
|
-
/** Subscription duration in days. */
|
|
34
|
-
daysFollowing: number;
|
|
35
|
-
/** Vault entry timestamp. */
|
|
36
|
-
vaultEntryTime: number;
|
|
37
|
-
/** Timestamp when funds become unlocked. */
|
|
38
|
-
lockupUntil: number;
|
|
39
|
-
}[];
|
|
27
|
+
})[];
|
|
40
28
|
/** Maximum distributable amount. */
|
|
41
29
|
maxDistributable: number;
|
|
42
30
|
/** Maximum withdrawable amount. */
|
|
@@ -59,6 +47,23 @@ export interface VaultEquity {
|
|
|
59
47
|
/** Timestamp when the user can withdraw their equity. */
|
|
60
48
|
lockedUntilTimestamp: number;
|
|
61
49
|
}
|
|
50
|
+
/** Vault follower state. */
|
|
51
|
+
export interface VaultFollowerState {
|
|
52
|
+
/** Follower address. */
|
|
53
|
+
user: Hex;
|
|
54
|
+
/** Follower's vault equity. */
|
|
55
|
+
vaultEquity: string;
|
|
56
|
+
/** Current profit and loss. */
|
|
57
|
+
pnl: string;
|
|
58
|
+
/** All-time profit and loss. */
|
|
59
|
+
allTimePnl: string;
|
|
60
|
+
/** Subscription duration in days. */
|
|
61
|
+
daysFollowing: number;
|
|
62
|
+
/** Vault entry timestamp. */
|
|
63
|
+
vaultEntryTime: number;
|
|
64
|
+
/** Timestamp when funds become unlocked. */
|
|
65
|
+
lockupUntil: number;
|
|
66
|
+
}
|
|
62
67
|
/** Vault relationship configuration. */
|
|
63
68
|
export type VaultRelationship = {
|
|
64
69
|
/** Relationship type. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaults.d.ts","sourceRoot":"","sources":["../../../../src/src/types/info/vaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,6BAA6B;AAC7B,MAAM,WAAW,YAAY;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,YAAY,EAAE,GAAG,CAAC;IAClB,sBAAsB;IACtB,MAAM,EAAE,GAAG,CAAC;IACZ,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,
|
|
1
|
+
{"version":3,"file":"vaults.d.ts","sourceRoot":"","sources":["../../../../src/src/types/info/vaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,6BAA6B;AAC7B,MAAM,WAAW,YAAY;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,YAAY,EAAE,GAAG,CAAC;IAClB,sBAAsB;IACtB,MAAM,EAAE,GAAG,CAAC;IACZ,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,aAAa,EAAE,kBA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AyB;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,+BAA+B;IAC/B,IAAI,EAAE;QACF,6BAA6B;QAC7B,cAAc,EAAE,GAAG,EAAE,CAAC;KACzB,CAAC;CACL,CAAC;AAEN,0BAA0B;AAC1B,MAAM,WAAW,YAAY;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,YAAY,EAAE,GAAG,CAAC;IAClB,sBAAsB;IACtB,MAAM,EAAE,GAAG,CAAC;IACZ,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,+BAA+B;IAC/B,YAAY,EAAE,iBAAiB,CAAC;IAChC,0BAA0B;IAC1B,gBAAgB,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -1,84 +1,91 @@
|
|
|
1
1
|
import type { Hex } from "../../base.js";
|
|
2
|
-
/**
|
|
2
|
+
/** Context events for a specific perpetual asset. */
|
|
3
3
|
export interface WsActiveAssetCtxRequest {
|
|
4
4
|
/** Type of subscription. */
|
|
5
5
|
type: "activeAssetCtx";
|
|
6
|
-
/** Asset symbol. */
|
|
6
|
+
/** Asset symbol (e.g., BTC). */
|
|
7
7
|
coin: string;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
9
|
+
/** Trading data events for a specific asset and user. */
|
|
10
10
|
export interface WsActiveAssetDataRequest {
|
|
11
11
|
/** Type of subscription. */
|
|
12
12
|
type: "activeAssetData";
|
|
13
|
-
/** Asset symbol. */
|
|
13
|
+
/** Asset symbol (e.g., BTC). */
|
|
14
14
|
coin: string;
|
|
15
15
|
/** User's address. */
|
|
16
16
|
user: Hex;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
18
|
+
/** Mid prices for all actively traded assets. */
|
|
19
19
|
export interface WsAllMidsRequest {
|
|
20
20
|
/** Type of subscription. */
|
|
21
21
|
type: "allMids";
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** Best bid and offer events for a specific asset. */
|
|
24
|
+
export interface WsBboRequest {
|
|
25
|
+
/** Type of subscription. */
|
|
26
|
+
type: "bbo";
|
|
27
|
+
/** Asset symbol (e.g., BTC). */
|
|
28
|
+
coin: string;
|
|
29
|
+
}
|
|
30
|
+
/** Candlestick data events for a specific asset. */
|
|
24
31
|
export interface WsCandleRequest {
|
|
25
32
|
/** Type of subscription. */
|
|
26
33
|
type: "candle";
|
|
27
|
-
/** Asset symbol. */
|
|
34
|
+
/** Asset symbol (e.g., BTC). */
|
|
28
35
|
coin: string;
|
|
29
36
|
/** Time interval. */
|
|
30
37
|
interval: "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "8h" | "12h" | "1d" | "3d" | "1w" | "1M";
|
|
31
38
|
}
|
|
32
|
-
/**
|
|
39
|
+
/** Explorer block events. */
|
|
33
40
|
export interface WsExplorerBlockRequest {
|
|
34
41
|
/** Type of subscription. */
|
|
35
42
|
type: "explorerBlock";
|
|
36
43
|
}
|
|
37
|
-
/**
|
|
44
|
+
/** Explorer transaction events. */
|
|
38
45
|
export interface WsExplorerTxsRequest {
|
|
39
46
|
/** Type of subscription. */
|
|
40
47
|
type: "explorerTxs";
|
|
41
48
|
}
|
|
42
|
-
/**
|
|
49
|
+
/** L2 order book events for a specific asset. */
|
|
43
50
|
export interface WsL2BookRequest {
|
|
44
51
|
/** Type of subscription. */
|
|
45
52
|
type: "l2Book";
|
|
46
|
-
/** Asset symbol. */
|
|
53
|
+
/** Asset symbol (e.g., BTC). */
|
|
47
54
|
coin: string;
|
|
48
55
|
/** Number of significant figures. */
|
|
49
56
|
nSigFigs?: 2 | 3 | 4 | 5 | null;
|
|
50
57
|
/** Mantissa for aggregation. */
|
|
51
58
|
mantissa?: 2 | 5 | null;
|
|
52
59
|
}
|
|
53
|
-
/**
|
|
60
|
+
/** Notification events for a specific user. */
|
|
54
61
|
export interface WsNotificationRequest {
|
|
55
62
|
/** Type of subscription. */
|
|
56
63
|
type: "notification";
|
|
57
64
|
/** User's address. */
|
|
58
65
|
user: Hex;
|
|
59
66
|
}
|
|
60
|
-
/**
|
|
67
|
+
/** Order status events for a specific user. */
|
|
61
68
|
export interface WsOrderUpdatesRequest {
|
|
62
69
|
/** Type of subscription. */
|
|
63
70
|
type: "orderUpdates";
|
|
64
71
|
/** User's address. */
|
|
65
72
|
user: Hex;
|
|
66
73
|
}
|
|
67
|
-
/**
|
|
74
|
+
/** Real-time trade updates for a specific asset. */
|
|
68
75
|
export interface WsTradesRequest {
|
|
69
76
|
/** Type of subscription. */
|
|
70
77
|
type: "trades";
|
|
71
|
-
/** Asset symbol. */
|
|
78
|
+
/** Asset symbol (e.g., BTC). */
|
|
72
79
|
coin: string;
|
|
73
80
|
}
|
|
74
|
-
/**
|
|
81
|
+
/** Non-order events for a specific user. */
|
|
75
82
|
export interface WsUserEventsRequest {
|
|
76
83
|
/** Type of subscription. */
|
|
77
84
|
type: "userEvents";
|
|
78
85
|
/** User's address. */
|
|
79
86
|
user: Hex;
|
|
80
87
|
}
|
|
81
|
-
/**
|
|
88
|
+
/** Trade fill events for a specific user. */
|
|
82
89
|
export interface WsUserFillsRequest {
|
|
83
90
|
/** Type of subscription. */
|
|
84
91
|
type: "userFills";
|
|
@@ -87,35 +94,35 @@ export interface WsUserFillsRequest {
|
|
|
87
94
|
/** Whether to aggregate fills by time. */
|
|
88
95
|
aggregateByTime?: boolean;
|
|
89
96
|
}
|
|
90
|
-
/**
|
|
97
|
+
/** Funding payment events for a specific user. */
|
|
91
98
|
export interface WsUserFundingsRequest {
|
|
92
99
|
/** Type of subscription. */
|
|
93
100
|
type: "userFundings";
|
|
94
101
|
/** User's address. */
|
|
95
102
|
user: Hex;
|
|
96
103
|
}
|
|
97
|
-
/**
|
|
104
|
+
/** Non-funding ledger events for a specific user. */
|
|
98
105
|
export interface WsUserNonFundingLedgerUpdatesRequest {
|
|
99
106
|
/** Type of subscription. */
|
|
100
107
|
type: "userNonFundingLedgerUpdates";
|
|
101
108
|
/** User's address. */
|
|
102
109
|
user: Hex;
|
|
103
110
|
}
|
|
104
|
-
/**
|
|
111
|
+
/** TWAP order history events for a specific user. */
|
|
105
112
|
export interface WsUserTwapHistoryRequest {
|
|
106
113
|
/** Type of subscription. */
|
|
107
114
|
type: "userTwapHistory";
|
|
108
115
|
/** User's address. */
|
|
109
116
|
user: Hex;
|
|
110
117
|
}
|
|
111
|
-
/**
|
|
118
|
+
/** TWAP execution events for a specific user. */
|
|
112
119
|
export interface WsUserTwapSliceFillsRequest {
|
|
113
120
|
/** Type of subscription. */
|
|
114
121
|
type: "userTwapSliceFills";
|
|
115
122
|
/** User's address. */
|
|
116
123
|
user: Hex;
|
|
117
124
|
}
|
|
118
|
-
/**
|
|
125
|
+
/** Comprehensive user and market data events. */
|
|
119
126
|
export interface WsWebData2Request {
|
|
120
127
|
/** Type of subscription. */
|
|
121
128
|
type: "webData2";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,qDAAqD;AACrD,MAAM,WAAW,uBAAuB;IACpC,4BAA4B;IAC5B,IAAI,EAAE,gBAAgB,CAAC;IACvB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,yDAAyD;AACzD,MAAM,WAAW,wBAAwB;IACrC,4BAA4B;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;CACb;AAED,iDAAiD;AACjD,MAA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19 +2,19 @@ import type { Hex } from "../../base.js";
|
|
|
2
2
|
import type { BlockDetails } from "../explorer/responses.js";
|
|
3
3
|
import type { FundingUpdate, PerpsClearinghouseState, SpotClearinghouseState, UserFundingUpdate, UserNonFundingLedgerUpdate } from "../info/accounts.js";
|
|
4
4
|
import type { AllMids, PerpsAssetCtx, PerpsMeta, SpotAssetCtx } from "../info/assets.js";
|
|
5
|
-
import type { Fill, FrontendOrder,
|
|
6
|
-
/**
|
|
5
|
+
import type { BookLevel, Fill, FrontendOrder, TwapHistory, TwapSliceFill, TwapState } from "../info/orders.js";
|
|
6
|
+
/** Active perpetual asset context. */
|
|
7
7
|
export interface WsActiveAssetCtx {
|
|
8
|
-
/** Asset symbol. */
|
|
8
|
+
/** Asset symbol (e.g., BTC). */
|
|
9
9
|
coin: string;
|
|
10
10
|
/** Context information for the perpetual asset. */
|
|
11
11
|
ctx: PerpsAssetCtx;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/** Active asset trading data. */
|
|
14
14
|
export interface WsActiveAssetData {
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/** Asset symbol. */
|
|
15
|
+
/** User's address. */
|
|
16
|
+
user: Hex;
|
|
17
|
+
/** Asset symbol (e.g., BTC). */
|
|
18
18
|
coin: string;
|
|
19
19
|
/** Leverage configuration. */
|
|
20
20
|
leverage: {
|
|
@@ -22,7 +22,7 @@ export interface WsActiveAssetData {
|
|
|
22
22
|
type: "isolated";
|
|
23
23
|
/** Leverage value used. */
|
|
24
24
|
value: number;
|
|
25
|
-
/** Amount of
|
|
25
|
+
/** Amount of USD used (1 = 1$). */
|
|
26
26
|
rawUsd: string;
|
|
27
27
|
} | {
|
|
28
28
|
/** Leverage type. */
|
|
@@ -32,69 +32,69 @@ export interface WsActiveAssetData {
|
|
|
32
32
|
};
|
|
33
33
|
/** Maximum trade size range [min, max]. */
|
|
34
34
|
maxTradeSzs: [string, string];
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/** Available to trade range [min, max]. */
|
|
36
|
+
availableToTrade: [string, string];
|
|
37
37
|
}
|
|
38
|
-
/**
|
|
38
|
+
/** Active spot asset context. */
|
|
39
39
|
export interface WsActiveSpotAssetCtx {
|
|
40
|
-
/** Asset symbol. */
|
|
40
|
+
/** Asset symbol (e.g., BTC). */
|
|
41
41
|
coin: string;
|
|
42
42
|
/** Context information for the spot asset. */
|
|
43
43
|
ctx: SpotAssetCtx;
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
45
|
+
/** Mid prices for all assets. */
|
|
46
46
|
export interface WsAllMids {
|
|
47
|
-
/**
|
|
47
|
+
/** Mapping of coin symbols to mid prices. */
|
|
48
48
|
mids: AllMids;
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
50
|
+
/** Best Bid and Offer. */
|
|
51
|
+
export interface WsBbo {
|
|
52
|
+
/** Asset symbol (e.g., BTC). */
|
|
53
|
+
coin: string;
|
|
54
|
+
/** Time of the BBO update (in ms since epoch). */
|
|
55
|
+
time: number;
|
|
56
|
+
/** Best bid and offer tuple [bid, offer], either can be undefined if unavailable. */
|
|
57
|
+
bbo: [BookLevel | undefined, BookLevel | undefined];
|
|
58
|
+
}
|
|
59
|
+
/** Block details. */
|
|
51
60
|
export type WsBlockDetails = Omit<BlockDetails, "txs">;
|
|
52
|
-
/**
|
|
61
|
+
/** User's notifications. */
|
|
53
62
|
export interface WsNotification {
|
|
54
63
|
/** Notification content. */
|
|
55
64
|
notification: string;
|
|
56
65
|
}
|
|
57
|
-
/**
|
|
58
|
-
export interface WsOrder {
|
|
59
|
-
/** Order details. */
|
|
60
|
-
order: Order;
|
|
61
|
-
/** Order processing status. */
|
|
62
|
-
status: OrderProcessingStatus;
|
|
63
|
-
/** Status timestamp (in ms since epoch). */
|
|
64
|
-
statusTimestamp: number;
|
|
65
|
-
}
|
|
66
|
-
/** WebSocket message containing trade information. */
|
|
66
|
+
/** Trade information. */
|
|
67
67
|
export interface WsTrade {
|
|
68
|
-
/** Asset symbol. */
|
|
68
|
+
/** Asset symbol (e.g., BTC). */
|
|
69
69
|
coin: string;
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/** Trade side ("B" = Bid/Buy, "A" = Ask/Sell). */
|
|
71
|
+
side: "B" | "A";
|
|
72
72
|
/** Trade price. */
|
|
73
73
|
px: string;
|
|
74
|
-
/** Trade side. */
|
|
75
|
-
side: string;
|
|
76
74
|
/** Trade size. */
|
|
77
75
|
sz: string;
|
|
78
|
-
/** Trade ID. */
|
|
79
|
-
tid: number;
|
|
80
76
|
/** Trade timestamp (in ms since epoch). */
|
|
81
77
|
time: number;
|
|
82
|
-
/**
|
|
78
|
+
/** Transaction hash. */
|
|
79
|
+
hash: Hex;
|
|
80
|
+
/** Trade ID. */
|
|
81
|
+
tid: number;
|
|
82
|
+
/** Addresses of users involved in the trade [Maker, Taker]. */
|
|
83
83
|
users: [Hex, Hex];
|
|
84
84
|
}
|
|
85
|
-
/**
|
|
85
|
+
/** User's event. */
|
|
86
86
|
export type WsUserEvent = WsUserEventFill | WsUserEventFunding | WsUserEventLiquidation | WsUserEventNonUserCancel | WsUserEventTwapHistory | WsUserEventTwapSliceFills;
|
|
87
|
-
/**
|
|
87
|
+
/** User's fill event. */
|
|
88
88
|
export interface WsUserEventFill {
|
|
89
89
|
/** Array of trade fills. */
|
|
90
90
|
fills: Fill[];
|
|
91
91
|
}
|
|
92
|
-
/**
|
|
92
|
+
/** User's funding event. */
|
|
93
93
|
export interface WsUserEventFunding {
|
|
94
94
|
/** Funding update details. */
|
|
95
95
|
funding: Omit<FundingUpdate, "type">;
|
|
96
96
|
}
|
|
97
|
-
/**
|
|
97
|
+
/** User's liquidation event. */
|
|
98
98
|
export interface WsUserEventLiquidation {
|
|
99
99
|
/** Liquidation event details. */
|
|
100
100
|
liquidation: {
|
|
@@ -110,27 +110,27 @@ export interface WsUserEventLiquidation {
|
|
|
110
110
|
liquidated_account_value: string;
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
/**
|
|
113
|
+
/** Non-user initiated order cancellation event. */
|
|
114
114
|
export interface WsUserEventNonUserCancel {
|
|
115
115
|
/** Array of cancelled orders not initiated by the user. */
|
|
116
116
|
nonUserCancel: {
|
|
117
|
-
/** Asset symbol. */
|
|
117
|
+
/** Asset symbol (e.g., BTC). */
|
|
118
118
|
coin: string;
|
|
119
119
|
/** Order ID. */
|
|
120
120
|
oid: number;
|
|
121
121
|
}[];
|
|
122
122
|
}
|
|
123
|
-
/**
|
|
123
|
+
/** User's TWAP history event. */
|
|
124
124
|
export interface WsUserEventTwapHistory {
|
|
125
125
|
/** Array of historical TWAP fills. */
|
|
126
126
|
twapHistory: TwapHistory[];
|
|
127
127
|
}
|
|
128
|
-
/**
|
|
128
|
+
/** User's TWAP slice fills event. */
|
|
129
129
|
export interface WsUserEventTwapSliceFills {
|
|
130
130
|
/** Array of TWAP slice fills. */
|
|
131
131
|
twapSliceFills: TwapSliceFill[];
|
|
132
132
|
}
|
|
133
|
-
/**
|
|
133
|
+
/** User's fills. */
|
|
134
134
|
export interface WsUserFills {
|
|
135
135
|
/** User's address. */
|
|
136
136
|
user: Hex;
|
|
@@ -139,7 +139,7 @@ export interface WsUserFills {
|
|
|
139
139
|
/** Whether this is an initial snapshot. */
|
|
140
140
|
isSnapshot?: true;
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
142
|
+
/** User's fundings. */
|
|
143
143
|
export interface WsUserFundings {
|
|
144
144
|
/** User's address. */
|
|
145
145
|
user: Hex;
|
|
@@ -148,7 +148,7 @@ export interface WsUserFundings {
|
|
|
148
148
|
/** Whether this is an initial snapshot. */
|
|
149
149
|
isSnapshot?: true;
|
|
150
150
|
}
|
|
151
|
-
/**
|
|
151
|
+
/** User's non-funding ledger updates. */
|
|
152
152
|
export interface WsUserNonFundingLedgerUpdates {
|
|
153
153
|
/** User's address. */
|
|
154
154
|
user: Hex;
|
|
@@ -157,7 +157,7 @@ export interface WsUserNonFundingLedgerUpdates {
|
|
|
157
157
|
/** Whether this is an initial snapshot. */
|
|
158
158
|
isSnapshot?: true;
|
|
159
159
|
}
|
|
160
|
-
/**
|
|
160
|
+
/** User's TWAP history. */
|
|
161
161
|
export interface WsUserTwapHistory {
|
|
162
162
|
/** User's address. */
|
|
163
163
|
user: Hex;
|
|
@@ -166,7 +166,7 @@ export interface WsUserTwapHistory {
|
|
|
166
166
|
/** Whether this is an initial snapshot. */
|
|
167
167
|
isSnapshot?: true;
|
|
168
168
|
}
|
|
169
|
-
/**
|
|
169
|
+
/** User's TWAP slice fills. */
|
|
170
170
|
export interface WsUserTwapSliceFills {
|
|
171
171
|
/** User's address. */
|
|
172
172
|
user: Hex;
|
|
@@ -175,7 +175,7 @@ export interface WsUserTwapSliceFills {
|
|
|
175
175
|
/** Whether this is an initial snapshot. */
|
|
176
176
|
isSnapshot?: true;
|
|
177
177
|
}
|
|
178
|
-
/**
|
|
178
|
+
/** Comprehensive user and market data. */
|
|
179
179
|
export interface WsWebData2 {
|
|
180
180
|
/** Account summary for perpetual trading. */
|
|
181
181
|
clearinghouseState: PerpsClearinghouseState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EACR,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/src/types/subscriptions/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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AO,CAAC;IACjB,sBAAsB;IACtB,IAAI,EAAE,GAAG,CAAC;IACV,mBAAmB;IACnB,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IAClC,wCAAwC;IACxC,SAAS,EAAE,sBAAsB,CAAC;IAClC,2CAA2C;IAC3C,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,sDAAsD;IACtD,mBAAmB,CAAC,EAAE,IAAI,CAAC;IAC3B,mDAAmD;IACnD,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Uint8Array_ } from "./_types.js";
|
|
2
|
+
export type { Uint8Array_ };
|
|
3
|
+
export declare const alphabet: Uint8Array;
|
|
4
|
+
export declare const rAlphabet: Uint8Array;
|
|
5
|
+
/**
|
|
6
|
+
* Calculate the output size needed to encode a given input size for
|
|
7
|
+
* {@linkcode encodeRawHex}.
|
|
8
|
+
*
|
|
9
|
+
* @param originalSize The size of the input buffer.
|
|
10
|
+
* @returns The size of the output buffer.
|
|
11
|
+
*
|
|
12
|
+
* @example Basic Usage
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
* import { calcSizeHex } from "@std/encoding/unstable-hex";
|
|
16
|
+
*
|
|
17
|
+
* assertEquals(calcSizeHex(1), 2);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function calcSizeHex(originalSize: number): number;
|
|
21
|
+
export declare function encode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array): number;
|
|
22
|
+
export declare function decode(buffer: Uint8Array_, i: number, o: number, alphabet: Uint8Array): number;
|
|
23
|
+
//# sourceMappingURL=_common16.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common16.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.9/_common16.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,eAAO,MAAM,QAAQ,YAA+C,CAAC;AACrE,eAAO,MAAM,SAAS,YAA+B,CAAC;AAMtD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,UAAU,GACnB,MAAM,CAOR;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,UAAU,GACnB,MAAM,CAeR"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
(function (factory) {
|
|
3
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
4
|
+
var v = factory(require, exports);
|
|
5
|
+
if (v !== undefined) module.exports = v;
|
|
6
|
+
}
|
|
7
|
+
else if (typeof define === "function" && define.amd) {
|
|
8
|
+
define(["require", "exports"], factory);
|
|
9
|
+
}
|
|
10
|
+
})(function (require, exports) {
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.rAlphabet = exports.alphabet = void 0;
|
|
14
|
+
exports.calcSizeHex = calcSizeHex;
|
|
15
|
+
exports.encode = encode;
|
|
16
|
+
exports.decode = decode;
|
|
17
|
+
exports.alphabet = new TextEncoder().encode("0123456789abcdef");
|
|
18
|
+
exports.rAlphabet = new Uint8Array(128).fill(16); // alphabet.Hex.length
|
|
19
|
+
exports.alphabet.forEach((byte, i) => exports.rAlphabet[byte] = i);
|
|
20
|
+
new TextEncoder()
|
|
21
|
+
.encode("ABCDEF")
|
|
22
|
+
.forEach((byte, i) => exports.rAlphabet[byte] = i + 10);
|
|
23
|
+
/**
|
|
24
|
+
* Calculate the output size needed to encode a given input size for
|
|
25
|
+
* {@linkcode encodeRawHex}.
|
|
26
|
+
*
|
|
27
|
+
* @param originalSize The size of the input buffer.
|
|
28
|
+
* @returns The size of the output buffer.
|
|
29
|
+
*
|
|
30
|
+
* @example Basic Usage
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { assertEquals } from "@std/assert";
|
|
33
|
+
* import { calcSizeHex } from "@std/encoding/unstable-hex";
|
|
34
|
+
*
|
|
35
|
+
* assertEquals(calcSizeHex(1), 2);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function calcSizeHex(originalSize) {
|
|
39
|
+
return originalSize * 2;
|
|
40
|
+
}
|
|
41
|
+
function encode(buffer, i, o, alphabet) {
|
|
42
|
+
for (; i < buffer.length; ++i) {
|
|
43
|
+
const x = buffer[i];
|
|
44
|
+
buffer[o++] = alphabet[x >> 4];
|
|
45
|
+
buffer[o++] = alphabet[x & 0xF];
|
|
46
|
+
}
|
|
47
|
+
return o;
|
|
48
|
+
}
|
|
49
|
+
function decode(buffer, i, o, alphabet) {
|
|
50
|
+
if ((buffer.length - o) % 2 === 1) {
|
|
51
|
+
throw new RangeError(`Cannot decode input as hex: Length (${buffer.length - o}) must be divisible by 2`);
|
|
52
|
+
}
|
|
53
|
+
i += 1;
|
|
54
|
+
for (; i < buffer.length; i += 2) {
|
|
55
|
+
buffer[o++] = (getByte(buffer[i - 1], alphabet) << 4) |
|
|
56
|
+
getByte(buffer[i], alphabet);
|
|
57
|
+
}
|
|
58
|
+
return o;
|
|
59
|
+
}
|
|
60
|
+
function getByte(char, alphabet) {
|
|
61
|
+
const byte = alphabet[char] ?? 16;
|
|
62
|
+
if (byte === 16) { // alphabet.Hex.length
|
|
63
|
+
throw new TypeError(`Cannot decode input as hex: Invalid character (${String.fromCharCode(char)})`);
|
|
64
|
+
}
|
|
65
|
+
return byte;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_common_detach.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.9/_common_detach.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,GACd,CAAC,WAAW,EAAE,MAAM,CAAC,CAWvB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
2
|
+
(function (factory) {
|
|
3
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
4
|
+
var v = factory(require, exports);
|
|
5
|
+
if (v !== undefined) module.exports = v;
|
|
6
|
+
}
|
|
7
|
+
else if (typeof define === "function" && define.amd) {
|
|
8
|
+
define(["require", "exports"], factory);
|
|
9
|
+
}
|
|
10
|
+
})(function (require, exports) {
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.detach = detach;
|
|
14
|
+
function detach(buffer, maxSize) {
|
|
15
|
+
const originalSize = buffer.length;
|
|
16
|
+
if (buffer.byteOffset) {
|
|
17
|
+
const b = new Uint8Array(buffer.buffer);
|
|
18
|
+
b.set(buffer);
|
|
19
|
+
buffer = b.subarray(0, originalSize);
|
|
20
|
+
}
|
|
21
|
+
// deno-lint-ignore no-explicit-any
|
|
22
|
+
buffer = new Uint8Array(buffer.buffer.transfer(maxSize));
|
|
23
|
+
buffer.set(buffer.subarray(0, originalSize), maxSize - originalSize);
|
|
24
|
+
return [buffer, maxSize - originalSize];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.
|
|
1
|
+
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.9/_types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.9/hex.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,CAAC;AAU5B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,CAWxE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAKlD"}
|