@liberfi.io/react 0.1.2 → 0.1.4
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 +251 -119
- package/dist/index.d.ts +251 -119
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,310 +1,442 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import * as _liberfi_io_types from '@liberfi.io/types';
|
|
4
|
-
import { API, Chain, Token, TokenResolution, TokenCandle, TokenHolder, TokenMarketData, TokenSecurity, TokenStats,
|
|
4
|
+
import { API, Chain, Token, TokenResolution, TokenCandle, TokenHolder, TokenMarketData, TokenSecurity, TokenStats, Trade, WalletPnl, WalletPortfolioPnls, WalletPortfolios, Portfolio, PortfolioPnl, Activity } from '@liberfi.io/types';
|
|
5
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
-
import { UseQueryOptions, UseMutationOptions
|
|
6
|
+
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
__LIBERFI_VERSION__?: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Default prefix prepended to every TanStack Query key produced by hooks in
|
|
19
|
+
* this package. Can be overridden via
|
|
20
|
+
* `<DexClientProvider queryKeyPrefix="...">`.
|
|
21
|
+
*/
|
|
22
|
+
declare const DEFAULT_QUERY_KEY_PREFIX = "liberfi";
|
|
23
|
+
/**
|
|
24
|
+
* Shape of the context value provided by `DexClientProvider` and consumed by
|
|
25
|
+
* `useDexClient`.
|
|
26
|
+
*/
|
|
9
27
|
interface DexClientContextValue {
|
|
28
|
+
/** REST / HTTP client implementing `API.IClient`. */
|
|
10
29
|
client: API.IClient;
|
|
30
|
+
/** WebSocket subscription client implementing `API.ISubscribeClient`. */
|
|
11
31
|
subscribeClient: API.ISubscribeClient;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
/** Prefix used in all query keys produced by hooks. */
|
|
33
|
+
queryKeyPrefix: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Internal React context. Use `DexClientProvider` to supply the value and
|
|
37
|
+
* `useDexClient()` to consume it.
|
|
38
|
+
*/
|
|
39
|
+
declare const DexClientContext: react.Context<DexClientContextValue | null>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns the `DexClientContextValue` provided by `DexClientProvider`.
|
|
43
|
+
*
|
|
44
|
+
* @throws If called outside a `DexClientProvider`.
|
|
45
|
+
*/
|
|
15
46
|
declare function useDexClient(): DexClientContextValue;
|
|
16
47
|
|
|
48
|
+
interface SubscriptionOptions {
|
|
49
|
+
/** Set to `false` to pause the subscription. Defaults to `true`. */
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
/** Called when the subscription encounters an error. */
|
|
52
|
+
onError?: (error: Error) => void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Serialises a primitive value (or Date) into a stable string for use in query
|
|
57
|
+
* keys. `undefined` and `null` map to `""`.
|
|
58
|
+
*/
|
|
59
|
+
declare function toKeySegment(value: string | number | boolean | Date | undefined | null): string;
|
|
60
|
+
/**
|
|
61
|
+
* Serialises an array value into a stable, sorted JSON string for use in
|
|
62
|
+
* query keys.
|
|
63
|
+
*/
|
|
64
|
+
declare function toSortedKeySegment(value: unknown[] | undefined | null): string;
|
|
65
|
+
|
|
66
|
+
/** Parameters for {@link useFinalStretchTokensQuery}. */
|
|
17
67
|
interface UseFinalStretchTokensQueryParams extends API.GetTokenListOptions {
|
|
18
68
|
chain: Chain;
|
|
19
69
|
}
|
|
20
|
-
declare
|
|
21
|
-
declare
|
|
22
|
-
declare
|
|
70
|
+
declare const finalStretchTokensQueryKey: (params: UseFinalStretchTokensQueryParams, prefix?: string) => string[];
|
|
71
|
+
declare const fetchFinalStretchTokens: (client: API.IClient, params: UseFinalStretchTokensQueryParams) => Promise<Token[]>;
|
|
72
|
+
declare const useFinalStretchTokensQuery: (params: UseFinalStretchTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token[], Error, Token[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
23
73
|
|
|
74
|
+
/** Parameters for {@link useMigratedTokensQuery}. */
|
|
24
75
|
interface UseMigratedTokensQueryParams extends API.GetTokenListOptions {
|
|
25
76
|
chain: Chain;
|
|
26
77
|
}
|
|
27
|
-
declare
|
|
28
|
-
declare
|
|
29
|
-
declare
|
|
78
|
+
declare const migratedTokensQueryKey: (params: UseMigratedTokensQueryParams, prefix?: string) => string[];
|
|
79
|
+
declare const fetchMigratedTokens: (client: API.IClient, params: UseMigratedTokensQueryParams) => Promise<Token[]>;
|
|
80
|
+
declare const useMigratedTokensQuery: (params: UseMigratedTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token[], Error, Token[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
30
81
|
|
|
82
|
+
/** Parameters for {@link useNewTokensQuery}. */
|
|
31
83
|
interface UseNewTokensQueryParams extends API.GetTokenListOptions {
|
|
32
84
|
chain: Chain;
|
|
33
85
|
}
|
|
34
|
-
declare
|
|
35
|
-
declare
|
|
36
|
-
declare
|
|
86
|
+
declare const newTokensQueryKey: (params: UseNewTokensQueryParams, prefix?: string) => string[];
|
|
87
|
+
declare const fetchNewTokens: (client: API.IClient, params: UseNewTokensQueryParams) => Promise<Token[]>;
|
|
88
|
+
declare const useNewTokensQuery: (params: UseNewTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token[], Error, Token[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
37
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Builds the query key for `usePresignedUploadUrlQuery`.
|
|
92
|
+
*
|
|
93
|
+
* @param prefix - Override the default query key prefix.
|
|
94
|
+
*/
|
|
95
|
+
declare function presignedUploadUrlQueryKey(prefix?: string): string[];
|
|
96
|
+
/** Fetches a presigned upload URL (for use outside React). */
|
|
38
97
|
declare function fetchPresignedUploadUrl(client: API.IClient): Promise<string>;
|
|
98
|
+
/** Fetches a one-time presigned upload URL. `staleTime` defaults to `0`. */
|
|
39
99
|
declare function usePresignedUploadUrlQuery(options?: Omit<UseQueryOptions<string, Error, string, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<string, Error>;
|
|
40
100
|
|
|
41
101
|
type UseSearchTokensQueryParams = API.SearchTokensOptions;
|
|
42
|
-
declare
|
|
43
|
-
declare
|
|
44
|
-
declare
|
|
102
|
+
declare const searchTokensQueryKey: (params: _liberfi_io_types.SearchTokensOptions, prefix?: string) => string[];
|
|
103
|
+
declare const fetchSearchTokens: (client: API.IClient, params: _liberfi_io_types.SearchTokensOptions) => Promise<_liberfi_io_types.SearchTokenCursorList>;
|
|
104
|
+
declare const useSearchTokensQuery: (params: _liberfi_io_types.SearchTokensOptions, options?: Omit<_tanstack_react_query.UseQueryOptions<_liberfi_io_types.SearchTokenCursorList, Error, _liberfi_io_types.SearchTokenCursorList, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<_liberfi_io_types.SearchTokenCursorList, Error>;
|
|
45
105
|
|
|
46
106
|
type UseSendTxMutationParams = API.SendTxParams;
|
|
107
|
+
/** Sends a transaction via the API client (for use outside React). */
|
|
47
108
|
declare function sendTx(client: API.IClient, params: UseSendTxMutationParams): Promise<_liberfi_io_types.SendTxResult>;
|
|
109
|
+
/** Mutation hook that sends a transaction. */
|
|
48
110
|
declare function useSendTxMutation(options?: Omit<UseMutationOptions<API.SendTxResult, Error, UseSendTxMutationParams>, "mutationFn">): _tanstack_react_query.UseMutationResult<_liberfi_io_types.SendTxResult, Error, _liberfi_io_types.SendTxParams, unknown>;
|
|
49
111
|
|
|
112
|
+
/** Parameters for {@link useStockTokensQuery}. */
|
|
50
113
|
interface UseStockTokensQueryParams extends API.GetTokenListOptions {
|
|
51
114
|
chain: Chain;
|
|
52
115
|
}
|
|
53
|
-
declare
|
|
54
|
-
declare
|
|
55
|
-
declare
|
|
116
|
+
declare const stockTokensQueryKey: (params: UseStockTokensQueryParams, prefix?: string) => string[];
|
|
117
|
+
declare const fetchStockTokens: (client: API.IClient, params: UseStockTokensQueryParams) => Promise<Token[]>;
|
|
118
|
+
declare const useStockTokensQuery: (params: UseStockTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token[], Error, Token[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
56
119
|
|
|
57
120
|
type UseSwapRouteQueryParams = API.SwapParams;
|
|
58
|
-
declare
|
|
59
|
-
declare
|
|
60
|
-
declare
|
|
121
|
+
declare const swapRouteQueryKey: (params: _liberfi_io_types.SwapParams, prefix?: string) => string[];
|
|
122
|
+
declare const fetchSwapRoute: (client: API.IClient, params: _liberfi_io_types.SwapParams) => Promise<_liberfi_io_types.SwapRoute>;
|
|
123
|
+
declare const useSwapRouteQuery: (params: _liberfi_io_types.SwapParams, options?: Omit<_tanstack_react_query.UseQueryOptions<_liberfi_io_types.SwapRoute, Error, _liberfi_io_types.SwapRoute, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<_liberfi_io_types.SwapRoute, Error>;
|
|
61
124
|
|
|
125
|
+
/** Parameters for {@link useTokenCandlesQuery}. */
|
|
62
126
|
interface UseTokenCandlesQueryParams extends API.GetTokenCandlesOptions {
|
|
63
127
|
chain: Chain;
|
|
64
128
|
address: string;
|
|
65
129
|
resolution: TokenResolution;
|
|
66
130
|
}
|
|
67
|
-
declare
|
|
68
|
-
declare
|
|
69
|
-
declare
|
|
131
|
+
declare const tokenCandlesQueryKey: (params: UseTokenCandlesQueryParams, prefix?: string) => string[];
|
|
132
|
+
declare const fetchTokenCandles: (client: API.IClient, params: UseTokenCandlesQueryParams) => Promise<TokenCandle[]>;
|
|
133
|
+
declare const useTokenCandlesQuery: (params: UseTokenCandlesQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<TokenCandle[], Error, TokenCandle[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<TokenCandle[], Error>;
|
|
70
134
|
|
|
135
|
+
/** Parameters for {@link useTokenHoldersQuery}. */
|
|
71
136
|
interface UseTokenHoldersQueryParams extends API.CursorListOptions {
|
|
72
137
|
chain: Chain;
|
|
73
138
|
address: string;
|
|
74
139
|
}
|
|
75
|
-
declare
|
|
76
|
-
declare
|
|
77
|
-
declare
|
|
140
|
+
declare const tokenHoldersQueryKey: (params: UseTokenHoldersQueryParams, prefix?: string) => string[];
|
|
141
|
+
declare const fetchTokenHolders: (client: API.IClient, params: UseTokenHoldersQueryParams) => Promise<API.CursorList<TokenHolder>>;
|
|
142
|
+
declare const useTokenHoldersQuery: (params: UseTokenHoldersQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<API.CursorList<TokenHolder>, Error, API.CursorList<TokenHolder>, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<API.CursorList<TokenHolder>, Error>;
|
|
78
143
|
|
|
144
|
+
/** Parameters for {@link useTokenMarketDataQuery}. */
|
|
79
145
|
interface UseTokenMarketDataQueryParams {
|
|
80
146
|
chain: Chain;
|
|
81
147
|
address: string;
|
|
82
148
|
}
|
|
83
|
-
declare
|
|
84
|
-
declare
|
|
85
|
-
declare
|
|
149
|
+
declare const tokenMarketDataQueryKey: (params: UseTokenMarketDataQueryParams, prefix?: string) => string[];
|
|
150
|
+
declare const fetchTokenMarketData: (client: _liberfi_io_types.IClient, params: UseTokenMarketDataQueryParams) => Promise<TokenMarketData>;
|
|
151
|
+
declare const useTokenMarketDataQuery: (params: UseTokenMarketDataQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<TokenMarketData, Error, TokenMarketData, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<TokenMarketData, Error>;
|
|
86
152
|
|
|
153
|
+
/** Parameters for {@link useTokenQuery}. */
|
|
87
154
|
interface UseTokenQueryParams {
|
|
88
155
|
chain: Chain;
|
|
89
156
|
address: string;
|
|
90
157
|
}
|
|
91
|
-
declare
|
|
92
|
-
declare
|
|
93
|
-
declare
|
|
158
|
+
declare const tokenQueryKey: (params: UseTokenQueryParams, prefix?: string) => string[];
|
|
159
|
+
declare const fetchToken: (client: _liberfi_io_types.IClient, params: UseTokenQueryParams) => Promise<Token>;
|
|
160
|
+
declare const useTokenQuery: (params: UseTokenQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token, Error, Token, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token, Error>;
|
|
94
161
|
|
|
162
|
+
/** Parameters for {@link useTokenSecurityQuery}. */
|
|
95
163
|
interface UseTokenSecurityQueryParams {
|
|
96
164
|
chain: Chain;
|
|
97
165
|
address: string;
|
|
98
166
|
}
|
|
99
|
-
declare
|
|
100
|
-
declare
|
|
101
|
-
declare
|
|
167
|
+
declare const tokenSecurityQueryKey: (params: UseTokenSecurityQueryParams, prefix?: string) => string[];
|
|
168
|
+
declare const fetchTokenSecurity: (client: _liberfi_io_types.IClient, params: UseTokenSecurityQueryParams) => Promise<TokenSecurity>;
|
|
169
|
+
declare const useTokenSecurityQuery: (params: UseTokenSecurityQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<TokenSecurity, Error, TokenSecurity, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<TokenSecurity, Error>;
|
|
102
170
|
|
|
171
|
+
/** Parameters for {@link useTokensQuery}. */
|
|
103
172
|
interface UseTokensQueryParams {
|
|
104
173
|
chain: Chain;
|
|
105
174
|
addresses: Array<string>;
|
|
106
175
|
}
|
|
107
|
-
declare
|
|
108
|
-
declare
|
|
109
|
-
declare
|
|
176
|
+
declare const tokensQueryKey: (params: UseTokensQueryParams, prefix?: string) => string[];
|
|
177
|
+
declare const fetchTokens: (client: _liberfi_io_types.IClient, params: UseTokensQueryParams) => Promise<Token[]>;
|
|
178
|
+
declare const useTokensQuery: (params: UseTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token[], Error, Token[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
110
179
|
|
|
180
|
+
/** Parameters for {@link useTokenStatsQuery}. */
|
|
111
181
|
interface UseTokenStatsQueryParams {
|
|
112
182
|
chain: Chain;
|
|
113
183
|
address: string;
|
|
114
184
|
}
|
|
115
|
-
declare
|
|
116
|
-
declare
|
|
117
|
-
declare
|
|
185
|
+
declare const tokenStatsQueryKey: (params: UseTokenStatsQueryParams, prefix?: string) => string[];
|
|
186
|
+
declare const fetchTokenStats: (client: _liberfi_io_types.IClient, params: UseTokenStatsQueryParams) => Promise<TokenStats>;
|
|
187
|
+
declare const useTokenStatsQuery: (params: UseTokenStatsQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<TokenStats, Error, TokenStats, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<TokenStats, Error>;
|
|
118
188
|
|
|
119
|
-
|
|
189
|
+
/** Parameters for {@link useTokenTradesQuery}. */
|
|
190
|
+
interface UseTokenTradesQueryParams extends API.GetTradesOptions {
|
|
120
191
|
chain: Chain;
|
|
121
192
|
address: string;
|
|
122
193
|
}
|
|
123
|
-
declare
|
|
124
|
-
declare
|
|
125
|
-
declare
|
|
194
|
+
declare const tokenTradesQueryKey: (params: UseTokenTradesQueryParams, prefix?: string) => string[];
|
|
195
|
+
declare const fetchTokenTrades: (client: API.IClient, params: UseTokenTradesQueryParams) => Promise<API.CursorList<Trade>>;
|
|
196
|
+
declare const useTokenTradesQuery: (params: UseTokenTradesQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<API.CursorList<Trade>, Error, API.CursorList<Trade>, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<API.CursorList<Trade>, Error>;
|
|
126
197
|
|
|
198
|
+
/** Parameters for {@link useTrendingTokensQuery}. */
|
|
127
199
|
interface UseTrendingTokensQueryParams extends API.GetTokenListOptions {
|
|
128
200
|
chain: Chain;
|
|
129
201
|
resolution: "1m" | "5m" | "1h" | "4h" | "24h";
|
|
130
202
|
}
|
|
131
|
-
declare
|
|
132
|
-
declare
|
|
133
|
-
declare
|
|
203
|
+
declare const trendingTokensQueryKey: (params: UseTrendingTokensQueryParams, prefix?: string) => string[];
|
|
204
|
+
declare const fetchTrendingTokens: (client: API.IClient, params: UseTrendingTokensQueryParams) => Promise<Token[]>;
|
|
205
|
+
declare const useTrendingTokensQuery: (params: UseTrendingTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Token[], Error, Token[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
134
206
|
|
|
207
|
+
/** Parameters for {@link useTxSuccessQuery}. */
|
|
135
208
|
interface UseTxSuccessQueryParams {
|
|
136
209
|
chain: Chain;
|
|
137
210
|
txHash: string;
|
|
138
211
|
timeout?: number;
|
|
139
212
|
}
|
|
140
|
-
declare
|
|
141
|
-
declare
|
|
142
|
-
declare
|
|
213
|
+
declare const txSuccessQueryKey: (params: UseTxSuccessQueryParams, prefix?: string) => string[];
|
|
214
|
+
declare const fetchTxSuccess: (client: _liberfi_io_types.IClient, params: UseTxSuccessQueryParams) => Promise<boolean>;
|
|
215
|
+
declare const useTxSuccessQuery: (params: UseTxSuccessQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<boolean, Error, boolean, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<boolean, Error>;
|
|
143
216
|
|
|
217
|
+
/** Parameters for {@link useWalletPnlQuery}. */
|
|
144
218
|
interface UseWalletPnlQueryParams {
|
|
145
219
|
chain: Chain;
|
|
146
220
|
address: string;
|
|
147
221
|
resolution?: string;
|
|
148
222
|
}
|
|
149
|
-
declare
|
|
150
|
-
declare
|
|
151
|
-
declare
|
|
223
|
+
declare const walletPnlQueryKey: (params: UseWalletPnlQueryParams, prefix?: string) => string[];
|
|
224
|
+
declare const fetchWalletPnl: (client: _liberfi_io_types.IClient, params: UseWalletPnlQueryParams) => Promise<WalletPnl>;
|
|
225
|
+
declare const useWalletPnlQuery: (params: UseWalletPnlQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<WalletPnl, Error, WalletPnl, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<WalletPnl, Error>;
|
|
152
226
|
|
|
227
|
+
/** Parameters for {@link useWalletPortfolioPnlsQuery}. */
|
|
153
228
|
interface UseWalletPortfolioPnlsQueryParams {
|
|
154
229
|
chain: Chain;
|
|
155
230
|
address: string;
|
|
156
231
|
cursor?: string;
|
|
157
232
|
limit?: number;
|
|
158
233
|
}
|
|
159
|
-
declare
|
|
160
|
-
declare
|
|
161
|
-
declare
|
|
234
|
+
declare const walletPortfolioPnlsQueryKey: (params: UseWalletPortfolioPnlsQueryParams, prefix?: string) => string[];
|
|
235
|
+
declare const fetchWalletPortfolioPnls: (client: _liberfi_io_types.IClient, params: UseWalletPortfolioPnlsQueryParams) => Promise<WalletPortfolioPnls>;
|
|
236
|
+
declare const useWalletPortfolioPnlsQuery: (params: UseWalletPortfolioPnlsQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<WalletPortfolioPnls, Error, WalletPortfolioPnls, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<WalletPortfolioPnls, Error>;
|
|
162
237
|
|
|
238
|
+
/** Parameters for {@link useWalletPortfolioPnlsInfiniteQuery}. */
|
|
163
239
|
interface UseWalletPortfolioPnlsInfiniteQueryParams {
|
|
164
240
|
chain: Chain;
|
|
165
241
|
address: string;
|
|
166
242
|
limit?: number;
|
|
167
243
|
}
|
|
168
|
-
declare
|
|
169
|
-
declare
|
|
244
|
+
declare const walletPortfolioPnlsInfiniteQueryKey: (params: UseWalletPortfolioPnlsInfiniteQueryParams, prefix?: string) => string[];
|
|
245
|
+
declare const useWalletPortfolioPnlsInfiniteQuery: (params: UseWalletPortfolioPnlsInfiniteQueryParams, options?: Omit<_tanstack_react_query.UseInfiniteQueryOptions<WalletPortfolioPnls, Error, _tanstack_react_query.InfiniteData<WalletPortfolioPnls, unknown>, string[], string | undefined>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam"> | undefined) => _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<WalletPortfolioPnls, unknown>, Error>;
|
|
170
246
|
|
|
247
|
+
/** Parameters for {@link useWalletPortfoliosQuery}. */
|
|
171
248
|
interface UseWalletPortfoliosQueryParams {
|
|
172
249
|
chain: Chain;
|
|
173
250
|
address: string;
|
|
174
251
|
cursor?: string;
|
|
175
252
|
limit?: number;
|
|
176
253
|
}
|
|
177
|
-
declare
|
|
178
|
-
declare
|
|
179
|
-
declare
|
|
254
|
+
declare const walletPortfoliosQueryKey: (params: UseWalletPortfoliosQueryParams, prefix?: string) => string[];
|
|
255
|
+
declare const fetchWalletPortfolios: (client: _liberfi_io_types.IClient, params: UseWalletPortfoliosQueryParams) => Promise<WalletPortfolios>;
|
|
256
|
+
declare const useWalletPortfoliosQuery: (params: UseWalletPortfoliosQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<WalletPortfolios, Error, WalletPortfolios, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<WalletPortfolios, Error>;
|
|
180
257
|
|
|
258
|
+
/** Parameters for {@link useWalletPortfoliosByTokensQuery}. */
|
|
181
259
|
interface UseWalletPortfoliosByTokensQueryParams {
|
|
182
260
|
chain: Chain;
|
|
183
261
|
address: string;
|
|
184
262
|
tokenAddresses: Array<string>;
|
|
185
263
|
}
|
|
186
|
-
declare
|
|
187
|
-
declare
|
|
188
|
-
declare
|
|
264
|
+
declare const walletPortfoliosByTokensQueryKey: (params: UseWalletPortfoliosByTokensQueryParams, prefix?: string) => string[];
|
|
265
|
+
declare const fetchWalletPortfoliosByTokens: (client: _liberfi_io_types.IClient, params: UseWalletPortfoliosByTokensQueryParams) => Promise<Portfolio[]>;
|
|
266
|
+
declare const useWalletPortfoliosByTokensQuery: (params: UseWalletPortfoliosByTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<Portfolio[], Error, Portfolio[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<Portfolio[], Error>;
|
|
189
267
|
|
|
268
|
+
/** Parameters for {@link useWalletPortfoliosInfiniteQuery}. */
|
|
190
269
|
interface UseWalletPortfoliosInfiniteQueryParams {
|
|
191
270
|
chain: Chain;
|
|
192
271
|
address: string;
|
|
193
272
|
limit?: number;
|
|
194
273
|
}
|
|
195
|
-
declare
|
|
196
|
-
declare
|
|
274
|
+
declare const walletPortfoliosInfiniteQueryKey: (params: UseWalletPortfoliosInfiniteQueryParams, prefix?: string) => string[];
|
|
275
|
+
declare const useWalletPortfoliosInfiniteQuery: (params: UseWalletPortfoliosInfiniteQueryParams, options?: Omit<_tanstack_react_query.UseInfiniteQueryOptions<WalletPortfolios, Error, _tanstack_react_query.InfiniteData<WalletPortfolios, unknown>, string[], string | undefined>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam"> | undefined) => _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<WalletPortfolios, unknown>, Error>;
|
|
197
276
|
|
|
277
|
+
/** Parameters for {@link useWalletPortfolioPnlsByTokensQuery}. */
|
|
198
278
|
interface UseWalletPortfolioPnlsByTokensQueryParams {
|
|
199
279
|
chain: Chain;
|
|
200
280
|
address: string;
|
|
201
281
|
tokenAddresses: Array<string>;
|
|
202
282
|
}
|
|
203
|
-
declare
|
|
204
|
-
declare
|
|
205
|
-
declare
|
|
283
|
+
declare const walletPortfolioPnlsByTokensQueryKey: (params: UseWalletPortfolioPnlsByTokensQueryParams, prefix?: string) => string[];
|
|
284
|
+
declare const fetchWalletPortfolioPnlsByTokens: (client: _liberfi_io_types.IClient, params: UseWalletPortfolioPnlsByTokensQueryParams) => Promise<PortfolioPnl[]>;
|
|
285
|
+
declare const useWalletPortfolioPnlsByTokensQuery: (params: UseWalletPortfolioPnlsByTokensQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<PortfolioPnl[], Error, PortfolioPnl[], string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<PortfolioPnl[], Error>;
|
|
206
286
|
|
|
207
|
-
|
|
287
|
+
/** Parameters for {@link useWalletTradesQuery}. */
|
|
288
|
+
interface UseWalletTradesQueryParams extends API.GetTradesOptions {
|
|
208
289
|
chain: Chain;
|
|
209
290
|
address: string;
|
|
210
291
|
}
|
|
211
|
-
declare
|
|
212
|
-
declare
|
|
213
|
-
declare
|
|
292
|
+
declare const walletTradesQueryKey: (params: UseWalletTradesQueryParams, prefix?: string) => string[];
|
|
293
|
+
declare const fetchWalletTrades: (client: API.IClient, params: UseWalletTradesQueryParams) => Promise<API.CursorList<Trade>>;
|
|
294
|
+
declare const useWalletTradesQuery: (params: UseWalletTradesQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<API.CursorList<Trade>, Error, API.CursorList<Trade>, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<API.CursorList<Trade>, Error>;
|
|
214
295
|
|
|
296
|
+
/** Parameters for {@link useTokenActivitiesQuery}. */
|
|
297
|
+
interface UseTokenActivitiesQueryParams extends API.GetActivitiesOptions {
|
|
298
|
+
chain: Chain;
|
|
299
|
+
address: string;
|
|
300
|
+
}
|
|
301
|
+
declare const tokenActivitiesQueryKey: (params: UseTokenActivitiesQueryParams, prefix?: string) => string[];
|
|
302
|
+
declare const fetchTokenActivities: (client: API.IClient, params: UseTokenActivitiesQueryParams) => Promise<API.CursorList<Activity>>;
|
|
303
|
+
declare const useTokenActivitiesQuery: (params: UseTokenActivitiesQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<API.CursorList<Activity>, Error, API.CursorList<Activity>, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<API.CursorList<Activity>, Error>;
|
|
304
|
+
|
|
305
|
+
/** Parameters for {@link useWalletActivitiesQuery}. */
|
|
306
|
+
interface UseWalletActivitiesQueryParams extends API.GetActivitiesOptions {
|
|
307
|
+
chain: Chain;
|
|
308
|
+
address: string;
|
|
309
|
+
}
|
|
310
|
+
declare const walletActivitiesQueryKey: (params: UseWalletActivitiesQueryParams, prefix?: string) => string[];
|
|
311
|
+
declare const fetchWalletActivities: (client: API.IClient, params: UseWalletActivitiesQueryParams) => Promise<API.CursorList<Activity>>;
|
|
312
|
+
declare const useWalletActivitiesQuery: (params: UseWalletActivitiesQueryParams, options?: Omit<_tanstack_react_query.UseQueryOptions<API.CursorList<Activity>, Error, API.CursorList<Activity>, string[]>, "queryKey" | "queryFn"> | undefined) => _tanstack_react_query.UseQueryResult<API.CursorList<Activity>, Error>;
|
|
313
|
+
|
|
314
|
+
/** Parameters for {@link useTokenSubscription}. */
|
|
215
315
|
interface UseTokenSubscriptionParams {
|
|
216
316
|
chain: Chain;
|
|
217
317
|
address: string;
|
|
218
318
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}): void;
|
|
319
|
+
/** Subscribes to real-time updates for a single token. */
|
|
320
|
+
declare function useTokenSubscription(params: UseTokenSubscriptionParams, callback: (data: Array<API.TokenSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
222
321
|
|
|
322
|
+
/** Parameters for {@link useTokenCandlesSubscription}. */
|
|
223
323
|
interface UseTokenCandlesSubscriptionParams {
|
|
224
324
|
chain: Chain;
|
|
225
325
|
address: string;
|
|
226
326
|
resolution: TokenResolution;
|
|
227
327
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}): void;
|
|
328
|
+
/** Subscribes to real-time candle updates for a token. */
|
|
329
|
+
declare function useTokenCandlesSubscription(params: UseTokenCandlesSubscriptionParams, callback: (candles: Array<TokenCandle>) => void, options?: SubscriptionOptions): void;
|
|
231
330
|
|
|
232
|
-
|
|
331
|
+
/** Parameters for {@link useTokenTradesSubscription}. */
|
|
332
|
+
interface UseTokenTradesSubscriptionParams {
|
|
233
333
|
chain: Chain;
|
|
234
334
|
address: string;
|
|
235
335
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}): void;
|
|
336
|
+
/** Subscribes to real-time trade events for a token. */
|
|
337
|
+
declare function useTokenTradesSubscription(params: UseTokenTradesSubscriptionParams, callback: (trades: Array<Trade>) => void, options?: SubscriptionOptions): void;
|
|
239
338
|
|
|
339
|
+
/** Parameters for {@link useWalletPnlSubscription}. */
|
|
240
340
|
interface UseWalletPnlSubscriptionParams {
|
|
241
341
|
chain: Chain;
|
|
242
342
|
address: string;
|
|
243
343
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}): void;
|
|
344
|
+
/** Subscribes to real-time wallet PnL updates. */
|
|
345
|
+
declare function useWalletPnlSubscription(params: UseWalletPnlSubscriptionParams, callback: (pnls: Array<API.WalletPnlSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
247
346
|
|
|
347
|
+
/** Parameters for {@link useWalletPortfoliosSubscription}. */
|
|
248
348
|
interface UseWalletPortfoliosSubscriptionParams {
|
|
249
349
|
chain: Chain;
|
|
250
350
|
address: string;
|
|
251
351
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}): void;
|
|
352
|
+
/** Subscribes to real-time wallet portfolio updates. */
|
|
353
|
+
declare function useWalletPortfoliosSubscription(params: UseWalletPortfoliosSubscriptionParams, callback: (portfolios: Array<API.PortfolioSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
255
354
|
|
|
355
|
+
/** Parameters for {@link useWalletPortfolioPnlsSubscription}. */
|
|
256
356
|
interface UseWalletPortfolioPnlsSubscriptionParams {
|
|
257
357
|
chain: Chain;
|
|
258
358
|
address: string;
|
|
259
359
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}): void;
|
|
360
|
+
/** Subscribes to real-time wallet portfolio PnL updates. */
|
|
361
|
+
declare function useWalletPortfolioPnlsSubscription(params: UseWalletPortfolioPnlsSubscriptionParams, callback: (portfolioPnls: Array<API.PortfolioPnlSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
263
362
|
|
|
264
|
-
|
|
363
|
+
/** Parameters for {@link useWalletTradesSubscription}. */
|
|
364
|
+
interface UseWalletTradesSubscriptionParams {
|
|
265
365
|
chain: Chain;
|
|
266
366
|
address: string;
|
|
267
367
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
368
|
+
/** Subscribes to real-time wallet trade events. */
|
|
369
|
+
declare function useWalletTradesSubscription(params: UseWalletTradesSubscriptionParams, callback: (trades: Array<Trade>) => void, options?: SubscriptionOptions): void;
|
|
370
|
+
|
|
371
|
+
/** Parameters for {@link useTokenActivitiesSubscription}. */
|
|
372
|
+
interface UseTokenActivitiesSubscriptionParams {
|
|
373
|
+
chain: Chain;
|
|
374
|
+
address: string;
|
|
375
|
+
}
|
|
376
|
+
/** Subscribes to real-time activity events for a token. */
|
|
377
|
+
declare function useTokenActivitiesSubscription(params: UseTokenActivitiesSubscriptionParams, callback: (activities: Array<Activity>) => void, options?: SubscriptionOptions): void;
|
|
378
|
+
|
|
379
|
+
/** Parameters for {@link useWalletActivitiesSubscription}. */
|
|
380
|
+
interface UseWalletActivitiesSubscriptionParams {
|
|
381
|
+
chain: Chain;
|
|
382
|
+
address: string;
|
|
383
|
+
}
|
|
384
|
+
/** Subscribes to real-time wallet activity events. */
|
|
385
|
+
declare function useWalletActivitiesSubscription(params: UseWalletActivitiesSubscriptionParams, callback: (activities: Array<Activity>) => void, options?: SubscriptionOptions): void;
|
|
271
386
|
|
|
387
|
+
/** Parameters for {@link useNewTokensSubscription}. */
|
|
272
388
|
interface UseNewTokensSubscriptionParams {
|
|
273
389
|
chain: Chain;
|
|
274
390
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}): void;
|
|
391
|
+
/** Subscribes to real-time new token listings. */
|
|
392
|
+
declare function useNewTokensSubscription(params: UseNewTokensSubscriptionParams, callback: (tokens: Array<API.TokenSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
278
393
|
|
|
394
|
+
/** Parameters for {@link useTrendingTokensSubscription}. */
|
|
279
395
|
interface UseTrendingTokensSubscriptionParams {
|
|
280
396
|
chain: Chain;
|
|
281
397
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}): void;
|
|
398
|
+
/** Subscribes to real-time trending token updates. */
|
|
399
|
+
declare function useTrendingTokensSubscription(params: UseTrendingTokensSubscriptionParams, callback: (data: Array<API.TokenSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
285
400
|
|
|
401
|
+
/** Parameters for {@link useMigratedTokensSubscription}. */
|
|
286
402
|
interface UseMigratedTokensSubscriptionParams {
|
|
287
403
|
chain: Chain;
|
|
288
404
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}): void;
|
|
405
|
+
/** Subscribes to real-time migrated token updates. */
|
|
406
|
+
declare function useMigratedTokensSubscription(params: UseMigratedTokensSubscriptionParams, callback: (data: Array<API.TokenSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
292
407
|
|
|
408
|
+
/** Parameters for {@link useFinalStretchTokensSubscription}. */
|
|
293
409
|
interface UseFinalStretchTokensSubscriptionParams {
|
|
294
410
|
chain: Chain;
|
|
295
411
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}): void;
|
|
412
|
+
/** Subscribes to real-time final-stretch token updates. */
|
|
413
|
+
declare function useFinalStretchTokensSubscription(params: UseFinalStretchTokensSubscriptionParams, callback: (data: Array<API.TokenSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
299
414
|
|
|
415
|
+
/** Parameters for {@link useStockTokensSubscription}. */
|
|
300
416
|
interface UseStockTokensSubscriptionParams {
|
|
301
417
|
chain: Chain;
|
|
302
418
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}): void;
|
|
306
|
-
|
|
307
|
-
type DexClientProviderProps = PropsWithChildren<DexClientContextValue>;
|
|
308
|
-
declare function DexClientProvider({ client, subscribeClient, children, }: DexClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
419
|
+
/** Subscribes to real-time stock token updates. */
|
|
420
|
+
declare function useStockTokensSubscription(params: UseStockTokensSubscriptionParams, callback: (data: Array<API.TokenSubscribed>) => void, options?: SubscriptionOptions): void;
|
|
309
421
|
|
|
310
|
-
|
|
422
|
+
type DexClientProviderProps = PropsWithChildren<{
|
|
423
|
+
client: API.IClient;
|
|
424
|
+
subscribeClient: API.ISubscribeClient;
|
|
425
|
+
/**
|
|
426
|
+
* Prefix prepended to every TanStack Query key produced by hooks in this
|
|
427
|
+
* package. Useful for avoiding collisions with other libraries.
|
|
428
|
+
*
|
|
429
|
+
* @default "liberfi"
|
|
430
|
+
*/
|
|
431
|
+
queryKeyPrefix?: string;
|
|
432
|
+
}>;
|
|
433
|
+
/**
|
|
434
|
+
* Provides the Dex client instances and configuration to all descendant hooks.
|
|
435
|
+
*
|
|
436
|
+
* Both `client` and `subscribeClient` should be referentially stable (e.g.
|
|
437
|
+
* created with `useMemo` or stored in a `useRef`) to avoid unnecessary
|
|
438
|
+
* re-renders of consumers.
|
|
439
|
+
*/
|
|
440
|
+
declare function DexClientProvider({ client, subscribeClient, queryKeyPrefix, children, }: DexClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
441
|
+
|
|
442
|
+
export { DEFAULT_QUERY_KEY_PREFIX, DexClientContext, type DexClientContextValue, DexClientProvider, type DexClientProviderProps, type SubscriptionOptions, type UseFinalStretchTokensQueryParams, type UseFinalStretchTokensSubscriptionParams, type UseMigratedTokensQueryParams, type UseMigratedTokensSubscriptionParams, type UseNewTokensQueryParams, type UseNewTokensSubscriptionParams, type UseSearchTokensQueryParams, type UseSendTxMutationParams, type UseStockTokensQueryParams, type UseStockTokensSubscriptionParams, type UseSwapRouteQueryParams, type UseTokenActivitiesQueryParams, type UseTokenActivitiesSubscriptionParams, type UseTokenCandlesQueryParams, type UseTokenCandlesSubscriptionParams, type UseTokenHoldersQueryParams, type UseTokenMarketDataQueryParams, type UseTokenQueryParams, type UseTokenSecurityQueryParams, type UseTokenStatsQueryParams, type UseTokenSubscriptionParams, type UseTokenTradesQueryParams, type UseTokenTradesSubscriptionParams, type UseTokensQueryParams, type UseTrendingTokensQueryParams, type UseTrendingTokensSubscriptionParams, type UseTxSuccessQueryParams, type UseWalletActivitiesQueryParams, type UseWalletActivitiesSubscriptionParams, type UseWalletPnlQueryParams, type UseWalletPnlSubscriptionParams, type UseWalletPortfolioPnlsByTokensQueryParams, type UseWalletPortfolioPnlsInfiniteQueryParams, type UseWalletPortfolioPnlsQueryParams, type UseWalletPortfolioPnlsSubscriptionParams, type UseWalletPortfoliosByTokensQueryParams, type UseWalletPortfoliosInfiniteQueryParams, type UseWalletPortfoliosQueryParams, type UseWalletPortfoliosSubscriptionParams, type UseWalletTradesQueryParams, type UseWalletTradesSubscriptionParams, fetchFinalStretchTokens, fetchMigratedTokens, fetchNewTokens, fetchPresignedUploadUrl, fetchSearchTokens, fetchStockTokens, fetchSwapRoute, fetchToken, fetchTokenActivities, fetchTokenCandles, fetchTokenHolders, fetchTokenMarketData, fetchTokenSecurity, fetchTokenStats, fetchTokenTrades, fetchTokens, fetchTrendingTokens, fetchTxSuccess, fetchWalletActivities, fetchWalletPnl, fetchWalletPortfolioPnls, fetchWalletPortfolioPnlsByTokens, fetchWalletPortfolios, fetchWalletPortfoliosByTokens, fetchWalletTrades, finalStretchTokensQueryKey, migratedTokensQueryKey, newTokensQueryKey, presignedUploadUrlQueryKey, searchTokensQueryKey, sendTx, stockTokensQueryKey, swapRouteQueryKey, toKeySegment, toSortedKeySegment, tokenActivitiesQueryKey, tokenCandlesQueryKey, tokenHoldersQueryKey, tokenMarketDataQueryKey, tokenQueryKey, tokenSecurityQueryKey, tokenStatsQueryKey, tokenTradesQueryKey, tokensQueryKey, trendingTokensQueryKey, txSuccessQueryKey, useDexClient, useFinalStretchTokensQuery, useFinalStretchTokensSubscription, useMigratedTokensQuery, useMigratedTokensSubscription, useNewTokensQuery, useNewTokensSubscription, usePresignedUploadUrlQuery, useSearchTokensQuery, useSendTxMutation, useStockTokensQuery, useStockTokensSubscription, useSwapRouteQuery, useTokenActivitiesQuery, useTokenActivitiesSubscription, useTokenCandlesQuery, useTokenCandlesSubscription, useTokenHoldersQuery, useTokenMarketDataQuery, useTokenQuery, useTokenSecurityQuery, useTokenStatsQuery, useTokenSubscription, useTokenTradesQuery, useTokenTradesSubscription, useTokensQuery, useTrendingTokensQuery, useTrendingTokensSubscription, useTxSuccessQuery, useWalletActivitiesQuery, useWalletActivitiesSubscription, useWalletPnlQuery, useWalletPnlSubscription, useWalletPortfolioPnlsByTokensQuery, useWalletPortfolioPnlsInfiniteQuery, useWalletPortfolioPnlsQuery, useWalletPortfolioPnlsSubscription, useWalletPortfoliosByTokensQuery, useWalletPortfoliosInfiniteQuery, useWalletPortfoliosQuery, useWalletPortfoliosSubscription, useWalletTradesQuery, useWalletTradesSubscription, walletActivitiesQueryKey, walletPnlQueryKey, walletPortfolioPnlsByTokensQueryKey, walletPortfolioPnlsInfiniteQueryKey, walletPortfolioPnlsQueryKey, walletPortfoliosByTokensQueryKey, walletPortfoliosInfiniteQueryKey, walletPortfoliosQueryKey, walletTradesQueryKey };
|