@liberfi.io/hooks 0.1.1
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/index.d.mts +349 -0
- package/dist/index.d.ts +349 -0
- package/dist/index.js +885 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +789 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +87 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { PropsWithChildren, RefObject, useLayoutEffect } from 'react';
|
|
3
|
+
import { API, Chain, Token, TokenResolution, TokenCandle, TokenHolder, TokenMarketData, TokenSecurity, TokenStats, TradeActivity, WalletPortfolios } from '@liberfi.io/types';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
+
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
7
|
+
import * as _liberfi_io_core from '@liberfi.io/core';
|
|
8
|
+
import { WalletAdapter, EventEmitter, SimpleDI } from '@liberfi.io/core';
|
|
9
|
+
export { default as useConstant } from 'use-constant';
|
|
10
|
+
export * from 'use-debounce';
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
interface Window {
|
|
14
|
+
__LIBERFI_VERSION__?: {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const _default: "0.1.0";
|
|
20
|
+
|
|
21
|
+
interface APIClientContextValue {
|
|
22
|
+
client: API.IClient;
|
|
23
|
+
subscribeClient: API.ISubscribeClient;
|
|
24
|
+
}
|
|
25
|
+
declare const APIClientContext: react.Context<APIClientContextValue>;
|
|
26
|
+
|
|
27
|
+
type APIClientProviderProps = PropsWithChildren<APIClientContextValue>;
|
|
28
|
+
declare function APIClientProvider({ client, subscribeClient, children, }: APIClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
|
|
30
|
+
declare function useAPIClient(): APIClientContextValue;
|
|
31
|
+
|
|
32
|
+
interface UseFinalStretchTokensQueryParams extends API.GetTokenListOptions {
|
|
33
|
+
chain: Chain;
|
|
34
|
+
}
|
|
35
|
+
declare function finalStretchTokensQueryKey(params: UseFinalStretchTokensQueryParams): string[];
|
|
36
|
+
declare function fetchFinalStretchTokens(client: API.IClient, { chain, ...options }: UseFinalStretchTokensQueryParams): Promise<Token[]>;
|
|
37
|
+
declare function useFinalStretchTokensQuery(params: UseFinalStretchTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
38
|
+
|
|
39
|
+
interface UseMigratedTokensQueryParams extends API.GetTokenListOptions {
|
|
40
|
+
chain: Chain;
|
|
41
|
+
}
|
|
42
|
+
declare function migratedTokensQueryKey(params: UseMigratedTokensQueryParams): string[];
|
|
43
|
+
declare function fetchMigratedTokens(client: API.IClient, { chain, ...options }: UseMigratedTokensQueryParams): Promise<Token[]>;
|
|
44
|
+
declare function useMigratedTokensQuery(params: UseMigratedTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
45
|
+
|
|
46
|
+
interface UseNewTokensQueryParams extends API.GetTokenListOptions {
|
|
47
|
+
chain: Chain;
|
|
48
|
+
}
|
|
49
|
+
declare function newTokensQueryKey(params: UseNewTokensQueryParams): string[];
|
|
50
|
+
declare function fetchNewTokens(client: API.IClient, { chain, ...options }: UseNewTokensQueryParams): Promise<Token[]>;
|
|
51
|
+
declare function useNewTokensQuery(params: UseNewTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
52
|
+
|
|
53
|
+
declare function fetchPresignedUploadUrl(client: API.IClient): Promise<string>;
|
|
54
|
+
declare function usePresignedUploadUrlQuery(options?: Omit<UseQueryOptions<string, Error, string, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<string, Error>;
|
|
55
|
+
|
|
56
|
+
type UseSearchTokensQueryParams = API.SearchTokensOptions;
|
|
57
|
+
declare function searchTokensQueryKey(params: UseSearchTokensQueryParams): string[];
|
|
58
|
+
declare function fetchSearchTokens(client: API.IClient, params: UseSearchTokensQueryParams): Promise<API.SearchTokenCursorList>;
|
|
59
|
+
declare function useSearchTokensQuery(params: UseSearchTokensQueryParams, options?: Omit<UseQueryOptions<API.SearchTokenCursorList, Error, API.SearchTokenCursorList, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<API.SearchTokenCursorList, Error>;
|
|
60
|
+
|
|
61
|
+
type UseSendTxMutationParams = API.SendTxParams;
|
|
62
|
+
declare function sendTx(client: API.IClient, params: UseSendTxMutationParams): Promise<API.SendTxResult>;
|
|
63
|
+
declare function useSendTxMutation(options?: Omit<UseMutationOptions<API.SendTxResult, Error, UseSendTxMutationParams>, "mutationFn">): _tanstack_react_query.UseMutationResult<API.SendTxResult, Error, API.SendTxParams, unknown>;
|
|
64
|
+
|
|
65
|
+
interface UseStockTokensQueryParams extends API.GetTokenListOptions {
|
|
66
|
+
chain: Chain;
|
|
67
|
+
}
|
|
68
|
+
declare function stockTokensQueryKey(params: UseStockTokensQueryParams): string[];
|
|
69
|
+
declare function fetchStockTokens(client: API.IClient, { chain, ...options }: UseStockTokensQueryParams): Promise<Token[]>;
|
|
70
|
+
declare function useStockTokensQuery(params: UseStockTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
71
|
+
|
|
72
|
+
type UseSwapRouteQueryParams = API.SwapParams;
|
|
73
|
+
declare function swapRouteQueryKey(params: UseSwapRouteQueryParams): string[];
|
|
74
|
+
declare function fetchSwapRoute(client: API.IClient, params: UseSwapRouteQueryParams): Promise<API.SwapRoute>;
|
|
75
|
+
declare function useSwapRouteQuery(params: UseSwapRouteQueryParams, options?: Omit<UseQueryOptions<API.SwapRoute, Error, API.SwapRoute, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<API.SwapRoute, Error>;
|
|
76
|
+
|
|
77
|
+
interface UseTokenCandlesQueryParams extends API.GetTokenCandlesOptions {
|
|
78
|
+
chain: Chain;
|
|
79
|
+
address: string;
|
|
80
|
+
resolution: TokenResolution;
|
|
81
|
+
}
|
|
82
|
+
declare function tokenCandlesQueryKey(params: UseTokenCandlesQueryParams): string[];
|
|
83
|
+
declare function fetchTokenCandles(client: API.IClient, { chain, address, resolution, ...options }: UseTokenCandlesQueryParams): Promise<TokenCandle[]>;
|
|
84
|
+
declare function useTokenCandlesQuery(params: UseTokenCandlesQueryParams, options?: Omit<UseQueryOptions<Array<TokenCandle>, Error, Array<TokenCandle>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenCandle[], Error>;
|
|
85
|
+
|
|
86
|
+
interface UseTokenHoldersQueryParams extends API.CursorListOptions {
|
|
87
|
+
chain: Chain;
|
|
88
|
+
address: string;
|
|
89
|
+
}
|
|
90
|
+
declare function tokenHoldersQueryKey(params: UseTokenHoldersQueryParams): string[];
|
|
91
|
+
declare function fetchTokenHolders(client: API.IClient, { chain, address, ...options }: UseTokenHoldersQueryParams): Promise<API.CursorList<TokenHolder>>;
|
|
92
|
+
declare function useTokenHoldersQuery(params: UseTokenHoldersQueryParams, options?: Omit<UseQueryOptions<API.CursorList<TokenHolder>, Error, API.CursorList<TokenHolder>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<API.CursorList<TokenHolder>, Error>;
|
|
93
|
+
|
|
94
|
+
interface UseTokenMarketDataQueryParams {
|
|
95
|
+
chain: Chain;
|
|
96
|
+
address: string;
|
|
97
|
+
}
|
|
98
|
+
declare function tokenMarketDataQueryKey(params: UseTokenMarketDataQueryParams): string[];
|
|
99
|
+
declare function fetchTokenMarketData(client: API.IClient, { chain, address }: UseTokenMarketDataQueryParams): Promise<TokenMarketData>;
|
|
100
|
+
declare function useTokenMarketDataQuery(params: UseTokenMarketDataQueryParams, options?: Omit<UseQueryOptions<TokenMarketData, Error, TokenMarketData, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenMarketData, Error>;
|
|
101
|
+
|
|
102
|
+
interface UseTokenQueryParams {
|
|
103
|
+
chain: Chain;
|
|
104
|
+
address: string;
|
|
105
|
+
}
|
|
106
|
+
declare function tokenQueryKey(params: UseTokenQueryParams): string[];
|
|
107
|
+
declare function fetchToken(client: API.IClient, { chain, address }: UseTokenQueryParams): Promise<Token>;
|
|
108
|
+
declare function useTokenQuery(params: UseTokenQueryParams, options?: Omit<UseQueryOptions<Token, Error, Token, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token, Error>;
|
|
109
|
+
|
|
110
|
+
interface UseTokenSecurityQueryParams {
|
|
111
|
+
chain: Chain;
|
|
112
|
+
address: string;
|
|
113
|
+
}
|
|
114
|
+
declare function tokenSecurityQueryKey(params: UseTokenSecurityQueryParams): string[];
|
|
115
|
+
declare function fetchTokenSecurity(client: API.IClient, { chain, address }: UseTokenSecurityQueryParams): Promise<TokenSecurity>;
|
|
116
|
+
declare function useTokenSecurityQuery(params: UseTokenSecurityQueryParams, options?: Omit<UseQueryOptions<TokenSecurity, Error, TokenSecurity, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenSecurity, Error>;
|
|
117
|
+
|
|
118
|
+
interface UseTokensQueryParams {
|
|
119
|
+
chain: Chain;
|
|
120
|
+
addresses: Array<string>;
|
|
121
|
+
}
|
|
122
|
+
declare function tokensQueryKey(params: UseTokensQueryParams): string[];
|
|
123
|
+
declare function fetchTokens(client: API.IClient, { chain, addresses }: UseTokensQueryParams): Promise<Token[]>;
|
|
124
|
+
declare function useTokensQuery(params: UseTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
125
|
+
|
|
126
|
+
interface UseTokenStatsQueryParams {
|
|
127
|
+
chain: Chain;
|
|
128
|
+
address: string;
|
|
129
|
+
}
|
|
130
|
+
declare function tokenStatsQueryKey(params: UseTokenStatsQueryParams): string[];
|
|
131
|
+
declare function fetchTokenStats(client: API.IClient, { chain, address }: UseTokenStatsQueryParams): Promise<TokenStats>;
|
|
132
|
+
declare function useTokenStatsQuery(params: UseTokenStatsQueryParams, options?: Omit<UseQueryOptions<TokenStats, Error, TokenStats, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenStats, Error>;
|
|
133
|
+
|
|
134
|
+
interface UseTokenTradeActivitiesQueryParams extends API.GetTradeActivitiesOptions {
|
|
135
|
+
chain: Chain;
|
|
136
|
+
address: string;
|
|
137
|
+
}
|
|
138
|
+
declare function tokenTradeActivitiesQueryKey(params: UseTokenTradeActivitiesQueryParams): string[];
|
|
139
|
+
declare function fetchTokenTradeActivities(client: API.IClient, { chain, address, ...options }: UseTokenTradeActivitiesQueryParams): Promise<API.CursorList<TradeActivity>>;
|
|
140
|
+
declare function useTokenTradeActivitiesQuery(params: UseTokenTradeActivitiesQueryParams, options?: Omit<UseQueryOptions<API.CursorList<TradeActivity>, Error, API.CursorList<TradeActivity>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<API.CursorList<TradeActivity>, Error>;
|
|
141
|
+
|
|
142
|
+
interface UseTrendingTokensQueryParams extends API.GetTokenListOptions {
|
|
143
|
+
chain: Chain;
|
|
144
|
+
resolution: "1m" | "5m" | "1h" | "4h" | "24h";
|
|
145
|
+
}
|
|
146
|
+
declare function trendingTokensQueryKey(params: UseTrendingTokensQueryParams): string[];
|
|
147
|
+
declare function fetchTrendingTokens(client: API.IClient, { chain, resolution, ...options }: UseTrendingTokensQueryParams): Promise<Token[]>;
|
|
148
|
+
declare function useTrendingTokensQuery(params: UseTrendingTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
149
|
+
|
|
150
|
+
interface UseTxSuccessQueryParams {
|
|
151
|
+
chain: Chain;
|
|
152
|
+
txHash: string;
|
|
153
|
+
timeout?: number;
|
|
154
|
+
}
|
|
155
|
+
declare function txSuccessQueryKey(params: UseTxSuccessQueryParams): string[];
|
|
156
|
+
declare function fetchTxSuccess(client: API.IClient, { chain, txHash, timeout }: UseTxSuccessQueryParams): Promise<boolean>;
|
|
157
|
+
declare function useTxSuccessQuery(params: UseTxSuccessQueryParams, options?: Omit<UseQueryOptions<boolean, Error, boolean, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<boolean, Error>;
|
|
158
|
+
|
|
159
|
+
interface UseWalletPortfoliosQueryParams {
|
|
160
|
+
chain: Chain;
|
|
161
|
+
address: string;
|
|
162
|
+
}
|
|
163
|
+
declare function walletPortfoliosQueryKey(params: UseWalletPortfoliosQueryParams): string[];
|
|
164
|
+
declare function fetchWalletPortfolios(client: API.IClient, { chain, address }: UseWalletPortfoliosQueryParams): Promise<WalletPortfolios>;
|
|
165
|
+
declare function useWalletPortfoliosQuery(params: UseWalletPortfoliosQueryParams, options?: Omit<UseQueryOptions<WalletPortfolios, Error, WalletPortfolios, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<WalletPortfolios, Error>;
|
|
166
|
+
|
|
167
|
+
interface UseWalletTradeActivitiesQueryParams extends API.GetTradeActivitiesOptions {
|
|
168
|
+
chain: Chain;
|
|
169
|
+
address: string;
|
|
170
|
+
}
|
|
171
|
+
declare function walletTradeActivitiesQueryKey(params: UseWalletTradeActivitiesQueryParams): string[];
|
|
172
|
+
declare function fetchWalletTradeActivities(client: API.IClient, { chain, address, ...options }: UseWalletTradeActivitiesQueryParams): Promise<API.CursorList<TradeActivity>>;
|
|
173
|
+
declare function useWalletTradeActivitiesQuery(params: UseWalletTradeActivitiesQueryParams, options?: Omit<UseQueryOptions<API.CursorList<TradeActivity>, Error, API.CursorList<TradeActivity>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<API.CursorList<TradeActivity>, Error>;
|
|
174
|
+
|
|
175
|
+
interface WalletConnectorContextValue {
|
|
176
|
+
/**
|
|
177
|
+
* detecting: is detecting connected wallets
|
|
178
|
+
* connecting: is connecting to the first wallet
|
|
179
|
+
* connected: is connected to at least one wallet
|
|
180
|
+
* disconnecting: is disconnecting from the last connected wallet
|
|
181
|
+
* disconnected: is disconnected from all wallets
|
|
182
|
+
*/
|
|
183
|
+
status: "detecting" | "connecting" | "connected" | "disconnecting" | "disconnected";
|
|
184
|
+
wallets: Array<WalletAdapter>;
|
|
185
|
+
connect: () => Promise<void>;
|
|
186
|
+
disconnect: () => Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
declare const WalletConnectorContext: react.Context<WalletConnectorContextValue>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* use wallet connector hook
|
|
192
|
+
* @returns wallet connector
|
|
193
|
+
*/
|
|
194
|
+
declare function useWalletConnector(): WalletConnectorContextValue;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* use wallets hook
|
|
198
|
+
* @returns all wallets that can be used to take onchain actions
|
|
199
|
+
*/
|
|
200
|
+
declare function useWallets(): _liberfi_io_core.WalletAdapter[];
|
|
201
|
+
|
|
202
|
+
type WalletConnectorProviderProps = PropsWithChildren<WalletConnectorContextValue>;
|
|
203
|
+
declare function WalletConnectorProvider({ children, ...value }: WalletConnectorProviderProps): react_jsx_runtime.JSX.Element;
|
|
204
|
+
|
|
205
|
+
type UseBooleanReturn = [
|
|
206
|
+
/** current state */
|
|
207
|
+
boolean,
|
|
208
|
+
{
|
|
209
|
+
/** set state to true */
|
|
210
|
+
setTrue: () => void;
|
|
211
|
+
/** set state to false */
|
|
212
|
+
setFalse: () => void;
|
|
213
|
+
/** toggle state */
|
|
214
|
+
toggle: () => void;
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
/**
|
|
218
|
+
* Hook to manage a boolean state
|
|
219
|
+
* @param initialValue Initial value of the boolean
|
|
220
|
+
* @returns
|
|
221
|
+
*/
|
|
222
|
+
declare const useBoolean: (initialValue?: boolean) => UseBooleanReturn;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* React hook to persist any value between renders,
|
|
226
|
+
* but keeps it up-to-date if it changes.
|
|
227
|
+
* @param fn the function to persist
|
|
228
|
+
* @param deps the function dependency list
|
|
229
|
+
*/
|
|
230
|
+
declare function useCallbackRef<T extends (...args: any[]) => any>(fn: T | undefined, deps?: React.DependencyList): T;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Custom hook that determines if the component is currently mounted.
|
|
234
|
+
* @example
|
|
235
|
+
* ```tsx
|
|
236
|
+
* const isComponentMounted = useIsMounted();
|
|
237
|
+
* // Use isComponentMounted() to check if the component is currently mounted before performing certain actions.
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
declare function useIsMounted(): () => boolean;
|
|
241
|
+
|
|
242
|
+
/** The size of the observed element. */
|
|
243
|
+
type Size = {
|
|
244
|
+
/** The width of the observed element. */
|
|
245
|
+
width: number | undefined;
|
|
246
|
+
/** The height of the observed element. */
|
|
247
|
+
height: number | undefined;
|
|
248
|
+
};
|
|
249
|
+
/** The options for the ResizeObserver. */
|
|
250
|
+
type UseResizeObserverOptions<T extends HTMLElement = HTMLElement> = {
|
|
251
|
+
/** The ref of the element to observe. */
|
|
252
|
+
ref: RefObject<T | null>;
|
|
253
|
+
/**
|
|
254
|
+
* When using `onResize`, the hook doesn't re-render on element size changes; it delegates handling to the provided callback.
|
|
255
|
+
* @default undefined
|
|
256
|
+
*/
|
|
257
|
+
onResize?: (size: Size) => void;
|
|
258
|
+
/**
|
|
259
|
+
* The box model to use for the ResizeObserver.
|
|
260
|
+
* @default 'content-box'
|
|
261
|
+
*/
|
|
262
|
+
box?: "border-box" | "content-box" | "device-pixel-content-box";
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Custom hook that observes the size of an element using the [`ResizeObserver API`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).
|
|
266
|
+
* @template T - The type of the element to observe.
|
|
267
|
+
* @see [Documentation](https://usehooks-ts.com/react-hook/use-resize-observer)
|
|
268
|
+
* @example
|
|
269
|
+
* ```tsx
|
|
270
|
+
* const myRef = useRef(null);
|
|
271
|
+
* const { width = 0, height = 0 } = useResizeObserver({
|
|
272
|
+
* ref: myRef,
|
|
273
|
+
* box: 'content-box',
|
|
274
|
+
* });
|
|
275
|
+
*
|
|
276
|
+
* <div ref={myRef}>Hello, world!</div>
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
declare function useResizeObserver<T extends HTMLElement = HTMLElement>(options: UseResizeObserverOptions<T>): Size;
|
|
280
|
+
|
|
281
|
+
declare const useSafeLayoutEffect: typeof useLayoutEffect;
|
|
282
|
+
|
|
283
|
+
type TickEvent = {
|
|
284
|
+
/** delta time in milliseconds since last tick */
|
|
285
|
+
delta: number;
|
|
286
|
+
/** current timestamp in milliseconds */
|
|
287
|
+
now: number;
|
|
288
|
+
};
|
|
289
|
+
type TickCallback = (event: TickEvent) => void;
|
|
290
|
+
type UnsubscribeTick = () => void;
|
|
291
|
+
/**
|
|
292
|
+
* Hook to call a callback at specified interval
|
|
293
|
+
* @param callback Function to call at specified interval
|
|
294
|
+
* @param interval Interval in milliseconds (default: 1000ms)
|
|
295
|
+
* @returns
|
|
296
|
+
*/
|
|
297
|
+
declare function useTick(callback: TickCallback, interval?: number): void;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Hook to get the age in milliseconds since birthday in every tick
|
|
301
|
+
* @param birthday Timestamp in milliseconds or Date object (default: now)
|
|
302
|
+
* @param interval Tick interval in milliseconds (default: 1000ms)
|
|
303
|
+
* @returns age in milliseconds since birthday
|
|
304
|
+
*/
|
|
305
|
+
declare function useTickAge(birthday?: number | Date, interval?: number): number;
|
|
306
|
+
|
|
307
|
+
type NotFunction<T> = T extends (...args: any[]) => any ? never : T;
|
|
308
|
+
declare const useUpdatedRef: <T>(val: NotFunction<T>) => react.RefObject<T>;
|
|
309
|
+
|
|
310
|
+
type noop = (this: any, ...args: any[]) => any;
|
|
311
|
+
type PickFunction<T extends noop> = (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
|
|
312
|
+
declare const useMemoizedFn: <T extends noop>(fn: T) => PickFunction<T>;
|
|
313
|
+
|
|
314
|
+
interface AudioPlayerOptions {
|
|
315
|
+
volume?: number;
|
|
316
|
+
loop?: boolean;
|
|
317
|
+
autoPlay?: boolean;
|
|
318
|
+
}
|
|
319
|
+
declare const useAudioPlayer: (src: string, options?: AudioPlayerOptions) => readonly [react__default.DetailedReactHTMLElement<{
|
|
320
|
+
controls: boolean;
|
|
321
|
+
ref: react__default.RefObject<HTMLAudioElement | null>;
|
|
322
|
+
autoPlay: boolean | undefined;
|
|
323
|
+
src: string;
|
|
324
|
+
style: {
|
|
325
|
+
display: "none";
|
|
326
|
+
};
|
|
327
|
+
onPlay: () => void;
|
|
328
|
+
onPlaying: () => void;
|
|
329
|
+
onPause: () => void;
|
|
330
|
+
onEnded: () => void;
|
|
331
|
+
onError: () => void;
|
|
332
|
+
}, HTMLAudioElement>, react__default.RefObject<HTMLAudioElement | null>, "error" | "paused" | "idle" | "play" | "playing" | "ended"];
|
|
333
|
+
|
|
334
|
+
declare const useEventEmitter: () => EventEmitter<string | symbol, any>;
|
|
335
|
+
|
|
336
|
+
declare function useSessionStorage<T>(key: string, initialValue: T): [T, (data: any) => void];
|
|
337
|
+
|
|
338
|
+
declare function parseJSON<T>(value: string | null): T | undefined;
|
|
339
|
+
|
|
340
|
+
declare function useLocalStorage<T>(key: string, initialValue: T, options?: {
|
|
341
|
+
parseJSON: typeof parseJSON;
|
|
342
|
+
}): [any, (value: T) => void];
|
|
343
|
+
|
|
344
|
+
declare const useSimpleDI: <T>() => {
|
|
345
|
+
get: (name: string) => T;
|
|
346
|
+
register: typeof SimpleDI.register;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export { APIClientContext, type APIClientContextValue, APIClientProvider, type APIClientProviderProps, type TickCallback, type TickEvent, type UnsubscribeTick, type UseBooleanReturn, type UseFinalStretchTokensQueryParams, type UseMigratedTokensQueryParams, type UseNewTokensQueryParams, type UseResizeObserverOptions, type UseSearchTokensQueryParams, type UseSendTxMutationParams, type UseStockTokensQueryParams, type UseSwapRouteQueryParams, type UseTokenCandlesQueryParams, type UseTokenHoldersQueryParams, type UseTokenMarketDataQueryParams, type UseTokenQueryParams, type UseTokenSecurityQueryParams, type UseTokenStatsQueryParams, type UseTokenTradeActivitiesQueryParams, type UseTokensQueryParams, type UseTrendingTokensQueryParams, type UseTxSuccessQueryParams, type UseWalletPortfoliosQueryParams, type UseWalletTradeActivitiesQueryParams, WalletConnectorContext, type WalletConnectorContextValue, WalletConnectorProvider, type WalletConnectorProviderProps, fetchFinalStretchTokens, fetchMigratedTokens, fetchNewTokens, fetchPresignedUploadUrl, fetchSearchTokens, fetchStockTokens, fetchSwapRoute, fetchToken, fetchTokenCandles, fetchTokenHolders, fetchTokenMarketData, fetchTokenSecurity, fetchTokenStats, fetchTokenTradeActivities, fetchTokens, fetchTrendingTokens, fetchTxSuccess, fetchWalletPortfolios, fetchWalletTradeActivities, finalStretchTokensQueryKey, migratedTokensQueryKey, newTokensQueryKey, parseJSON, searchTokensQueryKey, sendTx, stockTokensQueryKey, swapRouteQueryKey, tokenCandlesQueryKey, tokenHoldersQueryKey, tokenMarketDataQueryKey, tokenQueryKey, tokenSecurityQueryKey, tokenStatsQueryKey, tokenTradeActivitiesQueryKey, tokensQueryKey, trendingTokensQueryKey, txSuccessQueryKey, useAPIClient, useAudioPlayer, useBoolean, useCallbackRef, useEventEmitter, useFinalStretchTokensQuery, useIsMounted, useLocalStorage, useMemoizedFn, useMigratedTokensQuery, useNewTokensQuery, usePresignedUploadUrlQuery, useResizeObserver, useSafeLayoutEffect, useSearchTokensQuery, useSendTxMutation, useSessionStorage, useSimpleDI, useStockTokensQuery, useSwapRouteQuery, useTick, useTickAge, useTokenCandlesQuery, useTokenHoldersQuery, useTokenMarketDataQuery, useTokenQuery, useTokenSecurityQuery, useTokenStatsQuery, useTokenTradeActivitiesQuery, useTokensQuery, useTrendingTokensQuery, useTxSuccessQuery, useUpdatedRef, useWalletConnector, useWalletPortfoliosQuery, useWalletTradeActivitiesQuery, useWallets, _default as version, walletPortfoliosQueryKey, walletTradeActivitiesQueryKey };
|