@hyperix/hooks 0.1.19 → 0.1.20
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/dist/use-perp-meta.d.ts +211 -2
- package/dist/use-perp-meta.js +3 -3
- package/package.json +1 -1
package/dist/use-perp-meta.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type { AllPerpMetasData } from "./use-all-perp-metas.js";
|
|
|
2
2
|
import { type UseAllPerpMetasOptions } from "./use-all-perp-metas.js";
|
|
3
3
|
export type PerpMeta = AllPerpMetasData[number]["universe"][number];
|
|
4
4
|
export declare function usePerpMeta(coin: string, options?: UseAllPerpMetasOptions): {
|
|
5
|
-
|
|
6
|
-
meta: {
|
|
5
|
+
data: {
|
|
7
6
|
szDecimals: number;
|
|
8
7
|
name: string;
|
|
9
8
|
maxLeverage: number;
|
|
@@ -14,4 +13,214 @@ export declare function usePerpMeta(coin: string, options?: UseAllPerpMetasOptio
|
|
|
14
13
|
growthMode?: "enabled";
|
|
15
14
|
lastGrowthModeChangeTime?: string;
|
|
16
15
|
} | undefined;
|
|
16
|
+
error: Error;
|
|
17
|
+
isError: true;
|
|
18
|
+
isPending: false;
|
|
19
|
+
isLoading: false;
|
|
20
|
+
isLoadingError: false;
|
|
21
|
+
isRefetchError: true;
|
|
22
|
+
isSuccess: false;
|
|
23
|
+
isPlaceholderData: false;
|
|
24
|
+
status: "error";
|
|
25
|
+
dataUpdatedAt: number;
|
|
26
|
+
errorUpdatedAt: number;
|
|
27
|
+
failureCount: number;
|
|
28
|
+
failureReason: Error | null;
|
|
29
|
+
errorUpdateCount: number;
|
|
30
|
+
isFetched: boolean;
|
|
31
|
+
isFetchedAfterMount: boolean;
|
|
32
|
+
isFetching: boolean;
|
|
33
|
+
isInitialLoading: boolean;
|
|
34
|
+
isPaused: boolean;
|
|
35
|
+
isRefetching: boolean;
|
|
36
|
+
isStale: boolean;
|
|
37
|
+
isEnabled: boolean;
|
|
38
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@nktkas/hyperliquid").AllPerpMetasResponse, Error>>;
|
|
39
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
40
|
+
promise: Promise<import("@nktkas/hyperliquid").AllPerpMetasResponse>;
|
|
41
|
+
} | {
|
|
42
|
+
data: {
|
|
43
|
+
szDecimals: number;
|
|
44
|
+
name: string;
|
|
45
|
+
maxLeverage: number;
|
|
46
|
+
marginTableId: number;
|
|
47
|
+
onlyIsolated?: true;
|
|
48
|
+
isDelisted?: true;
|
|
49
|
+
marginMode?: "strictIsolated" | "noCross";
|
|
50
|
+
growthMode?: "enabled";
|
|
51
|
+
lastGrowthModeChangeTime?: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
error: null;
|
|
54
|
+
isError: false;
|
|
55
|
+
isPending: false;
|
|
56
|
+
isLoading: false;
|
|
57
|
+
isLoadingError: false;
|
|
58
|
+
isRefetchError: false;
|
|
59
|
+
isSuccess: true;
|
|
60
|
+
isPlaceholderData: false;
|
|
61
|
+
status: "success";
|
|
62
|
+
dataUpdatedAt: number;
|
|
63
|
+
errorUpdatedAt: number;
|
|
64
|
+
failureCount: number;
|
|
65
|
+
failureReason: Error | null;
|
|
66
|
+
errorUpdateCount: number;
|
|
67
|
+
isFetched: boolean;
|
|
68
|
+
isFetchedAfterMount: boolean;
|
|
69
|
+
isFetching: boolean;
|
|
70
|
+
isInitialLoading: boolean;
|
|
71
|
+
isPaused: boolean;
|
|
72
|
+
isRefetching: boolean;
|
|
73
|
+
isStale: boolean;
|
|
74
|
+
isEnabled: boolean;
|
|
75
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@nktkas/hyperliquid").AllPerpMetasResponse, Error>>;
|
|
76
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
77
|
+
promise: Promise<import("@nktkas/hyperliquid").AllPerpMetasResponse>;
|
|
78
|
+
} | {
|
|
79
|
+
data: {
|
|
80
|
+
szDecimals: number;
|
|
81
|
+
name: string;
|
|
82
|
+
maxLeverage: number;
|
|
83
|
+
marginTableId: number;
|
|
84
|
+
onlyIsolated?: true;
|
|
85
|
+
isDelisted?: true;
|
|
86
|
+
marginMode?: "strictIsolated" | "noCross";
|
|
87
|
+
growthMode?: "enabled";
|
|
88
|
+
lastGrowthModeChangeTime?: string;
|
|
89
|
+
} | undefined;
|
|
90
|
+
error: Error;
|
|
91
|
+
isError: true;
|
|
92
|
+
isPending: false;
|
|
93
|
+
isLoading: false;
|
|
94
|
+
isLoadingError: true;
|
|
95
|
+
isRefetchError: false;
|
|
96
|
+
isSuccess: false;
|
|
97
|
+
isPlaceholderData: false;
|
|
98
|
+
status: "error";
|
|
99
|
+
dataUpdatedAt: number;
|
|
100
|
+
errorUpdatedAt: number;
|
|
101
|
+
failureCount: number;
|
|
102
|
+
failureReason: Error | null;
|
|
103
|
+
errorUpdateCount: number;
|
|
104
|
+
isFetched: boolean;
|
|
105
|
+
isFetchedAfterMount: boolean;
|
|
106
|
+
isFetching: boolean;
|
|
107
|
+
isInitialLoading: boolean;
|
|
108
|
+
isPaused: boolean;
|
|
109
|
+
isRefetching: boolean;
|
|
110
|
+
isStale: boolean;
|
|
111
|
+
isEnabled: boolean;
|
|
112
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@nktkas/hyperliquid").AllPerpMetasResponse, Error>>;
|
|
113
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
114
|
+
promise: Promise<import("@nktkas/hyperliquid").AllPerpMetasResponse>;
|
|
115
|
+
} | {
|
|
116
|
+
data: {
|
|
117
|
+
szDecimals: number;
|
|
118
|
+
name: string;
|
|
119
|
+
maxLeverage: number;
|
|
120
|
+
marginTableId: number;
|
|
121
|
+
onlyIsolated?: true;
|
|
122
|
+
isDelisted?: true;
|
|
123
|
+
marginMode?: "strictIsolated" | "noCross";
|
|
124
|
+
growthMode?: "enabled";
|
|
125
|
+
lastGrowthModeChangeTime?: string;
|
|
126
|
+
} | undefined;
|
|
127
|
+
error: null;
|
|
128
|
+
isError: false;
|
|
129
|
+
isPending: true;
|
|
130
|
+
isLoading: true;
|
|
131
|
+
isLoadingError: false;
|
|
132
|
+
isRefetchError: false;
|
|
133
|
+
isSuccess: false;
|
|
134
|
+
isPlaceholderData: false;
|
|
135
|
+
status: "pending";
|
|
136
|
+
dataUpdatedAt: number;
|
|
137
|
+
errorUpdatedAt: number;
|
|
138
|
+
failureCount: number;
|
|
139
|
+
failureReason: Error | null;
|
|
140
|
+
errorUpdateCount: number;
|
|
141
|
+
isFetched: boolean;
|
|
142
|
+
isFetchedAfterMount: boolean;
|
|
143
|
+
isFetching: boolean;
|
|
144
|
+
isInitialLoading: boolean;
|
|
145
|
+
isPaused: boolean;
|
|
146
|
+
isRefetching: boolean;
|
|
147
|
+
isStale: boolean;
|
|
148
|
+
isEnabled: boolean;
|
|
149
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@nktkas/hyperliquid").AllPerpMetasResponse, Error>>;
|
|
150
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
151
|
+
promise: Promise<import("@nktkas/hyperliquid").AllPerpMetasResponse>;
|
|
152
|
+
} | {
|
|
153
|
+
data: {
|
|
154
|
+
szDecimals: number;
|
|
155
|
+
name: string;
|
|
156
|
+
maxLeverage: number;
|
|
157
|
+
marginTableId: number;
|
|
158
|
+
onlyIsolated?: true;
|
|
159
|
+
isDelisted?: true;
|
|
160
|
+
marginMode?: "strictIsolated" | "noCross";
|
|
161
|
+
growthMode?: "enabled";
|
|
162
|
+
lastGrowthModeChangeTime?: string;
|
|
163
|
+
} | undefined;
|
|
164
|
+
error: null;
|
|
165
|
+
isError: false;
|
|
166
|
+
isPending: true;
|
|
167
|
+
isLoadingError: false;
|
|
168
|
+
isRefetchError: false;
|
|
169
|
+
isSuccess: false;
|
|
170
|
+
isPlaceholderData: false;
|
|
171
|
+
status: "pending";
|
|
172
|
+
dataUpdatedAt: number;
|
|
173
|
+
errorUpdatedAt: number;
|
|
174
|
+
failureCount: number;
|
|
175
|
+
failureReason: Error | null;
|
|
176
|
+
errorUpdateCount: number;
|
|
177
|
+
isFetched: boolean;
|
|
178
|
+
isFetchedAfterMount: boolean;
|
|
179
|
+
isFetching: boolean;
|
|
180
|
+
isLoading: boolean;
|
|
181
|
+
isInitialLoading: boolean;
|
|
182
|
+
isPaused: boolean;
|
|
183
|
+
isRefetching: boolean;
|
|
184
|
+
isStale: boolean;
|
|
185
|
+
isEnabled: boolean;
|
|
186
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@nktkas/hyperliquid").AllPerpMetasResponse, Error>>;
|
|
187
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
188
|
+
promise: Promise<import("@nktkas/hyperliquid").AllPerpMetasResponse>;
|
|
189
|
+
} | {
|
|
190
|
+
data: {
|
|
191
|
+
szDecimals: number;
|
|
192
|
+
name: string;
|
|
193
|
+
maxLeverage: number;
|
|
194
|
+
marginTableId: number;
|
|
195
|
+
onlyIsolated?: true;
|
|
196
|
+
isDelisted?: true;
|
|
197
|
+
marginMode?: "strictIsolated" | "noCross";
|
|
198
|
+
growthMode?: "enabled";
|
|
199
|
+
lastGrowthModeChangeTime?: string;
|
|
200
|
+
} | undefined;
|
|
201
|
+
isError: false;
|
|
202
|
+
error: null;
|
|
203
|
+
isPending: false;
|
|
204
|
+
isLoading: false;
|
|
205
|
+
isLoadingError: false;
|
|
206
|
+
isRefetchError: false;
|
|
207
|
+
isSuccess: true;
|
|
208
|
+
isPlaceholderData: true;
|
|
209
|
+
status: "success";
|
|
210
|
+
dataUpdatedAt: number;
|
|
211
|
+
errorUpdatedAt: number;
|
|
212
|
+
failureCount: number;
|
|
213
|
+
failureReason: Error | null;
|
|
214
|
+
errorUpdateCount: number;
|
|
215
|
+
isFetched: boolean;
|
|
216
|
+
isFetchedAfterMount: boolean;
|
|
217
|
+
isFetching: boolean;
|
|
218
|
+
isInitialLoading: boolean;
|
|
219
|
+
isPaused: boolean;
|
|
220
|
+
isRefetching: boolean;
|
|
221
|
+
isStale: boolean;
|
|
222
|
+
isEnabled: boolean;
|
|
223
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<import("@nktkas/hyperliquid").AllPerpMetasResponse, Error>>;
|
|
224
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
225
|
+
promise: Promise<import("@nktkas/hyperliquid").AllPerpMetasResponse>;
|
|
17
226
|
};
|
package/dist/use-perp-meta.js
CHANGED
|
@@ -2,12 +2,12 @@ import { useMemo } from "react";
|
|
|
2
2
|
import { useAllPerpMetas, } from "./use-all-perp-metas.js";
|
|
3
3
|
export function usePerpMeta(coin, options = {}) {
|
|
4
4
|
const allPerpMetasState = useAllPerpMetas(options);
|
|
5
|
-
const
|
|
5
|
+
const data = useMemo(() => {
|
|
6
6
|
const universes = allPerpMetasState.data?.flatMap((perpMeta) => perpMeta.universe) ?? [];
|
|
7
7
|
return universes.find((universe) => universe.name === coin);
|
|
8
8
|
}, [coin, allPerpMetasState.data]);
|
|
9
9
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
...allPerpMetasState,
|
|
11
|
+
data,
|
|
12
12
|
};
|
|
13
13
|
}
|