@liberfi.io/client 0.1.8
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 +215 -0
- package/dist/index.d.ts +215 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/utils.d.mts +30 -0
- package/dist/utils.d.ts +30 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +2 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +53 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import * as _liberfi_io_types from '@liberfi.io/types';
|
|
4
|
+
import { API, Chain, Token, TokenResolution, TokenCandle, TokenHolder, TokenMarketData, TokenSecurity, TokenStats, TradeActivity, WalletPortfolios } from '@liberfi.io/types';
|
|
5
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
+
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
7
|
+
import { DexAggregatorOptions, TokenProvider } from '@chainstream-io/sdk';
|
|
8
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
__LIBERFI_VERSION__?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const _default: "0.1.7";
|
|
18
|
+
|
|
19
|
+
interface DexClientContextValue {
|
|
20
|
+
client: API.IClient;
|
|
21
|
+
subscribeClient: API.ISubscribeClient;
|
|
22
|
+
}
|
|
23
|
+
declare const DexClientContext: react.Context<DexClientContextValue>;
|
|
24
|
+
|
|
25
|
+
declare function useDexClient(): DexClientContextValue;
|
|
26
|
+
|
|
27
|
+
interface UseFinalStretchTokensQueryParams extends API.GetTokenListOptions {
|
|
28
|
+
chain: Chain;
|
|
29
|
+
}
|
|
30
|
+
declare function finalStretchTokensQueryKey(params: UseFinalStretchTokensQueryParams): string[];
|
|
31
|
+
declare function fetchFinalStretchTokens(client: API.IClient, { chain, ...options }: UseFinalStretchTokensQueryParams): Promise<Token[]>;
|
|
32
|
+
declare function useFinalStretchTokensQuery(params: UseFinalStretchTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
33
|
+
|
|
34
|
+
interface UseMigratedTokensQueryParams extends API.GetTokenListOptions {
|
|
35
|
+
chain: Chain;
|
|
36
|
+
}
|
|
37
|
+
declare function migratedTokensQueryKey(params: UseMigratedTokensQueryParams): string[];
|
|
38
|
+
declare function fetchMigratedTokens(client: API.IClient, { chain, ...options }: UseMigratedTokensQueryParams): Promise<Token[]>;
|
|
39
|
+
declare function useMigratedTokensQuery(params: UseMigratedTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
40
|
+
|
|
41
|
+
interface UseNewTokensQueryParams extends API.GetTokenListOptions {
|
|
42
|
+
chain: Chain;
|
|
43
|
+
}
|
|
44
|
+
declare function newTokensQueryKey(params: UseNewTokensQueryParams): string[];
|
|
45
|
+
declare function fetchNewTokens(client: API.IClient, { chain, ...options }: UseNewTokensQueryParams): Promise<Token[]>;
|
|
46
|
+
declare function useNewTokensQuery(params: UseNewTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
47
|
+
|
|
48
|
+
declare function fetchPresignedUploadUrl(client: API.IClient): Promise<string>;
|
|
49
|
+
declare function usePresignedUploadUrlQuery(options?: Omit<UseQueryOptions<string, Error, string, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<string, Error>;
|
|
50
|
+
|
|
51
|
+
type UseSearchTokensQueryParams = API.SearchTokensOptions;
|
|
52
|
+
declare function searchTokensQueryKey(params: UseSearchTokensQueryParams): string[];
|
|
53
|
+
declare function fetchSearchTokens(client: API.IClient, params: UseSearchTokensQueryParams): Promise<_liberfi_io_types.SearchTokenCursorList>;
|
|
54
|
+
declare function useSearchTokensQuery(params: UseSearchTokensQueryParams, options?: Omit<UseQueryOptions<API.SearchTokenCursorList, Error, API.SearchTokenCursorList, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<_liberfi_io_types.SearchTokenCursorList, Error>;
|
|
55
|
+
|
|
56
|
+
type UseSendTxMutationParams = API.SendTxParams;
|
|
57
|
+
declare function sendTx(client: API.IClient, params: UseSendTxMutationParams): Promise<_liberfi_io_types.SendTxResult>;
|
|
58
|
+
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>;
|
|
59
|
+
|
|
60
|
+
interface UseStockTokensQueryParams extends API.GetTokenListOptions {
|
|
61
|
+
chain: Chain;
|
|
62
|
+
}
|
|
63
|
+
declare function stockTokensQueryKey(params: UseStockTokensQueryParams): string[];
|
|
64
|
+
declare function fetchStockTokens(client: API.IClient, { chain, ...options }: UseStockTokensQueryParams): Promise<Token[]>;
|
|
65
|
+
declare function useStockTokensQuery(params: UseStockTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
66
|
+
|
|
67
|
+
type UseSwapRouteQueryParams = API.SwapParams;
|
|
68
|
+
declare function swapRouteQueryKey(params: UseSwapRouteQueryParams): string[];
|
|
69
|
+
declare function fetchSwapRoute(client: API.IClient, params: UseSwapRouteQueryParams): Promise<_liberfi_io_types.SwapRoute>;
|
|
70
|
+
declare function useSwapRouteQuery(params: UseSwapRouteQueryParams, options?: Omit<UseQueryOptions<API.SwapRoute, Error, API.SwapRoute, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<_liberfi_io_types.SwapRoute, Error>;
|
|
71
|
+
|
|
72
|
+
interface UseTokenCandlesQueryParams extends API.GetTokenCandlesOptions {
|
|
73
|
+
chain: Chain;
|
|
74
|
+
address: string;
|
|
75
|
+
resolution: TokenResolution;
|
|
76
|
+
}
|
|
77
|
+
declare function tokenCandlesQueryKey(params: UseTokenCandlesQueryParams): string[];
|
|
78
|
+
declare function fetchTokenCandles(client: API.IClient, { chain, address, resolution, ...options }: UseTokenCandlesQueryParams): Promise<TokenCandle[]>;
|
|
79
|
+
declare function useTokenCandlesQuery(params: UseTokenCandlesQueryParams, options?: Omit<UseQueryOptions<Array<TokenCandle>, Error, Array<TokenCandle>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenCandle[], Error>;
|
|
80
|
+
|
|
81
|
+
interface UseTokenHoldersQueryParams extends API.CursorListOptions {
|
|
82
|
+
chain: Chain;
|
|
83
|
+
address: string;
|
|
84
|
+
}
|
|
85
|
+
declare function tokenHoldersQueryKey(params: UseTokenHoldersQueryParams): string[];
|
|
86
|
+
declare function fetchTokenHolders(client: API.IClient, { chain, address, ...options }: UseTokenHoldersQueryParams): Promise<API.CursorList<TokenHolder>>;
|
|
87
|
+
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>;
|
|
88
|
+
|
|
89
|
+
interface UseTokenMarketDataQueryParams {
|
|
90
|
+
chain: Chain;
|
|
91
|
+
address: string;
|
|
92
|
+
}
|
|
93
|
+
declare function tokenMarketDataQueryKey(params: UseTokenMarketDataQueryParams): string[];
|
|
94
|
+
declare function fetchTokenMarketData(client: API.IClient, { chain, address }: UseTokenMarketDataQueryParams): Promise<TokenMarketData>;
|
|
95
|
+
declare function useTokenMarketDataQuery(params: UseTokenMarketDataQueryParams, options?: Omit<UseQueryOptions<TokenMarketData, Error, TokenMarketData, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenMarketData, Error>;
|
|
96
|
+
|
|
97
|
+
interface UseTokenQueryParams {
|
|
98
|
+
chain: Chain;
|
|
99
|
+
address: string;
|
|
100
|
+
}
|
|
101
|
+
declare function tokenQueryKey(params: UseTokenQueryParams): string[];
|
|
102
|
+
declare function fetchToken(client: API.IClient, { chain, address }: UseTokenQueryParams): Promise<Token>;
|
|
103
|
+
declare function useTokenQuery(params: UseTokenQueryParams, options?: Omit<UseQueryOptions<Token, Error, Token, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token, Error>;
|
|
104
|
+
|
|
105
|
+
interface UseTokenSecurityQueryParams {
|
|
106
|
+
chain: Chain;
|
|
107
|
+
address: string;
|
|
108
|
+
}
|
|
109
|
+
declare function tokenSecurityQueryKey(params: UseTokenSecurityQueryParams): string[];
|
|
110
|
+
declare function fetchTokenSecurity(client: API.IClient, { chain, address }: UseTokenSecurityQueryParams): Promise<TokenSecurity>;
|
|
111
|
+
declare function useTokenSecurityQuery(params: UseTokenSecurityQueryParams, options?: Omit<UseQueryOptions<TokenSecurity, Error, TokenSecurity, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenSecurity, Error>;
|
|
112
|
+
|
|
113
|
+
interface UseTokensQueryParams {
|
|
114
|
+
chain: Chain;
|
|
115
|
+
addresses: Array<string>;
|
|
116
|
+
}
|
|
117
|
+
declare function tokensQueryKey(params: UseTokensQueryParams): string[];
|
|
118
|
+
declare function fetchTokens(client: API.IClient, { chain, addresses }: UseTokensQueryParams): Promise<Token[]>;
|
|
119
|
+
declare function useTokensQuery(params: UseTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
120
|
+
|
|
121
|
+
interface UseTokenStatsQueryParams {
|
|
122
|
+
chain: Chain;
|
|
123
|
+
address: string;
|
|
124
|
+
}
|
|
125
|
+
declare function tokenStatsQueryKey(params: UseTokenStatsQueryParams): string[];
|
|
126
|
+
declare function fetchTokenStats(client: API.IClient, { chain, address }: UseTokenStatsQueryParams): Promise<TokenStats>;
|
|
127
|
+
declare function useTokenStatsQuery(params: UseTokenStatsQueryParams, options?: Omit<UseQueryOptions<TokenStats, Error, TokenStats, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenStats, Error>;
|
|
128
|
+
|
|
129
|
+
interface UseTokenTradeActivitiesQueryParams extends API.GetTradeActivitiesOptions {
|
|
130
|
+
chain: Chain;
|
|
131
|
+
address: string;
|
|
132
|
+
}
|
|
133
|
+
declare function tokenTradeActivitiesQueryKey(params: UseTokenTradeActivitiesQueryParams): string[];
|
|
134
|
+
declare function fetchTokenTradeActivities(client: API.IClient, { chain, address, ...options }: UseTokenTradeActivitiesQueryParams): Promise<API.CursorList<TradeActivity>>;
|
|
135
|
+
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>;
|
|
136
|
+
|
|
137
|
+
interface UseTrendingTokensQueryParams extends API.GetTokenListOptions {
|
|
138
|
+
chain: Chain;
|
|
139
|
+
resolution: "1m" | "5m" | "1h" | "4h" | "24h";
|
|
140
|
+
}
|
|
141
|
+
declare function trendingTokensQueryKey(params: UseTrendingTokensQueryParams): string[];
|
|
142
|
+
declare function fetchTrendingTokens(client: API.IClient, { chain, resolution, ...options }: UseTrendingTokensQueryParams): Promise<Token[]>;
|
|
143
|
+
declare function useTrendingTokensQuery(params: UseTrendingTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
144
|
+
|
|
145
|
+
interface UseTxSuccessQueryParams {
|
|
146
|
+
chain: Chain;
|
|
147
|
+
txHash: string;
|
|
148
|
+
timeout?: number;
|
|
149
|
+
}
|
|
150
|
+
declare function txSuccessQueryKey(params: UseTxSuccessQueryParams): string[];
|
|
151
|
+
declare function fetchTxSuccess(client: API.IClient, { chain, txHash, timeout }: UseTxSuccessQueryParams): Promise<boolean>;
|
|
152
|
+
declare function useTxSuccessQuery(params: UseTxSuccessQueryParams, options?: Omit<UseQueryOptions<boolean, Error, boolean, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<boolean, Error>;
|
|
153
|
+
|
|
154
|
+
interface UseWalletPortfoliosQueryParams {
|
|
155
|
+
chain: Chain;
|
|
156
|
+
address: string;
|
|
157
|
+
}
|
|
158
|
+
declare function walletPortfoliosQueryKey(params: UseWalletPortfoliosQueryParams): string[];
|
|
159
|
+
declare function fetchWalletPortfolios(client: API.IClient, { chain, address }: UseWalletPortfoliosQueryParams): Promise<WalletPortfolios>;
|
|
160
|
+
declare function useWalletPortfoliosQuery(params: UseWalletPortfoliosQueryParams, options?: Omit<UseQueryOptions<WalletPortfolios, Error, WalletPortfolios, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<WalletPortfolios, Error>;
|
|
161
|
+
|
|
162
|
+
interface UseWalletTradeActivitiesQueryParams extends API.GetTradeActivitiesOptions {
|
|
163
|
+
chain: Chain;
|
|
164
|
+
address: string;
|
|
165
|
+
}
|
|
166
|
+
declare function walletTradeActivitiesQueryKey(params: UseWalletTradeActivitiesQueryParams): string[];
|
|
167
|
+
declare function fetchWalletTradeActivities(client: API.IClient, { chain, address, ...options }: UseWalletTradeActivitiesQueryParams): Promise<API.CursorList<TradeActivity>>;
|
|
168
|
+
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>;
|
|
169
|
+
|
|
170
|
+
type ClientOptions = DexAggregatorOptions;
|
|
171
|
+
type ClientTokenProvider = TokenProvider | string;
|
|
172
|
+
declare class Client implements API.IClient, API.ISubscribeClient {
|
|
173
|
+
private readonly accessToken;
|
|
174
|
+
private readonly options?;
|
|
175
|
+
private readonly _client;
|
|
176
|
+
constructor(accessToken: ClientTokenProvider, options?: ClientOptions | undefined);
|
|
177
|
+
getToken(chain: Chain, address: string): Promise<Token>;
|
|
178
|
+
getTokens(chain: Chain, addresses: Array<string>): Promise<Array<Token>>;
|
|
179
|
+
getTokenCandles(chain: Chain, address: string, resolution: TokenResolution, options?: API.GetTokenCandlesOptions): Promise<Array<TokenCandle>>;
|
|
180
|
+
getTokenSecurity(chain: Chain, address: string): Promise<TokenSecurity>;
|
|
181
|
+
getTokenStats(chain: Chain, address: string): Promise<TokenStats>;
|
|
182
|
+
getTokenHolders(chain: Chain, address: string, options?: API.CursorListOptions): Promise<API.CursorList<TokenHolder>>;
|
|
183
|
+
getTokenMarketData(chain: Chain, address: string): Promise<TokenMarketData>;
|
|
184
|
+
getNewTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
185
|
+
getFinalStretchTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
186
|
+
getMigratedTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
187
|
+
getTrendingTokens(chain: Chain, resolution: "1m" | "5m" | "1h" | "4h" | "24h", options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
188
|
+
getStockTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
189
|
+
searchTokens(options?: API.SearchTokensOptions): Promise<API.SearchTokenCursorList>;
|
|
190
|
+
swapRoute(params: API.SwapParams): Promise<API.SwapRoute>;
|
|
191
|
+
sendTx(params: API.SendTxParams): Promise<API.SendTxResult>;
|
|
192
|
+
checkTxSuccess(chain: Chain, txHash: string, timeout?: number): Promise<boolean>;
|
|
193
|
+
getWalletPortfolios(chain: Chain, address: string): Promise<WalletPortfolios>;
|
|
194
|
+
getWalletTradeActivities(chain: Chain, address: string, options?: API.GetTradeActivitiesOptions): Promise<API.CursorList<TradeActivity>>;
|
|
195
|
+
getTokenTradeActivities(chain: Chain, address: string, options?: API.GetTradeActivitiesOptions): Promise<API.CursorList<TradeActivity>>;
|
|
196
|
+
getPresignedUploadUrl(): Promise<string>;
|
|
197
|
+
subscribeTokenBasic(chain: Chain, address: string, callback: (tokens: Array<API.TokenSubscribed>) => void): API.ISubscription;
|
|
198
|
+
subscribeTokenMarketData(chain: Chain, address: string, callback: (marketDatas: Array<TokenMarketData>) => void): API.ISubscription;
|
|
199
|
+
subscribeTokenStats(chain: Chain, address: string, callback: (stats: Array<TokenStats>) => void): API.ISubscription;
|
|
200
|
+
subscribeTokenCandles(chain: Chain, address: string, resolution: TokenResolution, callback: (candles: Array<TokenCandle>) => void): API.ISubscription;
|
|
201
|
+
subscribeWalletPnl(chain: Chain, address: string, callback: (pnls: Array<API.WalletPnlSubscribed>) => void): API.ISubscription;
|
|
202
|
+
subscribeWalletPortfolios(chain: Chain, address: string, callback: (portfolios: Array<API.PortfolioSubscribed>) => void): API.ISubscription;
|
|
203
|
+
subscribeWalletPortfolioPnls(chain: Chain, address: string, callback: (portfolioPnls: Array<API.PortfolioPnlSubscribed>) => void): API.ISubscription;
|
|
204
|
+
subscribeWalletTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): API.ISubscription;
|
|
205
|
+
subscribeTokenTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): API.ISubscription;
|
|
206
|
+
subscribeNewTokens(chain: Chain, callback: (tokens: Array<API.TokenSubscribed>) => void): API.ISubscription;
|
|
207
|
+
subscribeNewTokensBasic(chain: Chain, callback: (tokens: Array<API.TokenSubscribed>) => void): API.ISubscription;
|
|
208
|
+
subscribeNewTokensMarketData(chain: Chain, callback: (marketDatas: Array<TokenMarketData>) => void): API.ISubscription;
|
|
209
|
+
subscribeNewTokensStats(chain: Chain, callback: (stats: Array<TokenStats>) => void): API.ISubscription;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
type DexClientProviderProps = PropsWithChildren<DexClientContextValue>;
|
|
213
|
+
declare function DexClientProvider({ client, subscribeClient, children, }: DexClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
214
|
+
|
|
215
|
+
export { Client, type ClientOptions, type ClientTokenProvider, DexClientContext, type DexClientContextValue, DexClientProvider, type DexClientProviderProps, type UseFinalStretchTokensQueryParams, type UseMigratedTokensQueryParams, type UseNewTokensQueryParams, 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, fetchFinalStretchTokens, fetchMigratedTokens, fetchNewTokens, fetchPresignedUploadUrl, fetchSearchTokens, fetchStockTokens, fetchSwapRoute, fetchToken, fetchTokenCandles, fetchTokenHolders, fetchTokenMarketData, fetchTokenSecurity, fetchTokenStats, fetchTokenTradeActivities, fetchTokens, fetchTrendingTokens, fetchTxSuccess, fetchWalletPortfolios, fetchWalletTradeActivities, finalStretchTokensQueryKey, migratedTokensQueryKey, newTokensQueryKey, searchTokensQueryKey, sendTx, stockTokensQueryKey, swapRouteQueryKey, tokenCandlesQueryKey, tokenHoldersQueryKey, tokenMarketDataQueryKey, tokenQueryKey, tokenSecurityQueryKey, tokenStatsQueryKey, tokenTradeActivitiesQueryKey, tokensQueryKey, trendingTokensQueryKey, txSuccessQueryKey, useDexClient, useFinalStretchTokensQuery, useMigratedTokensQuery, useNewTokensQuery, usePresignedUploadUrlQuery, useSearchTokensQuery, useSendTxMutation, useStockTokensQuery, useSwapRouteQuery, useTokenCandlesQuery, useTokenHoldersQuery, useTokenMarketDataQuery, useTokenQuery, useTokenSecurityQuery, useTokenStatsQuery, useTokenTradeActivitiesQuery, useTokensQuery, useTrendingTokensQuery, useTxSuccessQuery, useWalletPortfoliosQuery, useWalletTradeActivitiesQuery, _default as version, walletPortfoliosQueryKey, walletTradeActivitiesQueryKey };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
import * as _liberfi_io_types from '@liberfi.io/types';
|
|
4
|
+
import { API, Chain, Token, TokenResolution, TokenCandle, TokenHolder, TokenMarketData, TokenSecurity, TokenStats, TradeActivity, WalletPortfolios } from '@liberfi.io/types';
|
|
5
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
+
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
7
|
+
import { DexAggregatorOptions, TokenProvider } from '@chainstream-io/sdk';
|
|
8
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
__LIBERFI_VERSION__?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const _default: "0.1.7";
|
|
18
|
+
|
|
19
|
+
interface DexClientContextValue {
|
|
20
|
+
client: API.IClient;
|
|
21
|
+
subscribeClient: API.ISubscribeClient;
|
|
22
|
+
}
|
|
23
|
+
declare const DexClientContext: react.Context<DexClientContextValue>;
|
|
24
|
+
|
|
25
|
+
declare function useDexClient(): DexClientContextValue;
|
|
26
|
+
|
|
27
|
+
interface UseFinalStretchTokensQueryParams extends API.GetTokenListOptions {
|
|
28
|
+
chain: Chain;
|
|
29
|
+
}
|
|
30
|
+
declare function finalStretchTokensQueryKey(params: UseFinalStretchTokensQueryParams): string[];
|
|
31
|
+
declare function fetchFinalStretchTokens(client: API.IClient, { chain, ...options }: UseFinalStretchTokensQueryParams): Promise<Token[]>;
|
|
32
|
+
declare function useFinalStretchTokensQuery(params: UseFinalStretchTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
33
|
+
|
|
34
|
+
interface UseMigratedTokensQueryParams extends API.GetTokenListOptions {
|
|
35
|
+
chain: Chain;
|
|
36
|
+
}
|
|
37
|
+
declare function migratedTokensQueryKey(params: UseMigratedTokensQueryParams): string[];
|
|
38
|
+
declare function fetchMigratedTokens(client: API.IClient, { chain, ...options }: UseMigratedTokensQueryParams): Promise<Token[]>;
|
|
39
|
+
declare function useMigratedTokensQuery(params: UseMigratedTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
40
|
+
|
|
41
|
+
interface UseNewTokensQueryParams extends API.GetTokenListOptions {
|
|
42
|
+
chain: Chain;
|
|
43
|
+
}
|
|
44
|
+
declare function newTokensQueryKey(params: UseNewTokensQueryParams): string[];
|
|
45
|
+
declare function fetchNewTokens(client: API.IClient, { chain, ...options }: UseNewTokensQueryParams): Promise<Token[]>;
|
|
46
|
+
declare function useNewTokensQuery(params: UseNewTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
47
|
+
|
|
48
|
+
declare function fetchPresignedUploadUrl(client: API.IClient): Promise<string>;
|
|
49
|
+
declare function usePresignedUploadUrlQuery(options?: Omit<UseQueryOptions<string, Error, string, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<string, Error>;
|
|
50
|
+
|
|
51
|
+
type UseSearchTokensQueryParams = API.SearchTokensOptions;
|
|
52
|
+
declare function searchTokensQueryKey(params: UseSearchTokensQueryParams): string[];
|
|
53
|
+
declare function fetchSearchTokens(client: API.IClient, params: UseSearchTokensQueryParams): Promise<_liberfi_io_types.SearchTokenCursorList>;
|
|
54
|
+
declare function useSearchTokensQuery(params: UseSearchTokensQueryParams, options?: Omit<UseQueryOptions<API.SearchTokenCursorList, Error, API.SearchTokenCursorList, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<_liberfi_io_types.SearchTokenCursorList, Error>;
|
|
55
|
+
|
|
56
|
+
type UseSendTxMutationParams = API.SendTxParams;
|
|
57
|
+
declare function sendTx(client: API.IClient, params: UseSendTxMutationParams): Promise<_liberfi_io_types.SendTxResult>;
|
|
58
|
+
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>;
|
|
59
|
+
|
|
60
|
+
interface UseStockTokensQueryParams extends API.GetTokenListOptions {
|
|
61
|
+
chain: Chain;
|
|
62
|
+
}
|
|
63
|
+
declare function stockTokensQueryKey(params: UseStockTokensQueryParams): string[];
|
|
64
|
+
declare function fetchStockTokens(client: API.IClient, { chain, ...options }: UseStockTokensQueryParams): Promise<Token[]>;
|
|
65
|
+
declare function useStockTokensQuery(params: UseStockTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
66
|
+
|
|
67
|
+
type UseSwapRouteQueryParams = API.SwapParams;
|
|
68
|
+
declare function swapRouteQueryKey(params: UseSwapRouteQueryParams): string[];
|
|
69
|
+
declare function fetchSwapRoute(client: API.IClient, params: UseSwapRouteQueryParams): Promise<_liberfi_io_types.SwapRoute>;
|
|
70
|
+
declare function useSwapRouteQuery(params: UseSwapRouteQueryParams, options?: Omit<UseQueryOptions<API.SwapRoute, Error, API.SwapRoute, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<_liberfi_io_types.SwapRoute, Error>;
|
|
71
|
+
|
|
72
|
+
interface UseTokenCandlesQueryParams extends API.GetTokenCandlesOptions {
|
|
73
|
+
chain: Chain;
|
|
74
|
+
address: string;
|
|
75
|
+
resolution: TokenResolution;
|
|
76
|
+
}
|
|
77
|
+
declare function tokenCandlesQueryKey(params: UseTokenCandlesQueryParams): string[];
|
|
78
|
+
declare function fetchTokenCandles(client: API.IClient, { chain, address, resolution, ...options }: UseTokenCandlesQueryParams): Promise<TokenCandle[]>;
|
|
79
|
+
declare function useTokenCandlesQuery(params: UseTokenCandlesQueryParams, options?: Omit<UseQueryOptions<Array<TokenCandle>, Error, Array<TokenCandle>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenCandle[], Error>;
|
|
80
|
+
|
|
81
|
+
interface UseTokenHoldersQueryParams extends API.CursorListOptions {
|
|
82
|
+
chain: Chain;
|
|
83
|
+
address: string;
|
|
84
|
+
}
|
|
85
|
+
declare function tokenHoldersQueryKey(params: UseTokenHoldersQueryParams): string[];
|
|
86
|
+
declare function fetchTokenHolders(client: API.IClient, { chain, address, ...options }: UseTokenHoldersQueryParams): Promise<API.CursorList<TokenHolder>>;
|
|
87
|
+
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>;
|
|
88
|
+
|
|
89
|
+
interface UseTokenMarketDataQueryParams {
|
|
90
|
+
chain: Chain;
|
|
91
|
+
address: string;
|
|
92
|
+
}
|
|
93
|
+
declare function tokenMarketDataQueryKey(params: UseTokenMarketDataQueryParams): string[];
|
|
94
|
+
declare function fetchTokenMarketData(client: API.IClient, { chain, address }: UseTokenMarketDataQueryParams): Promise<TokenMarketData>;
|
|
95
|
+
declare function useTokenMarketDataQuery(params: UseTokenMarketDataQueryParams, options?: Omit<UseQueryOptions<TokenMarketData, Error, TokenMarketData, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenMarketData, Error>;
|
|
96
|
+
|
|
97
|
+
interface UseTokenQueryParams {
|
|
98
|
+
chain: Chain;
|
|
99
|
+
address: string;
|
|
100
|
+
}
|
|
101
|
+
declare function tokenQueryKey(params: UseTokenQueryParams): string[];
|
|
102
|
+
declare function fetchToken(client: API.IClient, { chain, address }: UseTokenQueryParams): Promise<Token>;
|
|
103
|
+
declare function useTokenQuery(params: UseTokenQueryParams, options?: Omit<UseQueryOptions<Token, Error, Token, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token, Error>;
|
|
104
|
+
|
|
105
|
+
interface UseTokenSecurityQueryParams {
|
|
106
|
+
chain: Chain;
|
|
107
|
+
address: string;
|
|
108
|
+
}
|
|
109
|
+
declare function tokenSecurityQueryKey(params: UseTokenSecurityQueryParams): string[];
|
|
110
|
+
declare function fetchTokenSecurity(client: API.IClient, { chain, address }: UseTokenSecurityQueryParams): Promise<TokenSecurity>;
|
|
111
|
+
declare function useTokenSecurityQuery(params: UseTokenSecurityQueryParams, options?: Omit<UseQueryOptions<TokenSecurity, Error, TokenSecurity, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenSecurity, Error>;
|
|
112
|
+
|
|
113
|
+
interface UseTokensQueryParams {
|
|
114
|
+
chain: Chain;
|
|
115
|
+
addresses: Array<string>;
|
|
116
|
+
}
|
|
117
|
+
declare function tokensQueryKey(params: UseTokensQueryParams): string[];
|
|
118
|
+
declare function fetchTokens(client: API.IClient, { chain, addresses }: UseTokensQueryParams): Promise<Token[]>;
|
|
119
|
+
declare function useTokensQuery(params: UseTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
120
|
+
|
|
121
|
+
interface UseTokenStatsQueryParams {
|
|
122
|
+
chain: Chain;
|
|
123
|
+
address: string;
|
|
124
|
+
}
|
|
125
|
+
declare function tokenStatsQueryKey(params: UseTokenStatsQueryParams): string[];
|
|
126
|
+
declare function fetchTokenStats(client: API.IClient, { chain, address }: UseTokenStatsQueryParams): Promise<TokenStats>;
|
|
127
|
+
declare function useTokenStatsQuery(params: UseTokenStatsQueryParams, options?: Omit<UseQueryOptions<TokenStats, Error, TokenStats, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<TokenStats, Error>;
|
|
128
|
+
|
|
129
|
+
interface UseTokenTradeActivitiesQueryParams extends API.GetTradeActivitiesOptions {
|
|
130
|
+
chain: Chain;
|
|
131
|
+
address: string;
|
|
132
|
+
}
|
|
133
|
+
declare function tokenTradeActivitiesQueryKey(params: UseTokenTradeActivitiesQueryParams): string[];
|
|
134
|
+
declare function fetchTokenTradeActivities(client: API.IClient, { chain, address, ...options }: UseTokenTradeActivitiesQueryParams): Promise<API.CursorList<TradeActivity>>;
|
|
135
|
+
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>;
|
|
136
|
+
|
|
137
|
+
interface UseTrendingTokensQueryParams extends API.GetTokenListOptions {
|
|
138
|
+
chain: Chain;
|
|
139
|
+
resolution: "1m" | "5m" | "1h" | "4h" | "24h";
|
|
140
|
+
}
|
|
141
|
+
declare function trendingTokensQueryKey(params: UseTrendingTokensQueryParams): string[];
|
|
142
|
+
declare function fetchTrendingTokens(client: API.IClient, { chain, resolution, ...options }: UseTrendingTokensQueryParams): Promise<Token[]>;
|
|
143
|
+
declare function useTrendingTokensQuery(params: UseTrendingTokensQueryParams, options?: Omit<UseQueryOptions<Array<Token>, Error, Array<Token>, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<Token[], Error>;
|
|
144
|
+
|
|
145
|
+
interface UseTxSuccessQueryParams {
|
|
146
|
+
chain: Chain;
|
|
147
|
+
txHash: string;
|
|
148
|
+
timeout?: number;
|
|
149
|
+
}
|
|
150
|
+
declare function txSuccessQueryKey(params: UseTxSuccessQueryParams): string[];
|
|
151
|
+
declare function fetchTxSuccess(client: API.IClient, { chain, txHash, timeout }: UseTxSuccessQueryParams): Promise<boolean>;
|
|
152
|
+
declare function useTxSuccessQuery(params: UseTxSuccessQueryParams, options?: Omit<UseQueryOptions<boolean, Error, boolean, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<boolean, Error>;
|
|
153
|
+
|
|
154
|
+
interface UseWalletPortfoliosQueryParams {
|
|
155
|
+
chain: Chain;
|
|
156
|
+
address: string;
|
|
157
|
+
}
|
|
158
|
+
declare function walletPortfoliosQueryKey(params: UseWalletPortfoliosQueryParams): string[];
|
|
159
|
+
declare function fetchWalletPortfolios(client: API.IClient, { chain, address }: UseWalletPortfoliosQueryParams): Promise<WalletPortfolios>;
|
|
160
|
+
declare function useWalletPortfoliosQuery(params: UseWalletPortfoliosQueryParams, options?: Omit<UseQueryOptions<WalletPortfolios, Error, WalletPortfolios, string[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<WalletPortfolios, Error>;
|
|
161
|
+
|
|
162
|
+
interface UseWalletTradeActivitiesQueryParams extends API.GetTradeActivitiesOptions {
|
|
163
|
+
chain: Chain;
|
|
164
|
+
address: string;
|
|
165
|
+
}
|
|
166
|
+
declare function walletTradeActivitiesQueryKey(params: UseWalletTradeActivitiesQueryParams): string[];
|
|
167
|
+
declare function fetchWalletTradeActivities(client: API.IClient, { chain, address, ...options }: UseWalletTradeActivitiesQueryParams): Promise<API.CursorList<TradeActivity>>;
|
|
168
|
+
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>;
|
|
169
|
+
|
|
170
|
+
type ClientOptions = DexAggregatorOptions;
|
|
171
|
+
type ClientTokenProvider = TokenProvider | string;
|
|
172
|
+
declare class Client implements API.IClient, API.ISubscribeClient {
|
|
173
|
+
private readonly accessToken;
|
|
174
|
+
private readonly options?;
|
|
175
|
+
private readonly _client;
|
|
176
|
+
constructor(accessToken: ClientTokenProvider, options?: ClientOptions | undefined);
|
|
177
|
+
getToken(chain: Chain, address: string): Promise<Token>;
|
|
178
|
+
getTokens(chain: Chain, addresses: Array<string>): Promise<Array<Token>>;
|
|
179
|
+
getTokenCandles(chain: Chain, address: string, resolution: TokenResolution, options?: API.GetTokenCandlesOptions): Promise<Array<TokenCandle>>;
|
|
180
|
+
getTokenSecurity(chain: Chain, address: string): Promise<TokenSecurity>;
|
|
181
|
+
getTokenStats(chain: Chain, address: string): Promise<TokenStats>;
|
|
182
|
+
getTokenHolders(chain: Chain, address: string, options?: API.CursorListOptions): Promise<API.CursorList<TokenHolder>>;
|
|
183
|
+
getTokenMarketData(chain: Chain, address: string): Promise<TokenMarketData>;
|
|
184
|
+
getNewTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
185
|
+
getFinalStretchTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
186
|
+
getMigratedTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
187
|
+
getTrendingTokens(chain: Chain, resolution: "1m" | "5m" | "1h" | "4h" | "24h", options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
188
|
+
getStockTokens(chain: Chain, options?: API.GetTokenListOptions): Promise<Array<Token>>;
|
|
189
|
+
searchTokens(options?: API.SearchTokensOptions): Promise<API.SearchTokenCursorList>;
|
|
190
|
+
swapRoute(params: API.SwapParams): Promise<API.SwapRoute>;
|
|
191
|
+
sendTx(params: API.SendTxParams): Promise<API.SendTxResult>;
|
|
192
|
+
checkTxSuccess(chain: Chain, txHash: string, timeout?: number): Promise<boolean>;
|
|
193
|
+
getWalletPortfolios(chain: Chain, address: string): Promise<WalletPortfolios>;
|
|
194
|
+
getWalletTradeActivities(chain: Chain, address: string, options?: API.GetTradeActivitiesOptions): Promise<API.CursorList<TradeActivity>>;
|
|
195
|
+
getTokenTradeActivities(chain: Chain, address: string, options?: API.GetTradeActivitiesOptions): Promise<API.CursorList<TradeActivity>>;
|
|
196
|
+
getPresignedUploadUrl(): Promise<string>;
|
|
197
|
+
subscribeTokenBasic(chain: Chain, address: string, callback: (tokens: Array<API.TokenSubscribed>) => void): API.ISubscription;
|
|
198
|
+
subscribeTokenMarketData(chain: Chain, address: string, callback: (marketDatas: Array<TokenMarketData>) => void): API.ISubscription;
|
|
199
|
+
subscribeTokenStats(chain: Chain, address: string, callback: (stats: Array<TokenStats>) => void): API.ISubscription;
|
|
200
|
+
subscribeTokenCandles(chain: Chain, address: string, resolution: TokenResolution, callback: (candles: Array<TokenCandle>) => void): API.ISubscription;
|
|
201
|
+
subscribeWalletPnl(chain: Chain, address: string, callback: (pnls: Array<API.WalletPnlSubscribed>) => void): API.ISubscription;
|
|
202
|
+
subscribeWalletPortfolios(chain: Chain, address: string, callback: (portfolios: Array<API.PortfolioSubscribed>) => void): API.ISubscription;
|
|
203
|
+
subscribeWalletPortfolioPnls(chain: Chain, address: string, callback: (portfolioPnls: Array<API.PortfolioPnlSubscribed>) => void): API.ISubscription;
|
|
204
|
+
subscribeWalletTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): API.ISubscription;
|
|
205
|
+
subscribeTokenTradeActivities(chain: Chain, address: string, callback: (trades: Array<TradeActivity>) => void): API.ISubscription;
|
|
206
|
+
subscribeNewTokens(chain: Chain, callback: (tokens: Array<API.TokenSubscribed>) => void): API.ISubscription;
|
|
207
|
+
subscribeNewTokensBasic(chain: Chain, callback: (tokens: Array<API.TokenSubscribed>) => void): API.ISubscription;
|
|
208
|
+
subscribeNewTokensMarketData(chain: Chain, callback: (marketDatas: Array<TokenMarketData>) => void): API.ISubscription;
|
|
209
|
+
subscribeNewTokensStats(chain: Chain, callback: (stats: Array<TokenStats>) => void): API.ISubscription;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
type DexClientProviderProps = PropsWithChildren<DexClientContextValue>;
|
|
213
|
+
declare function DexClientProvider({ client, subscribeClient, children, }: DexClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
214
|
+
|
|
215
|
+
export { Client, type ClientOptions, type ClientTokenProvider, DexClientContext, type DexClientContextValue, DexClientProvider, type DexClientProviderProps, type UseFinalStretchTokensQueryParams, type UseMigratedTokensQueryParams, type UseNewTokensQueryParams, 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, fetchFinalStretchTokens, fetchMigratedTokens, fetchNewTokens, fetchPresignedUploadUrl, fetchSearchTokens, fetchStockTokens, fetchSwapRoute, fetchToken, fetchTokenCandles, fetchTokenHolders, fetchTokenMarketData, fetchTokenSecurity, fetchTokenStats, fetchTokenTradeActivities, fetchTokens, fetchTrendingTokens, fetchTxSuccess, fetchWalletPortfolios, fetchWalletTradeActivities, finalStretchTokensQueryKey, migratedTokensQueryKey, newTokensQueryKey, searchTokensQueryKey, sendTx, stockTokensQueryKey, swapRouteQueryKey, tokenCandlesQueryKey, tokenHoldersQueryKey, tokenMarketDataQueryKey, tokenQueryKey, tokenSecurityQueryKey, tokenStatsQueryKey, tokenTradeActivitiesQueryKey, tokensQueryKey, trendingTokensQueryKey, txSuccessQueryKey, useDexClient, useFinalStretchTokensQuery, useMigratedTokensQuery, useNewTokensQuery, usePresignedUploadUrlQuery, useSearchTokensQuery, useSendTxMutation, useStockTokensQuery, useSwapRouteQuery, useTokenCandlesQuery, useTokenHoldersQuery, useTokenMarketDataQuery, useTokenQuery, useTokenSecurityQuery, useTokenStatsQuery, useTokenTradeActivitiesQuery, useTokensQuery, useTrendingTokensQuery, useTxSuccessQuery, useWalletPortfoliosQuery, useWalletTradeActivitiesQuery, _default as version, walletPortfoliosQueryKey, walletTradeActivitiesQueryKey };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react'),reactQuery=require('@tanstack/react-query'),sdk=require('@chainstream-io/sdk'),openapi=require('@chainstream-io/sdk/openapi'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),jsxRuntime=require('react/jsx-runtime');typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/client"]="0.1.7");var R="0.1.7";var P=react.createContext({});function s(){let e=react.useContext(P);if(!e)throw new Error("useDexClient must be used within an DexClientProvider");return e}function _(e){return ["finalStretchTokens",e.chain,e.sortBy??"",e.sortDirection??"",JSON.stringify((e.keywords??[]).sort()),JSON.stringify((e.excludeKeywords??[]).sort()),JSON.stringify(e.filters??[])]}async function N(e,{chain:r,...t}){return await e.getFinalStretchTokens(r,t)}function ir(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:_(e),queryFn:async()=>N(t,e),...r})}function L(e){return ["migratedTokens",e.chain,e.sortBy??"",e.sortDirection??"",JSON.stringify((e.keywords??[]).sort()),JSON.stringify((e.excludeKeywords??[]).sort()),JSON.stringify(e.filters??[])]}async function W(e,{chain:r,...t}){return await e.getMigratedTokens(r,t)}function dr(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:L(e),queryFn:async()=>W(t,e),...r})}function V(e){return ["newTokens",e.chain,e.sortBy??"",e.sortDirection??"",JSON.stringify((e.keywords??[]).sort()),JSON.stringify((e.excludeKeywords??[]).sort()),JSON.stringify(e.filters??[])]}async function J(e,{chain:r,...t}){return await e.getNewTokens(r,t)}function fr(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:V(e),queryFn:async()=>J(t,e),...r})}async function Z(e){return await e.getPresignedUploadUrl()}function pr(e={}){let{client:r}=s();return reactQuery.useQuery({queryKey:["presignedUploadUrl"],queryFn:async()=>Z(r),...e})}function z(e){return ["searchTokens",e.cursor??"",e.limit?`${e.limit}`:"",e.direction??"",JSON.stringify((e.chains??[]).sort()),e.keyword??"",JSON.stringify(e.filters??[]),e.sortBy??"",e.sortDirection??""]}async function X(e,r){return await e.searchTokens(r)}function wr(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:z(e),queryFn:async()=>X(t,e),...r})}async function re(e,r){return await e.sendTx(r)}function br(e={}){let{client:r}=s();return reactQuery.useMutation({mutationFn:async t=>re(r,t),...e})}function ne(e){return ["stockTokens",e.chain,e.sortBy??"",e.sortDirection??"",JSON.stringify((e.keywords??[]).sort()),JSON.stringify((e.excludeKeywords??[]).sort()),JSON.stringify(e.filters??[])]}async function oe(e,{chain:r,...t}){return await e.getStockTokens(r,t)}function Br(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:ne(e),queryFn:async()=>oe(t,e),...r})}function ie(e){return ["swapRoute",e.chain,e.userAddress,e.input,e.output,e.mode,e.amount,e.slippage?`${e.slippage}`:"",e.priorityFee??"",e.tipFee??"",e.isAntiMev!==void 0?`${e.isAntiMev}`:""]}async function ae(e,r){return await e.swapRoute(r)}function _r(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:ie(e),queryFn:async()=>ae(t,e),...r})}function ce(e){return ["tokenCandles",e.chain,e.address,e.resolution,e.after?.toString()??"",e.before?.toString()??"",e.limit?`${e.limit}`:""]}async function le(e,{chain:r,address:t,resolution:n,...c}){return await e.getTokenCandles(r,t,n,c)}function $r(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:ce(e),queryFn:async()=>le(t,e),...r})}function ye(e){return ["tokenHolders",e.chain,e.address,e.cursor??"",e.limit?`${e.limit}`:"",e.direction??""]}async function me(e,{chain:r,address:t,...n}){return await e.getTokenHolders(r,t,n)}function jr(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:ye(e),queryFn:async()=>me(t,e),...r})}function Te(e){return ["tokenMarketData",e.chain,e.address]}async function fe(e,{chain:r,address:t}){return await e.getTokenMarketData(r,t)}function tt(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Te(e),queryFn:async()=>fe(t,e),...r})}function Pe(e){return ["token",e.chain,e.address]}async function ge(e,{chain:r,address:t}){return await e.getToken(r,t)}function at(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Pe(e),queryFn:async()=>ge(t,e),...r})}function pe(e){return ["tokenSecurity",e.chain,e.address]}async function Ae(e,{chain:r,address:t}){return await e.getTokenSecurity(r,t)}function yt(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:pe(e),queryFn:async()=>Ae(t,e),...r})}function Ce(e){return ["tokens",e.chain,e.addresses.sort().join(",")]}async function Ie(e,{chain:r,addresses:t}){return await e.getTokens(r,t)}function ht(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Ce(e),queryFn:async()=>Ie(t,e),...r})}function Ue(e){return ["tokenStats",e.chain,e.address]}async function Qe(e,{chain:r,address:t}){return await e.getTokenStats(r,t)}function At(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Ue(e),queryFn:async()=>Qe(t,e),...r})}function Oe(e){return ["tokenTradeActivities",e.chain,e.address,e.before?.toString()??"",e.after?.toString()??"",e.beforeBlockHeight?`${e.beforeBlockHeight}`:"",e.afterBlockHeight?`${e.afterBlockHeight}`:"",e.type??"",e.poolAddress??""]}async function be(e,{chain:r,address:t,...n}){return await e.getTokenTradeActivities(r,t,n)}function Ut(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Oe(e),queryFn:async()=>be(t,e),...r})}function Ee(e){return ["trendingTokens",e.chain,e.resolution,e.sortBy??"",e.sortDirection??"",JSON.stringify((e.keywords??[]).sort()),JSON.stringify((e.excludeKeywords??[]).sort()),JSON.stringify(e.filters??[])]}async function Me(e,{chain:r,resolution:t,...n}){return await e.getTrendingTokens(r,t,n)}function vt(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Ee(e),queryFn:async()=>Me(t,e),...r})}function Be(e){return ["txSuccess",e.chain,e.txHash,e.timeout?`${e.timeout}`:""]}async function Re(e,{chain:r,txHash:t,timeout:n}){return await e.checkTxSuccess(r,t,n)}function Rt(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Be(e),queryFn:async()=>Re(t,e),...r})}function Ke(e){return ["walletPortfolios",e.chain,e.address]}async function He(e,{chain:r,address:t}){return await e.getWalletPortfolios(r,t)}function Nt(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Ke(e),queryFn:async()=>He(t,e),...r})}function Ne(e){return ["walletTradeActivities",e.chain,e.address,e.before?.toString()??"",e.after?.toString()??"",e.beforeBlockHeight?`${e.beforeBlockHeight}`:"",e.afterBlockHeight?`${e.afterBlockHeight}`:"",e.type??"",e.poolAddress??""]}async function Ge(e,{chain:r,address:t,...n}){return await e.getWalletTradeActivities(r,t,n)}function Vt(e,r={}){let{client:t}=s();return reactQuery.useQuery({queryKey:Ne(e),queryFn:async()=>Ge(t,e),...r})}function i(e){switch(e){case types.Chain.ETHEREUM:return openapi.ChainSymbol.Eth;case types.Chain.POLYGON:return openapi.ChainSymbol.Polygon;case types.Chain.BINANCE:return openapi.ChainSymbol.Bsc;case types.Chain.ARBITRUM:return openapi.ChainSymbol.Arbitrum;case types.Chain.OPTIMISM:return openapi.ChainSymbol.Optimism;case types.Chain.AVALANCHE:return openapi.ChainSymbol.Avalanche;case types.Chain.BASE:return openapi.ChainSymbol.Base;case types.Chain.ZKSYNC_ERA:return openapi.ChainSymbol.Zksync;case types.Chain.SOLANA:return openapi.ChainSymbol.Sol}throw new Error(`Unsupported chain: ${e}`)}function x(e){switch(e){case "1s":return openapi.Resolution._1s;case "15s":return openapi.Resolution._15s;case "30s":return openapi.Resolution._30s;case "1m":return openapi.Resolution._1m;case "5m":return openapi.Resolution._5m;case "15m":return openapi.Resolution._15m;case "30m":case "1h":return openapi.Resolution._1h;case "4h":return openapi.Resolution._4h;case "12h":return openapi.Resolution._12h;case "24h":return openapi.Resolution._1d}}function T(e){switch(e){case "asc":return "ASC";case "desc":return "DESC"}}function C(e){switch(e){case "marketCap":return openapi.SearchSortByEnum.MarketCapInUsd;case "tvl":return openapi.SearchSortByEnum.LiquidityInUsd;case "price":return openapi.SearchSortByEnum.PriceInUsd;case "holders":return openapi.SearchSortByEnum.HolderCount;case "volumes24h":return openapi.SearchSortByEnum.H24VolumeInUsd;case "trades24h":return openapi.SearchSortByEnum.H24Transactions;case "createdAt":return openapi.SearchSortByEnum.TokenCreatedAt}throw new Error(`Unsupported search field: ${e}`)}function k(e){switch(e){case "price":return openapi.GetNewTokensSortByEnum.MarketDataPriceInUsd;case "priceChange1m":return openapi.GetNewTokensSortByEnum.StatsPriceChangeRatioInUsd1m;case "priceChange5m":return openapi.GetNewTokensSortByEnum.StatsPriceChangeRatioInUsd5m;case "priceChange1h":return openapi.GetNewTokensSortByEnum.StatsPriceChangeRatioInUsd1h;case "priceChange4h":return openapi.GetNewTokensSortByEnum.StatsPriceChangeRatioInUsd4h;case "priceChange24h":return openapi.GetNewTokensSortByEnum.StatsPriceChangeRatioInUsd24h;case "marketCap":return openapi.GetNewTokensSortByEnum.MarketDataMarketCapInUsd;case "tvl":return openapi.GetNewTokensSortByEnum.MarketDataTvlInUsd;case "top10Holdings":return openapi.GetNewTokensSortByEnum.MarketDataTop10TotalHoldings;case "top10Ratio":return openapi.GetNewTokensSortByEnum.MarketDataTop10HoldingsRatio;case "top100Holdings":return openapi.GetNewTokensSortByEnum.MarketDataTop100TotalHoldings;case "top100Ratio":return openapi.GetNewTokensSortByEnum.MarketDataTop100HoldingsRatio;case "holders":return openapi.GetNewTokensSortByEnum.MarketDataHolders;case "creatorsHoldings":return openapi.GetNewTokensSortByEnum.MarketDataCreatorHoldings;case "creatorsRatio":return openapi.GetNewTokensSortByEnum.MarketDataCreatorHoldingsRatio;case "buys1m":return openapi.GetNewTokensSortByEnum.StatsBuys1m;case "buys5m":return openapi.GetNewTokensSortByEnum.StatsBuys5m;case "buys15m":return openapi.GetNewTokensSortByEnum.StatsBuys15m;case "buys30m":return openapi.GetNewTokensSortByEnum.StatsBuys30m;case "buys1h":return openapi.GetNewTokensSortByEnum.StatsBuys1h;case "buys4h":return openapi.GetNewTokensSortByEnum.StatsBuys4h;case "buys24h":return openapi.GetNewTokensSortByEnum.StatsBuys24h;case "sells1m":return openapi.GetNewTokensSortByEnum.StatsSells1m;case "sells5m":return openapi.GetNewTokensSortByEnum.StatsSells5m;case "sells15m":return openapi.GetNewTokensSortByEnum.StatsSells15m;case "sells30m":return openapi.GetNewTokensSortByEnum.StatsSells30m;case "sells1h":return openapi.GetNewTokensSortByEnum.StatsSells1h;case "sells4h":return openapi.GetNewTokensSortByEnum.StatsSells4h;case "sells24h":return openapi.GetNewTokensSortByEnum.StatsSells24h;case "trades1m":return openapi.GetNewTokensSortByEnum.StatsTrades1m;case "trades5m":return openapi.GetNewTokensSortByEnum.StatsTrades5m;case "trades1h":return openapi.GetNewTokensSortByEnum.StatsTrades1h;case "trades4h":return openapi.GetNewTokensSortByEnum.StatsTrades4h;case "trades24h":return openapi.GetNewTokensSortByEnum.StatsTrades24h;case "traders1m":return openapi.GetNewTokensSortByEnum.StatsTraders1m;case "traders5m":return openapi.GetNewTokensSortByEnum.StatsTraders5m;case "traders1h":return openapi.GetNewTokensSortByEnum.StatsTraders1h;case "traders4h":return openapi.GetNewTokensSortByEnum.StatsTraders4h;case "traders24h":return openapi.GetNewTokensSortByEnum.StatsTraders24h;case "volumes1m":return openapi.GetNewTokensSortByEnum.StatsVolumesInUsd1m;case "volumes5m":return openapi.GetNewTokensSortByEnum.StatsVolumesInUsd5m;case "volumes1h":return openapi.GetNewTokensSortByEnum.StatsVolumesInUsd1h;case "volumes4h":return openapi.GetNewTokensSortByEnum.StatsVolumesInUsd4h;case "volumes24h":return openapi.GetNewTokensSortByEnum.StatsVolumesInUsd24h;case "createdAt":return openapi.GetNewTokensSortByEnum.TokenCreatedAt}throw new Error(`Unsupported sortBy: ${e}`)}function f(e){return e.filter(r=>["gt","gte","lt","lte","between"].indexOf(r.operator)>=0).map(r=>{let t={field:k(r.field)};return ["gt","gte","between"].indexOf(r.operator)>=0&&(t.min=typeof r.value=="number"?new utils.SafeBigNumber(r.value).toString():r.value),["lt","lte","between"].indexOf(r.operator)>=0&&(t.max=typeof r.value=="number"?new utils.SafeBigNumber(r.value).toString():r.value),t})}function Le(e){switch(e){case openapi.ChainSymbol.Eth:return types.Chain.ETHEREUM;case openapi.ChainSymbol.Polygon:return types.Chain.POLYGON;case openapi.ChainSymbol.Bsc:return types.Chain.BINANCE;case openapi.ChainSymbol.Arbitrum:return types.Chain.ARBITRUM;case openapi.ChainSymbol.Optimism:return types.Chain.OPTIMISM;case openapi.ChainSymbol.Avalanche:return types.Chain.AVALANCHE;case openapi.ChainSymbol.Base:return types.Chain.BASE;case openapi.ChainSymbol.Zksync:return types.Chain.ZKSYNC_ERA;case openapi.ChainSymbol.Sol:case "solana":return types.Chain.SOLANA}throw new Error(`Unsupported chain: ${e}`)}function We(e){return {address:e.address,share:e.share,isVerified:e.isVerified}}function d(e){return {chain:Le(e.chain),name:e.name,symbol:e.symbol,address:e.address,decimals:e.decimals,image:e.imageUrl,description:e.description,creators:e.tokenCreators?.map(We),launchedFrom:{programAddress:e.extra?.launchFromProgramAddress,protocolFamily:e.extra?.launchFromProtocolFamily},migrateProgress:e.marketData.completionRatio?new utils.SafeBigNumber(e.marketData.completionRatio).shiftedBy(2).toString():void 0,migratedTo:{programAddress:e.extra?.migratedToProgramAddress,protocolFamily:e.extra?.migratedToProtocolFamily,poolAddress:e.extra?.migratedToPoolAddress,migratedAt:e.extra?.migratedAt?new Date(e.extra.migratedAt):void 0},socialMedias:e.socialMedias?{...e.socialMedias}:void 0,stats:e.stats?S(e.stats):void 0,marketData:e.marketData?p(e.marketData):void 0,liquidities:e.liquidity?.map($e),createdAt:e.tokenCreatedAt?new Date(e.tokenCreatedAt):void 0}}function S(e){return {"1m":m(e,"1m"),"5m":m(e,"5m"),"15m":m(e,"15m"),"30m":m(e,"30m"),"1h":m(e,"1h"),"4h":m(e,"4h"),"24h":m(e,"24h")}}function m(e,r){switch(r){case "1m":case "5m":case "15m":case "30m":case "1h":case "4h":case "24h":return {buys:e[`buys${r}`],sells:e[`sells${r}`],trades:e[`trades${r}`],buyers:e[`buyers${r}`],sellers:e[`sellers${r}`],traders:e[`traders${r}`],buyVolumes:e[`buyVolumes${r}`],sellVolumes:e[`sellsVolumes${r}`],volumes:e[`volumes${r}`],buyVolumesInUsd:e[`buyVolumesInUsd${r}`],sellVolumesInUsd:e[`sellVolumesInUsd${r}`],volumesInUsd:e[`volumesInUsd${r}`],openPriceInUsd:e[`openPriceInUsd${r}`],closePriceInUsd:e[`closePriceInUsd${r}`],highPriceInUsd:e[`highInUsd${r}`],lowPriceInUsd:e[`lowInUsd${r}`],priceInUsd:e[`price${r}`],priceChange:e[`priceChangeRatioInUsd${r}`]};default:throw new Error(`Unsupported resolution: ${r}`)}}function $e(e){return {image:e.image,poolAddress:e.poolAddress,programAddress:e.programAddress,protocolFamily:e.protocolFamily,tvl:e.tvlInSol,tvlInUsd:e.tvlInUsd}}function p(e){return {totalSupply:e.totalSupply,marketCap:e.marketCapInSol,marketCapInUsd:e.marketCapInUsd,price:e.priceInSol,priceInUsd:e.priceInUsd,tvl:e.tvlInSol,tvlInUsd:e.tvlInUsd,holders:e.holders,creators:e.devTeamCount,creatorsHoldings:e.devTeamAmount,creatorsRatio:e.devTeamRatio,top10Holdings:e.top10TotalHoldings,top10Ratio:e.top10HoldingsRatio,top100Holdings:e.top100TotalHoldings,top100Ratio:e.top100HoldingsRatio}}function I(e){throw new Error("Method not implemented.")}function w(e){throw new Error("Method not implemented.")}function U(e){throw new Error("Method not implemented.")}function Q(e){throw new Error("Method not implemented.")}function D(e){throw new Error("Method not implemented.")}function O(e){throw new Error("Method not implemented.")}function b(e){throw new Error("Method not implemented.")}function v(e){throw new Error("Method not implemented.")}function E(e){throw new Error("Method not implemented.")}function A(e){throw new Error("Method not implemented.")}function M(e,r){throw new Error("Method not implemented.")}function F(e,r){throw new Error("Method not implemented.")}var B=class{constructor(r,t){this.accessToken=r;this.options=t;this._client=new sdk.DexClient(this.accessToken,this.options);}_client;async getToken(r,t){let n=await this._client.token.getToken({chain:i(r),tokenAddress:t});return d(n)}async getTokens(r,t){return (await this._client.token.getTokens({chain:i(r),tokenAddresses:t.join(",")})).map(d)}async getTokenCandles(r,t,n,c){return (await this._client.token.getCandles({chain:i(r),tokenAddress:t,resolution:x(n),from:c?.after?.getTime(),to:c?.before?.getTime(),limit:c?.limit})).map(I)}async getTokenSecurity(r,t){await this._client.token.getSecurity({chain:i(r),tokenAddress:t});return w()}async getTokenStats(r,t){let n=await this._client.token.getStats({chain:i(r),tokenAddress:t});return S(n)}async getTokenHolders(r,t,n){await this._client.token.getHolders({chain:i(r),tokenAddress:t,cursor:n?.cursor,limit:n?.limit,direction:n?.direction});return D()}async getTokenMarketData(r,t){let n=await this._client.token.getMarketData({chain:i(r),tokenAddress:t});return p(n)}async getNewTokens(r,t){return (await this._client.ranking.getNewTokens({chain:i(r),sortBy:t?.sortBy?k(t.sortBy):void 0,sortDirection:t?.sortDirection?T(t.sortDirection):void 0,rangeFilters:t?.filters?f(t.filters):void 0,launchpadPlatform:t?.filters?h(t.filters):void 0,searchKeywords:t?.keywords,excludeKeywords:t?.excludeKeywords})).map(d)}async getFinalStretchTokens(r,t){return (await this._client.ranking.getFinalStretchTokens({chain:i(r),sortBy:t?.sortBy?k(t.sortBy):void 0,sortDirection:t?.sortDirection?T(t.sortDirection):void 0,rangeFilters:t?.filters?f(t.filters):void 0,launchpadPlatform:t?.filters?h(t.filters):void 0,searchKeywords:t?.keywords,excludeKeywords:t?.excludeKeywords})).map(d)}async getMigratedTokens(r,t){return (await this._client.ranking.getMigratedTokens({chain:i(r),sortBy:t?.sortBy?k(t.sortBy):void 0,sortDirection:t?.sortDirection?T(t.sortDirection):void 0,rangeFilters:t?.filters?f(t.filters):void 0,launchpadPlatform:t?.filters?h(t.filters):void 0,searchKeywords:t?.keywords,excludeKeywords:t?.excludeKeywords})).map(d)}async getTrendingTokens(r,t,n){return (await this._client.ranking.getHotTokens({chain:i(r),duration:t,sortBy:n?.sortBy?k(n.sortBy):void 0,sortDirection:n?.sortDirection?T(n.sortDirection):void 0,rangeFilters:n?.filters?f(n.filters):void 0,launchpadPlatform:n?.filters?h(n.filters):void 0,searchKeywords:n?.keywords,excludeKeywords:n?.excludeKeywords})).map(d)}async getStockTokens(r,t){return (await this._client.ranking.getStocksTokens({chain:i(r),sortBy:t?.sortBy?k(t.sortBy):void 0,sortDirection:t?.sortDirection?T(t.sortDirection):void 0,rangeFilters:t?.filters?f(t.filters):void 0,launchpadPlatform:t?.filters?h(t.filters):void 0,searchKeywords:t?.keywords,excludeKeywords:t?.excludeKeywords})).map(d)}async searchTokens(r){await this._client.token.search({chains:r?.chains?.map(i),q:r?.keyword,limit:r?.limit,cursor:r?.cursor,sortBy:r?.sortBy?C(r.sortBy):void 0,sort:r?.sortDirection});return O()}async swapRoute(r){await this._client.dex.route({chain:i(r.chain),swapRouteInput:U()});return b()}async sendTx(r){await this._client.transaction.send({chain:i(r.chain),sendTxInput:Q()});return v()}async checkTxSuccess(r,t,n){let{result:c}=await this._client.waitForJob(t,n);return c.success}async getWalletPortfolios(r,t){await this._client.wallet.getBalance({chain:i(r),walletAddress:t});return E()}async getWalletTradeActivities(r,t,n){await this._client.trade.getTrades({chain:i(r),walletAddress:t,cursor:n?.cursor,limit:n?.limit,direction:n?.direction,beforeTimestamp:n?.before?.getTime(),afterTimestamp:n?.after?.getTime(),beforeBlockHeight:n?.beforeBlockHeight,afterBlockHeight:n?.afterBlockHeight,poolAddress:n?.poolAddress,type:n?.type?n.type.toUpperCase():void 0});return A()}async getTokenTradeActivities(r,t,n){await this._client.trade.getTrades({chain:i(r),tokenAddress:t,cursor:n?.cursor,limit:n?.limit,direction:n?.direction,beforeTimestamp:n?.before?.getTime(),afterTimestamp:n?.after?.getTime(),beforeBlockHeight:n?.beforeBlockHeight,afterBlockHeight:n?.afterBlockHeight,poolAddress:n?.poolAddress,type:n?.type?n.type.toUpperCase():void 0});return A()}async getPresignedUploadUrl(){return await this._client.ipfs.presign()}subscribeTokenBasic(r,t,n){throw new Error("Method not implemented.")}subscribeTokenMarketData(r,t,n){throw new Error("Method not implemented.")}subscribeTokenStats(r,t,n){throw new Error("Method not implemented.")}subscribeTokenCandles(r,t,n,c){throw new Error("Method not implemented.")}subscribeWalletPnl(r,t,n){throw new Error("Method not implemented.")}subscribeWalletPortfolios(r,t,n){throw new Error("Method not implemented.")}subscribeWalletPortfolioPnls(r,t,n){throw new Error("Method not implemented.")}subscribeWalletTradeActivities(r,t,n){throw new Error("Method not implemented.")}subscribeTokenTradeActivities(r,t,n){throw new Error("Method not implemented.")}subscribeNewTokens(r,t){return this._client.stream.subscribeNewToken({chain:i(r),callback:n=>t([M()])})}subscribeNewTokensBasic(r,t){return this._client.stream.subscribeNewTokensMetadata({chain:i(r),callback:n=>t(n.map(c=>F()))})}subscribeNewTokensMarketData(r,t){throw new Error("Method not implemented.")}subscribeNewTokensStats(r,t){throw new Error("Method not implemented.")}};function h(e){let r=e.find(t=>t.field==="launchedFromProtocolFamily");if(r){if(r.operator==="eq")return [r.value];if(r.operator==="in")return r.value}}function no({client:e,subscribeClient:r,children:t}){return jsxRuntime.jsx(P.Provider,{value:{client:e,subscribeClient:r},children:t})}exports.Client=B;exports.DexClientContext=P;exports.DexClientProvider=no;exports.fetchFinalStretchTokens=N;exports.fetchMigratedTokens=W;exports.fetchNewTokens=J;exports.fetchPresignedUploadUrl=Z;exports.fetchSearchTokens=X;exports.fetchStockTokens=oe;exports.fetchSwapRoute=ae;exports.fetchToken=ge;exports.fetchTokenCandles=le;exports.fetchTokenHolders=me;exports.fetchTokenMarketData=fe;exports.fetchTokenSecurity=Ae;exports.fetchTokenStats=Qe;exports.fetchTokenTradeActivities=be;exports.fetchTokens=Ie;exports.fetchTrendingTokens=Me;exports.fetchTxSuccess=Re;exports.fetchWalletPortfolios=He;exports.fetchWalletTradeActivities=Ge;exports.finalStretchTokensQueryKey=_;exports.migratedTokensQueryKey=L;exports.newTokensQueryKey=V;exports.searchTokensQueryKey=z;exports.sendTx=re;exports.stockTokensQueryKey=ne;exports.swapRouteQueryKey=ie;exports.tokenCandlesQueryKey=ce;exports.tokenHoldersQueryKey=ye;exports.tokenMarketDataQueryKey=Te;exports.tokenQueryKey=Pe;exports.tokenSecurityQueryKey=pe;exports.tokenStatsQueryKey=Ue;exports.tokenTradeActivitiesQueryKey=Oe;exports.tokensQueryKey=Ce;exports.trendingTokensQueryKey=Ee;exports.txSuccessQueryKey=Be;exports.useDexClient=s;exports.useFinalStretchTokensQuery=ir;exports.useMigratedTokensQuery=dr;exports.useNewTokensQuery=fr;exports.usePresignedUploadUrlQuery=pr;exports.useSearchTokensQuery=wr;exports.useSendTxMutation=br;exports.useStockTokensQuery=Br;exports.useSwapRouteQuery=_r;exports.useTokenCandlesQuery=$r;exports.useTokenHoldersQuery=jr;exports.useTokenMarketDataQuery=tt;exports.useTokenQuery=at;exports.useTokenSecurityQuery=yt;exports.useTokenStatsQuery=At;exports.useTokenTradeActivitiesQuery=Ut;exports.useTokensQuery=ht;exports.useTrendingTokensQuery=vt;exports.useTxSuccessQuery=Rt;exports.useWalletPortfoliosQuery=Nt;exports.useWalletTradeActivitiesQuery=Vt;exports.version=R;exports.walletPortfoliosQueryKey=Ke;exports.walletTradeActivitiesQueryKey=Ne;//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|