@surf-ai/sdk 0.1.0
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 +209 -0
- package/dist/chunk-J4OMYO3F.js +70 -0
- package/dist/client-3YMIRPDV.js +8 -0
- package/dist/db/index.cjs +112 -0
- package/dist/db/index.d.cts +48 -0
- package/dist/db/index.d.ts +48 -0
- package/dist/db/index.js +81 -0
- package/dist/react/index.d.ts +3382 -0
- package/dist/react/index.js +980 -0
- package/dist/server/index.cjs +798 -0
- package/dist/server/index.d.cts +3342 -0
- package/dist/server/index.d.ts +3342 -0
- package/dist/server/index.js +677 -0
- package/package.json +58 -0
- package/src/theme/index.css +314 -0
|
@@ -0,0 +1,980 @@
|
|
|
1
|
+
// src/react/utils.ts
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
function cn(...inputs) {
|
|
5
|
+
return twMerge(clsx(inputs));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// src/react/use-toast.ts
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
var TOAST_LIMIT = 1;
|
|
11
|
+
var TOAST_REMOVE_DELAY = 1e6;
|
|
12
|
+
var count = 0;
|
|
13
|
+
function genId() {
|
|
14
|
+
return (count = (count + 1) % Number.MAX_SAFE_INTEGER).toString();
|
|
15
|
+
}
|
|
16
|
+
var toastTimeouts = /* @__PURE__ */ new Map();
|
|
17
|
+
var listeners = [];
|
|
18
|
+
var memoryState = { toasts: [] };
|
|
19
|
+
function dispatch(action) {
|
|
20
|
+
memoryState = reducer(memoryState, action);
|
|
21
|
+
listeners.forEach((l) => l(memoryState));
|
|
22
|
+
}
|
|
23
|
+
function reducer(state, action) {
|
|
24
|
+
switch (action.type) {
|
|
25
|
+
case "ADD_TOAST":
|
|
26
|
+
return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) };
|
|
27
|
+
case "UPDATE_TOAST":
|
|
28
|
+
return { ...state, toasts: state.toasts.map((t) => t.id === action.toast.id ? { ...t, ...action.toast } : t) };
|
|
29
|
+
case "DISMISS_TOAST": {
|
|
30
|
+
const { toastId } = action;
|
|
31
|
+
if (toastId) {
|
|
32
|
+
if (!toastTimeouts.has(toastId)) {
|
|
33
|
+
toastTimeouts.set(toastId, setTimeout(() => {
|
|
34
|
+
toastTimeouts.delete(toastId);
|
|
35
|
+
dispatch({ type: "REMOVE_TOAST", toastId });
|
|
36
|
+
}, TOAST_REMOVE_DELAY));
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
state.toasts.forEach((t) => dispatch({ type: "DISMISS_TOAST", toastId: t.id }));
|
|
40
|
+
}
|
|
41
|
+
return { ...state, toasts: state.toasts.map((t) => t.id === toastId || !toastId ? { ...t } : t) };
|
|
42
|
+
}
|
|
43
|
+
case "REMOVE_TOAST":
|
|
44
|
+
return { ...state, toasts: action.toastId ? state.toasts.filter((t) => t.id !== action.toastId) : [] };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function toast(props) {
|
|
48
|
+
const id = genId();
|
|
49
|
+
dispatch({ type: "ADD_TOAST", toast: { ...props, id } });
|
|
50
|
+
return { id, dismiss: () => dispatch({ type: "DISMISS_TOAST", toastId: id }), update: (p) => dispatch({ type: "UPDATE_TOAST", toast: { ...p, id } }) };
|
|
51
|
+
}
|
|
52
|
+
function useToast() {
|
|
53
|
+
const [state, setState] = React.useState(memoryState);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
listeners.push(setState);
|
|
56
|
+
return () => {
|
|
57
|
+
const i = listeners.indexOf(setState);
|
|
58
|
+
if (i > -1) listeners.splice(i, 1);
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
return { ...state, toast, dismiss: (toastId) => dispatch({ type: "DISMISS_TOAST", toastId }) };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/react/hooks/exchange.ts
|
|
65
|
+
import { useQuery } from "@tanstack/react-query";
|
|
66
|
+
|
|
67
|
+
// src/react/fetch.ts
|
|
68
|
+
var BASE = typeof window !== "undefined" ? (import.meta.env?.BASE_URL || "/").replace(/\/$/, "") : "";
|
|
69
|
+
function normalizePath(path) {
|
|
70
|
+
return String(path || "").replace(/^\/+/, "").replace(/^(?:proxy\/)+/, "");
|
|
71
|
+
}
|
|
72
|
+
async function fetchWithRetry(url, init, retries = 1) {
|
|
73
|
+
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
74
|
+
const res = await fetch(url, init);
|
|
75
|
+
if (!res.ok) {
|
|
76
|
+
const text2 = await res.text();
|
|
77
|
+
throw new Error(`API error ${res.status}: ${text2.slice(0, 200)}`);
|
|
78
|
+
}
|
|
79
|
+
const text = await res.text();
|
|
80
|
+
if (text) return JSON.parse(text);
|
|
81
|
+
if (attempt < retries) await new Promise((r) => setTimeout(r, 1e3));
|
|
82
|
+
}
|
|
83
|
+
throw new Error(`Empty response from ${url}`);
|
|
84
|
+
}
|
|
85
|
+
async function proxyGet(path, params) {
|
|
86
|
+
const cleaned = {};
|
|
87
|
+
if (params) {
|
|
88
|
+
for (const [k, v] of Object.entries(params)) {
|
|
89
|
+
if (v != null) cleaned[k] = String(v);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const qs = Object.keys(cleaned).length ? "?" + new URLSearchParams(cleaned).toString() : "";
|
|
93
|
+
return fetchWithRetry(`${BASE}/proxy/${normalizePath(path)}${qs}`);
|
|
94
|
+
}
|
|
95
|
+
async function proxyPost(path, body) {
|
|
96
|
+
return fetchWithRetry(`${BASE}/proxy/${normalizePath(path)}`, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: { "Content-Type": "application/json" },
|
|
99
|
+
body: body ? JSON.stringify(body) : void 0
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// src/react/hooks/exchange.ts
|
|
104
|
+
function useExchangeDepth(params) {
|
|
105
|
+
return useQuery({
|
|
106
|
+
queryKey: ["exchange-depth", params],
|
|
107
|
+
queryFn: () => proxyGet("exchange/depth", params)
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function useExchangeFundingHistory(params) {
|
|
111
|
+
return useQuery({
|
|
112
|
+
queryKey: ["exchange-funding-history", params],
|
|
113
|
+
queryFn: () => proxyGet("exchange/funding-history", params)
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function useExchangeKlines(params) {
|
|
117
|
+
return useQuery({
|
|
118
|
+
queryKey: ["exchange-klines", params],
|
|
119
|
+
queryFn: () => proxyGet("exchange/klines", params)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function useExchangeLongShortRatio(params) {
|
|
123
|
+
return useQuery({
|
|
124
|
+
queryKey: ["exchange-long-short-ratio", params],
|
|
125
|
+
queryFn: () => proxyGet("exchange/long-short-ratio", params)
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function useExchangeMarkets(params) {
|
|
129
|
+
return useQuery({
|
|
130
|
+
queryKey: ["exchange-markets", params],
|
|
131
|
+
queryFn: () => proxyGet("exchange/markets", params)
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function useExchangePerp(params) {
|
|
135
|
+
return useQuery({
|
|
136
|
+
queryKey: ["exchange-perp", params],
|
|
137
|
+
queryFn: () => proxyGet("exchange/perp", params)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function useExchangePrice(params) {
|
|
141
|
+
return useQuery({
|
|
142
|
+
queryKey: ["exchange-price", params],
|
|
143
|
+
queryFn: () => proxyGet("exchange/price", params)
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/react/hooks/fund.ts
|
|
148
|
+
import { useQuery as useQuery2, useInfiniteQuery as useInfiniteQuery2 } from "@tanstack/react-query";
|
|
149
|
+
function useFundDetail(params) {
|
|
150
|
+
return useQuery2({
|
|
151
|
+
queryKey: ["fund-detail", params],
|
|
152
|
+
queryFn: () => proxyGet("fund/detail", params)
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function useInfiniteFundPortfolio(params) {
|
|
156
|
+
return useInfiniteQuery2({
|
|
157
|
+
queryKey: ["fund-portfolio", params],
|
|
158
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("fund/portfolio", { ...params, offset: String(pageParam) }),
|
|
159
|
+
initialPageParam: 0,
|
|
160
|
+
getNextPageParam: (last) => {
|
|
161
|
+
const m = last?.meta;
|
|
162
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
163
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
164
|
+
return next < m.total ? next : void 0;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function useInfiniteFundRanking(params) {
|
|
169
|
+
return useInfiniteQuery2({
|
|
170
|
+
queryKey: ["fund-ranking", params],
|
|
171
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("fund/ranking", { ...params, offset: String(pageParam) }),
|
|
172
|
+
initialPageParam: 0,
|
|
173
|
+
getNextPageParam: (last) => {
|
|
174
|
+
const m = last?.meta;
|
|
175
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
176
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
177
|
+
return next < m.total ? next : void 0;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// src/react/hooks/kalshi.ts
|
|
183
|
+
import { useQuery as useQuery3, useInfiniteQuery as useInfiniteQuery3 } from "@tanstack/react-query";
|
|
184
|
+
function useInfiniteKalshiEvents(params) {
|
|
185
|
+
return useInfiniteQuery3({
|
|
186
|
+
queryKey: ["kalshi-events", params],
|
|
187
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("kalshi/events", { ...params, offset: String(pageParam) }),
|
|
188
|
+
initialPageParam: 0,
|
|
189
|
+
getNextPageParam: (last) => {
|
|
190
|
+
const m = last?.meta;
|
|
191
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
192
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
193
|
+
return next < m.total ? next : void 0;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function useInfiniteKalshiMarkets(params) {
|
|
198
|
+
return useInfiniteQuery3({
|
|
199
|
+
queryKey: ["kalshi-markets", params],
|
|
200
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("kalshi/markets", { ...params, offset: String(pageParam) }),
|
|
201
|
+
initialPageParam: 0,
|
|
202
|
+
getNextPageParam: (last) => {
|
|
203
|
+
const m = last?.meta;
|
|
204
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
205
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
206
|
+
return next < m.total ? next : void 0;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function useKalshiOpenInterest(params) {
|
|
211
|
+
return useQuery3({
|
|
212
|
+
queryKey: ["kalshi-open-interest", params],
|
|
213
|
+
queryFn: () => proxyGet("kalshi/open-interest", params)
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function useKalshiPrices(params) {
|
|
217
|
+
return useQuery3({
|
|
218
|
+
queryKey: ["kalshi-prices", params],
|
|
219
|
+
queryFn: () => proxyGet("kalshi/prices", params)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function useInfiniteKalshiRanking(params) {
|
|
223
|
+
return useInfiniteQuery3({
|
|
224
|
+
queryKey: ["kalshi-ranking", params],
|
|
225
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("kalshi/ranking", { ...params, offset: String(pageParam) }),
|
|
226
|
+
initialPageParam: 0,
|
|
227
|
+
getNextPageParam: (last) => {
|
|
228
|
+
const m = last?.meta;
|
|
229
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
230
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
231
|
+
return next < m.total ? next : void 0;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function useInfiniteKalshiTrades(params) {
|
|
236
|
+
return useInfiniteQuery3({
|
|
237
|
+
queryKey: ["kalshi-trades", params],
|
|
238
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("kalshi/trades", { ...params, offset: String(pageParam) }),
|
|
239
|
+
initialPageParam: 0,
|
|
240
|
+
getNextPageParam: (last) => {
|
|
241
|
+
const m = last?.meta;
|
|
242
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
243
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
244
|
+
return next < m.total ? next : void 0;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function useKalshiVolumes(params) {
|
|
249
|
+
return useQuery3({
|
|
250
|
+
queryKey: ["kalshi-volumes", params],
|
|
251
|
+
queryFn: () => proxyGet("kalshi/volumes", params)
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/react/hooks/market.ts
|
|
256
|
+
import { useQuery as useQuery4, useInfiniteQuery as useInfiniteQuery4 } from "@tanstack/react-query";
|
|
257
|
+
function useMarketEtf(params) {
|
|
258
|
+
return useQuery4({
|
|
259
|
+
queryKey: ["market-etf", params],
|
|
260
|
+
queryFn: () => proxyGet("market/etf", params)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function useMarketFearGreed(params) {
|
|
264
|
+
return useQuery4({
|
|
265
|
+
queryKey: ["market-fear-greed", params],
|
|
266
|
+
queryFn: () => proxyGet("market/fear-greed", params)
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function useMarketFutures(params) {
|
|
270
|
+
return useQuery4({
|
|
271
|
+
queryKey: ["market-futures", params],
|
|
272
|
+
queryFn: () => proxyGet("market/futures", params)
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function useMarketLiquidationChart(params) {
|
|
276
|
+
return useQuery4({
|
|
277
|
+
queryKey: ["market-liquidation-chart", params],
|
|
278
|
+
queryFn: () => proxyGet("market/liquidation-chart", params)
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
function useMarketLiquidationExchangeList(params) {
|
|
282
|
+
return useQuery4({
|
|
283
|
+
queryKey: ["market-liquidation-exchange-list", params],
|
|
284
|
+
queryFn: () => proxyGet("market/liquidation-exchange-list", params)
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function useMarketLiquidationOrder(params) {
|
|
288
|
+
return useQuery4({
|
|
289
|
+
queryKey: ["market-liquidation-order", params],
|
|
290
|
+
queryFn: () => proxyGet("market/liquidation-order", params)
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function useMarketOnchainIndicator(params) {
|
|
294
|
+
return useQuery4({
|
|
295
|
+
queryKey: ["market-onchain-indicator", params],
|
|
296
|
+
queryFn: () => proxyGet("market/onchain-indicator", params)
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function useMarketOptions(params) {
|
|
300
|
+
return useQuery4({
|
|
301
|
+
queryKey: ["market-options", params],
|
|
302
|
+
queryFn: () => proxyGet("market/options", params)
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function useMarketPrice(params) {
|
|
306
|
+
return useQuery4({
|
|
307
|
+
queryKey: ["market-price", params],
|
|
308
|
+
queryFn: () => proxyGet("market/price", params)
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function useMarketPriceIndicator(params) {
|
|
312
|
+
return useQuery4({
|
|
313
|
+
queryKey: ["market-price-indicator", params],
|
|
314
|
+
queryFn: () => proxyGet("market/price-indicator", params)
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
function useInfiniteMarketRanking(params) {
|
|
318
|
+
return useInfiniteQuery4({
|
|
319
|
+
queryKey: ["market-ranking", params],
|
|
320
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("market/ranking", { ...params, offset: String(pageParam) }),
|
|
321
|
+
initialPageParam: 0,
|
|
322
|
+
getNextPageParam: (last) => {
|
|
323
|
+
const m = last?.meta;
|
|
324
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
325
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
326
|
+
return next < m.total ? next : void 0;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// src/react/hooks/news.ts
|
|
332
|
+
import { useQuery as useQuery5, useInfiniteQuery as useInfiniteQuery5 } from "@tanstack/react-query";
|
|
333
|
+
function useNewsDetail(params) {
|
|
334
|
+
return useQuery5({
|
|
335
|
+
queryKey: ["news-detail", params],
|
|
336
|
+
queryFn: () => proxyGet("news/detail", params)
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function useInfiniteNewsFeed(params) {
|
|
340
|
+
return useInfiniteQuery5({
|
|
341
|
+
queryKey: ["news-feed", params],
|
|
342
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("news/feed", { ...params, offset: String(pageParam) }),
|
|
343
|
+
initialPageParam: 0,
|
|
344
|
+
getNextPageParam: (last) => {
|
|
345
|
+
const m = last?.meta;
|
|
346
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
347
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
348
|
+
return next < m.total ? next : void 0;
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/react/hooks/onchain.ts
|
|
354
|
+
import { useQuery as useQuery6, useInfiniteQuery as useInfiniteQuery6 } from "@tanstack/react-query";
|
|
355
|
+
function useInfiniteOnchainBridgeRanking(params) {
|
|
356
|
+
return useInfiniteQuery6({
|
|
357
|
+
queryKey: ["onchain-bridge-ranking", params],
|
|
358
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("onchain/bridge-ranking", { ...params, offset: String(pageParam) }),
|
|
359
|
+
initialPageParam: 0,
|
|
360
|
+
getNextPageParam: (last) => {
|
|
361
|
+
const m = last?.meta;
|
|
362
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
363
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
364
|
+
return next < m.total ? next : void 0;
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function useOnchainGasPrice(params) {
|
|
369
|
+
return useQuery6({
|
|
370
|
+
queryKey: ["onchain-gas-price", params],
|
|
371
|
+
queryFn: () => proxyGet("onchain/gas-price", params)
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function useOnchainStructuredQuery(params) {
|
|
375
|
+
return useQuery6({
|
|
376
|
+
queryKey: ["onchain-structured-query", params],
|
|
377
|
+
queryFn: () => proxyPost("onchain/structured-query", params)
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
function useOnchainSchema() {
|
|
381
|
+
return useQuery6({
|
|
382
|
+
queryKey: ["onchain-schema"],
|
|
383
|
+
queryFn: () => proxyGet("onchain/schema")
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
function useOnchainSql(params) {
|
|
387
|
+
return useQuery6({
|
|
388
|
+
queryKey: ["onchain-sql", params],
|
|
389
|
+
queryFn: () => proxyPost("onchain/sql", params)
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function useOnchainTx(params) {
|
|
393
|
+
return useQuery6({
|
|
394
|
+
queryKey: ["onchain-tx", params],
|
|
395
|
+
queryFn: () => proxyGet("onchain/tx", params)
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
function useInfiniteOnchainYieldRanking(params) {
|
|
399
|
+
return useInfiniteQuery6({
|
|
400
|
+
queryKey: ["onchain-yield-ranking", params],
|
|
401
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("onchain/yield-ranking", { ...params, offset: String(pageParam) }),
|
|
402
|
+
initialPageParam: 0,
|
|
403
|
+
getNextPageParam: (last) => {
|
|
404
|
+
const m = last?.meta;
|
|
405
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
406
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
407
|
+
return next < m.total ? next : void 0;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// src/react/hooks/polymarket.ts
|
|
413
|
+
import { useQuery as useQuery7, useInfiniteQuery as useInfiniteQuery7 } from "@tanstack/react-query";
|
|
414
|
+
function useInfinitePolymarketActivity(params) {
|
|
415
|
+
return useInfiniteQuery7({
|
|
416
|
+
queryKey: ["polymarket-activity", params],
|
|
417
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("polymarket/activity", { ...params, offset: String(pageParam) }),
|
|
418
|
+
initialPageParam: 0,
|
|
419
|
+
getNextPageParam: (last) => {
|
|
420
|
+
const m = last?.meta;
|
|
421
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
422
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
423
|
+
return next < m.total ? next : void 0;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function useInfinitePolymarketEvents(params) {
|
|
428
|
+
return useInfiniteQuery7({
|
|
429
|
+
queryKey: ["polymarket-events", params],
|
|
430
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("polymarket/events", { ...params, offset: String(pageParam) }),
|
|
431
|
+
initialPageParam: 0,
|
|
432
|
+
getNextPageParam: (last) => {
|
|
433
|
+
const m = last?.meta;
|
|
434
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
435
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
436
|
+
return next < m.total ? next : void 0;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
function useInfinitePolymarketMarkets(params) {
|
|
441
|
+
return useInfiniteQuery7({
|
|
442
|
+
queryKey: ["polymarket-markets", params],
|
|
443
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("polymarket/markets", { ...params, offset: String(pageParam) }),
|
|
444
|
+
initialPageParam: 0,
|
|
445
|
+
getNextPageParam: (last) => {
|
|
446
|
+
const m = last?.meta;
|
|
447
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
448
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
449
|
+
return next < m.total ? next : void 0;
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
function usePolymarketOpenInterest(params) {
|
|
454
|
+
return useQuery7({
|
|
455
|
+
queryKey: ["polymarket-open-interest", params],
|
|
456
|
+
queryFn: () => proxyGet("polymarket/open-interest", params)
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
function useInfinitePolymarketPositions(params) {
|
|
460
|
+
return useInfiniteQuery7({
|
|
461
|
+
queryKey: ["polymarket-positions", params],
|
|
462
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("polymarket/positions", { ...params, offset: String(pageParam) }),
|
|
463
|
+
initialPageParam: 0,
|
|
464
|
+
getNextPageParam: (last) => {
|
|
465
|
+
const m = last?.meta;
|
|
466
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
467
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
468
|
+
return next < m.total ? next : void 0;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function usePolymarketPrices(params) {
|
|
473
|
+
return useQuery7({
|
|
474
|
+
queryKey: ["polymarket-prices", params],
|
|
475
|
+
queryFn: () => proxyGet("polymarket/prices", params)
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
function useInfinitePolymarketRanking(params) {
|
|
479
|
+
return useInfiniteQuery7({
|
|
480
|
+
queryKey: ["polymarket-ranking", params],
|
|
481
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("polymarket/ranking", { ...params, offset: String(pageParam) }),
|
|
482
|
+
initialPageParam: 0,
|
|
483
|
+
getNextPageParam: (last) => {
|
|
484
|
+
const m = last?.meta;
|
|
485
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
486
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
487
|
+
return next < m.total ? next : void 0;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
function useInfinitePolymarketTrades(params) {
|
|
492
|
+
return useInfiniteQuery7({
|
|
493
|
+
queryKey: ["polymarket-trades", params],
|
|
494
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("polymarket/trades", { ...params, offset: String(pageParam) }),
|
|
495
|
+
initialPageParam: 0,
|
|
496
|
+
getNextPageParam: (last) => {
|
|
497
|
+
const m = last?.meta;
|
|
498
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
499
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
500
|
+
return next < m.total ? next : void 0;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
function usePolymarketVolumes(params) {
|
|
505
|
+
return useQuery7({
|
|
506
|
+
queryKey: ["polymarket-volumes", params],
|
|
507
|
+
queryFn: () => proxyGet("polymarket/volumes", params)
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// src/react/hooks/prediction_market.ts
|
|
512
|
+
import { useInfiniteQuery as useInfiniteQuery8 } from "@tanstack/react-query";
|
|
513
|
+
function useInfinitePredictionMarketCategoryMetrics(params) {
|
|
514
|
+
return useInfiniteQuery8({
|
|
515
|
+
queryKey: ["prediction-market-category-metrics", params],
|
|
516
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("prediction-market/category-metrics", { ...params, offset: String(pageParam) }),
|
|
517
|
+
initialPageParam: 0,
|
|
518
|
+
getNextPageParam: (last) => {
|
|
519
|
+
const m = last?.meta;
|
|
520
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
521
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
522
|
+
return next < m.total ? next : void 0;
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// src/react/hooks/project.ts
|
|
528
|
+
import { useQuery as useQuery9, useInfiniteQuery as useInfiniteQuery9 } from "@tanstack/react-query";
|
|
529
|
+
function useInfiniteProjectDefiMetrics(params) {
|
|
530
|
+
return useInfiniteQuery9({
|
|
531
|
+
queryKey: ["project-defi-metrics", params],
|
|
532
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("project/defi-metrics", { ...params, offset: String(pageParam) }),
|
|
533
|
+
initialPageParam: 0,
|
|
534
|
+
getNextPageParam: (last) => {
|
|
535
|
+
const m = last?.meta;
|
|
536
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
537
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
538
|
+
return next < m.total ? next : void 0;
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
function useInfiniteProjectDefiRanking(params) {
|
|
543
|
+
return useInfiniteQuery9({
|
|
544
|
+
queryKey: ["project-defi-ranking", params],
|
|
545
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("project/defi-ranking", { ...params, offset: String(pageParam) }),
|
|
546
|
+
initialPageParam: 0,
|
|
547
|
+
getNextPageParam: (last) => {
|
|
548
|
+
const m = last?.meta;
|
|
549
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
550
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
551
|
+
return next < m.total ? next : void 0;
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function useProjectDetail(params) {
|
|
556
|
+
return useQuery9({
|
|
557
|
+
queryKey: ["project-detail", params],
|
|
558
|
+
queryFn: () => proxyGet("project/detail", params)
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// src/react/hooks/search.ts
|
|
563
|
+
import { useQuery as useQuery10, useInfiniteQuery as useInfiniteQuery10 } from "@tanstack/react-query";
|
|
564
|
+
function useInfiniteSearchAirdrop(params) {
|
|
565
|
+
return useInfiniteQuery10({
|
|
566
|
+
queryKey: ["search-airdrop", params],
|
|
567
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/airdrop", { ...params, offset: String(pageParam) }),
|
|
568
|
+
initialPageParam: 0,
|
|
569
|
+
getNextPageParam: (last) => {
|
|
570
|
+
const m = last?.meta;
|
|
571
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
572
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
573
|
+
return next < m.total ? next : void 0;
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
function useInfiniteSearchEvents(params) {
|
|
578
|
+
return useInfiniteQuery10({
|
|
579
|
+
queryKey: ["search-events", params],
|
|
580
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/events", { ...params, offset: String(pageParam) }),
|
|
581
|
+
initialPageParam: 0,
|
|
582
|
+
getNextPageParam: (last) => {
|
|
583
|
+
const m = last?.meta;
|
|
584
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
585
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
586
|
+
return next < m.total ? next : void 0;
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
function useInfiniteSearchFund(params) {
|
|
591
|
+
return useInfiniteQuery10({
|
|
592
|
+
queryKey: ["search-fund", params],
|
|
593
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/fund", { ...params, offset: String(pageParam) }),
|
|
594
|
+
initialPageParam: 0,
|
|
595
|
+
getNextPageParam: (last) => {
|
|
596
|
+
const m = last?.meta;
|
|
597
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
598
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
599
|
+
return next < m.total ? next : void 0;
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function useInfiniteSearchKalshi(params) {
|
|
604
|
+
return useInfiniteQuery10({
|
|
605
|
+
queryKey: ["search-kalshi", params],
|
|
606
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/kalshi", { ...params, offset: String(pageParam) }),
|
|
607
|
+
initialPageParam: 0,
|
|
608
|
+
getNextPageParam: (last) => {
|
|
609
|
+
const m = last?.meta;
|
|
610
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
611
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
612
|
+
return next < m.total ? next : void 0;
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
function useSearchNews(params) {
|
|
617
|
+
return useQuery10({
|
|
618
|
+
queryKey: ["search-news", params],
|
|
619
|
+
queryFn: () => proxyGet("search/news", params)
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
function useInfiniteSearchPolymarket(params) {
|
|
623
|
+
return useInfiniteQuery10({
|
|
624
|
+
queryKey: ["search-polymarket", params],
|
|
625
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/polymarket", { ...params, offset: String(pageParam) }),
|
|
626
|
+
initialPageParam: 0,
|
|
627
|
+
getNextPageParam: (last) => {
|
|
628
|
+
const m = last?.meta;
|
|
629
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
630
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
631
|
+
return next < m.total ? next : void 0;
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
function useInfiniteSearchProject(params) {
|
|
636
|
+
return useInfiniteQuery10({
|
|
637
|
+
queryKey: ["search-project", params],
|
|
638
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/project", { ...params, offset: String(pageParam) }),
|
|
639
|
+
initialPageParam: 0,
|
|
640
|
+
getNextPageParam: (last) => {
|
|
641
|
+
const m = last?.meta;
|
|
642
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
643
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
644
|
+
return next < m.total ? next : void 0;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
function useInfiniteSearchSocialPeople(params) {
|
|
649
|
+
return useInfiniteQuery10({
|
|
650
|
+
queryKey: ["search-social-people", params],
|
|
651
|
+
queryFn: ({ pageParam }) => proxyGet("search/social-people", { ...params, cursor: pageParam || void 0 }),
|
|
652
|
+
initialPageParam: "",
|
|
653
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function useInfiniteSearchSocialPosts(params) {
|
|
657
|
+
return useInfiniteQuery10({
|
|
658
|
+
queryKey: ["search-social-posts", params],
|
|
659
|
+
queryFn: ({ pageParam }) => proxyGet("search/social-posts", { ...params, cursor: pageParam || void 0 }),
|
|
660
|
+
initialPageParam: "",
|
|
661
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
function useInfiniteSearchWallet(params) {
|
|
665
|
+
return useInfiniteQuery10({
|
|
666
|
+
queryKey: ["search-wallet", params],
|
|
667
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/wallet", { ...params, offset: String(pageParam) }),
|
|
668
|
+
initialPageParam: 0,
|
|
669
|
+
getNextPageParam: (last) => {
|
|
670
|
+
const m = last?.meta;
|
|
671
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
672
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
673
|
+
return next < m.total ? next : void 0;
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
function useInfiniteSearchWeb(params) {
|
|
678
|
+
return useInfiniteQuery10({
|
|
679
|
+
queryKey: ["search-web", params],
|
|
680
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("search/web", { ...params, offset: String(pageParam) }),
|
|
681
|
+
initialPageParam: 0,
|
|
682
|
+
getNextPageParam: (last) => {
|
|
683
|
+
const m = last?.meta;
|
|
684
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
685
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
686
|
+
return next < m.total ? next : void 0;
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// src/react/hooks/social.ts
|
|
692
|
+
import { useQuery as useQuery11, useInfiniteQuery as useInfiniteQuery11 } from "@tanstack/react-query";
|
|
693
|
+
function useSocialDetail(params) {
|
|
694
|
+
return useQuery11({
|
|
695
|
+
queryKey: ["social-detail", params],
|
|
696
|
+
queryFn: () => proxyGet("social/detail", params)
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
function useSocialMindshare(params) {
|
|
700
|
+
return useQuery11({
|
|
701
|
+
queryKey: ["social-mindshare", params],
|
|
702
|
+
queryFn: () => proxyGet("social/mindshare", params)
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
function useInfiniteSocialRanking(params) {
|
|
706
|
+
return useInfiniteQuery11({
|
|
707
|
+
queryKey: ["social-ranking", params],
|
|
708
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("social/ranking", { ...params, offset: String(pageParam) }),
|
|
709
|
+
initialPageParam: 0,
|
|
710
|
+
getNextPageParam: (last) => {
|
|
711
|
+
const m = last?.meta;
|
|
712
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
713
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
714
|
+
return next < m.total ? next : void 0;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
function useSocialSmartFollowersHistory(params) {
|
|
719
|
+
return useQuery11({
|
|
720
|
+
queryKey: ["social-smart-followers-history", params],
|
|
721
|
+
queryFn: () => proxyGet("social/smart-followers-history", params)
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
function useInfiniteSocialTweetReplies(params) {
|
|
725
|
+
return useInfiniteQuery11({
|
|
726
|
+
queryKey: ["social-tweet-replies", params],
|
|
727
|
+
queryFn: ({ pageParam }) => proxyGet("social/tweet-replies", { ...params, cursor: pageParam || void 0 }),
|
|
728
|
+
initialPageParam: "",
|
|
729
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
function useSocialTweets(params) {
|
|
733
|
+
return useQuery11({
|
|
734
|
+
queryKey: ["social-tweets", params],
|
|
735
|
+
queryFn: () => proxyGet("social/tweets", params)
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
function useSocialUser(params) {
|
|
739
|
+
return useQuery11({
|
|
740
|
+
queryKey: ["social-user", params],
|
|
741
|
+
queryFn: () => proxyGet("social/user", params)
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
function useInfiniteSocialUserFollowers(params) {
|
|
745
|
+
return useInfiniteQuery11({
|
|
746
|
+
queryKey: ["social-user-followers", params],
|
|
747
|
+
queryFn: ({ pageParam }) => proxyGet("social/user-followers", { ...params, cursor: pageParam || void 0 }),
|
|
748
|
+
initialPageParam: "",
|
|
749
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
function useInfiniteSocialUserFollowing(params) {
|
|
753
|
+
return useInfiniteQuery11({
|
|
754
|
+
queryKey: ["social-user-following", params],
|
|
755
|
+
queryFn: ({ pageParam }) => proxyGet("social/user-following", { ...params, cursor: pageParam || void 0 }),
|
|
756
|
+
initialPageParam: "",
|
|
757
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
function useInfiniteSocialUserPosts(params) {
|
|
761
|
+
return useInfiniteQuery11({
|
|
762
|
+
queryKey: ["social-user-posts", params],
|
|
763
|
+
queryFn: ({ pageParam }) => proxyGet("social/user-posts", { ...params, cursor: pageParam || void 0 }),
|
|
764
|
+
initialPageParam: "",
|
|
765
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
function useInfiniteSocialUserReplies(params) {
|
|
769
|
+
return useInfiniteQuery11({
|
|
770
|
+
queryKey: ["social-user-replies", params],
|
|
771
|
+
queryFn: ({ pageParam }) => proxyGet("social/user-replies", { ...params, cursor: pageParam || void 0 }),
|
|
772
|
+
initialPageParam: "",
|
|
773
|
+
getNextPageParam: (last) => last?.meta?.has_more ? last.meta.next_cursor : void 0
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// src/react/hooks/token.ts
|
|
778
|
+
import { useQuery as useQuery12, useInfiniteQuery as useInfiniteQuery12 } from "@tanstack/react-query";
|
|
779
|
+
function useInfiniteTokenDexTrades(params) {
|
|
780
|
+
return useInfiniteQuery12({
|
|
781
|
+
queryKey: ["token-dex-trades", params],
|
|
782
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("token/dex-trades", { ...params, offset: String(pageParam) }),
|
|
783
|
+
initialPageParam: 0,
|
|
784
|
+
getNextPageParam: (last) => {
|
|
785
|
+
const m = last?.meta;
|
|
786
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
787
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
788
|
+
return next < m.total ? next : void 0;
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
function useInfiniteTokenHolders(params) {
|
|
793
|
+
return useInfiniteQuery12({
|
|
794
|
+
queryKey: ["token-holders", params],
|
|
795
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("token/holders", { ...params, offset: String(pageParam) }),
|
|
796
|
+
initialPageParam: 0,
|
|
797
|
+
getNextPageParam: (last) => {
|
|
798
|
+
const m = last?.meta;
|
|
799
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
800
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
801
|
+
return next < m.total ? next : void 0;
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
function useTokenTokenomics(params) {
|
|
806
|
+
return useQuery12({
|
|
807
|
+
queryKey: ["token-tokenomics", params],
|
|
808
|
+
queryFn: () => proxyGet("token/tokenomics", params)
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
function useInfiniteTokenTransfers(params) {
|
|
812
|
+
return useInfiniteQuery12({
|
|
813
|
+
queryKey: ["token-transfers", params],
|
|
814
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("token/transfers", { ...params, offset: String(pageParam) }),
|
|
815
|
+
initialPageParam: 0,
|
|
816
|
+
getNextPageParam: (last) => {
|
|
817
|
+
const m = last?.meta;
|
|
818
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
819
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
820
|
+
return next < m.total ? next : void 0;
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// src/react/hooks/wallet.ts
|
|
826
|
+
import { useQuery as useQuery13, useInfiniteQuery as useInfiniteQuery13 } from "@tanstack/react-query";
|
|
827
|
+
function useWalletDetail(params) {
|
|
828
|
+
return useQuery13({
|
|
829
|
+
queryKey: ["wallet-detail", params],
|
|
830
|
+
queryFn: () => proxyGet("wallet/detail", params)
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function useInfiniteWalletHistory(params) {
|
|
834
|
+
return useInfiniteQuery13({
|
|
835
|
+
queryKey: ["wallet-history", params],
|
|
836
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("wallet/history", { ...params, offset: String(pageParam) }),
|
|
837
|
+
initialPageParam: 0,
|
|
838
|
+
getNextPageParam: (last) => {
|
|
839
|
+
const m = last?.meta;
|
|
840
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
841
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
842
|
+
return next < m.total ? next : void 0;
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
function useWalletLabelsBatch(params) {
|
|
847
|
+
return useQuery13({
|
|
848
|
+
queryKey: ["wallet-labels-batch", params],
|
|
849
|
+
queryFn: () => proxyGet("wallet/labels-batch", params)
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
function useWalletNetWorth(params) {
|
|
853
|
+
return useQuery13({
|
|
854
|
+
queryKey: ["wallet-net-worth", params],
|
|
855
|
+
queryFn: () => proxyGet("wallet/net-worth", params)
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function useInfiniteWalletProtocols(params) {
|
|
859
|
+
return useInfiniteQuery13({
|
|
860
|
+
queryKey: ["wallet-protocols", params],
|
|
861
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("wallet/protocols", { ...params, offset: String(pageParam) }),
|
|
862
|
+
initialPageParam: 0,
|
|
863
|
+
getNextPageParam: (last) => {
|
|
864
|
+
const m = last?.meta;
|
|
865
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
866
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
867
|
+
return next < m.total ? next : void 0;
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
function useInfiniteWalletTransfers(params) {
|
|
872
|
+
return useInfiniteQuery13({
|
|
873
|
+
queryKey: ["wallet-transfers", params],
|
|
874
|
+
queryFn: ({ pageParam = 0 }) => proxyGet("wallet/transfers", { ...params, offset: String(pageParam) }),
|
|
875
|
+
initialPageParam: 0,
|
|
876
|
+
getNextPageParam: (last) => {
|
|
877
|
+
const m = last?.meta;
|
|
878
|
+
if (!m?.total || !m?.limit) return void 0;
|
|
879
|
+
const next = (m.offset ?? 0) + m.limit;
|
|
880
|
+
return next < m.total ? next : void 0;
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
// src/react/hooks/web.ts
|
|
886
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
887
|
+
function useWebFetch(params) {
|
|
888
|
+
return useQuery14({
|
|
889
|
+
queryKey: ["web-fetch", params],
|
|
890
|
+
queryFn: () => proxyGet("web/fetch", params)
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
export {
|
|
894
|
+
cn,
|
|
895
|
+
toast,
|
|
896
|
+
useExchangeDepth,
|
|
897
|
+
useExchangeFundingHistory,
|
|
898
|
+
useExchangeKlines,
|
|
899
|
+
useExchangeLongShortRatio,
|
|
900
|
+
useExchangeMarkets,
|
|
901
|
+
useExchangePerp,
|
|
902
|
+
useExchangePrice,
|
|
903
|
+
useFundDetail,
|
|
904
|
+
useInfiniteFundPortfolio,
|
|
905
|
+
useInfiniteFundRanking,
|
|
906
|
+
useInfiniteKalshiEvents,
|
|
907
|
+
useInfiniteKalshiMarkets,
|
|
908
|
+
useInfiniteKalshiRanking,
|
|
909
|
+
useInfiniteKalshiTrades,
|
|
910
|
+
useInfiniteMarketRanking,
|
|
911
|
+
useInfiniteNewsFeed,
|
|
912
|
+
useInfiniteOnchainBridgeRanking,
|
|
913
|
+
useInfiniteOnchainYieldRanking,
|
|
914
|
+
useInfinitePolymarketActivity,
|
|
915
|
+
useInfinitePolymarketEvents,
|
|
916
|
+
useInfinitePolymarketMarkets,
|
|
917
|
+
useInfinitePolymarketPositions,
|
|
918
|
+
useInfinitePolymarketRanking,
|
|
919
|
+
useInfinitePolymarketTrades,
|
|
920
|
+
useInfinitePredictionMarketCategoryMetrics,
|
|
921
|
+
useInfiniteProjectDefiMetrics,
|
|
922
|
+
useInfiniteProjectDefiRanking,
|
|
923
|
+
useInfiniteSearchAirdrop,
|
|
924
|
+
useInfiniteSearchEvents,
|
|
925
|
+
useInfiniteSearchFund,
|
|
926
|
+
useInfiniteSearchKalshi,
|
|
927
|
+
useInfiniteSearchPolymarket,
|
|
928
|
+
useInfiniteSearchProject,
|
|
929
|
+
useInfiniteSearchSocialPeople,
|
|
930
|
+
useInfiniteSearchSocialPosts,
|
|
931
|
+
useInfiniteSearchWallet,
|
|
932
|
+
useInfiniteSearchWeb,
|
|
933
|
+
useInfiniteSocialRanking,
|
|
934
|
+
useInfiniteSocialTweetReplies,
|
|
935
|
+
useInfiniteSocialUserFollowers,
|
|
936
|
+
useInfiniteSocialUserFollowing,
|
|
937
|
+
useInfiniteSocialUserPosts,
|
|
938
|
+
useInfiniteSocialUserReplies,
|
|
939
|
+
useInfiniteTokenDexTrades,
|
|
940
|
+
useInfiniteTokenHolders,
|
|
941
|
+
useInfiniteTokenTransfers,
|
|
942
|
+
useInfiniteWalletHistory,
|
|
943
|
+
useInfiniteWalletProtocols,
|
|
944
|
+
useInfiniteWalletTransfers,
|
|
945
|
+
useKalshiOpenInterest,
|
|
946
|
+
useKalshiPrices,
|
|
947
|
+
useKalshiVolumes,
|
|
948
|
+
useMarketEtf,
|
|
949
|
+
useMarketFearGreed,
|
|
950
|
+
useMarketFutures,
|
|
951
|
+
useMarketLiquidationChart,
|
|
952
|
+
useMarketLiquidationExchangeList,
|
|
953
|
+
useMarketLiquidationOrder,
|
|
954
|
+
useMarketOnchainIndicator,
|
|
955
|
+
useMarketOptions,
|
|
956
|
+
useMarketPrice,
|
|
957
|
+
useMarketPriceIndicator,
|
|
958
|
+
useNewsDetail,
|
|
959
|
+
useOnchainGasPrice,
|
|
960
|
+
useOnchainSchema,
|
|
961
|
+
useOnchainSql,
|
|
962
|
+
useOnchainStructuredQuery,
|
|
963
|
+
useOnchainTx,
|
|
964
|
+
usePolymarketOpenInterest,
|
|
965
|
+
usePolymarketPrices,
|
|
966
|
+
usePolymarketVolumes,
|
|
967
|
+
useProjectDetail,
|
|
968
|
+
useSearchNews,
|
|
969
|
+
useSocialDetail,
|
|
970
|
+
useSocialMindshare,
|
|
971
|
+
useSocialSmartFollowersHistory,
|
|
972
|
+
useSocialTweets,
|
|
973
|
+
useSocialUser,
|
|
974
|
+
useToast,
|
|
975
|
+
useTokenTokenomics,
|
|
976
|
+
useWalletDetail,
|
|
977
|
+
useWalletLabelsBatch,
|
|
978
|
+
useWalletNetWorth,
|
|
979
|
+
useWebFetch
|
|
980
|
+
};
|